Adds a new allocation API to GWP-ASan that handles size+alignment
restrictions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/gwp_asan/optional/backtrace.h | ||
---|---|---|
18 ↗ | (On Diff #317080) | unrelated comment |
compiler-rt/lib/gwp_asan/tests/harness.h | ||
38 ↗ | (On Diff #317080) | extra new line |
compiler-rt/lib/scudo/scudo_allocator.cpp | ||
321 ↗ | (On Diff #317080) | split hooks into a separate commit, or at least mention them in the message |
compiler-rt/lib/scudo/standalone/combined.h | ||
501 ↗ | (On Diff #317080) | another unrelated change |
I'm looking into some cmake magic to also run the scudo-standalone tests using GWP_ASAN_OPTIONS=MaxSimultaneousAllocations=10000:SampleRate=1 as well, but it's taking some time... :(.
compiler-rt/lib/scudo/standalone/combined.h | ||
---|---|---|
501 ↗ | (On Diff #317080) | added details to the commit message |
Address reviewer comments.
Change the API to take an alignment, not a 'size' and 'real size' paramater. This way, GWP-ASan can use its own alignment guarantees (page alignment).
Needs a little bit more WIP to get the alignment tighter.
Removed Scudo bits for now, made this GWP-ASan specific. Changes to scudo will come in a follow-up patch.
compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp | ||
---|---|---|
157 | Note to reviewers: Please check my logic here. This specifically helps with the case where we have a 0x4000 byte slot, and we ask for a 0x1 byte allocation with 0x4000 alignment - this allocation can obviously be resident. |
Accidentally committed this in 9dc06762470cb5a6cde8de5833cb75262e1bacb0, and reverted it in 0dcf3324cfb4429e85b54e857f9bb86f423ffc5e. This is still needing review.
LGTM with a nit
getAlignedPtr is very unclear to me, and the 3rd argument is always const anyway!
compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp | ||
---|---|---|
157 | this looks correct | |
218 | alignUp(SlotStart, Alignment) (add a helper function if we don;t have that in gwp-asan yet) | |
221 | alignDown(SlotEnd - Size, Alignment) |
nit: capital X