[PATCH] Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portable

Alexander Potapenko glider at google.com
Fri Apr 10 08:26:54 PDT 2015


LGTM with nits.


================
Comment at: lib/asan/asan_rtl.cc:300
@@ -299,2 +299,3 @@
 
 static void ProtectGap(uptr a, uptr size) {
+  void *res = MmapNoAccess(a, size);
----------------
The argument name "a" is meaningless, can you please fix?
(I know it was meaningless before)

================
Comment at: lib/sanitizer_common/sanitizer_posix.cc:202
@@ -201,3 +201,3 @@
 
-void *Mprotect(uptr fixed_addr, uptr size) {
+void *MmapNoAccess(uptr fixed_addr, uptr size) {
   return (void *)internal_mmap((void*)fixed_addr, size,
----------------
Why not return an uptr here?
IIRC the result of internal_mmap() is an uptr, which is cast to void* here, returned and then cast to an uptr by the callers of MmapNoAccess().

http://reviews.llvm.org/D8970

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






More information about the llvm-commits mailing list