PERFORCE change 168130 for review

Stanislav Sedov stas at FreeBSD.org
Thu Sep 3 22:00:32 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=168130

Change 168130 by stas at stas_orion on 2009/09/03 21:59:37

	- Track changes in the address space by implementing mprotect(2) handler.
	  This fixes excessive FP in memchek on HEAD.

Affected files ...

.. //depot/projects/valgrind/memcheck/mc_main.c#4 edit

Differences ...

==== //depot/projects/valgrind/memcheck/mc_main.c#4 (text+ko) ====

@@ -1606,7 +1606,6 @@
    make_mem_undefined_w_tid_and_okind ( a, len, tid, MC_OKIND_UNKNOWN );
 }
 
-
 void MC_(make_mem_defined) ( Addr a, SizeT len )
 {
    PROF_EVENT(42, "MC_(make_mem_defined)");
@@ -1636,6 +1635,15 @@
    }
 }
 
+/* Track changes in the virtual memory space. */
+static void track_perms_change( Addr a, SizeT len,
+                      Bool rr, Bool ww, Bool xx )
+{
+   if (!(rr || ww))
+      MC_(make_mem_noaccess) ( a, len );
+   MC_(make_mem_defined) ( a, len );
+}
+
 
 /* --- Block-copy permissions (needed for implementing realloc() and
        sys_mremap). --- */
@@ -5806,7 +5814,7 @@
    // happen if the program catches the signal, though, which is bad.  If we
    // had two A bits (for readability and writability) that were completely
    // distinct from V bits, then we could handle all this properly.
-   VG_(track_change_mem_mprotect) ( NULL );
+   VG_(track_change_mem_mprotect) ( track_perms_change );
       
    VG_(track_die_mem_stack_signal)( MC_(make_mem_noaccess) ); 
    VG_(track_die_mem_brk)         ( MC_(make_mem_noaccess) );


More information about the p4-projects mailing list