This is an archive of the discontinued LLVM Phabricator instance.

[gwp-asan] Initialize AllocatorVersionMagic at runtime
ClosedPublic

Authored by cryptoad on Sep 27 2021, 12:32 PM.

Details

Summary

GWP-ASan's AllocatorState was recently extended with a
AllocatorVersionMagic structure required so that GWP-ASan bug reports
can be understood by tools at different versions.

On Fuchsia, this in included in the scudo::Allocator structure, and
by having non-zero initializers, this effectively moved the static
allocator structure from the .bss segment to the .data segment, thus
increasing (significantly) the size of the libc.

This CL proposes to initialize the structure with its magic numbers at
runtime, allowing for the allocator to go back into the .bss segment.

I will work on adding a test on the Scudo side to ensure that this type
of changes get detected early on. Additional work is also needed to
reduce the footprint of the (large) memory-tagging related structures
that are currently part of the allocator.

Diff Detail

Event Timeline

cryptoad created this revision.Sep 27 2021, 12:32 PM
cryptoad requested review of this revision.Sep 27 2021, 12:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2021, 12:32 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
hctim added inline comments.Sep 27 2021, 1:14 PM
compiler-rt/lib/gwp_asan/common.h
44

Can you hoist these inside the struct (next to their declarations), and add a note that the values are copied into the struct at runtime, during GuardedPoolAllocator::initialize() so that GWP-ASan remains completely in the .bss segment?

cryptoad updated this revision to Diff 375394.Sep 27 2021, 1:43 PM
cryptoad marked an inline comment as done.

Addressing Mitch's request.

hctim accepted this revision.Sep 27 2021, 1:44 PM

LGTM

This revision is now accepted and ready to land.Sep 27 2021, 1:44 PM
This revision was landed with ongoing or failed builds.Sep 27 2021, 1:50 PM
This revision was automatically updated to reflect the committed changes.