[compiler-rt] r211713 - [ASan] When iterating over segments on OSX, treat the segments' initial

Alexander Potapenko glider at google.com
Wed Jun 25 08:43:19 PDT 2014


Author: glider
Date: Wed Jun 25 10:43:19 2014
New Revision: 211713

URL: http://llvm.org/viewvc/llvm-project?rev=211713&view=rev
Log:
[ASan] When iterating over segments on OSX, treat the segments' initial
protection level as their current protection level.
This fixes the UNIMPLEMENTED check that started to fire on OSX after r210649.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_mac.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_mac.cc?rev=211713&r1=211712&r2=211713&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_mac.cc Wed Jun 25 10:43:19 2014
@@ -75,14 +75,16 @@ template<u32 kLCSegment, typename Segmen
 bool MemoryMappingLayout::NextSegmentLoad(
     uptr *start, uptr *end, uptr *offset,
     char filename[], uptr filename_size, uptr *protection) {
-  if (protection)
-    UNIMPLEMENTED();
   const char* lc = current_load_cmd_addr_;
   current_load_cmd_addr_ += ((const load_command *)lc)->cmdsize;
   if (((const load_command *)lc)->cmd == kLCSegment) {
     const sptr dlloff = _dyld_get_image_vmaddr_slide(current_image_);
     const SegmentCommand* sc = (const SegmentCommand *)lc;
     if (start) *start = sc->vmaddr + dlloff;
+    if (protection) {
+      // Return the initial protection.
+      *protection = sc->initprot;
+    }
     if (end) *end = sc->vmaddr + sc->vmsize + dlloff;
     if (offset) {
       if (current_filetype_ == /*MH_EXECUTE*/ 0x2) {





More information about the llvm-commits mailing list