From: Paul Floyd Date: Thu, 19 May 2022 17:52:57 +0000 (+0200) Subject: Update FreeBSD (f)stat tests for FreeBSD 13.1 X-Git-Tag: VALGRIND_3_20_0~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b7cd3b4e40d01073a86e716dac7b4e2e1dba25a;p=thirdparty%2Fvalgrind.git Update FreeBSD (f)stat tests for FreeBSD 13.1 Somewhat annoyingly, libc is using tail call optimization which alters our callstacks. FreeBSD 13 and earlier had something like {compatibility API check} 1372e0: 48 8d 95 08 fe ff ff lea -0x1f8(%rbp),%rdx 1372e7: bf 8d 01 00 00 mov $0x18d,%edi 1372ec: 44 89 f6 mov %r14d,%esi 1372ef: 31 c0 xor %eax,%eax 1372f1: e8 8a c5 09 00 call 1d3880 {compatibility API check} 1342b9: 3d 9f 4f 12 00 cmp $0x124f9f,%eax 1342be: 7c 25 jl 1342e5 <_fstatfs+0x55> 1342c0: 49 8b 07 mov (%r15),%rax 1342c3: 48 3b 45 e0 cmp -0x20(%rbp),%rax 1342c7: 0f 85 51 01 00 00 jne 13441e <_fstatfs+0x18e> {compatibility not needed} 1342cd: 44 89 f7 mov %r14d,%edi 1342d0: 48 89 de mov %rbx,%rsi 1342d3: 48 81 c4 e8 01 00 00 add $0x1e8,%rsp 1342da: 5b pop %rbx 1342db: 41 5e pop %r14 1342dd: 41 5f pop %r15 1342df: 5d pop %rbp {tail call optimization} 1342e0: e9 bb a0 09 00 jmp 1ce3a0 <__sys_fstatfs@plt> {compatibility API call} So I've updated the expecteds and added a filter for 13.0 and older. --- diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index b9dc4a6d76..472f92125e 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr filter_pts dump_stdout filter_sigwait \ - filter_scalar filter_realpathat + filter_scalar filter_realpathat filter_fstat EXTRA_DIST = \ scalar.h \ diff --git a/memcheck/tests/freebsd/filter_fstat b/memcheck/tests/freebsd/filter_fstat new file mode 100755 index 0000000000..b3bdb245e4 --- /dev/null +++ b/memcheck/tests/freebsd/filter_fstat @@ -0,0 +1,8 @@ +#! /bin/sh + +../filter_stderr "$@" | + +gsed '/by 0x........: stat (in \/...libc...)/d;/by 0x........: fstat (in \/...libc...)/d;/by 0x........: fstatat (in \/...libc...)/d' | +gsed '/by 0x........: statfs (in \/...libc...)/d;/by 0x........: fstatfs (in \/...libc...)/d' + +exit 0 diff --git a/memcheck/tests/freebsd/stat.stderr.exp b/memcheck/tests/freebsd/stat.stderr.exp index 017dfc77ca..6df3fa375e 100644 --- a/memcheck/tests/freebsd/stat.stderr.exp +++ b/memcheck/tests/freebsd/stat.stderr.exp @@ -1,6 +1,5 @@ Syscall param fstatat(path) points to unaddressable byte(s) ... - by 0x........: stat (in /...libc...) by 0x........: main (stat.c:52) Address 0x........ is 0 bytes inside a block of size 7 free'd at 0x........: free (vg_replace_malloc.c:...) @@ -12,7 +11,6 @@ Syscall param fstatat(path) points to unaddressable byte(s) Syscall param fstatat(sb) points to unaddressable byte(s) ... - by 0x........: stat (in /...libc...) by 0x........: main (stat.c:57) Address 0x........ is 0 bytes inside a block of size 224 free'd at 0x........: free (vg_replace_malloc.c:...) @@ -23,7 +21,6 @@ Syscall param fstatat(sb) points to unaddressable byte(s) Syscall param fstat(sb) points to unaddressable byte(s) at 0x........: __sys_fstat (in /...libc...) - by 0x........: fstat (in /...libc...) by 0x........: main (stat.c:61) Address 0x........ is 0 bytes inside a block of size 224 free'd at 0x........: free (vg_replace_malloc.c:...) @@ -34,16 +31,13 @@ Syscall param fstat(sb) points to unaddressable byte(s) Syscall param fstat(fd) contains uninitialised byte(s) at 0x........: __sys_fstat (in /...libc...) - by 0x........: fstat (in /...libc...) by 0x........: main (stat.c:64) Syscall param fstatat(fd) contains uninitialised byte(s) ... - by 0x........: fstatat (in /...libc...) by 0x........: main (stat.c:66) Syscall param fstatat(flag) contains uninitialised byte(s) ... - by 0x........: fstatat (in /...libc...) by 0x........: main (stat.c:67) diff --git a/memcheck/tests/freebsd/stat.vgtest b/memcheck/tests/freebsd/stat.vgtest index 320803b1d7..bbdf19a1a8 100644 --- a/memcheck/tests/freebsd/stat.vgtest +++ b/memcheck/tests/freebsd/stat.vgtest @@ -1,3 +1,4 @@ prereq: test -e ./stat prog: stat vgopts: -q +stderr_filter: filter_fstat diff --git a/memcheck/tests/freebsd/statfs.stderr.exp b/memcheck/tests/freebsd/statfs.stderr.exp index 43e51f9842..e60ab30fe6 100644 --- a/memcheck/tests/freebsd/statfs.stderr.exp +++ b/memcheck/tests/freebsd/statfs.stderr.exp @@ -1,6 +1,5 @@ Syscall param statfs(buf) points to unaddressable byte(s) at 0x........: _statfs (in /...libc...) - by 0x........: statfs (in /...libc...) by 0x........: main (statfs.c:28) Address 0x........ is 0 bytes inside a block of size 2,344 free'd at 0x........: free (vg_replace_malloc.c:...) @@ -11,7 +10,6 @@ Syscall param statfs(buf) points to unaddressable byte(s) Syscall param fstatfs(buf) points to unaddressable byte(s) at 0x........: __sys_fstatfs (in /...libc...) - by 0x........: fstatfs (in /...libc...) by 0x........: main (statfs.c:31) Address 0x........ is 0 bytes inside a block of size 2,344 free'd at 0x........: free (vg_replace_malloc.c:...) @@ -22,7 +20,6 @@ Syscall param fstatfs(buf) points to unaddressable byte(s) Syscall param statfs(buf) points to unaddressable byte(s) at 0x........: _statfs (in /...libc...) - by 0x........: statfs (in /...libc...) by 0x........: main (statfs.c:34) Address 0x........ is 0 bytes after a block of size 2,341 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) @@ -30,7 +27,6 @@ Syscall param statfs(buf) points to unaddressable byte(s) Syscall param statfs(path) points to unaddressable byte(s) at 0x........: _statfs (in /...libc...) - by 0x........: statfs (in /...libc...) by 0x........: main (statfs.c:39) Address 0x........ is 0 bytes inside a block of size 8 free'd at 0x........: free (vg_replace_malloc.c:...) @@ -42,6 +38,5 @@ Syscall param statfs(path) points to unaddressable byte(s) Syscall param fstatfs(fd) contains uninitialised byte(s) at 0x........: __sys_fstatfs (in /...libc...) - by 0x........: fstatfs (in /...libc...) by 0x........: main (statfs.c:42) diff --git a/memcheck/tests/freebsd/statfs.vgtest b/memcheck/tests/freebsd/statfs.vgtest index 73c40609d9..e76486ae86 100644 --- a/memcheck/tests/freebsd/statfs.vgtest +++ b/memcheck/tests/freebsd/statfs.vgtest @@ -1,3 +1,4 @@ prereq: test -e ./statfs prog: statfs vgopts: -q +stderr_filter: filter_fstat