[LLVMbugs] [Bug 13794] New: AddressSanitizer should detect and warn if MallocGuardEdges env var is on

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 7 14:17:11 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13794

             Bug #: 13794
           Summary: AddressSanitizer should detect and warn if
                    MallocGuardEdges env var is on
           Product: new-bugs
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sean at rogue-research.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


On Mac OS X, there is a system environment variable called MallocGuardEdges. 
'man malloc' describes it thusly:

  "If set, add a guard page before and after each large block"

We had ASan working in toy apps, but it took us quite a while to figure out why
it was failing with our large projects, and it was because he had this env var
set as part of our standard debugging settings.

If would be a nice piece of finesse if, at runtime, you detect if this env var
is set and print a big error message.  Might save some other people some hours.
:)

$ MallocGuardEdges=1 ./boom

boom(7300) malloc: protecting edges
==7300== AddressSanitizer CHECK failed:
/Users/alex/external/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:274
"((!asan_init_is_running)) != (0)" (0x0, 0x0)
Stats: 0M malloced (0M for red zones) by 0 calls
Stats: 0M realloced by 0 calls
Stats: 0M freed by 0 calls
Stats: 0M really freed by 0 calls
Stats: 0M (0 full pages) mmaped in 0 calls
  mmaps   by size class: 
  mallocs by size class: 
  frees   by size class: 
  rfrees  by size class: 
Stats: malloc large: 0 small slow: 0

(MallocGuardEdges is much less capable than ASan, so I don't care that they
don't work together, I'm just asking that I be warned.)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list