In http://reviews.llvm.org/D19100, I introduced a bug: On OS X, existing programs rely on malloc_size() to detect whether a pointer comes from heap memory (malloc_size returns non-zero) or not. We have to distinguish between a zero-sized allocation (where we need to return 1 from malloc_size, due to other binary compatibility reasons, see http://reviews.llvm.org/D19100), and pointers that are not returned from malloc at all.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/tsan/rtl/tsan_mman.cc | ||
---|---|---|
167 ↗ | (On Diff #55395) | this changes behavior on all platforms, not only Mac, right? Is it intended? |
lib/tsan/rtl/tsan_mman.cc | ||
---|---|---|
167 ↗ | (On Diff #55395) | Correct, this changes all platforms. It is intended, I should have said that in the original description. At least on Linux, malloc_usable_size also returns non-zero value for a zero-sized allocation, I guess other platforms behave the same. Running under TSan shouldn't change that to avoid breaking compatibility. |