From 5bf05e7a47f1179bad5d31c3619667f3d2f4b3ec Mon Sep 17 00:00:00 2001 From: Ivan Prisyazhnyy Date: Fri, 23 Jun 2023 16:29:32 +0200 Subject: [PATCH] fix try_create_uring() probe release for ASAN ================================================================= ==93534==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7f676abad010 in thread T0 #0 0x7f677fedfdc2 in __interceptor_free /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52 #1 0x7f6776e81776 in operator() /home/sitano/Projects/seastar/src/core/reactor_backend.cc:1242 #2 0x7f6776e884a4 in ~deferred_action /home/sitano/Projects/seastar/include/seastar/util/defer.hh:67 #3 0x7f6776e82d31 in try_create_uring /home/sitano/Projects/seastar/src/core/reactor_backend.cc:1253 #4 0x7f6776e83e39 in detect_io_uring /home/sitano/Projects/seastar/src/core/reactor_backend.cc:1288 #5 0x7f6776e85113 in seastar::reactor_backend_selector::available() /home/sitano/Projects/seastar/src/core/reactor_backend.cc:2039 #6 0x7f67773be492 in seastar::reactor_options::reactor_options(seastar::program_options::option_group*) /home/sitano/Projects/seastar/src/core/reactor.cc:3782 #7 0x7f6776f04c32 in seastar::app_template::seastar_options::seastar_options() /home/sitano/Projects/seastar/src/core/app-template.cc:70 #8 0x7f6776f04040 in seastar_options_from_config /home/sitano/Projects/seastar/src/core/app-template.cc:58 #9 0x7f6776f0704f in seastar::app_template::app_template(seastar::app_template::config) /home/sitano/Projects/seastar/src/core/app-template.cc:108 #10 0x55a5ff597a6e in main /home/sitano/Projects/seastar/demos/hello-world.cc:30 #11 0x7f676f03984f (/usr/lib/libc.so.6+0x2384f) (BuildId: 2f005a79cd1a8e385972f5a102f16adba414d75e) #12 0x7f676f039909 in __libc_start_main (/usr/lib/libc.so.6+0x23909) (BuildId: 2f005a79cd1a8e385972f5a102f16adba414d75e) #13 0x55a5ff597614 in _start (/home/sitano/Projects/seastar/build/debug/demos/hello-world_demo+0xf0614) (BuildId: cbf8a43d1565f3bf0a48cdfb43a11ce16d7a9bc1) Address 0x7f676abad010 is a wild pointer inside of access range of size 0x000000000001. SUMMARY: AddressSanitizer: bad-free /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52 in __interceptor_free ==93534==ABORTING --- src/core/reactor_backend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/reactor_backend.cc b/src/core/reactor_backend.cc index 14792681d3d..5597e70f99a 100644 --- a/src/core/reactor_backend.cc +++ b/src/core/reactor_backend.cc @@ -1239,7 +1239,7 @@ try_create_uring(unsigned queue_len, bool throw_on_error) { maybe_throw(std::runtime_error("unable to create io_uring probe")); return std::nullopt; } - auto free_probe = defer([&] () noexcept { ::free(probe); }); + auto free_probe = defer([&] () noexcept { ::io_uring_free_probe(probe); }); for (auto op : required_ops) { if (!io_uring_opcode_supported(probe, op)) {