[PATCH] D44705: [HWASan] Port HWASan to Linux x86-64 (compiler-rt)

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 16:44:04 PDT 2018


eugenis accepted this revision.
eugenis added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/hwasan/hwasan.cc:257
+  (void)p;
+  // 0x900 is added as a safeguard, to help distinguish our trap from others.
+  asm("brk %0\n\t" ::"n"(0x900 + X));
----------------
It's actually added because the kernel has other plans for low values of brk immediate.


================
Comment at: lib/hwasan/hwasan.cc:268
+      "nopl %c0(%%rax)\n"
+      :: "n"(0x40 + X), "D"(p));
 #else
----------------
We could do the same thing with assembly constraint in aarch64 branch to put the pointer in x0. Let's not touch that code for now, but please add a FIXME.


================
Comment at: lib/hwasan/hwasan_linux.cc:214
+  // which are interpreted as log2(access_size), and 0xF, which means that
+  // access size is in RSI. Access address is always in RDI.
+  uptr pc = (uptr)uc->uc_mcontext.gregs[REG_RIP];
----------------
This is mostly a copy of the comment above. Please factor out the common part.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D44705





More information about the llvm-commits mailing list