This is an archive of the discontinued LLVM Phabricator instance.

[GWP-ASan] Add version header.
ClosedPublic

Authored by hctim on Jul 23 2021, 10:50 AM.

Details

Summary

Adds magic version header to AllocatorState. This can be used by
out-of-process crash handlers, like Crashpad on Fuchsia, to do offline
reconstruction of GWP-ASan crash metadata.

Crashpad on Fuchsia is intending on dumping the AllocationMetadata pool
and the AllocatorState directly into the minidump. Then, using the
version number, they can unpack the data on serverside using a versioned
unpack tool.

Also add some asserts to make sure the version number gets bumped if the
internal structs get changed.

Diff Detail

Event Timeline

hctim created this revision.Jul 23 2021, 10:50 AM
hctim requested review of this revision.Jul 23 2021, 10:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2021, 10:50 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis accepted this revision.Jul 23 2021, 10:59 AM
eugenis added inline comments.
compiler-rt/lib/gwp_asan/common.h
29

do you really need ((packed)) here?

152

It does not sound impossible for the offsets to change on some targets only. Check aarch64, too?

This revision is now accepted and ready to land.Jul 23 2021, 10:59 AM
mcgrathr accepted this revision.Jul 23 2021, 1:37 PM

lgtm

compiler-rt/lib/gwp_asan/common.h
29

It should have no effect here.
You can static_assert(sizeof(AllocatorVersionMagic) == 8); to be extra sure about it.

hctim updated this revision to Diff 361772.Jul 26 2021, 1:17 PM
hctim marked 3 inline comments as done.

Addressing reviewer comments.

compiler-rt/lib/gwp_asan/common.h
29

Sure, done.

152

Without architecture-specific fields in these structs, I don't know how it would be possible unless there was an ABI change on that architecture.

I've added some more, but can you elaborate on a scenario in which this could happen for my understanding?

This revision was automatically updated to reflect the committed changes.