[PATCH] D72546: Scudo tests with GWP-ASan.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 20:30:29 PST 2020


hctim added a comment.

Thanks for doing this.



================
Comment at: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h:102
+  // Initialize parts of GWP-ASan that require functional underlying malloc().
+  static void setupForFork();
+  void uninitTestOnly();
----------------
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?


================
Comment at: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h:105
+
+  static void disable();
+  static void enable();
----------------
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.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72546/new/

https://reviews.llvm.org/D72546





More information about the llvm-commits mailing list