Created attachment 15602 [details] reproducer This problem was detected while creating new tests to enhance aligned_alloc/calloc/malloc test coverage (https://patchwork.sourceware.org/project/glibc/list/?series=35824) A simplified reproducer is attached. gcc -o threaded-malloc-free threaded-malloc-free.c ; ./threaded-malloc-free; echo $? 0 valgrind --tool=memcheck ./threaded-malloc-free ==3433528== Memcheck, a memory error detector ==3433528== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==3433528== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info ==3433528== Command: ./threaded-malloc-free ==3433528== ==3433528== ==3433528== HEAP SUMMARY: ==3433528== in use at exit: 0 bytes in 0 blocks ==3433528== total heap usage: 131,147 allocs, 131,147 frees, 134,242,488 bytes allocated ==3433528== ==3433528== All heap blocks were freed -- no leaks are possible ==3433528== ==3433528== For lists of detected and suppressed errors, rerun with: -s ==3433528== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) gcc -o threaded-malloc-free threaded-malloc-free.c -lmcheck LD_PRELOAD=/lib64/libc_malloc_debug.so.0 ./threaded-malloc-free; echo $? memory clobbered before allocated block memory clobbered before allocated block Aborted (core dumped) 134
Looks like a de-facto duplicate of bug 9939 to me. We don't do the problematic hook updates anymore, but there's still no lock protecting the allocation list in malloc/mcheck-impl.c.