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.
Remove square root tests as they are covered by bfp-emit.pl
Likewise for multiplication.
Add tests for division.
New file bfp-arith.c: Check condition code of arithmetic ops.
Remove bfp-1.c
Part of https://bugs.kde.org/show_bug.cgi?id=509572
Paul Floyd [Mon, 22 Sep 2025 12:59:17 +0000 (14:59 +0200)]
gdbserver regtest: add return value to sleepers select error message
This is failing on FreeBSD 15 (looks like an OS or libc regression).
Improve the error message to make the problem clearer. errno is 0
but select is returning 93 (from a set of 0 fds!).
Paul Floyd [Sun, 21 Sep 2025 15:08:35 +0000 (17:08 +0200)]
Refactor: make try_get_interp extern and multi-plaftorm
Previously it was static and defined for Darwin, FreeBSD and Linux.
Now it is global VG_(args_the_exename) and has a length check.
Also fixed a nasty bug related to VG_(args_the_exename).
Initially this is set to point to the name of the client command
in Valgrinds own arguments. Later when checking for scripts or binaries
VG_(load_script) may get called recursively. If it gets called more than
once it sets VG_(args_the_exename) to point to the new name.
But that is on the stack. Later, if the stack grows too much the
name will get overwritten. I was seeing that with my first versions
of this code in the recursive tests in none/tests/scripts.
Now I'm allocating VG_(args_the_exename) on the heap.
Paul Floyd [Sat, 20 Sep 2025 17:20:50 +0000 (19:20 +0200)]
FreeBSD amd64: amd64 syscalls only ever need max 7 args
The only possible exception would be a syscall0 of SYS_sendfile
done by the host. Since we're never going to do that reduce the number
of arguments to 7.
For a BFP insn X in the guest code the same insn will be emitted in
the jitted code. This does not hold universally but for most BFP
insns it does.
bfp-emit.pl contains a complete list of all BFP insns as of Principles
of Operations SA22-7832-14. It tests all insns for which the above
observation is true and ensures the emitted insn matches the insn in
the guest code.
Part of fixing https://bugs.kde.org/show_bug.cgi?id=509572
Martin Cermak [Fri, 19 Sep 2025 15:25:30 +0000 (17:25 +0200)]
Wrap the mount_setattr syscall 442
int syscall(SYS_mount_setattr, int dirfd, const char *pathname,
unsigned int flags, struct mount_attr *attr, size_t size);
The mount_setattr() system call changes the mount properties of a
mount or an entire mount tree. If pathname is a relative pathname,
then it is interpreted relative to the directory referred to by the
file descriptor dirfd. If dirfd is the special value AT_FDCWD, then
pathname is interpreted relative to the current working directory of
the calling process. If pathname is the empty string and
AT_EMPTY_PATH is specified in flags, then the mount properties of the
mount identified by dirfd are changed
Declare a mount_setattr wrapper in priv_syswrap-linux.h and hook it
for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux
using LINX_ with PRE handler in syswrap-linux.c
Part of this update also is a fix of the sys_move_mount wrapper.
Specifically there was a typo mount_moce vs. move_mount, and also
there was a problem in handling VKI_AT_FDCWD special fd value in the
check for to_fd and to_pathname.
Martin Cermak [Fri, 19 Sep 2025 07:31:39 +0000 (09:31 +0200)]
Wrap the setdomainname syscall
The setdomainname() call sets the domain name to the value given in the
character array name. The len argument specifies the number of bytes in
name. (Thus, name does not require a terminating null byte.)
Declare a setdomainname wrapper in priv_syswrap-linux.h and hook it for
{amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux using
LINX_ with PRE handler in syswrap-linux.c
Remove stdout.exp file as it is not needed.
The mandatory .stderr.exp file was not empty even though disasm-test
does not write anything to stderr. Annoying!
../filter_stderr was doing it. Adjust filter_stderr accordingly and
let .stderr.exp reflect the actual output.
Martin Cermak [Fri, 19 Sep 2025 09:47:14 +0000 (11:47 +0200)]
Add missing ppc64-linux and s390x-linux syswraps existing on other arches
This update adds following ppc64le and s390x syswraps:
- sys_msgctl
- sys_semctl
- sys_semtimedop
- sys_sethostname
- sys_shmctl
- sys_sigpending
- sys_stime
This update adds following ppc64le syswraps:
- sys_setns
This update adds following s390x syswraps:
- sys_bpf
Blacklist the shmctl05, as it is a long running one. It does
pass on all architectures afaics, but needs a relatively high
LTP_TIMEOUT_MUL setting. So, let's skip that one.
Rewritten in perl.
Command line options added.
Minimise assembler file by throwing out any function prologue stuff GCC
might stick into a function. Also remove insns following the svc as they
are not reachable.
Error handling: capture errors/warnings from the assembler.
Why all this? https://bugs.kde.org/show_bug.cgi?id=509572
The quotactl_fd works in a similar way to quotactl. They both manipulate
disk quotas. They differ in how the target file system is specified.
While quotactl takes path, quotactl_fd takes a file descriptor.
Declare a quotactl_fd wrapper in priv_syswrap-linux.h and hook it for
{amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux using
LINX_ with PRE handler in syswrap-linux.c
Martin Cermak [Wed, 17 Sep 2025 14:27:09 +0000 (16:27 +0200)]
Run the LTP tests with LTP_QUIET
Introduce a new LTP_QUIET env var which suppresses certain
types of LTP log messages, specifically TCONF, TWARN, TINFO,
and TDEBUG. This helps us keep the test logs briefer, while
still keeping the important information in the logs.
This update avoids several false positives, specifically with
the following testcases: eventfd2_03, shmctl05, mlock03,
poll02, prctl09, setsockopt10, and select02.
This update also adds a brief summary for the LTP testsuite,
something like the following:
Paul Floyd [Wed, 17 Sep 2025 18:05:09 +0000 (20:05 +0200)]
FreeBSD regtest: clean up none auxv test
I got fed up with this changing all the time, needing endless
expecteds for x86, amd65, arm64, and each FreeBSD version
So now I'm generating the expected on the fly, doing the same auxv
filtering as previously plus swapping unsupported AT_ values
with AT_IGNORE / number 01. The awk script will still need occasional
maintenance but it should be less frequent.
Andreas Arnez [Wed, 10 Sep 2025 17:05:40 +0000 (19:05 +0200)]
Bug 509517 - s390x: Add even/odd-lane memcheck test for VME etc.
Add an s390x-specific memcheck test case for the correct handling of
even/odd lanes with various vector insns. The test fails before applying
the fix for Bug 509517 and succeeds afterwards.
Andreas Arnez [Mon, 15 Sep 2025 13:39:11 +0000 (15:39 +0200)]
Bug 509517 - s390x: Fix even/odd lane confusion for VME etc.
Fix the swapping of even/odd IROps generation in guest_s390_toIR.c for
VME, VMO, VMLE, VMLO, VMAE, VMAO, VMALE, and VMALO. Adjust the code
generation for the according IROps to match the documentation in
libvex_ir.h.
sys_futex_waitv - Wait on a list of futexes
@waiters: List of futexes to wait on
@nr_futexes: Length of futexv
@flags: Flag for timeout (monotonic/realtime)
@timeout: Optional absolute timeout.
@clockid: Clock to be used for the timeout, realtime or monotonic.
Given an array of `struct futex_waitv`, wait on each uaddr. The thread wakes
if a futex_wake() is performed at any uaddr. The syscall returns immediately
if any waiter has *uaddr != val. *timeout is an optional timeout value for
the operation. Each waiter has individual flags. The `flags` argument for
the syscall should be used solely for specifying the timeout as realtime, if
needed. Flags for private futexes, sizes, etc. should be used on the
individual flags of each waiter. Returns the array index of one of the woken
futexes. No further information is provided.
Declare a futex_waitv wrapper in priv_syswrap-linux.h
and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x\
,x86}- linux using LINX_ with PRE handler in syswrap-linux.c
Paul Floyd [Wed, 10 Sep 2025 19:53:22 +0000 (21:53 +0200)]
Helgrind regtest: use older C++ dialect for bug392331.cpp
Old versions of GCC (like 6.3) claim some C++17 support but
apparently not CTAD
https://en.cppreference.com/w/cpp/language/class_template_argument_deduction.html
So, go backwards and explicitly give the std::mutex template type for the locks.
Martin Cermak [Wed, 3 Sep 2025 14:02:26 +0000 (16:02 +0200)]
Wrap the remap_file_pages syscall
The remap_file_pages() system call is used to create a nonlinear
mapping, that is, a mapping in which the pages of the file are
mapped into a nonsequential order in memory. It is deprecated
but in some cases it may still be used. LTP remap_file_pages01
and remap_file_pages02 test-cover it.
Declare a remap_file_pages wrapper in priv_syswrap-linux.h
and hook it for {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x\
,x86}- linux using LINX_ with PRE handler in syswrap-linux.c