-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
If I modify the cxx standard to set(CMAKE_CXX_STANDARD 23) I get an address sanitizer error:
% cmake -GNinja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Debug -DQUICKPOOL_TEST_SANITIZE=1 .. && ninja && ./quickpool_test
* [quickpool] lock free: yes
=================================================================
==98234==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6230000000f8 at pc 0x0001042549f4 bp 0x00016bbc9010 sp 0x00016bbc9008
READ of size 8 at 0x6230000000f8 thread T0
#0 0x1042549f0 in quickpool::mem::aligned::free(void*) quickpool.hpp:145
#1 0x1042548a4 in quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>::deallocate(quickpool::sched::TaskQueue*, unsigned long) quickpool.hpp:186
#2 0x10425057c in std::__1::allocator_traits<quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::deallocate[abi:ne180100](quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>&, quickpool::sched::TaskQueue*, unsigned long) allocator_traits.h
:289
#3 0x10425021c in std::__1::vector<quickpool::sched::TaskQueue, quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::__destroy_vector::operator()[abi:ne180100]() vector:492
#4 0x1042560d8 in std::__1::vector<quickpool::sched::TaskQueue, quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::~vector[abi:ne180100]() vector:501
#5 0x1042497dc in std::__1::vector<quickpool::sched::TaskQueue, quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::~vector[abi:ne180100]() vector:501
#6 0x10425845c in quickpool::sched::TaskManager::~TaskManager() quickpool.hpp:558
#7 0x10424906c in quickpool::sched::TaskManager::~TaskManager() quickpool.hpp:558
#8 0x1042408a0 in quickpool::ThreadPool::set_active_threads(unsigned long) quickpool.hpp:849
#9 0x104248ddc in quickpool::ThreadPool::ThreadPool(unsigned long) quickpool.hpp:805
#10 0x1042390d8 in quickpool::ThreadPool::ThreadPool(unsigned long) quickpool.hpp:804
#11 0x104248cdc in quickpool::ThreadPool::global_instance() quickpool.hpp:828
#12 0x104238d24 in void quickpool::push<main::$_0, unsigned long&>(main::$_0&&, unsigned long&) quickpool.hpp:1021
#13 0x104232994 in main test.cpp:23
#14 0x195ccc270 (<unknown module>)
0x6230000000f8 is located 8 bytes before 6400-byte region [0x623000000100,0x623000001a00)
allocated by thread T0 here:
#0 0x104ca1df8 in __sanitizer_mz_memalign+0x9c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x55df8)
#1 0x195e86ecc in _malloc_zone_memalign+0x138 (libsystem_malloc.dylib:arm64e+0x2fecc)
#2 0x195e73bd4 in _malloc_type_aligned_alloc_outlined+0x68 (libsystem_malloc.dylib:arm64e+0x1cbd4)
#3 0x19600945c in operator new(unsigned long, std::align_val_t)+0x4c (libc++abi.dylib:arm64e+0x1745c)
#4 0x104246558 in void* std::__1::__libcpp_operator_new[abi:ne180100]<unsigned long, std::align_val_t>(unsigned long, std::align_val_t) new:303
#5 0x1042464ec in std::__1::__libcpp_allocate[abi:ne180100](unsigned long, unsigned long) new:322
#6 0x10424cb84 in std::__1::allocator<quickpool::sched::TaskQueue>::allocate[abi:ne180100](unsigned long) allocator.h:125
#7 0x10424c964 in std::__1::allocator<quickpool::sched::TaskQueue>::allocate_at_least[abi:ne180100](unsigned long) allocator.h:131
#8 0x10424c71c in std::__1::allocation_result<std::__1::allocator_traits<quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::pointer> std::__1::allocate_at_least[abi:ne180100]<quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>(quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>&, unsigned long) allocate_at_least.h:34
#9 0x10424bdd4 in auto std::__1::__allocate_at_least[abi:ne180100]<quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>(quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>&, unsigned long) allocate_at_least.h:42
#10 0x10424a2e8 in std::__1::vector<quickpool::sched::TaskQueue, quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::__vallocate[abi:ne180100](unsigned long) vector:741
#11 0x104249b74 in std::__1::vector<quickpool::sched::TaskQueue, quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::vector(unsigned long) vector:1121
#12 0x1042492a0 in std::__1::vector<quickpool::sched::TaskQueue, quickpool::mem::aligned::allocator<quickpool::sched::TaskQueue, 64ul>>::vector(unsigned long) vector:1118
#13 0x1042490fc in quickpool::sched::TaskManager::TaskManager(unsigned long) quickpool.hpp:562
#14 0x104248e8c in quickpool::sched::TaskManager::TaskManager(unsigned long) quickpool.hpp:565
#15 0x104248db4 in quickpool::ThreadPool::ThreadPool(unsigned long) quickpool.hpp:803
#16 0x1042390d8 in quickpool::ThreadPool::ThreadPool(unsigned long) quickpool.hpp:804
#17 0x104248cdc in quickpool::ThreadPool::global_instance() quickpool.hpp:828
#18 0x104238d24 in void quickpool::push<main::$_0, unsigned long&>(main::$_0&&, unsigned long&) quickpool.hpp:1021
#19 0x104232994 in main test.cpp:23
#20 0x195ccc270 (<unknown module>)
SUMMARY: AddressSanitizer: heap-buffer-overflow quickpool.hpp:145 in quickpool::mem::aligned::free(void*)Clang 16.0.0 on macOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels