Skip to content

Commit 9dfe5c1

Browse files
committed
test: test_bluefs_ex.cc - use after free bug
This test case calls exit() to terminiate a test mid flight to test recovery from crashes at different points in the code. However it does not stop threads before calling exit and consequently these threads can continue to access mempool structures that have gone out of scope and are freed by the exiting thread. The introduction of a unique_ptr into mempool causes these threads to assert when they access the freed memory. The simple fix is to call _exit instead of exit in the test case so that global destructors are not run. Signed-off-by: Bill Scales <[email protected]>
1 parent ea4a895 commit 9dfe5c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/objectstore/test_bluefs_ex.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class BlueFS_ex : virtual public ::testing::Test {
133133
conf.ApplyChanges();
134134

135135
auto stop_at_fixed_point = [&](uint32_t i) -> void {
136-
if (i == stop_point) exit(107);
136+
if (i == stop_point) _exit(107);
137137
};
138138
BlueFS fs(g_ceph_context);
139139
fs.tracepoint_async_compact = stop_at_fixed_point;

0 commit comments

Comments
 (0)