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
(1) |
2
(3) |
|
3
(6) |
4
(2) |
5
(2) |
6
(5) |
7
(4) |
8
(3) |
9
(3) |
|
10
(4) |
11
(7) |
12
(3) |
13
(4) |
14
|
15
|
16
|
|
17
|
18
|
19
(6) |
20
|
21
|
22
|
23
|
|
24
|
25
|
26
|
27
(2) |
28
|
29
|
30
|
|
From: Carl L. <ce...@us...> - 2022-04-09 20:26:50
|
Mark: On Sat, 2022-04-09 at 00:21 +0000, Mark Wielaard wrote: > https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=116b93b49080dc61363b2a8da85f8f1bb32c5640 > > commit 116b93b49080dc61363b2a8da85f8f1bb32c5640 > Author: Mark Wielaard <ma...@kl...> > Date: Sat Apr 9 02:13:46 2022 +0200 > > -> 3.19.0.RC2 Tested on Power 8LE, Power 8BE, Power 9, Power 10. All looks good to go. Carl |
|
From: Mark W. <ma...@kl...> - 2022-04-09 00:56:31
|
Hi valgrind hackers, An RC2 tarball for 3.19.0 is now available at ftp://sourceware.org/pub/valgrind/valgrind-3.19.0.RC2.tar.bz2 https://sourceware.org/pub/valgrind/valgrind-3.19.0.RC2.tar.bz2 (md5sum = 002f3b97f93f16c8afa957bee90b2198) Please give it a try in configurations that are important for you and report any problems you have, either on this mailing list, or (preferably) via our bug tracker at https://bugs.kde.org/enter_bug.cgi?product=valgrind I believe this is in pretty good shape. So unless someone reports a showstopper this weekend I like to do a 3.19.0 final release on Monday (April 11). Cheers, Mark |
|
From: Mark W. <ma...@so...> - 2022-04-09 00:21:28
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=116b93b49080dc61363b2a8da85f8f1bb32c5640 commit 116b93b49080dc61363b2a8da85f8f1bb32c5640 Author: Mark Wielaard <ma...@kl...> Date: Sat Apr 9 02:13:46 2022 +0200 -> 3.19.0.RC2 Diff: --- NEWS | 3 ++- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 1fa918dfbd..dcce409261 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Release 3.19.0 (08 Apr 2022) +Release 3.19.0 (11 Apr 2022) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, @@ -106,6 +106,7 @@ To see details of a given bug, visit where XXXXXX is the bug number as listed above. (3.19.0.RC1: 02 Apr 2022) +(3.19.0.RC2: 08 Apr 2022) Release 3.18.0 (15 Oct 2021) diff --git a/configure.ac b/configure.ac index 4bde7318cf..da50a48491 100755 --- a/configure.ac +++ b/configure.ac @@ -17,8 +17,8 @@ m4_define([v_major_ver], [3]) m4_define([v_minor_ver], [19]) m4_define([v_micro_ver], [0]) -m4_define([v_suffix_ver], [RC1]) -m4_define([v_rel_date], ["02 Apr 2022"]) +m4_define([v_suffix_ver], [RC2]) +m4_define([v_rel_date], ["08 Apr 2022"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], |
|
From: Mark W. <ma...@so...> - 2022-04-08 13:36:54
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7b5867b1fda1dbadc1291988828f6d6ad9438144 commit 7b5867b1fda1dbadc1291988828f6d6ad9438144 Author: Mark Wielaard <ma...@kl...> Date: Fri Apr 8 14:58:38 2022 +0200 helgrind reports false races for printfs using mempcpy on FILE* state We already have a suppression for helgrind which is for when glibc uses __GI_mempcpy to manipulate internal FILE state (this was bug 352130). But since glibc-2.26 mempcpy is used instead __GI_mempcpy, making the suppresion from the original bug obsolete. This patch adds a new suppression using mempcpy but doesn't replace the original suppression for older systems. Patch adding suppression + testcase by Jesus Checa <jc...@re...> https://bugs.kde.org/show_bug.cgi?id=450962 Diff: --- .gitignore | 1 + glibc-2.X-helgrind.supp.in | 8 ++++ helgrind/tests/Makefile.am | 2 + helgrind/tests/pth_mempcpy_false_races.c | 50 +++++++++++++++++++++++ helgrind/tests/pth_mempcpy_false_races.stderr.exp | 0 helgrind/tests/pth_mempcpy_false_races.vgtest | 3 ++ 6 files changed, 64 insertions(+) diff --git a/.gitignore b/.gitignore index 5026fcbc78..94ff17d299 100644 --- a/.gitignore +++ b/.gitignore @@ -666,6 +666,7 @@ /helgrind/tests/Makefile.in /helgrind/tests/pth_barrier /helgrind/tests/pth_destroy_cond +/helgrind/tests/pth_mempcpy_false_races /helgrind/tests/rwlock_race /helgrind/tests/rwlock_test /helgrind/tests/shmem_abits diff --git a/glibc-2.X-helgrind.supp.in b/glibc-2.X-helgrind.supp.in index cecf3ceab9..8e1a10fa55 100644 --- a/glibc-2.X-helgrind.supp.in +++ b/glibc-2.X-helgrind.supp.in @@ -54,6 +54,14 @@ obj:@GLIBC_LIBC_PATH@ } +{ + helgrind-glibc-io-xsputn-mempcpy-glibc2-26+ + Helgrind:Race + fun:mempcpy + fun:_IO_*xsputn* + obj:@GLIBC_LIBC_PATH@ +} + { helgrind-glibc2X-005 Helgrind:Race diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index cf7f76d46a..05e145f7b8 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -58,6 +58,7 @@ EXTRA_DIST = \ pth_cond_destroy_busy.stderr.exp-ppc64 \ pth_cond_destroy_busy.stderr.exp-solaris \ pth_cond_destroy_busy.stderr.exp-freebsd \ + pth_mempcpy_false_races.vgtest pth_mempcpy_false_races.stderr.exp \ pth_spinlock.vgtest pth_spinlock.stdout.exp pth_spinlock.stderr.exp \ rwlock_race.vgtest rwlock_race.stdout.exp rwlock_race.stderr.exp \ rwlock_test.vgtest rwlock_test.stdout.exp rwlock_test.stderr.exp \ @@ -152,6 +153,7 @@ check_PROGRAMS = \ locked_vs_unlocked2 \ locked_vs_unlocked3 \ pth_destroy_cond \ + pth_mempcpy_false_races \ shmem_abits \ stackteardown \ t2t \ diff --git a/helgrind/tests/pth_mempcpy_false_races.c b/helgrind/tests/pth_mempcpy_false_races.c new file mode 100644 index 0000000000..90716435d6 --- /dev/null +++ b/helgrind/tests/pth_mempcpy_false_races.c @@ -0,0 +1,50 @@ +/* Related bugs: + * https://bugs.kde.org/show_bug.cgi?id=352130 + * https://bugs.kde.org/show_bug.cgi?id=450962 + * This reproducer has no real race conditions but since helgrind doesn't see + * or know about the glibc internal locking done for FILE *state, it will report + * a race when several threads run printf due to this fact. + */ + +#include <stdio.h> +#include <pthread.h> + +pthread_t thread; + +void* thread3 (void* d) +{ + int count3 = 0; + + while(count3 < 100){ + printf("Thread 3: %d\n", count3++); + } + return NULL; +} + +void* thread2 (void* d) +{ + int count2 = 0; + + while(count2 < 1000){ + // + printf("Thread 2: %d\n", count2++); + } + return NULL; +} + +int main (){ + + pthread_create (&thread, NULL, thread2, NULL); + pthread_create (&thread, NULL, thread3, NULL); + + //Thread 1 + int count1 = 0; + + while(count1 < 10){ + printf("Thread 1: %d\n", count1++); + } + + pthread_join(thread,NULL); + return 0; +} + diff --git a/helgrind/tests/pth_mempcpy_false_races.stderr.exp b/helgrind/tests/pth_mempcpy_false_races.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/helgrind/tests/pth_mempcpy_false_races.vgtest b/helgrind/tests/pth_mempcpy_false_races.vgtest new file mode 100644 index 0000000000..9e3c6d4b45 --- /dev/null +++ b/helgrind/tests/pth_mempcpy_false_races.vgtest @@ -0,0 +1,3 @@ +prog: pth_mempcpy_false_races +vgopts: -q +stdout_filter: ../../gdbserver_tests/filter_make_empty |
|
From: Mark W. <ma...@kl...> - 2022-04-08 10:26:09
|
Hi valgrind hackers, On Sat, 2022-04-02 at 21:51 +0200, Mark Wielaard wrote: > An RC1 tarball for 3.19.0 is now available at > ftp://sourceware.org/pub/valgrind/valgrind-3.19.0.RC1.tar.bz2 > https://sourceware.org/pub/valgrind/valgrind-3.19.0.RC1.tar.bz2 > (md5sum = d784310ca4c159e4d6c36c7dacffc3ed) > > Please give it a try in configurations that are important for you and > report any problems you have, either on this mailing list, or > (preferably) via our bug tracker at > https://bugs.kde.org/enter_bug.cgi?product=valgrind > > There are are couple of issues I like to look into which have patches > that need review: > 451878 Add support for new syscall memfd_secret > 450437 Warn for execve syscall with argv or argv[0] being NULL. > 445011 SIGCHLD is sent when valgrind uses debuginfod-find > > And this not yet fully understood issue: > 452058 Generated suppressions contain a mix of mangled (physical) > and demangled (inline) frames > > If there are any other urgent issues please do propose patches. > > I'll like to do an RC2 on Wednesday, with a final release on Friday, > April 8th if everything goes well. So, I didn't make the RC2 on Wednesday because we are still fixing some bugs (although in general things look pretty good). I'll do an RC2 later today (Friday) and if that looks good after some more testing do the final 3.19.0 release on Monday (April 11). Cheers, Mark |
|
From: Mark W. <ma...@so...> - 2022-04-08 07:52:22
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a1bb40171ab2289043856c6893522449ccc9fdff commit a1bb40171ab2289043856c6893522449ccc9fdff Author: Mark Wielaard <ma...@kl...> Date: Fri Apr 8 09:42:10 2022 +0200 Move ht_sigchld_ignore and ht_ignore_node to pub_tool_signals.h ht_sigchld_ignore and ht_ignore_node were defined in pub_core_signals.h which cannot include any other tool header. ...checking header files and include directives *** File coregrind/pub_core_signals.h must not include pub_tool_hashtable.h So move the definition and type to pub_tool_signals.h Diff: --- coregrind/pub_core_signals.h | 10 ---------- include/pub_tool_signals.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/coregrind/pub_core_signals.h b/coregrind/pub_core_signals.h index 1c86ee5f63..ae8555ba80 100644 --- a/coregrind/pub_core_signals.h +++ b/coregrind/pub_core_signals.h @@ -35,7 +35,6 @@ #include "pub_tool_signals.h" // I want to get rid of this header... #include "pub_core_vki.h" // vki_sigset_t et al. -#include "pub_tool_hashtable.h" /* Highest signal the kernel will let us use */ extern Int VG_(max_signal); @@ -86,15 +85,6 @@ extern Bool VG_(extend_stack)(ThreadId tid, Addr addr); before using that signal to kill the process. */ extern void VG_(set_default_handler)(Int sig); -/* Hash table of PIDs from which SIGCHLD is ignored. */ -extern VgHashTable *ht_sigchld_ignore; - -/* Hash table node where each key represents a PID. */ -typedef struct _ht_ignore_node { - struct _ht_ignore_node *next; - UWord key; -} ht_ignore_node; - #endif // __PUB_CORE_SIGNALS_H /*--------------------------------------------------------------------*/ diff --git a/include/pub_tool_signals.h b/include/pub_tool_signals.h index 0de30465c1..f037cd5d7e 100644 --- a/include/pub_tool_signals.h +++ b/include/pub_tool_signals.h @@ -30,6 +30,7 @@ #define __PUB_TOOL_SIGNALS_H #include "pub_tool_basics.h" // Addr +#include "pub_tool_hashtable.h" // VgHashTable // Register an interest in apparently internal faults; used code which // wanders around dangerous memory (ie, leakcheck). The catcher is @@ -43,6 +44,15 @@ typedef void (*fault_catcher_t)(Int sig, Addr addr); extern fault_catcher_t VG_(set_fault_catcher)(fault_catcher_t catcher); +/* Hash table of PIDs from which SIGCHLD is ignored. */ +extern VgHashTable *ht_sigchld_ignore; + +/* Hash table node where each key represents a PID. */ +typedef struct _ht_ignore_node { + struct _ht_ignore_node *next; + UWord key; +} ht_ignore_node; + #endif // __PUB_TOOL_SIGNALS_H /*--------------------------------------------------------------------*/ |
|
From: Mark W. <ma...@so...> - 2022-04-07 21:51:18
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=2c0fb665699309e1e02a02084324748f46a6c788 commit 2c0fb665699309e1e02a02084324748f46a6c788 Author: Randy MacLeod <Ran...@wi...> Date: Tue Oct 16 21:01:04 2018 -0400 Fix out of tree builds. The paths to these files need to be fully specified in the out of tree build case. glibc-2.X.supp is a generated file so the full path is deliberately not specified in that case. Also adjust the mpi include dir location as valgrind.h is generated as well and needs to be taken out of build dir. Also adjust the location of generated xml file. And the search paths for the xmllint, xsltproc and xmlto programs. Signed-off-by: Alexander Kanavin <ale...@gm...> Diff: --- NEWS | 1 + configure.ac | 72 ++++++++++++++++++++++++++++---------------------------- docs/Makefile.am | 13 ++++++---- mpi/Makefile.am | 4 ++-- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git a/NEWS b/NEWS index d3bb86d0f6..1fa918dfbd 100644 --- a/NEWS +++ b/NEWS @@ -71,6 +71,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 444925 fexecve syscall wrapper not properly implemented 445032 valgrind/memcheck crash with SIGSEGV when SIGVTALRM timer used and libthr.so associated +445211 Fix out of tree builds 445300 [PATCH] Fix building tests with Musl 445011 SIGCHLD is sent when valgrind uses debuginfod-find 445354 arm64 backend: incorrect code emitted for doubleword CAS diff --git a/configure.ac b/configure.ac index 04c306efbb..4bde7318cf 100755 --- a/configure.ac +++ b/configure.ac @@ -454,7 +454,7 @@ case "${host_os}" in ;; esac - DEFAULT_SUPP="freebsd.supp freebsd-helgrind.supp freebsd-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}" ;; *darwin*) @@ -493,56 +493,56 @@ case "${host_os}" in 9.*) AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard]) AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin9.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin9-drd.supp ${DEFAULT_SUPP}" ;; 10.*) AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard]) AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 11.*) AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion]) AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin11.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 12.*) AC_MSG_RESULT([Darwin 12.x (${kernel}) / Mac OS X 10.8 Mountain Lion]) AC_DEFINE([DARWIN_VERS], DARWIN_10_8, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin12.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin12.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 13.*) AC_MSG_RESULT([Darwin 13.x (${kernel}) / Mac OS X 10.9 Mavericks]) AC_DEFINE([DARWIN_VERS], DARWIN_10_9, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin13.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin13.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 14.*) AC_MSG_RESULT([Darwin 14.x (${kernel}) / Mac OS X 10.10 Yosemite]) AC_DEFINE([DARWIN_VERS], DARWIN_10_10, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin14.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin14.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 15.*) AC_MSG_RESULT([Darwin 15.x (${kernel}) / Mac OS X 10.11 El Capitan]) AC_DEFINE([DARWIN_VERS], DARWIN_10_11, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin15.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin15.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 16.*) AC_MSG_RESULT([Darwin 16.x (${kernel}) / macOS 10.12 Sierra]) AC_DEFINE([DARWIN_VERS], DARWIN_10_12, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin16.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin16.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; 17.*) AC_MSG_RESULT([Darwin 17.x (${kernel}) / macOS 10.13 High Sierra]) AC_DEFINE([DARWIN_VERS], DARWIN_10_13, [Darwin / Mac OS X version]) - DEFAULT_SUPP="darwin17.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin17.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/darwin10-drd.supp ${DEFAULT_SUPP}" ;; *) AC_MSG_RESULT([unsupported (${kernel})]) @@ -558,10 +558,10 @@ case "${host_os}" in uname_v=$( uname -v ) case "$uname_v" in 11.4.*) - DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}" ;; *) - DEFAULT_SUPP="solaris11.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/solaris11.supp ${DEFAULT_SUPP}" ;; esac ;; @@ -569,7 +569,7 @@ case "${host_os}" in solaris2.12*) AC_MSG_RESULT([ok (${host_os})]) VGCONF_OS="solaris" - DEFAULT_SUPP="solaris12.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/solaris12.supp ${DEFAULT_SUPP}" ;; *) @@ -1283,15 +1283,15 @@ AC_MSG_CHECKING([the glibc version]) case "${GLIBC_VERSION}" in 2.2) AC_MSG_RESULT(${GLIBC_VERSION} family) - DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/glibc-2.2.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" ;; 2.[[3-6]]) AC_MSG_RESULT(${GLIBC_VERSION} family) - DEFAULT_SUPP="glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/glibc-${GLIBC_VERSION}.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" ;; 2.[[7-9]]) AC_MSG_RESULT(${GLIBC_VERSION} family) @@ -1304,8 +1304,8 @@ case "${GLIBC_VERSION}" in AC_DEFINE([GLIBC_MANDATORY_STRLEN_REDIRECT], 1, [Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10)]) DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" ;; 2.*) AC_MSG_RESULT(${GLIBC_VERSION} family) @@ -1314,8 +1314,8 @@ case "${GLIBC_VERSION}" in AC_DEFINE([GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT], 1, [Define to 1 if index() and strlen() have been optimized heavily (x86 glibc >= 2.12)]) DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-helgrind.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}" ;; darwin) AC_MSG_RESULT(Darwin) @@ -1330,7 +1330,7 @@ case "${GLIBC_VERSION}" in bionic) AC_MSG_RESULT(Bionic) AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic]) - DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/bionic.supp ${DEFAULT_SUPP}" ;; solaris) AC_MSG_RESULT(Solaris) @@ -1340,7 +1340,7 @@ case "${GLIBC_VERSION}" in musl) AC_MSG_RESULT(Musl) AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc]) - DEFAULT_SUPP="musl.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/musl.supp ${DEFAULT_SUPP}" ;; 2.0|2.1|*) AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}]) @@ -1359,8 +1359,8 @@ if test "$VGCONF_OS" != "solaris"; then # attempt to detect whether such libraries are installed on the # build machine (or even if any X facilities are present); just # add the suppressions antidisirregardless. - DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}" - DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/xfree-4.supp ${DEFAULT_SUPP}" + DEFAULT_SUPP="$srcdir/xfree-3.supp ${DEFAULT_SUPP}" fi diff --git a/docs/Makefile.am b/docs/Makefile.am index 5c777a263a..3850d7b744 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -124,11 +124,12 @@ LOGFILE = print.log # validation stuff XMLLINT = xmllint -XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent +XMLLINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent \ + --path $(top_builddir)/docs/xml # stylesheet processor XSLTPROC = xsltproc -XSLTPROC_FLAGS = --nonet --xinclude +XSLTPROC_FLAGS = --nonet --xinclude --path $(top_builddir)/docs/xml # stylesheets XSL_HTML_CHUNK_STYLE = $(mylibdir)/vg-html-chunk.xsl @@ -143,7 +144,7 @@ XSL_MAN_STYLES = \ # Input files for valid-manual and valid-manpages MANUAL_XML_FILES = $(myxmldir)/index.xml \ - $(myxmldir)/vg-entities.xml \ + $(top_builddir)/docs/xml/vg-entities.xml \ $(myxmldir)/quick-start-guide.xml \ $(myxmldir)/manual.xml \ $(myxmldir)/manual-intro.xml \ @@ -238,7 +239,8 @@ print-docs: cp $(myimgdir)/*.png $(myprintdir)/images && \ xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \ -x $(XSL_FO_STYLE) \ - --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE) && \ + --searchpath $(top_builddir)/docs/xml:print \ + pdf $(myxmldir)/index.xml &> $(LOGFILE) && \ echo "Generating PS file: $(myprintdir)/index.ps ..." && \ pdftops index.pdf && \ mv index.pdf index.ps $(myprintdir) && \ @@ -353,7 +355,8 @@ download-docs: cp $(myimgdir)/*.png $(vgdir)/print/images/ xmlto -v $(WITH_FOP) --stringparam=keep.relative.image.uris="1" \ -x $(XSL_FO_STYLE) \ - --searchpath print pdf $(myxmldir)/index.xml &> $(LOGFILE) + --searchpath $(top_builddir)/docs/xml:print \ + pdf $(myxmldir)/index.xml &> $(LOGFILE) mv index.pdf $(vgdir)/print/manual.pdf @echo "" @echo "Generating valgrind_manual.ps.bz2 ..." diff --git a/mpi/Makefile.am b/mpi/Makefile.am index 69b69aa925..e57e5aa85c 100644 --- a/mpi/Makefile.am +++ b/mpi/Makefile.am @@ -56,14 +56,14 @@ endif if BUILD_MPIWRAP_PRI libmpiwrap_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_SOURCES = libmpiwrap.c -libmpiwrap_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = -I$(top_srcdir)/include +libmpiwrap_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CPPFLAGS = -I$(top_builddir)/include libmpiwrap_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_CFLAGS = \ $(CFLAGS_MPI) $(MPI_FLAG_M3264_PRI) -Wno-deprecated-declarations libmpiwrap_@VGCONF_ARCH_PRI@_@VGCONF_OS@_so_LDFLAGS = $(LDFLAGS_MPI) endif if BUILD_MPIWRAP_SEC libmpiwrap_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_SOURCES = libmpiwrap.c -libmpiwrap_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = -I$(top_srcdir)/include +libmpiwrap_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CPPFLAGS = -I$(top_builddir)/include libmpiwrap_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_CFLAGS = \ $(CFLAGS_MPI) $(MPI_FLAG_M3264_SEC) -Wno-deprecated-declarations libmpiwrap_@VGCONF_ARCH_SEC@_@VGCONF_OS@_so_LDFLAGS = $(LDFLAGS_MPI) |
|
From: Mark W. <ma...@so...> - 2022-04-07 21:42:46
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7959d0661b2bce47a0f85b219f328b2239c4ffff commit 7959d0661b2bce47a0f85b219f328b2239c4ffff Author: Mark Wielaard <ma...@kl...> Date: Thu Apr 7 22:02:12 2022 +0200 Update mc_main Copyright message to include 2022 We haven't ran auxprogs/change-copyright-year since we switched to git. This means most Copyright year ranges still say 2017. The script also doesn't work for years >= 2020. Instead of trying to figure out how to correctly update the per file Copyright year ranges just update the main copyright notice that the program outputs on startup. Diff: --- memcheck/mc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 47b370bf51..979a654097 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -8348,7 +8348,7 @@ static void mc_pre_clo_init(void) VG_(details_version) (NULL); VG_(details_description) ("a memory error detector"); VG_(details_copyright_author)( - "Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al."); + "Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al."); VG_(details_bug_reports_to) (VG_BUGS_TO); VG_(details_avg_translation_sizeB) ( 640 ); |
|
From: Mark W. <ma...@so...> - 2022-04-07 20:57:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=2ad93350446a49a5b0093548b63d43195d99d4ae commit 2ad93350446a49a5b0093548b63d43195d99d4ae Author: Aaron Merey <am...@re...> Date: Tue Jan 25 20:24:18 2022 -0500 Bug 445011: SIGCHLD is sent when valgrind uses debuginfod-find Valgrind fork+execs debuginfod-find in order to perform debuginfod queries. Any SIGCHLD debuginfod-find sends upon termination can mistakenly be delivered to the client running under valgrind. To prevent this, record in a hash table the PID of each process valgrind forks for internal use. Do not send SIGCHLD to the client if it is from a PID in this hash table. https://bugs.kde.org/show_bug.cgi?id=445011 Diff: --- NEWS | 1 + coregrind/m_libcproc.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ coregrind/m_signals.c | 26 +++++++++++++++++++ coregrind/pub_core_signals.h | 10 ++++++++ include/vki/vki-darwin.h | 6 +++++ include/vki/vki-freebsd.h | 10 ++++++++ include/vki/vki-linux.h | 10 ++++++++ 7 files changed, 123 insertions(+) diff --git a/NEWS b/NEWS index 924032b3c1..d3bb86d0f6 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 445032 valgrind/memcheck crash with SIGSEGV when SIGVTALRM timer used and libthr.so associated 445300 [PATCH] Fix building tests with Musl +445011 SIGCHLD is sent when valgrind uses debuginfod-find 445354 arm64 backend: incorrect code emitted for doubleword CAS 445415 arm64 front end: alignment checks missing for atomic instructions 445504 Using C++ condition_variable results in bogus "mutex is locked simultaneously by two threads" warning diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c index 7425c9c887..b94cabcf1f 100644 --- a/coregrind/m_libcproc.c +++ b/coregrind/m_libcproc.c @@ -38,6 +38,7 @@ #include "pub_core_libcsignal.h" #include "pub_core_seqmatch.h" #include "pub_core_mallocfree.h" +#include "pub_core_signals.h" #include "pub_core_syscall.h" #include "pub_core_xarray.h" #include "pub_core_clientstate.h" @@ -888,14 +889,68 @@ Int VG_(ptrace) ( Int request, Int pid, void *addr, void *data ) Fork ------------------------------------------------------------------ */ +/* Record PID of a child process in order to avoid sending any SIGCHLD from + it to the client. If PID is 0 then this is the child process and it + should synch with the parent to ensure it can't send any SIGCHLD before + the parent has registered its PID. + + FDS should be initialized with VG_(pipe). This function closes both + file descriptors. */ +static void register_sigchld_ignore ( Int pid, Int fds[2]) +{ + Int child_wait = 1; + ht_ignore_node *n; + + if (fds[0] < 0 || fds[1] < 0) + return; + + if (pid == 0) { + /* Before proceeding, ensure parent has recorded child PID in map + of SIGCHLD to ignore */ + while (child_wait == 1) + { + if (VG_(read)(fds[0], &child_wait, sizeof(Int)) <= 0) { + VG_(message)(Vg_DebugMsg, + "warning: Unable to record PID of internal process (read)\n"); + child_wait = 0; + } + } + + VG_(close)(fds[0]); + return; + } + + n = VG_(malloc)("ht.ignore.node", sizeof(ht_ignore_node)); + n->key = pid; + if (ht_sigchld_ignore == NULL) + ht_sigchld_ignore = VG_(HT_construct)("ht.sigchld.ignore"); + VG_(HT_add_node)(ht_sigchld_ignore, n); + + child_wait = 0; + if (VG_(write)(fds[1], &child_wait, sizeof(Int)) <= 0) + VG_(message)(Vg_DebugMsg, + "warning: Unable to record PID of internal process (write)\n"); + + VG_(close)(fds[1]); +} + Int VG_(fork) ( void ) { + Int fds[2]; + + if (VG_(pipe)(fds) != 0) { + VG_(message)(Vg_DebugMsg, + "warning: Unable to record PID of internal process (pipe)\n"); + fds[0] = fds[1] = -1; + } + # if defined(VGP_arm64_linux) || defined(VGP_nanomips_linux) SysRes res; res = VG_(do_syscall5)(__NR_clone, VKI_SIGCHLD, (UWord)NULL, (UWord)NULL, (UWord)NULL, (UWord)NULL); if (sr_isError(res)) return -1; + register_sigchld_ignore(sr_Res(res), fds); return sr_Res(res); # elif defined(VGO_linux) || defined(VGO_freebsd) @@ -903,6 +958,7 @@ Int VG_(fork) ( void ) res = VG_(do_syscall0)(__NR_fork); if (sr_isError(res)) return -1; + register_sigchld_ignore(sr_Res(res), fds); return sr_Res(res); # elif defined(VGO_darwin) @@ -912,8 +968,10 @@ Int VG_(fork) ( void ) return -1; /* on success: wLO = child pid; wHI = 1 for child, 0 for parent */ if (sr_ResHI(res) != 0) { + register_sigchld_ignore(0, fds); return 0; /* this is child: return 0 instead of child pid */ } + register_sigchld_ignore(sr_Res(res), fds); return sr_Res(res); # elif defined(VGO_solaris) @@ -930,8 +988,10 @@ Int VG_(fork) ( void ) child, val2 = 0 in the parent process, 1 in the child process. */ if (sr_ResHI(res) != 0) { + register_sigchld_ignore(0, fds); return 0; } + register_sigchld_ignore(sr_Res(res), fds); return sr_Res(res); # else diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 9210db8e5e..bfddbe392a 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -207,6 +207,7 @@ #include "pub_core_aspacemgr.h" #include "pub_core_errormgr.h" #include "pub_core_gdbserver.h" +#include "pub_core_hashtable.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" @@ -247,6 +248,9 @@ typedef struct SigQueue { vki_siginfo_t sigs[N_QUEUED_SIGNALS]; } SigQueue; +/* Hash table of PIDs from which SIGCHLD is ignored. */ +VgHashTable *ht_sigchld_ignore = NULL; + /* ------ Macros for pulling stuff out of ucontexts ------ */ /* Q: what does VG_UCONTEXT_SYSCALL_SYSRES do? A: let's suppose the @@ -2058,6 +2062,28 @@ static void deliver_signal ( ThreadId tid, const vki_siginfo_t *info, void *handler_fn; ThreadState *tst = VG_(get_ThreadState)(tid); +#if defined(VGO_linux) + /* If this signal is SIGCHLD and it came from a process which valgrind + created for some internal use, then it should not be delivered to + the client. */ + if (sigNo == VKI_SIGCHLD && ht_sigchld_ignore != NULL) { + Int pid = info->_sifields._sigchld._pid; + ht_ignore_node *n = VG_(HT_lookup)(ht_sigchld_ignore, pid); + + if (n != NULL) { + /* If the child has terminated, remove its PID from the + ignore list. */ + if (info->si_code == VKI_CLD_EXITED + || info->si_code == VKI_CLD_KILLED + || info->si_code == VKI_CLD_DUMPED) { + VG_(HT_remove)(ht_sigchld_ignore, pid); + VG_(free)(n); + } + return; + } + } +#endif + if (VG_(clo_trace_signals)) VG_(dmsg)("delivering signal %d (%s):%d to thread %u\n", sigNo, VG_(signame)(sigNo), info->si_code, tid ); diff --git a/coregrind/pub_core_signals.h b/coregrind/pub_core_signals.h index ae8555ba80..1c86ee5f63 100644 --- a/coregrind/pub_core_signals.h +++ b/coregrind/pub_core_signals.h @@ -35,6 +35,7 @@ #include "pub_tool_signals.h" // I want to get rid of this header... #include "pub_core_vki.h" // vki_sigset_t et al. +#include "pub_tool_hashtable.h" /* Highest signal the kernel will let us use */ extern Int VG_(max_signal); @@ -85,6 +86,15 @@ extern Bool VG_(extend_stack)(ThreadId tid, Addr addr); before using that signal to kill the process. */ extern void VG_(set_default_handler)(Int sig); +/* Hash table of PIDs from which SIGCHLD is ignored. */ +extern VgHashTable *ht_sigchld_ignore; + +/* Hash table node where each key represents a PID. */ +typedef struct _ht_ignore_node { + struct _ht_ignore_node *next; + UWord key; +} ht_ignore_node; + #endif // __PUB_CORE_SIGNALS_H /*--------------------------------------------------------------------*/ diff --git a/include/vki/vki-darwin.h b/include/vki/vki-darwin.h index dbae64bc49..5a01c3cbd9 100644 --- a/include/vki/vki-darwin.h +++ b/include/vki/vki-darwin.h @@ -525,6 +525,12 @@ typedef #define VKI_BUS_ADRERR BUS_ADRERR #define VKI_BUS_OBJERR BUS_OBJERR #define VKI_TRAP_BRKPT TRAP_BRKPT +#define VKI_CLD_EXITED CLD_EXITED +#define VKI_CLD_KILLED CLD_KILLED +#define VKI_CLD_DUMPED CLD_DUMPED +#define VKI_CLD_TRAPPED CLD_TRAPPED +#define VKI_CLD_STOPPED CLD_STOPPED +#define VKI_CLD_CONTINUED CLD_CONTINUED /* JRS: not 100% sure, but I think these two are correct */ #define VKI_SA_ONESHOT SA_RESETHAND diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index d467f017e5..f50598e093 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -609,6 +609,16 @@ typedef struct vki_siginfo { #define VKI_TRAP_DTRACE 3 /* DTrace induced trap. */ #define VKI_TRAP_CAP 4 /* Capabilities protective trap. */ +/* + * SIGCHLD si_codes + */ +#define VKI_CLD_EXITED 1 /* child has exited */ +#define VKI_CLD_KILLED 2 /* child was killed */ +#define VKI_CLD_DUMPED 3 /* child terminated abnormally */ +#define VKI_CLD_TRAPPED 4 /* traced child has trapped */ +#define VKI_CLD_STOPPED 5 /* child has stopped */ +#define VKI_CLD_CONTINUED 6 /* stopped child has continued */ + #if 0 /* freebsd-6 */ typedef struct vki_sigevent { int sigev_notify; diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index e6cef7dfff..905c3ba36e 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -576,6 +576,16 @@ typedef struct vki_siginfo { #define VKI_TRAP_BRKPT (__VKI_SI_FAULT|1) /* process breakpoint */ #define VKI_TRAP_TRACE (__VKI_SI_FAULT|2) /* process trace trap */ +/* + * SIGCHLD si_codes + */ +#define VKI_CLD_EXITED (__VKI_SI_FAULT|1) /* child has exited */ +#define VKI_CLD_KILLED (__VKI_SI_FAULT|2) /* child was killed */ +#define VKI_CLD_DUMPED (__VKI_SI_FAULT|3) /* child terminated abnormally */ +#define VKI_CLD_TRAPPED (__VKI_SI_FAULT|4) /* traced child has trapped */ +#define VKI_CLD_STOPPED (__VKI_SI_FAULT|5) /* child has stopped */ +#define VKI_CLD_CONTINUED (__VKI_SI_FAULT|6) /* stopped child has continued */ + /* * This works because the alignment is ok on all current architectures * but we leave open this being overridden in the future |
|
From: Paul F. <pa...@so...> - 2022-04-07 05:57:49
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=19584a93d15e4a0f027ccd478b0e70caaa594d05 commit 19584a93d15e4a0f027ccd478b0e70caaa594d05 Author: Paul Floyd <pj...@wa...> Date: Thu Apr 7 07:56:27 2022 +0200 Update FreeBSD [f]execve expecteds As requested by Mark, for https://bugs.kde.org/show_bug.cgi?id=450437 Diff: --- memcheck/tests/freebsd/fexecve.stderr.exp | 5 +++++ memcheck/tests/freebsd/scalar.stderr.exp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/memcheck/tests/freebsd/fexecve.stderr.exp b/memcheck/tests/freebsd/fexecve.stderr.exp index 5e49552511..5bb85f79dc 100644 --- a/memcheck/tests/freebsd/fexecve.stderr.exp +++ b/memcheck/tests/freebsd/fexecve.stderr.exp @@ -9,6 +9,11 @@ Syscall param fexecve(argv) points to uninitialised byte(s) at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (fexecve.c:17) +Syscall param fexecve(argv[0]) points to unaddressable byte(s) + at 0x........: fexecve (in /...libc...) + by 0x........: main (fexecve.c:29) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + Syscall param fexecve(envp) points to uninitialised byte(s) at 0x........: fexecve (in /...libc...) by 0x........: main (fexecve.c:29) diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 8e7f9fb145..869b48d416 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -541,6 +541,10 @@ Syscall param execve(filename) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param execve(argv) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 60: SYS_umask 1s 0m --------------------------------------------------------- |
|
From: Mark W. <ma...@so...> - 2022-04-06 22:49:55
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6a35b364c5db0f0c3edb7936de8b75c3995b0882 commit 6a35b364c5db0f0c3edb7936de8b75c3995b0882 Author: Di Chen <di...@re...> Date: Wed Mar 30 07:59:25 2022 +0800 memfd test should be memfd_create test Currently, syscall memfd_create was tested by this: $ perl tests/vg_regtest memcheck/tests/linux/memfd.vgtest Since memfd_secret introduced in kernel 5.14, valgrind should rename the "memfd" test to "memfd_create" test to avoid the ambiguity, so that user will not get confused with the "memfd_secret" test. After this change, syscall memfd_create will be tested by: $ perl tests/vg_regtest memcheck/tests/linux/memfd_create.vgtest Diff: --- .gitignore | 2 +- memcheck/tests/linux/Makefile.am | 4 ++-- memcheck/tests/linux/memfd.vgtest | 3 --- memcheck/tests/linux/{memfd.c => memfd_create.c} | 0 memcheck/tests/linux/{memfd.stderr.exp => memfd_create.stderr.exp} | 4 ++-- memcheck/tests/linux/memfd_create.vgtest | 3 +++ 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 86416f576c..5026fcbc78 100644 --- a/.gitignore +++ b/.gitignore @@ -1100,7 +1100,7 @@ /memcheck/tests/linux/lsframe2 /memcheck/tests/linux/Makefile /memcheck/tests/linux/Makefile.in -/memcheck/tests/linux/memfd +/memcheck/tests/linux/memfd_create /memcheck/tests/linux/rfcomm /memcheck/tests/linux/sigqueue /memcheck/tests/linux/stack_changes diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am index 4f0d838434..d5991dc5e5 100644 --- a/memcheck/tests/linux/Makefile.am +++ b/memcheck/tests/linux/Makefile.am @@ -15,7 +15,7 @@ EXTRA_DIST = \ ioctl-tiocsig.vgtest ioctl-tiocsig.stderr.exp \ lsframe1.vgtest lsframe1.stdout.exp lsframe1.stderr.exp \ lsframe2.vgtest lsframe2.stdout.exp lsframe2.stderr.exp \ - memfd.vgtest memfd.stderr.exp \ + memfd_create.vgtest memfd_create.stderr.exp \ rfcomm.vgtest rfcomm.stderr.exp \ sigqueue.vgtest sigqueue.stderr.exp \ stack_changes.stderr.exp stack_changes.stdout.exp \ @@ -62,7 +62,7 @@ check_PROGRAMS += sys-openat endif if HAVE_MEMFD_CREATE -check_PROGRAMS += memfd +check_PROGRAMS += memfd_create endif if HAVE_COPY_FILE_RANGE diff --git a/memcheck/tests/linux/memfd.vgtest b/memcheck/tests/linux/memfd.vgtest deleted file mode 100644 index 4096401f73..0000000000 --- a/memcheck/tests/linux/memfd.vgtest +++ /dev/null @@ -1,3 +0,0 @@ -prereq: test -e memfd -vgopts: -q --track-origins=yes -prog: memfd diff --git a/memcheck/tests/linux/memfd.c b/memcheck/tests/linux/memfd_create.c similarity index 100% rename from memcheck/tests/linux/memfd.c rename to memcheck/tests/linux/memfd_create.c diff --git a/memcheck/tests/linux/memfd.stderr.exp b/memcheck/tests/linux/memfd_create.stderr.exp similarity index 57% rename from memcheck/tests/linux/memfd.stderr.exp rename to memcheck/tests/linux/memfd_create.stderr.exp index 13009d8ae4..27ccbfe494 100644 --- a/memcheck/tests/linux/memfd.stderr.exp +++ b/memcheck/tests/linux/memfd_create.stderr.exp @@ -1,6 +1,6 @@ Syscall param fcntl(arg) contains uninitialised byte(s) ... - by 0x........: main (memfd.c:72) + by 0x........: main (memfd_create.c:72) Uninitialised value was created by a client request - at 0x........: main (memfd.c:71) + at 0x........: main (memfd_create.c:71) diff --git a/memcheck/tests/linux/memfd_create.vgtest b/memcheck/tests/linux/memfd_create.vgtest new file mode 100644 index 0000000000..13b956333e --- /dev/null +++ b/memcheck/tests/linux/memfd_create.vgtest @@ -0,0 +1,3 @@ +prereq: test -e memfd_create +vgopts: -q --track-origins=yes +prog: memfd_create |
|
From: Mark W. <ma...@kl...> - 2022-04-06 22:36:08
|
Hi, On Wed, Mar 30, 2022 at 10:00:20AM +0000, Chen Di wrote: > Sorry for the confusing post, I think my patch got formatted slightly in an odd way. > > I have also attached the patch to bug: https://bugs.kde.org/show_bug.cgi?id=451878 > Could you please review it when you are avalable? Thanks, that applied fine. And I admit having been confused by memfd_create vs memfd_secret before. I have pushed this. Hope that helps creating a separate memfd_secret. But we are very close to the 3.19.0 release. So that might have to wait till after the release. Cheers, Mark |
|
From: Mark W. <ma...@so...> - 2022-04-06 21:07:26
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8eb547054a051a00742b1b9e1b381015fafeacb9 commit 8eb547054a051a00742b1b9e1b381015fafeacb9 Author: Mark Wielaard <ma...@kl...> Date: Wed Feb 16 22:56:31 2022 +0100 Warn for execve syscall with argv or argv[0] being NULL. For execve valgrind would silently fail when argv was NULL or unadressable. Make sure that this produces a warning under memcheck. The linux kernel accepts argv[0] being NULL, but most other kernels don't since posix says it should be non-NULL and it causes argc to be zero which is unexpected and might cause security issues. This adjusts some testcases so they don't rely on execve succeeding when argv is NULL and expect warnings about argv or argv[0] being NULL or unaddressable. https://bugs.kde.org/show_bug.cgi?id=450437 Diff: --- NEWS | 1 + coregrind/m_syswrap/syswrap-generic.c | 28 ++++++++++++++------ memcheck/tests/arm64-linux/scalar.stderr.exp | 11 +++++--- memcheck/tests/execve1.c | 2 +- memcheck/tests/execve1.stderr.exp | 2 +- memcheck/tests/execve2.stderr.exp | 5 ++++ memcheck/tests/linux/sys-execveat.stderr.exp | 12 +++++++++ memcheck/tests/x86-linux/scalar.c | 4 +-- memcheck/tests/x86-linux/scalar.stderr.exp | 18 ++++++++++--- none/tests/execve.c | 38 ++++++++++++++++++++++------ 10 files changed, 94 insertions(+), 27 deletions(-) diff --git a/NEWS b/NEWS index 730f2b5ff8..924032b3c1 100644 --- a/NEWS +++ b/NEWS @@ -93,6 +93,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 449838 sigsegv liburing the 'impossible' happened for io_uring_setup 450025 Powerc: ACC file not implemented as a logical overlay of the VSR registers. +450437 Warn for execve syscall with argv or argv[0] being NULL 450536 Powerpc: valgrind throws 'facility scv unavailable exception' 451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s) 451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index bc3fa6fe9f..44a60bf128 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -2933,6 +2933,7 @@ void handle_pre_sys_execve(ThreadId tid, SyscallStatus *status, Addr pathname, Bool setuid_allowed, trace_this_child; const char *str; char str2[30], str3[30]; + Addr arg_2_check = arg_2; switch (execveType) { case EXECVE: @@ -2951,15 +2952,26 @@ void handle_pre_sys_execve(ThreadId tid, SyscallStatus *status, Addr pathname, VG_(strcpy)(str2, str); VG_(strcpy)(str3, str); - if (arg_2 != 0) { - /* At least the terminating NULL must be addressable. */ - if (!ML_(safe_to_deref)((HChar **) (Addr)arg_2, sizeof(HChar *))) { - SET_STATUS_Failure(VKI_EFAULT); - return; + VG_(strcat)(str2, "(argv)"); + VG_(strcat)(str3, "(argv[0])"); + + /* argv[] should not be NULL and valid. */ + PRE_MEM_READ(str2, arg_2_check, sizeof(Addr)); + + /* argv[0] should not be NULL and valid. */ + if (ML_(safe_to_deref)((HChar **) (Addr)arg_2_check, sizeof(HChar *))) { + Addr argv0 = *(Addr*)arg_2_check; + PRE_MEM_RASCIIZ( str3, argv0 ); + /* The rest of argv can be NULL or a valid string pointer. */ + if (VG_(am_is_valid_for_client)(arg_2_check, sizeof(HChar), VKI_PROT_READ)) { + arg_2_check += sizeof(HChar*); + str3[VG_(strlen)(str)] = '\0'; + VG_(strcat)(str3, "(argv[i])"); + ML_(pre_argv_envp)( arg_2_check, tid, str2, str3 ); } - VG_(strcat)(str2, "(argv)"); - VG_(strcat)(str3, "(argv[i])"); - ML_(pre_argv_envp)( arg_2, tid, str2, str3 ); + } else { + SET_STATUS_Failure(VKI_EFAULT); + return; } // Reset helper strings to syscall name. str2[VG_(strlen)(str)] = '\0'; diff --git a/memcheck/tests/arm64-linux/scalar.stderr.exp b/memcheck/tests/arm64-linux/scalar.stderr.exp index 66975efcb2..4c81819b64 100644 --- a/memcheck/tests/arm64-linux/scalar.stderr.exp +++ b/memcheck/tests/arm64-linux/scalar.stderr.exp @@ -75,6 +75,11 @@ Syscall param execve(filename) points to unaddressable byte(s) by 0x........: main (scalar.c:91) Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param execve(argv) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c:91) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 49: __NR_chdir 1s 1m ----------------------------------------------------- @@ -576,13 +581,13 @@ Syscall param getpriority(who) contains uninitialised byte(s) ----------------------------------------------------- 140: __NR_setpriority 3s 0m ----------------------------------------------------- + +More than 100 errors detected. Subsequent errors +will still be recorded, but in less detail than before. Syscall param setpriority(which) contains uninitialised byte(s) ... by 0x........: main (scalar.c:458) - -More than 100 errors detected. Subsequent errors -will still be recorded, but in less detail than before. Syscall param setpriority(who) contains uninitialised byte(s) ... by 0x........: main (scalar.c:458) diff --git a/memcheck/tests/execve1.c b/memcheck/tests/execve1.c index 83e058a2f3..df36f145e0 100644 --- a/memcheck/tests/execve1.c +++ b/memcheck/tests/execve1.c @@ -4,7 +4,7 @@ int main(void) { char* null_filename = NULL; char* bad[2] = { (char*)1, NULL }; - char* good[1] = { NULL }; + char* good[2] = { "true", NULL }; execve(null_filename, bad, bad); execve("/bin/true", good, good); diff --git a/memcheck/tests/execve1.stderr.exp b/memcheck/tests/execve1.stderr.exp index 37a91b83a3..eebc1e5ebd 100644 --- a/memcheck/tests/execve1.stderr.exp +++ b/memcheck/tests/execve1.stderr.exp @@ -3,7 +3,7 @@ Syscall param execve(filename) points to unaddressable byte(s) by 0x........: main (execve1.c:9) Address 0x........ is not stack'd, malloc'd or (recently) free'd -Syscall param execve(argv[i]) points to unaddressable byte(s) +Syscall param execve(argv[0]) points to unaddressable byte(s) ... by 0x........: main (execve1.c:9) Address 0x........ is not stack'd, malloc'd or (recently) free'd diff --git a/memcheck/tests/execve2.stderr.exp b/memcheck/tests/execve2.stderr.exp index cd98593f7c..f9d7c35926 100644 --- a/memcheck/tests/execve2.stderr.exp +++ b/memcheck/tests/execve2.stderr.exp @@ -3,3 +3,8 @@ Syscall param execve(filename) points to unaddressable byte(s) by 0x........: main (execve2.c:9) Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param execve(argv) points to unaddressable byte(s) + ... + by 0x........: main (execve2.c:9) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + diff --git a/memcheck/tests/linux/sys-execveat.stderr.exp b/memcheck/tests/linux/sys-execveat.stderr.exp index a58b0fb6ae..b49b9be981 100644 --- a/memcheck/tests/linux/sys-execveat.stderr.exp +++ b/memcheck/tests/linux/sys-execveat.stderr.exp @@ -17,3 +17,15 @@ Syscall param execveat(argv) points to uninitialised byte(s) at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (sys-execveat.c:41) +Syscall param execveat(argv[0]) points to unaddressable byte(s) + ... + by 0x........: sys_execveat (sys-execveat.c:16) + by 0x........: main (sys-execveat.c:51) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param execveat(argv) points to unaddressable byte(s) + ... + by 0x........: sys_execveat (sys-execveat.c:16) + by 0x........: main (sys-execveat.c:52) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c index 52f0d4e353..54d0e0443a 100644 --- a/memcheck/tests/x86-linux/scalar.c +++ b/memcheck/tests/x86-linux/scalar.c @@ -95,9 +95,9 @@ int main(void) char *argv_envp[] = {(char *) (x0 + 1), NULL}; GO(__NR_execve, "4s 2m"); SY(__NR_execve, x0 + 1, x0 + argv_envp, x0); FAIL; - + char *argv_ok[] = {"frob", NULL}; GO(__NR_execve, "4s 2m"); - SY(__NR_execve, x0 + 1, x0, x0 + argv_envp); FAIL; + SY(__NR_execve, x0 + 1, x0 + argv_ok, x0 + argv_envp); FAIL; // __NR_chdir 12 GO(__NR_chdir, "1s 1m"); diff --git a/memcheck/tests/x86-linux/scalar.stderr.exp b/memcheck/tests/x86-linux/scalar.stderr.exp index 470023f0e0..b9202a8c2f 100644 --- a/memcheck/tests/x86-linux/scalar.stderr.exp +++ b/memcheck/tests/x86-linux/scalar.stderr.exp @@ -170,6 +170,11 @@ Syscall param execve(filename) points to unaddressable byte(s) by 0x........: main (scalar.c:90) Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param execve(argv) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c:90) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 11: __NR_execve 3s 1m ----------------------------------------------------- @@ -190,6 +195,11 @@ Syscall param execve(filename) points to unaddressable byte(s) by 0x........: main (scalar.c:93) Address 0x........ is not stack'd, malloc'd or (recently) free'd +Syscall param execve(argv) points to unaddressable byte(s) + ... + by 0x........: main (scalar.c:93) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + ----------------------------------------------------- 11: __NR_execve 4s 2m ----------------------------------------------------- @@ -216,7 +226,7 @@ Syscall param execve(argv) points to uninitialised byte(s) Address 0x........ is on thread 1's stack in frame #1, created by main (scalar.c:29) -Syscall param execve(argv[i]) points to unaddressable byte(s) +Syscall param execve(argv[0]) points to unaddressable byte(s) ... by 0x........: main (scalar.c:97) Address 0x........ is not stack'd, malloc'd or (recently) free'd @@ -564,6 +574,9 @@ Syscall param pipe(filedes) contains uninitialised byte(s) ... by 0x........: main (scalar.c:225) + +More than 100 errors detected. Subsequent errors +will still be recorded, but in less detail than before. Syscall param pipe(filedes) points to unaddressable byte(s) ... by 0x........: main (scalar.c:225) @@ -576,9 +589,6 @@ Syscall param times(buf) contains uninitialised byte(s) ... by 0x........: main (scalar.c:229) - -More than 100 errors detected. Subsequent errors -will still be recorded, but in less detail than before. Syscall param times(buf) points to unaddressable byte(s) ... by 0x........: main (scalar.c:229) diff --git a/none/tests/execve.c b/none/tests/execve.c index 950842da29..a1af72fd9e 100644 --- a/none/tests/execve.c +++ b/none/tests/execve.c @@ -7,20 +7,42 @@ int main(int argc, char **argv) if (argc == 1) { // This tests the case where argv and envp are NULL, which is easy to - // get wrong because it's an unusual case. + // get wrong because it's an unusual case. It is also bad and only + // "worked" by accident with the linux kernel. -#if defined(VGO_solaris) - // Solaris requires non-NULL argv parameter char *const argv_exe[] = {"true", NULL}; - if (execve("/bin/true", argv_exe, NULL) < 0) + char *const v_null[] = { NULL }; + char *const v_minus_one[] = { (char *const) -1, NULL }; + +#if defined(VGO_solaris) + const char *exe = "/bin/true"; #elif defined(VGO_darwin) - if (execve("/usr/bin/true", NULL, NULL) < 0) + const char *exe = "/usr/bin/true"; #elif defined(VGO_freebsd) - char *const argv_exe[] = {"true", NULL}; - if (execve("/usr/bin/true", argv_exe, NULL) < 0) + const char *exe = "/usr/bin/true"; #else - if (execve("/bin/true", NULL, NULL) < 0) + const char *exe = "/bin/true"; #endif + + /* Try some bad argv and envp arguments, make sure the executable + doesn't actually exists, so execve doesn't accidentally succeeds. */ + if (execve("/%/", NULL, NULL) >= 0) + printf ("WHAT?"); + if (execve("/%/", (void *)-1, NULL) >= 0) + printf ("WHAT?"); + if (execve("/%/", v_null, NULL) >= 0) + printf ("WHAT?"); + if (execve("/%/", v_null, v_null) >= 0) + printf ("WHAT?"); + if (execve("/%/", v_minus_one, NULL) >= 0) + printf ("WHAT?"); + if (execve("/%/", v_minus_one, v_null) >= 0) + printf ("WHAT?"); + if (execve("/%/", v_minus_one, v_minus_one) >= 0) + printf ("WHAT?"); + + /* Finally a correct execve. */ + if (execve(exe, argv_exe, NULL) < 0) { perror("execve"); exit(1); |
|
From: Paul F. <pa...@so...> - 2022-04-06 18:54:36
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f540c79937c6348d3cb5508f83fee0c9def73d11 commit f540c79937c6348d3cb5508f83fee0c9def73d11 Author: Paul Floyd <pj...@wa...> Date: Wed Apr 6 20:51:54 2022 +0200 Missed macro when adding FreeBSD 13.1 Also add the names of some new FreeBSD 14 syscalls (not yet inplemented in Valgrind). Diff: --- coregrind/m_stacktrace.c | 2 +- coregrind/m_syswrap/syswrap-freebsd.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index 4c45b97b9f..308bebdd86 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -594,7 +594,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known, VG_(printf)(" ipsS[%d]=%#08lx rbp %#08lx rsp %#08lx\n", i-1, ips[i-1], uregs.xbp, uregs.xsp); -# if defined(VGO_darwin) || (defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13)) +# if defined(VGO_darwin) || (defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13_0)) if (VG_(is_valid_tid)(tid_if_known) && VG_(is_in_syscall)(tid_if_known) && i < max_n_ips) { diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 6088d89d70..fcbd11fbbb 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3856,6 +3856,7 @@ POST(sys_swapcontext) POST_MEM_WRITE( ARG1, sizeof(struct vki_ucontext) ); } +// @todo PJF In FreeBSD 14 and onwards this is SYS_freebsd13_swapoff // SYS_swapoff 424 // int swapoff(const char *special); PRE(sys_swapoff) @@ -6245,7 +6246,7 @@ PRE(sys___specialfd) PRE_MEM_READ("__specialfd(req)", (Addr)ARG2, ARG3); } -#endif // (FREEBSD_VERS >= FREEBSD_13) +#endif // (FREEBSD_VERS >= FREEBSD_13_0) #undef PRE #undef POST @@ -6956,6 +6957,12 @@ const SyscallTableEntry ML_(syscall_table)[] = { // unimpl __NR_aio_readv 579 #endif +#if (FREEBSD_VERS >= FREEBSD_14) + // unimpl __NR_fspacectl 580 + // unimpl __NR_sched_getcpu 581 + // unimpl __NR_swapoff 582 +#endif + BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn }; |
|
From: zgx1119 <zg...@gm...> - 2022-04-06 08:48:50
|
Below is my add code for my platform:
static Bool VG_(parse_cpuinfo)(void) {
..............
const char *search_Taroko_str = "cpu model\t\t: Taroko";
.................
else if (VG_(strstr)(file_buf, search_MIPS_str) != NULL ||
VG_(strstr)(file_buf, search_Taroko_str) != NULL)
vai.hwcaps = VEX_PRID_COMP_MIPS;
.......
}
Then run: [# valgrind --run-libc-freeres=no
--suppressions=/lib/valgrind/default.supp ./a
.out
machine_get_hwcaps============================machine_get_hwcaps============================1
machine_get_hwcaps============================3
==4512== Memcheck, a memory error detector
==4512== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==4512== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==4512== Command: ./a.out
==4512==
vex mips->IR: unhandled instruction bytes: 0x0 0x40 0x63 0x40
==4512== valgrind: Unrecognised instruction at address 0x4897284.
==4512== at 0x4897284: ??? (in /usr/lib/libuClibc-1.0.31.so)
==4512== by 0x487C704: ??? (in /usr/lib/libuClibc-1.0.31.so)
==4512== Your program just tried to execute an instruction that Valgrind
==4512== did not recognise. There are two possible reasons for this.
==4512== 1. Your program has a bug and erroneously jumped to a non-code
==4512== location. If you are running Memcheck and you just saw a
==4512== warning about a bad jump, it's probably your program's fault.
==4512== 2. The instruction is legitimate but Valgrind doesn't handle it,
==4512== i.e. it's Valgrind's fault. If you think this is the case or
==4512== you are not sure, please let us know and we'll try to fix it.
==4512== Either way, Valgrind will now raise a SIGILL signal which will
==4512== probably kill your program.
==4512==
==4512== Process terminating with default action of signal 4 (SIGILL)
==4512== Illegal opcode at address 0x4897284
==4512== at 0x4897284: ??? (in /usr/lib/libuClibc-1.0.31.so)
==4512== by 0x487C704: ??? (in /usr/lib/libuClibc-1.0.31.so)
==4512==
==4512== HEAP SUMMARY:
==4512== in use at exit: 0 bytes in 0 blocks
==4512== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==4512==
==4512== All heap blocks were freed -- no leaks are possible
==4512==
==4512== For lists of detected and suppressed errors, rerun with: -s
==4512== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction
Below is our platform cpu info:
# cat /proc/cpuinfo
system type : Realtek RTS39XX
machine : RTS3916 EVB
processor : 0
cpu model : Taroko V0.2 FPU V0.1
BogoMIPS : 798.72
wait instruction : yes
microsecond timers : yes
tlb_entries : 64
extra interrupt vector : no
hardware watchpoint : no
isa : mips1
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
|
|
From: Carl L. <ce...@us...> - 2022-04-05 01:53:24
|
Mark:
On Mon, 2022-04-04 at 09:56 -0700, Carl Love wrote:
>
<snip>
>
> I ran the RC1 on Power 8 RHEL7.8, gcc (GCC) 4.8.5 20150623 (Red Hat
> 4.8.5-39) with the following results:
>
> == 708 tests, 5 stderr failures, 1 stdout failure, 0 stderrB
> failures,
> 2 stdoutB failures, 1 post failure ==
> gdbserver_tests/nlgone_abrt (stdoutB)
> gdbserver_tests/nlpasssigalrm (stdoutB)
> memcheck/tests/bug340392 (stderr)
> memcheck/tests/leak_cpp_interior (stderr)
> drd/tests/pth_mutex_signal (stderr)
> drd/tests/std_mutex (stderr)
> drd/tests/timed_mutex (stderr)
> none/tests/ppc32/jm_vec_isa_2_07 (stdout)
>
> The jm_vec_isa_2_07 failures is due to a couple of the vpermq tests
> failing. Looks like I didn't run the regression test for the vpermq
> tests on Power 8 BE. I will take a look at these failures today.
I have updated the bugzilla 451827 for the vbpermq re-write with a fix
for the Powerpc 32-bit mode. The fix was retested on all platforms.
No additional regression issues were seen. The Power 8 BE tests now
pass as expected.
== 708 tests, 5 stderr failures, 0 stdout failures, 0 stderrB failures,
2 stdoutB failures, 1 post failure ==
gdbserver_tests/nlgone_abrt (stdoutB)
gdbserver_tests/nlpasssigalrm (stdoutB)
memcheck/tests/bug340392 (stderr)
memcheck/tests/leak_cpp_interior (stderr)
drd/tests/pth_mutex_signal (stderr)
drd/tests/std_mutex (stderr)
drd/tests/timed_mutex (stderr)
I think we are good to go on Power.
Carl Love
|
|
From: Carl L. <ca...@so...> - 2022-04-05 01:46:23
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=bc4dc04d5f23e363a79bade6dee475e9c2287c93 commit bc4dc04d5f23e363a79bade6dee475e9c2287c93 Author: Carl Love <ce...@us...> Date: Mon Apr 4 21:31:33 2022 -0400 Powerpc 32bit, fix the vbpermq support Passing the two 128-bit vA and vB arguments doesn't work in 32-bit mode. The clean helper was changed to compute the result for 8 indexes. The helper is then called twice to get the result for the upper 64-bits of the vB register and the lower 64-bits of the vB register. The patch is an additional fix for bugzilla 451827. Diff: --- VEX/priv/guest_ppc_defs.h | 3 +-- VEX/priv/guest_ppc_helpers.c | 12 ++++-------- VEX/priv/guest_ppc_toIR.c | 30 +++++++++++++++++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h index e79b86cd76..220fbf1395 100644 --- a/VEX/priv/guest_ppc_defs.h +++ b/VEX/priv/guest_ppc_defs.h @@ -164,8 +164,7 @@ extern UInt count_bits_under_mask_helper( ULong src, ULong mask, UInt flag ); extern ULong deposit_bits_under_mask_helper( ULong src, ULong mask ); extern ULong population_count64_helper( ULong src ); -extern ULong vbpermq_clean_helper( ULong vA_high, ULong vA_low, - ULong vB_high, ULong vB_low ); +extern UInt vbpermq_clean_helper( ULong vA_high, ULong vA_low, ULong vB); extern ULong vector_evaluate64_helper( ULong srcA, ULong srcB, ULong srcC, ULong IMM ); void write_ACC_entry (VexGuestPPC64State* gst, UInt offset, UInt acc, diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c index a6f63f5d26..2914667514 100644 --- a/VEX/priv/guest_ppc_helpers.c +++ b/VEX/priv/guest_ppc_helpers.c @@ -704,17 +704,13 @@ ULong vector_evaluate64_helper( ULong srcA, ULong srcB, ULong srcC, /*---------------------------------------------------------------*/ /* --- Clean helper for vbpermq instruction ---*/ /*---------------------------------------------------------------*/ -ULong vbpermq_clean_helper( ULong vA_high, ULong vA_low, - ULong vB_high, ULong vB_low) { +UInt vbpermq_clean_helper( ULong vA_high, ULong vA_low, ULong vB) { ULong bit, result = 0x0; UInt i, index; /* IBM numbering bit 0 on is MSB, bit 63 is LSB */ - for ( i = 0; i < 16; i++) { - if (i < 8) - index = 0xFFULL & (vB_high >> (56 - 8*i) ); - else - index = 0xFFULL & (vB_low >> (56 - 8*(i-8))); + for ( i = 0; i < 8; i++) { + index = 0xFFULL & (vB >> (56 - 8*i) ); if (index < 64) { bit = 0x1 & (vA_high >> (63 - index)); @@ -725,7 +721,7 @@ ULong vbpermq_clean_helper( ULong vA_high, ULong vA_low, } else bit = 0; - result |= bit << (15 - i); + result |= bit << (7 - i); } return result; } diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c index 94bf798726..3f813358ae 100644 --- a/VEX/priv/guest_ppc_toIR.c +++ b/VEX/priv/guest_ppc_toIR.c @@ -31830,22 +31830,42 @@ static Bool dis_av_quad ( UInt prefix, UInt theInstr, const VexAbiInfo* vbi ) { /* The original supports was done with Iops but it caused the internal temorary storage to be exhausted if there were three or more vbpermq - instructions in a row. Changed to a clean helper on 3/24/2022 */ + instructions in a row. Changed to a clean helper on 3/24/2022. For + Powerpc 32-bit support, passing two 128-bit arguments doesn't work. + Hence, the helper is called twice to calculate the result for the + upper and lower 64-bit vB register indicies. */ IRTemp res_hi = newTemp( Ity_I64 ); + IRTemp res_0 = newTemp( Ity_I32 ); + IRTemp res_1 = newTemp( Ity_I32 ); IRExpr * res_low = mkU64(0); - assign( res_hi, - mkIRExprCCall( Ity_I64, 0 /*regparms*/, + assign( res_0, + mkIRExprCCall( Ity_I32, 0 /*regparms*/, "vbpermq_clean_helper", fnptr_to_fnentry( vbi, &vbpermq_clean_helper ), - mkIRExprVec_4( unop( Iop_V128HIto64, + mkIRExprVec_3( unop( Iop_V128HIto64, mkexpr(vA) ), unop( Iop_V128to64, mkexpr(vA) ), unop( Iop_V128HIto64, - mkexpr(vB) ), + mkexpr(vB) ) ) ) ); + assign( res_1, + mkIRExprCCall( Ity_I32, 0 /*regparms*/, + "vbpermq_clean_helper", + fnptr_to_fnentry( vbi, + &vbpermq_clean_helper ), + mkIRExprVec_3( unop( Iop_V128HIto64, + mkexpr(vA) ), + unop( Iop_V128to64, + mkexpr(vA) ), unop( Iop_V128to64, mkexpr(vB) ) ) ) ); + assign( res_hi, binop( Iop_32HLto64, + mkU32( 0 ), + binop( Iop_Or32, + binop( Iop_Shl32, mkexpr( res_0 ), + mkU8( 8 ) ), + mkexpr( res_1 ) ) ) ); putVReg( vRT_addr, binop( Iop_64HLtoV128, mkexpr( res_hi ), res_low ) ); return True; |
|
From: Carl L. <ce...@us...> - 2022-04-04 16:57:07
|
Mark:
Here is the results of running the Valgrind-3.19.0 RC1 candidate on
various Power systems.
On Sat, 2022-04-02 at 21:51 +0200, Mark Wielaard wrote:
> Hi valgrind hackers,
>
> An RC1 tarball for 3.19.0 is now available at
>
>
<snip>
> On all architectures there are two drd failures which are unexplained
> for now. ppc64le has a couple of failures where the aspace manager
> crashes with:
>
> --492941:0: aspacem segment mismatch: V's seg 1st, kernel's 2nd:
> --492941:0: aspacem 1: file 0004000000-000400ffff 65536 r----
> SmFixed d=0x........ i=8463 o=0 (2,89) /usr/lib64/ld64.so.2
> --492941:0: aspacem ...: .... 0004000000-000400ffff 65536 r--..
> ....... d=0x........ i=8463 o=0 (.) m=. /usr/lib64/ld64.so.2
> --492941:0: aspacem sync check at m_aspacemgr/aspacemgr-linux.c:2142
> (vgPlain_am_get_advisory): FAILED
> --492941:0: aspacem
> --492941:0: aspacem Valgrind: FATAL: aspacem assertion failed:
> --492941:0: aspacem VG_(am_do_sync_check)
> (__PRETTY_FUNCTION__,__FILE__,__LINE__)
> --492941:0: aspacem at m_aspacemgr/aspacemgr-linux.c:2142
> (vgPlain_am_get_advisory)
> --492941:0: aspacem Exiting now.
>
> I think this comes from the new kernel, since it is an rc kernel
> maybe
> it is an kernel issue. I'll try to retest with a 5.17.0 final kernel.
>
<snip>
> ppc64le
> == 672 tests, 10 stderr failures, 4 stdout failures, 1 stderrB
> failure, 0 stdoutB failures, 2 post failures ==
> gdbserver_tests/hginfo (stderrB)
> memcheck/tests/bug340392 (stderr)
> memcheck/tests/linux/rfcomm (stderr)
> helgrind/tests/tls_threads (stderr)
> drd/tests/pth_barrier_thr_cr (stderr)
> drd/tests/pth_mutex_signal (stderr)
> drd/tests/shared_timed_mutex (stderr)
> massif/tests/new-cpp (post)
> massif/tests/overloaded-new (post)
> none/tests/bigcode (stdout)
> none/tests/bigcode (stderr)
> none/tests/map_unmap (stdout)
> none/tests/map_unmap (stderr)
> none/tests/sigstackgrowth (stdout)
> none/tests/sigstackgrowth (stderr)
> none/tests/stackgrowth (stdout)
> none/tests/stackgrowth (stderr)
I ran the RC1 on Power 10LE Ubuntu 21.04, gcc (Ubuntu 11.2.0-7ubuntu2)
with the following results,11.2.0:
== 680 tests, 9 stderr failures, 0 stdout failures, 1 stderrB failure,
1 stdoutB failure, 3 post failures ==
gdbserver_tests/hginfo (stderrB)
gdbserver_tests/mcsignopass (stderr)
gdbserver_tests/mcsigpass (stderr)
gdbserver_tests/nlcontrolc (stdoutB)
memcheck/tests/bug340392 (stderr)
memcheck/tests/linux/rfcomm (stderr)
memcheck/tests/linux/sys-execveat (stderr)
helgrind/tests/tls_threads (stderr)
drd/tests/pth_mutex_signal (stderr)
drd/tests/shared_timed_mutex (stderr)
massif/tests/new-cpp (post)
massif/tests/overloaded-new (post)
none/tests/faultstatus (stderr)
I ran the RC1 on Power 10LE RHEL 9 (Pre-release build), gcc (GCC)
11.2.1 20220127 (Red Hat 11.2.1-9) with the following results:
== 679 tests, 5 stderr failures, 0 stdout failures, 3 stderrB failures,
18 stdo\
utB failures, 3 post failures ==
gdbserver_tests/hginfo (stdoutB)
gdbserver_tests/hginfo (stderrB)
gdbserver_tests/hgtls (stdoutB)
gdbserver_tests/mcblocklistsearch (stderrB)
gdbserver_tests/mcbreak (stdoutB)
gdbserver_tests/mcclean_after_fork (stdoutB)
gdbserver_tests/mcinfcallWSRU (stderrB)
gdbserver_tests/mcleak (stdoutB)
gdbserver_tests/mcmain_pic (stdoutB)
gdbserver_tests/mcsignopass (stdoutB)
gdbserver_tests/mcsigpass (stdoutB)
gdbserver_tests/mcvabits (stdoutB)
gdbserver_tests/mcwatchpoints (stdoutB)
gdbserver_tests/mssnapshot (stdoutB)
gdbserver_tests/nlcontrolc (stdoutB)
gdbserver_tests/nlgone_abrt (stdoutB)
gdbserver_tests/nlgone_exit (stdoutB)
gdbserver_tests/nlgone_return (stdoutB)
gdbserver_tests/nlpasssigalrm (stdoutB)
gdbserver_tests/nlsigvgdb (stdoutB)
gdbserver_tests/nlvgdbsigqueue (stdoutB)
memcheck/tests/bug340392 (stderr)
memcheck/tests/linux/rfcomm (stderr)
helgrind/tests/tls_threads (stderr)
drd/tests/pth_mutex_signal (stderr)
drd/tests/shared_timed_mutex (stderr)
massif/tests/new-cpp (post)
massif/tests/overloaded-new (post)
I am guessing there may be a bit of a mismatch on the gdbserver given
that it is a pre-release. Can't prove that, but I have seen gdbserver
issues in the past when everything is not in sync.
I ran the RC1 on Power 9 LE Ubuntu 20.04, gcc (Ubuntu 9.3.0-
17ubuntu1~20.04) 9.3.0 with the following results:
= 671 tests, 6 stderr failures, 0 stdout failures, 0 stderrB failures,
1 stdoutB failure, 3 post failures ==
gdbserver_tests/nlcontrolc (stdoutB)
memcheck/tests/bug340392 (stderr)
memcheck/tests/leak_cpp_interior (stderr)
memcheck/tests/linux/rfcomm (stderr)
memcheck/tests/linux/sys-execveat (stderr)
drd/tests/pth_mutex_signal (stderr)
drd/tests/shared_timed_mutex (stderr)
massif/tests/new-cpp (post)
massif/tests/overloaded-new (post)
I ran the RC1 on Power 8 LE Ubuntu 20.04, gcc (Ubuntu 9.4.0-
1ubuntu1~20.04) 9.4.0 with the following results:
== 667 tests, 6 stderr failures, 0 stdout failures, 0 stderrB failures,
1 stdoutB failure, 3 post failures ==
gdbserver_tests/nlcontrolc (stdoutB)
memcheck/tests/bug340392 (stderr)
memcheck/tests/leak_cpp_interior (stderr)
memcheck/tests/linux/rfcomm (stderr)
memcheck/tests/linux/sys-execveat (stderr)
drd/tests/pth_mutex_signal (stderr)
drd/tests/shared_timed_mutex (stderr)
massif/tests/new-cpp (post)
massif/tests/overloaded-new (post)
I ran the RC1 on Power 8 RHEL7.8, gcc (GCC) 4.8.5 20150623 (Red Hat
4.8.5-39) with the following results:
== 708 tests, 5 stderr failures, 1 stdout failure, 0 stderrB failures,
2 stdoutB failures, 1 post failure ==
gdbserver_tests/nlgone_abrt (stdoutB)
gdbserver_tests/nlpasssigalrm (stdoutB)
memcheck/tests/bug340392 (stderr)
memcheck/tests/leak_cpp_interior (stderr)
drd/tests/pth_mutex_signal (stderr)
drd/tests/std_mutex (stderr)
drd/tests/timed_mutex (stderr)
none/tests/ppc32/jm_vec_isa_2_07 (stdout)
The jm_vec_isa_2_07 failures is due to a couple of the vpermq tests
failing. Looks like I didn't run the regression test for the vpermq
tests on Power 8 BE. I will take a look at these failures today.
Other than that, I don't see anything of concern with regards to
Powerpc for the release.
Carl Love
|
|
From: Paul F. <pa...@so...> - 2022-04-04 05:54:41
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=615731617bc7478ecfaa756cc861321e5fc3659b commit 615731617bc7478ecfaa756cc861321e5fc3659b Author: Paul Floyd <pj...@wa...> Date: Mon Apr 4 07:52:45 2022 +0200 Add missing bugzilla items and some more FreeBSD/DRD/Helgrind news Diff: --- NEWS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 23caf25025..730f2b5ff8 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ AMD64/macOS 10.13 and nanoMIPS/Linux. * Fix Rust v0 name demangling. * The Linux rseq syscall is now implemented as (silently) returning ENOSYS. * Add FreeBSD syscall wrappers for __specialfd and __realpathat. +* Remove FreeBSD dependencies on COMPAT10, which fixes compatibility with HardenedBSD * ================== PLATFORM CHANGES ================= @@ -43,6 +44,9 @@ AMD64/macOS 10.13 and nanoMIPS/Linux. * Memcheck: - Speed up --track-origins=yes for large (in the range of hundreds to thousands of megabytes) mmap/munmaps. +* DRD/Helgrind: + - Several fixes for new versions of libstd++ using new posix try_lock + functions * ==================== FIXED BUGS ==================== @@ -53,6 +57,8 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +403802 leak_cpp_interior fails with some reachable blocks different than expected +435732 memcheck/tests/leak_cpp_interior fails with gcc11 444242 s390x: Valgrind crashes on EXRL with negative offset 444399 arm64: unhandled instruction 0xC87F2D89 (LD{,A}XP and ST{,L}XP). == 434283 @@ -62,17 +68,22 @@ are not entered into bugzilla tend to get forgotten about or ignored. 444571 PPC, fix the lxsibzx and lxsihzx so they only load their respective sized data. 444836 PPC, pstq instruction for R=1 is not storing to the correct address. +444925 fexecve syscall wrapper not properly implemented 445032 valgrind/memcheck crash with SIGSEGV when SIGVTALRM timer used and libthr.so associated 445300 [PATCH] Fix building tests with Musl 445354 arm64 backend: incorrect code emitted for doubleword CAS 445415 arm64 front end: alignment checks missing for atomic instructions +445504 Using C++ condition_variable results in bogus "mutex is locked simultaneously by two threads" warning +445607 Unhandled amd64-freebsd syscall: 247 445668 Inline stack frame generation is broken for Rust binaries 445916 Demangle Rust v0 symbols with .llvm suffix 446139 DRD/Helgrind with std::shared_timed_mutex::try_lock_until and try_lock_shared_until false positives 446138 DRD/Helgrind with std::timed_mutex::try_lock_until false positives 446281 Add a DRD suppression for fwrite 446103 Memcheck: `--track-origins=yes` causes extreme slowdowns for large mmap/munmap +446139 DRD/Helgrind with std::shared_timed_mutex::try_lock_until and try_lock_shared_until false +446251 TARGET_SIGNAL_THR added to enum target_signal 446823 FreeBSD - missing syscalls when using libzm4 447991 s390x: Valgrind indicates illegal instruction on wflrx 447995 Valgrind segfault on power10 due to hwcap checking code |
|
From: Paul F. <pa...@so...> - 2022-04-03 20:29:41
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4dd849e4eca28467c92eb523a8d001a8d06ee74e commit 4dd849e4eca28467c92eb523a8d001a8d06ee74e Author: Paul Floyd <pj...@wa...> Date: Sun Apr 3 22:28:26 2022 +0200 Second go at memcheck/tests/freebsd/relapathat Missed adding the argument to the C file Needs more filtering Diff: --- memcheck/tests/freebsd/filter_realpathat | 4 +++- memcheck/tests/freebsd/realpathat.c | 2 +- memcheck/tests/freebsd/realpathat.stderr.exp | 16 ++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/memcheck/tests/freebsd/filter_realpathat b/memcheck/tests/freebsd/filter_realpathat index 82b21841dd..599a35cb38 100755 --- a/memcheck/tests/freebsd/filter_realpathat +++ b/memcheck/tests/freebsd/filter_realpathat @@ -1,6 +1,8 @@ #! /bin/sh -gsed 's/Invalid write of size 8/Invalid write of size .../' | +gsed 's/Invalid write of size 8/Invalid write of size 4/' | +gsed 's/is [4-9][0-9] bytes inside a block of size 100 free/is ... bytes inside a block of size 100 free/' | + ../filter_stderr "$@" diff --git a/memcheck/tests/freebsd/realpathat.c b/memcheck/tests/freebsd/realpathat.c index d7a84240b0..05a20cb924 100644 --- a/memcheck/tests/freebsd/realpathat.c +++ b/memcheck/tests/freebsd/realpathat.c @@ -19,7 +19,7 @@ int main(void) *bad_int1 = AT_FDCWD; *bad_int2 = 0; *bad_sz = PATH_MAX; - syscall(SYS___realpathat, *bad_int1, self_path, buf, *bad_int2); + syscall(SYS___realpathat, *bad_int1, self_path, buf, *bad_sz, *bad_int2); free(bad_int1); free(bad_int2); diff --git a/memcheck/tests/freebsd/realpathat.stderr.exp b/memcheck/tests/freebsd/realpathat.stderr.exp index 3d6647e3ae..e299abcba8 100644 --- a/memcheck/tests/freebsd/realpathat.stderr.exp +++ b/memcheck/tests/freebsd/realpathat.stderr.exp @@ -10,7 +10,7 @@ Invalid write of size 4 at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:17) -Invalid write of size ... +Invalid write of size 4 at 0x........: main (realpathat.c:21) Address 0x........ is 0 bytes inside a block of size 1 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) @@ -24,6 +24,10 @@ Syscall param __realpathat(size) contains uninitialised byte(s) ... by 0x........: main (realpathat.c:22) +Syscall param __realpathat(flags) contains uninitialised byte(s) + ... + by 0x........: main (realpathat.c:22) + Invalid read of size 1 ... by 0x........: main (realpathat.c:32) @@ -116,7 +120,7 @@ Invalid read of size 1 Invalid write of size 2 ... by 0x........: main (realpathat.c:32) - Address 0x........ is 55 bytes inside a block of size 100 free'd + Address 0x........ is ... bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:29) Block was alloc'd at @@ -127,7 +131,7 @@ Invalid read of size 1 at 0x........: strlcat (vg_replace_strmem.c:...) ... by 0x........: main (realpathat.c:32) - Address 0x........ is 56 bytes inside a block of size 100 free'd + Address 0x........ is ... bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:29) Block was alloc'd at @@ -138,7 +142,7 @@ Invalid write of size 1 at 0x........: strlcat (vg_replace_strmem.c:...) ... by 0x........: main (realpathat.c:32) - Address 0x........ is 56 bytes inside a block of size 100 free'd + Address 0x........ is ... bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:29) Block was alloc'd at @@ -149,7 +153,7 @@ Invalid write of size 1 at 0x........: strlcat (vg_replace_strmem.c:...) ... by 0x........: main (realpathat.c:32) - Address 0x........ is 66 bytes inside a block of size 100 free'd + Address 0x........ is ... bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:29) Block was alloc'd at @@ -159,7 +163,7 @@ Invalid write of size 1 Syscall param fstatat(path) points to unaddressable byte(s) ... by 0x........: main (realpathat.c:32) - Address 0x........ is 56 bytes inside a block of size 100 free'd + Address 0x........ is ... bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:29) Block was alloc'd at |
|
From: Paul F. <pa...@so...> - 2022-04-03 20:02:43
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e816f4c44f8556a8e3a64ce972e46acf62d5f89d commit e816f4c44f8556a8e3a64ce972e46acf62d5f89d Author: Paul Floyd <pj...@wa...> Date: Sun Apr 3 22:00:09 2022 +0200 Fixes for memcheck/tests/freebsd/realpathat The syscall to realpathat was missing the buffer size argument. By luck, no problem on amd64 but this failed on x86. This adds the argument and a filter for the errors (size_t can be 4 or 8 bytes) Diff: --- memcheck/tests/freebsd/Makefile.am | 2 +- memcheck/tests/freebsd/filter_realpathat | 7 +++ memcheck/tests/freebsd/realpathat.c | 2 + memcheck/tests/freebsd/realpathat.stderr.exp | 92 +++++++++++++++------------- memcheck/tests/freebsd/realpathat.vgtest | 1 + 5 files changed, 60 insertions(+), 44 deletions(-) diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 66d1022753..f70e822a41 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr filter_pts dump_stdout filter_sigwait \ - filter_scalar + filter_scalar filter_realpathat EXTRA_DIST = \ scalar.h \ diff --git a/memcheck/tests/freebsd/filter_realpathat b/memcheck/tests/freebsd/filter_realpathat new file mode 100755 index 0000000000..82b21841dd --- /dev/null +++ b/memcheck/tests/freebsd/filter_realpathat @@ -0,0 +1,7 @@ +#! /bin/sh + +gsed 's/Invalid write of size 8/Invalid write of size .../' | + +../filter_stderr "$@" + +exit 0 diff --git a/memcheck/tests/freebsd/realpathat.c b/memcheck/tests/freebsd/realpathat.c index 218fd75cb2..d7a84240b0 100644 --- a/memcheck/tests/freebsd/realpathat.c +++ b/memcheck/tests/freebsd/realpathat.c @@ -15,8 +15,10 @@ int main(void) // bad int * bad_int1 = malloc(sizeof(char)); int * bad_int2 = malloc(sizeof(char)); + size_t * bad_sz = malloc(sizeof(char)); *bad_int1 = AT_FDCWD; *bad_int2 = 0; + *bad_sz = PATH_MAX; syscall(SYS___realpathat, *bad_int1, self_path, buf, *bad_int2); free(bad_int1); free(bad_int2); diff --git a/memcheck/tests/freebsd/realpathat.stderr.exp b/memcheck/tests/freebsd/realpathat.stderr.exp index 575f1e6a98..3d6647e3ae 100644 --- a/memcheck/tests/freebsd/realpathat.stderr.exp +++ b/memcheck/tests/freebsd/realpathat.stderr.exp @@ -1,162 +1,168 @@ Invalid write of size 4 - at 0x........: main (realpathat.c:18) + at 0x........: main (realpathat.c:19) Address 0x........ is 0 bytes inside a block of size 1 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:16) Invalid write of size 4 - at 0x........: main (realpathat.c:19) + at 0x........: main (realpathat.c:20) Address 0x........ is 0 bytes inside a block of size 1 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (realpathat.c:17) +Invalid write of size ... + at 0x........: main (realpathat.c:21) + Address 0x........ is 0 bytes inside a block of size 1 alloc'd + at 0x........: malloc (vg_replace_malloc.c:...) + by 0x........: main (realpathat.c:18) + Syscall param __realpathat(fd) contains uninitialised byte(s) ... - by 0x........: main (realpathat.c:20) + by 0x........: main (realpathat.c:22) Syscall param __realpathat(size) contains uninitialised byte(s) ... - by 0x........: main (realpathat.c:20) + by 0x........: main (realpathat.c:22) Invalid read of size 1 ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 0 bytes inside a block of size 31 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:28) + by 0x........: main (realpathat.c:30) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) ... - by 0x........: main (realpathat.c:26) + by 0x........: main (realpathat.c:28) Syscall param __realpathat(path) points to unaddressable byte(s) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 0 bytes inside a block of size 31 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:28) + by 0x........: main (realpathat.c:30) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) ... - by 0x........: main (realpathat.c:26) + by 0x........: main (realpathat.c:28) Syscall param __realpathat(buf) points to unaddressable byte(s) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 0 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) Invalid read of size 1 ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 0 bytes inside a block of size 31 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:28) + by 0x........: main (realpathat.c:30) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) ... - by 0x........: main (realpathat.c:26) + by 0x........: main (realpathat.c:28) Syscall param __getcwd(buf) points to unaddressable byte(s) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 0 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) Invalid read of size 1 at 0x........: strlcpy (vg_replace_strmem.c:...) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 0 bytes inside a block of size 31 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:28) + by 0x........: main (realpathat.c:30) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) ... - by 0x........: main (realpathat.c:26) + by 0x........: main (realpathat.c:28) Invalid read of size 1 at 0x........: strlcpy (vg_replace_strmem.c:...) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 1 bytes inside a block of size 31 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:28) + by 0x........: main (realpathat.c:30) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) ... - by 0x........: main (realpathat.c:26) + by 0x........: main (realpathat.c:28) Invalid read of size 1 at 0x........: strlcpy (vg_replace_strmem.c:...) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 30 bytes inside a block of size 31 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:28) + by 0x........: main (realpathat.c:30) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) ... - by 0x........: main (realpathat.c:26) + by 0x........: main (realpathat.c:28) Invalid write of size 2 ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 55 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) Invalid read of size 1 at 0x........: strlcat (vg_replace_strmem.c:...) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 56 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) Invalid write of size 1 at 0x........: strlcat (vg_replace_strmem.c:...) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 56 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) Invalid write of size 1 at 0x........: strlcat (vg_replace_strmem.c:...) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 66 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) Syscall param fstatat(path) points to unaddressable byte(s) ... - by 0x........: main (realpathat.c:30) + by 0x........: main (realpathat.c:32) Address 0x........ is 56 bytes inside a block of size 100 free'd at 0x........: free (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:27) + by 0x........: main (realpathat.c:29) Block was alloc'd at at 0x........: malloc (vg_replace_malloc.c:...) - by 0x........: main (realpathat.c:25) + by 0x........: main (realpathat.c:27) diff --git a/memcheck/tests/freebsd/realpathat.vgtest b/memcheck/tests/freebsd/realpathat.vgtest index 9efbcbdfcf..c34ca564aa 100644 --- a/memcheck/tests/freebsd/realpathat.vgtest +++ b/memcheck/tests/freebsd/realpathat.vgtest @@ -1,3 +1,4 @@ prog: realpathat prereq: test -e ./realpathat vgopts: -q +stderr_filter: filter_realpathat |
|
From: Paul F. <pa...@so...> - 2022-04-03 19:29:47
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d6cdc6e523227bf483036aa004b4b369fd17713f commit d6cdc6e523227bf483036aa004b4b369fd17713f Author: Paul Floyd <pj...@wa...> Date: Sun Apr 3 21:28:24 2022 +0200 Add filter to memcheck/tests/freebsd/fexecve for the size Different size on x86 was causing a failure Diff: --- memcheck/tests/freebsd/fexecve.stderr.exp | 4 ++-- memcheck/tests/freebsd/fexecve.vgtest | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/freebsd/fexecve.stderr.exp b/memcheck/tests/freebsd/fexecve.stderr.exp index 1b4da10d00..5e49552511 100644 --- a/memcheck/tests/freebsd/fexecve.stderr.exp +++ b/memcheck/tests/freebsd/fexecve.stderr.exp @@ -5,14 +5,14 @@ Syscall param fexecve(fd) contains uninitialised byte(s) Syscall param fexecve(argv) points to uninitialised byte(s) at 0x........: fexecve (in /...libc...) by 0x........: main (fexecve.c:29) - Address 0x........ is 0 bytes inside a block of size 16 alloc'd + Address 0x........ is 0 bytes inside a block of size ... alloc'd at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (fexecve.c:17) Syscall param fexecve(envp) points to uninitialised byte(s) at 0x........: fexecve (in /...libc...) by 0x........: main (fexecve.c:29) - Address 0x........ is 0 bytes inside a block of size 16 alloc'd + Address 0x........ is 0 bytes inside a block of size ... alloc'd at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (fexecve.c:18) diff --git a/memcheck/tests/freebsd/fexecve.vgtest b/memcheck/tests/freebsd/fexecve.vgtest index 2ba2b646ca..78eec35d78 100644 --- a/memcheck/tests/freebsd/fexecve.vgtest +++ b/memcheck/tests/freebsd/fexecve.vgtest @@ -1,2 +1,3 @@ prog: fexecve vgopts: -q +stderr_filter: ../filter_dw4 |
|
From: Paul F. <pa...@so...> - 2022-04-03 16:28:29
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6c91d2d4eebb8a0096ce3b45d9bb23777074e3d4 commit 6c91d2d4eebb8a0096ce3b45d9bb23777074e3d4 Author: Paul Floyd <pj...@wa...> Date: Sun Apr 3 18:27:17 2022 +0200 Extend FreeBSD procctl 4 new types added in FreeBSD 13.1 Diff: --- coregrind/m_syswrap/syswrap-amd64-freebsd.c | 50 ++++++++++++++++------------- coregrind/m_syswrap/syswrap-x86-freebsd.c | 48 ++++++++++++++------------- include/vki/vki-freebsd.h | 37 +++++++++++---------- 3 files changed, 74 insertions(+), 61 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-amd64-freebsd.c b/coregrind/m_syswrap/syswrap-amd64-freebsd.c index 7302ffc429..9ddd34c77a 100644 --- a/coregrind/m_syswrap/syswrap-amd64-freebsd.c +++ b/coregrind/m_syswrap/syswrap-amd64-freebsd.c @@ -958,21 +958,23 @@ PRE(sys_procctl) SARG1, SARG2, SARG3, ARG4); PRE_REG_READ4(int, "procctl", vki_idtype_t, idtype, vki_id_t, id, int, cmd, void *, arg); switch (ARG3) { - case PROC_ASLR_CTL: - case PROC_SPROTECT: - case PROC_TRACE_CTL: - case PROC_TRAPCAP_CTL: - case PROC_PDEATHSIG_CTL: - case PROC_STACKGAP_CTL: + case VKI_PROC_ASLR_CTL: + case VKI_PROC_SPROTECT: + case VKI_PROC_TRACE_CTL: + case VKI_PROC_TRAPCAP_CTL: + case VKI_PROC_PDEATHSIG_CTL: + case VKI_PROC_STACKGAP_CTL: + case VKI_PROC_NO_NEW_PRIVS_CTL: + case VKI_PROC_WXMAP_CTL: PRE_MEM_READ("procctl(arg)", ARG4, sizeof(int)); break; - case PROC_REAP_STATUS: + case VKI_PROC_REAP_STATUS: PRE_MEM_READ("procctl(arg)", ARG4, sizeof(struct vki_procctl_reaper_status)); break; - case PROC_REAP_GETPIDS: + case VKI_PROC_REAP_GETPIDS: PRE_MEM_READ("procctl(arg)", ARG4, sizeof(struct vki_procctl_reaper_pids)); break; - case PROC_REAP_KILL: + case VKI_PROC_REAP_KILL: /* The first three fields are reads * int rk_sig; * u_int rk_flags; @@ -987,14 +989,16 @@ PRE(sys_procctl) PRE_MEM_READ("procctl(arg)", ARG4, sizeof(int) + sizeof(u_int) + sizeof(vki_pid_t)); PRE_MEM_WRITE("procctl(arg)", ARG4+offsetof(struct vki_procctl_reaper_kill, rk_killed), sizeof(u_int) + sizeof(vki_pid_t)); break; - case PROC_ASLR_STATUS: - case PROC_PDEATHSIG_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_TRACE_STATUS: + case VKI_PROC_ASLR_STATUS: + case VKI_PROC_PDEATHSIG_STATUS: + case VKI_PROC_STACKGAP_STATUS: + case VKI_PROC_TRAPCAP_STATUS: + case VKI_PROC_TRACE_STATUS: + case VKI_PROC_NO_NEW_PRIVS_STATUS: + case VKI_PROC_WXMAP_STATUS: PRE_MEM_WRITE("procctl(arg)", ARG4, sizeof(int)); - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: + case VKI_PROC_REAP_ACQUIRE: + case VKI_PROC_REAP_RELEASE: default: break; } @@ -1003,14 +1007,16 @@ PRE(sys_procctl) POST(sys_procctl) { switch (ARG3) { - case PROC_REAP_KILL: + case VKI_PROC_REAP_KILL: POST_MEM_WRITE(ARG4+offsetof(struct vki_procctl_reaper_kill, rk_killed), sizeof(u_int) + sizeof(vki_pid_t)); break; - case PROC_ASLR_STATUS: - case PROC_PDEATHSIG_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_TRACE_STATUS: + case VKI_PROC_ASLR_STATUS: + case VKI_PROC_PDEATHSIG_STATUS: + case VKI_PROC_STACKGAP_STATUS: + case VKI_PROC_TRAPCAP_STATUS: + case VKI_PROC_TRACE_STATUS: + case VKI_PROC_NO_NEW_PRIVS_STATUS: + case VKI_PROC_WXMAP_STATUS: POST_MEM_WRITE(ARG4, sizeof(int)); default: break; diff --git a/coregrind/m_syswrap/syswrap-x86-freebsd.c b/coregrind/m_syswrap/syswrap-x86-freebsd.c index 5c82f7db65..0ba304952f 100644 --- a/coregrind/m_syswrap/syswrap-x86-freebsd.c +++ b/coregrind/m_syswrap/syswrap-x86-freebsd.c @@ -1357,21 +1357,23 @@ PRE(sys_procctl) vki_uint32_t, MERGE64_SECOND(id), int, cmd, void *, arg); switch (ARG4) { - case PROC_ASLR_CTL: - case PROC_SPROTECT: - case PROC_TRACE_CTL: - case PROC_TRAPCAP_CTL: - case PROC_PDEATHSIG_CTL: - case PROC_STACKGAP_CTL: + case VKI_PROC_ASLR_CTL: + case VKI_PROC_SPROTECT: + case VKI_PROC_TRACE_CTL: + case VKI_PROC_TRAPCAP_CTL: + case VKI_PROC_PDEATHSIG_CTL: + case VKI_PROC_STACKGAP_CTL: + case VKI_PROC_NO_NEW_PRIVS_CTL: + case VKI_PROC_WXMAP_CTL: PRE_MEM_READ("procctl(arg)", ARG5, sizeof(int)); break; - case PROC_REAP_STATUS: + case VKI_PROC_REAP_STATUS: PRE_MEM_READ("procctl(arg)", ARG5, sizeof(struct vki_procctl_reaper_status)); break; - case PROC_REAP_GETPIDS: + case VKI_PROC_REAP_GETPIDS: PRE_MEM_READ("procctl(arg)", ARG5, sizeof(struct vki_procctl_reaper_pids)); break; - case PROC_REAP_KILL: + case VKI_PROC_REAP_KILL: /* The first three fields are reads * int rk_sig; * u_int rk_flags; @@ -1386,14 +1388,14 @@ PRE(sys_procctl) PRE_MEM_READ("procctl(arg)", ARG5, sizeof(int) + sizeof(u_int) + sizeof(vki_pid_t)); PRE_MEM_WRITE("procctl(arg)", ARG5+offsetof(struct vki_procctl_reaper_kill, rk_killed), sizeof(u_int) + sizeof(vki_pid_t)); break; - case PROC_ASLR_STATUS: - case PROC_PDEATHSIG_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_TRACE_STATUS: + case VKI_PROC_ASLR_STATUS: + case VKI_PROC_PDEATHSIG_STATUS: + case VKI_PROC_STACKGAP_STATUS: + case VKI_PROC_TRAPCAP_STATUS: + case VKI_PROC_TRACE_STATUS: PRE_MEM_WRITE("procctl(arg)", ARG5, sizeof(int)); - case PROC_REAP_ACQUIRE: - case PROC_REAP_RELEASE: + case VKI_PROC_REAP_ACQUIRE: + case VKI_PROC_REAP_RELEASE: default: break; } @@ -1402,14 +1404,16 @@ PRE(sys_procctl) POST(sys_procctl) { switch (ARG4) { - case PROC_REAP_KILL: + case VKI_PROC_REAP_KILL: POST_MEM_WRITE(ARG5+offsetof(struct vki_procctl_reaper_kill, rk_killed), sizeof(u_int) + sizeof(vki_pid_t)); break; - case PROC_ASLR_STATUS: - case PROC_PDEATHSIG_STATUS: - case PROC_STACKGAP_STATUS: - case PROC_TRAPCAP_STATUS: - case PROC_TRACE_STATUS: + case VKI_PROC_ASLR_STATUS: + case VKI_PROC_PDEATHSIG_STATUS: + case VKI_PROC_STACKGAP_STATUS: + case VKI_PROC_TRAPCAP_STATUS: + case VKI_PROC_TRACE_STATUS: + case VKI_PROC_NO_NEW_PRIVS_STATUS: + case VKI_PROC_WXMAP_STATUS: POST_MEM_WRITE(ARG5, sizeof(int)); default: break; diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index b0036679ed..d467f017e5 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -2285,23 +2285,26 @@ typedef struct vki_domainset vki_domainset_t; // From sys/procctl.h //---------------------------------------------------------------------- -#define PROC_SPROTECT 1 -#define PROC_REAP_ACQUIRE 2 -#define PROC_REAP_RELEASE 3 -#define PROC_REAP_STATUS 4 -#define PROC_REAP_GETPIDS 5 -#define PROC_REAP_KILL 6 -#define PROC_TRACE_CTL 7 -#define PROC_TRACE_STATUS 8 -#define PROC_TRAPCAP_CTL 9 -#define PROC_TRAPCAP_STATUS 10 -#define PROC_PDEATHSIG_CTL 11 -#define PROC_PDEATHSIG_STATUS 12 -#define PROC_ASLR_CTL 13 -#define PROC_ASLR_STATUS 14 -#define PROC_STACKGAP_CTL 17 -#define PROC_STACKGAP_STATUS 18 - +#define VKI_PROC_SPROTECT 1 +#define VKI_PROC_REAP_ACQUIRE 2 +#define VKI_PROC_REAP_RELEASE 3 +#define VKI_PROC_REAP_STATUS 4 +#define VKI_PROC_REAP_GETPIDS 5 +#define VKI_PROC_REAP_KILL 6 +#define VKI_PROC_TRACE_CTL 7 +#define VKI_PROC_TRACE_STATUS 8 +#define VKI_PROC_TRAPCAP_CTL 9 +#define VKI_PROC_TRAPCAP_STATUS 10 +#define VKI_PROC_PDEATHSIG_CTL 11 +#define VKI_PROC_PDEATHSIG_STATUS 12 +#define VKI_PROC_ASLR_CTL 13 +#define VKI_PROC_ASLR_STATUS 14 +#define VKI_PROC_STACKGAP_CTL 17 +#define VKI_PROC_STACKGAP_STATUS 18 +#define VKI_PROC_NO_NEW_PRIVS_CTL 19 +#define VKI_PROC_NO_NEW_PRIVS_STATUS 20 +#define VKI_PROC_WXMAP_CTL 21 +#define VKI_PROC_WXMAP_STATUS 22 struct vki_procctl_reaper_status { u_int rs_flags; |
|
From: Paul F. <pa...@so...> - 2022-04-03 13:51:34
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=bbc3bcab0ae7aa01a116c05c52c66a6714a7df12 commit bbc3bcab0ae7aa01a116c05c52c66a6714a7df12 Author: Paul Floyd <pj...@wa...> Date: Sun Apr 3 15:50:38 2022 +0200 Bug 451843 - valgrind fails to start on a FreeBSD system which enforces W^X Also add FreeBSD 13.1 to configure.ac Diff: --- NEWS | 1 + configure.ac | 23 ++++++++++---- coregrind/m_initimg/initimg-freebsd.c | 6 ++-- coregrind/m_main.c | 50 ++++++++++++++++++++++++++++-- coregrind/m_stacktrace.c | 2 +- coregrind/m_syswrap/priv_syswrap-freebsd.h | 4 +-- coregrind/m_syswrap/syswrap-freebsd.c | 6 ++-- include/vki/vki-scnums-freebsd.h | 2 +- memcheck/tests/freebsd/scalar.c | 4 +-- none/tests/freebsd/auxv.c | 2 +- 10 files changed, 78 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 2b74b58644..23caf25025 100644 --- a/NEWS +++ b/NEWS @@ -85,6 +85,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 450536 Powerpc: valgrind throws 'facility scv unavailable exception' 451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s) 451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions +451843 valgrind fails to start on a FreeBSD system which enforces W^X To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/configure.ac b/configure.ac index 4559028f92..04c306efbb 100755 --- a/configure.ac +++ b/configure.ac @@ -394,8 +394,10 @@ case "${host_os}" in freebsd_12=1200 AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2]) freebsd_12_2=1220 - AC_DEFINE([FREEBSD_13], 1300, [FREEBSD_VERS value for FreeBSD 13.x]) - freebsd_13=1300 + AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0]) + freebsd_13_0=1300 + AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1+]) + freebsd_13_1=1310 AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x]) freebsd_14=1400 @@ -428,9 +430,18 @@ case "${host_os}" in esac ;; 13.*) - AC_MSG_RESULT([FreeBSD 13.x (${kernel})]) - AC_DEFINE([FREEBSD_VERS], FREEBSD_13, [FreeBSD version]) - freebsd_vers=$freebsd_13 + case "${kernel}" in + 13.0-*) + AC_MSG_RESULT([FreeBSD 13.0 (${kernel})]) + AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version]) + freebsd_vers=$freebsd_13_0 + ;; + *) + AC_MSG_RESULT([FreeBSD 13.1+ (${kernel})]) + AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version]) + freebsd_vers=$freebsd_13_1 + ;; + esac ;; 14.*) AC_MSG_RESULT([FreeBSD 14.x (${kernel})]) @@ -4625,7 +4636,7 @@ fi # test "$VGCONF_OS" = "solaris" if test "$VGCONF_OS" = "freebsd" ; then -AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13) +AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0) else diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index 71fb8add17..10d034eab6 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -578,7 +578,7 @@ Addr setup_client_stack( void* init_sp, /* --- auxv --- */ auxv = (struct auxv *)ptr; *client_auxv = (UInt *)auxv; -#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13) +#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13_0) int* pagesizes = NULL; #endif @@ -660,7 +660,7 @@ Addr setup_client_stack( void* init_sp, // case AT_CANARYLEN: // case AT_EXECPATH: // case AT_CANARY: -#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13) +#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13_0) case AT_PAGESIZESLEN: if (!VG_(is32on64)()) { VG_(debugLog)(2, "initimg", @@ -685,7 +685,7 @@ Addr setup_client_stack( void* init_sp, // case AT_TIMEKEEP: break; -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) case AT_BSDFLAGS: case AT_ARGC: // case AT_ARGV: diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 70b6c05495..2a7712b3ce 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1348,14 +1348,14 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) VG_(exit)(1); } +#if defined(VGO_freebsd) + Int val; + SizeT len = sizeof(val); //-------------------------------------------------------------- // FreeBSD check security.bsd.unprivileged_proc_debug sysctl // This needs to be done before aspacemgr starts, otherwise that // will fail with mysterious error codes //-------------------------------------------------------------- -#if defined(VGO_freebsd) - Int val; - SizeT len = sizeof(val); Int error = VG_(sysctlbyname)("security.bsd.unprivileged_proc_debug", &val, &len, 0, 0); if (error != -1 && val != 1) { VG_(debugLog)(0, "main", "Valgrind: FATAL:\n"); @@ -1366,6 +1366,50 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) VG_(exit)(1); } + + //-------------------------------------------------------------- + // FreeBSD also check for sysctl kern.elf64.allow_wx=0 + // This is a sysctl that prevents applications from mmap'ing + // segments that are writeable and executable + //-------------------------------------------------------------- +#if defined(VGP_amd64_freebsd) + error = VG_(sysctlbyname)("kern.elf64.allow_wx", &val, &len, 0, 0); + if (error != -1 && val != 1) { + VG_(debugLog)(0, "main", "Valgrind: FATAL:\n"); + VG_(debugLog)(0, "main", "sysctl kern.elf64.allow_wx sysctl is 0.\n"); + VG_(debugLog)(0, "main", " Set this sysctl with\n"); + VG_(debugLog)(0, "main", " 'sysctl kern.elf64.allow_wx sysctl=1'.\n"); + // the below code doesn't work as I expected + // the proccontrol command doesn't cause sysctlbyname to get a modified value + // which means that valgrind will still detect allow_wx == 0 and exit here +//#if (FREEBSD_VERS >= FREEBSD_13_1) +// VG_(debugLog)(0, "main", " Or, alternatively, run valgrind with\n"); +// VG_(debugLog)(0, "main", " 'proccontrol -m wxmap -s enable valgrind [options] prog-and-args'\n"); +//#endif + VG_(debugLog)(0, "main", " Cannot continue.\n"); + + VG_(exit)(1); + } + +#endif + + /* also 323bit version */ +#if defined(VGP_x86_freebsd) + error = VG_(sysctlbyname)("kern.elf32.allow_wx", &val, &len, 0, 0); + if (error != -1 && val != 1) { + VG_(debugLog)(0, "main", "Valgrind: FATAL:\n"); + VG_(debugLog)(0, "main", "sysctl kern.elf32.allow_wx sysctl is 0.\n"); + VG_(debugLog)(0, "main", " Set this sysctl with\n"); + VG_(debugLog)(0, "main", " 'sysctl kern.elf32.allow_wx sysctl=1'.\n"); +//#if (FREEBSD_VERS >= FREEBSD_13_1) +// VG_(debugLog)(0, "main", " Or, alternatively, run valgrind with\n"); +// VG_(debugLog)(0, "main", " 'proccontrol -m wxmap -s enable valgrind [options] prog-and-args'\n"); +//#endif + VG_(debugLog)(0, "main", " Cannot continue.\n"); + + VG_(exit)(1); + } +#endif #endif diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index 9467f3caf6..4c45b97b9f 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -283,7 +283,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known, if (do_stats) stats.nr++; // Does this apply to macOS 10.14 and earlier? -# if defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13) +# if defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13_0) if (VG_(is_valid_tid)(tid_if_known) && VG_(is_in_syscall)(tid_if_known) && i < max_n_ips) { diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index e7b66b17d6..db0b647f53 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -524,7 +524,7 @@ DECL_TEMPLATE(freebsd, sys_fhreadlink) // 567 // unimpl __NR_copy_file_range 569 DECL_TEMPLATE(freebsd, sys___sysctlbyname) // 570 -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) // looks like close_range got backported // to 12.2 leaving these 4 marked as UNIMPL in 12.2 // unimpl __NR_shm_open2 571 @@ -537,7 +537,7 @@ DECL_TEMPLATE(freebsd, sys___realpathat) // 574 #endif -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) // unimpl __NR_rpctls_syscall 576 DECL_TEMPLATE(freebsd, sys___specialfd) // 577 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 3fe6c0eb24..6088d89d70 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -6208,7 +6208,7 @@ POST(sys___sysctlbyname) #endif // (FREEBSD_VERS >= FREEBSD_12_2) -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) // SYS___realpathat 474 // from syscalls.master @@ -6940,7 +6940,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { // unimpl __NR_copy_file_range 569 BSDXY(__NR___sysctlbyname, sys___sysctlbyname), // 570 -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) // unimpl __NR_shm_open2 571 // unimpl __NR_shm_rename 572 // unimpl __NR_sigfastblock 573 @@ -6949,7 +6949,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { // unimpl __NR_close_range 575 #endif -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) // unimpl __NR_rpctls_syscall 576 BSDX_(__NR___specialfd, sys___specialfd), // 577 // unimpl __NR_aio_writev 578 diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index f3247e5376..2bce8b523d 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -640,7 +640,7 @@ #endif -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) #define __NR_rpctls_syscall 576 #define __NR___specialfd 577 diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 140ee82568..50c70e4f23 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -1615,7 +1615,7 @@ int main(void) SY(SYS_thr_kill2, x0-1, x0-1, x0+9999); FAIL; /* SYS_shm_open 482 */ -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) GO(SYS_freebsd12_shm_open, "(SHM_ANON) 3s 0m"); SY(SYS_freebsd12_shm_open, x0+SHM_ANON, x0+2, x0+9); SUCC; #else @@ -1748,7 +1748,7 @@ int main(void) SY(SYS_jail_remove, x0+1); FAIL; /* SYS_closefrom 509 */ -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) GO(SYS_freebsd12_closefrom, "1s 0m"); SY(SYS_freebsd12_closefrom, x0+100000); SUCC; #else diff --git a/none/tests/freebsd/auxv.c b/none/tests/freebsd/auxv.c index a6d0f45244..689fb3d113 100644 --- a/none/tests/freebsd/auxv.c +++ b/none/tests/freebsd/auxv.c @@ -39,7 +39,7 @@ Elf_AuxStr aux_map[AT_COUNT] = { {"AT_HWCAP2", 26}, // FreeBSD 12 and 11 // {"AT_COUNT", 27}, -#if (FREEBSD_VERS >= FREEBSD_13) +#if (FREEBSD_VERS >= FREEBSD_13_0) {"AT_BSDFLAGS", 27}, {"AT_ARGC", 28}, {"AT_ARGV", 29}, |
|
From: Paul F. <pa...@so...> - 2022-04-03 13:35:12
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=aba645e5a542f8e95e9b8ef07d30f0a0cfbe16fa commit aba645e5a542f8e95e9b8ef07d30f0a0cfbe16fa Author: Paul Floyd <pj...@wa...> Date: Sun Apr 3 15:34:14 2022 +0200 Add some FreeBSD tests to .gitignore Diff: --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 5d9ba7c429..86416f576c 100644 --- a/.gitignore +++ b/.gitignore @@ -1336,6 +1336,10 @@ /memcheck/tests/freebsd/utimes /memcheck/tests/freebsd/static_allocs /memcheck/tests/freebsd/fexecve +/memcheck/tests/freebsd/eventfd1 +/memcheck/tests/freebsd/eventfd2 +/memcheck/tests/freebsd/realpathat +/memcheck/tests/freebsd/scalar_13_plus # /memcheck/tests/amd64-freebsd /memcheck/tests/amd64-freebsd/*.stderr.diff |