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
(83) |
Oct
(89) |
Nov
(97) |
Dec
(30) |
2024 |
Jan
(25) |
Feb
(73) |
Mar
(76) |
Apr
(122) |
May
(46) |
Jun
(44) |
Jul
(27) |
Aug
(30) |
Sep
(33) |
Oct
(67) |
Nov
(91) |
Dec
(70) |
2025 |
Jan
(44) |
Feb
(36) |
Mar
(85) |
Apr
(100) |
May
(138) |
Jun
(55) |
Jul
(107) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Mark W. <ma...@so...> - 2025-05-22 14:47:38
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=ebd7dd5ea9504e0d8490507fd2b894647477b085 commit ebd7dd5ea9504e0d8490507fd2b894647477b085 Author: Alexandra Hájková <aha...@re...> Date: Tue May 6 06:50:44 2025 -0400 Add "yes" argument for the --modify-fds option. Use --modify-fds=yes to restrict the option from affecting the 0/1/2 file descriptors as they're often used for stdin/tdout/stderr redirection. The new possibility is named "yes" because "yes" is used as the default in general. The default behaviour of the --modify-fds option is then such, that highest available file descriptor is returned execept when the lowest stdin/stdout/stderr (0, 1, 2) are available. For example, if we want to redirect stdout to stderr by closing stdout (file descriptor 1) and then calling dup (), file descriptor 1 will be returned and not the highest number available. This is because the following is a common pattern to redirect stdout to stderr: close (1); /* stdout becomes stderr */ ret = dup (2); Add none/tests/track_yes.vgtest and none/tests/track_high.vgtest tests to test --modify-fds=yes/high behave as expected. https://bugs.kde.org/show_bug.cgi?id=502359 Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_main.c | 10 ++++++---- coregrind/m_options.c | 2 +- coregrind/m_syswrap/priv_syswrap-generic.h | 15 ++++++++------- docs/xml/manual-core.xml | 6 ++++-- include/pub_tool_options.h | 5 +++++ none/tests/Makefile.am | 8 +++++--- none/tests/cmdline1.stdout.exp | 2 +- none/tests/cmdline2.stdout.exp | 2 +- none/tests/track_high.stderr.exp | 8 ++++++++ none/tests/track_high.vgtest | 4 ++++ none/tests/track_std.c | 31 ++++++++++++++++++++++++++++++ none/tests/track_yes.stderr.exp | 9 +++++++++ none/tests/track_yes.vgtest | 4 ++++ 15 files changed, 89 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 5264bdd29a..8cabb96df4 100644 --- a/.gitignore +++ b/.gitignore @@ -1675,6 +1675,7 @@ /none/tests/tls /none/tests/track-fds-exec-children /none/tests/track_new +/none/tests/track_std /none/tests/unit_debuglog /none/tests/use_after_close /none/tests/valgrind_cpp_test diff --git a/NEWS b/NEWS index d9f5fa9031..1450dfba82 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 504101 Add a "vgstack" script 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 501741 syscall cachestat not wrapped +502359 Add --modify-fds=yes option 503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 diff --git a/coregrind/m_main.c b/coregrind/m_main.c index ff82e3a505..4da156fb94 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -115,7 +115,7 @@ static void usage_NORETURN ( int need_help ) " startup exit abexit valgrindabexit all none\n" " --track-fds=no|yes|all track open file descriptors? [no]\n" " all includes reporting inherited file descriptors\n" -" --modify-fds=no|high modify newly open file descriptors? [no]\n" +" --modify-fds=no|yes|high modify newly open file descriptors? [no]\n" " --time-stamp=no|yes add timestamps to log messages? [no]\n" " --log-fd=<number> log messages to file descriptor [2=stderr]\n" " --log-file=<file> log messages to <file>\n" @@ -649,12 +649,14 @@ static void process_option (Clo_Mode mode, } else if VG_STR_CLO(arg, "--modify-fds", tmp_str) { if (VG_(strcmp)(tmp_str, "high") == 0) - VG_(clo_modify_fds) = 1; + VG_(clo_modify_fds) = VG_MODIFY_FD_HIGH; + else if (VG_(strcmp)(tmp_str, "yes") == 0) + VG_(clo_modify_fds) = VG_MODIFY_FD_YES; else if (VG_(strcmp)(tmp_str, "no") == 0) - VG_(clo_modify_fds) = 0; + VG_(clo_modify_fds) = VG_MODIFY_FD_NO; else VG_(fmsg_bad_option)(arg, - "Bad argument, should be 'high' or 'no'\n"); + "Bad argument, should be 'high', 'yes', or 'no'\n"); } else if VG_BOOL_CLOM(cloPD, arg, "--trace-children", VG_(clo_trace_children)) {} else if VG_BOOL_CLOM(cloPD, arg, "--child-silent-after-fork", diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 6f5a4d0458..e70ba08e8f 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -182,7 +182,7 @@ XArray *VG_(clo_req_tsyms); // array of strings Bool VG_(clo_run_libc_freeres) = True; Bool VG_(clo_run_cxx_freeres) = True; UInt VG_(clo_track_fds) = 0; -UInt VG_(clo_modify_fds) = 0; +UInt VG_(clo_modify_fds) = VG_MODIFY_FD_NO; Bool VG_(clo_show_below_main)= False; Bool VG_(clo_keep_debuginfo) = False; Bool VG_(clo_show_emwarns) = False; diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h index b24b6b9035..eb815840d9 100644 --- a/coregrind/m_syswrap/priv_syswrap-generic.h +++ b/coregrind/m_syswrap/priv_syswrap-generic.h @@ -342,13 +342,14 @@ extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, UW, Off64 /* Helper macro for POST handlers that return a new file in RES. If possible sets RES (through SET_STATUS_Success) to a new (not yet seem before) file descriptor. */ -#define POST_newFd_RES \ - do { \ - if (VG_(clo_modify_fds) == 1) { \ - int newFd = ML_(get_next_new_fd)(RES); \ - if (newFd != RES) \ - SET_STATUS_Success(newFd); \ - } \ +#define POST_newFd_RES \ + do { \ + if ((VG_(clo_modify_fds) == VG_MODIFY_FD_YES && RES > 2) \ + || (VG_(clo_modify_fds) == VG_MODIFY_FD_HIGH)) { \ + int newFd = ML_(get_next_new_fd)(RES); \ + if (newFd != RES) \ + SET_STATUS_Success(newFd); \ + } \ } while (0) ///////////////////////////////////////////////////////////////// diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index ffcb8d4bf5..7d18d46f39 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -903,12 +903,14 @@ in most cases. We group the available options by rough categories.</para> <varlistentry id="opt.modify-fds" xreflabel="--modify-fds"> <term> - <option><![CDATA[--modify-fds=<no|high> [default: no] ]]></option> + <option><![CDATA[--modify-fds=<no|yes|high> [default: no] ]]></option> </term> <listitem> <para>When enabled, when the program opens a new file descriptor, the highest available file descriptor is returned instead of the - lowest one.</para> + lowest one. Use <option>yes</option> to restrict the feature from + the 0/1/2 file descriptors as they're often used for stdout/stderr + redirection.</para> </listitem> </varlistentry> diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index fec61e30fe..021f888bec 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -419,6 +419,11 @@ extern Bool VG_(clo_keep_debuginfo); /* Track open file descriptors? 0 = No, 1 = Yes, 2 = All (including std) */ extern UInt VG_(clo_track_fds); +/* Whether to adjust file descriptor numbers. Yes does for all nonstd file + descriptors. High does for all file descriptors. */ +#define VG_MODIFY_FD_NO 0 +#define VG_MODIFY_FD_YES 1 +#define VG_MODIFY_FD_HIGH 2 extern UInt VG_(clo_modify_fds); diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 6305044ca6..18924b34f3 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -272,8 +272,9 @@ EXTRA_DIST = \ fdbaduse.stderr.exp fdbaduse.vgtest \ use_after_close.stderr.exp use_after_close.vgtest \ track_new.stderr.exp track_new.stdout.exp \ - track_new.vgtest track_new.stderr.exp-illumos - + track_new.vgtest track_new.stderr.exp-illumos \ + track_yes.vgtest track_high.vgtest \ + track_yes.stderr.exp track_high.stderr.exp check_PROGRAMS = \ args \ @@ -331,7 +332,8 @@ check_PROGRAMS = \ file_dclose \ fdbaduse \ use_after_close \ - track_new + track_new \ + track_std if HAVE_STATIC_LIBC if ! VGCONF_OS_IS_LINUX diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index d2f3e5d6a8..06a679a111 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -30,7 +30,7 @@ usage: valgrind [options] prog-and-args startup exit abexit valgrindabexit all none --track-fds=no|yes|all track open file descriptors? [no] all includes reporting inherited file descriptors - --modify-fds=no|high modify newly open file descriptors? [no] + --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 9a49757461..d7914ae010 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -30,7 +30,7 @@ usage: valgrind [options] prog-and-args startup exit abexit valgrindabexit all none --track-fds=no|yes|all track open file descriptors? [no] all includes reporting inherited file descriptors - --modify-fds=no|high modify newly open file descriptors? [no] + --modify-fds=no|yes|high modify newly open file descriptors? [no] --time-stamp=no|yes add timestamps to log messages? [no] --log-fd=<number> log messages to file descriptor [2=stderr] --log-file=<file> log messages to <file> diff --git a/none/tests/track_high.stderr.exp b/none/tests/track_high.stderr.exp new file mode 100644 index 0000000000..f9a605f10e --- /dev/null +++ b/none/tests/track_high.stderr.exp @@ -0,0 +1,8 @@ +FILE DESCRIPTORS: 3 open (1 inherited) at exit. +Open file descriptor ...: ... + ... + +Open file descriptor ...: /dev/null + ... + + diff --git a/none/tests/track_high.vgtest b/none/tests/track_high.vgtest new file mode 100644 index 0000000000..c5eb8f5461 --- /dev/null +++ b/none/tests/track_high.vgtest @@ -0,0 +1,4 @@ +prog: track_std +vgopts: -q --track-fds=yes --modify-fds=high +stderr_filter: filter_fdleak + diff --git a/none/tests/track_std.c b/none/tests/track_std.c new file mode 100644 index 0000000000..2cf01de8f0 --- /dev/null +++ b/none/tests/track_std.c @@ -0,0 +1,31 @@ +#include <fcntl.h> +#include <unistd.h> +#include <sys/stat.h> +#include <string.h> + +int +main (void) +{ + char buf[20]; + size_t nbytes; + int ret; + + /* close stdin */ + close (0); + /* open /dev/null as new stdin */ + (void)open ("/dev/null", O_RDONLY); + /* redirect stdout as stderr */ + close (1); + /* stdout becomes stderr */ + ret = dup (2); + + if (ret == 1) { + strcpy(buf, "hello world\n"); + nbytes = strlen(buf); + + /* should come out on stderr */ + write (1, buf, nbytes); + } + + return 0; +} diff --git a/none/tests/track_yes.stderr.exp b/none/tests/track_yes.stderr.exp new file mode 100644 index 0000000000..92c790f6c0 --- /dev/null +++ b/none/tests/track_yes.stderr.exp @@ -0,0 +1,9 @@ +hello world +FILE DESCRIPTORS: 3 open (1 inherited) at exit. +Open file descriptor ...: ... + ... + +Open file descriptor ...: /dev/null + ... + + diff --git a/none/tests/track_yes.vgtest b/none/tests/track_yes.vgtest new file mode 100644 index 0000000000..5c55038fd5 --- /dev/null +++ b/none/tests/track_yes.vgtest @@ -0,0 +1,4 @@ +prog: track_std +vgopts: -q --track-fds=yes --modify-fds=yes +stderr_filter: filter_fdleak + |
From: Martin C. <mc...@re...> - 2025-05-21 11:26:18
|
On Tue 2025-05-20 10:40 , Mark Wielaard wrote: > Hi, > > On Tue, May 20, 2025 at 07:38:58AM +0200, zz...@ge... wrote: > > This change looks strange to me. > > > > Am 19.05.25 um 18:53 schrieb Mark Wielaard: > > >https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=859d267a456c2921772f0c957bf24f463c51bd93 > > > > > >commit 859d267a456c2921772f0c957bf24f463c51bd93 > > >Author: Martin Cermak <mc...@re...> > > >Date: Mon May 19 11:45:04 2025 +0200 > > > > > > PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind > > > Prevent ltp/testcases/kernel/syscalls/setrlimit/setrlimit05 testcase > > > from crashing valgrind when passing 0xffffffffffff as ARG3 and then > > > trying to dereference it. > > > https://bugs.kde.org/show_bug.cgi?id=504341 > > [...] > > >index d4653d0273..470635f565 100644 > > >--- a/coregrind/m_syswrap/syswrap-linux.c > > >+++ b/coregrind/m_syswrap/syswrap-linux.c > > >@@ -2300,12 +2300,14 @@ PRE(sys_prlimit64) > > > if (ARG4) > > > PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); > > >- if (ARG3 && > > >- ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur > > >- > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { > > >- SET_STATUS_Failure( VKI_EINVAL ); > > >- } > > >- else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { > > >+ if (ARG3) { > > > > Changing the condition from (ARG3 && rlim_cur > rlim_max) to just > > (ARG3) changes the logic. So some branches below are not executed > > when they should. The switch inside "else if (ARG1 == 0 || ARG1 == > > VG_(getpid)())" is the main part of prlimit64. > > Yeah, my fault. I tried to keep the logic the same by removing the > safe_to_deref from the if clause as Martin originally > suggested. Forgetting that also changes the logic flow :{ And then it > was only tested against the ltp testsuite not the normal > regtests. Apologies. Lesson learned. Now I can see how my update regressed none/tests/rlimit{,64}_nofile. Sorry about that. Thanks for the fix! Martin |
From: Mark W. <ma...@kl...> - 2025-05-20 11:59:52
|
We are pleased to announce a new release of Valgrind, version 3.25.1, available from https://valgrind.org/downloads/current.html. This point release contains only bug fixes. See the list of bugs and the git shortlog below for details of the changes. Happy and productive debugging and profiling, -- The Valgrind Developers Release 3.25.1 (20 May 2025) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This point release contains only bug fixes. * ==================== FIXED BUGS ==================== The following bugs have been fixed or resolved in this point release. 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503914 mount syscall param filesystemtype may be NULL 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504466 Double close causes SEGV To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX where XXXXXX is the bug number as listed above. git shortlog ~~~~~~~~~~~~ Ivan Tetyushkin (1): riscv64: Fix nan-boxing for single-precision calculations Mark Wielaard (9): Set version to 3.25.1.GIT Prepare NEWS for branch 3.25 fixes mount syscall param filesystemtype may be NULL Add workaround for missing riscv_hwprobe syscall (258) Don't count closed inherited file descriptors More gdb filtering for glibc 2.41 with debuginfo installed Check whether file descriptor is inherited before printing where_opened Add fixed bug 504466 double close causes SEGV to NEWS -> 3.25.1 final Paul Floyd (6): FreeBSD close_range syscall Bug 503641 - close_range syscalls started failing with 3.25.0 regtest: use /bin/cat in none/tests/fdleak_cat.vgtest Linux PPC64 syscall: add sys_io_pgetevents Bug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred FreeBSD regtest: updates for FreeBSD 15.0-CURRENT |
From: Mark W. <ma...@so...> - 2025-05-20 10:59:13
|
The signed tag 'VALGRIND_3_25_1' was created pointing to: 4441567fbe... -> 3.25.1 final Tagger: Mark Wielaard <ma...@kl...> Date: Tue May 20 12:57:37 2025 +0200 valgrind 3.25.1 release |
From: Mark W. <ma...@so...> - 2025-05-20 10:59:03
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4441567fbec8c263e1624b49ba86572d4cccfccd commit 4441567fbec8c263e1624b49ba86572d4cccfccd Author: Mark Wielaard <ma...@kl...> Date: Tue May 20 12:53:15 2025 +0200 -> 3.25.1 final Diff: --- NEWS | 8 +++++--- configure.ac | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 31bf21379e..741329a681 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,11 @@ -Branch 3.25 -~~~~~~~~~~~ +Release 3.25.1 (20 May 2025) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This point release contains only bug fixes. * ==================== FIXED BUGS ==================== -The following bugs have been fixed or resolved on this branch. +The following bugs have been fixed or resolved in this point release. 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 diff --git a/configure.ac b/configure.ac index c386a3b66a..2becfe7e2f 100755 --- a/configure.ac +++ b/configure.ac @@ -18,8 +18,8 @@ AC_PREREQ(2.69) m4_define([v_major_ver], [3]) m4_define([v_minor_ver], [25]) m4_define([v_micro_ver], [1]) -m4_define([v_suffix_ver], [GIT]) -m4_define([v_rel_date], ["?? ??? 2025"]) +m4_define([v_suffix_ver], []) +m4_define([v_rel_date], ["20 May 2025"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], |
From: Mark W. <ma...@so...> - 2025-05-20 10:14:20
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f51744ed2d1f07c814b72853ca946da3c94de0f1 commit f51744ed2d1f07c814b72853ca946da3c94de0f1 Author: Mark Wielaard <ma...@kl...> Date: Tue May 20 12:09:13 2025 +0200 PRE(sys_prlimit64): Check ARG3 and ARG4 ML_(safe_to_deref) up front The previous commit 859d267a456c "PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind" changed the checking logic of the PRE handler changing the if-else control flow. Do the ARG3 and ARG4 ML_(safe_to_deref) checking up front and return EFAULT early so the later checking logic doesn't need to change. https://bugs.kde.org/show_bug.cgi?id=504341 Suggested-by: Matthias <zz...@ge...> Diff: --- coregrind/m_syswrap/syswrap-linux.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 470635f565..fa2ab9e9fe 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2295,19 +2295,27 @@ PRE(sys_prlimit64) vki_pid_t, pid, unsigned int, resource, const struct rlimit64 *, new_rlim, struct rlimit64 *, old_rlim); - if (ARG3) + if (ARG3) { PRE_MEM_READ( "rlimit64(new_rlim)", ARG3, sizeof(struct vki_rlimit64) ); - if (ARG4) + if (!ML_(safe_to_deref)((void*)(Addr)ARG3, sizeof(struct vki_rlimit64))) { + SET_STATUS_Failure(VKI_EFAULT); + return; + } + } + if (ARG4) { PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); - - if (ARG3) { - if (ML_(safe_to_deref)( (void*)(Addr)ARG3, sizeof(struct vki_rlimit64) )) { - if (((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { - SET_STATUS_Failure( VKI_EINVAL ); - } + if (!ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(struct vki_rlimit64))) { + SET_STATUS_Failure(VKI_EFAULT); + return; } - } else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { + } + + if (ARG3 && + ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur + > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { + SET_STATUS_Failure( VKI_EINVAL ); + } + else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { switch (ARG2) { case VKI_RLIMIT_NOFILE: SET_STATUS_Success( 0 ); |
From: Mark W. <ma...@kl...> - 2025-05-20 08:40:38
|
Hi, On Tue, May 20, 2025 at 07:38:58AM +0200, zz...@ge... wrote: > This change looks strange to me. > > Am 19.05.25 um 18:53 schrieb Mark Wielaard: > >https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=859d267a456c2921772f0c957bf24f463c51bd93 > > > >commit 859d267a456c2921772f0c957bf24f463c51bd93 > >Author: Martin Cermak <mc...@re...> > >Date: Mon May 19 11:45:04 2025 +0200 > > > > PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind > > Prevent ltp/testcases/kernel/syscalls/setrlimit/setrlimit05 testcase > > from crashing valgrind when passing 0xffffffffffff as ARG3 and then > > trying to dereference it. > > https://bugs.kde.org/show_bug.cgi?id=504341 > [...] > >index d4653d0273..470635f565 100644 > >--- a/coregrind/m_syswrap/syswrap-linux.c > >+++ b/coregrind/m_syswrap/syswrap-linux.c > >@@ -2300,12 +2300,14 @@ PRE(sys_prlimit64) > > if (ARG4) > > PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); > >- if (ARG3 && > >- ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur > >- > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { > >- SET_STATUS_Failure( VKI_EINVAL ); > >- } > >- else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { > >+ if (ARG3) { > > Changing the condition from (ARG3 && rlim_cur > rlim_max) to just > (ARG3) changes the logic. So some branches below are not executed > when they should. The switch inside "else if (ARG1 == 0 || ARG1 == > VG_(getpid)())" is the main part of prlimit64. Yeah, my fault. I tried to keep the logic the same by removing the safe_to_deref from the if clause as Martin originally suggested. Forgetting that also changes the logic flow :{ And then it was only tested against the ltp testsuite not the normal regtests. Apologies. > The simplest fix I can image is to check the pointers before > entering the real logic if-else-if block: > > --- a/coregrind/m_syswrap/syswrap-linux.c > +++ b/coregrind/m_syswrap/syswrap-linux.c > @@ -2295,19 +2295,28 @@ PRE(sys_prlimit64) > vki_pid_t, pid, unsigned int, resource, > const struct rlimit64 *, new_rlim, > struct rlimit64 *, old_rlim); > - if (ARG3) > + if (ARG3) { > PRE_MEM_READ( "rlimit64(new_rlim)", ARG3, sizeof(struct > vki_rlimit64) ); > - if (ARG4) > - PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct > vki_rlimit64) ); > + if (! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(struct > vki_rlimit64))) { > + SET_STATUS_Failure ( VKI_EFAULT ); > + return; > + } > + } yes, doing the checking for safe_to_deref upfront after PRE_MEM_READ/WRITE and then setting/returning VKI_EFAULT seems the right idea. Then the logic below can stay the same. Thanks, Mark > - if (ARG3) { > - if (ML_(safe_to_deref)( (void*)(Addr)ARG3, sizeof(struct > vki_rlimit64) )) { > - if (((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur > - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { > - SET_STATUS_Failure( VKI_EINVAL ); > - } > + if (ARG4) { > + PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct > vki_rlimit64) ); > + if (! ML_(safe_to_deref)((void *)(Addr)ARG4, sizeof(struct > vki_rlimit64))) { > + SET_STATUS_Failure ( VKI_EFAULT ); > + return; > } > - } else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { > + } > + > + if (ARG3 && > + ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur > + > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { > + SET_STATUS_Failure( VKI_EINVAL ); > + } > + else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { > switch (ARG2) { > case VKI_RLIMIT_NOFILE: > SET_STATUS_Success( 0 ); > > > > Regards > Matthias > |
From: <zz...@ge...> - 2025-05-20 05:39:08
|
This change looks strange to me. Am 19.05.25 um 18:53 schrieb Mark Wielaard: > https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=859d267a456c2921772f0c957bf24f463c51bd93 > > commit 859d267a456c2921772f0c957bf24f463c51bd93 > Author: Martin Cermak <mc...@re...> > Date: Mon May 19 11:45:04 2025 +0200 > > PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind > > Prevent ltp/testcases/kernel/syscalls/setrlimit/setrlimit05 testcase > from crashing valgrind when passing 0xffffffffffff as ARG3 and then > trying to dereference it. > > https://bugs.kde.org/show_bug.cgi?id=504341 > > Diff: > --- > NEWS | 1 + > coregrind/m_syswrap/syswrap-linux.c | 14 ++++++++------ > 2 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/NEWS b/NEWS > index d6fbbb41b9..7bb9a79d10 100644 > --- a/NEWS > +++ b/NEWS > @@ -33,6 +33,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. > 501741 syscall cachestat not wrapped > 503969 Make test results of make ltpchecks compatible with bunsen > 504265 FreeBSD: missing syscall wrappers for fchroot and setcred > +504341 Valgrind killed by LTP syscall testcase setrlimit05 > > To see details of a given bug, visit > https://bugs.kde.org/show_bug.cgi?id=XXXXXX > diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c > index d4653d0273..470635f565 100644 > --- a/coregrind/m_syswrap/syswrap-linux.c > +++ b/coregrind/m_syswrap/syswrap-linux.c > @@ -2300,12 +2300,14 @@ PRE(sys_prlimit64) > if (ARG4) > PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); > > - if (ARG3 && > - ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur > - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { > - SET_STATUS_Failure( VKI_EINVAL ); > - } > - else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { > + if (ARG3) { Changing the condition from (ARG3 && rlim_cur > rlim_max) to just (ARG3) changes the logic. So some branches below are not executed when they should. The switch inside "else if (ARG1 == 0 || ARG1 == VG_(getpid)())" is the main part of prlimit64. The testsuite catches this: $ perl tests/vg_regtest none/tests/rlimit{,64}_nofile rlimit_nofile: valgrind ./rlimit_nofile *** rlimit_nofile failed (stderr) *** rlimit64_nofile: valgrind ./rlimit64_nofile *** rlimit64_nofile failed (stderr) *** == 2 tests, 2 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == none/tests/rlimit_nofile (stderr) none/tests/rlimit64_nofile (stderr) $ cat none/tests/rlimit64_nofile.stderr.diff --- rlimit64_nofile.stderr.exp 2023-10-27 09:53:13.809659010 +0200 +++ rlimit64_nofile.stderr.out 2025-05-20 07:35:14.513269310 +0200 @@ -1,2 +1,3 @@ +setrlimit64 changing hardlimit must return -1 The simplest fix I can image is to check the pointers before entering the real logic if-else-if block: --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2295,19 +2295,28 @@ PRE(sys_prlimit64) vki_pid_t, pid, unsigned int, resource, const struct rlimit64 *, new_rlim, struct rlimit64 *, old_rlim); - if (ARG3) + if (ARG3) { PRE_MEM_READ( "rlimit64(new_rlim)", ARG3, sizeof(struct vki_rlimit64) ); - if (ARG4) - PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); + if (! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(struct vki_rlimit64))) { + SET_STATUS_Failure ( VKI_EFAULT ); + return; + } + } - if (ARG3) { - if (ML_(safe_to_deref)( (void*)(Addr)ARG3, sizeof(struct vki_rlimit64) )) { - if (((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { - SET_STATUS_Failure( VKI_EINVAL ); - } + if (ARG4) { + PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); + if (! ML_(safe_to_deref)((void *)(Addr)ARG4, sizeof(struct vki_rlimit64))) { + SET_STATUS_Failure ( VKI_EFAULT ); + return; } - } else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { + } + + if (ARG3 && + ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur + > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { + SET_STATUS_Failure( VKI_EINVAL ); + } + else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { switch (ARG2) { case VKI_RLIMIT_NOFILE: SET_STATUS_Success( 0 ); Regards Matthias |
From: Mark W. <ma...@kl...> - 2025-05-19 19:48:37
|
Hi Paul, On Mon, May 19, 2025 at 08:38:04AM +0200, Paul Floyd via Valgrind-developers wrote: > > On 5/16/25 11:41, Mark Wielaard wrote: > >How many commit are there for freebsd to cherry-pick? > >If you give me a list I can do them for you. > > > There are 2 for sure and 2 if you'd like to add the new vgstack > script to 3.25.1. > > Definitely: > > commit 4f3f688a31ef1a213bd1a3a9e897e99cfe3950f6 > Author: Paul Floyd <pj...@wa...> > Date: Fri May 16 07:58:02 2025 +0200 > > Bug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred > > commit 8dbf86733e76d30c194f5321a72c6b44f1055e20 > Author: Paul Floyd <pj...@wa...> > Date: Fri May 16 21:32:02 2025 +0200 > > FreeBSD regtest: updates for FreeBSD 15.0-CURRENT I cherry-picked these two. But dropped the .gitignore update, because that file isn't in a release tar and so the patch wouldn't apply when someone would try to apply it directly on top of the previous release. > Maybe: > > commit 568ce38ac76e1cefc20b006c7da8cf7bf2209596 > Author: Paul Floyd <pj...@wa...> > Date: Tue May 13 20:34:48 2025 +0200 > > Bug 504101 - Add a "vgstack" script > > commit 382efd0ccbe8447eca4bde0068a205a01d02f90e > Author: Paul Floyd <pj...@wa...> > Date: Mon May 19 08:23:57 2025 +0200 > > Script: move vgstack to configure.ac section with chmod -x But not these two. Although it is just a small new feature (and pretty cool!) it would make 3.25.1 not be a simple drop-in for 3.25.0 because packagers will have to adjust things so that the new script gets installed and possibly be placed in a particular subpackage. The VALGRIND_3_25_BRANCH now contains these commits: Add fixed bug 504466 double close causes SEGV to NEWS FreeBSD regtest: updates for FreeBSD 15.0-CURRENT FreeBSD: missing syscall wrappers for fchroot and setcred Check whether file descriptor is inherited before printing where_opened More gdb filtering for glibc 2.41 with debuginfo installed Linux PPC64 syscall: add sys_io_pgetevents riscv64: Fix nan-boxing for single-precision calculations regtest: use /bin/cat in none/tests/fdleak_cat.vgtest Don't count closed inherited file descriptors Add workaround for missing riscv_hwprobe syscall (258) mount syscall param filesystemtype may be NULL Bug 503641 - close_range syscalls started failing with 3.25.0 FreeBSD close_range syscall Which fix these bugs: 503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503914 mount syscall param filesystemtype may be NULL 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504466 Double close causes SEGV I'll create an official 3.25.1 release tomorrow from the branch (after updating the version number of course). Cheers, Mark |
From: Mark W. <ma...@so...> - 2025-05-19 19:47:12
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=0c31bca2f87acbdbc2b56cc495142c69f4f951e4 commit 0c31bca2f87acbdbc2b56cc495142c69f4f951e4 Author: Mark Wielaard <ma...@kl...> Date: Mon May 19 21:42:18 2025 +0200 Add fixed bug 504466 double close causes SEGV to NEWS https://bugs.kde.org/show_bug.cgi?id=504466 was fixed by commit 8187386962598d1393eaf6cf4e032996f5edabb3 Check whether file descriptor is inherited before printing where_opened (cherry picked from commit c6c37fd95ad1d89f5f644054d1cccd5ecd385e55) Diff: --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index ed73889a51..31bf21379e 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ The following bugs have been fixed or resolved on this branch. 503914 mount syscall param filesystemtype may be NULL 504177 FILE DESCRIPTORS banner shows when closing some inherited fds 504265 FreeBSD: missing syscall wrappers for fchroot and setcred +504466 Double close causes SEGV To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX |
From: Mark W. <ma...@so...> - 2025-05-19 19:44:47
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=2e710aff2cc7dd5cf4d3db4d647c7c119fbb0abe commit 2e710aff2cc7dd5cf4d3db4d647c7c119fbb0abe Author: Paul Floyd <pj...@wa...> Date: Fri May 16 21:32:02 2025 +0200 FreeBSD regtest: updates for FreeBSD 15.0-CURRENT Mostly minor expected/filter changes. Helgrind did detect a race condition in a Valgrind file static variable. Teh DRD dlopen test needs to be linked with the thread library. In a VirtualBox environment I'm getting 4 hanging testcases (3 in gdbserver_tests and none/freebsd/bug452274). (cherry picked from commit 8dbf86733e76d30c194f5321a72c6b44f1055e20) Diff: --- drd/tests/Makefile.am | 4 +++- freebsd-helgrind.supp | 7 ++++++- helgrind/tests/Makefile.am | 1 + helgrind/tests/filter_fiw | 8 ++++++++ helgrind/tests/free_is_write.stderr.exp | 2 +- helgrind/tests/free_is_write.vgtest | 1 + memcheck/tests/Makefile.am | 2 +- memcheck/tests/filter_sendmsg | 5 +++++ memcheck/tests/sendmsg.stderr.exp | 2 +- memcheck/tests/sendmsg.stderr.exp-freebsd | 7 +++---- memcheck/tests/sendmsg.stderr.exp-freebsd-x86 | 20 -------------------- memcheck/tests/sendmsg.stderr.exp-solaris | 2 +- memcheck/tests/sendmsg.vgtest | 1 + none/tests/fdleak_cmsg_supp.supp | 2 +- 14 files changed, 33 insertions(+), 31 deletions(-) diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am index e2030ad157..7fa1611a97 100755 --- a/drd/tests/Makefile.am +++ b/drd/tests/Makefile.am @@ -550,7 +550,9 @@ bug322621_SOURCES = bug322621.cpp condvar_SOURCES = condvar.cpp condvar_CXXFLAGS = $(AM_CXXFLAGS) -std=c++0x concurrent_close_SOURCES = concurrent_close.cpp -if !VGCONF_OS_IS_FREEBSD +if VGCONF_OS_IS_FREEBSD +dlopen_main_LDADD = ${LDADD} +else dlopen_main_LDADD = -ldl endif dlopen_lib_so_SOURCES = dlopen_lib.c diff --git a/freebsd-helgrind.supp b/freebsd-helgrind.supp index dd998f15c5..1a6f372492 100644 --- a/freebsd-helgrind.supp +++ b/freebsd-helgrind.supp @@ -238,4 +238,9 @@ Helgrind:Race fun:thr_exit } - +# sigh, this is our own variable in coregrind/m_replacemalloc/vg_replace_malloc.c +{ + FREEBSD15-AMD64-MALLOC + Helgrind:Race + fun:malloc +} diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am index 7adc5c6021..a299a226b3 100755 --- a/helgrind/tests/Makefile.am +++ b/helgrind/tests/Makefile.am @@ -5,6 +5,7 @@ dist_noinst_SCRIPTS = \ filter_stderr_solaris \ filter_helgrind \ filter_xml \ + filter_fiw \ filter_freebsd.awk \ filter_stderr_freebsd \ filter_bug392331 diff --git a/helgrind/tests/filter_fiw b/helgrind/tests/filter_fiw new file mode 100755 index 0000000000..9ff7ae79a5 --- /dev/null +++ b/helgrind/tests/filter_fiw @@ -0,0 +1,8 @@ +#! /bin/sh + +# free_is_write may have different arena sizes + +./filter_stderr "$@" | + +sed 's/size [^ ]* in arena/size ... in arena/' + diff --git a/helgrind/tests/free_is_write.stderr.exp b/helgrind/tests/free_is_write.stderr.exp index daa327ce01..5d05242aca 100644 --- a/helgrind/tests/free_is_write.stderr.exp +++ b/helgrind/tests/free_is_write.stderr.exp @@ -23,7 +23,7 @@ Locks held: none This conflicts with a previous read of size 1 by thread #x Locks held: none at 0x........: main (free_is_write.c:36) - Address 0x........ is 5 bytes inside an unallocated block of size 16 in arena "client" + Address 0x........ is 5 bytes inside an unallocated block of size ... in arena "client" Done. diff --git a/helgrind/tests/free_is_write.vgtest b/helgrind/tests/free_is_write.vgtest index 5ba9d3423e..1e68c6054e 100644 --- a/helgrind/tests/free_is_write.vgtest +++ b/helgrind/tests/free_is_write.vgtest @@ -1,2 +1,3 @@ prog: free_is_write vgopts: --free-is-write=yes +stderr_filter: filter_fiw diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index bdaa9d761e..1ad475f540 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -86,6 +86,7 @@ dist_noinst_SCRIPTS = \ filter_varinfo3 \ filter_memcheck \ filter_malloc_free \ + filter_sendmsg \ filter_size_t \ filter_stanza \ filter_stanza.awk \ @@ -381,7 +382,6 @@ EXTRA_DIST = \ sem.stderr.exp sem.vgtest \ sendmsg.stderr.exp sendmsg.stderr.exp-solaris sendmsg.vgtest \ sendmsg.stderr.exp-freebsd \ - sendmsg.stderr.exp-freebsd-x86 \ sh-mem.stderr.exp sh-mem.vgtest \ sh-mem-random.stderr.exp sh-mem-random.stdout.exp64 \ sh-mem-random.stdout.exp sh-mem-random.vgtest \ diff --git a/memcheck/tests/filter_sendmsg b/memcheck/tests/filter_sendmsg new file mode 100755 index 0000000000..c11650dd08 --- /dev/null +++ b/memcheck/tests/filter_sendmsg @@ -0,0 +1,5 @@ +#! /bin/sh + +./filter_stderr "$@" | +sed -e "s/frame #./frame #.../" \ + -e "/by 0x........: sendmsg (in \/...libc...)/d" diff --git a/memcheck/tests/sendmsg.stderr.exp b/memcheck/tests/sendmsg.stderr.exp index 397a57996c..1268300b2b 100644 --- a/memcheck/tests/sendmsg.stderr.exp +++ b/memcheck/tests/sendmsg.stderr.exp @@ -2,6 +2,6 @@ Syscall param sendmsg(msg) points to uninitialised byte(s) at 0x........: sendmsg (in /...libc...) by 0x........: main (sendmsg.c:46) Address 0x........ is on thread 1's stack - in frame #1, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) sendmsg: 6 diff --git a/memcheck/tests/sendmsg.stderr.exp-freebsd b/memcheck/tests/sendmsg.stderr.exp-freebsd index 7cf17e625e..d65f86f055 100644 --- a/memcheck/tests/sendmsg.stderr.exp-freebsd +++ b/memcheck/tests/sendmsg.stderr.exp-freebsd @@ -2,19 +2,18 @@ Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte( ... by 0x........: main (sendmsg.c:29) Address 0x........ is on thread 1's stack - in frame #1, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) Syscall param sendmsg(sendmsg) points to uninitialised byte(s) at 0x........: _sendmsg (in /...libc...) - by 0x........: sendmsg (in /...libc...) by 0x........: main (sendmsg.c:46) Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte(s) ... by 0x........: main (sendmsg.c:59) Address 0x........ is on thread 1's stack - in frame #1, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) sendmsg: 6 diff --git a/memcheck/tests/sendmsg.stderr.exp-freebsd-x86 b/memcheck/tests/sendmsg.stderr.exp-freebsd-x86 deleted file mode 100644 index 9aafb02afd..0000000000 --- a/memcheck/tests/sendmsg.stderr.exp-freebsd-x86 +++ /dev/null @@ -1,20 +0,0 @@ -Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte(s) - ... - by 0x........: main (sendmsg.c:29) - Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) - -Syscall param sendmsg(sendmsg) points to uninitialised byte(s) - at 0x........: _sendmsg (in /...libc...) - by 0x........: sendmsg (in /...libc...) - by 0x........: main (sendmsg.c:46) - Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) - -Syscall param socketcall.connect(serv_addr.sa_len) points to uninitialised byte(s) - ... - by 0x........: main (sendmsg.c:59) - Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) - -sendmsg: 6 diff --git a/memcheck/tests/sendmsg.stderr.exp-solaris b/memcheck/tests/sendmsg.stderr.exp-solaris index f00e76e402..3ef45c16ad 100644 --- a/memcheck/tests/sendmsg.stderr.exp-solaris +++ b/memcheck/tests/sendmsg.stderr.exp-solaris @@ -3,6 +3,6 @@ Syscall param sendmsg(msg) points to uninitialised byte(s) by 0x........: __xnet_sendmsg (in /...libc...) by 0x........: main (sendmsg.c:46) Address 0x........ is on thread 1's stack - in frame #2, created by main (sendmsg.c:13) + in frame #..., created by main (sendmsg.c:13) sendmsg: 6 diff --git a/memcheck/tests/sendmsg.vgtest b/memcheck/tests/sendmsg.vgtest index f252b62b95..562fc968fe 100644 --- a/memcheck/tests/sendmsg.vgtest +++ b/memcheck/tests/sendmsg.vgtest @@ -1,2 +1,3 @@ prog: sendmsg vgopts: -q +stderr_filter: filter_sendmsg diff --git a/none/tests/fdleak_cmsg_supp.supp b/none/tests/fdleak_cmsg_supp.supp index 95f0a31de6..cc0daca187 100644 --- a/none/tests/fdleak_cmsg_supp.supp +++ b/none/tests/fdleak_cmsg_supp.supp @@ -52,7 +52,7 @@ sup5 CoreError:FdNotClosed ... - fun:recvmsg + fun:*recvmsg fun:client fun:main } |
From: Mark W. <ma...@so...> - 2025-05-19 19:44:25
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c6c37fd95ad1d89f5f644054d1cccd5ecd385e55 commit c6c37fd95ad1d89f5f644054d1cccd5ecd385e55 Author: Mark Wielaard <ma...@kl...> Date: Mon May 19 21:42:18 2025 +0200 Add fixed bug 504466 double close causes SEGV to NEWS https://bugs.kde.org/show_bug.cgi?id=504466 was fixed by commit 8187386962598d1393eaf6cf4e032996f5edabb3 Check whether file descriptor is inherited before printing where_opened Diff: --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 7bb9a79d10..d9f5fa9031 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred 504341 Valgrind killed by LTP syscall testcase setrlimit05 +504466 Double close causes SEGV To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX |
From: Mark W. <ma...@so...> - 2025-05-19 19:25:06
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=b90959c1aeaa0d9a655c68e32b9ceae50fbacde0 commit b90959c1aeaa0d9a655c68e32b9ceae50fbacde0 Author: Paul Floyd <pj...@wa...> Date: Fri May 16 07:58:02 2025 +0200 Bug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred (cherry picked from commit 4f3f688a31ef1a213bd1a3a9e897e99cfe3950f6) Diff: --- NEWS | 1 + configure.ac | 8 +++++++- coregrind/m_syswrap/priv_syswrap-freebsd.h | 3 +++ coregrind/m_syswrap/syswrap-freebsd.c | 25 +++++++++++++++++++++++ include/vki/vki-freebsd.h | 17 ++++++++++++++++ include/vki/vki-scnums-freebsd.h | 2 ++ memcheck/tests/freebsd/Makefile.am | 15 ++++++++++++++ memcheck/tests/freebsd/fchroot.cpp | 17 ++++++++++++++++ memcheck/tests/freebsd/fchroot.stderr.exp | 4 ++++ memcheck/tests/freebsd/fchroot.vgtest | 3 +++ memcheck/tests/freebsd/scalar.c | 32 +++++++++++++++++++++++++++++- memcheck/tests/freebsd/scalar.stderr.exp | 22 ++++++++++++++++++++ memcheck/tests/freebsd/setcred.cpp | 31 +++++++++++++++++++++++++++++ memcheck/tests/freebsd/setcred.stderr.exp | 30 ++++++++++++++++++++++++++++ memcheck/tests/freebsd/setcred.vgtest | 3 +++ 15 files changed, 211 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2a373a02e1..ed73889a51 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ The following bugs have been fixed or resolved on this branch. 503641 close_range syscalls started failing with 3.25.0 503914 mount syscall param filesystemtype may be NULL 504177 FILE DESCRIPTORS banner shows when closing some inherited fds +504265 FreeBSD: missing syscall wrappers for fchroot and setcred 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 59eecada29..c386a3b66a 100755 --- a/configure.ac +++ b/configure.ac @@ -5006,7 +5006,9 @@ AC_CHECK_FUNCS([ \ fdatasync \ getrandom \ getrlimitusage \ - timer_delete + timer_delete \ + fchroot \ + setcred ]) # AC_CHECK_LIB adds any library found to the variable LIBS, and links these @@ -5064,6 +5066,10 @@ AM_CONDITIONAL([HAVE_GETRLIMITUSAGE], [test x$ac_cv_func_getrlimitusage = xyes]) AM_CONDITIONAL([HAVE_TIMER_DELETE], [test x$ac_cv_func_timer_delete = xyes]) +AM_CONDITIONAL([HAVE_FCHROOT], + [test x$ac_cv_func_fchroot = xyes]) +AM_CONDITIONAL([HAVE_SETCRED], + [test x$ac_cv_func_setcred = xyes]) if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \ diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index 8b78c5d742..f8d404239d 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -538,7 +538,10 @@ DECL_TEMPLATE(freebsd, sys_timerfd_settime) // 587 // __FreeBSD_version 1400507 and 1500012 DECL_TEMPLATE(freebsd, sys_kcmp) // 588 + DECL_TEMPLATE(freebsd, sys_getrlimitusage) // 589 +DECL_TEMPLATE(freebsd, sys_fchroot) // 590 +DECL_TEMPLATE(freebsd, sys_setcred) // 591 DECL_TEMPLATE(freebsd, sys_fake_sigreturn) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 41cd075619..8fcfe10904 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -7001,6 +7001,28 @@ POST(sys_getrlimitusage) } } +// SYS_fchroot 590 +// int fchroot(int fd); +PRE(sys_fchroot) +{ + PRINT("sys_fchroot(%ld)", ARG1); + PRE_REG_READ1(int, "fchroot", int, fd); + + /* Be strict. */ + if (!ML_(fd_allowed)(ARG1, "fchroot", tid, False)) + SET_STATUS_Failure(VKI_EBADF); +} + +// SYS_setcred +// int setcred(u_int flags, const struct setcred *wcred, size_t size); +PRE(sys_setcred) +{ + PRINT("sys_setcred(%ld, %#" FMT_REGWORD "x, %lu)", ARG1, ARG2, ARG3); + PRE_REG_READ3(int, "setcred", u_int, flags, const struct setcred*, wcred, size_t, size); + PRE_MEM_READ("setcred(wcred)", ARG2, sizeof(struct vki_setcred)); +} + + #undef PRE #undef POST @@ -7694,6 +7716,9 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_kcmp, sys_kcmp), // 588 BSDXY(__NR_getrlimitusage, sys_getrlimitusage), // 589 + BSDX_(__NR_fchroot, sys_fchroot), // 590 + BSDX_(__NR_setcred, sys_setcred), // 591 + BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn }; diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index b870025f0f..2539979995 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -3257,6 +3257,23 @@ union vki_ccb { #define VKI_CAMIOCOMMAND _VKI_IOWR(VKI_CAM_VERSION, 2, union vki_ccb) +//---------------------------------------------------------------------- +// From cam/scsi/scsi_all.h +//---------------------------------------------------------------------- +struct vki_setcred { + vki_uid_t sc_uid; /* effective user id */ + vki_uid_t sc_ruid; /* real user id */ + vki_uid_t sc_svuid; /* saved user id */ + vki_gid_t sc_gid; /* effective group id */ + vki_gid_t sc_rgid; /* real group id */ + vki_gid_t sc_svgid; /* saved group id */ + vki_u_int sc_pad; /* see 32-bit compat structure */ + vki_u_int sc_supp_groups_nb; /* number of supplementary groups */ + vki_gid_t *sc_supp_groups; /* supplementary groups */ + struct vki_mac *sc_label; /* MAC label */ +}; + + /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 098b722f48..a92abb9a15 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -627,6 +627,8 @@ #define __NR_kcmp 588 #define __NR_getrlimitusage 589 +#define __NR_fchroot 590 +#define __NR_setcred 591 #define __NR_fake_sigreturn 1000 diff --git a/memcheck/tests/freebsd/Makefile.am b/memcheck/tests/freebsd/Makefile.am index 1213b31898..1e668a1523 100644 --- a/memcheck/tests/freebsd/Makefile.am +++ b/memcheck/tests/freebsd/Makefile.am @@ -53,6 +53,8 @@ EXTRA_DIST = \ extattr.stderr.exp \ fbsd278566.vgtest \ fbsd278566.stderr.exp \ + fchroot.vgtest \ + fchroot.stderr.exp \ fexecve.vgtest \ fexecve.stderr.exp \ file_locking_wait6.vgtest \ @@ -109,6 +111,8 @@ EXTRA_DIST = \ sctp2.vgtest \ sctp2.stderr.exp \ sctp2.stdout.exp \ + setcred.vgtest \ + setcred.stderr.exp \ setproctitle.vgtest \ setproctitle.stderr.exp \ setproctitle.stdout.exp \ @@ -176,6 +180,11 @@ if HAVE_AIO_READV check_PROGRAMS += aiov endif +if HAVE_FCHROOT +check_PROGRAMS += fchroot +fchroot_SOURCES = fchroot.cpp +endif + if HAVE_GETRLIMITUSAGE check_PROGRAMS += getrlimitusage endif @@ -203,6 +212,12 @@ if FREEBSD_KQUEUEX_SYSCALL check_PROGRAMS += kqueuex endif +if HAVE_SETCRED +check_PROGRAMS += setcred +setcred_SOURCES = setcred.cpp +setcred_CXXFLAGS = ${AM_CXXFLAGS} @FLAG_W_NO_UNINITIALIZED@ +endif + if FREEBSD_TIMERFD_SYSCALL check_PROGRAMS += timerfd timerfd_LDFLAGS = -lm diff --git a/memcheck/tests/freebsd/fchroot.cpp b/memcheck/tests/freebsd/fchroot.cpp new file mode 100644 index 0000000000..84b7ee7ad5 --- /dev/null +++ b/memcheck/tests/freebsd/fchroot.cpp @@ -0,0 +1,17 @@ +#include <unistd.h> +#include <fcntl.h> + +int main() +{ + int fd1; + int* fd2{new int}; + + fd1 = open("..", O_DIRECTORY | O_RDONLY); + // will fail unless run as root + fchroot(fd1); + + fchroot(*fd2); + + delete fd2; +} + diff --git a/memcheck/tests/freebsd/fchroot.stderr.exp b/memcheck/tests/freebsd/fchroot.stderr.exp new file mode 100644 index 0000000000..938d3474f9 --- /dev/null +++ b/memcheck/tests/freebsd/fchroot.stderr.exp @@ -0,0 +1,4 @@ +Syscall param fchroot(fd) contains uninitialised byte(s) + at 0x........: fchroot (in /...libc...) + by 0x........: main (fchroot.cpp:13) + diff --git a/memcheck/tests/freebsd/fchroot.vgtest b/memcheck/tests/freebsd/fchroot.vgtest new file mode 100644 index 0000000000..a07103eed1 --- /dev/null +++ b/memcheck/tests/freebsd/fchroot.vgtest @@ -0,0 +1,3 @@ +prereq: test -e ./fchroot +prog: fchroot +vgopts: -q diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 65348c232a..eddde2f428 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -2450,7 +2450,37 @@ int main(void) FAKE_SY(" ...\n"); FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); FAKE_SY("\n"); -#endif +#endif + +#if defined(SYS_fchroot) + GO(SYS_fchroot, "1s, 0m"); + SY(SYS_fchroot, x0+1000); +#else + FAKE_GO("590: SYS_fchroot 1s, 0m"); + FAKE_SY("Syscall param fchroot(fd) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); +#endif + +#if defined(SYS_setcred) + GO(SYS_setcred, "3s, 1m"); + SY(SYS_setcred, x0+100, x0+3, x0+50); +#else + FAKE_GO("591: SYS_setcred 3s, 1m"); + FAKE_SY("Syscall param setcred(flags) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setcred(wcred) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setcred(size) contains uninitialised byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY("\n"); + FAKE_SY("Syscall param setcred(wcred) points to unaddressable byte(s)\n"); + FAKE_SY(" ...\n"); + FAKE_SY(" Address 0x........ is not stack'd, malloc'd or (recently) free'd\n"); + FAKE_SY("\n"); +#endif /* SYS_exit 1 */ GO(SYS_exit, "1s 0m"); diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 0e47fe1aac..59ed185242 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -5740,6 +5740,28 @@ Syscall param getrlimitusage(res) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd +--------------------------------------------------------- +590: SYS_fchroot 1s, 0m +--------------------------------------------------------- +Syscall param fchroot(fd) contains uninitialised byte(s) + ... + +--------------------------------------------------------- +591: SYS_setcred 3s, 1m +--------------------------------------------------------- +Syscall param setcred(flags) contains uninitialised byte(s) + ... + +Syscall param setcred(wcred) contains uninitialised byte(s) + ... + +Syscall param setcred(size) contains uninitialised byte(s) + ... + +Syscall param setcred(wcred) points to unaddressable byte(s) + ... + Address 0x........ is not stack'd, malloc'd or (recently) free'd + --------------------------------------------------------- 1: SYS_exit 1s 0m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/setcred.cpp b/memcheck/tests/freebsd/setcred.cpp new file mode 100644 index 0000000000..7553599dfc --- /dev/null +++ b/memcheck/tests/freebsd/setcred.cpp @@ -0,0 +1,31 @@ +#include <sys/ucred.h> +#include <cstring> + +int main() +{ + struct setcred cred1; + struct setcred* cred2; + int flags1{0}; + int flags2; + size_t size1{sizeof(cred1)}; + size_t size2; + + std::memset(&cred1, 250, sizeof(cred1)); + + // needs to be root to work correctly + setcred(flags1, &cred1, size1); + + // not accessible + setcred(flags1, nullptr, size1); + + // uninit + setcred(flags2, cred2, size2); + + cred2 = new struct setcred; + + // uninit memory + setcred(flags1, cred2, size1); + + delete cred2; +} + diff --git a/memcheck/tests/freebsd/setcred.stderr.exp b/memcheck/tests/freebsd/setcred.stderr.exp new file mode 100644 index 0000000000..1d9cecf8e3 --- /dev/null +++ b/memcheck/tests/freebsd/setcred.stderr.exp @@ -0,0 +1,30 @@ +Syscall param setcred(wcred) points to unaddressable byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:19) + Address 0x........ is not stack'd, malloc'd or (recently) free'd + +Syscall param setcred(flags) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + +Syscall param setcred(wcred) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + +Syscall param setcred(size) contains uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + +Syscall param setcred(wcred) points to uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:22) + Address 0x........ is on thread 1's stack + in frame #2, created by __libc_start1 (???:) + +Syscall param setcred(wcred) points to uninitialised byte(s) + at 0x........: setcred (in /...libc...) + by 0x........: main (setcred.cpp:27) + Address 0x........ is 0 bytes inside a block of size 48 alloc'd + at 0x........: ...operator new... (vg_replace_malloc.c:...) + by 0x........: main (setcred.cpp:24) + diff --git a/memcheck/tests/freebsd/setcred.vgtest b/memcheck/tests/freebsd/setcred.vgtest new file mode 100644 index 0000000000..8c4f4d36f0 --- /dev/null +++ b/memcheck/tests/freebsd/setcred.vgtest @@ -0,0 +1,3 @@ +prereq: test -e ./setcred +prog: setcred +vgopts: -q |
From: Mark W. <ma...@so...> - 2025-05-19 19:13:19
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8a55301a0bdb8dcd308bd076cb12e924917e8964 commit 8a55301a0bdb8dcd308bd076cb12e924917e8964 Author: Mark Wielaard <ma...@kl...> Date: Sun May 18 15:31:36 2025 +0200 Check whether file descriptor is inherited before printing where_opened Inherited file descriptors don't have an ExeContext where they were opened (by the program). So don't try to print the NULL where_opened when reporting double close errors for such file descriptors. Add a testcase none/tests/fdleak_doubleclose0 that crashes valgrind before this fix. https://bugs.kde.org/show_bug.cgi?id=504466 (cherry picked from commit 8187386962598d1393eaf6cf4e032996f5edabb3) Diff: --- coregrind/m_syswrap/syswrap-generic.c | 13 +++++++++---- none/tests/Makefile.am | 3 ++- none/tests/fdleak_doubleclose0.c | 10 ++++++++++ none/tests/fdleak_doubleclose0.stderr.exp | 12 ++++++++++++ none/tests/fdleak_doubleclose0.vgtest | 3 +++ 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 81c8fc028d..98cbb172fd 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -637,7 +637,8 @@ struct BadCloseExtra { HChar *description; /* Description of the file descriptor might include the pathname */ ExeContext *where_closed; /* record the last close of fd */ - ExeContext *where_opened; /* recordwhere the fd was opened */ + ExeContext *where_opened; /* recordwhere the fd was opened, + NULL if inherited file descriptor */ }; struct FdBadUse { @@ -646,7 +647,8 @@ struct FdBadUse { HChar *description; /* Description of the file descriptor might include the pathname */ ExeContext *where_closed; /* record the last close of fd */ - ExeContext *where_opened; /* recordwhere the fd was opened */ + ExeContext *where_opened; /* recordwhere the fd was opened, + NULL if inherited file descriptor */ }; struct NotClosedExtra { @@ -1197,8 +1199,11 @@ void fd_pp_Error (const Error *err) VG_(pp_ExeContext)( where ); VG_(emit)("%sPreviously closed%s\n", auxpre, auxpost); VG_(pp_ExeContext)(bce->where_closed); - VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); - VG_(pp_ExeContext)(bce->where_opened); + // Inherited file descriptors where never opened (by the program) + if (bce->where_opened) { + VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); + VG_(pp_ExeContext)(bce->where_opened); + } } else if (VG_(get_error_kind)(err) == FdNotClosed) { if (xml) VG_(emit)(" <kind>FdNotClosed</kind>\n"); struct NotClosedExtra *nce = (struct NotClosedExtra *) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index bebc2f4dd1..6305044ca6 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -150,6 +150,7 @@ EXTRA_DIST = \ fdleak_creat_xml.stderr.exp fdleak_creat_xml.vgtest \ fdleak_creat_sup.stderr.exp fdleak_creat_sup.supp \ fdleak_creat_sup.vgtest \ + fdleak_doubleclose0.stderr.exp fdleak_doubleclose0.vgtest \ fdleak_dup.stderr.exp fdleak_dup.vgtest \ fdleak_dup_xml.stderr.exp fdleak_dup_xml.vgtest \ fdleak_dup2.stderr.exp fdleak_dup2.vgtest \ @@ -283,7 +284,7 @@ check_PROGRAMS = \ bug492678 \ closeall coolo_strlen \ discard exec-sigmask execve faultstatus fcntl_setown \ - fdleak_cmsg fdleak_creat fdleak_dup fdleak_dup2 \ + fdleak_cmsg fdleak_creat fdleak_doubleclose0 fdleak_dup fdleak_dup2 \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ diff --git a/none/tests/fdleak_doubleclose0.c b/none/tests/fdleak_doubleclose0.c new file mode 100644 index 0000000000..83c89a8c4b --- /dev/null +++ b/none/tests/fdleak_doubleclose0.c @@ -0,0 +1,10 @@ +#include <unistd.h> + +int main (int argc, char **argv) +{ + close (0); + close (1); + close (1); + close (0); + return 0; +} diff --git a/none/tests/fdleak_doubleclose0.stderr.exp b/none/tests/fdleak_doubleclose0.stderr.exp new file mode 100644 index 0000000000..6487cf8a42 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.stderr.exp @@ -0,0 +1,12 @@ +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main diff --git a/none/tests/fdleak_doubleclose0.vgtest b/none/tests/fdleak_doubleclose0.vgtest new file mode 100644 index 0000000000..36d3e36a60 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.vgtest @@ -0,0 +1,3 @@ +prog: fdleak_doubleclose0 +vgopts: -q --track-fds=yes +stderr_filter: filter_fdleak |
From: Mark W. <ma...@so...> - 2025-05-19 16:53:13
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=859d267a456c2921772f0c957bf24f463c51bd93 commit 859d267a456c2921772f0c957bf24f463c51bd93 Author: Martin Cermak <mc...@re...> Date: Mon May 19 11:45:04 2025 +0200 PR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind Prevent ltp/testcases/kernel/syscalls/setrlimit/setrlimit05 testcase from crashing valgrind when passing 0xffffffffffff as ARG3 and then trying to dereference it. https://bugs.kde.org/show_bug.cgi?id=504341 Diff: --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index d6fbbb41b9..7bb9a79d10 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501741 syscall cachestat not wrapped 503969 Make test results of make ltpchecks compatible with bunsen 504265 FreeBSD: missing syscall wrappers for fchroot and setcred +504341 Valgrind killed by LTP syscall testcase setrlimit05 To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d4653d0273..470635f565 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -2300,12 +2300,14 @@ PRE(sys_prlimit64) if (ARG4) PRE_MEM_WRITE( "rlimit64(old_rlim)", ARG4, sizeof(struct vki_rlimit64) ); - if (ARG3 && - ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur - > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { - SET_STATUS_Failure( VKI_EINVAL ); - } - else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { + if (ARG3) { + if (ML_(safe_to_deref)( (void*)(Addr)ARG3, sizeof(struct vki_rlimit64) )) { + if (((struct vki_rlimit64 *)(Addr)ARG3)->rlim_cur + > ((struct vki_rlimit64 *)(Addr)ARG3)->rlim_max) { + SET_STATUS_Failure( VKI_EINVAL ); + } + } + } else if (ARG1 == 0 || ARG1 == VG_(getpid)()) { switch (ARG2) { case VKI_RLIMIT_NOFILE: SET_STATUS_Success( 0 ); |
From: Paul F. <pj...@wa...> - 2025-05-19 06:38:16
|
On 5/16/25 11:41, Mark Wielaard wrote: > How many commit are there for freebsd to cherry-pick? > If you give me a list I can do them for you. > Hi Mark There are 2 for sure and 2 if you'd like to add the new vgstack script to 3.25.1. Definitely: commit 4f3f688a31ef1a213bd1a3a9e897e99cfe3950f6 Author: Paul Floyd <pj...@wa...> Date: Fri May 16 07:58:02 2025 +0200 Bug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred commit 8dbf86733e76d30c194f5321a72c6b44f1055e20 Author: Paul Floyd <pj...@wa...> Date: Fri May 16 21:32:02 2025 +0200 FreeBSD regtest: updates for FreeBSD 15.0-CURRENT Maybe: commit 568ce38ac76e1cefc20b006c7da8cf7bf2209596 Author: Paul Floyd <pj...@wa...> Date: Tue May 13 20:34:48 2025 +0200 Bug 504101 - Add a "vgstack" script commit 382efd0ccbe8447eca4bde0068a205a01d02f90e Author: Paul Floyd <pj...@wa...> Date: Mon May 19 08:23:57 2025 +0200 Script: move vgstack to configure.ac section with chmod -x Regards Paul |
From: Paul F. <pa...@so...> - 2025-05-19 06:30:30
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c0791f593265dcb6356a471eebd2594b4619dc7f commit c0791f593265dcb6356a471eebd2594b4619dc7f Author: Paul Floyd <pj...@wa...> Date: Mon May 19 08:29:57 2025 +0200 .gitignore: add /none/tests/fdleak_doubleclose0 Diff: --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index be8c1a2687..5264bdd29a 100644 --- a/.gitignore +++ b/.gitignore @@ -1570,6 +1570,7 @@ /none/tests/fdbaduse /none/tests/fdleak_cmsg /none/tests/fdleak_creat +/none/tests/fdleak_doubleclose0 /none/tests/fdleak_dup /none/tests/fdleak_dup2 /none/tests/fdleak_fcntl |
From: Paul F. <pa...@so...> - 2025-05-19 06:29:19
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=382efd0ccbe8447eca4bde0068a205a01d02f90e commit 382efd0ccbe8447eca4bde0068a205a01d02f90e Author: Paul Floyd <pj...@wa...> Date: Mon May 19 08:23:57 2025 +0200 Script: move vgstack to configure.ac section with chmod -x Previously wasn't possible to run it in place without doing a chmod -x on it first. Diff: --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index caa79c0147..a235f1a424 100755 --- a/configure.ac +++ b/configure.ac @@ -5699,7 +5699,6 @@ AC_CONFIG_FILES([ auxprogs/Makefile mpi/Makefile coregrind/Makefile - coregrind/vgstack memcheck/Makefile memcheck/tests/Makefile memcheck/tests/common/Makefile @@ -5791,6 +5790,8 @@ AC_CONFIG_FILES([coregrind/link_tool_exe_darwin], [chmod +x coregrind/link_tool_exe_darwin]) AC_CONFIG_FILES([coregrind/link_tool_exe_solaris], [chmod +x coregrind/link_tool_exe_solaris]) +AC_CONFIG_FILES([coregrind/vgstack], + [chmod +x coregrind/vgstack]) AC_CONFIG_FILES([tests/filter_stderr_basic], [chmod +x tests/filter_stderr_basic]) AC_CONFIG_FILES([tests/filter_discards], |
From: Mark W. <ma...@so...> - 2025-05-18 19:39:41
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8187386962598d1393eaf6cf4e032996f5edabb3 commit 8187386962598d1393eaf6cf4e032996f5edabb3 Author: Mark Wielaard <ma...@kl...> Date: Sun May 18 15:31:36 2025 +0200 Check whether file descriptor is inherited before printing where_opened Inherited file descriptors don't have an ExeContext where they were opened (by the program). So don't try to print the NULL where_opened when reporting double close errors for such file descriptors. Add a testcase none/tests/fdleak_doubleclose0 that crashes valgrind before this fix. https://bugs.kde.org/show_bug.cgi?id=504466 Diff: --- coregrind/m_syswrap/syswrap-generic.c | 13 +++++++++---- none/tests/Makefile.am | 3 ++- none/tests/fdleak_doubleclose0.c | 10 ++++++++++ none/tests/fdleak_doubleclose0.stderr.exp | 12 ++++++++++++ none/tests/fdleak_doubleclose0.vgtest | 3 +++ 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 81c8fc028d..98cbb172fd 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -637,7 +637,8 @@ struct BadCloseExtra { HChar *description; /* Description of the file descriptor might include the pathname */ ExeContext *where_closed; /* record the last close of fd */ - ExeContext *where_opened; /* recordwhere the fd was opened */ + ExeContext *where_opened; /* recordwhere the fd was opened, + NULL if inherited file descriptor */ }; struct FdBadUse { @@ -646,7 +647,8 @@ struct FdBadUse { HChar *description; /* Description of the file descriptor might include the pathname */ ExeContext *where_closed; /* record the last close of fd */ - ExeContext *where_opened; /* recordwhere the fd was opened */ + ExeContext *where_opened; /* recordwhere the fd was opened, + NULL if inherited file descriptor */ }; struct NotClosedExtra { @@ -1197,8 +1199,11 @@ void fd_pp_Error (const Error *err) VG_(pp_ExeContext)( where ); VG_(emit)("%sPreviously closed%s\n", auxpre, auxpost); VG_(pp_ExeContext)(bce->where_closed); - VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); - VG_(pp_ExeContext)(bce->where_opened); + // Inherited file descriptors where never opened (by the program) + if (bce->where_opened) { + VG_(emit)("%sOriginally opened%s\n", auxpre, auxpost); + VG_(pp_ExeContext)(bce->where_opened); + } } else if (VG_(get_error_kind)(err) == FdNotClosed) { if (xml) VG_(emit)(" <kind>FdNotClosed</kind>\n"); struct NotClosedExtra *nce = (struct NotClosedExtra *) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index bebc2f4dd1..6305044ca6 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -150,6 +150,7 @@ EXTRA_DIST = \ fdleak_creat_xml.stderr.exp fdleak_creat_xml.vgtest \ fdleak_creat_sup.stderr.exp fdleak_creat_sup.supp \ fdleak_creat_sup.vgtest \ + fdleak_doubleclose0.stderr.exp fdleak_doubleclose0.vgtest \ fdleak_dup.stderr.exp fdleak_dup.vgtest \ fdleak_dup_xml.stderr.exp fdleak_dup_xml.vgtest \ fdleak_dup2.stderr.exp fdleak_dup2.vgtest \ @@ -283,7 +284,7 @@ check_PROGRAMS = \ bug492678 \ closeall coolo_strlen \ discard exec-sigmask execve faultstatus fcntl_setown \ - fdleak_cmsg fdleak_creat fdleak_dup fdleak_dup2 \ + fdleak_cmsg fdleak_creat fdleak_doubleclose0 fdleak_dup fdleak_dup2 \ fdleak_fcntl fdleak_ipv4 fdleak_open fdleak_pipe \ fdleak_socketpair \ floored fork fucomip \ diff --git a/none/tests/fdleak_doubleclose0.c b/none/tests/fdleak_doubleclose0.c new file mode 100644 index 0000000000..83c89a8c4b --- /dev/null +++ b/none/tests/fdleak_doubleclose0.c @@ -0,0 +1,10 @@ +#include <unistd.h> + +int main (int argc, char **argv) +{ + close (0); + close (1); + close (1); + close (0); + return 0; +} diff --git a/none/tests/fdleak_doubleclose0.stderr.exp b/none/tests/fdleak_doubleclose0.stderr.exp new file mode 100644 index 0000000000..6487cf8a42 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.stderr.exp @@ -0,0 +1,12 @@ +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main +File descriptor ...: ... is already closed + at 0x........: close (in /...libc...) + by 0x........: main + Previously closed + at 0x........: close (in /...libc...) + by 0x........: main diff --git a/none/tests/fdleak_doubleclose0.vgtest b/none/tests/fdleak_doubleclose0.vgtest new file mode 100644 index 0000000000..36d3e36a60 --- /dev/null +++ b/none/tests/fdleak_doubleclose0.vgtest @@ -0,0 +1,3 @@ +prog: fdleak_doubleclose0 +vgopts: -q --track-fds=yes +stderr_filter: filter_fdleak |
From: Mark W. <ma...@so...> - 2025-05-17 21:22:10
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=69b931e1216d48b91d51fdffc526cff84bf72b9f commit 69b931e1216d48b91d51fdffc526cff84bf72b9f Author: Mark Wielaard <ma...@kl...> Date: Sun May 11 23:12:15 2025 +0200 More gdb filtering for glibc 2.41 with debuginfo installed (cherry picked from commit 3404f081ed2027ccdb756c87bcaea7f95fd0525a) Diff: --- gdbserver_tests/filter_gdb.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdbserver_tests/filter_gdb.in b/gdbserver_tests/filter_gdb.in index d7b1bb11c6..681376e488 100755 --- a/gdbserver_tests/filter_gdb.in +++ b/gdbserver_tests/filter_gdb.in @@ -137,6 +137,12 @@ s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../ # in __syscall_cancel_arch is just in a syscall s/in __syscall_cancel_arch .*/in syscall .../ +# as is just __syscall_cancel_arch +s/__syscall_cancel_arch .*/0x........ in syscall .../ + +# gdb with source might figure out there is just a ret instruction +/^[1-9][0-9\t ]*ret$/d + # do_syscall is in syscall s/__libc_do_syscall ().*/0x........ in syscall .../ |
From: Mark W. <ma...@so...> - 2025-05-17 21:22:05
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=9a9a4261106cfb10e5dca7348c6e6e98c5a0bd91 commit 9a9a4261106cfb10e5dca7348c6e6e98c5a0bd91 Author: Paul Floyd <pj...@wa...> Date: Sun May 11 10:28:01 2025 +0200 Linux PPC64 syscall: add sys_io_pgetevents (cherry picked from commit 01f66db19fd91bbe869d1272ab67e441396cabe5) Diff: --- coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + include/vki/vki-scnums-ppc64-linux.h | 1 + 2 files changed, 2 insertions(+) diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 7a79c6dee3..007fa6336c 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1022,6 +1022,7 @@ static SyscallTableEntry syscall_table[] = { LINXY(__NR_statx, sys_statx), // 383 GENX_(__NR_rseq, sys_ni_syscall), // 387 + LINX_(__NR_io_pgetevents, sys_io_pgetevents), // 388 LINXY(__NR_io_uring_setup, sys_io_uring_setup), // 425 LINXY(__NR_io_uring_enter, sys_io_uring_enter), // 426 diff --git a/include/vki/vki-scnums-ppc64-linux.h b/include/vki/vki-scnums-ppc64-linux.h index a76fa6d322..6d8b2b508c 100644 --- a/include/vki/vki-scnums-ppc64-linux.h +++ b/include/vki/vki-scnums-ppc64-linux.h @@ -408,6 +408,7 @@ #define __NR_pkey_free 385 #define __NR_pkey_mprotect 386 #define __NR_rseq 387 +#define __NR_io_pgetevents 388 #endif /* __VKI_SCNUMS_PPC64_LINUX_H */ |
From: Mark W. <ma...@so...> - 2025-05-17 21:21:56
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=45d661391164aa4baa0802fade6ce9e2afdf7d26 commit 45d661391164aa4baa0802fade6ce9e2afdf7d26 Author: Ivan Tetyushkin <iva...@sy...> Date: Mon Apr 21 11:59:48 2025 +0300 riscv64: Fix nan-boxing for single-precision calculations For float values, for arithmetics we expect to have canonical nan if used double register is not currectly nan-boxed. https://bugs.kde.org/show_bug.cgi?id=503098 (cherry picked from commit 9dd24c9b57cde064ca8b356c985b2e1cb7972adc) Diff: --- NEWS | 1 + VEX/priv/guest_riscv64_toIR.c | 28 +++++++++++++++++++++------- none/tests/riscv64/float32.c | 6 ++++++ none/tests/riscv64/float32.stdout.exp | 3 +++ 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 533b008166..2a373a02e1 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ Branch 3.25 The following bugs have been fixed or resolved on this branch. +503098 Incorrect NAN-boxing for float registers in RISC-V 503641 close_range syscalls started failing with 3.25.0 503914 mount syscall param filesystemtype may be NULL 504177 FILE DESCRIPTORS banner shows when closing some inherited fds diff --git a/VEX/priv/guest_riscv64_toIR.c b/VEX/priv/guest_riscv64_toIR.c index 5d9b903c9b..ee9580520a 100644 --- a/VEX/priv/guest_riscv64_toIR.c +++ b/VEX/priv/guest_riscv64_toIR.c @@ -522,9 +522,13 @@ static IRExpr* getFReg32(UInt fregNo) vassert(fregNo < 32); /* Note that the following access depends on the host being little-endian which is checked in disInstr_RISCV64(). */ - /* TODO Check that the value is correctly NaN-boxed. If not then return - the 32-bit canonical qNaN, as mandated by the RISC-V ISA. */ - return IRExpr_Get(offsetFReg(fregNo), Ity_F32); + IRExpr* f64 = getFReg64(fregNo); + IRExpr* high_half = unop(Iop_64HIto32, unop(Iop_ReinterpF64asI64, f64)); + IRExpr* cond = binop(Iop_CmpEQ32, high_half, mkU32(0xffffffff)); + IRExpr* res = IRExpr_ITE( + cond, IRExpr_Get(offsetFReg(fregNo), Ity_F32), + /* canonical nan */ unop(Iop_ReinterpI32asF32, mkU32(0x7fc00000))); + return res; } /* Write a 32-bit value into a guest floating-point register. */ @@ -2162,8 +2166,10 @@ static Bool dis_RV64F(/*MB_OUT*/ DisResult* dres, UInt rs2 = INSN(24, 20); UInt imm11_0 = INSN(31, 25) << 5 | INSN(11, 7); ULong simm = vex_sx_to_64(imm11_0, 12); - storeLE(irsb, binop(Iop_Add64, getIReg64(rs1), mkU64(simm)), - getFReg32(rs2)); + // do not modify the bits being transferred; + IRExpr* f64 = getFReg64(rs2); + IRExpr* i32 = unop(Iop_64to32, unop(Iop_ReinterpF64asI64, f64)); + storeLE(irsb, binop(Iop_Add64, getIReg64(rs1), mkU64(simm)), i32); DIP("fsw %s, %lld(%s)\n", nameFReg(rs2), (Long)simm, nameIReg(rs1)); return True; } @@ -2458,8 +2464,16 @@ static Bool dis_RV64F(/*MB_OUT*/ DisResult* dres, INSN(24, 20) == 0b00000 && INSN(31, 25) == 0b1110000) { UInt rd = INSN(11, 7); UInt rs1 = INSN(19, 15); - if (rd != 0) - putIReg32(irsb, rd, unop(Iop_ReinterpF32asI32, getFReg32(rs1))); + if (rd != 0) { + // For RV64, the higher 32 bits of the destination register are filled + // with copies of the floating-point number’s sign bit. + IRExpr* freg = getFReg64(rs1); + IRExpr* low_half = unop(Iop_64to32, unop(Iop_ReinterpF64asI64, freg)); + IRExpr* sign = binop(Iop_And32, low_half, mkU32(1u << 31)); + IRExpr* cond = binop(Iop_CmpEQ32, sign, mkU32(1u << 31)); + IRExpr* high_part = IRExpr_ITE(cond, mkU32(0xffffffff), mkU32(0)); + putIReg64(irsb, rd, binop(Iop_32HLto64, high_part, low_half)); + } DIP("fmv.x.w %s, %s\n", nameIReg(rd), nameFReg(rs1)); return True; } diff --git a/none/tests/riscv64/float32.c b/none/tests/riscv64/float32.c index b63305a64e..f635bc7614 100644 --- a/none/tests/riscv64/float32.c +++ b/none/tests/riscv64/float32.c @@ -1578,6 +1578,12 @@ static void test_float32_additions(void) TESTINST_1_1_FI(4, "fcvt.s.lu fa0, a0", 0x0000000001000001, 0x60, fa0, a0); /* 2**24+1 (DYN-RMM) -> 2**24+2 (NX) */ TESTINST_1_1_FI(4, "fcvt.s.lu fa0, a0", 0x0000000001000001, 0x80, fa0, a0); + + // check nan-boxing + /* fabs.s rd, rs1 */ + TESTINST_1_2_F(4, "fsgnjx.s fa0, fa1, fa1", 0xfaffffff3f800000, + 0xfaffffff3f800000, 0x00, fa0, fa1, fa1); + } int main(void) diff --git a/none/tests/riscv64/float32.stdout.exp b/none/tests/riscv64/float32.stdout.exp index 013c7eda21..734370d518 100644 --- a/none/tests/riscv64/float32.stdout.exp +++ b/none/tests/riscv64/float32.stdout.exp @@ -1554,3 +1554,6 @@ fcvt.s.lu fa0, a0 :: fcvt.s.lu fa0, a0 :: inputs: a0=0x0000000001000001, fcsr=0x00000080 output: fa0=0xffffffff4b800001, fcsr=0x00000081 +fsgnjx.s fa0, fa1, fa1 :: + inputs: fa1=0xfaffffff3f800000, fa1=0xfaffffff3f800000, fcsr=0x00000000 + output: fa0=0xffffffff7fc00000, fcsr=0x00000000 |
From: Yao Zi <zi...@di...> - 2025-05-17 10:53:12
|
"-no-pie" is forwarded to the linker by compiler driver, instructing the linker not to produce a relocatable executable file. The flag has no effect when doing only compilation, where newer Clang considers it as unused arguments and warns about it. Such warnings are promoted as errors since we supply "-Werror" flag as well, causing configure.ac misdetects the availablity of "-no-pie" flag and failing building of test cases that cannot be compiled as PIE. Let's link the test program as well when checking compiler features to avoid such misdetection. Fixes: 84ad3a82c247 ("Fix compilation problems with some unit tests on Ubuntu 16.10+. Compiler produces position independent executables (PIE) by default which gets in the way of some unit tests. Fixes BZ#377066.") Signed-off-by: Yao Zi <zi...@di...> --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index caa79c0147cb..fdf510be4f4a 100755 --- a/configure.ac +++ b/configure.ac @@ -3000,7 +3000,7 @@ AC_MSG_CHECKING([if gcc accepts -no-pie]) safe_CFLAGS=$CFLAGS CFLAGS="-no-pie -Werror" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[ return 0; ]])], [ AC_SUBST([FLAG_NO_PIE], ["-no-pie"]) -- 2.49.0 |
From: Yao Zi <zi...@di...> - 2025-05-17 10:52:42
|
The inline assembly chunk contains abosulute address references to zz_int, which isn't practical in PIE files and results in text relocations. ld.bfd may throw out some warnings, depending on build-time configuration, warning: relocation in read-only section `.text' warning: creating DT_TEXTREL in a PIE and LLVM ld.lld doesn't even allow text relocations by default. Additionally, dynamic loader of musl-libc doesn't support text relocations, thus the test will segfault on musl even built successfully. Let's just apply @FLAG_NO_PIE@ for it and disable PIE. Signed-off-by: Yao Zi <zi...@di...> --- memcheck/tests/amd64-linux/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/memcheck/tests/amd64-linux/Makefile.am b/memcheck/tests/amd64-linux/Makefile.am index 26e8c8ed549c..240517f6258d 100644 --- a/memcheck/tests/amd64-linux/Makefile.am +++ b/memcheck/tests/amd64-linux/Makefile.am @@ -28,4 +28,5 @@ AM_CCASFLAGS += @FLAG_M64@ defcfaexpr_SOURCES = defcfaexpr.S defcfaexpr_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@ +int3_amd64_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@ reallocarray_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@ -- 2.49.0 |
From: Mark W. <ma...@so...> - 2025-05-16 22:37:51
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=2045aefbb0261bd5844b693e5d390affcffb8749 commit 2045aefbb0261bd5844b693e5d390affcffb8749 Author: Martin Cermak <mc...@re...> Date: Fri May 16 22:12:39 2025 +0200 PR503969: make ltpchecks: flatten the log structure Flatten the directory structure of make ltpchecks logs per PR503969#c9. Individual syscall tests are numbered, so that no testcase naming conflicts should show up. Demo upload: https://builder.sourceware.org/testrun/5b8f868b3e3c84801814dcd4ea963690f94fd2d1 Diff: --- auxprogs/ltp-tester.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/auxprogs/ltp-tester.sh b/auxprogs/ltp-tester.sh index 036f196ce2..54d807b0c2 100755 --- a/auxprogs/ltp-tester.sh +++ b/auxprogs/ltp-tester.sh @@ -9,7 +9,7 @@ fi ORIG_PATH=$PATH SCRIPT_SRC=$(dirname $0) -LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp} +LOGDIR=${LOGDIR:-$LTP_SRC_DIR/ltp/tests} DIFFCMD="diff -u" VALGRIND="${VALGRIND:-$LTP_SRC_DIR/../../../vg-in-place}" # For parallel testing, consider IO intensive jobs, take nproc into account @@ -36,11 +36,9 @@ doTest () echo "[$nr/$c] Testing $exe ..." pushd $dir >/dev/null PATH="$ORIG_PATH:$PWD" - t1=$(date +%s) ./$exe >$l/log1std 2>$l/log1err ||: $VALGRIND -q --tool=none --log-file=$l/log2 ./$exe >$l/log2std 2>$l/log2err ||: $VALGRIND -q --tool=memcheck --log-file=$l/log3 ./$exe >$l/log3std 2>$l/log3err ||: - t2=$(date +%s) # We want to make sure that LTP syscall tests give identical # results with and without valgrind. The test logs go to the @@ -56,34 +54,35 @@ doTest () # Check logs, report errors pushd $l >/dev/null if test -s log2; then - echo -e "${exe}: unempty log2:\n$(cat log2)" | tee -a $l/$exe.log + echo -e "${exe}: unempty log2:\n$(cat log2)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi if grep -f $SCRIPT_SRC/ltp-error-patterns.txt log* > error-patterns-found.txt; then - echo -e "${exe}: error string found:\n$(cat error-patterns-found.txt)" | tee -a $l/$exe.log + echo -e "${exe}: error string found:\n$(cat error-patterns-found.txt)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi if ! ${DIFFCMD} log1summary log2summary >/dev/null; then - echo -e "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" | tee -a $l/$exe.log + echo -e "${exe}: ${DIFFCMD} log1summary log2summary:\n$(${DIFFCMD} log1summary log2summary)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi if ! ${DIFFCMD} log2summary log3summary >/dev/null; then - echo -e "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" | tee -a $l/$exe.log + echo -e "${exe}: ${DIFFCMD} log2summary log3summary:\n$(${DIFFCMD} log2summary log3summary)" | tee -a $LOGDIR/$exe.log rv="FAIL" fi # synthetize automake style testlogs for bunsen import - echo ":test-result: $rv" | tee -a $l/$exe.log > $l/$exe.trs - echo "Test time secs: $((t2 - t1))" > $l/test-suite.log + echo ":test-result: $rv" | tee -a $LOGDIR/$exe.log > $LOGDIR/$exe.trs popd >/dev/null popd >/dev/null } cd $LTP_SRC_DIR +echo "See *.log files for details on each test in this directory." > $LOGDIR/test-suite.log + if [ -n "$TESTS" ]; then echo "Running individual syscall tests specified in the TESTS env var ..." mapfile -t files < <(find testcases/kernel/syscalls -executable -and -type f \ |