[LLVMbugs] [Bug 10431] New: Optionally mark memory undefined/noaccess for valgrind on entering/leaving stack frames

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 21 00:26:11 PDT 2011


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

           Summary: Optionally mark memory undefined/noaccess for valgrind
                    on entering/leaving stack frames
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu


It would be nice if there were an option to emit Valgrind's magic sequences
saying that a new stack frame has undefined contents and that a just-exited
stack frame is inaccessible.

The sequences are documented at
http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq
and http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs.

It probably makes the most sense to use VALGRIND_MALLOCLIKE_BLOCK() for
entering a frame and VALGRIND_FREELIKE_BLOCK() for leaving a frame, but
VALGRIND_MAKE_MEM_UNDEFINED() and VALGRIND_MAKE_MEM_NOACCESS() might make more
sense for programs that might use longjmp. This is a point midway between doing
nothing and turning on asan or safecode, since it costs ~11 instructions (on
x86-64) at the beginning and end of each function but allows full valgrind to
catch more errors than it otherwise would.

These sequences should be safe to embed into LLVM since they're designed to be
compiled into lots of client programs.

-- 
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