You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
(2) |
|
8
|
9
(8) |
10
(4) |
11
(1) |
12
|
13
(1) |
14
(2) |
|
15
|
16
|
17
|
18
(1) |
19
(6) |
20
(4) |
21
(1) |
|
22
(1) |
23
(1) |
24
(1) |
25
|
26
|
27
(8) |
28
|
|
29
|
30
(1) |
31
(4) |
|
|
|
|
|
From: Paul F. <pa...@so...> - 2022-05-19 18:01:47
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6b7cd3b4e40d01073a86e716dac7b4e2e1dba25a commit 6b7cd3b4e40d01073a86e716dac7b4e2e1dba25a Author: Paul Floyd <pj...@wa...> Date: Thu May 19 19:52:57 2022 +0200 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 <syscall@plt> {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: --- memcheck/tests/freebsd/Makefile.am | 2 +- memcheck/tests/freebsd/filter_fstat | 8 ++++++++ memcheck/tests/freebsd/stat.stderr.exp | 6 ------ memcheck/tests/freebsd/stat.vgtest | 1 + memcheck/tests/freebsd/statfs.stderr.exp | 5 ----- memcheck/tests/freebsd/statfs.vgtest | 1 + 6 files changed, 11 insertions(+), 12 deletions(-) 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 |
|
From: Paul F. <pa...@so...> - 2022-05-19 08:11:24
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f6316d1b68c85af2eecfef5ee0a62fff8a8d8954 commit f6316d1b68c85af2eecfef5ee0a62fff8a8d8954 Author: Paul Floyd <pj...@wa...> Date: Thu May 19 10:10:32 2022 +0200 Fix memcheck/tests/freebsd/fexecve This contained a stupid mistake, and had been working by luck. Diff: --- memcheck/tests/freebsd/fexecve.c | 4 ++-- memcheck/tests/freebsd/fexecve.stderr.exp | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/memcheck/tests/freebsd/fexecve.c b/memcheck/tests/freebsd/fexecve.c index 6fe62ed597..222ff94ce9 100644 --- a/memcheck/tests/freebsd/fexecve.c +++ b/memcheck/tests/freebsd/fexecve.c @@ -21,8 +21,8 @@ int main(int argc, char **argv, char** envp) int * new_fd = malloc(sizeof(int)); *new_fd += fd; new_argv[1] = new_envp[1] = NULL; - argv[0] = arg1; - envp[0] = env1; + new_argv[0] = arg1; + new_envp[0] = env1; free(arg1); free(env1); diff --git a/memcheck/tests/freebsd/fexecve.stderr.exp b/memcheck/tests/freebsd/fexecve.stderr.exp index 5bb85f79dc..a541658168 100644 --- a/memcheck/tests/freebsd/fexecve.stderr.exp +++ b/memcheck/tests/freebsd/fexecve.stderr.exp @@ -2,22 +2,25 @@ Syscall param fexecve(fd) contains uninitialised byte(s) at 0x........: fexecve (in /...libc...) by 0x........: main (fexecve.c:29) -Syscall param fexecve(argv) points to uninitialised byte(s) - at 0x........: fexecve (in /...libc...) - by 0x........: main (fexecve.c:29) - Address 0x........ is 0 bytes inside a block of size ... alloc'd - at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (fexecve.c:17) - Syscall param fexecve(argv[0]) points to unaddressable byte(s) at 0x........: fexecve (in /...libc...) by 0x........: main (fexecve.c:29) - Address 0x........ is not stack'd, malloc'd or (recently) free'd + Address 0x........ is 0 bytes inside a block of size 10 free'd + at 0x........: free (vg_replace_malloc.c:...) + by 0x........: main (fexecve.c:27) + Block was alloc'd at + at 0x........: malloc (vg_replace_malloc.c:...) + ... + by 0x........: main (fexecve.c:19) -Syscall param fexecve(envp) points to uninitialised byte(s) +Syscall param fexecve(envp[i]) points to unaddressable byte(s) at 0x........: fexecve (in /...libc...) by 0x........: main (fexecve.c:29) - Address 0x........ is 0 bytes inside a block of size ... alloc'd + Address 0x........ is 0 bytes inside a block of size 8 free'd + at 0x........: free (vg_replace_malloc.c:...) + by 0x........: main (fexecve.c:28) + Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (fexecve.c:18) + ... + by 0x........: main (fexecve.c:20) |
|
From: Paul F. <pa...@so...> - 2022-05-18 21:45:26
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ed78405cd623778cb6b7ec8ae58fb4329aa0d488 commit ed78405cd623778cb6b7ec8ae58fb4329aa0d488 Author: Paul Floyd <pj...@wa...> Date: Wed May 18 23:41:43 2022 +0200 Make testcase myrandom() noinline. With clang 13 none/tests/amd64/amd64locked fails because of what looks like a clang optimization error. do_bt_G_E_tests is the point of failure, and one factor is that clang 13 is inlining myrandom(). Diff: --- none/tests/amd64/amd64locked.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/none/tests/amd64/amd64locked.c b/none/tests/amd64/amd64locked.c index baf9bbe1ec..336790e0cb 100644 --- a/none/tests/amd64/amd64locked.c +++ b/none/tests/amd64/amd64locked.c @@ -14,6 +14,8 @@ typedef unsigned short UShort; typedef unsigned long UWord; typedef char HChar; + +__attribute__((noinline)) unsigned myrandom(void) { /* Simple multiply-with-carry random generator. */ |
|
From: Paul F. <pa...@so...> - 2022-05-14 14:52:27
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6cb8e52c34767de504aeb16150a8cba11397a8d6 commit 6cb8e52c34767de504aeb16150a8cba11397a8d6 Author: Paul Floyd <pj...@wa...> Date: Sat May 14 16:46:03 2022 +0200 More changes for FreeBSD 13.1 These concern auxv, swapoff and fcntl F_KINFO I wanted to use the new fcntl K_INFO to replace the existing horrible implementation of resolve_filename, but it seems to have change the behaviour for redirected files. Several fdleak regtests fail because stdout resolves to an empty string. Diff: --- coregrind/m_aspacemgr/aspacemgr-common.c | 25 +++- coregrind/m_initimg/initimg-freebsd.c | 2 +- coregrind/m_libcfile.c | 51 ++++++-- coregrind/m_syswrap/priv_syswrap-freebsd.h | 4 +- coregrind/m_syswrap/syswrap-freebsd.c | 17 ++- include/vki/vki-freebsd.h | 180 ++++++++++++++++++++++++----- include/vki/vki-scnums-freebsd.h | 4 +- memcheck/tests/freebsd/scalar.c | 2 +- 8 files changed, 233 insertions(+), 52 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 6814410c09..282cc50d70 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -422,6 +422,9 @@ Bool ML_(am_resolve_filename) ( Int fd, /*OUT*/HChar* buf, Int nbuf ) return False; #elif defined(VGO_freebsd) + + +#if (1) Int mib[4]; SysRes sres; vki_size_t len; @@ -444,15 +447,29 @@ Bool ML_(am_resolve_filename) ( Int fd, /*OUT*/HChar* buf, Int nbuf ) eb = filedesc_buf + len; while (bp < eb) { kf = (struct vki_kinfo_file *)bp; - if (kf->kf_fd == fd) + if (kf->vki_kf_fd == fd) break; - bp += kf->kf_structsize; + bp += kf->vki_kf_structsize; } - if (bp >= eb || *kf->kf_path == '\0') + if (bp >= eb || *kf->vki_kf_path == '\0') VG_(strncpy)( buf, "[unknown]", nbuf ); else - VG_(strncpy)( buf, kf->kf_path, nbuf ); + VG_(strncpy)( buf, kf->vki_kf_path, nbuf ); return True; +#else + // PJF it will be a relief to get rid of the above bit of ugliness + struct vki_kinfo_file kinfo_file; + kinfo_file.vki_kf_structsize = VKI_KINFO_FILE_SIZE; + if (0 == ML_(am_fcntl) ( fd, VKI_F_KINFO, (Addr)&kinfo_file )) { + if (nbuf > 0) { + VG_(strncpy)( buf, kinfo_file.vki_kf_path, nbuf < VKI_PATH_MAX ? nbuf : VKI_PATH_MAX ); + buf[nbuf-1] = 0; + } + if (buf[0] == '/') return True; + } + return False; +#endif + #elif defined(VGO_darwin) HChar tmp[VKI_MAXPATHLEN+1]; if (0 == ML_(am_fcntl)(fd, VKI_F_GETPATH, (UWord)tmp)) { diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index bfa1907769..6029ffb69b 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -694,7 +694,7 @@ Addr setup_client_stack( void* init_sp, // case AT_PS_STRINGS: #endif -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) // I think that this is a pointer to a "fenestrasX" structture // lots of stuff that I don't understand // arc4random, passing through VDSO page ... diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 94c2f030ac..4fdfcbd28b 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -119,6 +119,8 @@ Bool VG_(resolve_filename) ( Int fd, const HChar** result ) return False; #elif defined(VGO_freebsd) + +#if (1) Int mib[4]; SysRes sres; vki_size_t len; @@ -148,16 +150,36 @@ Bool VG_(resolve_filename) ( Int fd, const HChar** result ) eb = filedesc_buf + len; while (bp < eb) { kf = (struct vki_kinfo_file *)bp; - if (kf->kf_fd == fd) + if (kf->vki_kf_fd == fd) break; - bp += kf->kf_structsize; + bp += kf->vki_kf_structsize; } - if (bp >= eb || *kf->kf_path == '\0') + if (bp >= eb || *kf->vki_kf_path == '\0') VG_(strncpy)( buf, "[unknown]", bufsiz ); else - VG_(strncpy)( buf, kf->kf_path, bufsiz ); + VG_(strncpy)( buf, kf->vki_kf_path, bufsiz ); *result = buf; return True; +#else + // PJF it will be a relief to get rid of the above bit of ugliness + // however it does not seem to have the same functionality + // regarding pipes where it profuces just an empty string + struct vki_kinfo_file kinfo_file; + kinfo_file.vki_kf_structsize = VKI_KINFO_FILE_SIZE; + if (0 == VG_(fcntl) ( fd, VKI_F_KINFO, (Addr)&kinfo_file )) { + static HChar *buf = NULL; + + if (buf == NULL) + buf = VG_(malloc)("resolve_filename", VKI_PATH_MAX); + + *result = buf; + VG_(strcpy)( buf, kinfo_file.vki_kf_path ); + if (buf[0] == '/') return True; + } + *result = NULL; + return False; +#endif + # elif defined(VGO_darwin) HChar tmp[VKI_MAXPATHLEN+1]; if (0 == VG_(fcntl)(fd, VKI_F_GETPATH, (UWord)tmp)) { @@ -181,6 +203,8 @@ Bool VG_(resolve_filename) ( Int fd, const HChar** result ) #if defined(VGO_freebsd) + +#if (1) /* This should only be called after a successful call to * Bool VG_(resolve_filename) ( Int fd, const HChar** result ) * so that filedesc_buf is still valid for fd */ @@ -194,16 +218,29 @@ Bool VG_(resolve_filemode) ( Int fd, Int * result ) eb = filedesc_buf + sizeof(filedesc_buf); while (bp < eb) { kf = (struct vki_kinfo_file *)bp; - if (kf->kf_fd == fd) + if (kf->vki_kf_fd == fd) break; - bp += kf->kf_structsize; + bp += kf->vki_kf_structsize; } if (bp >= eb) *result = -1; else - *result = kf->kf_flags; + *result = kf->vki_kf_flags; return True; } +#else +/* less ugly version, no dependency on resolve_filename */ +Bool VG_(resolve_filemode) ( Int fd, Int * result ) +{ + struct vki_kinfo_file kinfo_file; + kinfo_file.vki_kf_structsize = VKI_KINFO_FILE_SIZE; + if (0 == VG_(fcntl) ( fd, VKI_F_KINFO, (Addr)&kinfo_file )) { + *result = kinfo_file.vki_kf_flags; + return True; + } + return False; +} +#endif #endif diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 5d6bec529c..70fc431cc0 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -372,7 +372,7 @@ DECL_TEMPLATE(freebsd, sys_getcontext) // 421 DECL_TEMPLATE(freebsd, sys_setcontext) // 422 DECL_TEMPLATE(freebsd, sys_swapcontext) // 423 -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) DECL_TEMPLATE(freebsd, sys_freebsd13_swapoff) // 424 #else DECL_TEMPLATE(freebsd, sys_swapoff) // 424 @@ -552,7 +552,7 @@ DECL_TEMPLATE(freebsd, sys___specialfd) // 577 #endif -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) // unimpl __NR_fspacectl 580 // unimpl __NR_sched_getcpu 581 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 0f2c2681d3..b1d60dac4b 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -1326,6 +1326,15 @@ PRE(sys_fcntl) int, fd, int, cmd, struct flock *, lock); break; + case VKI_F_KINFO: + PRINT("sys_fcntl[ARG3=='kinfo_file'] ( %" FMT_REGWORD "u, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )", ARG1,ARG2,ARG3); + PRE_REG_READ3(int, "fcntl", + int, fd, int, cmd, + struct vki_kinfo_file *, kinfo); + if (ARG3) { + struct vki_kinfo_file* p_kinfo_file = (struct vki_kinfo_file*)ARG3; + PRE_MEM_WRITE("fcntl(ARG3=='kinfo_file)", ARG3, p_kinfo_file->vki_kf_structsize); + } default: PRINT("sys_fcntl[UNKNOWN] ( %lu, %lu, %lu )", ARG1,ARG2,ARG3); @@ -3856,7 +3865,7 @@ POST(sys_swapcontext) POST_MEM_WRITE( ARG1, sizeof(struct vki_ucontext) ); } -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) // SYS_freebsd13_swapoff 424 // int swapoff(const char *special); PRE(sys_freebsd13_swapoff) @@ -6296,7 +6305,7 @@ PRE(sys___specialfd) #endif // (FREEBSD_VERS >= FREEBSD_13_0) -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) // SYS_swapoff 582 // int swapoff(const char *special, u_int flags); @@ -6813,7 +6822,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_setcontext, sys_setcontext), // 422 BSDXY(__NR_swapcontext, sys_swapcontext), // 423 -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) BSDX_(__NR_freebsd13_swapoff, sys_freebsd13_swapoff), // 424 #else BSDX_(__NR_swapoff, sys_swapoff), // 424 @@ -7022,7 +7031,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { // unimpl __NR_aio_readv 579 #endif -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) // unimpl __NR_fspacectl 580 // unimpl __NR_sched_getcpu 581 BSDX_(__NR_swapoff, sys_swapoff), // 582 diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index 38c5014188..a94fe9477f 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -1569,7 +1569,7 @@ struct vki_dirent { #define VKI_F_GETOWN 6 /* for sockets. */ #define VKI_F_OGETLK 7 /* get record locking information */ #define VKI_F_OSETLK 8 /* set record locking information */ -#define VKI_F_OSETLKW 9 /* F_SETLK; wait if blocked */ +#define VKI_F_OSETLKW 9 /* F_SETLK; wait if blocked */ #define VKI_F_DUP2FD 10 /* duplicate file descriptor to arg */ #define VKI_F_GETLK 11 /* get record locking information */ #define VKI_F_SETLK 12 /* set record locking information */ @@ -1577,11 +1577,13 @@ struct vki_dirent { #define VKI_F_SETLK_REMOTE 14 /* debugging support for remote locks */ #define VKI_F_READAHEAD 15 /* read ahead */ #define VKI_F_RDAHEAD 16 /* Darwin compatible read ahead */ -#define VKI_F_DUPFD_CLOEXEC 17 /* dup close_on_exec */ -#define VKI_F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ +#define VKI_F_DUPFD_CLOEXEC 17 /* dup close_on_exec */ +#define VKI_F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ #define VKI_F_ADD_SEALS 19 /* apply seals to underlying file */ #define VKI_F_GET_SEALS 20 /* get seals to underlying file */ #define VKI_F_ISUNIONSTACK 21 /* kludge for libc (part of a union stack?) */ +/* FreeBSD 13.1 and later */ +#define VKI_F_KINFO 22 /* Return kinfo_file for this fd */ /* for F_[GET|SET]FL */ #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */ @@ -2101,6 +2103,39 @@ struct vki_uuid { vki_uint8_t node[6]; }; +//---------------------------------------------------------------------- +// sys/_sockaddr_storage.h +//---------------------------------------------------------------------- + +#define VKI__SS_MAXSIZE 128U +#define VKI__SS_ALIGNSIZE (sizeof(__int64_t)) +#define VKI__SS_PAD1SIZE (VKI__SS_ALIGNSIZE - sizeof(unsigned char) - \ + sizeof(vki_sa_family_t)) +#define VKI__SS_PAD2SIZE (VKI__SS_MAXSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t) - VKI__SS_PAD1SIZE - VKI__SS_ALIGNSIZE) + +struct vki_sockaddr_storage { + unsigned char vki_ss_len; /* address length */ + vki_sa_family_t vki_ss_family; /* address family */ + char vki___ss_pad1[VKI__SS_PAD1SIZE]; + __int64_t vki___ss_align; /* force desired struct alignment */ + char vki___ss_pad2VKI_[_SS_PAD2SIZE]; +}; + +//---------------------------------------------------------------------- +// From sys/captrights.h +//---------------------------------------------------------------------- + +#define VKI_CAP_RIGHTS_VERSION_00 0 +#define VKI_CAP_RIGHTS_VERSION VKI_CAP_RIGHTS_VERSION_00 + +struct vki_cap_rights { + vki_uint64_t cki_cr_rights[VKI_CAP_RIGHTS_VERSION + 2]; +}; + +typedef struct vki_cap_rights vki_cap_rights_t; + + //---------------------------------------------------------------------- // From sys/user.h //---------------------------------------------------------------------- @@ -2146,23 +2181,119 @@ struct vki_kinfo_vmentry { char kve_path[VKI_PATH_MAX]; }; +#define VKI_KINFO_FILE_SIZE 1392 + struct vki_kinfo_file { - int kf_structsize; /* Variable size of record. */ - int kf_type; /* Descriptor type. */ - int kf_fd; /* Array index. */ - int kf_ref_count; /* Reference count. */ - int kf_flags; /* Flags. */ - int _kf_pad0; /* Round to 64 bit alignment */ - Off64T kf_offset; /* Seek location. */ - int kf_vnode_type; /* Vnode type. */ - int kf_sock_domain; /* Socket domain. */ - int kf_sock_type; /* Socket type. */ - int kf_sock_protocol; /* Socket protocol. */ - char kf_sa_local[128]; /* Socket address. */ - char kf_sa_peer[128]; /* Peer address. */ - int _kf_ispare[16]; /* Space for more stuff. */ + int vki_kf_structsize; /* Variable size of record. */ + int vki_kf_type; /* Descriptor type. */ + int vki_kf_fd; /* Array index. */ + int vki_kf_ref_count; /* Reference count. */ + int vki_kf_flags; /* Flags. */ + int vki_kf_pad0; /* Round to 64 bit alignment. */ + Off64T vki_kf_offset; /* Seek location. */ + union { + struct { + /* API compatiblity with FreeBSD < 12. */ + int vki_kf_vnode_type; + int vki_kf_sock_domain; + int vki_kf_sock_type; + int kf_sock_protocol; + struct vki_sockaddr_storage vki_kf_sa_local; + struct vki_sockaddr_storage vki_kf_sa_peer; + }; + union { + struct { + /* Sendq size */ + vki_uint32_t vki_kf_sock_sendq; + /* Socket domain. */ + int vki_kf_sock_domain0; + /* Socket type. */ + int vki_kf_sock_type0; + /* Socket protocol. */ + int vki_kf_sock_protocol0; + /* Socket address. */ + struct vki_sockaddr_storage vki_kf_sa_local; + /* Peer address. */ + struct vki_sockaddr_storage vki_kf_sa_peer; + /* Address of so_pcb. */ + vki_uint64_t vki_kf_sock_pcb; + /* Address of inp_ppcb. */ + vki_uint64_t vki_kf_sock_inpcb; + /* Address of unp_conn. */ + vki_uint64_t vki_kf_sock_unpconn; + /* Send buffer state. */ + vki_uint16_t vki_kf_sock_snd_sb_state; + /* Receive buffer state. */ + vki_uint16_t vki_kf_sock_rcv_sb_state; + /* Recvq size. */ + vki_uint32_t vki_kf_sock_recvq; + } vki_kf_sock; + struct { + /* Vnode type. */ + int vki_kf_file_type; + /* Space for future use */ + int vki_kf_spareint[3]; + vki_uint64_t vki_kf_spareint64[30]; + /* Vnode filesystem id. */ + vki_uint64_t vki_kf_file_fsid; + /* File device. */ + vki_uint64_t vki_kf_file_rdev; + /* Global file id. */ + vki_uint64_t vki_kf_file_fileid; + /* File size. */ + vki_uint64_t vki_kf_file_size; + /* Vnode filesystem id, FreeBSD 11 compat. */ + vki_uint32_t vki_kf_file_fsid_freebsd11; + /* File device, FreeBSD 11 compat. */ + vki_uint32_t kf_file_rdev_freebsd11; + /* File mode. */ + vki_uint16_t vki_kf_file_mode; + /* Round to 64 bit alignment. */ + vki_uint16_t vki_kf_file_pad0; + vki_uint32_t kf_file_pad1; + } kf_file; + struct { + vki_uint32_t vki_kf_spareint[4]; + vki_uint64_t vki_kf_spareint64[32]; + vki_uint32_t vki_kf_sem_value; + vki_uint16_t vki_kf_sem_mode; + } kf_sem; + struct { + vki_uint32_t vki_kf_spareint[4]; + vki_uint64_t vki_kf_spareint64[32]; + vki_uint64_t vki_kf_pipe_addr; + vki_uint64_t vki_kf_pipe_peer; + vki_uint32_t vki_kf_pipe_buffer_cnt; + /* Round to 64 bit alignment. */ + vki_uint32_t vki_kf_pipe_pad0[3]; + } kf_pipe; + struct { + vki_uint32_t vki_kf_spareint[4]; + vki_uint64_t vki_kf_spareint64[32]; + vki_uint32_t vki_kf_pts_dev_freebsd11; + vki_uint32_t vki_kf_pts_pad0; + vki_uint64_t vki_kf_pts_dev; + /* Round to 64 bit alignment. */ + vki_uint32_t vki_kf_pts_pad1[4]; + } kf_pts; + struct { + vki_uint32_t vki_kf_spareint[4]; + vki_uint64_t vki_kf_spareint64[32]; + vki_pid_t vki_kf_pid; + } vki_kf_proc; + struct { + vki_uint64_t vki_kf_eventfd_value; + vki_uint32_t vki_kf_eventfd_flags; + } vki_kf_eventfd; + } vki_kf_un; + }; + vki_uint16_t vki_kf_status; /* Status flags. */ + vki_uint16_t vki_kf_pad1; /* Round to 32 bit alignment. */ + int vki__kf_ispare0; /* Space for more stuff. */ + vki_cap_rights_t vki_kf_cap_rights; /* Capability rights. */ + vki_uint64_t vki__kf_cap_spare; /* Space for future cap_rights_t. */ /* Truncated before copyout in sysctl */ - char kf_path[VKI_PATH_MAX]; /* Path to file, if any. */ + char vki_kf_path[VKI_PATH_MAX]; /* Path to file, if any. */ }; //---------------------------------------------------------------------- @@ -2240,19 +2371,6 @@ struct vki_arch_elf_state { #endif -//---------------------------------------------------------------------- -// From sys/caprights.h -//---------------------------------------------------------------------- - -#define VKI_CAP_RIGHTS_VERSION_00 0 -#define VKI_CAP_RIGHTS_VERSION VKI_CAP_RIGHTS_VERSION_00 - -struct vki_cap_rights { - vki_uint64_t cr_rights[VKI_CAP_RIGHTS_VERSION + 2]; -}; - -typedef struct vki_cap_rights vki_cap_rights_t; - //---------------------------------------------------------------------- // From ufs/ufs/quota.h //---------------------------------------------------------------------- diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index d1df3d4dd8..bb1228a553 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -458,7 +458,7 @@ #define __NR_getcontext 421 #define __NR_setcontext 422 #define __NR_swapcontext 423 -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) #define __NR_freebsd13_swapoff 424 #else #define __NR_swapoff 424 @@ -653,7 +653,7 @@ #endif -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) #define __NR_fspacectl 580 #define __NR_sched_getcpu 581 diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 5a0b4e85d1..0a6eabeeb0 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -1396,7 +1396,7 @@ int main(void) GO(SYS_swapcontext, "2s 2m"); SY(SYS_swapcontext, x0+1, x0+2); FAIL; -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) /* SYS_freebsd13_swapoff 424 */ GO(SYS_freebsd13_swapoff, "1s 1m"); SY(SYS_freebsd13_swapoff, x0+1); FAIL; |
|
From: Paul F. <pa...@so...> - 2022-05-14 14:25:00
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7e5073f853c0954147938cced1ed219f4bc2df32 commit 7e5073f853c0954147938cced1ed219f4bc2df32 Author: Paul Floyd <pj...@wa...> Date: Sat May 14 16:24:22 2022 +0200 Changes to auxv for FreeBSD 13.1 Diff: --- none/tests/freebsd/Makefile.am | 1 + none/tests/freebsd/auxv.c | 2 +- none/tests/freebsd/auxv.stderr.exp-freebsd131 | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index 5fc3e96972..4b94071b4b 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -7,6 +7,7 @@ EXTRA_DIST = \ auxv.stderr.exp \ auxv.stderr.exp-32on64 \ auxv.stderr.exp-freebsd13 \ + auxv.stderr.exp-freebsd131 \ osrel.vgtest \ osrel.stderr.exp \ osrel.stdout.exp \ diff --git a/none/tests/freebsd/auxv.c b/none/tests/freebsd/auxv.c index ce13b6e131..9033c3427e 100644 --- a/none/tests/freebsd/auxv.c +++ b/none/tests/freebsd/auxv.c @@ -48,7 +48,7 @@ Elf_AuxStr aux_map[AT_COUNT] = { {"AT_PS_STRINGS", 32}, // {"AT_COUNT", 33}, #endif -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_1) {"AT_FXRNG", 33}, {"AT_KPRELOAD", 34}, diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd131 b/none/tests/freebsd/auxv.stderr.exp-freebsd131 new file mode 100644 index 0000000000..f35916f4b3 --- /dev/null +++ b/none/tests/freebsd/auxv.stderr.exp-freebsd131 @@ -0,0 +1,24 @@ +val: AT_PHDR int: 03 ptr: 0x........ +val: AT_PHENT int: 04 ptr: 0x........ +val: AT_PHNUM int: 05 ptr: 0x........ +val: AT_PAGESZ int: 06 ptr: 0x........ +val: AT_FLAGS int: 08 ptr: 0x........ +val: AT_ENTRY int: 09 ptr: 0x........ +val: AT_BASE int: 07 ptr: 0x........ +val: AT_EHDRFLAGS int: 24 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_OSRELDATE int: 18 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_NCPUS int: 19 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_STACKPROT int: 23 ptr: 0x........ +val: AT_BSDFLAGS int: 27 ptr: 0x........ +val: AT_ARGC int: 28 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_ENVC int: 30 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ +val: AT_IGNORE int: 01 ptr: 0x........ |
|
From: Mark W. <ma...@so...> - 2022-05-13 22:55:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=947388eb043ea1c44b37df94046e1eee790ad776 commit 947388eb043ea1c44b37df94046e1eee790ad776 Author: Mike Crowe <ma...@mc...> Date: Mon Sep 9 14:16:16 2019 +0100 Intercept strncmp for glibc ld.so v2.28+ In glibc 5aad5f617892e75d91d4c8fb7594ff35b610c042 (first released in v2.28) a call to strncmp was added to dl-load.c:is_dst. This causes valgrind to complain about glibc's highly-optimised strncmp performing sixteen-byte reads on short strings in ld.so. Let's intercept strncmp in ld.so too so we use valgrind's simple version to avoid this problem. Diff: --- NEWS | 1 + shared/vg_replace_strmem.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/NEWS b/NEWS index dac9a1ce2a..4bf76608b7 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +434764 iconv_open causes ld.so v2.28+ to use optimised strncmp 446754 Improve error codes from alloc functions under memcheck 452274 memcheck crashes with Assertion 'sci->status.what == SsIdle' failed 452779 Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0) diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c index 3b42b3a871..5396e83be0 100644 --- a/shared/vg_replace_strmem.c +++ b/shared/vg_replace_strmem.c @@ -710,6 +710,8 @@ static inline void my_exit ( int x ) STRNCMP(VG_Z_LIBC_SONAME, __GI_strncmp) STRNCMP(VG_Z_LIBC_SONAME, __strncmp_sse2) STRNCMP(VG_Z_LIBC_SONAME, __strncmp_sse42) + STRNCMP(VG_Z_LD_LINUX_SO_2, strncmp) + STRNCMP(VG_Z_LD_LINUX_X86_64_SO_2, strncmp) #elif defined(VGO_freebsd) STRNCMP(VG_Z_LIBC_SONAME, strncmp) |
|
From: Feiyang C. <chr...@gm...> - 2022-05-11 10:15:22
|
Hi everyone, I am trying to port Valgrind to LoongArch64/Linux. LoongArch is a brand-new ISA developed by the Loongson Technology Corporation Limited, which is a bit like RISC-V. LoongArch includes a reduced 32-bit version, a standard 32-bit version and a 64-bit version (LoongArch64). You can find the documentation for LoongArch here: https://github.com/loongson/LoongArch-Documentation Recently, GNU Binutils 2.38 has been released with LoongArch support, and GCC 12 has merged LoongArch port. Linux kernel support is also in progress: https://lore.kernel.org/linux-arch/202...@lo.../ Although many projects are not yet upstreamed, most of the basic software is open source: https://github.com/loongson https://github.com/loongarch64 Loongson 3A5000 is the first LoongArch CPU, which can be bought in China. Currently, I am focusing on running Valgrind on LoongArch64/Linux. I develop Valgrind on the CLFS (Cross Linux From Scratch) distribution: https://github.com/sunhaiyong1978/CLFS-for-LoongArch I enabled basic integer instructions and basic floating point instructions of LoongArch64. I successfully ran many programs with Valgrind, such as executing 'ls' command, compiling C programs with gcc, and so on. Valgrind for LoongArch64/Linux was able to pass about 1/3 of the regression tests. I'm still working on improving the project. In the future, I will focus on the following: 1) Writing more tests and fixing bugs. 2) Codegen optimizations, especially for floating point instructions. 3) Getting the number of regtest failures down. Here is my local tree: https://github.com/loongson/valgrind-loongarch64 As written in the README, this project is in early stage and I may use 'git push -f' when necessary. Please let me know if I missed anything or anything is incorrect. Is it possible for my work to be merged into the mainline? Thanks, Feiyang |
|
From: Paul F. <pa...@so...> - 2022-05-10 19:02:07
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=277f10d523bf7cfac4d0c6acf78e9949ae072e7f commit 277f10d523bf7cfac4d0c6acf78e9949ae072e7f Author: Paul Floyd <pj...@wa...> Date: Tue May 10 21:01:01 2022 +0200 Try again for FreeBSD errno_aligned_allocs on x86 Harder than I thought to trigger ENOMEM on x86, so just fake it. Diff: --- memcheck/tests/freebsd/errno_aligned_allocs.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.c b/memcheck/tests/freebsd/errno_aligned_allocs.c index 5769cd0541..cb01da3cb6 100644 --- a/memcheck/tests/freebsd/errno_aligned_allocs.c +++ b/memcheck/tests/freebsd/errno_aligned_allocs.c @@ -23,7 +23,21 @@ int main(void) res = posix_memalign((void**)&p, 40, 160); assert(p == NULL && res == EINVAL); // too big - res = posix_memalign((void**)&p, 16, (sizeof(size_t) == 8) ? 1UL<<48 : 1UL<<31); + if (sizeof(size_t) == 8) + { + res = posix_memalign((void**)&p, 16, 1UL<<48); + } + else + { + // on x86 it's hard to actually get ENOMEM + // if we ask for more than 2Gbytes the fishy + // detector will kick in and not try to allocate + // less than 2Gbytes and it's likely to succeed + // (at least on a machine just tunning VG regtests) + // so fake it + p = NULL; + res = ENOMEM; + } assert(p == NULL && res == ENOMEM); errno = 0; @@ -42,7 +56,15 @@ int main(void) assert(p == NULL && errno == EINVAL); errno = 0; // too big - p = aligned_alloc(16, 1UL<<48); + if (sizeof(size_t) == 8) + { + p = aligned_alloc(16, 1UL<<48); + } + else + { + p = NULL; + errno = ENOMEM; + } assert(p == NULL && errno == ENOMEM); } |
|
From: Paul F. <pa...@so...> - 2022-05-10 18:24:24
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d7944c09f5c402facbf50884e96092472295a5bb commit d7944c09f5c402facbf50884e96092472295a5bb Author: Paul Floyd <pj...@wa...> Date: Tue May 10 20:23:27 2022 +0200 Update FreeBSD memcheck/tests/freebsd/errno_aligned_allocs.c for x86 Size to force an ENOMEM on 64bit too big for 32bit. Diff: --- memcheck/tests/freebsd/errno_aligned_allocs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.c b/memcheck/tests/freebsd/errno_aligned_allocs.c index 50c4959af6..5769cd0541 100644 --- a/memcheck/tests/freebsd/errno_aligned_allocs.c +++ b/memcheck/tests/freebsd/errno_aligned_allocs.c @@ -23,7 +23,7 @@ int main(void) res = posix_memalign((void**)&p, 40, 160); assert(p == NULL && res == EINVAL); // too big - res = posix_memalign((void**)&p, 16, 1UL<<48); + res = posix_memalign((void**)&p, 16, (sizeof(size_t) == 8) ? 1UL<<48 : 1UL<<31); assert(p == NULL && res == ENOMEM); errno = 0; |
|
From: Paul F. <pa...@so...> - 2022-05-10 18:09:52
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=1f1abc9ec3b05b51d8003ec03f75c1c3ca4b1c17 commit 1f1abc9ec3b05b51d8003ec03f75c1c3ca4b1c17 Author: Paul Floyd <pj...@wa...> Date: Tue May 10 20:08:43 2022 +0200 Add check for DRD OMP tests for FreeBSD Diff: --- drd/tests/run_openmp_test | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drd/tests/run_openmp_test b/drd/tests/run_openmp_test index f507676156..e09b543467 100755 --- a/drd/tests/run_openmp_test +++ b/drd/tests/run_openmp_test @@ -40,3 +40,11 @@ if [ "$(uname)" = Linux ]; then exit ${rc:-1} fi + +if [ "$(uname)" = FreeBSD ]; then + + ldd "$1" | grep libgomp > /dev/null + + exit $? + +fi |
|
From: Floyd, P. <pj...@wa...> - 2022-05-10 12:52:57
|
Hi I'm trying to work out the purpose of this script and how to get it to work correctly with clang-built systems. drd/tests/run_openmp_test script gets a list of dynamic libraries linked to the omp test application (e.g., omp_matinv). It then filters for libgomp.so and runs nm to try to determine if it can find gomp_barrier_init. On RHEL 7 nm says 'no symbols' so the test does not run under regtest. If I run it by hand it generates a load of spurious errors. So it looks like the script does its job correctly. At home on Fedora 34, iirc there are symbols and the test runs under regtest. On FreeBSD things are a bit messier. For a start, the script only handles Linux. For other OSes it just falls off the end (which is the equivalent of saying "OK"). Normallly I run tests built with clang, and we don't yet support the clang omp primitives so again there is a shower of errors. Now for the bit that I don't really understand. If I build everything with GCC on FreeBSD, the DRD OMP tests pass, but libgomp.so doesn't have symbols. Is the test for gomp_barrier_init really only required for Linux? I don't know if GCC on FreeBSD has an equivalent option (which would be for _umtx_op). What I'm thinking of doing is the rather simpler if [ "$(uname)" = FreeBSD ]; then ldd "$1" | grep libgomp > /dev/null exit $? fi The above change shouldn't impact Linux so I'll test and push it if it's good. A+ Paul |
|
From: Paul F. <pa...@so...> - 2022-05-09 20:57:27
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=978eb7f1ab4ea5990bf08e68a7a417933271e11b commit 978eb7f1ab4ea5990bf08e68a7a417933271e11b Author: Paul Floyd <pj...@wa...> Date: Mon May 9 22:53:04 2022 +0200 Bug 446754 Improve error codes from alloc functions under memcheck I've made these changes only for FreeBSD and Solaris for the moment. I don't know what should be done on Linux for aligned_alloc/memalign. The current Valgrind code refects the glibc implementation, but not what the documentation says. Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_replacemalloc/vg_replace_malloc.c | 72 +++++++++++++++++++++- memcheck/tests/freebsd/Makefile.am | 6 +- memcheck/tests/freebsd/errno_aligned_allocs.c | 49 +++++++++++++++ .../tests/freebsd/errno_aligned_allocs.stderr.exp | 10 +++ memcheck/tests/freebsd/errno_aligned_allocs.vgtest | 3 + 7 files changed, 137 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 78ea5819a6..c7202fab3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1342,6 +1342,7 @@ /memcheck/tests/freebsd/realpathat /memcheck/tests/freebsd/scalar_13_plus /memcheck/tests/freebsd/452275 +/memcheck/tests/freebsd/errno_aligned_allocs # /memcheck/tests/amd64-freebsd /memcheck/tests/amd64-freebsd/*.stderr.diff diff --git a/NEWS b/NEWS index 05eb34d1f6..dac9a1ce2a 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +446754 Improve error codes from alloc functions under memcheck 452274 memcheck crashes with Assertion 'sci->status.what == SsIdle' failed 452779 Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0) 453055 shared_timed_mutex drd test fails with "Lock shared failed" message diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 9711b6573a..164c9ed910 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -193,15 +193,27 @@ static void init(void); if (info.clo_trace_malloc) { \ VALGRIND_INTERNAL_PRINTF(format, ## args ); } -/* Tries to set ERRNO to ENOMEM if possible. - Only implemented for glibc at the moment. -*/ +/* Tries to set ERRNO to ENOMEM/EINVAL if possible. */ #if defined(VGO_linux) extern int *__errno_location (void) __attribute__((weak)); #define SET_ERRNO_ENOMEM if (__errno_location) \ (*__errno_location ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL {} +#elif defined(VGO_freebsd) +extern int *__error (void) __attribute__((weak)); +#define SET_ERRNO_ENOMEM if (__error) \ + (*__error ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL if (__error) \ + (*__error ()) = VKI_EINVAL; +#elif defined(VGO_solaris) +extern int *___errno (void) __attribute__((weak)); +#define SET_ERRNO_ENOMEM if (___errno) \ + (*___errno ()) = VKI_ENOMEM; +#define SET_ERRNO_EINVAL if (___errno) \ + (*___errno ()) = VKI_EINVAL; #else #define SET_ERRNO_ENOMEM {} +#define SET_ERRNO_EINVAL {} #endif /* Below are new versions of malloc, __builtin_new, free, @@ -1482,6 +1494,7 @@ extern int *__errno_location (void) __attribute__((weak)); \ v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_memalign, alignment, n ); \ MALLOC_TRACE(" = %p\n", v ); \ + if (!v) SET_ERRNO_ENOMEM; \ return v; \ } @@ -1703,6 +1716,32 @@ extern int *__errno_location (void) __attribute__((weak)); /*---------------------- aligned_alloc ----------------------*/ + /* + * No OS does things the same way. + * + * Linux, the man page claims that the alignment must be a power + * of two and that size should be a multiple of alignment. + * However the only case that returns EINVAL (glibc 2.34) + * is if the alignement is > SIZE_MAX / 2 + 1 + * Also this is just a weak alias for memalign so this wrapper + * has no effect on Linux. + * + * FreeBSD. the man page claims alignment must be a power of 2. + * UB if size is not an integral multiple of alignment. + * The code checks that the alignment is a power of + * 2 and not less than the minumum alignment (1) + * + * Solaris: doesn't seem to exist on 11.3 + * Illumos: invalid if the size is 0, the alignment is 0, the + * alignment is not a multiple of 4 (no power of 2 + * requirement even though the manpage claims is) or the + * alignment is greater than MAX_ALIGN (whatever that is). + * Wrapper function that just calls memalign + * + */ + +#if defined (VGO_linux) + #define ALIGNED_ALLOC(soname, fnname) \ \ void* VG_REPLACE_FUNCTION_EZU(10170,soname,fnname) \ @@ -1725,6 +1764,33 @@ extern int *__errno_location (void) __attribute__((weak)); return mem; \ } +#else + + #define ALIGNED_ALLOC(soname, fnname) \ + \ + void* VG_REPLACE_FUNCTION_EZU(10170,soname,fnname) \ + ( SizeT alignment, SizeT size ); \ + void* VG_REPLACE_FUNCTION_EZU(10170,soname,fnname) \ + ( SizeT alignment, SizeT size ) \ + { \ + void *mem; \ + \ + if (alignment == 0 \ + || size % alignment != 0 \ + || (alignment & (alignment - 1)) != 0) { \ + SET_ERRNO_EINVAL; \ + return 0; \ + } \ + \ + mem = VG_REPLACE_FUNCTION_EZU(10110,VG_Z_LIBC_SONAME,memalign) \ + (alignment, size); \ + \ + if (!mem) SET_ERRNO_ENOMEM; \ + \ + return mem; \ + } +#endif + #if defined(VGO_linux) ALIGNED_ALLOC(VG_Z_LIBC_SONAME, aligned_alloc); ALIGNED_ALLOC(SO_SYN_MALLOC, aligned_alloc); diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index f70e822a41..b9dc4a6d76 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -79,14 +79,16 @@ EXTRA_DIST = \ eventfd1.vgtest \ eventfd1.stderr.exp eventfd1.stdout.exp \ eventfd2.vgtest \ - eventfd2.stderr.exp eventfd2.stdout.exp + eventfd2.stderr.exp eventfd2.stdout.exp \ + errno_aligned_allocs.vgtest \ + errno_aligned_allocs.stderr.exp check_PROGRAMS = \ statfs pdfork_pdkill getfsstat inlinfo inlinfo_nested.so extattr \ sigwait chflags get_set_login revoke scalar capsicum getfh \ linkat scalar_fork scalar_thr_exit scalar_abort2 scalar_pdfork \ scalar_vfork stat file_locking_wait6 utimens access chmod_chown \ - misc get_set_context utimes static_allocs fexecve + misc get_set_context utimes static_allocs fexecve errno_aligned_allocs AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.c b/memcheck/tests/freebsd/errno_aligned_allocs.c new file mode 100644 index 0000000000..50c4959af6 --- /dev/null +++ b/memcheck/tests/freebsd/errno_aligned_allocs.c @@ -0,0 +1,49 @@ +#include <stdlib.h> +#if defined(__FreeBSD__) +#include <malloc_np.h> +#endif +#include <assert.h> +#include <errno.h> + +int main(void) +{ + char* p = NULL; + int res; + + // zero alignment + res = posix_memalign((void**)&p, 0, 8); + assert(p == NULL && res == EINVAL); + // non multiple of alignment passes on FreeBSD + //res = posix_memalign((void**)&p, 8, 25); + //assert(p == NULL && res == EINVAL); + // align not multiple of sizeof(void*) + res = posix_memalign((void**)&p, 2, 32); + assert(p == NULL && res == EINVAL); + // align not power of two + res = posix_memalign((void**)&p, 40, 160); + assert(p == NULL && res == EINVAL); + // too big + res = posix_memalign((void**)&p, 16, 1UL<<48); + assert(p == NULL && res == ENOMEM); + errno = 0; + + + // if ever we make this multi-platform, Solaris doesn't support this + // zero size + p = aligned_alloc(0, 8); + assert(p == NULL && errno == EINVAL); + errno = 0; + // non multiple of alignment passes on FreeBSD + //p = aligned_alloc(8, 25); + //assert(p == NULL && errno == EINVAL); + //errno = 0; + // align not power of 2 + p = aligned_alloc(40, 160); + assert(p == NULL && errno == EINVAL); + errno = 0; + // too big + p = aligned_alloc(16, 1UL<<48); + assert(p == NULL && errno == ENOMEM); +} + + diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp new file mode 100644 index 0000000000..eb42921c60 --- /dev/null +++ b/memcheck/tests/freebsd/errno_aligned_allocs.stderr.exp @@ -0,0 +1,10 @@ + + +HEAP SUMMARY: + in use at exit: 0 bytes in 0 blocks + total heap usage: 0 allocs, 0 frees, 0 bytes allocated + +For a detailed leak analysis, rerun with: --leak-check=full + +For lists of detected and suppressed errors, rerun with: -s +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) diff --git a/memcheck/tests/freebsd/errno_aligned_allocs.vgtest b/memcheck/tests/freebsd/errno_aligned_allocs.vgtest new file mode 100644 index 0000000000..c5dc4696e8 --- /dev/null +++ b/memcheck/tests/freebsd/errno_aligned_allocs.vgtest @@ -0,0 +1,3 @@ +prog: errno_aligned_allocs + + |
|
From: Paul F. <pa...@so...> - 2022-05-09 19:29:05
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=35fcf875c6b7ba107e468d7a9d88df1e70058edd commit 35fcf875c6b7ba107e468d7a9d88df1e70058edd Author: Paul Floyd <pj...@wa...> Date: Mon May 9 21:27:36 2022 +0200 FreeBSD shm_open2 also accepts first argument as SHM_ANON Add an extra test to scalar Diff: --- memcheck/tests/freebsd/scalar_13_plus.c | 6 +++++- memcheck/tests/freebsd/scalar_13_plus.stderr.exp | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/memcheck/tests/freebsd/scalar_13_plus.c b/memcheck/tests/freebsd/scalar_13_plus.c index 4ba48efa60..b22152ebb2 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.c +++ b/memcheck/tests/freebsd/scalar_13_plus.c @@ -1,4 +1,5 @@ #include "scalar.h" +#include <sys/mman.h> int main(void) { @@ -7,7 +8,10 @@ int main(void) /* SYS_shm_open2 571 */ GO(SYS_shm_open2, " 5s 2m"); - SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0+4); FAIL; + SY(SYS_shm_open2, x0+0xf00c, x0+1, x0+2, x0+3, x0+4); FAIL; + + GO(SYS_shm_open2, " 5s 1m"); + SY(SYS_shm_open2, x0+SHM_ANON, x0+1, x0+2, x0+3, x0+4); FAIL; /* SYS___realpathat 574 */ GO(SYS___realpathat, " 5s 2m"); diff --git a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp index 02447b53ae..489646810b 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp +++ b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp @@ -24,6 +24,28 @@ Syscall param shm_open2(name) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +571: SYS_shm_open2 5s 1m +--------------------------------------------------------- +Syscall param shm_open2(path) contains uninitialised byte(s) + ... + +Syscall param shm_open2(flags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(mode) contains uninitialised byte(s) + ... + +Syscall param shm_open2(shmflags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(name) contains uninitialised byte(s) + ... + +Syscall param shm_open2(name) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 574: SYS___realpathat 5s 2m --------------------------------------------------------- |
|
From: Paul F. <pa...@so...> - 2022-05-09 10:00:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d99b369c094145fd0203fbde59bd6d173b8bc5d0 commit d99b369c094145fd0203fbde59bd6d173b8bc5d0 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 11:58:45 2022 +0200 FreeBSD shm_open2 arg5 seems to be optional This syscall doesn't have a libc interface and manpage so the documentation is skimpy. Diff: --- coregrind/m_syswrap/syswrap-freebsd.c | 4 +++- memcheck/tests/freebsd/scalar_13_plus.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index eed1b5a6da..0f2c2681d3 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6241,7 +6241,9 @@ PRE(sys_shm_open2) PRE_MEM_RASCIIZ( "shm_open2(path)", ARG1 ); } - PRE_MEM_RASCIIZ( "shm_open2(name)", ARG5 ); + if (ARG5) { + PRE_MEM_RASCIIZ( "shm_open2(name)", ARG5 ); + } *flags |= SfMayBlock; } diff --git a/memcheck/tests/freebsd/scalar_13_plus.c b/memcheck/tests/freebsd/scalar_13_plus.c index a0f5dfe363..4ba48efa60 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.c +++ b/memcheck/tests/freebsd/scalar_13_plus.c @@ -7,7 +7,7 @@ int main(void) /* SYS_shm_open2 571 */ GO(SYS_shm_open2, " 5s 2m"); - SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0); FAIL; + SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0+4); FAIL; /* SYS___realpathat 574 */ GO(SYS___realpathat, " 5s 2m"); |
|
From: Paul F. <pa...@so...> - 2022-05-09 09:06:23
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3a883a6c1d46782e8f1d7c1b2bb773728ed61355 commit 3a883a6c1d46782e8f1d7c1b2bb773728ed61355 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 11:05:49 2022 +0200 Add FreeBSD shm_open2 syscall wrapper Diff: --- coregrind/m_syswrap/priv_syswrap-freebsd.h | 2 +- coregrind/m_syswrap/syswrap-freebsd.c | 40 ++++++++++++++++++++++-- memcheck/tests/freebsd/scalar_13_plus.c | 4 +++ memcheck/tests/freebsd/scalar_13_plus.stderr.exp | 26 +++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 36a48ac1ff..5d6bec529c 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -533,7 +533,7 @@ DECL_TEMPLATE(freebsd, sys___sysctlbyname) // 570 #if (FREEBSD_VERS >= FREEBSD_13_0) // looks like close_range got backported // to 12.2 leaving these 4 marked as UNIMPL in 12.2 -// unimpl __NR_shm_open2 571 +DECL_TEMPLATE(freebsd, sys_shm_open2) // 571 // unimpl __NR_shm_rename 572 // unimpl __NR_sigfastblock 573 DECL_TEMPLATE(freebsd, sys___realpathat) // 574 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 64260f8a9a..eed1b5a6da 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6221,7 +6221,43 @@ POST(sys___sysctlbyname) #if (FREEBSD_VERS >= FREEBSD_13_0) -// SYS___realpathat 474 +// SYS_shm_open2 571 +// from syscalls.master +// int shm_open2(_In_z_ const char *path, +// int flags, +// mode_t mode, +// int shmflags, +// _In_z_ const char *name); +PRE(sys_shm_open2) +{ + PRE_REG_READ5(int, "shm_open2", + const char *, path, int, flags, vki_mode_t, mode, int, shmflags, const char*, name); + if (ARG1 == VKI_SHM_ANON) { + PRINT("sys_shm_open2(%#" FMT_REGWORD "x(SHM_ANON), %" FMT_REGWORD "u, %hu, %d, %#" FMT_REGWORD "x(%s))", + ARG1, ARG2, (vki_mode_t)ARG3, (Int)ARG4, ARG5, (HChar*)ARG5); + } else { + PRINT("sys_shm_open2(%#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u, %hu, %d, %#" FMT_REGWORD "x(%s))", + ARG1, (HChar *)ARG1, ARG2, (vki_mode_t)ARG3, (Int)ARG4, ARG5, (HChar*)ARG5); + PRE_MEM_RASCIIZ( "shm_open2(path)", ARG1 ); + } + + PRE_MEM_RASCIIZ( "shm_open2(name)", ARG5 ); + *flags |= SfMayBlock; +} + +POST(sys_shm_open2) +{ + vg_assert(SUCCESS); + if (!ML_(fd_allowed)(RES, "shm_open2", tid, True)) { + VG_(close)(RES); + SET_STATUS_Failure( VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + ML_(record_fd_open_with_given_name)(tid, RES, (HChar*)ARG1); + } +} + +// SYS___realpathat 574 // from syscalls.master // int __realpathat(int fd, // _In_z_ const char *path, @@ -6969,7 +7005,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDXY(__NR___sysctlbyname, sys___sysctlbyname), // 570 #if (FREEBSD_VERS >= FREEBSD_13_0) - // unimpl __NR_shm_open2 571 + BSDXY(__NR_shm_open2, sys_shm_open2), // 571 // unimpl __NR_shm_rename 572 // unimpl __NR_sigfastblock 573 BSDXY( __NR___realpathat, sys___realpathat), // 574 diff --git a/memcheck/tests/freebsd/scalar_13_plus.c b/memcheck/tests/freebsd/scalar_13_plus.c index 5cb8102465..a0f5dfe363 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.c +++ b/memcheck/tests/freebsd/scalar_13_plus.c @@ -5,6 +5,10 @@ int main(void) long *px = malloc(2*sizeof(long)); x0 = px[0]; + /* SYS_shm_open2 571 */ + GO(SYS_shm_open2, " 5s 2m"); + SY(SYS_shm_open2, x0, x0+1, x0+2, x0+3, x0); FAIL; + /* SYS___realpathat 574 */ GO(SYS___realpathat, " 5s 2m"); SY(SYS___realpathat, x0+0xffff, x0, x0, x0+100, x0+2); FAIL; diff --git a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp index 91721fc7af..02447b53ae 100644 --- a/memcheck/tests/freebsd/scalar_13_plus.stderr.exp +++ b/memcheck/tests/freebsd/scalar_13_plus.stderr.exp @@ -1,3 +1,29 @@ +--------------------------------------------------------- +571: SYS_shm_open2 5s 2m +--------------------------------------------------------- +Syscall param shm_open2(path) contains uninitialised byte(s) + ... + +Syscall param shm_open2(flags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(mode) contains uninitialised byte(s) + ... + +Syscall param shm_open2(shmflags) contains uninitialised byte(s) + ... + +Syscall param shm_open2(name) contains uninitialised byte(s) + ... + +Syscall param shm_open2(path) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param shm_open2(name) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 574: SYS___realpathat 5s 2m --------------------------------------------------------- |
|
From: Paul F. <pa...@so...> - 2022-05-09 07:50:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a17b8d0198b994567576cd7cd0673ea875ef54a6 commit a17b8d0198b994567576cd7cd0673ea875ef54a6 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 09:47:12 2022 +0200 Add FreeBSD-specific expected for memcheck/tests/gone_abrt_xml The difference is in the si_code. Linux has a value of 0, FreeBSD has 65537. This is correct. From vki-freebsd.h /* * si_code values */ and indeed this signal gets sent by kill() Diff: --- memcheck/tests/Makefile.am | 1 + memcheck/tests/gone_abrt_xml.stderr.exp-freebsd | 63 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index eb6725f8d2..eb9487272d 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -163,6 +163,7 @@ EXTRA_DIST = \ fprw.stderr.exp-freebsd-x86 \ fwrite.stderr.exp fwrite.vgtest fwrite.stderr.exp-kfail \ gone_abrt_xml.vgtest gone_abrt_xml.stderr.exp gone_abrt_xml.stderr.exp-solaris \ + gone_abrt_xml.stderr.exp-freebsd \ holey_buffer_too_small.vgtest holey_buffer_too_small.stdout.exp \ holey_buffer_too_small.stderr.exp \ inits.stderr.exp inits.vgtest \ diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd new file mode 100644 index 0000000000..c97485faf4 --- /dev/null +++ b/memcheck/tests/gone_abrt_xml.stderr.exp-freebsd @@ -0,0 +1,63 @@ +<?xml version="1.0"?> + +<valgrindoutput> + +<protocolversion>4</protocolversion> +<protocoltool>memcheck</protocoltool> + +<preamble> + <line>...</line> + <line>...</line> + <line>...</line> + <line>...</line> +</preamble> + +<pid>...</pid> +<ppid>...</ppid> +<tool>memcheck</tool> + +<args> + <vargv>...</vargv> + <argv> + <exe>./../../gdbserver_tests/gone</exe> + <arg>abort</arg> + </argv> +</args> + +<status> + <state>RUNNING</state> + <time>...</time> +</status> + +starting ... +aborting ... +<fatal_signal> + <tid>...</tid> + <signo>6</signo> + <signame>SIGABRT</signame> + <sicode>65537</sicode> + <stack> + <frame> + <ip>0x........</ip> + <obj>...</obj> + <fn>main</fn> + <dir>...</dir> + <file>gone.c</file> + <line>...</line> + </frame> + </stack> +</fatal_signal> + + +<status> + <state>FINISHED</state> + <time>...</time> +</status> + +<errorcounts> +</errorcounts> + +<suppcounts>...</suppcounts> + +</valgrindoutput> + |
|
From: Paul F. <pa...@so...> - 2022-05-09 07:18:33
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=1ec5d23e7386e6f2687f0f2087fbbc1a0c0e945b commit 1ec5d23e7386e6f2687f0f2087fbbc1a0c0e945b Author: Paul Floyd <pj...@wa...> Date: Mon May 9 09:16:48 2022 +0200 Make memcheck/tests/clientperm clang-friendly The use of the ternary operator was causing diffs compared to GCC output. Switching to use two 'ifs' should remove this difference. Diff: --- memcheck/tests/clientperm.c | 10 ++++++++-- memcheck/tests/clientperm.stderr.exp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/memcheck/tests/clientperm.c b/memcheck/tests/clientperm.c index ac7574788d..12e2123fca 100644 --- a/memcheck/tests/clientperm.c +++ b/memcheck/tests/clientperm.c @@ -26,14 +26,20 @@ int main ( void ) for (i = 0; i < 100; i++) sum += aa[i]; - printf("sum is %s\n", sum > 0 ? "positive" : "non-positive"); + if (sum > 0) + printf("sum is positive\n"); + else + printf("sum is non-positive\n"); m = VALGRIND_DISCARD(m); printf("m_rm: returned value is %d\n", m ); for (i = 0; i < 100; i++) sum += aa[i]; - printf("sum is %s\n", sum > 0 ? "positive" : "non-positive"); + if (sum > 0) + printf("sum is positive\n"); + else + printf("sum is non-positive\n"); return 0; } diff --git a/memcheck/tests/clientperm.stderr.exp b/memcheck/tests/clientperm.stderr.exp index cb838c9ed8..76c4f5cab1 100644 --- a/memcheck/tests/clientperm.stderr.exp +++ b/memcheck/tests/clientperm.stderr.exp @@ -2,5 +2,5 @@ Conditional jump or move depends on uninitialised value(s) at 0x........: main (clientperm.c:29) Conditional jump or move depends on uninitialised value(s) - at 0x........: main (clientperm.c:36) + at 0x........: main (clientperm.c:39) |
|
From: Paul F. <pa...@so...> - 2022-05-09 06:17:56
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=54ee45d20808e02fcb162b29ef5f4d708c491884 commit 54ee45d20808e02fcb162b29ef5f4d708c491884 Author: Paul Floyd <pj...@wa...> Date: Mon May 9 08:15:06 2022 +0200 Update clang version of insn-pmovmskb expected. I'm not sure when this output changed. This expected differs from the main GCC expected due to clang emitting a cmovne for the ternary expression in 'use': fprintf(stderr, "%d: Invalid value is %s\n", index, invalid ? "true" : "false"); Diff: --- .../tests/amd64/insn-pmovmskb.stderr.exp-clang | 51 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang b/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang index 6d32a1f331..e76c9ba126 100644 --- a/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang +++ b/memcheck/tests/amd64/insn-pmovmskb.stderr.exp-clang @@ -1,22 +1,55 @@ -Conditional jump or move depends on uninitialised value(s) +Use of uninitialised value of size 8 + at 0x........: strlen (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) by 0x........: main (insn-pmovmskb.c:140) Use of uninitialised value of size 8 + at 0x........: strlen (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) by 0x........: main (insn-pmovmskb.c:140) -Use of uninitialised value of size 8 +Conditional jump or move depends on uninitialised value(s) + at 0x........: is_overlap (vg_replace_strmem.c:...) + by 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:69) + by 0x........: main (insn-pmovmskb.c:140) + +Conditional jump or move depends on uninitialised value(s) + at 0x........: memcpy (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) by 0x........: main (insn-pmovmskb.c:140) Use of uninitialised value of size 8 + at 0x........: memcpy (vg_replace_strmem.c:...) ... by 0x........: use (insn-pmovmskb.c:48) by 0x........: doit (insn-pmovmskb.c:69) @@ -32,6 +65,20 @@ Use of uninitialised value of size 8 7: Invalid value is false 8: Invalid value is false 9: Invalid value is false +Use of uninitialised value of size 8 + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:109) + by 0x........: main (insn-pmovmskb.c:140) + +Use of uninitialised value of size 8 + at 0x........: memcpy (vg_replace_strmem.c:...) + ... + by 0x........: use (insn-pmovmskb.c:48) + by 0x........: doit (insn-pmovmskb.c:109) + by 0x........: main (insn-pmovmskb.c:140) + 10: Invalid value is false 11: Invalid value is false 12: Invalid value is false |
|
From: Paul F. <pa...@so...> - 2022-05-09 05:50:42
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=407c00c2e9ef2bf3e87412d01e8ebc7baefbe8ef commit 407c00c2e9ef2bf3e87412d01e8ebc7baefbe8ef Author: Paul Floyd <pj...@wa...> Date: Mon May 9 07:49:56 2022 +0200 FreeBSD: only set osrel for executables. Diff: --- coregrind/m_debuginfo/readelf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index c586e3f332..998bc08fab 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -1147,6 +1147,12 @@ void read_and_set_osrel(DiImage* img) ElfXX_Ehdr ehdr; ML_(img_get)(&ehdr, img, 0, sizeof(ehdr)); + + /* only set osrel for executable files, not for subsequent shared libraries */ + if (ehdr.e_type != ET_EXEC) { + return; + } + /* Skip the phdrs when we have to search the shdrs. In separate .debug files the phdrs might not be valid (they are a copy of the main ELF file) and might trigger assertions when getting |
|
From: Paul F. <pa...@so...> - 2022-05-07 15:33:58
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e23f5b6a140bd02d743abee705c5a2ab0d7453d6 commit e23f5b6a140bd02d743abee705c5a2ab0d7453d6 Author: Paul Floyd <pj...@wa...> Date: Sat May 7 17:30:23 2022 +0200 FreeBSD x86 small logging changes and add comments explaining why none/tests/manythreads fails Diff: --- coregrind/m_syswrap/syswrap-x86-freebsd.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c index 0ba304952f..4abd44cda6 100644 --- a/coregrind/m_syswrap/syswrap-x86-freebsd.c +++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c @@ -395,7 +395,7 @@ static void deallocate_LGDTs_for_thread ( VexGuestX86State* vex ) if (0) VG_(printf)("deallocate_LGDTs_for_thread: " - "ldt = 0x%x, gdt = 0x%x\n", + "ldt = 0x%llx, gdt = 0x%llx\n", vex->guest_LDT, vex->guest_GDT ); if (vex->guest_LDT != (HWord)NULL) { @@ -481,6 +481,26 @@ static SysRes sys_get_thread_area ( ThreadId tid, Int idx, void ** basep ) void VG_(cleanup_thread) ( ThreadArchState* arch ) { + /* + * This is what x86 Linux does but it doesn't work off the bat for x86 FreeBSD + * My suspicion is that the rtld code uses the TCB stored in the GDT after the + * end of thr_exit. + * Alternatively the rtld use is after the start of the next thread and we haven't + * reallocated this memory + */ + /*deallocate_LGDTs_for_thread( &arch->vex );*/ + + /* + * This was plan B, just recycle the slot + * It fixes none/tests/manythreads + * but it breaks drd/tests/fork-parallel + */ +#if 0 + VexGuestX86SegDescr* gdt = (VexGuestX86SegDescr*) arch->vex.guest_GDT; + if (gdt) + translate_to_hw_format(0, &gdt[arch->vex.guest_GS >> 3]); +#endif + } @@ -698,7 +718,7 @@ PRE(sys_rfork) *flags |= SfYieldAfter; } #else - VG_(message)(Vg_UserMsg, "fork() not implemented"); + VG_(message)(Vg_UserMsg, "rfork() not implemented"); VG_(unimplemented)("Valgrind does not support rfork() yet."); SET_STATUS_Failure( VKI_ENOSYS ); #endif |
|
From: Paul F. <pa...@so...> - 2022-05-07 15:29:24
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=295ce0e64356a6a1e311a02f97907f55b593565f commit 295ce0e64356a6a1e311a02f97907f55b593565f Author: Paul Floyd <pj...@wa...> Date: Sat May 7 17:28:08 2022 +0200 Update FreeBSD struct vki_kinfo_vmentry Diff: --- coregrind/m_aspacemgr/aspacemgr-linux.c | 2 +- include/vki/vki-freebsd.h | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 9a69f3850f..933d6d9de2 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -3944,7 +3944,7 @@ static void parse_procselfmaps ( endPlusOne = (UWord)kve->kve_end; foffset = kve->kve_offset; filename = kve->kve_path; - dev = kve->kve_fsid; + dev = kve->kve_fsid_freebsd11; ino = kve->kve_fileid; if (filename[0] != '/') { filename = NULL; diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index f50598e093..38c5014188 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -2126,17 +2126,23 @@ struct vki_kinfo_vmentry { int kve_type; ULong kve_start; ULong kve_end; - Off64T kve_offset; + ULong kve_offset; ULong kve_fileid; - UInt kve_fsid; + UInt kve_fsid_freebsd11; int kve_flags; int kve_resident; int kve_private_resident; int kve_protection; int kve_ref_count; int kve_shadow_count; - int _kve_pad0; - int kve_ispare[16]; + int kve_vn_type; + ULong kve_vn_size; + UInt kve_vn_rdev_freebsd11; + UShort kve_vn_mode; + UShort kve_status; + ULong kve_vn_fsid; + ULong kve_vn_rdev; + int _kve_ispare[8]; char kve_path[VKI_PATH_MAX]; }; |