[PATCH] D60593: [GwpAsan] Introduce GWP-ASan.

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 16:38:42 PDT 2019


vlad.tsyrklevich added inline comments.


================
Comment at: compiler-rt/lib/gwp_asan/options.inc:21
+GWP_ASAN_OPTION(
+    bool, PerfectlyRightAlign, false,
+    "When allocations are right-aligned, should we perfectly align them up to "
----------------
morehouse wrote:
> malloc is required to return memory that is "suitably aligned".  Won't perfect right alignment violate this?
> 
> E.g.,
> ```
> uint8_t *buf = malloc(5);
> // ... Copy some data into buf ...
> uint32_t *word = (uint32_t *) buf;
> *word += buf[4];
> ```
> 
> I think if malloc right-aligns, some processors would fail to load the 32-bit word on the last line.
I think it's a useful option on platforms that do support unaligned access (Intel, ARM >= v7). We've heard that this was useful with PageHeap for finding small OOB accesses, though obviously perf characteristics from using this option will vary significantly depending on the application.


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