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
(1) |
3
(1) |
4
(5) |
5
|
6
(1) |
7
|
|
8
(10) |
9
(7) |
10
(2) |
11
(10) |
12
(1) |
13
|
14
(1) |
|
15
(3) |
16
|
17
|
18
|
19
|
20
|
21
(5) |
|
22
(2) |
23
(2) |
24
(4) |
25
(2) |
26
|
27
(7) |
28
(4) |
|
29
(5) |
30
(5) |
31
(1) |
|
|
|
|
|
From: Paul F. <pa...@so...> - 2023-01-24 20:54:56
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e56436d5602d04023c768560c469ad0d4dab0a76 commit e56436d5602d04023c768560c469ad0d4dab0a76 Author: Paul Floyd <pj...@wa...> Date: Tue Jan 24 21:54:09 2023 +0100 FreeBSD: fix build on older OSes A bad copy-and-paste broke compilation on FreeBSD 12. Diff: --- coregrind/m_libcfile.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index aad0cb199c..e98de3e96f 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -1792,17 +1792,19 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved) HChar tmp[VKI_PATH_MAX]; struct vg_stat statbuf; - SysRes res = VG_(lstat)(exe_name, &statbuf); + SysRes res = VG_(lstat)(path, &statbuf); if (sr_isError(res)) { return False; - } else if (VKI_S_ISLNK(statbuf.mode)) { - SizeT link_len = VG_(readlink)(exe_name, tmp, VKI_PATH_MAX); + } + + if (VKI_S_ISLNK(statbuf.mode)) { + SizeT link_len = VG_(readlink)(path, tmp, VKI_PATH_MAX); tmp[link_len] = '\0'; resolved_name = tmp; } else { // not a link - resolved_name = exe_name; + resolved_name = path; } if (resolved_name[0] != '/') { @@ -1810,10 +1812,12 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved) if (resolved_name[0] == '.' && resolved_name[1] == '/') { resolved_name += 2; } - VG_(snprintf)(out, *len, "%s/%s", VG_(get_startup_wd)(), resolved_name); + VG_(snprintf)(resolved, VKI_PATH_MAX, "%s/%s", VG_(get_startup_wd)(), resolved_name); } else { - VG_(snprintf)(out, *len, "%s", resolved_name); + VG_(snprintf)(resolved, VKI_PATH_MAX, "%s", resolved_name); } + + return True; #endif } #endif |
|
From: Paul F. <pa...@so...> - 2023-01-24 20:05:16
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8dba06c771b1761775534c222f1375ecf661dc58 commit 8dba06c771b1761775534c222f1375ecf661dc58 Author: Paul Floyd <pj...@wa...> Date: Tue Jan 24 21:03:48 2023 +0100 FreeBSD: remove different reserved fds number No idea where it originated. Causes no problems on FreeBSD 13.1 amd64. Diff: --- coregrind/m_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 7a22b088a0..4316e625fa 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1134,11 +1134,7 @@ void main_process_cmd_line_options( void ) /* Number of file descriptors that Valgrind tries to reserve for its own use - just a small constant. */ -#if defined(VGO_freebsd) -#define N_RESERVED_FDS (20) -#else #define N_RESERVED_FDS (12) -#endif static void setup_file_descriptors(void) { |
|
From: Paul F. <pa...@so...> - 2023-01-24 19:42:09
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7886c072e1bc7939c22ab445ac0a9a0625737a78 commit 7886c072e1bc7939c22ab445ac0a9a0625737a78 Author: Paul Floyd <pj...@wa...> Date: Tue Jan 24 20:38:26 2023 +0100 FreeBSD: switch to FreeBSD 12 versions of syscalls for fstat etc This was a change that enabled 64bit inodes (ino64). Also a couple of typos in READMEs. Diff: --- README_DEVELOPERS | 2 +- README_MISSING_SYSCALL_OR_IOCTL | 4 ++-- coregrind/m_aspacemgr/aspacemgr-common.c | 5 +++-- coregrind/m_libcfile.c | 24 ++++++++++++++++-------- include/vki/vki-freebsd.h | 2 ++ 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/README_DEVELOPERS b/README_DEVELOPERS index 86f539bb6f..6f7d1a9eee 100644 --- a/README_DEVELOPERS +++ b/README_DEVELOPERS @@ -136,7 +136,7 @@ A different and possibly easier way is as follows: (2) In a different shell, do "gdb /proc/<pid>/exe <pid>", where <pid> you read from the output printed by (1). This attaches - GDB to the tool executable, which should be in the abovementioned + GDB to the tool executable, which should be in the above mentioned wait loop. (3) Do "cont" to continue. After the loop finishes spinning, startup diff --git a/README_MISSING_SYSCALL_OR_IOCTL b/README_MISSING_SYSCALL_OR_IOCTL index 0019951e75..8ddced5c99 100644 --- a/README_MISSING_SYSCALL_OR_IOCTL +++ b/README_MISSING_SYSCALL_OR_IOCTL @@ -19,7 +19,7 @@ What are syscall/ioctl wrappers? What do they do? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Valgrind does what it does, in part, by keeping track of everything your program does. When a system call happens, for example a request to read -part of a file, control passes to the Linux kernel, which fulfills the +part of a file, control passes to the Linux kernel, which fulfils the request, and returns control to your program. The problem is that the kernel will often change the status of some part of your program's memory as a result, and tools (instrumentation plug-ins) may need to know about @@ -29,7 +29,7 @@ Syscall and ioctl wrappers have two jobs: 1. Tell a tool what's about to happen, before the syscall takes place. A tool could perform checks beforehand, eg. if memory about to be written - is actually writeable. This part is useful, but not strictly + is actually writable. This part is useful, but not strictly essential. 2. Tell a tool what just happened, after a syscall takes place. This is diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 282cc50d70..816d2274f4 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -386,10 +386,11 @@ Bool ML_(am_get_fd_d_i_m)( Int fd, } return False; # elif defined(VGO_freebsd) +#if (FREEBSD_VERS < FREEBSD_12) struct vki_freebsd11_stat buf; -#if (FREEBSD_VERS >= FREEBSD_12) - SysRes res = VG_(do_syscall2)(__NR_freebsd11_fstat, fd, (UWord)&buf); + SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf); #else + struct vki_stat buf; SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf); #endif if (!sr_isError(res)) { diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 84de11a5c8..aad0cb199c 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -260,8 +260,13 @@ SysRes VG_(mknod) ( const HChar* pathname, Int mode, UWord dev ) SysRes res = VG_(do_syscall3)(__NR_mknod, (UWord)pathname, mode, dev); # elif defined(VGO_freebsd) +#if (FREEBSD_VERS < FREEBSD_12) SysRes res = VG_(do_syscall3)(__NR_freebsd11_mknod, (UWord)pathname, mode, dev); +#else + SysRes res = VG_(do_syscall4)(__NR_mknodat, VKI_AT_FDCWD, + (UWord)pathname, mode, dev); +#endif # elif defined(VGO_solaris) SysRes res = VG_(do_syscall4)(__NR_mknodat, VKI_AT_FDCWD, (UWord)pathname, mode, dev); @@ -556,11 +561,12 @@ SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* vgbuf ) } # elif defined(VGO_freebsd) { +#if (FREEBSD_VERS < FREEBSD_12) struct vki_freebsd11_stat buf; -#if (FREEBSD_VERS >= FREEBSD_12) - res = VG_(do_syscall2)(__NR_freebsd11_stat, (UWord)file_name, (UWord)&buf); -#else res = VG_(do_syscall2)(__NR_stat, (UWord)file_name, (UWord)&buf); +#else + struct vki_stat buf; + res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, 0); #endif if (!sr_isError(res)) { TRANSLATE_TO_vg_stat(vgbuf, &buf); @@ -632,10 +638,11 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf ) } # elif defined(VGO_freebsd) { +#if (FREEBSD_VERS < FREEBSD_12) struct vki_freebsd11_stat buf; -#if (FREEBSD_VERS >= FREEBSD_12) - res = VG_(do_syscall2)(__NR_freebsd11_fstat, (RegWord)fd, (RegWord)(Addr)&buf); + res = VG_(do_syscall2)(__NR_fstat, (RegWord)fd, (RegWord)(Addr)&buf); #else + struct vki_stat buf; res = VG_(do_syscall2)(__NR_fstat, (RegWord)fd, (RegWord)(Addr)&buf); #endif if (!sr_isError(res)) { @@ -655,11 +662,12 @@ SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf ) SysRes res; VG_(memset)(vgbuf, 0, sizeof(*vgbuf)); +#if (FREEBSD_VERS < FREEBSD_12) struct vki_freebsd11_stat buf; -#if (FREEBSD_VERS >= FREEBSD_12) - res = VG_(do_syscall2)(__NR_freebsd11_lstat, (UWord)file_name, (UWord)&buf); -#else res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); +#else + struct vki_stat buf; + res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); #endif if (!sr_isError(res)) { TRANSLATE_TO_vg_stat(vgbuf, &buf); diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index a7344242e9..2bbaa44188 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -1558,6 +1558,8 @@ struct vki_dirent { #define VKI_O_SEARCH O_EXEC #define VKI_AT_FDCWD AT_FDCWD +#define VKI_AT_SYMLINK_NOFOLLOW 0x0200 + #define VKI_F_DUPFD 0 /* dup */ #define VKI_F_GETFD 1 /* get close_on_exec */ |
|
From: Paul F. <pa...@so...> - 2023-01-23 08:07:01
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=5a6f1c1322d742308aaa4b3c1d937942b3de6c5a commit 5a6f1c1322d742308aaa4b3c1d937942b3de6c5a Author: Paul Floyd <pj...@wa...> Date: Mon Jan 23 09:05:50 2023 +0100 Bug 435441 - valgrind fails to interpose malloc on musl 1.2.2 due to weak symbol name and no libc soname Patch by Michael Forney <mf...@mf...> Diff: --- NEWS | 1 + coregrind/m_debuginfo/readelf.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c8ae4289cd..02296575c4 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 392331 Spurious lock not held error from inside pthread_cond_timedwait 400793 pthread_rwlock_timedwrlock false positive 433873 openat2 syscall unimplemented on Linux +435441 valgrind fails to interpose malloc on musl 1.2.2 due to weak symbol name and no libc soname 444110 priv/guest_ppc_toIR.c:36198:31: warning: duplicated 'if' condition. 444488 Use glibc.pthread.stack_cache_size tunable 444568 drd/tests/pth_barrier_thr_cr fails on Fedora 38 diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index 56e7d4b6f0..ce7b7998de 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -429,7 +429,8 @@ Bool get_elf_symbol_info ( } # endif - if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL) { + if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL + || ELFXX_ST_BIND(sym->st_info) == STB_WEAK) { *is_global_out = True; } |
|
From: Paul F. <pa...@so...> - 2023-01-23 06:29:14
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7f9531098591dc216fba9563c107db38b56b10e3 commit 7f9531098591dc216fba9563c107db38b56b10e3 Author: Paul Floyd <pj...@wa...> Date: Mon Jan 23 07:27:55 2023 +0100 FreeBSD: More details on interrupting vgdb and correct 1 typo. Diff: --- README.freebsd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.freebsd b/README.freebsd index 6aab37b8d2..e92dfd5932 100644 --- a/README.freebsd +++ b/README.freebsd @@ -35,7 +35,10 @@ Known Limitations (June 2022) to DWARF extensions ised by GCC. b) Code that uses OpenMP will generate spurious errors. 2. vgdb invoker, which uses ptrace, may cause system calls to be - interrupted. + interrupted. As an example, if the debuggee seems to have be + stuck and you press Ctrl-C in gdb the debuggee may execute + one more statement before stopping and returning control to + gdb. Notes for Developers ~~~~~~~~~~~~~~~~~~~~ @@ -99,9 +102,8 @@ executed with PRE_READ_REGX. This macro lets Valgrind know about the number and types of the syscall arguments which allows Valgrind to check that they are initialized. X is the number of arguments. It is best that the argument names match -the man page, but the must match the types and number of arguments in -syscalls.master. -Occasionally there are differences between the two. +the man page, but they must match the types and number of arguments in +syscalls.master. Occasionally there are differences between the two. If the syscall takes pointers to memory there will be one of the following for each pointer argument. |
|
From: Paul F. <pa...@so...> - 2023-01-22 20:50:11
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c15993dcb4d454ab74f2a37b76391006d5e3637d commit c15993dcb4d454ab74f2a37b76391006d5e3637d Author: Paul Floyd <pj...@wa...> Date: Sun Jan 22 21:48:51 2023 +0100 FreeBSD: start adding more checks for /proc Also add a couple of expecteds. Diff: --- coregrind/m_clientstate.c | 4 + coregrind/m_main.c | 12 ++ coregrind/m_syswrap/syswrap-freebsd.c | 30 ++-- coregrind/pub_core_clientstate.h | 4 + memcheck/tests/Makefile.am | 2 - memcheck/tests/origin5-bz2.stderr.exp-freebsd | 158 ---------------------- memcheck/tests/origin5-bz2.stderr.exp-freebsd-x86 | 158 ---------------------- 7 files changed, 36 insertions(+), 332 deletions(-) diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c index 93662dcb3d..7b343f27a5 100644 --- a/coregrind/m_clientstate.c +++ b/coregrind/m_clientstate.c @@ -129,6 +129,10 @@ client__gnu_get_libc_version_type VG_(client__gnu_get_libc_version_addr) = 0; Int* VG_(vfork_fildes_addr) = 0; #endif +#if defined(VGO_freebsd) +Bool VG_(have_slash_proc) = False; +#endif + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 27ec451433..7a22b088a0 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1719,6 +1719,18 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) } #endif +#if defined(VGO_freebsd) + /* On FreeBSD /proc is optional + * Most functionality is accessed through sysctl instead */ + if (!need_help) { + struct vg_stat statbuf; + SysRes statres = VG_(stat)("/proc", &statbuf); + if (!sr_isError(statres) || VKI_S_ISLNK(statbuf.mode)) { + VG_(have_slash_proc) = True; + } + } +#endif + //-------------------------------------------------------------- // Init tool part 1: pre_clo_init // p: setup_client_stack() [for 'VG_(client_arg[cv]'] diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 129df533df..401a7ba8ee 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5334,21 +5334,23 @@ PRE(sys_readlinkat) PRE_MEM_RASCIIZ( "readlinkat(path)", ARG2 ); PRE_MEM_WRITE( "readlinkat(buf)", ARG3,ARG4 ); - /* - * Handle the case where readlinkat is looking at /proc/curproc/file or - * /proc/<pid>/file. - */ - VG_(sprintf)(name, "/proc/%d/file", VG_(getpid)()); - if (ML_(safe_to_deref)((void*)ARG2, 1) - && (VG_(strcmp)((HChar *)ARG2, name) == 0 - || VG_(strcmp)((HChar *)ARG2, "/proc/curproc/file") == 0)) { - VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd)); - SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, - ARG3, ARG4)); - } else { - /* Normal case */ - SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, ARG2, ARG3, ARG4)); + if (VG_(have_slash_proc) == True) { + /* + * Handle the case where readlinkat is looking at /proc/curproc/file or + * /proc/<pid>/file. + */ + VG_(sprintf)(name, "/proc/%d/file", VG_(getpid)()); + if (ML_(safe_to_deref)((void*)ARG2, 1) + && (VG_(strcmp)((HChar *)ARG2, name) == 0 + || VG_(strcmp)((HChar *)ARG2, "/proc/curproc/file") == 0)) { + VG_(sprintf)(name, "/proc/curproc/fd/%d", VG_(cl_exec_fd)); + SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, (UWord)name, + ARG3, ARG4)); + return; + } } + /* Normal case */ + SET_STATUS_from_SysRes( VG_(do_syscall4)(saved, ARG1, ARG2, ARG3, ARG4)); } POST(sys_readlinkat) diff --git a/coregrind/pub_core_clientstate.h b/coregrind/pub_core_clientstate.h index 824ce1e05f..dceece9b90 100644 --- a/coregrind/pub_core_clientstate.h +++ b/coregrind/pub_core_clientstate.h @@ -127,6 +127,10 @@ extern client__gnu_get_libc_version_type VG_(client__gnu_get_libc_version_addr); extern Int* VG_(vfork_fildes_addr); #endif +#if defined(VGO_freebsd) +extern Bool VG_(have_slash_proc); +#endif + #endif // __PUB_CORE_CLIENTSTATE_H /*--------------------------------------------------------------------*/ diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index c382af5e07..aa936ac05e 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -249,8 +249,6 @@ EXTRA_DIST = \ origin5-bz2.stderr.exp-glibc27-ppc64 \ origin5-bz2.stderr.exp-glibc212-s390x \ origin5-bz2.stderr.exp-glibc234-s390x \ - origin5-bz2.stderr.exp-freebsd \ - origin5-bz2.stderr.exp-freebsd-x86 \ origin5-bz2.stderr.exp-glibc218-mips32 \ origin6-fp.vgtest origin6-fp.stdout.exp \ origin6-fp.stderr.exp-glibc25-amd64 \ diff --git a/memcheck/tests/origin5-bz2.stderr.exp-freebsd b/memcheck/tests/origin5-bz2.stderr.exp-freebsd deleted file mode 100644 index b1ac2cd5e0..0000000000 --- a/memcheck/tests/origin5-bz2.stderr.exp-freebsd +++ /dev/null @@ -1,158 +0,0 @@ -Conditional jump or move depends on uninitialised value(s) - at 0x........: main (origin5-bz2.c:6481) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Conditional jump or move depends on uninitialised value(s) - at 0x........: copy_input_until_stop (origin5-bz2.c:4686) - by 0x........: handle_compress (origin5-bz2.c:4750) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: copy_input_until_stop (origin5-bz2.c:4686) - by 0x........: handle_compress (origin5-bz2.c:4750) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: copy_input_until_stop (origin5-bz2.c:4686) - by 0x........: handle_compress (origin5-bz2.c:4750) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2820) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2823) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2854) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2855) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2858) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2859) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2963) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: mainSort (origin5-bz2.c:2964) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: fallbackSort (origin5-bz2.c:2269) - by 0x........: BZ2_blockSort (origin5-bz2.c:3116) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: fallbackSort (origin5-bz2.c:2275) - by 0x........: BZ2_blockSort (origin5-bz2.c:3116) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 8 - at 0x........: fallbackSort (origin5-bz2.c:2276) - by 0x........: BZ2_blockSort (origin5-bz2.c:3116) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Conditional jump or move depends on uninitialised value(s) - at 0x........: main (origin5-bz2.c:6512) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - diff --git a/memcheck/tests/origin5-bz2.stderr.exp-freebsd-x86 b/memcheck/tests/origin5-bz2.stderr.exp-freebsd-x86 deleted file mode 100644 index 7e6dd6fab2..0000000000 --- a/memcheck/tests/origin5-bz2.stderr.exp-freebsd-x86 +++ /dev/null @@ -1,158 +0,0 @@ -Conditional jump or move depends on uninitialised value(s) - at 0x........: main (origin5-bz2.c:6481) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Conditional jump or move depends on uninitialised value(s) - at 0x........: copy_input_until_stop (origin5-bz2.c:4686) - by 0x........: handle_compress (origin5-bz2.c:4750) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: copy_input_until_stop (origin5-bz2.c:4686) - by 0x........: handle_compress (origin5-bz2.c:4750) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: copy_input_until_stop (origin5-bz2.c:4686) - by 0x........: handle_compress (origin5-bz2.c:4750) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2820) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2823) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2854) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2855) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2858) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2859) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2963) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: mainSort (origin5-bz2.c:2964) - by 0x........: BZ2_blockSort (origin5-bz2.c:3105) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: fallbackSort (origin5-bz2.c:2269) - by 0x........: BZ2_blockSort (origin5-bz2.c:3116) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: fallbackSort (origin5-bz2.c:2275) - by 0x........: BZ2_blockSort (origin5-bz2.c:3116) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Use of uninitialised value of size 4 - at 0x........: fallbackSort (origin5-bz2.c:2276) - by 0x........: BZ2_blockSort (origin5-bz2.c:3116) - by 0x........: BZ2_compressBlock (origin5-bz2.c:4034) - by 0x........: handle_compress (origin5-bz2.c:4753) - by 0x........: BZ2_bzCompress (origin5-bz2.c:4822) - by 0x........: BZ2_bzBuffToBuffCompress (origin5-bz2.c:5630) - by 0x........: main (origin5-bz2.c:6484) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - -Conditional jump or move depends on uninitialised value(s) - at 0x........: main (origin5-bz2.c:6512) - Uninitialised value was created by a client request - at 0x........: main (origin5-bz2.c:6479) - |
|
From: Paul F. <pa...@so...> - 2023-01-22 08:42:58
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f7983be3f201b712239d1b66f460aa301c0b3662 commit f7983be3f201b712239d1b66f460aa301c0b3662 Author: Paul Floyd <pj...@wa...> Date: Sun Jan 22 09:41:49 2023 +0100 FreeBSD: improve auxv filter Didn't work id the clone directory isn't 'valgrind' Diff: --- none/tests/freebsd/filter_auxv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/freebsd/filter_auxv b/none/tests/freebsd/filter_auxv index 6938bf8b83..c35f0fcc21 100755 --- a/none/tests/freebsd/filter_auxv +++ b/none/tests/freebsd/filter_auxv @@ -2,5 +2,5 @@ ./filter_stderr | -sed 's#EXECPATH: .*/valgrind/none/tests/freebsd/auxv#EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv#' +sed 's#EXECPATH: .*/none/tests/freebsd/auxv#EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv#' |
|
From: Paul F. <pa...@so...> - 2023-01-21 19:50:02
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a526bbd05119b84e493856a27812412a20e77499 commit a526bbd05119b84e493856a27812412a20e77499 Author: Paul Floyd <pj...@wa...> Date: Sat Jan 21 20:46:24 2023 +0100 FreeBSD: Fix auxv AT_EXECPATH This was being copied from the host. Now it's synthesized for the guest. Also improve the none/freebsd/auxv test to print a few of the strings in auxv (but not the envp ones). Diff: --- coregrind/m_initimg/initimg-freebsd.c | 10 ++++---- coregrind/m_libcfile.c | 32 +++++++++++++++++++++++-- coregrind/m_syswrap/syswrap-freebsd.c | 29 +---------------------- coregrind/pub_core_libcfile.h | 2 -- none/tests/freebsd/Makefile.am | 3 ++- none/tests/freebsd/auxv.c | 34 +++++++++++++++++++++++++++ none/tests/freebsd/auxv.stderr.exp | 1 + none/tests/freebsd/auxv.stderr.exp-freebsd13 | 3 +++ none/tests/freebsd/auxv.stderr.exp-freebsd131 | 3 +++ none/tests/freebsd/auxv.stderr.exp-freebsd14 | 3 +++ none/tests/freebsd/auxv.vgtest | 1 + none/tests/freebsd/filter_auxv | 6 +++++ 12 files changed, 90 insertions(+), 37 deletions(-) diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index ad5452ed28..22c210cdeb 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -410,6 +410,10 @@ Addr setup_client_stack( void* init_sp, vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1)); vg_assert( VG_(args_for_client) ); + const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); + HChar resolved_name[VKI_PATH_MAX]; + VG_(realpath)(exe_name, resolved_name); + /* use our own auxv as a prototype */ orig_auxv = find_auxv(init_sp); @@ -459,8 +463,7 @@ Addr setup_client_stack( void* init_sp, auxsize += sizeof(*cauxv); switch(cauxv->a_type) { case VKI_AT_EXECPATH: - // @todo PJF this is wrong this will be the name of the execed tool - stringsize += VG_(strlen)(cauxv->u.a_ptr) + 1; + stringsize += VG_(strlen)(resolved_name) + 1; break; case VKI_AT_CANARYLEN: canarylen = cauxv->u.a_val; @@ -686,8 +689,7 @@ Addr setup_client_stack( void* init_sp, break; case VKI_AT_EXECPATH: - // @todo PJF this is wrong this will be the name of the execed tool - auxv->u.a_ptr = copy_str(&strtab, orig_auxv->u.a_ptr); + auxv->u.a_ptr = copy_str(&strtab, resolved_name); break; case VKI_AT_CANARY: if (canarylen >= 1) { diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 65ed4aa486..84de11a5c8 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -1761,7 +1761,6 @@ const HChar *VG_(dirname)(const HChar *path) } #if defined(VGO_freebsd) -#if (FREEBSD_VERS >= FREEBSD_13_0) /* * I did look at nicking this from FreeBSD, it's fairly easy to port * but I was put off by the copyright and 3-clause licence @@ -1777,9 +1776,38 @@ Bool VG_(realpath)(const HChar *path, HChar *resolved) { vg_assert(path); vg_assert(resolved); +#if (FREEBSD_VERS >= FREEBSD_13_0) return !sr_isError(VG_(do_syscall5)(__NR___realpathat, VKI_AT_FDCWD, (RegWord)path, (RegWord)resolved, VKI_PATH_MAX, 0)); -} +#else + // poor man's realpath + const HChar *resolved_name; + HChar tmp[VKI_PATH_MAX]; + + struct vg_stat statbuf; + SysRes res = VG_(lstat)(exe_name, &statbuf); + + if (sr_isError(res)) { + return False; + } else if (VKI_S_ISLNK(statbuf.mode)) { + SizeT link_len = VG_(readlink)(exe_name, tmp, VKI_PATH_MAX); + tmp[link_len] = '\0'; + resolved_name = tmp; + } else { + // not a link + resolved_name = exe_name; + } + + if (resolved_name[0] != '/') { + // relative path + if (resolved_name[0] == '.' && resolved_name[1] == '/') { + resolved_name += 2; + } + VG_(snprintf)(out, *len, "%s/%s", VG_(get_startup_wd)(), resolved_name); + } else { + VG_(snprintf)(out, *len, "%s", resolved_name); + } #endif +} #endif diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index b06dbe7e2b..129df533df 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -1944,39 +1944,12 @@ static Bool sysctl_kern_proc_pathname(HChar *out, SizeT *len) // is this stashed somewhere? const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); -#if (FREEBSD_VERS >= FREEBSD_13_0) - return VG_(realpath)(exe_name, out); -#else - // poor man's realpath - const HChar *resolved_name; - HChar tmp[VKI_PATH_MAX]; - - struct vg_stat statbuf; - SysRes res = VG_(lstat)(exe_name, &statbuf); - - if (sr_isError(res)) { + if (!VG_(realpath)(exe_name, out)) { return False; - } else if (VKI_S_ISLNK(statbuf.mode)) { - SizeT link_len = VG_(readlink)(exe_name, tmp, VKI_PATH_MAX); - tmp[link_len] = '\0'; - resolved_name = tmp; - } else { - // not a link - resolved_name = exe_name; } - if (resolved_name[0] != '/') { - // relative path - if (resolved_name[0] == '.' && resolved_name[1] == '/') { - resolved_name += 2; - } - VG_(snprintf)(out, *len, "%s/%s", VG_(get_startup_wd)(), resolved_name); - } else { - VG_(snprintf)(out, *len, "%s", resolved_name); - } *len = VG_(strlen)(out)+1; return True; -#endif } // SYS___sysctl 202 diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index af1176ca92..dc243bf7fe 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -111,10 +111,8 @@ extern Int VG_(mkstemp) ( const HChar* part_of_name, /*OUT*/HChar* fullname ); extern void VG_(record_startup_wd) ( void ); #if defined(VGO_freebsd) -#if (FREEBSD_VERS >= FREEBSD_13_0) extern Bool VG_(realpath)(const HChar *path, HChar *resolved); #endif -#endif #endif // __PUB_CORE_LIBCFILE_H diff --git a/none/tests/freebsd/Makefile.am b/none/tests/freebsd/Makefile.am index 030af12d20..5fe5de3627 100644 --- a/none/tests/freebsd/Makefile.am +++ b/none/tests/freebsd/Makefile.am @@ -1,7 +1,8 @@ include $(top_srcdir)/Makefile.tool-tests.am -dist_noinst_SCRIPTS = filter_stderr test.sh filter_452275 +dist_noinst_SCRIPTS = filter_stderr test.sh filter_452275 filter_auxv + EXTRA_DIST = \ auxv.vgtest \ auxv.stderr.exp \ diff --git a/none/tests/freebsd/auxv.c b/none/tests/freebsd/auxv.c index 49911deaed..ae26d4b5de 100644 --- a/none/tests/freebsd/auxv.c +++ b/none/tests/freebsd/auxv.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <elf.h> +#include <sys/exec.h> #include "../../../config.h" /* /usr/include/x86/elf.h AT_* defs */ @@ -71,5 +72,38 @@ int main(int argc, char* argv[], char* envp[]) { aux_str = &aux_map[auxp->a_type]; fprintf(stderr, "val: %s int: %02d ptr: 0x%lx\n", aux_str->str_val, aux_str->type, auxp->a_un.a_val); + switch ( aux_str->type) + { + case AT_EXECPATH: + if (auxp->a_un.a_val != 0) + { + fprintf(stderr, "EXECPATH: %s\n", (char*)auxp->a_un.a_val); + } + break; + case AT_ARGV: + if (auxp->a_un.a_val != 0) + { + fprintf(stderr, "ARGV: %s\n", *(char**)auxp->a_un.a_val); + } + break; + case AT_ENVV: + if (auxp->a_un.a_val != 0) + { + /* can't leave this in regtest don't know what it + * will be */ + /*fprintf(stderr, "ENVV: %s\n", *(char**)auxp->a_un.a_val);*/ + } + break; + case AT_PS_STRINGS: + if (auxp->a_un.a_val != 0) + { + struct ps_strings *ppss = (struct ps_strings*)auxp->a_un.a_val; + fprintf(stderr, "PS_STRINGS ARGV: %s\n", *ppss->ps_argvstr); + /* can't leave this in regtest don't know what it + * will be */ + /*fprintf(stderr, "PS_STRINGS ENVV: %s\n", *ppss->ps_envstr);*/ + } + break; + } } } diff --git a/none/tests/freebsd/auxv.stderr.exp b/none/tests/freebsd/auxv.stderr.exp index 6c45cf0c4e..e106f06af8 100644 --- a/none/tests/freebsd/auxv.stderr.exp +++ b/none/tests/freebsd/auxv.stderr.exp @@ -7,6 +7,7 @@ val: AT_ENTRY int: 09 ptr: 0x........ val: AT_BASE int: 07 ptr: 0x........ val: AT_EHDRFLAGS int: 24 ptr: 0x........ val: AT_EXECPATH int: 15 ptr: 0x........ +EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv val: AT_OSRELDATE int: 18 ptr: 0x........ val: AT_CANARY int: 16 ptr: 0x........ val: AT_CANARYLEN int: 17 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd13 b/none/tests/freebsd/auxv.stderr.exp-freebsd13 index b4a0a68601..1740ed9b47 100644 --- a/none/tests/freebsd/auxv.stderr.exp-freebsd13 +++ b/none/tests/freebsd/auxv.stderr.exp-freebsd13 @@ -7,6 +7,7 @@ val: AT_ENTRY int: 09 ptr: 0x........ val: AT_BASE int: 07 ptr: 0x........ val: AT_EHDRFLAGS int: 24 ptr: 0x........ val: AT_EXECPATH int: 15 ptr: 0x........ +EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv val: AT_OSRELDATE int: 18 ptr: 0x........ val: AT_CANARY int: 16 ptr: 0x........ val: AT_CANARYLEN int: 17 ptr: 0x........ @@ -18,6 +19,8 @@ val: AT_STACKPROT int: 23 ptr: 0x........ val: AT_IGNORE int: 01 ptr: 0x........ val: AT_ARGC int: 28 ptr: 0x........ val: AT_ARGV int: 29 ptr: 0x........ +ARGV: ./auxv val: AT_ENVC int: 30 ptr: 0x........ val: AT_ENVV int: 31 ptr: 0x........ val: AT_PS_STRINGS int: 32 ptr: 0x........ +PS_STRINGS ARGV: ./auxv diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd131 b/none/tests/freebsd/auxv.stderr.exp-freebsd131 index 2dd0b3c2df..7010bfa9c6 100644 --- a/none/tests/freebsd/auxv.stderr.exp-freebsd131 +++ b/none/tests/freebsd/auxv.stderr.exp-freebsd131 @@ -7,6 +7,7 @@ val: AT_ENTRY int: 09 ptr: 0x........ val: AT_BASE int: 07 ptr: 0x........ val: AT_EHDRFLAGS int: 24 ptr: 0x........ val: AT_EXECPATH int: 15 ptr: 0x........ +EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv val: AT_OSRELDATE int: 18 ptr: 0x........ val: AT_CANARY int: 16 ptr: 0x........ val: AT_CANARYLEN int: 17 ptr: 0x........ @@ -18,7 +19,9 @@ val: AT_STACKPROT int: 23 ptr: 0x........ val: AT_IGNORE int: 01 ptr: 0x........ val: AT_ARGC int: 28 ptr: 0x........ val: AT_ARGV int: 29 ptr: 0x........ +ARGV: ./auxv val: AT_ENVC int: 30 ptr: 0x........ val: AT_ENVV int: 31 ptr: 0x........ val: AT_PS_STRINGS int: 32 ptr: 0x........ +PS_STRINGS ARGV: ./auxv val: AT_IGNORE int: 01 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.stderr.exp-freebsd14 b/none/tests/freebsd/auxv.stderr.exp-freebsd14 index 76c6db5759..dcca09f63c 100644 --- a/none/tests/freebsd/auxv.stderr.exp-freebsd14 +++ b/none/tests/freebsd/auxv.stderr.exp-freebsd14 @@ -7,6 +7,7 @@ val: AT_ENTRY int: 09 ptr: 0x........ val: AT_BASE int: 07 ptr: 0x........ val: AT_EHDRFLAGS int: 24 ptr: 0x........ val: AT_EXECPATH int: 15 ptr: 0x........ +EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv val: AT_OSRELDATE int: 18 ptr: 0x........ val: AT_CANARY int: 16 ptr: 0x........ val: AT_CANARYLEN int: 17 ptr: 0x........ @@ -18,9 +19,11 @@ val: AT_STACKPROT int: 23 ptr: 0x........ val: AT_IGNORE int: 01 ptr: 0x........ val: AT_ARGC int: 28 ptr: 0x........ val: AT_ARGV int: 29 ptr: 0x........ +ARGV: ./auxv val: AT_ENVC int: 30 ptr: 0x........ val: AT_ENVV int: 31 ptr: 0x........ val: AT_PS_STRINGS int: 32 ptr: 0x........ +PS_STRINGS ARGV: ./auxv val: AT_IGNORE int: 01 ptr: 0x........ val: AT_USRSTACKBASE int: 35 ptr: 0x........ val: AT_USRSTACKLIM int: 36 ptr: 0x........ diff --git a/none/tests/freebsd/auxv.vgtest b/none/tests/freebsd/auxv.vgtest index ccd7192b8a..098f301342 100644 --- a/none/tests/freebsd/auxv.vgtest +++ b/none/tests/freebsd/auxv.vgtest @@ -1,3 +1,4 @@ prog: auxv vgopts: -q +stderr_filter: filter_auxv diff --git a/none/tests/freebsd/filter_auxv b/none/tests/freebsd/filter_auxv new file mode 100755 index 0000000000..6938bf8b83 --- /dev/null +++ b/none/tests/freebsd/filter_auxv @@ -0,0 +1,6 @@ +#! /bin/sh + +./filter_stderr | + +sed 's#EXECPATH: .*/valgrind/none/tests/freebsd/auxv#EXECPATH: BASEDIR/valgrind/none/tests/freebsd/auxv#' + |
|
From: Paul F. <pa...@so...> - 2023-01-21 17:10:13
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=2b1c6db9c88133888aea9f58b83ab33571f9afd2 commit 2b1c6db9c88133888aea9f58b83ab33571f9afd2 Author: Paul Floyd <pj...@wa...> Date: Sat Jan 21 18:09:47 2023 +0100 Two more debuginfo.c typos Diff: --- coregrind/m_debuginfo/debuginfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 7284f031f3..2d2accc999 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -1082,7 +1082,7 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) "GUEST TRIGGERED" 2. When the guest loads any further shared libs (valgrind core and - tool preload shred libraries, libc, other dependencies, dlopens) + tool preload shared libraries, libc, other dependencies, dlopens) using mmap. The call will be from ML_(generic_PRE_sys_mmap) or a platform-specific variation. @@ -1090,7 +1090,7 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) In this case the NSegment could possibly be merged, but that is irrelevant because di_notify_mmap is being - called directy on the mmap result. + called directly on the mmap result. If allow_SkFileV is True, it will try load debug info if the mapping at 'a' belongs to Valgrind; whereas normally (False) |
|
From: Paul F. <pa...@so...> - 2023-01-21 17:05:21
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=5d387642049bf366d913f572269f8bf16627ac10 commit 5d387642049bf366d913f572269f8bf16627ac10 Author: Paul Floyd <pj...@wa...> Date: Sat Jan 21 17:55:09 2023 +0100 Bug 464476 - Firefox fails to start under Valgrind On FreeBSD, Firefox uses the kern.proc.pathname.PID sysctl to get the binary path (where PID can be the actual pid or -1). The user path is /usr/local/bin/firefox which is a symlink to /usr/local/lib/firefox/firefox. This was failing because we were not handling this MIB. That meant that the sysctl returned the path for the binary of the running tool (e.g., /home/paulf/scratch/valgrind/memcheck/memcheck-amd64-freebsd). Firefox looks for files in the same directory. Since it was the wrong directory it failed to find them and exited. I also noticed a lot of _umtx_op errors. On analysis they are spurious. The wake ops take an "obj" argument, a pointer to a variable. They only use the address as a key for lookups and don't read the contents. Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_initimg/initimg-freebsd.c | 2 + coregrind/m_libcfile.c | 45 +++++++++++- coregrind/m_syswrap/syswrap-freebsd.c | 82 +++++++++++++++++++--- coregrind/pub_core_libcfile.h | 6 ++ include/pub_tool_libcfile.h | 3 + include/vki/vki-freebsd.h | 26 +++---- memcheck/tests/freebsd/Makefile.am | 15 +++- memcheck/tests/freebsd/bug464476.cpp | 33 +++++++++ memcheck/tests/freebsd/bug464476.stderr.exp | 0 memcheck/tests/freebsd/bug464476.stdout.exp | 1 + memcheck/tests/freebsd/bug464476.vgtest | 3 + .../tests/freebsd/bug464476_abs_symlink.stderr.exp | 0 .../tests/freebsd/bug464476_abs_symlink.stdout.exp | 1 + .../tests/freebsd/bug464476_abs_symlink.vgtest | 5 ++ .../tests/freebsd/bug464476_rel_symlink.stderr.exp | 0 .../tests/freebsd/bug464476_rel_symlink.stdout.exp | 1 + .../tests/freebsd/bug464476_rel_symlink.vgtest | 5 ++ 19 files changed, 204 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index b422b173e2..2400b4571a 100644 --- a/.gitignore +++ b/.gitignore @@ -1354,6 +1354,7 @@ /memcheck/tests/freebsd/setproctitle /memcheck/tests/freebsd/sctp /memcheck/tests/freebsd/sctp2 +/memcheck/tests/freebsd/bug464476 # /memcheck/tests/amd64-freebsd /memcheck/tests/amd64-freebsd/*.stderr.diff diff --git a/NEWS b/NEWS index f2a380863b..c8ae4289cd 100644 --- a/NEWS +++ b/NEWS @@ -89,6 +89,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 460356 s390: Sqrt32Fx4 -- cannot reduce tree 462830 WARNING: unhandled amd64-freebsd syscall: 474 463027 broken check for MPX instruction support in assembler +464476 Firefox fails to start under Valgrind To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index f0e2bcfd07..ad5452ed28 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -459,6 +459,7 @@ Addr setup_client_stack( void* init_sp, auxsize += sizeof(*cauxv); switch(cauxv->a_type) { case VKI_AT_EXECPATH: + // @todo PJF this is wrong this will be the name of the execed tool stringsize += VG_(strlen)(cauxv->u.a_ptr) + 1; break; case VKI_AT_CANARYLEN: @@ -685,6 +686,7 @@ Addr setup_client_stack( void* init_sp, break; case VKI_AT_EXECPATH: + // @todo PJF this is wrong this will be the name of the execed tool auxv->u.a_ptr = copy_str(&strtab, orig_auxv->u.a_ptr); break; case VKI_AT_CANARY: diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 95fa4bce4f..65ed4aa486 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -562,8 +562,9 @@ SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* vgbuf ) #else res = VG_(do_syscall2)(__NR_stat, (UWord)file_name, (UWord)&buf); #endif - if (!sr_isError(res)) + if (!sr_isError(res)) { TRANSLATE_TO_vg_stat(vgbuf, &buf); + } return res; } # else @@ -647,6 +648,26 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf ) # endif } +#if defined(VGO_freebsd) +/* extend this to other OSes as and when needed */ +SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf ) +{ + SysRes res; + VG_(memset)(vgbuf, 0, sizeof(*vgbuf)); + + struct vki_freebsd11_stat buf; +#if (FREEBSD_VERS >= FREEBSD_12) + res = VG_(do_syscall2)(__NR_freebsd11_lstat, (UWord)file_name, (UWord)&buf); +#else + res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); +#endif + if (!sr_isError(res)) { + TRANSLATE_TO_vg_stat(vgbuf, &buf); + } + return res; +} +#endif + #undef TRANSLATE_TO_vg_stat #undef TRANSLATE_statx_TO_vg_stat @@ -1739,6 +1760,28 @@ const HChar *VG_(dirname)(const HChar *path) return buf; } +#if defined(VGO_freebsd) +#if (FREEBSD_VERS >= FREEBSD_13_0) +/* + * I did look at nicking this from FreeBSD, it's fairly easy to port + * but I was put off by the copyright and 3-clause licence + * Then I looked at nicking it from glibc but that is full of + * macros private functions and conditions for Windows. + * So I gave up as it is only for FreeBSD 11 and 12. + * + * It is somewhat hard-coded for sysctl_kern_proc_pathname + * and PRE(sys___sysctl) assuming resolved has + * VKI_PATH_MAX space. + */ +Bool VG_(realpath)(const HChar *path, HChar *resolved) +{ + vg_assert(path); + vg_assert(resolved); + return !sr_isError(VG_(do_syscall5)(__NR___realpathat, VKI_AT_FDCWD, (RegWord)path, (RegWord)resolved, VKI_PATH_MAX, 0)); +} +#endif +#endif + /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 1df874e735..b06dbe7e2b 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -55,6 +55,7 @@ #include "pub_core_syscall.h" #include "pub_core_syswrap.h" #include "pub_core_inner.h" +#include "pub_core_pathscan.h" #if defined(ENABLE_INNER_CLIENT_REQUEST) #include "pub_core_clreq.h" #endif @@ -1938,6 +1939,46 @@ static void sysctl_kern_usrstack(SizeT* out, SizeT* outlen) *outlen = sizeof(ULong); } +static Bool sysctl_kern_proc_pathname(HChar *out, SizeT *len) +{ + // is this stashed somewhere? + const HChar *exe_name = VG_(find_executable)(VG_(args_the_exename)); + +#if (FREEBSD_VERS >= FREEBSD_13_0) + return VG_(realpath)(exe_name, out); +#else + // poor man's realpath + const HChar *resolved_name; + HChar tmp[VKI_PATH_MAX]; + + struct vg_stat statbuf; + SysRes res = VG_(lstat)(exe_name, &statbuf); + + if (sr_isError(res)) { + return False; + } else if (VKI_S_ISLNK(statbuf.mode)) { + SizeT link_len = VG_(readlink)(exe_name, tmp, VKI_PATH_MAX); + tmp[link_len] = '\0'; + resolved_name = tmp; + } else { + // not a link + resolved_name = exe_name; + } + + if (resolved_name[0] != '/') { + // relative path + if (resolved_name[0] == '.' && resolved_name[1] == '/') { + resolved_name += 2; + } + VG_(snprintf)(out, *len, "%s/%s", VG_(get_startup_wd)(), resolved_name); + } else { + VG_(snprintf)(out, *len, "%s", resolved_name); + } + *len = VG_(strlen)(out)+1; + return True; +#endif +} + // SYS___sysctl 202 /* int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen); */ /* ARG1 ARG2 ARG3 ARG4 ARG5 ARG6 */ @@ -2003,7 +2044,7 @@ PRE(sys___sysctl) * saved to file static variables in that file, so we call * VG_(get_usrstack)() to retrieve them from there. */ - if (SARG2 >= 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) { + if (SARG2 == 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) { if (name[0] == 1 && name[1] == 33) { // kern.usrstack sysctl_kern_usrstack((SizeT*)ARG3, (SizeT*)ARG4); @@ -2014,7 +2055,7 @@ PRE(sys___sysctl) /* * 2. kern.ps_strings */ - if (SARG2 >= 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) { + if (SARG2 == 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) { if (name[0] == 1 && name[1] == 32) { if (sysctl_kern_ps_strings((SizeT*)ARG3, (SizeT*)ARG4)) { SET_STATUS_Success(0); @@ -2022,6 +2063,19 @@ PRE(sys___sysctl) } } + /* + * 3. kern.proc.pathname + */ + if (SARG2 == 4 && ML_(safe_to_deref)(name, 4*sizeof(int))) { + if (name[0] == 1 && name[1] == 14 && name[2] == 12) { + vki_pid_t pid = (vki_pid_t)name[3]; + if (pid == -1 || pid == VG_(getpid)()) { + sysctl_kern_proc_pathname((HChar *)ARG3, (SizeT *)ARG4); + SET_STATUS_Success(0); + } + } + } + PRE_REG_READ6(int, "__sysctl", int *, name, vki_u_int32_t, namelen, void *, oldp, vki_size_t *, oldlenp, void *, newp, vki_size_t, newlen); @@ -2039,12 +2093,19 @@ PRE(sys___sysctl) // 2. Both are non-NULL // this is a query of oldp, oldlenp will be read and oldp will // be written + // + // More thoughts on this + // if say oldp is a string buffer + // oldlenp will point to the length of the buffer + // + // but on return does oldlenp also get updated? // is oldlenp is not NULL, can write if (ARG4 != (UWord)NULL) { if (ARG3 != (UWord)NULL) { // case 2 above PRE_MEM_READ("sysctl(oldlenp)", (Addr)ARG4, sizeof(vki_size_t)); + PRE_MEM_WRITE("sysctl(oldlenp)", (Addr)ARG4, sizeof(vki_size_t)); if (ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(vki_size_t))) { PRE_MEM_WRITE("sysctl(oldp)", (Addr)ARG3, *(vki_size_t *)ARG4); } else { @@ -2063,7 +2124,7 @@ POST(sys___sysctl) { if (ARG4 != (UWord)NULL) { if (ARG3 != (UWord)NULL) { - //POST_MEM_WRITE((Addr)ARG4, sizeof(vki_size_t)); + POST_MEM_WRITE((Addr)ARG4, sizeof(vki_size_t)); POST_MEM_WRITE((Addr)ARG3, *(vki_size_t *)ARG4); } else { POST_MEM_WRITE((Addr)ARG4, sizeof(vki_size_t)); @@ -4303,8 +4364,9 @@ PRE(sys__umtx_op) case VKI_UMTX_OP_WAKE: PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, WAKE, %" FMT_REGWORD "u)", ARG1, ARG3); PRE_REG_READ3(long, "_umtx_op_wake", - struct umtx *, obj, int, op, unsigned long, val); - PRE_MEM_READ( "_umtx_op_wake(mtx)", ARG1, sizeof(struct vki_umtx) ); + vki_uintptr_t *, obj, int, op, int, val); + // PJF I don't think that the value of obj gets read, the address is being used as a key + //PRE_MEM_READ("_umtx_op_wake(obj)", ARG1, sizeof(vki_uintptr_t)); break; case VKI_UMTX_OP_MUTEX_TRYLOCK: PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, MUTEX_TRYLOCK, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); @@ -4428,8 +4490,9 @@ PRE(sys__umtx_op) case VKI_UMTX_OP_WAKE_PRIVATE: PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, CV_WAKE_PRIVATE, %" FMT_REGWORD "u)", ARG1, ARG3); PRE_REG_READ3(long, "_umtx_op_wake_private", - struct umtx *, obj, int, op, unsigned long, id); - PRE_MEM_READ( "_umtx_op_wake_private(mtx)", ARG1, sizeof(struct vki_umtx) ); + vki_uintptr_t *, obj, int, op, int, val); + // PJF like OP_WAKE contents of obj not read + //PRE_MEM_READ("_umtx_op_wake_private(obj)", ARG1, sizeof(vki_uintptr_t)); break; case VKI_UMTX_OP_MUTEX_WAIT: // pthread_mutex_lock without prio flags @@ -4543,7 +4606,7 @@ POST(sys__umtx_op) case VKI_UMTX_OP_MUTEX_WAIT: /* Sets/clears contested bits */ case VKI_UMTX_OP_MUTEX_WAKE: /* Sets/clears contested bits */ if (SUCCESS) { - POST_MEM_WRITE( ARG1, sizeof(struct vki_umutex) ); + POST_MEM_WRITE( ARG1, sizeof(vki_uintptr_t) ); } break; case VKI_UMTX_OP_SET_CEILING: @@ -6430,6 +6493,9 @@ PRE(sys___sysctlbyname) SET_STATUS_Success(0); } + // @todo PJF kern.proc.pathname + // how is that done? jusr a pid or -1 in the string? + // read number of ints specified in ARG2 from mem pointed to by ARG1 PRE_MEM_READ("__sysctlbyname(name)", (Addr)ARG1, ARG2 * sizeof(int)); diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index 56289a494c..af1176ca92 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -110,6 +110,12 @@ extern Int VG_(mkstemp) ( const HChar* part_of_name, /*OUT*/HChar* fullname ); return if the working directory couldn't be found. */ extern void VG_(record_startup_wd) ( void ); +#if defined(VGO_freebsd) +#if (FREEBSD_VERS >= FREEBSD_13_0) +extern Bool VG_(realpath)(const HChar *path, HChar *resolved); +#endif +#endif + #endif // __PUB_CORE_LIBCFILE_H /*--------------------------------------------------------------------*/ diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h index c42f1b8d4d..ff4c0d3a57 100644 --- a/include/pub_tool_libcfile.h +++ b/include/pub_tool_libcfile.h @@ -81,6 +81,9 @@ extern Int VG_(pipe) ( Int fd[2] ); extern Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence ); extern SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* buf ); +#if defined(VGO_freebsd) +extern SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* buf ); +#endif extern Int VG_(fstat) ( Int fd, struct vg_stat* buf ); extern SysRes VG_(dup) ( Int oldfd ); extern SysRes VG_(dup2) ( Int oldfd, Int newfd ); diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index 929eb74adb..a7344242e9 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -105,10 +105,10 @@ typedef vki_uint64_t __vki_fsblkcnt_t; typedef vki_uint64_t __vki_fsfilcnt_t; typedef vki_uint32_t __vki_gid_t; typedef vki_int64_t __vki_id_t; -typedef vki_uint32_t __vki_ino_t; +typedef vki_uint64_t __vki_ino_t; typedef vki_int32_t __vki_lwpid_t; typedef vki_uint16_t __vki_mode_t; -typedef vki_uint16_t __vki_nlink_t; +typedef vki_uint64_t __vki_nlink_t; typedef vki_int64_t __vki_off_t; typedef vki_int32_t __vki_pid_t; typedef vki_int64_t __vki_rlim_t; @@ -119,7 +119,7 @@ typedef vki_int32_t __vki_useconds_t; typedef __vki_ct_rune_t __vki_rune_t; typedef __vki_ct_rune_t __vki_wchar_t; typedef __vki_ct_rune_t __vki_wint_t; -typedef vki_uint32_t __vki_dev_t; +typedef vki_uint64_t __vki_dev_t; typedef vki_uint32_t __vki_fixpt_t; @@ -331,13 +331,13 @@ struct vki_tms { /* QQQ 4.x stat layout */ struct vki_freebsd11_stat { - vki_dev_t st_dev; - vki_ino_t st_ino; + vki_uint32_t st_dev; + vki_uint32_t st_ino; vki_mode_t st_mode; - vki_nlink_t st_nlink; + vki_uint16_t st_nlink; vki_uid_t st_uid; vki_gid_t st_gid; - vki_dev_t st_rdev; + vki_uint32_t st_rdev; #if 0 struct vki_timespec st_atimespec; struct vki_timespec st_mtimespec; @@ -376,19 +376,15 @@ unsigned int : */ struct vki_stat { - //vki_dev_t st_dev; - vki_uint64_t st_dev; - //vki_ino_t st_ino; - vki_uint64_t st_ino; - //vki_nlink_t st_nlink; - vki_uint64_t st_nlink; + vki_dev_t st_dev; + vki_ino_t st_ino; + vki_nlink_t st_nlink; vki_mode_t st_mode; vki_int16_t st_padding0; vki_uid_t st_uid; vki_gid_t st_gid; vki_int32_t st_padding1; - //vki_dev_t st_rdev; - vki_uint64_t st_rdev; + vki_dev_t st_rdev; #ifdef VKI_STAT_TIME_T_EXT vki_int32_t st_atim_ext; #endif diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index daf14f2f8e..5cf1eaf67e 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -90,7 +90,16 @@ EXTRA_DIST = \ sctp.stdout.exp \ sctp2.vgtest \ sctp2.stderr.exp \ - sctp2.stdout.exp + sctp2.stdout.exp \ + bug464476.vgtest \ + bug464476.stderr.exp \ + bug464476.stdout.exp \ + bug464476_abs_symlink.vgtest \ + bug464476_abs_symlink.stderr.exp \ + bug464476_abs_symlink.stdout.exp \ + bug464476_rel_symlink.vgtest \ + bug464476_rel_symlink.stderr.exp \ + bug464476_rel_symlink.stdout.exp check_PROGRAMS = \ statfs pdfork_pdkill getfsstat inlinfo inlinfo_nested.so extattr \ @@ -98,7 +107,7 @@ check_PROGRAMS = \ 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 errno_aligned_allocs \ - setproctitle sctp sctp2 + setproctitle sctp sctp2 bug464476 AM_CFLAGS += $(AM_FLAG_M3264_PRI) AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) @@ -111,6 +120,8 @@ inlinfo_nested_so_SOURCES = inlinfo_nested.c inlinfo_nested_so_CFLAGS = $(AM_CFLAGS) -fPIC @FLAG_W_NO_UNINITIALIZED@ inlinfo_nested_so_LDFLAGS = -Wl,-rpath,$(top_builddir)/memcheck/tests/freebsd -shared -fPIC +bug464476_SOURCES = bug464476.cpp + if FREEBSD_VERS_13_PLUS check_PROGRAMS += realpathat scalar_13_plus eventfd1 eventfd2 diff --git a/memcheck/tests/freebsd/bug464476.cpp b/memcheck/tests/freebsd/bug464476.cpp new file mode 100644 index 0000000000..001ac21673 --- /dev/null +++ b/memcheck/tests/freebsd/bug464476.cpp @@ -0,0 +1,33 @@ +// roughly based on the code for Firefox class BinaryPath +// https://searchfox.org/mozilla-central/source/xpcom/build/BinaryPath.h#185 + +#include <iostream> +#include <sys/types.h> +#include <sys/sysctl.h> +#include <limits.h> +#include <string> + +using std::cerr; +using std::cout; +using std::string; + +int main(int argc, char **argv) +{ + char aResult[PATH_MAX]; + int mib[4]; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = -1; + + size_t len = PATH_MAX; + if (sysctl(mib, 4, aResult, &len, nullptr, 0) < 0) { + cerr << "sysctl failed\n"; + return -1; + } + if (string(aResult) == argv[1]) { + cout << "OK\n"; + } else { + cerr << "Not OK aResult " << aResult << " argv[1] " << argv[1] << '\n'; + } +} diff --git a/memcheck/tests/freebsd/bug464476.stderr.exp b/memcheck/tests/freebsd/bug464476.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/freebsd/bug464476.stdout.exp b/memcheck/tests/freebsd/bug464476.stdout.exp new file mode 100644 index 0000000000..d86bac9de5 --- /dev/null +++ b/memcheck/tests/freebsd/bug464476.stdout.exp @@ -0,0 +1 @@ +OK diff --git a/memcheck/tests/freebsd/bug464476.vgtest b/memcheck/tests/freebsd/bug464476.vgtest new file mode 100644 index 0000000000..b97d862e0c --- /dev/null +++ b/memcheck/tests/freebsd/bug464476.vgtest @@ -0,0 +1,3 @@ +prog: bug464476 +vgopts: -q +args: `pwd`/bug464476 diff --git a/memcheck/tests/freebsd/bug464476_abs_symlink.stderr.exp b/memcheck/tests/freebsd/bug464476_abs_symlink.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/freebsd/bug464476_abs_symlink.stdout.exp b/memcheck/tests/freebsd/bug464476_abs_symlink.stdout.exp new file mode 100644 index 0000000000..d86bac9de5 --- /dev/null +++ b/memcheck/tests/freebsd/bug464476_abs_symlink.stdout.exp @@ -0,0 +1 @@ +OK diff --git a/memcheck/tests/freebsd/bug464476_abs_symlink.vgtest b/memcheck/tests/freebsd/bug464476_abs_symlink.vgtest new file mode 100644 index 0000000000..29d6b80614 --- /dev/null +++ b/memcheck/tests/freebsd/bug464476_abs_symlink.vgtest @@ -0,0 +1,5 @@ +prereq: ln -s bug464476 `pwd`/bug464476_abs_symlink +prog: bug464476_abs_symlink +vgopts: -q +args: `pwd`/bug464476 +cleanup: rm bug464476_abs_symlink diff --git a/memcheck/tests/freebsd/bug464476_rel_symlink.stderr.exp b/memcheck/tests/freebsd/bug464476_rel_symlink.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/freebsd/bug464476_rel_symlink.stdout.exp b/memcheck/tests/freebsd/bug464476_rel_symlink.stdout.exp new file mode 100644 index 0000000000..d86bac9de5 --- /dev/null +++ b/memcheck/tests/freebsd/bug464476_rel_symlink.stdout.exp @@ -0,0 +1 @@ +OK diff --git a/memcheck/tests/freebsd/bug464476_rel_symlink.vgtest b/memcheck/tests/freebsd/bug464476_rel_symlink.vgtest new file mode 100644 index 0000000000..c2eace73b1 --- /dev/null +++ b/memcheck/tests/freebsd/bug464476_rel_symlink.vgtest @@ -0,0 +1,5 @@ +prereq: ln -s bug464476 ./bug464476_rel_symlink +prog: bug464476_rel_symlink +vgopts: -q +args: `pwd`/bug464476 +cleanup: rm bug464476_rel_symlink |
|
From: Paul F. <pa...@so...> - 2023-01-21 12:53:46
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ded1adc432d4110539302b593fbfa247f3817c4b commit ded1adc432d4110539302b593fbfa247f3817c4b Author: Paul Floyd <pj...@wa...> Date: Sat Jan 21 13:51:50 2023 +0100 FreeBSD: small change for pthread mutex types It seems what is 'normal' and 'default' is not portable. And a bit more debuginfo mmap comment fixing Diff: --- coregrind/m_debuginfo/debuginfo.c | 5 +++-- drd/drd_pthread_intercepts.c | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 3beeaa0a4a..7284f031f3 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -1069,9 +1069,10 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) 1b. Then the host loads ld.so and the guest exe. This is done in the sequence load_client -> VG_(do_exec) -> VG_(do_exec_inner) -> - exe_handlers->load_fn ( == VG_(load_ELF) ). + exe_handlers->load_fn ( == VG_(load_ELF) ) + [or load_MACHO]. - This does the mmap'ing and creats the associated NSegments. + This does the mmap'ing and creates the associated NSegments. The NSegments may get merged, (see maybe_merge_nsegments) so there could be more PT_LOADs than there are NSegments. diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index ecbf0f731b..b3895ea34f 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -350,6 +350,10 @@ static void DRD_(sema_up)(DrdSema* sema) static MutexT DRD_(pthread_to_drd_mutex_type)(int kind) { /* + * Static checkers don't like this as there are repeated branch + * but because there is variation between different platforms + * it's messy to make something without repetition. + * * See also PTHREAD_MUTEX_KIND_MASK_NP in glibc source file * <nptl/pthreadP.h>. */ @@ -363,7 +367,12 @@ static MutexT DRD_(pthread_to_drd_mutex_type)(int kind) else if (kind == PTHREAD_MUTEX_NORMAL) return mutex_type_default_mutex; else if (kind == PTHREAD_MUTEX_DEFAULT) + // @todo PJF what about Solaris? +#if defined(VGO_freebsd) + return mutex_type_errorcheck_mutex; +#else return mutex_type_default_mutex; +#endif #if defined(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP) else if (kind == PTHREAD_MUTEX_ADAPTIVE_NP) return mutex_type_default_mutex; |
|
From: Paul F. <pa...@so...> - 2023-01-21 12:35:26
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6d8ea1bd862a644bd89c703d3e22dbb79e7e004a commit 6d8ea1bd862a644bd89c703d3e22dbb79e7e004a Author: Paul Floyd <pj...@wa...> Date: Sat Jan 21 13:34:47 2023 +0100 Cleanup mmap comments in debuginfo.c Diff: --- coregrind/m_debuginfo/debuginfo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 34a2ea8ccb..3beeaa0a4a 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -1026,9 +1026,7 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) /* Notify the debuginfo system about a new mapping. This is the way new debug information gets loaded. - redelf -e will output something like - - readelf -e says + readelf -e will output something like Program Headers: Type Offset VirtAddr PhysAddr @@ -1063,7 +1061,7 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) "HOST TRIGGERED" - 1a. For the tool exe and tool/core shared libs. These are already + 1a. For the tool exe, called from valgrind_main. This is already mmap'd when the host starts so we look at something like the /proc filesystem to get the mapping after the event and build up the NSegments from that. @@ -1082,8 +1080,10 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di ) "GUEST TRIGGERED" - 2. When the guest loads any further shared libs (libc, - other dependencies, dlopens) using mmap. + 2. When the guest loads any further shared libs (valgrind core and + tool preload shred libraries, libc, other dependencies, dlopens) + using mmap. The call will be from ML_(generic_PRE_sys_mmap) or + a platform-specific variation. There are a few variations for syswraps/platforms. |
|
From: Mark W. <ma...@so...> - 2023-01-15 13:30:12
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=fdda0bece6dd57aafd7cc527e86431794430dc4a commit fdda0bece6dd57aafd7cc527e86431794430dc4a Author: Mark Wielaard <ma...@kl...> Date: Sun Jan 15 14:24:19 2023 +0100 m_debuginfo: Suppress warning about not handling entry_value ops The warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0xf3 isn't very helpful. This means we didn't handle DW_OP_GNU_entry_value. DW_OP_GNU_entry_value (or DWARF5 DW_OP_entry_value) means interpreting the given DWARF expression using register values as they were upon entering the function. Which is non-trivial to implement. We can fail the evaluation of the DWARF expression without warning about it by default, since it isn't really needed for any current valgrind functionality (and it is only done with --read-var-info=yes. Diff: --- coregrind/m_debuginfo/d3basics.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c index d48589a30c..e9e8944af8 100644 --- a/coregrind/m_debuginfo/d3basics.c +++ b/coregrind/m_debuginfo/d3basics.c @@ -1048,6 +1048,14 @@ GXResult ML_(evaluate_Dwarf3_Expr) ( const UChar* expr, UWord exprszB, FAIL("evaluate_Dwarf3_Expr: DW_OP_stack_value " "does not terminate expression"); break; + case DW_OP_entry_value: + case DW_OP_GNU_entry_value: + /* This provides a DWARF expression where any register op + needs tobe evaluated as if the value that register had + upon entering the function. Which is non-trivial to + implement. */ + FAIL("evaluate_Dwarf3_Expr: Unhandled DW_OP entry_value"); + return res; default: if (!VG_(clo_xml)) VG_(message)(Vg_DebugMsg, |
|
From: Paul F. <pa...@so...> - 2023-01-15 08:07:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=cae2118d959832196d5ba54b5290db0bc2060146 commit cae2118d959832196d5ba54b5290db0bc2060146 Author: Paul Floyd <pj...@wa...> Date: Sun Jan 15 09:05:55 2023 +0100 FreeBSD: some _umtx_op corrections mutex trylock doesn't user timer arguments plain mutex lock doesn't need restart still not sure about mutex trylock Diff: --- coregrind/m_syswrap/syswrap-freebsd.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 8bf4fcddee..1df874e735 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -4263,6 +4263,7 @@ PRE(sys__umtx_op) they're always pointers. They may not be used though. */ switch(ARG2) { case VKI_UMTX_OP_LOCK: + // marked as COMPAT10 PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, LOCK, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); PRE_REG_READ5(long, "_umtx_op_lock", struct umtx *, obj, int, op, unsigned long, id, @@ -4275,6 +4276,7 @@ PRE(sys__umtx_op) *flags |= SfMayBlock; break; case VKI_UMTX_OP_UNLOCK: + // marked as COMPAT10 PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, UNLOCK, %" FMT_REGWORD "u)", ARG1, ARG3); PRE_REG_READ3(long, "_umtx_op_unlock", struct umtx *, obj, int, op, unsigned long, id); @@ -4295,8 +4297,6 @@ PRE(sys__umtx_op) if (ARG5) { PRE_MEM_READ( "_umtx_op_wait(timeout)", ARG5, ARG4 ); - } else { - *flags |= SfKernelRestart; } break; @@ -4308,17 +4308,17 @@ PRE(sys__umtx_op) break; case VKI_UMTX_OP_MUTEX_TRYLOCK: PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, MUTEX_TRYLOCK, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); - PRE_REG_READ5(long, "_umtx_op_mutex_trylock", - struct umutex *, obj, int, op, unsigned long, noid, - size_t, timeout_size, struct vki_timespec *, timeout); + PRE_REG_READ2(long, "_umtx_op_mutex_trylock", struct umutex *, obj, int, op); PRE_MEM_READ( "_umtx_op_mutex_trylock(mutex)", ARG1, sizeof(struct vki_umutex) ); - if (ARG5) { - PRE_MEM_READ( "_umtx_op_mutex_trylock(timespec)", ARG5, ARG4 ); - } PRE_MEM_WRITE( "_umtx_op_mutex_trylock(mutex)", ARG1, sizeof(struct vki_umutex) ); + /* not too sure about the restart here + * it's hard to test as if the mutex is locked this returns EBUSY + * so there is only a small window where the syscall could be interrupted */ *flags |= SfMayBlock | SfKernelRestart; break; case VKI_UMTX_OP_MUTEX_LOCK: + // called by pthread_mutex_lock + // when the atribute UMUTEX_PRIO_PROTECT or UMUTEX_PRIO_INHERIT is set PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, MUTEX_LOCK, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); PRE_REG_READ5(long, "_umtx_op_mutex_lock", struct umutex *, obj, int, op, unsigned long, noid, @@ -4326,9 +4326,11 @@ PRE(sys__umtx_op) PRE_MEM_READ( "_umtx_op_mutex_lock(mutex)", ARG1, sizeof(struct vki_umutex) ); if (ARG5) { PRE_MEM_READ( "_umtx_op_mutex_lock(timespec)", ARG5, ARG4 ); + } else { + *flags |= SfKernelRestart; } PRE_MEM_WRITE( "_umtx_op_mutex_lock(mutex)", ARG1, sizeof(struct vki_umutex) ); - *flags |= SfMayBlock | SfKernelRestart; + *flags |= SfMayBlock; break; case VKI_UMTX_OP_MUTEX_UNLOCK: PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, MUTEX_UNLOCK)", ARG1); @@ -4430,6 +4432,8 @@ PRE(sys__umtx_op) PRE_MEM_READ( "_umtx_op_wake_private(mtx)", ARG1, sizeof(struct vki_umtx) ); break; case VKI_UMTX_OP_MUTEX_WAIT: + // pthread_mutex_lock without prio flags + // does not need to be restarted PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, MUTEX_WAIT, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); PRE_REG_READ2(long, "_umtx_op_mutex_wait", struct umutex *, obj, int, op); @@ -4438,6 +4442,7 @@ PRE(sys__umtx_op) *flags |= SfMayBlock; break; case VKI_UMTX_OP_MUTEX_WAKE: + // marked as deprecated PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, MUTEX_WAKE, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); PRE_REG_READ2(long, "_umtx_op_mutex_wake", struct umutex *, obj, int, op); @@ -4445,6 +4450,7 @@ PRE(sys__umtx_op) PRE_MEM_WRITE( "_umtx_op_mutex_wake(mutex)", ARG1, sizeof(struct vki_umutex) ); break; case VKI_UMTX_OP_SEM_WAIT: + // marked as deprecated PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, SEM_WAIT, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); PRE_REG_READ5(long, "_umtx_op_sem_wait", struct usem *, obj, int, op, unsigned long, id, @@ -4457,6 +4463,7 @@ PRE(sys__umtx_op) *flags |= SfMayBlock; break; case VKI_UMTX_OP_SEM_WAKE: + // marked as deprecated PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, SEM_WAKE, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x)", ARG1, ARG3, ARG4, ARG5); PRE_REG_READ2(long, "_umtx_op_sem_wake", struct umutex *, obj, int, op); |
|
From: Paul F. <pa...@so...> - 2023-01-15 06:20:32
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=30cdbfbb2c6d1a4fca45f86deae1a74a507d733c commit 30cdbfbb2c6d1a4fca45f86deae1a74a507d733c Author: Paul Floyd <pj...@wa...> Date: Sun Jan 15 07:20:08 2023 +0100 FreeBSD: some more clangd refactoring Diff: --- coregrind/vgdb-invoker-freebsd.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/coregrind/vgdb-invoker-freebsd.c b/coregrind/vgdb-invoker-freebsd.c index 6de80c9071..4a8a97cb7c 100644 --- a/coregrind/vgdb-invoker-freebsd.c +++ b/coregrind/vgdb-invoker-freebsd.c @@ -157,8 +157,9 @@ char *status_image (int status) result[0] = 0; - if (WIFEXITED(status)) + if (WIFEXITED(status)) { APPEND ("WIFEXITED %d ", WEXITSTATUS(status)); + } if (WIFSIGNALED(status)) { APPEND ("WIFSIGNALED %d ", WTERMSIG(status)); @@ -258,10 +259,11 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg) if (res != 0) { ERROR(errno, "PT_LWPINFO failed: signal lost !!!!\n"); signal_queue_sz--; - } else + } else { DEBUG(1, "waitstopped PTRACE_CONT, queuing signal %d" " si_signo %d si_pid %d\n", signal_received, newsiginfo->si_signo, newsiginfo->si_pid); + } res = ptrace (PT_CONTINUE, pid, (caddr_t)1, 0); } else { DEBUG(1, "waitstopped PT_CONTINUE with signal %d\n", signal_received); @@ -314,8 +316,9 @@ Bool attach (pid_t pid, const char *msg) if (res != 0) { if (output_error || debuglevel > 0) { ERROR(errno, "%s PT_ATTACH pid %d %ld\n", msg, pid, res); - if (initial_attach) + if (initial_attach) { output_error = False; + } } return False; } @@ -374,8 +377,9 @@ void restore_and_detach (pid_t pid) before resetting the registers. */ if (pid_of_save_regs_continued) { pid_of_save_regs_continued = False; - if (!stop(pid_of_save_regs, "sigstop before reset regs")) + if (!stop(pid_of_save_regs, "sigstop before reset regs")) { DEBUG(0, "Could not sigstop before reset"); + } } DEBUG(1, "setregs restore registers pid %d\n", pid_of_save_regs); @@ -392,11 +396,13 @@ void restore_and_detach (pid_t pid) signal_queue[i].si_signo); res = ptrace (PT_CONTINUE, pid_of_save_regs, (caddr_t)1, signal_queue[i].si_signo); - if (res != 0) + if (res != 0) { ERROR(errno, "PT_CONTINUE with signal %d\n", signal_queue[i].si_signo); - if (!stop(pid_of_save_regs, "sigstop after transmit sig")) + } + if (!stop(pid_of_save_regs, "sigstop after transmit sig")) { DEBUG(0, "Could not sigstop after transmit sig"); + } } free (signal_queue); signal_queue = NULL; @@ -406,9 +412,10 @@ void restore_and_detach (pid_t pid) } else { DEBUG(1, "PTRACE_SETREGS restore registers: no pid\n"); } - if (signal_queue) + if (signal_queue) { ERROR (0, "One or more signals queued were not delivered. " "First signal: %d\n", signal_queue[0].si_signo); + } detach_from_all_threads(pid); } @@ -600,18 +607,18 @@ Bool invoker_invoke_gdbserver (pid_t pid) pid_of_save_regs_continued = False; restore_and_detach(pid); return True; - } else { - /* Whatever kind of problem happened. We shutdown. */ - shutting_down = True; - return False; } + /* Whatever kind of problem happened. We shutdown. */ + shutting_down = True; + return False; } void invoker_cleanup_restore_and_detach(void *v_pid) { DEBUG(1, "invoker_cleanup_restore_and_detach dying: %d\n", dying); - if (!dying) + if (!dying) { restore_and_detach(*(int*)v_pid); + } } void invoker_restrictions_msg(void) |
|
From: Paul F. <pa...@so...> - 2023-01-14 15:24:56
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3c9cb7a7115a0de8a6daeacd108ec16cbd0d244f commit 3c9cb7a7115a0de8a6daeacd108ec16cbd0d244f Author: Paul Floyd <pj...@wa...> Date: Sat Jan 14 16:24:00 2023 +0100 Remove execute bit from drd tests std_string.cpp Diff: --- drd/tests/std_string.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/drd/tests/std_string.cpp b/drd/tests/std_string.cpp old mode 100755 new mode 100644 |
|
From: Paul F. <pa...@so...> - 2023-01-12 07:01:01
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ed73978bdb7495eb6c85be3ed2b0d19534d5b3ad commit ed73978bdb7495eb6c85be3ed2b0d19534d5b3ad Author: Paul Floyd <pj...@wa...> Date: Thu Jan 12 08:00:27 2023 +0100 Update wrong expecteds for Bug 241072 Diff: --- none/tests/cmdline1.stdout.exp | 2 ++ none/tests/cmdline1.stdout.exp-non-linux | 3 +++ none/tests/cmdline2.stdout.exp | 2 ++ none/tests/cmdline2.stdout.exp-non-linux | 3 +++ 4 files changed, 10 insertions(+) diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index c0e71fa576..c3e91bfcde 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -34,6 +34,8 @@ usage: valgrind [options] prog-and-args --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> --log-socket=ipaddr:port log messages to socket ipaddr:port + --enable-debuginfod=no|yes query debuginfod servers for missing + debuginfo [yes] user options for Valgrind tools that report errors: --xml=yes emit error output in XML (some tools only) diff --git a/none/tests/cmdline1.stdout.exp-non-linux b/none/tests/cmdline1.stdout.exp-non-linux index cdc13fd61c..c0e71fa576 100644 --- a/none/tests/cmdline1.stdout.exp-non-linux +++ b/none/tests/cmdline1.stdout.exp-non-linux @@ -2,6 +2,9 @@ usage: valgrind [options] prog-and-args tool-selection option, with default in [ ]: --tool=<name> use the Valgrind tool named <name> [memcheck] + available tools are: + memcheck cachegrind callgrind helgrind drd + massif dhat lackey none exp-bbv basic user options for all Valgrind tools, with defaults in [ ]: -h --help show this message diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index c19fa72597..3158c267a9 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -34,6 +34,8 @@ usage: valgrind [options] prog-and-args --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> --log-socket=ipaddr:port log messages to socket ipaddr:port + --enable-debuginfod=no|yes query debuginfod servers for missing + debuginfo [yes] user options for Valgrind tools that report errors: --xml=yes emit error output in XML (some tools only) diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux index 7b65b731fe..c19fa72597 100644 --- a/none/tests/cmdline2.stdout.exp-non-linux +++ b/none/tests/cmdline2.stdout.exp-non-linux @@ -2,6 +2,9 @@ usage: valgrind [options] prog-and-args tool-selection option, with default in [ ]: --tool=<name> use the Valgrind tool named <name> [memcheck] + available tools are: + memcheck cachegrind callgrind helgrind drd + massif dhat lackey none exp-bbv basic user options for all Valgrind tools, with defaults in [ ]: -h --help show this message |
|
From: Paul F. <pa...@so...> - 2023-01-11 20:44:06
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8fcc813468554b23c04d8db64f425b299df06ad0 commit 8fcc813468554b23c04d8db64f425b299df06ad0 Author: Paul Floyd <pj...@wa...> Date: Wed Jan 11 21:42:41 2023 +0100 Bug 241072 List tools in --help output Diff: --- NEWS | 1 + coregrind/m_main.c | 3 +++ none/tests/cmdline1.stdout.exp | 5 +++-- none/tests/cmdline2.stdout.exp | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 041ff5ba65..f2a380863b 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,7 @@ than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. 170510 Don't warn about ioctl of size 0 without direction hint +241072 List tools in --help output 327548 false positive while destroying mutex 351857 confusing error message about valid command line option 392331 Spurious lock not held error from inside pthread_cond_timedwait diff --git a/coregrind/m_main.c b/coregrind/m_main.c index c966873e26..27ec451433 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -87,6 +87,9 @@ static void usage_NORETURN ( int need_help ) "\n" " tool-selection option, with default in [ ]:\n" " --tool=<name> use the Valgrind tool named <name> [memcheck]\n" +" available tools are:\n" +" memcheck cachegrind callgrind helgrind drd\n" +" massif dhat lackey none exp-bbv\n" "\n" " basic user options for all Valgrind tools, with defaults in [ ]:\n" " -h --help show this message\n" diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index de5fcd819a..c0e71fa576 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -2,6 +2,9 @@ usage: valgrind [options] prog-and-args tool-selection option, with default in [ ]: --tool=<name> use the Valgrind tool named <name> [memcheck] + available tools are: + memcheck cachegrind callgrind helgrind drd + massif dhat lackey none exp-bbv basic user options for all Valgrind tools, with defaults in [ ]: -h --help show this message @@ -31,8 +34,6 @@ usage: valgrind [options] prog-and-args --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> --log-socket=ipaddr:port log messages to socket ipaddr:port - --enable-debuginfod=no|yes query debuginfod servers for missing - debuginfo [yes] user options for Valgrind tools that report errors: --xml=yes emit error output in XML (some tools only) diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index d810cc7fa3..c19fa72597 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -2,6 +2,9 @@ usage: valgrind [options] prog-and-args tool-selection option, with default in [ ]: --tool=<name> use the Valgrind tool named <name> [memcheck] + available tools are: + memcheck cachegrind callgrind helgrind drd + massif dhat lackey none exp-bbv basic user options for all Valgrind tools, with defaults in [ ]: -h --help show this message @@ -31,8 +34,6 @@ usage: valgrind [options] prog-and-args --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> --log-socket=ipaddr:port log messages to socket ipaddr:port - --enable-debuginfod=no|yes query debuginfod servers for missing - debuginfo [yes] user options for Valgrind tools that report errors: --xml=yes emit error output in XML (some tools only) |
|
From: Andreas A. <ar...@so...> - 2023-01-11 15:47:53
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d6073d34d46bf33488b1df43980284ba557617e7 commit d6073d34d46bf33488b1df43980284ba557617e7 Author: Andreas Arnez <ar...@li...> Date: Wed Oct 26 19:45:30 2022 +0200 s390: Add test for short/extended vector float insns Several issues with vector floating point instructions have gone unnoticed due to a lack of test coverage in this area. Add a test case that improves the coverage, particuarly when dealing with short and extended floating point formats. Diff: --- .gitignore | 1 + none/tests/s390x/Makefile.am | 3 +- none/tests/s390x/vec2_float.c | 419 +++++++++++++++++++++++++++++++++ none/tests/s390x/vec2_float.stderr.exp | 2 + none/tests/s390x/vec2_float.stdout.exp | 389 ++++++++++++++++++++++++++++++ none/tests/s390x/vec2_float.vgtest | 2 + tests/s390x_features.c | 2 +- 7 files changed, 816 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 66a221fb49..b422b173e2 100644 --- a/.gitignore +++ b/.gitignore @@ -2032,6 +2032,7 @@ /none/tests/s390x/vector_float /none/tests/s390x/misc3 /none/tests/s390x/vec2 +/none/tests/s390x/vec2_float # /none/tests/scripts/ /none/tests/scripts/*.dSYM diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index ca38db935c..d8f9e4b894 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -20,7 +20,7 @@ INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \ spechelper-icm-1 spechelper-icm-2 spechelper-tmll \ spechelper-tm laa vector lsc2 ppno vector_string vector_integer \ vector_float add-z14 sub-z14 mul-z14 bic \ - misc3 vec2 + misc3 vec2 vec2_float if BUILD_DFP_TESTS INSN_TESTS += dfp-1 dfp-2 dfp-3 dfp-4 dfptest dfpext dfpconv srnmt pfpo @@ -75,3 +75,4 @@ vector_string_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=5 vector_integer_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4 vector_float_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4 vec2_CFLAGS = $(AM_CFLAGS) -march=z13 +vec2_float_CFLAGS = $(AM_CFLAGS) -march=z13 diff --git a/none/tests/s390x/vec2_float.c b/none/tests/s390x/vec2_float.c new file mode 100644 index 0000000000..3dc4798708 --- /dev/null +++ b/none/tests/s390x/vec2_float.c @@ -0,0 +1,419 @@ +#include <stdio.h> + +#define VECTOR __attribute__ ((vector_size (16))) + +typedef unsigned int VECTOR u2_v; +typedef unsigned long VECTOR u3_v; +typedef unsigned long VECTOR u4_v; /* avoid 128-bit integers */ +typedef float VECTOR f2_v; +typedef double VECTOR f3_v; +typedef long double VECTOR f4_v; + +#define INF (1./0.) +#define NAN (0./0.) + +static const u2_v vec_u2_a = { -1, 0x7ffffff0, 42, 0 }; +static const u2_v vec_u2_b = { 0x7fffff80, 1, 1000, -0x7caffe }; +static const u2_v vec_u2_c = { 0x7fffff, 0x70000000, -10000, 0xffff }; +static const u2_v vec_u2_e = { 0x7fffffff, 0x8000000, 0, 42 }; + +static const f2_v vec_f2_a = { 16777215., -16777215., 42.5, 10000. }; +static const f2_v vec_f2_b = { 4., 3., 42.5, 1. }; +static const f2_v vec_f2_c = { 0., INF, -0., -INF }; +static const f2_v vec_f2_d = { -16777214., 16777214., -23., -9999. }; +static const f2_v vec_f2_e = { NAN, -NAN, NAN, -NAN }; + +static const f3_v vec_f3_a = { (double) ((1UL << 52) - 1), -16777215. }; +static const f3_v vec_f3_b = { 0.1, 3. }; +static const f3_v vec_f3_c = { -0., INF }; +static const f3_v vec_f3_e = { NAN, -NAN }; + +static const f4_v vec_f4_a = { 16777215.0L }; +static const f4_v vec_f4_b = { 4.0L }; +static const f4_v vec_f4_c = { INF }; +static const f4_v vec_f4_d = { -23.0 }; +static const f4_v vec_f4_e = { NAN }; + +static const u3_v vec_ini = { 0x0112233445566778, 0x899aabbccddeeff0 }; + +/* -- Dump a vector depending on FP format and single-element control -- */ + +static void dump_cc(int cc) +{ + if (cc) { + printf(" cc=%d", cc); + } + putchar('\n'); +} + +static void dump_vu2(u2_v u) +{ + printf("\t%d | %d | %d | %d", u[0], u[1], u[2], u[3]); +} + +static void dump_wu2(u2_v u) +{ + printf("\t%d | - | - | -", u[0]); +} + +static void dump_wu4(u4_v u) +{ + if (u[0] == 0) { + printf("\t%ld", u[1]); + } else if (u[0] == -1) { + printf("\t-%ld", -u[1]); + } else { + printf("\t0x%016lx%016lx", u[0], u[1]); + } +} + +static void dump_vf2(f2_v v) +{ + printf("\t%a | %a | %a | %a", v[0], v[1], v[2], v[3]); +} + +static void dump_ef2(f2_v v) +{ + printf("\t%a | - | %a | -", v[0], v[2]); +} + +static void dump_vf3(f3_v v) +{ + printf("\t%a | %a", v[0], v[1]); +} + +static void dump_wf3(f3_v v) +{ + printf("\t%a | -", v[0]); +} + +static void dump_wf2(f2_v v) +{ + printf("\t%a | - | - | -", v[0]); +} + +static void dump_wf4(f4_v v) +{ + printf("\t%La", v[0]); +} + +/* -- Vector unary operators -- */ + +#define TEST_EXEC(opc1,opc2,fmt,ty1,ty2,insn,m3,m4,m5) \ + do { \ + puts(#insn); \ + test_##insn##_##m3##_##m4##_##m5(vec_##ty2##_a); \ + test_##insn##_##m3##_##m4##_##m5(vec_##ty2##_b); \ + test_##insn##_##m3##_##m4##_##m5(vec_##ty2##_c); \ + test_##insn##_##m3##_##m4##_##m5(vec_##ty2##_e); \ + } while (0) + +#define TEST_GENERATE(opc1,opc2,fmt,ty1,ty2,insn,m3,m4,m5) \ + static void test_##insn##_##m3##_##m4##_##m5(ty2##_v a) \ + { \ + ty1##_v out = (ty1##_v) vec_ini; \ + int cc = -1; \ + __asm__( \ + "cr 0,0\n\t" \ + ".insn vrr,0x" #opc1 "00000000" #opc2 ",%[out],%[a],0," \ + #m3 "," #m4 "," #m5 "\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28" \ + : [cc]"=d" (cc), [out]"+v" (out) \ + : [a]"v" (a) \ + : "cc"); \ + dump_##fmt##ty1(out); \ + dump_cc(cc); \ + } + +#define INSNS \ + XTEST(e7,c0, v,u2, f2, vclfeb, 2,4,0); \ + XTEST(e7,c0, w,u2, f2, wclfeb, 2,12,0); \ + XTEST(e7,c1, v,f2, u2, vcelfb, 2,4,0); \ + XTEST(e7,c1, w,f2, u2, wcelfb, 2,12,0); \ + XTEST(e7,c2, v,u2, f2, vcfeb, 2,4,0); \ + XTEST(e7,c2, w,u2, f2, wcfeb, 2,12,0); \ + XTEST(e7,c3, v,f2, u2, vcefb, 2,4,0); \ + XTEST(e7,c3, w,f2, u2, wcefb, 2,12,0); \ + XTEST(e7,c4, v,f3, f2, vldeb, 2,0,0); \ + XTEST(e7,c4, w,f3, f2, wldeb, 2,8,0); \ + XTEST(e7,c4, w,f4, f3, wflld, 3,8,0); \ + XTEST(e7,c5, e,f2, f3, vledb, 3,4,0); \ + XTEST(e7,c5, w,f2, f3, wledb, 3,12,0); \ + XTEST(e7,c5, w,f3, f4, wflrx, 4,12,0); \ + XTEST(e7,c7, v,f2, f2, vfisb, 2,0,0); \ + XTEST(e7,c7, w,f2, f2, wfisb, 2,8,0); \ + XTEST(e7,c7, w,f4, f4, wfixb, 4,8,0); \ + XTEST(e7,cc, v,f2, f2, vflcsb, 2,0,0); \ + XTEST(e7,cc, w,f2, f2, wflcsb, 2,8,0); \ + XTEST(e7,cc, w,f4, f4, wflcxb, 4,8,0); \ + XTEST(e7,cc, v,f2, f2, vflnsb, 2,0,1); \ + XTEST(e7,cc, w,f2, f2, wflnsb, 2,8,1); \ + XTEST(e7,cc, w,f4, f4, wflnxb, 4,8,1); \ + XTEST(e7,cc, v,f2, f2, vflpsb, 2,0,2); \ + XTEST(e7,cc, w,f2, f2, wflpsb, 2,8,2); \ + XTEST(e7,cc, w,f4, f4, wflpxb, 4,8,2); \ + XTEST(e7,ce, v,f2, f2, vfsqsb, 2,0,0); \ + XTEST(e7,ce, w,f2, f2, wfsqsb, 2,8,0); \ + XTEST(e7,ce, w,f4, f4, wfsqxb, 4,8,0); + +#define XTEST TEST_GENERATE +INSNS +#undef XTEST + +static void test_all_unops() +{ +#define XTEST TEST_EXEC + INSNS +#undef XTEST +} + +#undef INSNS +#undef TEST_GENERATE +#undef TEST_EXEC + +/* -- Vector binary operators -- */ + +#define TEST_EXEC(opc1,opc2,fmt,ty1,insn,m4,m5,m6) \ + do { \ + puts(#insn); \ + test_##insn##_##m4##_##m5##_##m6(vec_f##m4##_a, vec_f##m4##_b); \ + test_##insn##_##m4##_##m5##_##m6(vec_f##m4##_b, vec_f##m4##_a); \ + test_##insn##_##m4##_##m5##_##m6(vec_f##m4##_a, vec_f##m4##_c); \ + test_##insn##_##m4##_##m5##_##m6(vec_f##m4##_d, vec_f##m4##_e); \ + } while (0) + +#define TEST_GENERATE(opc1,opc2,fmt,ty1,insn,m4,m5,m6) \ + static void test_##insn##_##m4##_##m5##_##m6(f##m4##_v a, f##m4##_v b) \ + { \ + ty1##_v out = (ty1##_v) vec_ini; \ + int cc = -1; \ + __asm__( \ + "cr 0,0\n\t" \ + ".insn vrr,0x" #opc1 "00000000" #opc2 ",%[out],%[a],%[b]," \ + #m4 "," #m5 "," #m6 "\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28" \ + : [cc]"=d" (cc), [out] "+v" (out) \ + : [a] "v" (a), [b] "v" (b) \ + : "cc"); \ + dump_##fmt##ty1(out); \ + dump_cc(cc); \ + } + +#define INSNS \ + XTEST(e7,e2, v,f2, vfssb, 2,0,0); \ + XTEST(e7,e2, w,f2, wfssb, 2,8,0); \ + XTEST(e7,e2, w,f4, wfsxb, 4,8,0); \ + XTEST(e7,e3, v,f2, vfasb, 2,0,0); \ + XTEST(e7,e3, w,f2, wfasb, 2,8,0); \ + XTEST(e7,e3, w,f4, wfaxb, 4,8,0); \ + XTEST(e7,e5, v,f2, vfdsb, 2,0,0); \ + XTEST(e7,e5, w,f2, wfdsb, 2,8,0); \ + XTEST(e7,e5, w,f4, wfdxb, 4,8,0); \ + XTEST(e7,e7, v,f2, vfmsb, 2,0,0); \ + XTEST(e7,e7, w,f2, wfmsb, 2,8,0); \ + XTEST(e7,e7, w,f4, wfmxb, 4,8,0); \ + XTEST(e7,e8, v,u2, vfcesb, 2,0,0); \ + XTEST(e7,e8, w,u2, wfcesb, 2,8,0); \ + XTEST(e7,e8, w,u4, wfcexb, 4,8,0); \ + XTEST(e7,e8, v,u2, vfcesbs, 2,0,1); \ + XTEST(e7,e8, w,u2, wfcesbs, 2,8,1); \ + XTEST(e7,e8, w,u4, wfcexbs, 4,8,1); \ + XTEST(e7,ea, v,u2, vfchesb, 2,0,0); \ + XTEST(e7,ea, w,u2, wfchesb, 2,8,0); \ + XTEST(e7,ea, w,u4, wfchexb, 4,8,0); \ + XTEST(e7,ea, v,u2, vfchesbs, 2,0,1); \ + XTEST(e7,ea, w,u2, wfchesbs, 2,8,1); \ + XTEST(e7,ea, w,u4, wfchexbs, 4,8,1); \ + XTEST(e7,ee, v,f2, vfminsb, 2,0,0); \ + XTEST(e7,ee, w,f2, wfminsb, 2,8,0); \ + XTEST(e7,ee, w,f4, wfminxb, 4,8,0); \ + XTEST(e7,ef, v,f2, vfmaxsb, 2,0,0); \ + XTEST(e7,ef, w,f2, wfmaxsb, 2,8,0); \ + XTEST(e7,ef, w,f4, wfmaxxb, 4,8,0); \ + XTEST(e7,eb, v,u2, vfchsb, 2,0,0); \ + XTEST(e7,eb, w,u2, wfchsb, 2,8,0); \ + XTEST(e7,eb, w,u4, wfchxb, 4,8,0); \ + XTEST(e7,eb, v,u2, vfchsbs, 2,0,1); \ + XTEST(e7,eb, w,u2, wfchsbs, 2,8,1); \ + XTEST(e7,eb, w,u4, wfchxbs, 4,8,1); + +#define XTEST TEST_GENERATE +INSNS +#undef XTEST + +static void test_all_binops() +{ +#define XTEST TEST_EXEC + INSNS +#undef XTEST +} + +#undef INSNS +#undef TEST_GENERATE +#undef TEST_EXEC + +/* -- Vector ternary operators -- */ + +#define TEST_EXEC(opc1,opc2,fmt,ty,insn,m5,m6) \ + do { \ + puts(#insn); \ + test_##insn##_##m5##_##m6(vec_##ty##_a, vec_##ty##_b, vec_##ty##_c); \ + test_##insn##_##m5##_##m6(vec_##ty##_b, vec_##ty##_a, vec_##ty##_d); \ + } while (0) + +#define TEST_GENERATE(opc1,opc2,fmt,ty,insn,m5,m6) \ + static void test_##insn##_##m5##_##m6(ty##_v a, ty##_v b, ty##_v c) \ + { \ + ty##_v out = (ty##_v) vec_ini; \ + int cc = -1; \ + register ty##_v my_c __asm__("v7") = c; \ + __asm__( \ + "cr 0,0\n\t" \ + ".insn vrr,0x" #opc1 "000" #m6 "0000" #opc2 ",%[out],%[a]," \ + "%[b],7," #m5 ",0\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28" \ + : [cc]"=d" (cc), [out] "+v" (out) \ + : [a] "v" (a), [b] "v" (b), [c] "v" (my_c) \ + : "cc"); \ + dump_##fmt##ty(out); \ + dump_cc(cc); \ + } + +#define INSNS \ + XTEST(e7,8e, v,f2, vfmssb, 0,2); \ + XTEST(e7,8e, w,f2, wfmssb, 8,2); \ + XTEST(e7,8e, w,f4, wfmsxb, 8,4); \ + XTEST(e7,8f, v,f2, vfmasb, 0,2); \ + XTEST(e7,8f, w,f2, wfmasb, 8,2); \ + XTEST(e7,8f, w,f4, wfmaxb, 8,4); \ + XTEST(e7,9e, v,f2, vfnmssb, 0,2); \ + XTEST(e7,9e, w,f2, wfnmssb, 8,2); \ + XTEST(e7,9e, w,f4, wfnmsxb, 8,4); \ + XTEST(e7,9f, v,f2, vfnmasb, 0,2); \ + XTEST(e7,9f, w,f2, wfnmasb, 8,2); \ + XTEST(e7,9f, w,f4, wfnmaxb, 8,4); + +#define XTEST TEST_GENERATE +INSNS +#undef XTEST + +static void test_all_ternops() +{ +#define XTEST TEST_EXEC + INSNS +#undef XTEST +} + +#undef INSNS +#undef TEST_GENERATE +#undef TEST_EXEC + +/* -- Vector scalar compare operators -- */ + +#define TEST_EXEC(opc1,opc2,ty,insn,m3,m4) \ + do { \ + puts(#insn); \ + test_##insn##_##m3##_##m4(vec_##ty##_a, vec_##ty##_b); \ + test_##insn##_##m3##_##m4(vec_##ty##_b, vec_##ty##_a); \ + test_##insn##_##m3##_##m4(vec_##ty##_c, vec_##ty##_c); \ + test_##insn##_##m3##_##m4(vec_##ty##_a, vec_##ty##_e); \ + } while (0) + +#define TEST_GENERATE(opc1,opc2,ty,insn,m3,m4) \ + static void test_##insn##_##m3##_##m4(ty##_v a, ty##_v b) \ + { \ + int cc = -1; \ + __asm__( \ + "cr 0,0\n\t" \ + ".insn vrr,0x" #opc1 "00000000" #opc2 ",%[a],%[b],0," \ + #m3 "," #m4 ",0\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28" \ + : [cc]"=d" (cc) \ + : [a]"v" (a), [b]"v" (b) \ + : "cc"); \ + printf("\tcc=%d\n", cc); \ + } + +#define INSNS \ + XTEST(e7,cb, f2, wfcsb, 2,0); \ + XTEST(e7,cb, f4, wfcxb, 4,0); + +#define XTEST TEST_GENERATE +INSNS +#undef XTEST + +static void test_all_scalar_compares() +{ +#define XTEST TEST_EXEC + INSNS +#undef XTEST +} + +#undef INSNS +#undef TEST_GENERATE +#undef TEST_EXEC + +/* -- Vector FP test data class -- */ + +#define TEST_EXEC(opc1,opc2,fmt,ty1,ty2,insn,i3,m4,m5) \ + do { \ + puts(#insn); \ + test_##insn##_##m3##_##m4(vec_##ty2##_a); \ + test_##insn##_##m3##_##m4(vec_##ty2##_b); \ + test_##insn##_##m3##_##m4(vec_##ty2##_c); \ + test_##insn##_##m3##_##m4(vec_##ty2##_d); \ + test_##insn##_##m3##_##m4(vec_##ty2##_e); \ + } while (0) + +#define TEST_GENERATE(opc1,opc2,fmt,ty1,ty2,insn,i3,m4,m5) \ + static void test_##insn##_##m3##_##m4(ty2##_v a) \ + { \ + ty1##_v out = (ty1##_v) vec_ini; \ + int cc = -1; \ + __asm__( \ + "cr 0,0\n\t" \ + ".insn vri,0x" #opc1 "00000000" #opc2 ",%[out],%[a]," \ + #i3 "," #m4 "," #m5 "\n\t" \ + "ipm %[cc]\n\t" \ + "srl %[cc],28" \ + : [cc]"=d" (cc), [out]"+v" (out) \ + : [a]"v" (a) \ + : "cc"); \ + dump_##fmt##ty1(out); \ + dump_cc(cc); \ + } + +#define INSNS \ + XTEST(e7,4a, v,u2,f2, vftcisb, 0x864,2,0); \ + XTEST(e7,4a, w,u2,f2, wftcisb, 0x520,2,8); \ + XTEST(e7,4a, w,u4,f4, wftcixb, 0x3c0,4,0); + +#define XTEST TEST_GENERATE +INSNS +#undef XTEST + +static void test_all_vftci() +{ +#define XTEST TEST_EXEC + INSNS +#undef XTEST +} + +#undef INSNS +#undef TEST_GENERATE +#undef TEST_EXEC + + +int main() +{ + test_all_unops(); + test_all_binops(); + test_all_ternops(); + test_all_scalar_compares(); + test_all_vftci(); + return 0; +} diff --git a/none/tests/s390x/vec2_float.stderr.exp b/none/tests/s390x/vec2_float.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/s390x/vec2_float.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/s390x/vec2_float.stdout.exp b/none/tests/s390x/vec2_float.stdout.exp new file mode 100644 index 0000000000..e021f08a35 --- /dev/null +++ b/none/tests/s390x/vec2_float.stdout.exp @@ -0,0 +1,389 @@ +vclfeb + 16777215 | 0 | 42 | 10000 + 4 | 3 | 42 | 1 + 0 | -1 | 0 | 0 + 0 | 0 | 0 | 0 +wclfeb + 16777215 | - | - | - + 4 | - | - | - + 0 | - | - | - + 0 | - | - | - +vcelfb + 0x1p+32 | 0x1p+31 | 0x1.5p+5 | 0x0p+0 + 0x1.fffffep+30 | 0x1p+0 | 0x1.f4p+9 | 0x1.ff06ap+31 + 0x1.fffffcp+22 | 0x1.cp+30 | 0x1.ffffb2p+31 | 0x1.fffep+15 + 0x1p+31 | 0x1p+27 | 0x0p+0 | 0x1.5p+5 +wcelfb + 0x1p+32 | - | - | - + 0x1.fffffep+30 | - | - | - + 0x1.fffffcp+22 | - | - | - + 0x1p+31 | - | - | - +vcfeb + 16777215 | -16777215 | 42 | 10000 + 4 | 3 | 42 | 1 + 0 | 2147483647 | 0 | -2147483648 + -2147483648 | -2147483648 | -2147483648 | -2147483648 +wcfeb + 16777215 | - | - | - + 4 | - | - | - + 0 | - | - | - + -2147483648 | - | - | - +vcefb + -0x1p+0 | 0x1p+31 | 0x1.5p+5 | 0x0p+0 + 0x1.fffffep+30 | 0x1p+0 | 0x1.f4p+9 | -0x1.f2bff8p+22 + 0x1.fffffcp+22 | 0x1.cp+30 | -0x1.388p+13 | 0x1.fffep+15 + 0x1p+31 | 0x1p+27 | 0x0p+0 | 0x1.5p+5 +wcefb + -0x1p+0 | - | - | - + 0x1.fffffep+30 | - | - | - + 0x1.fffffcp+22 | - | - | - + 0x1p+31 | - | - | - +vldeb + 0x1.fffffep+23 | 0x1.54p+5 + 0x1p+2 | 0x1.54p+5 + 0x0p+0 | -0x0p+0 + nan | nan +wldeb + 0x1.fffffep+23 | - + 0x1p+2 | - + 0x0p+0 | - + nan | - +wflld + 0x1.ffffffffffffep+51 + 0x1.999999999999ap-4 + -0x0p+0 + nan +vledb + 0x1p+52 | - | -0x1.fffffep+23 | - + 0x1.99999ap-4 | - | 0x1.8p+1 | - + -0x0p+0 | - | inf | - + nan | - | -nan | - +wledb + 0x1p+52 | - | - | - + 0x1.99999ap-4 | - | - | - + -0x0p+0 | - | - | - + nan | - | - | - +wflrx + 0x1.fffffep+23 | - + 0x1p+2 | - + inf | - + nan | - +vfisb + 0x1.fffffep+23 | -0x1.fffffep+23 | 0x1.5p+5 | 0x1.388p+13 + 0x1p+2 | 0x1.8p+1 | 0x1.5p+5 | 0x1p+0 + 0x0p+0 | inf | -0x0p+0 | -inf + nan | -nan | nan | -nan +wfisb + 0x1.fffffep+23 | - | - | - + 0x1p+2 | - | - | - + 0x0p+0 | - | - | - + nan | - | - | - +wfixb + 0x1.fffffep+23 + 0x1p+2 + inf + nan +vflcsb + -0x1.fffffep+23 | 0x1.fffffep+23 | -0x1.54p+5 | -0x1.388p+13 + -0x1p+2 | -0x1.8p+1 | -0x1.54p+5 | -0x1p+0 + -0x0p+0 | -inf | 0x0p+0 | inf + -nan | nan | -nan | nan +wflcsb + -0x1.fffffep+23 | - | - | - + -0x1p+2 | - | - | - + -0x0p+0 | - | - | - + -nan | - | - | - +wflcxb + -0x1.fffffep+23 + -0x1p+2 + -inf + -nan +vflnsb + -0x1.fffffep+23 | -0x1.fffffep+23 | -0x1.54p+5 | -0x1.388p+13 + -0x1p+2 | -0x1.8p+1 | -0x1.54p+5 | -0x1p+0 + -0x0p+0 | -inf | -0x0p+0 | -inf + -nan | -nan | -nan | -nan +wflnsb + -0x1.fffffep+23 | - | - | - + -0x1p+2 | - | - | - + -0x0p+0 | - | - | - + -nan | - | - | - +wflnxb + -0x1.fffffep+23 + -0x1p+2 + -inf + -nan +vflpsb + 0x1.fffffep+23 | 0x1.fffffep+23 | 0x1.54p+5 | 0x1.388p+13 + 0x1p+2 | 0x1.8p+1 | 0x1.54p+5 | 0x1p+0 + 0x0p+0 | inf | 0x0p+0 | inf + nan | nan | nan | nan +wflpsb + 0x1.fffffep+23 | - | - | - + 0x1p+2 | - | - | - + 0x0p+0 | - | - | - + nan | - | - | - +wflpxb + 0x1.fffffep+23 + 0x1p+2 + inf + nan +vfsqsb + 0x1.fffffep+11 | nan | 0x1.a13a9cp+2 | 0x1.9p+6 + 0x1p+1 | 0x1.bb67aep+0 | 0x1.a13a9cp+2 | 0x1p+0 + 0x0p+0 | inf | -0x0p+0 | nan + nan | -nan | nan | -nan +wfsqsb + 0x1.fffffep+11 | - | - | - + 0x1p+1 | - | - | - + 0x0p+0 | - | - | - + nan | - | - | - +wfsqxb + 0x1.fffffeffffffbfffffdfffffecp+11 + 0x1p+1 + inf + nan +vfssb + 0x1.fffff6p+23 | -0x1.000002p+24 | 0x0p+0 | 0x1.3878p+13 + -0x1.fffff6p+23 | 0x1.000002p+24 | 0x0p+0 | -0x1.3878p+13 + 0x1.fffffep+23 | -inf | 0x1.54p+5 | inf + nan | -nan | nan | -nan +wfssb + 0x1.fffff6p+23 | - | - | - + -0x1.fffff6p+23 | - | - | - + 0x1.fffffep+23 | - | - | - + nan | - | - | - +wfsxb + 0x1.fffff6p+23 + -0x1.fffff6p+23 + -inf + nan +vfasb + 0x1.000004p+24 | -0x1.fffff8p+23 | 0x1.54p+6 | 0x1.3888p+13 + 0x1.000004p+24 | -0x1.fffff8p+23 | 0x1.54p+6 | 0x1.3888p+13 + 0x1.fffffep+23 | inf | 0x1.54p+5 | -inf + nan | -nan | nan | -nan +wfasb + 0x1.000004p+24 | - | - | - + 0x1.000004p+24 | - | - | - + 0x1.fffffep+23 | - | - | - + nan | - | - | - +wfaxb + 0x1.000003p+24 + 0x1.000003p+24 + inf + nan +vfdsb + 0x1.fffffep+21 | -0x1.555554p+22 | 0x1p+0 | 0x1.388p+13 + 0x1.000002p-22 | -0x1.800002p-23 | 0x1p+0 | 0x1.a36e2ep-14 + inf | -0x0p+0 | -inf | -0x0p+0 + nan | -nan | nan | -nan +wfdsb + 0x1.fffffep+21 | - | - | - + 0x1.000002p-22 | - | - | - + inf | - | - | - + nan | - | - | - +wfdxb + 0x1.fffffep+21 + 0x1.000001000001000001000001p-22 + 0x0p+0 + nan +vfmsb + 0x1.fffffep+25 | -0x1.7ffffep+25 | 0x1.c39p+10 | 0x1.388p+13 + 0x1.fffffep+25 | -0x1.7ffffep+25 | 0x1.c39p+10 | 0x1.388p+13 + 0x0p+0 | -inf | -0x0p+0 | -inf + nan | -nan | nan | -nan +wfmsb + 0x1.fffffep+25 | - | - | - + 0x1.fffffep+25 | - | - | - + 0x0p+0 | - | - | - + nan | - | - | - +wfmxb + 0x1.fffffep+25 + 0x1.fffffep+25 + inf + nan +vfcesb + 0 | 0 | -1 | 0 + 0 | 0 | -1 | 0 + 0 | 0 | 0 | 0 + 0 | 0 | 0 | 0 +wfcesb + 0 | - | - | - + 0 | - | - | - + 0 | - | - | - + 0 | - | - | - +wfcexb + 0 + 0 + 0 + 0 +vfcesbs + 0 | 0 | -1 | 0 cc=1 + 0 | 0 | -1 | 0 cc=1 + 0 | 0 | 0 | 0 cc=3 + 0 | 0 | 0 | 0 cc=3 +wfcesbs + 0 | - | - | - cc=3 + 0 | - | - | - cc=3 + 0 | - | - | - cc=3 + 0 | - | - | - cc=3 +wfcexbs + 0 cc=3 + 0 cc=3 + 0 cc=3 + 0 cc=3 +vfchesb + -1 | 0 | -1 | -1 + 0 | -1 | -1 | 0 + -1 | 0 | -1 | -1 + 0 | 0 | 0 | 0 +wfchesb + -1 | - | - | - + 0 | - | - | - + -1 | - | - | - + 0 | - | - | - +wfchexb + -1 + 0 + 0 + 0 +vfchesbs + -1 | 0 | -1 | -1 cc=1 + 0 | -1 | -1 | 0 cc=1 + -1 | 0 | -1 | -1 cc=1 + 0 | 0 | 0 | 0 cc=3 +wfchesbs + -1 | - | - | - + 0 | - | - | - cc=3 + -1 | - | - | - + 0 | - | - | - cc=3 +wfchexbs + -1 + 0 cc=3 + 0 cc=3 + 0 cc=3 +vfminsb + 0x1p+2 | -0x1.fffffep+23 | 0x1.54p+5 | 0x1p+0 + 0x1p+2 | -0x1.fffffep+23 | 0x1.54p+5 | 0x1p+0 + 0x0p+0 | -0x1.fffffep+23 | -0x0p+0 | -inf + -0x1.fffffcp+23 | 0x1.fffffcp+23 | -0x1.7p+4 | -0x1.3878p+13 +wfminsb + 0x1p+2 | - | - | - + 0x1p+2 | - | - | - + 0x0p+0 | - | - | - + -0x1.fffffcp+23 | - | - | - +wfminxb + 0x1p+2 + 0x1p+2 + 0x1.fffffep+23 + -0x1.7p+4 +vfmaxsb + 0x1.fffffep+23 | 0x1.8p+1 | 0x1.54p+5 | 0x1.388p+13 + 0x1.fffffep+23 | 0x1.8p+1 | 0x1.54p+5 | 0x1.388p+13 + 0x1.fffffep+23 | inf | 0x1.54p+5 | 0x1.388p+13 + -0x1.fffffcp+23 | 0x1.fffffcp+23 | -0x1.7p+4 | -0x1.3878p+13 +wfmaxsb + 0x1.fffffep+23 | - | - | - + 0x1.fffffep+23 | - | - | - + 0x1.fffffep+23 | - | - | - + -0x1.fffffcp+23 | - | - | - +wfmaxxb + 0x1.fffffep+23 + 0x1.fffffep+23 + inf + -0x1.7p+4 +vfchsb + -1 | 0 | 0 | -1 + 0 | -1 | 0 | 0 + -1 | 0 | -1 | -1 + 0 | 0 | 0 | 0 +wfchsb + -1 | - | - | - + 0 | - | - | - + -1 | - | - | - + 0 | - | - | - +wfchxb + -1 + 0 + 0 + 0 +vfchsbs + -1 | 0 | 0 | -1 cc=1 + 0 | -1 | 0 | 0 cc=1 + -1 | 0 | -1 | -1 cc=1 + 0 | 0 | 0 | 0 cc=3 +wfchsbs + -1 | - | - | - + 0 | - | - | - cc=3 + -1 | - | - | - + 0 | - | - | - cc=3 +wfchxbs + -1 + 0 cc=3 + 0 cc=3 + 0 cc=3 +vfmssb + 0x1.fffffep+25 | -inf | 0x1.c39p+10 | inf + 0x1.3ffffep+26 | -0x1.fffffep+25 | 0x1.c95p+10 | 0x1.387cp+14 +wfmssb + 0x1.fffffep+25 | - | - | - + 0x1.3ffffep+26 | - | - | - +wfmsxb + -inf + 0x1.000004cp+26 +vfmasb + 0x1.fffffep+25 | inf | 0x1.c39p+10 | -inf + 0x1.8p+25 | -0x1p+25 | 0x1.bddp+10 | 0x1p+0 +wfmasb + 0x1.fffffep+25 | - | - | - + 0x1.8p+25 | - | - | - +wfmaxb + inf + 0x1.fffff28p+25 +vfnmssb + -0x1.fffffep+25 | inf | -0x1.c39p+10 | -inf + -0x1.3ffffep+26 | 0x1.fffffep+25 | -0x1.c95p+10 | -0x1.387cp+14 +wfnmssb + -0x1.fffffep+25 | - | - | - + -0x1.3ffffep+26 | - | - | - +wfnmsxb + inf + -0x1.000004cp+26 +vfnmasb + -0x1.fffffep+25 | -inf | -0x1.c39p+10 | inf + -0x1.8p+25 | 0x1p+25 | -0x1.bddp+10 | -0x1p+0 +wfnmasb + -0x1.fffffep+25 | - | - | - + -0x1.8p+25 | - | - | - +wfnmaxb + -inf + -0x1.fffff28p+25 +wfcsb + cc=2 + cc=1 + cc=0 + cc=3 +wfcxb + cc=2 + cc=1 + cc=0 + cc=3 +vftcisb + 0 | 0 | 0 | 0 cc=3 + 0 | 0 | 0 | 0 cc=3 + -1 | -1 | 0 | 0 cc=1 + 0 | 0 | 0 | 0 cc=3 + 0 | -1 | 0 | -1 cc=1 +wftcisb + 0 | - | - | - cc=3 + 0 | - | - | - cc=3 + 0 | - | - | - cc=3 + -1 | - | - | - + 0 | - | - | - cc=3 +wftcixb + -1 + -1 + 0 cc=3 + -1 + 0 cc=3 diff --git a/none/tests/s390x/vec2_float.vgtest b/none/tests/s390x/vec2_float.vgtest new file mode 100644 index 0000000000..1f92d59ece --- /dev/null +++ b/none/tests/s390x/vec2_float.vgtest @@ -0,0 +1,2 @@ +prog: vec2_float +prereq: test -e vec2_float && ../../../tests/s390x_features s390x-vx2 diff --git a/tests/s390x_features.c b/tests/s390x_features.c index e7939c4635..6a45199c9d 100644 --- a/tests/s390x_features.c +++ b/tests/s390x_features.c @@ -273,7 +273,7 @@ static int go(char *feature, char *cpu) } else if (strcmp(feature, "s390x-mi3") == 0 ) { match = facilities[0] & FAC_BIT(61); } else if (strcmp(feature, "s390x-vx2") == 0 ) { - match = facilities[2] & FAC_BIT(20); + match = (GET_HWCAP() & 0x800) && (facilities[2] & FAC_BIT(20)); } else { return 2; // Unrecognised feature. } |
|
From: Andreas A. <ar...@so...> - 2023-01-11 15:47:48
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4f4cd4b8d5ec13ef92d97b0e9a9e0053e8bd094e commit 4f4cd4b8d5ec13ef92d97b0e9a9e0053e8bd094e Author: Andreas Arnez <ar...@li...> Date: Thu Dec 8 13:39:25 2022 +0100 s390: Add z16 support to ecag testcase The testcase 'none/tests/s390x/ecag' requires expected output from any machine it runs on. This is missing for z16, so add it. Diff: --- none/tests/s390x/Makefile.am | 1 + none/tests/s390x/ecag.stdout.exp-z16 | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index d8f9e4b894..2a22aefac2 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -41,6 +41,7 @@ EXTRA_DIST = \ $(addsuffix .vgtest,$(INSN_TESTS)) \ ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \ + ecag.stdout.exp-z16 \ op00.stderr.exp1 op00.stderr.exp2 op00.vgtest \ fixbr.vgtest fixbr.stderr.exp fixbr.stdout.exp \ fpext.vgtest fpext.stderr.exp fpext.stdout.exp \ diff --git a/none/tests/s390x/ecag.stdout.exp-z16 b/none/tests/s390x/ecag.stdout.exp-z16 new file mode 100644 index 0000000000..e3f1af306b --- /dev/null +++ b/none/tests/s390x/ecag.stdout.exp-z16 @@ -0,0 +1,21 @@ +L1 topology: separate data and instruction; private +L1 cache line size data: 256 +L1 cache line size insn: 256 +L1 total cachesize data: 131072 +L1 total cachesize insn: 131072 +L1 set. assoc. data: 8 +L1 set. assoc. insn: 8 +L2 topology: unified data and instruction; private +L2 cache line size data: 256 +L2 cache line size insn: 256 +L2 total cachesize data: 33554432 +L2 total cachesize insn: 33554432 +L2 set. assoc. data: 16 +L2 set. assoc. insn: 16 +L3 topology: unified data and instruction; shared +L3 cache line size data: 256 +L3 cache line size insn: 256 +L3 total cachesize data: 268435456 +L3 total cachesize insn: 268435456 +L3 set. assoc. data: 128 +L3 set. assoc. insn: 128 |
|
From: Andreas A. <ar...@so...> - 2023-01-11 15:47:37
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=1b8dcec1b4b9e086894378f819eb3f12044b0b0a commit 1b8dcec1b4b9e086894378f819eb3f12044b0b0a Author: Andreas Arnez <ar...@li...> Date: Thu Dec 1 15:20:21 2022 +0100 s390: Stop CC clobbering by VFMIN and VFMAX Valgrind's implementation of the VFMIN and VFMAX instructions clobbers the condition code, which is wrong. Stop doing that. Diff: --- VEX/priv/guest_s390_toIR.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 3ef104fcd9..250daeca13 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -19382,7 +19382,6 @@ s390_irgen_VFMIN(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) Bool isSingleElementOp = s390_vr_is_single_element_control_set(m5); IRDirty* d; - IRTemp cc = newTemp(Ity_I64); s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VFMIN; @@ -19393,7 +19392,7 @@ s390_irgen_VFMIN(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) details.m5 = m5; details.m6 = m6; - d = unsafeIRDirty_1_N(cc, 0, "s390x_dirtyhelper_vec_op", + d = unsafeIRDirty_0_N(0, "s390x_dirtyhelper_vec_op", &s390x_dirtyhelper_vec_op, mkIRExprVec_2(IRExpr_GSPTR(), mkU64(details.serialized))); @@ -19413,7 +19412,6 @@ s390_irgen_VFMIN(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) d->fxState[2].size = sizeof(V128); stmt(IRStmt_Dirty(d)); - s390_cc_set(cc); return "vfmin"; } @@ -19425,7 +19423,6 @@ s390_irgen_VFMAX(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) Bool isSingleElementOp = s390_vr_is_single_element_control_set(m5); IRDirty* d; - IRTemp cc = newTemp(Ity_I64); s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VFMAX; @@ -19436,7 +19433,7 @@ s390_irgen_VFMAX(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) details.m5 = m5; details.m6 = m6; - d = unsafeIRDirty_1_N(cc, 0, "s390x_dirtyhelper_vec_op", + d = unsafeIRDirty_0_N(0, "s390x_dirtyhelper_vec_op", &s390x_dirtyhelper_vec_op, mkIRExprVec_2(IRExpr_GSPTR(), mkU64(details.serialized))); @@ -19456,7 +19453,6 @@ s390_irgen_VFMAX(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) d->fxState[2].size = sizeof(V128); stmt(IRStmt_Dirty(d)); - s390_cc_set(cc); return "vfmax"; } |
|
From: Andreas A. <ar...@so...> - 2023-01-11 15:47:32
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=73ab2978f8bfb5becc4bc7356228a117292ca51f commit 73ab2978f8bfb5becc4bc7356228a117292ca51f Author: Andreas Arnez <ar...@li...> Date: Thu Dec 1 11:02:12 2022 +0100 s390: Un-swap implementations of VFCH and VFCHE When running under Valgrind, the VFCH instruction behaves like VFCHE, and vice versa. Fix this. Diff: --- VEX/priv/host_s390_defs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index ac5ca6cbe8..c811dc5b80 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -11709,9 +11709,9 @@ s390_insn_vec_binop_emit(UChar *buf, const s390_insn *insn) case S390_VEC_FLOAT_COMPARE_EQUAL: return s390_emit_VFCE(buf, v1, v2, v3, s390_getM_from_size(size), 0, 0); case S390_VEC_FLOAT_COMPARE_LESS_OR_EQUAL: - return s390_emit_VFCH(buf, v1, v3, v2, s390_getM_from_size(size), 0, 0); - case S390_VEC_FLOAT_COMPARE_LESS: return s390_emit_VFCHE(buf, v1, v3, v2, s390_getM_from_size(size), 0, 0); + case S390_VEC_FLOAT_COMPARE_LESS: + return s390_emit_VFCH(buf, v1, v3, v2, s390_getM_from_size(size), 0, 0); default: goto fail; |
|
From: Andreas A. <ar...@so...> - 2023-01-11 15:47:28
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e05f55c77c4a330283778cfea042b6b18312e23d commit e05f55c77c4a330283778cfea042b6b18312e23d Author: Andreas Arnez <ar...@li...> Date: Wed Nov 30 19:15:53 2022 +0100 s390: Fix VFMA, VFMS, VFNMA, and VFNMS for 128-bit FP When trying to execute any of the vector float multiply-and-add family instructions, Valgrind panics with the message "Iex_Qop with F128 data". So far all F128 operations were implemented with instructions that operate on FP register pairs. However, such instructions don't exist for Iop_MAddF128 and Iop_MSubF128, so they must be implemented with vector instructions instead. This was missed when emitting them in "guest_s390_toIR.c". Add the missing support. This also involves adding a few new features to host_s390_defs: * a new vector operation S390_VEC_INIT_FROM_FPRS * the capability to move the left half of a VR to an FPR * S390_VEC_FLOAT_MADD/_MSUB for 128-bit sizes Diff: --- VEX/priv/host_s390_defs.c | 15 ++++++++++++--- VEX/priv/host_s390_defs.h | 1 + VEX/priv/host_s390_isel.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 239d9d2997..ac5ca6cbe8 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -8356,6 +8356,7 @@ s390_insn_as_string(const s390_insn *insn) case S390_VEC_PWSUM_DW: op = "v-vpwsumdw"; break; case S390_VEC_PWSUM_QW: op = "v-vpwsumqw"; break; case S390_VEC_INIT_FROM_GPRS: op = "v-vinitfromgprs"; break; + case S390_VEC_INIT_FROM_FPRS: op = "v-vinitfromfprs"; break; case S390_VEC_FLOAT_ADD: op = "v-vfloatadd"; break; case S390_VEC_FLOAT_SUB: op = "v-vfloatsub"; break; case S390_VEC_FLOAT_MUL: op = "v-vfloatmul"; break; @@ -8772,6 +8773,9 @@ s390_insn_move_emit(UChar *buf, const s390_insn *insn) return s390_emit_LGDRw(buf, dst, src); } } + if (dst_class == HRcFlt64 && src_class == HRcVec128) { + return s390_emit_VLR(buf, dst, src); + } /* A move between floating point registers and general purpose registers of different size should never occur and indicates an error elsewhere. */ @@ -11692,6 +11696,8 @@ s390_insn_vec_binop_emit(UChar *buf, const s390_insn *insn) return s390_emit_VSUMQ(buf, v1, v2, v3, s390_getM_from_size(size)); case S390_VEC_INIT_FROM_GPRS: return s390_emit_VLVGP(buf, v1, v2, v3); + case S390_VEC_INIT_FROM_FPRS: + return s390_emit_VMRH(buf, v1, v2, v3, 3); case S390_VEC_FLOAT_ADD: return s390_emit_VFA(buf, v1, v2, v3, s390_getM_from_size(size), 0); case S390_VEC_FLOAT_SUB: @@ -11722,6 +11728,7 @@ static UChar * s390_insn_vec_triop_emit(UChar *buf, const s390_insn *insn) { s390_vec_triop_t tag = insn->variant.vec_triop.tag; + UChar size = insn->size; UChar v1 = hregNumber(insn->variant.vec_triop.dst); UChar v2 = hregNumber(insn->variant.vec_triop.op1); UChar v3 = hregNumber(insn->variant.vec_triop.op2); @@ -11729,13 +11736,15 @@ s390_insn_vec_triop_emit(UChar *buf, const s390_insn *insn) switch (tag) { case S390_VEC_PERM: { - vassert(insn->size == 16); + vassert(size == 16); return s390_emit_VPERM(buf, v1, v2, v3, v4); } case S390_VEC_FLOAT_MADD: - return s390_emit_VFMA(buf, v1, v2, v3, v4, 0, 3); + return s390_emit_VFMA(buf, v1, v2, v3, v4, 0, + s390_getM_from_size(size)); case S390_VEC_FLOAT_MSUB: - return s390_emit_VFMS(buf, v1, v2, v3, v4, 0, 3); + return s390_emit_VFMS(buf, v1, v2, v3, v4, 0, + s390_getM_from_size(size)); default: goto fail; } diff --git a/VEX/priv/host_s390_defs.h b/VEX/priv/host_s390_defs.h index dc116106ef..375cc8402a 100644 --- a/VEX/priv/host_s390_defs.h +++ b/VEX/priv/host_s390_defs.h @@ -402,6 +402,7 @@ typedef enum { S390_VEC_PWSUM_QW, S390_VEC_INIT_FROM_GPRS, + S390_VEC_INIT_FROM_FPRS, S390_VEC_FLOAT_ADD, S390_VEC_FLOAT_SUB, S390_VEC_FLOAT_MUL, diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index 32c209edb5..3ae7c07c07 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -2153,8 +2153,47 @@ s390_isel_float128_expr_wrk(HReg *dst_hi, HReg *dst_lo, ISelEnv *env, vpanic("Iex_Get with F128 data"); /* --------- 4-ary OP --------- */ - case Iex_Qop: - vpanic("Iex_Qop with F128 data"); + case Iex_Qop: { + IRQop *qop = expr->Iex.Qop.details; + s390_vec_triop_t vecop; + HReg op1_hi, op1_lo, op2_hi, op2_lo, op3_hi, op3_lo; + HReg dst, dstv_lo, op1, op2, op3; + + s390_isel_float128_expr(&op1_hi, &op1_lo, env, qop->arg2); + s390_isel_float128_expr(&op2_hi, &op2_lo, env, qop->arg3); + s390_isel_float128_expr(&op3_hi, &op3_lo, env, qop->arg4); + + /* Cannot carry out with FPRs; move operands to VRs instead. */ + op1 = newVRegV(env); + op2 = newVRegV(env); + op3 = newVRegV(env); + dst = newVRegV(env); + dstv_lo = newVRegV(env); + addInstr(env, s390_insn_vec_binop(8, S390_VEC_INIT_FROM_FPRS, + op1, op1_hi, op1_lo)); + addInstr(env, s390_insn_vec_binop(8, S390_VEC_INIT_FROM_FPRS, + op2, op2_hi, op2_lo)); + addInstr(env, s390_insn_vec_binop(8, S390_VEC_INIT_FROM_FPRS, + op3, op3_hi, op3_lo)); + + switch (qop->op) { + case Iop_MAddF128: vecop = S390_VEC_FLOAT_MADD; break; + case Iop_MSubF128: vecop = S390_VEC_FLOAT_MSUB; break; + default: + goto irreducible; + } + + set_bfp_rounding_mode_in_fpc(env, qop->arg1); + addInstr(env, s390_insn_vec_triop(16, vecop, dst, op1, op2, op3)); + addInstr(env, s390_insn_vec_binop(8, S390_VEC_MERGEL, dstv_lo, dst, dst)); + + /* Move result to destination FPRs. */ + *dst_hi = newVRegF(env); + *dst_lo = newVRegF(env); + addInstr(env, s390_insn_move(8, *dst_hi, dst)); + addInstr(env, s390_insn_move(8, *dst_lo, dstv_lo)); + return; + } /* --------- TERNARY OP --------- */ case Iex_Triop: { @@ -4797,6 +4836,9 @@ s390_isel_vec_expr_wrk(ISelEnv *env, IRExpr *expr) } } + case Iex_Qop: { + } + /* --------- MULTIPLEX --------- */ case Iex_ITE: { IRExpr *cond_expr = expr->Iex.ITE.cond; |
|
From: Andreas A. <ar...@so...> - 2023-01-11 15:47:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6da4025b59253312a24eb2650190a4fcd8f2e634 commit 6da4025b59253312a24eb2650190a4fcd8f2e634 Author: Andreas Arnez <ar...@li...> Date: Thu Oct 13 14:29:08 2022 +0200 Bug 460356 -- s390: Fix code generation for Iop_Sqrt32Fx4 There is no instruction selector for Iop_Sqrt32Fx4, leading to Valgrind panicking with the message: s390_isel_vec_expr: cannot reduce tree Fix this. Diff: --- NEWS | 1 + VEX/priv/host_s390_isel.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index fb3b05fa9d..041ff5ba65 100644 --- a/NEWS +++ b/NEWS @@ -85,6 +85,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 444488 Use glibc.pthread.stack_cache_size tunable 444568 drd/tests/pth_barrier_thr_cr fails on Fedora 38 459476 vgdb: allow address reuse to avoid "address already in use" errorsuse" errors +460356 s390: Sqrt32Fx4 -- cannot reduce tree 462830 WARNING: unhandled amd64-freebsd syscall: 474 463027 broken check for MPX instruction support in assembler diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index f037255cb8..32c209edb5 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -4552,6 +4552,10 @@ s390_isel_vec_expr_wrk(ISelEnv *env, IRExpr *expr) goto Iop_VV_wrk; } + case Iop_Sqrt32Fx4: + size = 4; + vec_unop = S390_VEC_FLOAT_SQRT; + goto Iop_irrm_V_wrk; case Iop_Sqrt64Fx2: size = 8; vec_unop = S390_VEC_FLOAT_SQRT; |
|
From: Mark W. <ma...@kl...> - 2023-01-11 15:01:33
|
Hi Philippe, On Wed, 2023-01-11 at 11:50 +0100, Philippe Waroquiers wrote: > On Tue, 2023-01-10 at 14:40 +0100, Mark Wielaard wrote: > > Does that look correct? > Yes, the approach looks correct to me (but I did not test the patch). > > I think it would be good to put a specific comment for the new filter patterns to > indicate that these are to remove the loading error messages when running > in a .vg_in_place/not installed setup. > because a missing file looks frightening :). Thanks. Added comments and pushed. Hopefully this fixes some failures seen on the nightly builders. (It does fix the gdb_server tests on my local setup) Cheers, Mark |