This is an archive of the discontinued LLVM Phabricator instance.

tsan: increase dense slab alloc capacity
ClosedPublic

Authored by dvyukov on Apr 23 2021, 6:52 AM.

Details

Summary

We've got a user report about heap block allocator overflow.
Bump the L1 capacity of all dense slab allocators to maximum
and be careful to not page the whole L1 array in from .bss.
If OS uses huge pages, this still may cause a limited RSS increase
due to boundary huge pages, but avoiding that looks hard.

Diff Detail

Event Timeline

dvyukov created this revision.Apr 23 2021, 6:52 AM
dvyukov requested review of this revision.Apr 23 2021, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2021, 6:52 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
kda added a subscriber: kda.Apr 23 2021, 11:12 AM
vitalybuka accepted this revision.Apr 26 2021, 1:55 PM
vitalybuka added inline comments.
compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
41–42

checks can be replaced with static_asserts

63
freelist_ = 0;     fillpos_ = 0; should be moved here?
This revision is now accepted and ready to land.Apr 26 2021, 1:55 PM
vitalybuka added inline comments.Apr 26 2021, 1:57 PM
compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
63

nevermind, either way is fine, it's just internal_memset which must be here

dvyukov updated this revision to Diff 340753.Apr 27 2021, 1:16 AM

Changed CHECK's to static_assert's.

dvyukov marked an inline comment as done.Apr 27 2021, 1:17 AM

PTAL

compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
63

Yes, that was the intention. Not sure what option is better.
memset needs to be here, for other fields I decided to be more explicit and safe.

vitalybuka accepted this revision.Apr 28 2021, 1:46 PM
This revision was landed with ongoing or failed builds.Apr 28 2021, 10:34 PM
This revision was automatically updated to reflect the committed changes.