[PATCH] D60593: [GwpAsan] Introduce GWP-ASan.
Matt Morehouse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 08:56:26 PDT 2019
morehouse added inline comments.
================
Comment at: compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp:213
+ return 0;
+ else if (Ptr > GetGuardedPagePoolEnd() - PageSize)
+ return NumGuardedSlots - 1;
----------------
vlad.tsyrklevich wrote:
> morehouse wrote:
> > Nit: else is unnecessary.
> I believe it's required for the case when the OOB access happens in the second half of the last guard page.
Right, the `if` seems necessary. What I meant was:
```
if (X) return;
else if(Y) doSomething();
```
is always equivalent to
```
if (X) return;
if (Y) doSomething();
```
================
Comment at: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h:162
+ // slots are available.
+ bool reserveSlot(std::size_t *PageIndex);
+
----------------
vlad.tsyrklevich wrote:
> morehouse wrote:
> > `ssize_t reserveSlot()` seems cleaner to me. Also the function comment could be reworded clearer.
> I think this is because it's modeled on my implementation since with my design I reserve slots/metadata indices separately.
With `ssize_t` return value, we can still detect failure (-1) while not having to pass a return param. What's the benefit of the current setup?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60593/new/
https://reviews.llvm.org/D60593
More information about the llvm-commits
mailing list