[PATCH] D20084: [sanitizer] Initial implementation of a Hardened Allocator

Alexander Potapenko via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 10:18:31 PDT 2016


glider added inline comments.

================
Comment at: projects/compiler-rt/lib/hardened_allocator/scudo_malloc_linux.cc:15
@@ +14,3 @@
+#include "sanitizer_common/sanitizer_platform.h"
+#if SANITIZER_LINUX
+
----------------
filcab wrote:
> Don't add these to the whole file.
> I'm ok with protecting Linux/glibc-specific functions like `pvalloc`, etc. Those will need it anyway if this gets ported somewhere.
> No need to protect the `malloc`/`free` interceptors with `SANITIZER_LINUX`, though.
Note that for other systems (e.g. OSX) it may be incorrect to intercept malloc/free.
Therefore it should be ok to keep those in a Linux/FreeBSD-specific file and keep SANITIZER_LINUX | SANITIZER_FREEBSD for the whole file.

================
Comment at: projects/compiler-rt/lib/hardened_allocator/scudo_malloc_linux.cc:75
@@ +74,2 @@
+
+#endif
----------------
It's better to add comments (e.g. "  // SANITIZER_LINUX" here) to #endif directives, especially when the code doesn't fit on a single screen.


http://reviews.llvm.org/D20084





More information about the llvm-commits mailing list