[PATCH] D63736: [GWP-ASan] Guard against recursive allocs. Pack TLS for perf.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 16:54:29 PDT 2019


hctim added a comment.

In D63736#1556534 <https://reviews.llvm.org/D63736#1556534>, @eugenis wrote:

> We can not assume that the unwinder is reentrant, so we need to guard all unwinder calls. We can not really fallback to the system allocator in free(), which means that the rest of the deallocation code will have to be reentrant.


So in summary:

- The unwinder can call any combination of `malloc()`, `free()`, in any way/shape/form it wants. The unwinder is assumed to not be reentrant.
- `GPA::allocate()` will automatically fallback to the default allocator if it detects reentrant behaviour.
- `GPA::deallocate()` has no way to fallback (as it must deallocate any guarded allocations). In this case, we have to avoid reentrant calls to `deallocate()`, and so we never call the unwinder recursively.

SGTY?

Also, we don't want to place the reentrant-guard around the entirety of `RecordDeallocation()` (as then the slot won't be marked as deallocated in the metadata). The ScopedBool has to wrap the call to the unwinder only, and therefore must be in a follow up patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63736





More information about the llvm-commits mailing list