Paul Floyd [Thu, 30 Oct 2025 14:17:50 +0000 (15:17 +0100)]
Darwin regtest: changes to filters and sed commands
Darwin libc is quite incontinent, so use filter_xml_leak
in a few places rather than filter_xml.
Also old Darwin 17.7 sed doesn't understand "+1d" to delete the
matched line and the next line. So use N to join, s to delete the
newline and another match with d to delete the joined linbes.
Paul Floyd [Wed, 29 Oct 2025 13:25:04 +0000 (14:25 +0100)]
Darwin regtest: simplify memcheck filter_supp
The filter removes used suppression lines and duplicate lines.
Old Darwin sed doesn't understand 'M{}', so use "cat -s" to remove
duplicate blank lines instead.
Florian Krohm [Sun, 26 Oct 2025 21:45:32 +0000 (21:45 +0000)]
s390x: Enable "convert to logical" BFP test
This was disabled because I had thought that a negative
operand value should result in a condition code of 1. Not so.
Additionally the operand value must be 0 after rounding.
Mark Wielaard [Sun, 26 Oct 2025 14:23:23 +0000 (15:23 +0100)]
configure.ac: fix build lzcnt test to work on both i386 and amd64
The BUILD_LZCNT_TESTS conditional is used in both
none/tests/x86/Makefile.am and none/tests/amd64/Makefile.am to check
whether to build the lzcnt32 and lzcnt64 test program. However the
configure test uses %rax which is only available on amd64. Use %eax
instead to make sure the configure test succeeds on both i386 and
amd64.
Mark Wielaard [Fri, 24 Oct 2025 16:31:31 +0000 (18:31 +0200)]
Don't warn about fcntl F_GETFD with --track-fds
fcntl F_GETFD is used to check if a file descriptor is valid, so only
make sure it isn't a valgrind fd, otherwise we might warn, with
--track-fds=bad for any bad fd.
Martin Cermak [Mon, 13 Oct 2025 07:53:56 +0000 (09:53 +0200)]
Silence false positive failure of LTP munmap01
After upgrading LTP testsuite version to 20250930 (tracked in bug
510169) munmap01 syscall test started failing. It however turns out
that this testcase was substantially rewritten and the failure is
expected. This update will silence mentioned false positive.
New qExecAndArgs packet has been added recently to GDB's remote
protocol.
The new qExecAndArgs packet is sent from GDB, and gdbserver replies
with a packet that includes the executable filename and the arguments
string that were used for starting the initial inferior.
On the GDB side this information can be used to update GDB's state,
the 'show remote exec-file' will reflect how gdbserver was started,
and 'show args' will reflect the arguments used for starting the
inferior.
When running valgrind together with GDB like this:
All issues are similar to this:
--- mcblocklistsearch.stderrB.exp
+++ mcblocklistsearch.stderrB.out
@@ -1,7 +1,8 @@
vgdb-error value changed from 0 to 999999
-Breakpoint 1 at 0x........: file leak-tree.c, line 42.
-Breakpoint 2 at 0x........: file leak-tree.c, line 68.
+Haltepunkt 1 at 0x........: file leak-tree.c, line 42.
+Haltepunkt 2 at 0x........: file leak-tree.c, line 68.
Continuing.
+Warnung: Missing auto-load script at offset 0 in section .debug_gdb_scripts
Breakpoint 1, f () at leak-tree.c:42
42 t->l = mk(); // B
Continuing.
@@ -63,4 +64,4 @@
0x........[16] indirect loss record 4
0x........[16] indirect loss record 5
monitor command request to kill this process
-Remote connection closed
+Remote Verbindung wurde beendet
Mark Wielaard [Thu, 23 Oct 2025 23:12:19 +0000 (01:12 +0200)]
configure.ac: Use primary arch flags for openssl and libaio checks
Make sure that the configure check for openssl/crypto and libaio use
the primary arch flags. These are used in testcases for the primary
arch and should compile and link with the primary arch flags (which
are empty on most arches, but are set explicitly on e.g. mips).
Move the libaio check after the compiler check flags.
Make function check_valgrind_output actually check something..
Remove --check-prereq logic. It is not needed. I think I was doing some
experiment of using objdump to make sure the insns written out by
valgrind match those produced by objdump. And then there was different
behaviour of objdump in different versions.
Mark Wielaard [Mon, 20 Oct 2025 17:11:41 +0000 (19:11 +0200)]
Update NEWS with more items
- Make BUILD_DOCS controls building documentation.
- LTP integration has been updated to v20250930.
- New Linux syscall wrappers (cachestat, futex_waitv, listmount,
mount_setattr, mseal, quotactl_fd, remap_file_pages, setdomainname,
statmount, swapoff, swapon, sysfs and ustat).
- New --modify-fds=yes is like --modify-fds=high except for fds 0,1,2.
- New --track-fds=bad only produces errors for bad file descriptor usage.
- With --xml=yes log now always uses output protocol 6.
- vgdb now handles the qExecAndArgs packet.
- DWARF inlined subroutine handling has been rewritten to work cross CUs.
Mark Wielaard [Mon, 20 Oct 2025 17:04:25 +0000 (19:04 +0200)]
Document FdBadUse in xml-output-protocol5.txt
The core error FdBadUse was added in commit 22971a15d62d
"Report track-fd errors for fd used which was not opened or already closed"
But not documented. Add it to the protocol documentation now.
GCC notices that this_seg is set, but never really used in this
function
m_debuginfo/readpdb.c: In function 'DEBUG_SnarfLinetab':
m_debuginfo/readpdb.c:1542:23: warning: variable 'this_seg' set but not used [-Wunused-but-set-variable=]
1542 | Int this_seg;
| ^~~~~~~~
Mark Wielaard [Sun, 12 Oct 2025 21:57:43 +0000 (23:57 +0200)]
Upgrade to GNU General Public License version 3
- Update COPYING and VEX/LICENSE.GPL to version 3.
- Update README, NEWS, docs/manual license and contributing text.
- Update file headers to say either version 3 of the License,
or (at your option) any later version.
- Leave tests and perf file headers as is, unless the code is derived
from Valgrind/VEX.
- Leave valgrind.h, cachegrind.h, callgrind.h, drd.h, helgrind.h,
memcheck.h and dhat.h Hybrid-BSD licensed.
Mark Wielaard [Fri, 17 Oct 2025 16:23:58 +0000 (18:23 +0200)]
Keep at least one frame while peeling syscall frames
VG_(get_StackTrace_with_deltas) might peel extra glibc syscall
(cancel) frames. But if the backtrace failed, or only contains such
syscall frames then we should keep at least one (the initial frame will
always be there). Various routines expect n_ips of a Stacktrace to be
at least 1.
New qExecAndArgs packet has been added recently to GDB's remote
protocol.
The new qExecAndArgs packet is sent from GDB, and gdbserver replies
with a packet that includes the executable filename and the arguments
string that were used for starting the initial inferior.
On the GDB side this information can be used to update GDB's state,
the 'show remote exec-file' will reflect how gdbserver was started,
and 'show args' will reflect the arguments used for starting the
inferior.
When running Valgrind from inside GDB, we can see that GDB actually
sends the packet to vgdb and vgdb is able to respond to it.
[remote] Sending packet: $qExecAndArgs#96
[remote] Packet received: U
[remote] packet_ok: Packet qExecAndArgs (fetch-exec-and-args) is supported
To be able to run Valgrind from inside GDB we currently have to set
remote exec-file and our goal is to avoid that to make running Valgrind
from GDB easier for the users. There's work on GDB side which should allow
us to avoid this soon.
When vgdb replies with 'U', it indicates that no executable has been set.
GDB sees that the executable that it has loaded is inside the sysroot
(which we set with 'set sysroot /'), then GDB knows that the remote and
GDB can see the same file. GDB will then automatically use the current
executable path as the remote exec-file value.
Paul Floyd [Tue, 14 Oct 2025 06:27:16 +0000 (08:27 +0200)]
Fix exe name warnings
Most of the exe name functions can take a const char* for the name.
Indeed, on Linux this is a requirement since we also lookup
debuginfod-find using a const char string literal.
The exception to this rule is for scripts. In this case the script
shebang can refer to another script with another shebang. And so on
until eventually an ELF or macho file is encountered. In that case
VG_(args_the_exename) will get freed if necessary and reassigned
to a new string. So VG_(load_script) needs to be able to take a
non-const char* name, unlike VG_(load_ELF) and VG_(load_macho).
VG_(args_the_exename) is now non-const (which fixes a warning
when freeing it), VG_(load_script) takes a non-const name
and there is an ugly cast for the function pointer.
Paul Floyd [Mon, 13 Oct 2025 07:18:18 +0000 (09:18 +0200)]
FreeBSD syscall wrapper: fix warning
Was giving
m_syswrap/syswrap-main.c:370:28: warning: variable 'saved' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]
370 | syscall_mask, &saved, sizeof(vki_sigset_t)
| ^~~~~
Initialising it is probably the safest thing to do, but I suspect that the
argument ought not to be const. Will check on that.
While I'm at it, looking at how Solaris handles the carry flag it's much
better than the global variable used by FreeBSD and Darwin. Will check on
that as well.
Paul Floyd [Mon, 13 Oct 2025 06:38:09 +0000 (08:38 +0200)]
configure and make: add configure checks for C++ exception warnings
Add checks for -Wno-implicit-exception-spec-mismatch
(FLAG_W_NO_IMPLICIT_EXCEPTION_SPEC_MISMATCH)
and -Wno-missing-exception-spec
(FLAG_W_NO_MISSING_EXCEPTION_SPEC)
Also we should clean up C++ flag checking a bit. If all checks get
grouped together than just one AC_LANG(C++)/AC_LANG(C) would be
needed.
Paul Floyd [Sun, 12 Oct 2025 11:29:45 +0000 (13:29 +0200)]
FreeBSD regtest: add a prereq for bug452274
This test tends to hang when running in a VM. The problem is that
the test spams both syscalls (write) and signals (SIGVTALRM from
setitimer). The test halts after 100 signals have been handled.
Under VirtualBox the timer signals get starved by the syscalls
and the limit of 100 doesn't get reached (at least not in any
reasonable amount of time).
Martin Cermak [Thu, 2 Oct 2025 15:11:50 +0000 (17:11 +0200)]
Update the LTP version in valgrind testsuite to v20250930
Update the LTP version in valgrind testsuite to v20250930.
All patches from auxprogs/ltp-patches were accepted by LTP
upstream and included in the release, so these can now be
dropped locally.
Andreas Arnez [Thu, 9 Oct 2025 11:42:39 +0000 (13:42 +0200)]
s390x: Make IBM z17 known to Valgrind
Make the IBM z17 machine model 9175 known to Valgrind. Also add the
expected output of the s390x-specific "ecag" test case on an IBM z17, so
the test case succeeds on that system.
Florian Krohm [Fri, 3 Oct 2025 16:26:55 +0000 (16:26 +0000)]
Control building documentation (BZ 495483)
Introduce Makefile variable BUILD_DOCS with these possible values:
none - does not build any documentation
all - builds all documentation
html - builds HTML docs but skips building PDFs
BUILD_ALL_DOCS is still recognised for backward compatibility and
is mapped to BUILD_DOCS like so:
If not specified --> BUILD_DOCS=all
BUILD_ALL_DOCS=yes --> BUILD_DOCS=all
BUILD_ALL_DOCS=no --> BUILD_DOCS=html
On some file systems the testfiles 1000 and 1001 come out in different
order. Add filter_sort to sort the output lines to always appear at the
same order.
Florian Krohm [Wed, 1 Oct 2025 12:19:13 +0000 (12:19 +0000)]
VEX: Remove algebraic simplification for shift IROps.
Shl/Shr/Sar(0,x) ==> 0
Don't. Because doing so removes the undefined behaviour in case the shift
amount is out of range. This is also consistent with what constant folding
does in this case, namely, passing the undefined behaviour down the VEX
pipeline.
s390: Add testcases for unhandled IEEE exceptions. Fixes BZ 306098
New emulation warnings: EmWarn_S390X_XxC_not_zero and EmWarn_S390X_XiC_not_zero
New testcases bfp-XxC, dfp-XxC, and dfp-XiC.
New testcase driver emwarn-gen.pl to get around valgrind's restriction
on the number of emulation warnings.
Andreas Arnez [Mon, 29 Sep 2025 14:11:04 +0000 (16:11 +0200)]
s390x: Fix inline assembly for STFLE
The inline assembly for emitting the STFLE instruction changes GPR 0, but
fails to mention it in the clobber list. Depending on the compiler's
mood, this may result in wrong code.
A simple fix would be to just add "0" to the clobber list, but for
readability it also helps to move the inline assembly to a separate
function. So do that. In that function, use an "asm" variable for GPR 0
instead of moving the value back and forth between registers.
Rename rounding-1 to bfp-306054 because that was the corresponding BZ.
Rename bfp-3 to bfp-muldiv as it is more expressive.
Only compile testcases for 128-bit BFP if the compiler supports -mlong-double-128.
Add -mlong-double-128 to the compile flags for the files that need it.
This concludes fixing https://bugs.kde.org/show_bug.cgi?id=509572
Mark Wielaard [Wed, 24 Sep 2025 21:16:29 +0000 (23:16 +0200)]
Deal with linux arches that don't have getdents, only getdents64
Not all linux arches have getdents, some newer arches (arm64 and
riscv64) only implement getdents64. So only use the function
filter_valgrind_fds_from_getdents_with_refill on linux with
__NR_getdents.
Also move the getdents_filter testcase under none/tests/linux and only
use getdents64.
Fixes: e8e4066c3a01 ("Filter Valgrind FDs from getdents syscalls")
https://bugs.kde.org/show_bug.cgi?id=331311
s390: Reorg and extend BFP "convert to/from fixed/logical" testcases
Testing these insns was spread over 3 testcases: rounding-3, fpconv,
and fpext.
rounding-3 was testing "convert to fixed" with rounding per FPC.
fpext was testing "convert to/from logical" with rounding per M3 field.
fpconv was testing "convert to/from fixed" with rounding per M3 field.
The new testcase bfp-convert replaces these 3. It removes the
"convert from fixed/logical" testing because that is done in bfp-emit.pl.
It consolidates end extends "convert to fixed/logical" testing from
those files.
Testing "convert to logical" has been commented out until the condition
code weirdness for negative input values has been sorted.
Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572
This change prevents client programs from seeing Valgrind's internal file
descriptors when scanning /proc/self/fd or /proc/<pid>/fd.
This patch modifies the getdents and getdents64 syscall wrappers to
selectively filter out Valgrind's internal file descriptors only when
listing /proc/*/fd directories for the current process.
Add none/tests/getdents_filter.vgtest test that tests that the
Valgrind's file descriptors are hidden from the client program
and verifies both /proc/self/fd filtering and that regular
directory listings remain unfiltered.