[PATCH] Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library

Kostya Serebryany kcc at google.com
Tue May 19 14:05:18 PDT 2015


================
Comment at: lib/safestack/safestack.cc:20
@@ +19,3 @@
+#include <limits.h>
+#include <sys/mman.h>
+#include <sys/user.h>
----------------
Please check if you still need so many headers. Remove anything you don't need. 

================
Comment at: lib/safestack/safestack.cc:64
@@ +63,3 @@
+  void *addr = MmapOrDie(size + guard, "unsafe_stack_alloc");
+  if (addr == MAP_FAILED)
+    return nullptr;
----------------
MmapOrDie dies if it fails. You should not need the check

================
Comment at: lib/safestack/safestack.cc:83
@@ +82,3 @@
+  if (unsafe_stack_start) {
+    // We need the munmap system call without any LD_PRELOAD overrides
+    // (such overrides might crash if they use the unsafe stack themselves)
----------------
do you still need this comment? 

================
Comment at: test/safestack/check-pthread-cleanup.c:10
@@ +9,3 @@
+
+#define BUFFER_SIZE (1 << 15)
+
----------------
kBufferSize

http://reviews.llvm.org/D6096

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list