This is an archive of the discontinued LLVM Phabricator instance.

[Scudo] [GWP-ASan] Add GWP-ASan to Scudo Standalone.
ClosedPublic

Authored by hctim on Dec 9 2019, 2:40 PM.

Details

Summary

Adds GWP-ASan to Scudo standalone. Default parameters are pulled across from the
GWP-ASan build. No backtrace support as of yet.

Event Timeline

hctim created this revision.Dec 9 2019, 2:40 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 9 2019, 2:40 PM
Herald added subscribers: llvm-commits, Restricted Project, mgorny. · View Herald Transcript
pcc added a reviewer: pcc.Dec 9 2019, 3:00 PM
pcc added inline comments.
compiler-rt/lib/scudo/standalone/combined.h
514–528

I think you might need to sync to LLVM trunk. There is now a function isOwned here which I think might need to be taught about GWP-ASan.

Thanks!
What's the current plan for testing? (Currently I have only enabled the standalone on Linux x86/64 for upstream)

compiler-rt/lib/scudo/standalone/combined.h
342

Since there is no other size_t in combined, could you use a uptr?

498

Could you also please modify isOwned with a GWP check?

hctim marked 3 inline comments as done.Dec 9 2019, 4:37 PM
hctim updated this revision to Diff 232959.Dec 9 2019, 4:37 PM
  • Synced to master, added isOwned and /s/size_t/uptr.
hctim added a comment.Dec 9 2019, 4:39 PM

What's the current plan for testing? (Currently I have only enabled the standalone on Linux x86/64 for upstream)

I'd love to be able to test the current GWP-ASan tests using scudo_standalone as well. Unfortunately it won't be as simple as -fsanitize=scudo, but will take a look at getting it running with some linker magic.

cryptoad added inline comments.Dec 10 2019, 8:59 AM
compiler-rt/lib/scudo/standalone/combined.h
520

#ifdef GWP_ASAN_HOOKS?

hctim marked 2 inline comments as done.Dec 10 2019, 9:29 AM
hctim added inline comments.
compiler-rt/lib/scudo/standalone/combined.h
520

Danke.

hctim updated this revision to Diff 233129.Dec 10 2019, 9:30 AM
hctim marked an inline comment as done.
  • Guard isOwned behind macro.
cryptoad accepted this revision.Dec 10 2019, 9:36 AM
This revision is now accepted and ready to land.Dec 10 2019, 9:36 AM
hctim updated this revision to Diff 233237.Dec 10 2019, 5:15 PM
  • Enforce alignment to GWP-ASan. If userspace calls posix_memalign, this alignment guarantee should be kept even if the allocation is chosen to be sampled.

Build result: pass - 60660 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt, CMakeCache.txt

This revision was automatically updated to reflect the committed changes.