[libcxx-commits] [libcxx] [libcxx] Align `__recommend() + 1` by __endian_factor (PR #90292)
Aliaksiej Kandracienka via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 7 13:29:49 PDT 2024
alk wrote:
Hi. I came here via https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279560. This fix is not "just" about unbreaking some asan flag flip. It fixes real bug.
I.e. sized deallocation is intended to be a performance feature where memory allocator is given original allocation size. For ~most modern allocators (e.g. both versions of tcmalloc, jemalloc, mimalloc and perhaps more) this lets them obtain allocation's size-class directly from size rather than looking it up in some metadata. It saves cycles. With libc++ lying about the size, it is inviting the difficult to diagnose crashing bug.
I see that libc++-18 as shipped by Debian has this bug. libc++-17 and earlier appears to be fine (although I only did fairly simple test: https://paste.debian.net/hidden/8edbffc1/).
>From what I see, https://github.com/llvm/llvm-project/commits/release/18.x/ is your llvm/libc++ 18 release branch and I don't see this fix backported there. Can someone make sure it is cherry-picked?
BTW do I guess correctly that Google's internal codebase (which definitely runs on -fsized-deallocation) didn't catch this because Google runs on alternative string abi layout thingy? Otherwise, I'd be worried how come this wasn't caught much sooner.
https://github.com/llvm/llvm-project/pull/90292
More information about the libcxx-commits
mailing list