]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD sanity check: enable dev/ino and offset checking.
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 8 May 2024 16:25:12 +0000 (18:25 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 8 May 2024 16:25:12 +0000 (18:25 +0200)
Works OK on ZFS, with the usual exeption of the RW segment of
the tool itself that has a funky mapping optimization.

coregrind/m_aspacemgr/aspacemgr-common.c
coregrind/m_aspacemgr/aspacemgr-linux.c

index a0c18efac14137e4029eb1ff3395703870a547aa..d4845f113484693807efdb16c0f950c5bc1e5523 100644 (file)
@@ -394,7 +394,11 @@ Bool ML_(am_get_fd_d_i_m)( Int fd,
    SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
 #endif
    if (!sr_isError(res)) {
-      *dev  = (ULong)buf.st_dev;
+      /*
+       * This gets compared to the value obtained by sysctl KERN_PROC_VMMAP.
+       * For some reson that only uses 32bits, so truncate this to match
+       */
+      *dev  = (UInt)buf.st_dev;
       *ino  = (ULong)buf.st_ino;
       *mode = (UInt) buf.st_mode;
       return True;
index 83875e89b445189caa2b379fdb67db027ad4c970..9362f65af3c85da92ac1179ed29f79cf36fb4622 100644 (file)
@@ -859,12 +859,20 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
       if (nsegments[i].hasW) seg_prot |= VKI_PROT_WRITE;
       if (nsegments[i].hasX) seg_prot |= VKI_PROT_EXEC;
 
-#if defined(VGO_darwin) || defined(VGO_freebsd)
+#if defined(VGO_darwin)
       // GrP fixme kernel info doesn't have dev/inode
       cmp_devino = False;
 
       // GrP fixme V and kernel don't agree on offsets
       cmp_offsets = False;
+#elif defined(VGO_freebsd)
+      cmp_offsets
+         = nsegments[i].kind == SkFileC || nsegments[i].kind == SkFileV;
+      cmp_offsets &= ignore_offset;
+
+      cmp_devino
+         = nsegments[i].dev != 0 || nsegments[i].ino != 0;
+      cmp_devino &= ignore_offset;
 #else
       cmp_offsets
          = nsegments[i].kind == SkFileC || nsegments[i].kind == SkFileV;