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-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. |