Page MenuHomePhabricator

Scudo tests with GWP-ASan.
AbandonedPublic

Authored by eugenis on Jan 10 2020, 4:08 PM.

Details

Reviewers
cryptoad
hctim
jfb
Summary

Run standalone scudo tests in both configurations (with and without
GWP-ASan). Add test-only support for deinitialization to GWP-ASan.

Diff Detail

Event Timeline

eugenis created this revision.Jan 10 2020, 4:08 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added subscribers: Restricted Project, mgorny. · View Herald Transcript

Unit tests: pass. 61768 tests passed, 0 failed and 780 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

I'm not sure this is a good idea after all.
We'd need to also bump sampling rate to 1 for reliable testing, and that does not work with scudo tests which specifically test the scudo implementation, and not a random posix-compliant allocator.

eugenis updated this revision to Diff 237472.Jan 10 2020, 6:54 PM

Removed scudo+gwp_asan tests.
Added fork support to gwp_asan and associated tests.

eugenis updated this revision to Diff 237473.Jan 10 2020, 6:55 PM

remove a ton of unrelated changes

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: diff.json, console-log.txt

This is meant to go on top of

https://reviews.llvm.org/D72470

with the cmake bits that disable GWP-ASan reverted.

Unit tests: pass. 61637 tests passed, 0 failed and 777 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

hctim added a comment.Jan 12 2020, 8:24 PM

Thanks for doing this.

compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
102

I'd prefer that this was part of init() (of course adding the restriction that malloc() works to init()), rather than have two separate steps to init GWP-ASan.

It's pretty easy for GWP-ASan for Scudo (just init in the post-init callback), bit more tricky for bionic. Both jemalloc_constructor and __libc_init_malloc are run as part of the init array (the latter via __libc_preinit. Might be able to delay GWP-ASan init until __libc_init, WDYT?

105

I don't think either of these functions should be static.

Other than that, can you add this comment?

These functions are exported for use in Android's `malloc_disable()`. Disabling the allocator will spinlock any threads attempting to allocate memory until `enable()` is called.
hctim added a comment.Jan 12 2020, 9:02 PM

Oh, also, would you mind please updating the commit message to mention that this change adds enable/disable support, and fork protections? Thanks!