[PATCH] Memory protection in sanitizer_procmaps.h

Sergey Matveev earthdok at google.com
Tue Mar 12 10:42:12 PDT 2013



================
Comment at: lib/sanitizer_common/sanitizer_procmaps.h:22
@@ -21,1 +21,3 @@
 
+const uptr kProtectionRead = 1;
+const uptr kProtectionWrite = 2;
----------------
Alexey Samsonov wrote:
> Can you move it into MemoryMappingLayout class?
Done.

================
Comment at: lib/msan/msan.cc:76
@@ -75,3 +75,3 @@
   while (proc_maps.Next(/* start */0, /* end */0, /* file_offset */0,
-                        filename, kBufSize)) {
+                        filename, kBufSize, /* protection */0)) {
     if (internal_strstr(filename, "libdynamorio") != 0) {
----------------
Alexander Potapenko wrote:
> I think it's fine to omit the spaces around the variable names like it's done in other files below.
Unfortunately there's no consistency across different source files, so I'm sticking to whatever style is preferred in the current module.

================
Comment at: lib/sanitizer_common/sanitizer_procmaps.h:73
@@ -65,2 +72,3 @@
     uptr start, end, file_offset;
-    for (int i = 0; Next(&start, &end, &file_offset, filename, filename_size);
+    for (int i = 0; Next(&start, &end, &file_offset, filename, filename_size,
+                         protection);
----------------
Alexander Potapenko wrote:
> Won't a while-loop fit better here?
I'd rather not refactor existing code that works, considering that there aren't any tests for this module.


http://llvm-reviews.chandlerc.com/D470



More information about the llvm-commits mailing list