From: Paul Floyd Date: Wed, 8 May 2024 16:25:12 +0000 (+0200) Subject: FreeBSD sanity check: enable dev/ino and offset checking. X-Git-Tag: VALGRIND_3_24_0~154 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b1f6f8f2df51ee21fe070750b5f52930b78aedc;p=thirdparty%2Fvalgrind.git FreeBSD sanity check: enable dev/ino and offset checking. Works OK on ZFS, with the usual exeption of the RW segment of the tool itself that has a funky mapping optimization. --- diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index a0c18efac..d4845f113 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -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; diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 83875e89b..9362f65af 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -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;