]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add code that makes 1st page after brk inaccessible.
authorPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 2 Jun 2022 18:31:12 +0000 (20:31 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 2 Jun 2022 18:31:12 +0000 (20:31 +0200)
Also remove FreeBSD expected.

Note: this code is also mssing from Solaris and macOS initimg's.

coregrind/m_initimg/initimg-freebsd.c
memcheck/tests/dw4.stderr.exp-freebsd [deleted file]

index 6029ffb69b0d59849b0452f890f1baaa00967b26..fcf05c86acf2bd4bdfce4b9184e614914d51ffa5 100644 (file)
@@ -986,6 +986,15 @@ void VG_(ii_finalise_image)( IIFinaliseImageInfo iifii )
    /* Tell the tool that we just wrote to the registers. */
    VG_TRACK( post_reg_write, Vg_CoreStartup, /*tid*/1, /*offset*/0,
              sizeof(VexGuestArchState));
+
+   /* Tell the tool about the client data segment and then kill it which will
+      make it inaccessible/unaddressable. */
+   const NSegment *seg = VG_(am_find_nsegment)(VG_(brk_base));
+   vg_assert(seg);
+   vg_assert(seg->kind == SkAnonC);
+   VG_TRACK(new_mem_brk, VG_(brk_base), seg->end + 1 - VG_(brk_base),
+            1/*tid*/);
+   VG_TRACK(die_mem_brk, VG_(brk_base), seg->end + 1 - VG_(brk_base));
 }
 
 #endif // defined(VGO_freebsd)
diff --git a/memcheck/tests/dw4.stderr.exp-freebsd b/memcheck/tests/dw4.stderr.exp-freebsd
deleted file mode 100644 (file)
index e396a43..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:59)
- Address 0x........ is 4 bytes inside a block of size ... alloc'd
-   at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: main (dw4.c:52)
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:61)
- Location 0x........ is 0 bytes inside S2[0].i,
- a global variable declared at dw4.c:47
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:62)
- Location 0x........ is 0 bytes inside local.i,
- declared at dw4.c:51, in frame #1 of thread 1
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:68)
- Address 0x........ is in a rw- anonymous segment
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:82)
- Address 0x........ is in a rw- mapped file valgrind-dw4-test.PID segment
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:87)
- Address 0x........ is 0 bytes after the brk data segment limit 0x........
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:89)
- Address 0x........ is in the brk data segment 0x........-0x........
-
-Uninitialised byte(s) found during client check request
-   at 0x........: croak (dw4.c:32)
-   by 0x........: main (dw4.c:91)
- Address 0x........ is in the brk data segment 0x........-0x........
-
-Unaddressable byte(s) found during client check request
-   at 0x........: croak (dw4.c:25)
-   by 0x........: main (dw4.c:93)
- Address 0x........ is 1024 bytes after the brk data segment limit 0x........
-