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
|
|
From: Paul F. <pa...@so...> - 2023-01-29 16:36:11
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ea733f262e37ae691d27122b534a141fc6854ba8 commit ea733f262e37ae691d27122b534a141fc6854ba8 Author: Paul Floyd <pj...@wa...> Date: Sun Jan 29 17:35:08 2023 +0100 macOS: Try to fix build, doesn't like .debug_gdb_scripts Diff: --- coregrind/vg_preloaded.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c index 75a3b7ed0c..d6e05898c9 100644 --- a/coregrind/vg_preloaded.c +++ b/coregrind/vg_preloaded.c @@ -49,6 +49,7 @@ #include <features.h> #endif +#if !defined(VGO_darwin) /* Instruct GDB via a .debug_gdb_scripts section to load the valgrind and tool front-end commands. */ /* Note: The "MS" section flags are to remove duplicates. */ @@ -61,6 +62,7 @@ "); DEFINE_GDB_PY_SCRIPT(VG_LIBDIR "/valgrind-monitor.py") +#endif #if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd) |
|
From: Paul F. <pa...@so...> - 2023-01-28 21:08:55
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a1f365150565e3dd69666ebac85bf535bbe194a1 commit a1f365150565e3dd69666ebac85bf535bbe194a1 Author: Paul Floyd <pj...@wa...> Date: Sat Jan 28 22:08:29 2023 +0100 Remove one lingering trace of tilegx Diff: --- drd/drd_bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drd/drd_bitmap.h b/drd/drd_bitmap.h index d88811e41e..3b71d749a9 100644 --- a/drd/drd_bitmap.h +++ b/drd/drd_bitmap.h @@ -140,7 +140,7 @@ Addr make_address(const UWord a1, const UWord a0) #define BITS_PER_BITS_PER_UWORD 5 #elif defined(VGA_amd64) || defined(VGA_ppc64be) || defined(VGA_ppc64le) \ || defined(VGA_s390x) || (defined(VGA_mips64) && !defined(VGABI_N32)) \ - || defined(VGA_arm64) || defined(VGA_tilegx) + || defined(VGA_arm64) #define BITS_PER_BITS_PER_UWORD 6 #else #error Unknown platform. |
|
From: Mark W. <ma...@so...> - 2023-01-28 20:54:52
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3155bacf26237beb65edb4a572402492b2f1b050 commit 3155bacf26237beb65edb4a572402492b2f1b050 Author: Mark Wielaard <ma...@kl...> Date: Sat Jan 28 21:53:44 2023 +0100 tsan_thread_wrappers_pthread.h: Only include cstdint for C++11 Fixes build on older g++. Diff: --- drd/tests/tsan_thread_wrappers_pthread.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drd/tests/tsan_thread_wrappers_pthread.h b/drd/tests/tsan_thread_wrappers_pthread.h index 4cc8062069..e022e5dece 100644 --- a/drd/tests/tsan_thread_wrappers_pthread.h +++ b/drd/tests/tsan_thread_wrappers_pthread.h @@ -55,7 +55,9 @@ #define NO_TLS #endif +#if __cplusplus >= 201103L #include <cstdint> +#endif #include <string> using namespace std; |
|
From: Mark W. <ma...@so...> - 2023-01-28 20:14:47
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=092d9085442a2519d7b1bdbc79334a307ad55574 commit 092d9085442a2519d7b1bdbc79334a307ad55574 Author: Mark Wielaard <ma...@kl...> Date: Sat Jan 28 21:11:35 2023 +0100 configure.ac: Update AC_PROG_CC checks AM_PROG_CC_C_O has been obsolete since automake 1.14. AC_PROG_CC does the same check. With autoconf 2.70 we must use AC_PROG_CC (which will check for c11 and c99), for earlier versions we'll use AC_PROG_CC_C99. Diff: --- configure.ac | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 47b2a5fe8f..625063beb4 100755 --- a/configure.ac +++ b/configure.ac @@ -50,8 +50,11 @@ CXXFLAGS="$CXXFLAGS" #---------------------------------------------------------------------------- AC_PROG_LN_S -AC_PROG_CC -AM_PROG_CC_C_O +m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99]) +# Make sure we can compile in C99 mode. +if test "$ac_cv_prog_cc_c99" = "no"; then + AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99]) +fi AC_PROG_CPP AC_PROG_CXX # AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with @@ -136,12 +139,6 @@ else fi rm $tmpfile -# Make sure we can compile in C99 mode. -AC_PROG_CC_C99 -if test "$ac_cv_prog_cc_c99" = "no"; then - AC_MSG_ERROR([Valgrind relies on a C compiler supporting C99]) -fi - # We don't want gcc < 3.0 AC_MSG_CHECKING([for a supported version of gcc]) |
|
From: Paul F. <pa...@so...> - 2023-01-28 17:29:24
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=45c61d598f435d59302dea084912cd3390de1ffc commit 45c61d598f435d59302dea084912cd3390de1ffc Author: Paul Floyd <pj...@wa...> Date: Sat Jan 28 18:27:16 2023 +0100 Illumos: regtest filters and gitignore Filter for the gdb python autoload warnings Filter for another variation of shell abort messages Diff: --- .gitignore | 14 ++++++++++++-- gdbserver_tests/filter_vgdb.in | 1 + tests/filter_stderr_basic.in | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2400b4571a..b6c2852345 100644 --- a/.gitignore +++ b/.gitignore @@ -1213,15 +1213,18 @@ /memcheck/tests/solaris/scalar_frealpathat /memcheck/tests/solaris/scalar_getrandom /memcheck/tests/solaris/scalar_ioctl +/memcheck/tests/solaris/scalar_lwp_kill /memcheck/tests/solaris/scalar_lwp_name /memcheck/tests/solaris/scalar_lwp_sigqueue /memcheck/tests/solaris/scalar_lwp_sigqueue_pid /memcheck/tests/solaris/scalar_modctl_modnvl +/memcheck/tests/solaris/scalar_obsolete /memcheck/tests/solaris/scalar_shm_new /memcheck/tests/solaris/scalar_spawn /memcheck/tests/solaris/scalar_system_stats /memcheck/tests/solaris/scalar_tsol_clearance /memcheck/tests/solaris/scalar_utimensat +/memcheck/tests/solaris/scalar_utimesys /memcheck/tests/solaris/scalar_uuidsys /memcheck/tests/solaris/scalar_zone_defunct /memcheck/tests/solaris/sendfilev @@ -1307,6 +1310,7 @@ /memcheck/tests/x86-solaris/context_sse /memcheck/tests/x86-solaris/ldsoexec /memcheck/tests/x86-solaris/scalar +/memcheck/tests/x86-solaris/scalar_obsolete # /memcheck/tests/freebsd/ /memcheck/tests/freebsd/*.stderr.diff* @@ -1657,6 +1661,8 @@ /none/tests/amd64-solaris/*.stderr.out /none/tests/amd64-solaris/*.stdout.diff /none/tests/amd64-solaris/*.stdout.out +/none/tests/amd64-solaris/*.post.diff +/none/tests/amd64-solaris/*.post.out /none/tests/amd64-solaris/.deps /none/tests/amd64-solaris/Makefile /none/tests/amd64-solaris/Makefile.in @@ -2051,6 +2057,8 @@ /none/tests/solaris/*.stderr.out /none/tests/solaris/*.stdout.diff /none/tests/solaris/*.stdout.out +/none/tests/solaris/*.post.diff +/none/tests/solaris/*.post.out /none/tests/solaris/.deps /none/tests/solaris/Makefile /none/tests/solaris/Makefile.in @@ -2095,9 +2103,9 @@ # /none/tests/x86/ /none/tests/x86/*.dSYM -/none/tests/x86/*.stderr.diff +/none/tests/x86/*.stderr.diff* /none/tests/x86/*.stderr.out -/none/tests/x86/*.stdout.diff +/none/tests/x86/*.stdout.diff* /none/tests/x86/*.stdout.out /none/tests/x86/.deps /none/tests/x86/aad_aam @@ -2196,6 +2204,8 @@ /none/tests/x86-solaris/*.stderr.out /none/tests/x86-solaris/*.stdout.diff /none/tests/x86-solaris/*.stdout.out +/none/tests/x86-solaris/*.post.diff +/none/tests/x86-solaris/*.post.out /none/tests/x86-solaris/.deps /none/tests/x86-solaris/Makefile /none/tests/x86-solaris/Makefile.in diff --git a/gdbserver_tests/filter_vgdb.in b/gdbserver_tests/filter_vgdb.in index bd593d91c9..c1844e90c0 100755 --- a/gdbserver_tests/filter_vgdb.in +++ b/gdbserver_tests/filter_vgdb.in @@ -37,6 +37,7 @@ $SED -e '/warning: File .*valgrind-monitor.py.*declined.*/d' | $SED -e '/warning: Missing auto-load script.*/d' | $SED -e '/of file .*vgpreload.*so.*/d' | $SED -e '/Use.*info auto-load python-scripts.*/d' | +$SED -e '/warning: Invalid entry in .debug_gdb_scripts section/d' | # and filter out any remaining empty lines $SED -e '/^$/d' diff --git a/tests/filter_stderr_basic.in b/tests/filter_stderr_basic.in index fc1d19b35b..db83e9f366 100755 --- a/tests/filter_stderr_basic.in +++ b/tests/filter_stderr_basic.in @@ -52,6 +52,8 @@ perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error|Killed # Similar as above, but for ksh on Solaris/illumos. perl -n -e 'print if !/^(Memory fault|Killed) $/' | +# bash on Illumos +$SED '/sh: [1-9][0-9]*: Memory fault/d' | # Translate intercepted glibc functions back to their canonical name perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:.*?\)/: memcpy \(vg_replace_strmem.c:...\)/" | |
|
From: Paul F. <pa...@so...> - 2023-01-27 19:02:56
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=cbba7f699a830cab23bc0c0a19937ec93994ac39 commit cbba7f699a830cab23bc0c0a19937ec93994ac39 Author: Paul Floyd <pj...@wa...> Date: Fri Jan 27 20:00:26 2023 +0100 Regtest: broaden suppression for helgrind bug 392331 Inlining differences on different Linux platforms. Diff: --- helgrind/tests/bug392331.supp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/helgrind/tests/bug392331.supp b/helgrind/tests/bug392331.supp index 6b8c5e1174..d19ab70b4a 100644 --- a/helgrind/tests/bug392331.supp +++ b/helgrind/tests/bug392331.supp @@ -1,25 +1,6 @@ { - Check that Dubious suppression works FreeBSD + Check that Dubious suppression works Helgrind:Dubious fun:pthread_cond_signal_WRK - fun:pthread_cond_signal - fun:_ZNSt3__118condition_variable10notify_oneEv -} -{ - Check that Dubious suppression works Linux standalone - Helgrind:Dubious - fun:pthread_cond_signal_WRK - fun:pthread_cond_signal@* - fun:__gthread_cond_signal - fun:UnknownInlinedFun - fun:_ZNSt18condition_variable10notify_oneEv -} -# for some very strange reason the suppression is different -# when running under regtest -{ - Check that Dubious suppression works Linux regtest - Helgrind:Dubious - fun:pthread_cond_signal_WRK - fun:pthread_cond_signal@* - fun:_ZNSt18condition_variable10notify_oneEv + fun:pthread_cond_signal* } |
|
From: Floyd, P. <pj...@wa...> - 2023-01-27 15:08:42
|
Hi On 27/01/2023 08:19, Julian Seward wrote: > On 25/01/2023 21:16, Paul Floyd wrote: >> I'd like some feedback on >> >> https://bugs.kde.org/show_bug.cgi?id=464103 >> >> This allows the user to specify that a block of memory should be >> histogrammed. [..] > > I can see that the request tells dhat to start tracking the area. How > does it > know when to stop tracking? And what happens if the area happens to > overlap > an existing area? I didn't have any plans for stopping - just leave that to DHAT to stop when the memory is feeed/reallocd. > > Rather than specify exactly the bounds of the area in the macro (that > is, both > address and length), would it be preferable to just specify the base > address > of the block, in the expectation that the block is one that the > program has > previously obtained from malloc, and hence one that dhat already knows > about? > Good idea. I was just copying the code that creates the blocks and propagating the arguments back out to the client requests. > In this case, the macro is merely a request to say "please histogram > this block even though it's above the 1024 limit". That seems to me > at least to > be a simple mental model for end users. For the [start, +len) > formulation in > the existing patch, I'm unclear how that interacts with the "normal" > machinery > of tracking only blocks that come from malloc. My intention is this this to be an override for the 1024 limit. I'll remove the size argument. A+ Paul |
|
From: Paul F. <pa...@so...> - 2023-01-27 07:42:40
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f7e4bb4af294575432b629de4869812fdfee6feb commit f7e4bb4af294575432b629de4869812fdfee6feb Author: Paul Floyd <pj...@wa...> Date: Fri Jan 27 08:42:06 2023 +0100 Bug 382034 - Testcases build fixes for musl Diff: --- NEWS | 1 + memcheck/tests/arm64-linux/scalar.h | 4 ++++ memcheck/tests/x86-linux/scalar.h | 4 ++++ none/tests/x86-linux/seg_override.c | 11 +++++++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 9c2410d89a..7990a8a56f 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,7 @@ 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 +382034 Testcases build fixes for musl 351857 confusing error message about valid command line option 392331 Spurious lock not held error from inside pthread_cond_timedwait 400793 pthread_rwlock_timedwrlock false positive diff --git a/memcheck/tests/arm64-linux/scalar.h b/memcheck/tests/arm64-linux/scalar.h index 9008816d6e..8ef050f4b0 100644 --- a/memcheck/tests/arm64-linux/scalar.h +++ b/memcheck/tests/arm64-linux/scalar.h @@ -12,6 +12,10 @@ #include <sys/types.h> #include <sys/mman.h> +#ifndef __THROW +#define __THROW +#endif + // Since we use vki_unistd.h, we can't include <unistd.h>. So we have to // declare this ourselves. extern long int syscall (long int __sysno, ...) __THROW; diff --git a/memcheck/tests/x86-linux/scalar.h b/memcheck/tests/x86-linux/scalar.h index ef28b03550..52f742e4ac 100644 --- a/memcheck/tests/x86-linux/scalar.h +++ b/memcheck/tests/x86-linux/scalar.h @@ -11,6 +11,10 @@ #include <sys/types.h> #include <sys/mman.h> +#ifndef __THROW +#define __THROW +#endif + // Since we use vki_unistd.h, we can't include <unistd.h>. So we have to // declare this ourselves. extern long int syscall (long int __sysno, ...) __THROW; diff --git a/none/tests/x86-linux/seg_override.c b/none/tests/x86-linux/seg_override.c index b7619c9a80..ca8fbfe2b2 100644 --- a/none/tests/x86-linux/seg_override.c +++ b/none/tests/x86-linux/seg_override.c @@ -2,6 +2,8 @@ #include <stdio.h> #include <errno.h> #include <string.h> +#include "../../../config.h" + /* Stuff from Wine. */ @@ -52,14 +54,19 @@ inline static unsigned int wine_ldt_get_limit( const LDT_ENTRY *ent ) /* our copy of the ldt */ LDT_ENTRY ldt_copy[8192]; +#if defined(MUSL_LIBC) +#define MODIFY_LDT(func, ptr, bytecount) syscall(SYS_modify_ldt, (func), (ptr), (bytecount) ); +#else +#define MODIFY_LDT(func, ptr, bytecount) __modify_ldt((func), (ptr), (bytecount) ); /* System call to set LDT entry. */ //extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); extern int __modify_ldt (int, void *, size_t); +#endif void print_ldt ( void ) { int res; - res = __modify_ldt( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) ); + res = MODIFY_LDT( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) ); printf("got %d bytes\n", res ); perror("error is"); } @@ -102,7 +109,7 @@ void set_ldt1 ( void* base ) ldt_entry.read_exec_only = 0; ldt_entry.limit_in_pages = 0; ldt_entry.seg_not_present = 0; - stat = __modify_ldt (1, &ldt_entry, sizeof (ldt_entry)); + stat = MODIFY_LDT (1, &ldt_entry, sizeof (ldt_entry)); printf("stat = %d\n", stat); } |
|
From: Paul F. <pa...@so...> - 2023-01-27 07:32:04
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=dee222c6e818ca43ac45952fc8a020f445d98781 commit dee222c6e818ca43ac45952fc8a020f445d98781 Author: Paul Floyd <pj...@wa...> Date: Fri Jan 27 08:30:41 2023 +0100 Bug 464859 - Build failures with GCC-13 (drd tsan_unittest) Patch submitted by Khem Raj <raj...@gm...> Diff: --- NEWS | 1 + drd/tests/tsan_thread_wrappers_pthread.h | 1 + 2 files changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 02296575c4..9c2410d89a 100644 --- a/NEWS +++ b/NEWS @@ -91,6 +91,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 462830 WARNING: unhandled amd64-freebsd syscall: 474 463027 broken check for MPX instruction support in assembler 464476 Firefox fails to start under Valgrind +464859 Build failures with GCC-13 (drd tsan_unittest) To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/drd/tests/tsan_thread_wrappers_pthread.h b/drd/tests/tsan_thread_wrappers_pthread.h index f15e6ad631..4cc8062069 100644 --- a/drd/tests/tsan_thread_wrappers_pthread.h +++ b/drd/tests/tsan_thread_wrappers_pthread.h @@ -55,6 +55,7 @@ #define NO_TLS #endif +#include <cstdint> #include <string> using namespace std; |
|
From: Paul F. <pa...@so...> - 2023-01-27 07:24:28
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=57c1641d042e7554143c11af3b52f2efc924ace4 commit 57c1641d042e7554143c11af3b52f2efc924ace4 Author: Paul Floyd <pj...@wa...> Date: Fri Jan 27 08:22:19 2023 +0100 Linux regtest: some extra filtering for helgrind bug392331 Was failing on rhel 7.6 Diff: --- helgrind/tests/Makefile.am | 4 +++- helgrind/tests/bug392331.stderr.exp | 6 ------ helgrind/tests/bug392331.vgtest | 1 + helgrind/tests/filter_bug392331 | 12 ++++++++++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 0a8bd5744b..65f18f1435 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -6,7 +6,9 @@ dist_noinst_SCRIPTS = filter_stderr \ filter_helgrind \ filter_xml \ filter_freebsd.awk \ - filter_stderr_freebsd + filter_stderr_freebsd \ + filter_bug392331 + EXTRA_DIST = \ annotate_hbefore.vgtest annotate_hbefore.stdout.exp \ diff --git a/helgrind/tests/bug392331.stderr.exp b/helgrind/tests/bug392331.stderr.exp index f278e3b089..b61e64f40d 100644 --- a/helgrind/tests/bug392331.stderr.exp +++ b/helgrind/tests/bug392331.stderr.exp @@ -7,15 +7,12 @@ Thread #x is the program's root thread Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) by 0x........: pthread_cond_signal (hg_intercepts.c:...) - ... by 0x........: main (bug392331.cpp:47) ---Thread-Announcement------------------------------------------ Thread #x was created - ... by 0x........: pthread_create@* (hg_intercepts.c:...) - ... by 0x........: main (bug392331.cpp:38) ---------------------------------------------------------------- @@ -23,9 +20,6 @@ Thread #x was created Thread #x: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread at 0x........: pthread_cond_signal_WRK (hg_intercepts.c:...) by 0x........: pthread_cond_signal (hg_intercepts.c:...) - ... by 0x........: worker_thread() (bug392331.cpp:33) - ... by 0x........: mythread_wrapper (hg_intercepts.c:...) - ... diff --git a/helgrind/tests/bug392331.vgtest b/helgrind/tests/bug392331.vgtest index c160dcd40e..3889b15f77 100644 --- a/helgrind/tests/bug392331.vgtest +++ b/helgrind/tests/bug392331.vgtest @@ -1,3 +1,4 @@ prereq: test -e bug392331 vgopts: -q prog: bug392331 +stderr_filter: filter_bug392331 diff --git a/helgrind/tests/filter_bug392331 b/helgrind/tests/filter_bug392331 new file mode 100755 index 0000000000..9cbd5d04e2 --- /dev/null +++ b/helgrind/tests/filter_bug392331 @@ -0,0 +1,12 @@ +#! /bin/sh + +# at least on fedora 3{6|7} the first stanza contains +# by 0x........: pthread_cond_signal (hg_intercepts.c:...) +# ... +# but on rhel 7.6 at least there is no ellipsis +# To make life easier, filter all of them not just the first + +./filter_stderr "$@" | + +sed '/^ \.\.\./d' + |
|
From: Julian S. <jse...@gm...> - 2023-01-27 07:19:17
|
On 25/01/2023 21:16, Paul Floyd wrote: > I'd like some feedback on > > https://bugs.kde.org/show_bug.cgi?id=464103 > > This allows the user to specify that a block of memory should be histogrammed. [..] I can see that the request tells dhat to start tracking the area. How does it know when to stop tracking? And what happens if the area happens to overlap an existing area? Rather than specify exactly the bounds of the area in the macro (that is, both address and length), would it be preferable to just specify the base address of the block, in the expectation that the block is one that the program has previously obtained from malloc, and hence one that dhat already knows about? In this case, the macro is merely a request to say "please histogram this block even though it's above the 1024 limit". That seems to me at least to be a simple mental model for end users. For the [start, +len) formulation in the existing patch, I'm unclear how that interacts with the "normal" machinery of tracking only blocks that come from malloc. J |
|
From: Paul F. <pa...@so...> - 2023-01-27 06:41:37
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=0df691f9d9a8538ea34a4c535f45d30e0f77d60f commit 0df691f9d9a8538ea34a4c535f45d30e0f77d60f Author: Paul Floyd <pj...@wa...> Date: Fri Jan 27 07:40:31 2023 +0100 Linux regtest: forgot prereq test for scalar_openat2 Diff: --- memcheck/tests/x86-linux/scalar_openat2.vgtest | 1 + 1 file changed, 1 insertion(+) diff --git a/memcheck/tests/x86-linux/scalar_openat2.vgtest b/memcheck/tests/x86-linux/scalar_openat2.vgtest index 517c797e61..8f27ad11d0 100644 --- a/memcheck/tests/x86-linux/scalar_openat2.vgtest +++ b/memcheck/tests/x86-linux/scalar_openat2.vgtest @@ -1,2 +1,3 @@ +prereq: test -e ./scalar_openat2 prog: scalar_openat2 vgopts: -q |
|
From: Paul F. <pj...@wa...> - 2023-01-25 20:17:09
|
Hi I'd like some feedback on https://bugs.kde.org/show_bug.cgi?id=464103 This allows the user to specify that a block of memory should be histogrammed. It's intended for blocks larger than the existing 1024 byte limit - recently at work I was profiling and the top data structure was about 1600 bytes so I couldn't see the histogram straight way - I rebuilt dhat with a limit of 2048 to see it. Since this is a user request it shouldn't bee too overwhelming (either for runtime memory or the size of the html generated). I'll do a bit of trial and error and put in some upper limit. About 2500 will fit on my screen, so probably somewhere between 10k and 25k. For such large arrays someone needs to write a nice zoomable GUI. One change I'll probably make straight away is to add an argument for the initial count (normally 0 for malloc or 1 for calloc or std::vector with an initial size and value). Or possibly have 2 macros like DHAT_HISTOGRAM_MEMORY_UNINIT and DHAT_HISTOGRAM_MEMORY_INIT I've also been thinking about an array version of these user requests. For instance say we have 'struct Node' which is 80 bytes. If a user has std::vector<Node> nodeVec(500); or struct Node *nodes = malloc(500*sizeof(struct Node)); Then this would be too big for the DHAT histogram. Just increasing the limiat as with the 1st user request isn't very useful either. So what I'm thinking of is a user request DHAT_HISTOGRAM_ARRAY that takes 3 arguments - pointer to memory - number of elements - size of each element That would look like this std::vector<Node> nodeVec(500); DHAT_HISTOGRAM_ARRAY(nodeVec.data(), nodeVec.size(), sizeof(Node)); In DHAT this would find and throw away the old block. A bit inefficient but I don't see an alternative. Then create number_of_elements subblocks. I did think about automating that. The only alloc function where that would be possible is calloc. malloc new and new[] just have the overall size available. A+ Paul |
|
From: Paul F. <pa...@so...> - 2023-01-25 07:32:28
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=5830ece5cdfd71cb7a7b537b5b58c9a9858a78a3 commit 5830ece5cdfd71cb7a7b537b5b58c9a9858a78a3 Author: Paul Floyd <pj...@wa...> Date: Wed Jan 25 08:31:09 2023 +0100 FreeBSD: update comment about __sysctlbyname and kern.proc.pathname Diff: --- coregrind/m_syswrap/syswrap-freebsd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 401a7ba8ee..13d3b6bf25 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6468,8 +6468,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? + // kern.proc.pathname doesn't seem to be handled + // makes sense as the pid is variable and using + // a MIB is easier than generating a string // read number of ints specified in ARG2 from mem pointed to by ARG1 PRE_MEM_READ("__sysctlbyname(name)", (Addr)ARG1, ARG2 * sizeof(int)); |
|
From: Paul F. <pa...@so...> - 2023-01-24 21:01:17
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e2eeebafa6cd48538e16104d674232220cb4e1d1 commit e2eeebafa6cd48538e16104d674232220cb4e1d1 Author: Paul Floyd <pj...@wa...> Date: Tue Jan 24 22:00:44 2023 +0100 FreeBSD: fix compile of auxv on FreeBSD 12 Diff: --- none/tests/freebsd/auxv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/none/tests/freebsd/auxv.c b/none/tests/freebsd/auxv.c index ae26d4b5de..6425fc3043 100644 --- a/none/tests/freebsd/auxv.c +++ b/none/tests/freebsd/auxv.c @@ -80,6 +80,7 @@ int main(int argc, char* argv[], char* envp[]) fprintf(stderr, "EXECPATH: %s\n", (char*)auxp->a_un.a_val); } break; +#if (FREEBSD_VERS >= FREEBSD_13_0) case AT_ARGV: if (auxp->a_un.a_val != 0) { @@ -104,6 +105,9 @@ int main(int argc, char* argv[], char* envp[]) /*fprintf(stderr, "PS_STRINGS ENVV: %s\n", *ppss->ps_envstr);*/ } break; +#endif + default: + break; } } } |
|
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 |