]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
3 weeks agoFreeBSD regtest: small cleanup of kenv test
Paul Floyd [Sat, 12 Jul 2025 18:20:06 +0000 (20:20 +0200)] 
FreeBSD regtest: small cleanup of kenv test

Suppress uninitialised warning
Remove res variable that was copied and pasted

3 weeks agoFreeBSD syscall: improve kenv wrapper and add a test for it
Paul Floyd [Sat, 12 Jul 2025 14:21:29 +0000 (16:21 +0200)] 
FreeBSD syscall: improve kenv wrapper and add a test for it

3 weeks agoAdd program to double-check VEX constant folding. BZ 506211
Florian Krohm [Sat, 12 Jul 2025 13:32:14 +0000 (13:32 +0000)] 
Add program to double-check VEX constant folding. BZ 506211

Using IR injection. Essentially:
- prepare input values for an IROp
- create an IRExpr for the IRop
- constant fold the expression
- make sure the result is an IRConst with the expected value

Only IROps with integer operands and result are supported.
No vector and floating point IROps. Maximum bit width is 64.

Part of fixing https://bugs.kde.org/show_bug.cgi?id=506211

3 weeks agolinux mseal PRE wrapper should First check for overflow
Mark Wielaard [Fri, 11 Jul 2025 17:58:53 +0000 (19:58 +0200)] 
linux mseal PRE wrapper should First check for overflow

According to https://docs.kernel.org/next/userspace-api/mseal.html
mseal returns -EINVAL when Address range (addr + len) overflow. The
LTP test mseal02 checks this. So do this check first before checking
for valid_client_addr (which returns -ENOMEM).

3 weeks agoAdd auxprogs/filters/prctl10
Mark Wielaard [Fri, 11 Jul 2025 15:36:05 +0000 (17:36 +0200)] 
Add auxprogs/filters/prctl10

The LTP prctl10 test under memcheck has a child process dumping core.
Filter out the normal warning about this.

3 weeks agoCheck ppoll ufds array is safe to deref before checking fd members
Mark Wielaard [Fri, 11 Jul 2025 15:18:47 +0000 (17:18 +0200)] 
Check ppoll ufds array is safe to deref before checking fd members

LTP ppoll01 provides a bad fds array to ppoll as a testcase.
memcheck should warn (through PRE_MEM_READ) this array is bad.
But it shouldn't try to derefence anything if is isn't safe.

4 weeks agoAdd fcntl14{,_64}, fcntl34{,_64} and fcntl36{,_64} to ltp-excludes.txt
Mark Wielaard [Thu, 10 Jul 2025 21:09:18 +0000 (23:09 +0200)] 
Add fcntl14{,_64}, fcntl34{,_64} and fcntl36{,_64} to ltp-excludes.txt

These fcntl syscall tests time out and would need at least
LTP_TIMEOUT_MUL=5 when run under memcheck, which is several minutes,
so exclude them for now.

4 weeks agoFreeBSD syscall: make syscall kenv unhandles actions a -v warning
Paul Floyd [Thu, 10 Jul 2025 18:40:43 +0000 (20:40 +0200)] 
FreeBSD syscall: make syscall kenv unhandles actions a -v warning

Was VG_(unimplemented) which bombs. That's a bit drastic for a syscall intented
to be called directly by users.

4 weeks agoFreeBSD syscall: remove duplicate dead code from sysarch PRE wrapper
Paul Floyd [Thu, 10 Jul 2025 18:20:20 +0000 (20:20 +0200)] 
FreeBSD syscall: remove duplicate dead code from sysarch PRE wrapper

Probably a copy and paste error.

4 weeks agoSuppress unimplemented fcntl command warning with -q
Mark Wielaard [Wed, 9 Jul 2025 16:27:17 +0000 (18:27 +0200)] 
Suppress unimplemented fcntl command warning with -q

LTP tests fcntl13 and fcntl13_64 fail because even with -q valgrind
emits warnings about unknown (999) fcntl commands. Don't emit that
message with -q, just fail with EINVAL.

4 weeks agoBetter report which clone flag are problematic
Mark Wielaard [Wed, 9 Jul 2025 11:04:51 +0000 (13:04 +0200)] 
Better report which clone flag are problematic

Be explict about which combination of CLONE_VM, CLONE_FS, CLONE_FILES
and CLONE_VFORK flags are supported and which combination isn't.

https://bugs.kde.org/show_bug.cgi?id=506795

4 weeks agoFix operand / result types of Iop_DivU128[E], Iop_ModU128 and their signed counterparts
Florian Krohm [Wed, 9 Jul 2025 20:15:46 +0000 (20:15 +0000)] 
Fix operand / result types of Iop_DivU128[E], Iop_ModU128 and their signed counterparts

In libvex_ir.h these IROps are described to operate on Ity_I128 operands and produce a like typed result. This contradicts the specification in ir_defs.c
(function typeOfprimop) which claims Ity_V128 for operands and result.

Above IROps are used exclusively by ppc for the following opcodes:
Iop_DivU128  --> vdivuq  Vector Divide Unsigned Quadword
Iop_DivS128  --> vdivsq  Vector Divide Signed Quadword
Iop_DivU128E --> vdiveuq Vector Divide Extended Unsigned Quadword
Iop_DivS128E --> vdivesq Vector Divide Extended Signed Quadword
Iop_ModU128  --> vmoduq  Vector Modulo Unsigned Quadword
Iop_ModS128  --> vmodsq  Vector Modulo Signed Quadword

Reading the ISA document, it is clear, that those opcodes perform an
integer division / modulo operation. Technically, they work on vector
registers, presumably because vector registers are the only resource
wide enough to store a quadword. Perhaps that is where the confusion
comes from.
So Ity_I128 it is.

4 weeks agoRefactor IRICB
Florian Krohm [Tue, 8 Jul 2025 09:45:47 +0000 (09:45 +0000)] 
Refactor IRICB

So far there was only one application of IR injection, namely vbit-test.
Soonish there will be another.
Refactor the IRICB to separate out the structure for the application's
payload.

4 weeks agoFix VEX/useful/Makefile-vex again
Paul Floyd [Tue, 8 Jul 2025 06:27:20 +0000 (08:27 +0200)] 
Fix VEX/useful/Makefile-vex again

Again a hard coded error, using cc. Replace that with ${CC} so that
it uses the default system or user specified compiler.

4 weeks agoFix VEX/useful/Makefile-vex
Paul Floyd [Tue, 8 Jul 2025 06:14:56 +0000 (08:14 +0200)] 
Fix VEX/useful/Makefile-vex

This uses hard coded 'make' which may mean Solaris make or
BSD make ratheer than the initial invokation (e.g., gmake or some
other make that is not first inthe PATH). Use ${MAKE} instead
so that the same make is used for the second invokation.

4 weeks agoFix VEX/Makefile-gcc
Florian Krohm [Mon, 7 Jul 2025 20:17:38 +0000 (20:17 +0000)] 
Fix VEX/Makefile-gcc

Compile errors because config.h not found. Turns out libvex_inner.h
Also missing was priv/host_generic_reg_alloc3.o causing linking to fail.
Now fixed.

4 weeks agoAdd vgstack to NEWS
Paul Floyd [Mon, 7 Jul 2025 18:05:50 +0000 (20:05 +0200)] 
Add vgstack to NEWS

4 weeks agos390x: Minor fix for vbit-test
Florian Krohm [Mon, 7 Jul 2025 13:51:29 +0000 (13:51 +0000)] 
s390x: Minor fix for vbit-test

Add a big comment as to why Ity_I1 type values are stored in a
32-bit entity.

4 weeks agoCheck dup2 oldfd before allowing the syscall
Mark Wielaard [Fri, 4 Jul 2025 22:51:36 +0000 (00:51 +0200)] 
Check dup2 oldfd before allowing the syscall

The dup201 LTP test fails with TFAIL: dup2(1024, 5) succeeded

That is because 1024 here is the soft file limit (so one higher than
the max number of fds). Valgrind raises the soft limit a little
internally to have a few private fds for itself. So this dup2 call
succeeds (and possibly dups and internal valgrind fd into the
newfd). We should check the oldfd before allowing the dup2 syscall,
like we already check the newfd.

4 weeks agoSanity check io_submit addresses before dereferencing
Mark Wielaard [Fri, 4 Jul 2025 21:14:18 +0000 (23:14 +0200)] 
Sanity check io_submit addresses before dereferencing

The LTP io_submit03 test fails under valgrind memcheck because it
tests bad struct iocb attay addresses. Fix this by explicitly checking
the struct iocb pointer and each array element pointer are safe to
deref in the linux sys_io_submit PRE handler.

4 weeks agoImplement fcntl F_CREATED_QUERY
Alexandra Hájková [Fri, 4 Jul 2025 11:35:13 +0000 (07:35 -0400)] 
Implement fcntl F_CREATED_QUERY

Define VKI_F_CREATED_QUERY in vki-linux.h.
Recognize it in PRE(sys_fcntl).
This fixes ltp tests failures. When running:
make ltpchecks TESTS="fcntl40 fcntl40_64
the tests would fail with:
fcntl40: unempty log2.filtered:
==1809471== Warning: unimplemented fcntl command: 1028

https://bugs.kde.org/show_bug.cgi?id=506076

5 weeks agoFreeBSD syscall: harden sysctl kern.proc.pathname
Paul Floyd [Thu, 3 Jul 2025 20:06:49 +0000 (22:06 +0200)] 
FreeBSD syscall: harden sysctl kern.proc.pathname

Add handling for NULL len pointer and not enough space
for path. Also extend the bug470713 with a few more checks.

Need to add some more inaccessible memory checks.

5 weeks agos390x: Fix diagnostic for S390_DECODE_UNKNOWN_SPECIAL_INSN
Florian Krohm [Mon, 30 Jun 2025 19:31:33 +0000 (19:31 +0000)] 
s390x: Fix diagnostic for S390_DECODE_UNKNOWN_SPECIAL_INSN

When decoding fails the insn bytes (at most 6) are shown. However,
"special insns" are 10 bytes with the last 2 bytes being the interesting
ones. Print them all.

5 weeks agos390x: Add script s390-runone to help debugging small code snippets
Florian Krohm [Mon, 30 Jun 2025 08:27:18 +0000 (08:27 +0000)] 
s390x: Add script s390-runone to help debugging small code snippets

5 weeks agomips32: Use LINXY for statmount and listmount
Mark Wielaard [Sat, 28 Jun 2025 16:33:29 +0000 (18:33 +0200)] 
mips32: Use LINXY for statmount and listmount

commit 57152acfc6a8 "Wrap linux specific syscalls 457 (listmount) and
458 (statmount)" added LINXY wrappers for all arches, except for
mips32 where it used LINX_. This was a typo/mistake. Make sure mips32
also uses LINXY wrappers.

Suggested-by: Matthias Schwarzott <zzam@gentoo.org>
5 weeks agoNon-Linux regtest: update none cmdline2 stdout expected
Paul Floyd [Sat, 28 Jun 2025 07:00:13 +0000 (09:00 +0200)] 
Non-Linux regtest: update none cmdline2 stdout expected

5 weeks agoWrap linux specific syscalls 457 (listmount) and 458 (statmount)
Martin Cermak [Fri, 27 Jun 2025 20:36:03 +0000 (22:36 +0200)] 
Wrap linux specific syscalls 457 (listmount) and 458 (statmount)

The listmount syscall returns a list of mount IDs under the req.mnt_id.
This is meant to be used in conjunction with statmount(2) in order to
provide a way to iterate and discover mounted file systems.

The statmount syscall returns information about a mount, storing it in
the buffer pointed to by smbuf.  The returned buffer is a struct
statmount which is of size bufsize.

Declare a sys_{lis,sta}tmount wrapper in priv_syswrap-linux.h and hook it
for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux
using LINXY with PRE and POST handler in syswrap-linux.c

Both syscalls need CAP_SYS_ADMIN, to successfully test.

Resolves: https://bugs.kde.org/show_bug.cgi?id=502968

6 weeks agoAdd "bad" option for --track-fds.
Alexandra Hájková [Fri, 20 Jun 2025 07:21:41 +0000 (03:21 -0400)] 
Add "bad" option for --track-fds.

When --track-fds=bad is specified, do not warn about
leaked file descriptors and only warn about file decriptors
which was not opened or already closed.

Update the documentation in docs/xml/manual-core.xml.

Add none/tests/track_bad test to test the new option.

Adjust none/tests/cmdline1 and  none/tests/cmdline2 expected
outputs.

https://bugs.kde.org/show_bug.cgi?id=493434

6 weeks agoBug 503241 - s390x: Support z17 changes to the NNPA instruction
Andreas Arnez [Wed, 25 Jun 2025 14:35:04 +0000 (16:35 +0200)] 
Bug 503241 - s390x: Support z17 changes to the NNPA instruction

This adds support for the NNPA enhancements that are implemented with z17.

6 weeks agoUpdate DW_TAG_subprogram parsing for clang
Mark Wielaard [Sat, 21 Jun 2025 21:04:04 +0000 (23:04 +0200)] 
Update DW_TAG_subprogram parsing for clang

Clang doesn't give a name for some artificial subprograms. In that
case just use "<artificial>" as the name of the DW_TAG_subprogram.

Clang also sometimes generates a DW_TAG_subprogram without any
attributes. These aren't really useful for us. So just silently skip
them.

If we warn about subprograms without a name, specification or abstract
origin, also emit the index in the .debug_info section to make it
easier to look them up.

6 weeks agoir_opt.c bug fix: folloup to 4b8dcbb146
Florian Krohm [Sat, 21 Jun 2025 19:49:02 +0000 (19:49 +0000)] 
ir_opt.c bug fix: folloup to 4b8dcbb146

x <= x  is True, you silly.

6 weeks agolibvex_ir.h: Fix comment for Iop_DivModU128to64
Florian Krohm [Sat, 21 Jun 2025 14:11:47 +0000 (14:11 +0000)] 
libvex_ir.h: Fix comment for Iop_DivModU128to64

This IROp uses an I128 dividend and produces an I128 result.
Cf. function typeOfPrimop and IR generation for amd64 and s390.

6 weeks agoConstant folding tweaks.
Florian Krohm [Fri, 20 Jun 2025 20:28:22 +0000 (20:28 +0000)] 
Constant folding tweaks.

Add constant folding for Iop_8Sto64, Iop_32HIto16, Iop_Or1 and various
integer comparison operators.
New functions mkFalse and mkTrue.

7 weeks agoRewrite DWARF inlined subroutine handling to work cross CU
Mark Wielaard [Thu, 29 May 2025 21:41:52 +0000 (23:41 +0200)] 
Rewrite DWARF inlined subroutine handling to work cross CU

The readdwarf3 parsers cannot read DIEs across CUs. An inlined
subroutine refers to an subprogram which has a name (or refers to a
declaration of a subprogram that has a name). These subprograms can be
(and often are when dwz has been used to compress the DWARF) in a
different CU. So a lot of inlined subroutines in backtraces are just
called "UnknownInlinedFun".

To work around not being able to read DIEs across CUs directly we
don't try to immediately resolve the name of the inlined subroutine by
following the abstract origin reference to the subprogram, but just
record it in the DiInlLoc. We also record all subprogram indexes while
parsing in a new DiSubprogram structure and whether the subprogram had
a name or had a reference to another subprogram (specification).

We have to look under a couple more DIEs. We normally want to skip any
DIE that doesn't have an address range when looking for inlined
subroutines, but there are various other DIEs that can contain a
subprogram (specification).

We also want to walk the DIEs from low to high (cooked DIE) index, so
we first pass over the main .debug_info, then the .debug_types, and
finally the alt .debug_info. That way we can store the DiSubprograms
in an array from low to high index and use a binary search to connect
the inlined subroutines to the subprogram that contains the name.

The code also tracks whether the subprogram is artificial, but this
isn't used yet. But should make it possible for a followup patch to
remove artificial inlined subroutines from a backtrace.

Tested against emacs and libreoffice as packaged in Fedora where the
programs and all shared libraries used are processed with dwz. The new
code gives a name to every inlined subroutine. Except when the DWARF
produced is bad and the DW_AT_subroutine didn't contain an
DW_AT_abstract_origin and so no DW_AT_subprogram can be found.

https://bugs.kde.org/show_bug.cgi?id=338803

7 weeks agos390x: Robustise LibVEX_GuestS390X_initialise
Florian Krohm [Wed, 18 Jun 2025 21:10:17 +0000 (21:10 +0000)] 
s390x: Robustise LibVEX_GuestS390X_initialise

7 weeks agos390x: Fix a comment
Florian Krohm [Wed, 18 Jun 2025 17:02:06 +0000 (17:02 +0000)] 
s390x: Fix a comment

7 weeks agoWrap linux specific mseal syscall
Martin Cermak [Tue, 17 Jun 2025 11:51:48 +0000 (13:51 +0200)] 
Wrap linux specific mseal syscall

mseal takes address, size and flags.  Flags are reserved for
future use. Modern CPUs support memory permissions such as RW and
NX bits.  The mseal syscall takes address and size parameters to
additionally protect memory mapping against modifications.

FTR: https://docs.kernel.org/userspace-api/mseal.html

Declare a sys_mseal wrapper in priv_syswrap-linux.h and hook it
for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux
using LINX_ with PRE handler in syswrap-linux.c

https://bugs.kde.org/show_bug.cgi?id=505228

2 months agos390x: Fix thinko, remove a few fixs390's
Florian Krohm [Sat, 7 Jun 2025 12:12:56 +0000 (12:12 +0000)] 
s390x: Fix thinko, remove a few fixs390's

All of VEX's Iops are side effect free. They don't set the condition
code. Therefore, when emitting a VCEQ, VPK[L]S or VCH[L] the 'set cc' field
is 0. Nothing to fix here.

2 months agos390x: Improve none/tests/s390x/cvb.c
Florian Krohm [Sat, 7 Jun 2025 11:48:01 +0000 (11:48 +0000)] 
s390x: Improve none/tests/s390x/cvb.c

The result of a CVB insn resides in an 8-byte register of which the
most significant 4 bytes ought to unchanged by the insn. We want to
check that. So we need to use a variable of type 'long'.
Rewrite the code a bit.

2 months agoltp tests: Use new LTP 20250530, allow for filtering valgrind output
Martin Cermak [Tue, 3 Jun 2025 11:43:18 +0000 (13:43 +0200)] 
ltp tests: Use new LTP 20250530, allow for filtering valgrind output

Use fresh LTP 20250530.

Allow for filtering valgrind output:

In some cases the LTP tests intentionally work with SIGSEGV.  This
happens e.g. with the mmap18 and select03 testcases.  Valgrind
detects SIGSEGV and reports that as a failure.

Such report can't be suppressed using the suppressions mechanism.
That's why this update comes with "output filters". Filters are
scripts that read from their stdin, and write filtered output to
their stdout. Filters reside in auxprogs/filters.

This update comes with 2 filters: For mmap18, and for select03.
They are awk scripts.

Except for filters, this update also blacklists testcase fork13
because it is slow.  It is possible to add comments prefixed with
the '#' sign (implicitly - because they don't match any testcase
name), so a comment is added too.

This update also introduces new default valgrind --vgdb=no switch. It
improves valgrind behavior with nftw01 nftw6401 setfsgid04 setfsgid03_16
and symlink03 testcases. These were previously complaining like this:

==22969== could not unlink /tmp/vgdb-pipe-from-vgdb-to-22969-by-root-on ...

2 months agodoc: add xml protocol 5 and 6 files to EXTRA_DIST
Paul Floyd [Sun, 1 Jun 2025 06:09:14 +0000 (08:09 +0200)] 
doc: add xml protocol 5 and 6 files to EXTRA_DIST

2 months agoFreeBSD syscalls: change two more warnings
Paul Floyd [Fri, 30 May 2025 06:47:00 +0000 (08:47 +0200)] 
FreeBSD syscalls: change two more warnings

sysctl gave me a hard time when I first started working on FreeBSD
but that warning should only be without -q

change the unhandled kenv warning to a VG_(unimplemented), which will
terminate Valgrind rather than just print a warning.

There are still a few aio warnings. Really they should be promoted
to some kind of fully fledged warning (maybe a core warning). I'm
not sure that it's worth the effort as I suspect that aio is not
much used.

2 months agoFreeBSD sigprocmask syscall: do not print warnings when -q is set
Paul Floyd [Fri, 30 May 2025 06:31:48 +0000 (08:31 +0200)] 
FreeBSD sigprocmask syscall: do not print warnings when -q is set

Equivalent to bug504904 and bug504909

2 months agoHide "client tried to modify addresses" warnings when -q (quiet) is set
Martin Cermak [Wed, 28 May 2025 16:04:46 +0000 (18:04 +0200)] 
Hide "client tried to modify addresses" warnings when -q (quiet) is set

When -q is set, that is when verbosity is 0, the "client tried to
modify addresses" warning should be hidden.

Also remove the warning from {freebsd,solaris}/scalar.stderr.exp

Reproducer: TESTS=munmap03 make -j$(nproc) ltpchecks

https://bugs.kde.org/show_bug.cgi?id=504919

2 months agoHide "Bad oldset address" warnings when -q (quiet) flag is set
Martin Cermak [Wed, 28 May 2025 12:50:49 +0000 (14:50 +0200)] 
Hide "Bad oldset address" warnings when -q (quiet) flag is set

When valgrind is run with -q, messages like "Warning: Bad oldset
address 0xFFFFFFFFFFFFFFFF in sigprocmask" be hidden.

Reproducer: TESTS=rt_sigprocmask02 make ltpchecks

https://bugs.kde.org/show_bug.cgi?id=504909

2 months agoHide bad act handler address warning when -q is set
Martin Cermak [Wed, 28 May 2025 10:09:44 +0000 (12:09 +0200)] 
Hide bad act handler address warning when -q is set

When valgrind is run with -q, messages like "Warning: bad act
handler address 0xFFFFFFFFFFFFFFFF in rt_sigaction()" should
be hidden.

https://bugs.kde.org/show_bug.cgi?id=504904

2 months agoregtest arm: one fix for building with clang
Paul Floyd [Thu, 29 May 2025 20:06:21 +0000 (22:06 +0200)] 
regtest arm: one fix for building with clang

2 months agoUse portable syntax for pushsection directive in inline assembly
Khem Raj [Wed, 14 May 2025 16:29:33 +0000 (09:29 -0700)] 
Use portable syntax for pushsection directive in inline assembly

'@' does not work with clang inline assembler, but '%' works with both
gcc and clang. Therefore use '%' to make it more portable

Fixes
<inline asm>:1:41: error: expected '%<type>' or "<type>"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 months agoBug 504936 - Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TL...
Paul Floyd [Thu, 29 May 2025 06:52:28 +0000 (08:52 +0200)] 
Bug 504936 - Add FreeBSD amd64 sysarch subcommands AMD64_SET_TLSBASE and AMD64_GET_TLSBASE

2 months agos390x: Remove a fixs390. Add an explanation.
Florian Krohm [Wed, 28 May 2025 21:07:44 +0000 (21:07 +0000)] 
s390x: Remove a fixs390. Add an explanation.

2 months agoregtest warning: suppress -Walloc-size-larger-than= warning in memcheck calloc-overflow.c
Paul Floyd [Tue, 27 May 2025 10:41:32 +0000 (12:41 +0200)] 
regtest warning: suppress -Walloc-size-larger-than= warning in memcheck calloc-overflow.c

2 months agoregtest warnings: fix unused returns and missing noexcept specifiers
Paul Floyd [Mon, 26 May 2025 20:02:35 +0000 (22:02 +0200)] 
regtest warnings: fix unused returns and missing noexcept specifiers

GCC 15.1.1 is still giving a -Walloc-size-larger-than= warning for
memcheck calloc-overflow.c

2 months agoregtest PPC: update a few XML expecteds after bug390310
Paul Floyd [Mon, 26 May 2025 06:21:23 +0000 (08:21 +0200)] 
regtest PPC: update a few XML expecteds after bug390310

2 months agoBug 390310 - Output summaries in XML files
Paul Floyd [Sun, 11 May 2025 13:41:10 +0000 (15:41 +0200)] 
Bug 390310 - Output summaries in XML files

Original patch contributed by renaultd@free.fr

2 months agoFreeBSD: change vgdb traces to use PTRACE_CONTINUE rather than Linux PTRACE_CONT
Paul Floyd [Sat, 24 May 2025 16:43:03 +0000 (18:43 +0200)] 
FreeBSD: change vgdb traces to use PTRACE_CONTINUE rather than Linux PTRACE_CONT

2 months agoDarwin: removing trailing ... from suppressions
Paul Floyd [Sat, 24 May 2025 07:44:07 +0000 (09:44 +0200)] 
Darwin: removing trailing ... from suppressions

They don't serve any purpose

2 months agoREADME_DEVELOPERS: add some platform specific notres for running regtest
Paul Floyd [Sat, 24 May 2025 06:39:40 +0000 (08:39 +0200)] 
README_DEVELOPERS: add some platform specific notres for running regtest

2 months agoregtest: update none cmdline expecteds for non-linux
Paul Floyd [Thu, 22 May 2025 19:38:20 +0000 (21:38 +0200)] 
regtest: update none cmdline expecteds for non-linux

2 months agoAdd "yes" argument for the --modify-fds option.
Alexandra Hájková [Tue, 6 May 2025 10:50:44 +0000 (06:50 -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

2 months agoPRE(sys_prlimit64): Check ARG3 and ARG4 ML_(safe_to_deref) up front
Mark Wielaard [Tue, 20 May 2025 10:09:13 +0000 (12:09 +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 <zzam@gentoo.org>
2 months agoAdd fixed bug 504466 double close causes SEGV to NEWS
Mark Wielaard [Mon, 19 May 2025 19:42:18 +0000 (21:42 +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

2 months agoPR504341: Prevent LTP setrlimit05 syscall test from crashing valgrind
Martin Cermak [Mon, 19 May 2025 09:45:04 +0000 (11:45 +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

2 months ago.gitignore: add /none/tests/fdleak_doubleclose0
Paul Floyd [Mon, 19 May 2025 06:29:57 +0000 (08:29 +0200)] 
.gitignore: add /none/tests/fdleak_doubleclose0

2 months agoScript: move vgstack to configure.ac section with chmod -x
Paul Floyd [Mon, 19 May 2025 06:23:57 +0000 (08:23 +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.

2 months agoCheck whether file descriptor is inherited before printing where_opened users/mark/try-doubleclose0
Mark Wielaard [Sun, 18 May 2025 13:31:36 +0000 (15:31 +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

2 months agoPR503969: make ltpchecks: flatten the log structure
Martin Cermak [Fri, 16 May 2025 20:12:39 +0000 (22:12 +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

2 months agos390x: disasm-test: add forgotten opcodes SRNMT, LDE, and LDER
Florian Krohm [Fri, 16 May 2025 20:39:42 +0000 (20:39 +0000)] 
s390x: disasm-test: add forgotten opcodes SRNMT, LDE, and LDER

2 months agoFreeBSD regtest: updates for FreeBSD 15.0-CURRENT
Paul Floyd [Fri, 16 May 2025 19:32:02 +0000 (21:32 +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).

2 months agoPR503969: Make test results of make ltpchecks compatible with bunsen
Martin Cermak [Fri, 16 May 2025 09:46:06 +0000 (11:46 +0200)] 
PR503969: Make test results of make ltpchecks compatible with bunsen

Synthesize automake-like testcase log format for bunsen compatibility.

Each testcase now produces a triplet of <testcase>.{log,trs}, and a
test-suite.log file.  This way test results can be uploaded to bunsen
using the t-upload-git-push command.

The <testcase>.log file contains the actual testcase log. The .trs
file contains automake-encoded test result.  The test-suite.log
file contains testcase timing information.

The log directory tree respect the one of the LTP testcases to avoid
naming collisions.

Here is how the test result was uploaded to Bunsen:

> TESTING FINISHED, logs in /home/mcermak/WORK/valgrind/valgrind/auxprogs/auxchecks/ltp-full-20250130/ltp
> make[1]: Leaving directory '/home/mcermak/WORK/valgrind/valgrind/auxprogs'
>
> real 8m27.467s
> user 44m46.416s
> sys 6m46.405s
> 41$ cd /home/mcermak/WORK/valgrind/valgrind/auxprogs/auxchecks/ltp-full-20250130/ltp
> 41$ t-upload-git-push ssh://builder.sourceware.org/git/bunsendb.git mcermak/PR503969-$(date +%s) \
>  $(find . -type f -name '*.log' -o -name  '*.trs' -o -name 'test-suite.log')
3036eba2de1cc44a1942f9681720ea234da9029e refs/tags/mcermak/PR503969-1747389329
> 41$

Here's the resulting bunsen upload:
https://builder.sourceware.org/testrun/3036eba2de1cc44a1942f9681720ea234da9029e

2 months agoFreeBSD regtest: update 32bit scalar
Paul Floyd [Fri, 16 May 2025 06:04:06 +0000 (08:04 +0200)] 
FreeBSD regtest: update 32bit scalar

2 months agoBug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred
Paul Floyd [Fri, 16 May 2025 05:58:02 +0000 (07:58 +0200)] 
Bug 504265 - FreeBSD: missing syscall wrappers for fchroot and setcred

2 months agoCompile code that gets linked with libc by adding -fhosted.
Florian Krohm [Thu, 15 May 2025 21:42:19 +0000 (21:42 +0000)] 
Compile code that gets linked with libc by adding -fhosted.

The use of -fno-builtin interfers with -Wformat: no format warnings will
be given when both options are present. Because -fno-builtin means: when
you encounter a function that has the same name as a built-in function,
forget everything you know about that function.
That includes functions attributes. And without __attribute__((format...))
there will be no -Wformat warnings.

The fix is to append -fhosted when compiling something that gets linked
with libc. As command line options are processed left to right adding
-fhosted at the end overrides any earlier -fno-builtin option.

Fix compiler warnings.

Add some ugly ifdeffery to drd/drd_intercepts.c. I could not figure out how
to rewrite the offensive printf to avoid testcase breakage.

2 months agoWrap linux specific cachestat syscall
Martin Cermak [Thu, 15 May 2025 10:03:55 +0000 (12:03 +0200)] 
Wrap linux specific cachestat syscall

cachestat takes an fd, cstat_range and flags arguments and
writes out page cache statistics via the cstat struct.

Declare a sys_cachestat wrapper in priv_syswrap-linux.h and hook it
for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux
using LINXY with PRE/POST handlers in syswrap-linux.c.

Define __NR_cachestat for amd64, arm, arm64, mips32, mips64, nanomips,
ppc32, ppc64, riscv64, s390x, and x86.

https://bugs.kde.org/show_bug.cgi?id=501741

2 months agoBug 504101 - Add a "vgstack" script
Paul Floyd [Tue, 13 May 2025 18:34:48 +0000 (20:34 +0200)] 
Bug 504101 - Add a "vgstack" script

This works just like pstack/gstack (and bstack on FreeBSD).

Run "vgstack [valgrind pid]" and you will get the guest backtraces.

2 months agoregtest: use /bin/cat in none/tests/fdleak_cat.vgtest
Paul Floyd [Wed, 14 May 2025 05:47:43 +0000 (07:47 +0200)] 
regtest: use /bin/cat in none/tests/fdleak_cat.vgtest

There's no /usr/bin/cat on FreeBSD or Darwin.

2 months agoDon't count closed inherited file descriptors
Mark Wielaard [Tue, 13 May 2025 22:13:06 +0000 (00:13 +0200)] 
Don't count closed inherited file descriptors

Programs which close some inherited file descriptors and are run under
valgrind with -q and --track-fds=yes would still show the FILE
DESCRIPTORS banner even if there were no non-inherited file
descriptors still open.

Fix this by not counting already closed inherited file descriptors.

Add a simple testcase to show /usr/bin/cat /dev/null doesn't produce
any output running under valgrind -q --track-fds=yes.

https://bugs.kde.org/show_bug.cgi?id=504177

2 months agoauxprogs/ltp-tester.sh: Fix typo in summary log grep
Martin Cermak [Tue, 13 May 2025 12:21:08 +0000 (14:21 +0200)] 
auxprogs/ltp-tester.sh: Fix typo in summary log grep

This does point out a couple more failures. In case the test results
differ when running under valgrind, but there are no other error
indicators. e.g. openat202 now reports:

openat202: diff -u log1summary log2summary:
--- log1summary
+++ log2summary
@@ -1,5 +1,5 @@
-passed   9
-failed   0
+passed   8
+failed   1
 broken   0
 skipped  0
 warnings 0

Which points out we have a bug in our openat wrapper when given
/proc/self/exe with RESOLVE_NO_MAGICLINKS (which should fail with
ELOOP, but succeeds when running under valgrind, probably because we
have a "magic" /proc/self/exe wrapper).

2 months agoillumos regtest: mask a leak in memcheck/tests/realloc_size_zero_xml
Paul Floyd [Mon, 12 May 2025 19:38:46 +0000 (21:38 +0200)] 
illumos regtest: mask a leak in memcheck/tests/realloc_size_zero_xml

There's what looks like a libc printf buffer possible leak
in this test on illumos. With xml output leak reporting is
hard coded to on. So to avoid this extra error add
--show-possibly-lost=no

Maybe this should be suppressed. I haven't managed to reproduce it
without xml and outside of perl regtest.

2 months agoLinux regtest: add an expected for memcheck realloc_size_zero_xml
Paul Floyd [Mon, 12 May 2025 05:20:59 +0000 (07:20 +0200)] 
Linux regtest: add an expected for memcheck realloc_size_zero_xml

2 months agoMore gdb filtering for glibc 2.41 with debuginfo installed
Mark Wielaard [Sun, 11 May 2025 21:12:15 +0000 (23:12 +0200)] 
More gdb filtering for glibc 2.41 with debuginfo installed

2 months agoRegtest: add an xml version of memcheck realloc_size_zero
Paul Floyd [Sun, 11 May 2025 19:25:11 +0000 (21:25 +0200)] 
Regtest: add an xml version of memcheck realloc_size_zero

2 months agoFreeBSD warnings: a couple of signatures that warn of mismatches
Paul Floyd [Sun, 11 May 2025 17:40:22 +0000 (19:40 +0200)] 
FreeBSD warnings: a couple of signatures that warn of mismatches

when -fno-bultin is specified. There's still infinite recursion and
crashes with clang though.

2 months agoLinux PPC64 syscall: add sys_io_pgetevents
Paul Floyd [Sun, 11 May 2025 08:28:01 +0000 (10:28 +0200)] 
Linux PPC64 syscall: add sys_io_pgetevents

2 months agoriscv64: Fix nan-boxing for single-precision calculations
Ivan Tetyushkin [Mon, 21 Apr 2025 08:59:48 +0000 (11:59 +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

2 months agoAdd workaround for missing riscv_hwprobe syscall (258)
Mark Wielaard [Fri, 9 May 2025 11:46:44 +0000 (13:46 +0200)] 
Add workaround for missing riscv_hwprobe syscall (258)

On riscv newer glibc (2.41) will probe instruction support using the
riscv_hwprobe syscall. Since Valgrind currently doesn't have a wrapper
for riscv_hwprobe that causes a Warning. Since the RISC-V Hardware
Probing Interface is non-trivial and we don't really implement
extended riscv instructions anyway work around that by "implementing"
riscv_hwprobe as sys_ni_syscall so it generates an ENOSYS and glibc
will silently fall back to not using any extended instructions.

https://docs.kernel.org/arch/riscv/hwprobe.html

https://bugs.kde.org/show_bug.cgi?id=503253

2 months agomount syscall param filesystemtype may be NULL
Mark Wielaard [Thu, 8 May 2025 22:21:25 +0000 (00:21 +0200)] 
mount syscall param filesystemtype may be NULL

On Linux the mount syscall, depending on flags provided, the source,
type and data my be ignored.  We already don't check data and allow
source to be NULL.  Normally when type is ignored an application will
provide an empty string "".  But sometimes NULL is passed (like for
source).  So we now also allow type to be NULL to prevent false
positives.

Adjust the linux/scalar.c tests so the type param is still
unaddressable.

https://bugs.kde.org/show_bug.cgi?id=503914

3 months agos390x: BPRP related fixes
Florian Krohm [Tue, 6 May 2025 21:22:47 +0000 (21:22 +0000)] 
s390x: BPRP related fixes

objdump disassembly for BPRP looks like so:

c5 0f ff 00 00 00   bprp  0,88 <main+0x88>,8a <main+0x8a>

But the disasm-test parser assumed there could only be one
address including a symbol name on a given line. It stopped
comparison beyond that point.
The line

c5 0f ff 00 00 00   bprp  0,88 <main+0x88>,fffe <main+0xfffe>

would compare equal to the above -- a false positive.

Once fixed, BPRP testcases began failing. This is because the i3
field is 24 bit wide. So an UShort is not good enough to represent
it.

3 months agoRun the LTP syscall tests in parallel
Martin Cermak [Mon, 5 May 2025 12:23:16 +0000 (14:23 +0200)] 
Run the LTP syscall tests in parallel

- Run the LTP syscall tests in parallel to save time.
- Allow for running only selected tests using TESTS env var.

3 months agos390x: disasm-test: Fix compiler warning (BZ 503817)
Florian Krohm [Tue, 6 May 2025 08:53:04 +0000 (08:53 +0000)] 
s390x: disasm-test: Fix compiler warning (BZ 503817)

Forgotten pointer dereference. Beef up unit test accordingly.
Fix a few -Wsign-compare compiler warnings along the way.

Fixes https://bugs.kde.org/show_bug.cgi?id=503817

3 months agos390x: Follow-up to 558f5e9517
Florian Krohm [Sun, 4 May 2025 22:30:25 +0000 (22:30 +0000)] 
s390x: Follow-up to 558f5e9517

Said patch removes the resteering machinery which allowed chasing through
unconditional jumps/calls during IR generation.
There were two fixme's related to this which are now removed.
Also eliminate functions 'call_function_and_chase' and
'always_goto_and_chase' which no longer are meaningful. Use
'call_function' and 'always_goto' instead.

3 months agos390x: Add disassembly for special insns
Florian Krohm [Sun, 4 May 2025 21:29:34 +0000 (21:29 +0000)] 
s390x: Add disassembly for special insns

Surely we want to see this when tracing the frintend.
Also: new function s390_irgen_inject_ir to wrap the handling of
the special insn for IR injection.

3 months agoltp-excludes: Add fork14, futex_cmp_requeue and pidfd_send_signal
Mark Wielaard [Sun, 4 May 2025 18:16:26 +0000 (20:16 +0200)] 
ltp-excludes: Add fork14, futex_cmp_requeue and pidfd_send_signal

There are a few more linux test project syscall tests that seem to
cause some trouble for some buildbots. The fork14 test uses a lot of
memory, as do the futex_cmp_requeue tests (at least on ppc64le). And
the pidfd_send_signal tests, when run inside a container, seem to kill
the test wrapper (and the container it runs in).

3 months agoFreeBSD regtest: cleanup test warnings when building with GCC
Paul Floyd [Sun, 4 May 2025 08:38:50 +0000 (10:38 +0200)] 
FreeBSD regtest: cleanup test warnings when building with GCC

3 months agoBug 503677 - duplicated-cond compiler warning in dis_RV64M
Paul Floyd [Sun, 4 May 2025 06:55:45 +0000 (08:55 +0200)] 
Bug 503677 - duplicated-cond compiler warning in dis_RV64M

3 months agoBug 503641 - close_range syscalls started failing with 3.25.0
Paul Floyd [Fri, 2 May 2025 16:53:09 +0000 (18:53 +0200)] 
Bug 503641 - close_range syscalls started failing with 3.25.0

3 months agoFreeBSD close_range syscall
Paul Floyd [Fri, 2 May 2025 14:59:58 +0000 (16:59 +0200)] 
FreeBSD close_range syscall

Simplify the checking. No ned to test for reserved fds,
and just split the close_range if debug output is enabled.

Add a call to close_range with an upper bound of ~0U in the
testcase.

These changes will probably be the basis for fixing
https://bugs.kde.org/show_bug.cgi?id=503641

3 months agoillumos regtest: filter a gdb warning
Paul Floyd [Fri, 2 May 2025 10:19:11 +0000 (12:19 +0200)] 
illumos regtest: filter a gdb warning

I only get it when running make test from oi-userland components,
not when running make regtest from a shell. Possibly a locale or
similar issue.

3 months ago-> 3.25.0 final VALGRIND_3_25_0
Mark Wielaard [Fri, 25 Apr 2025 12:38:05 +0000 (14:38 +0200)] 
-> 3.25.0 final

3 months agoRegtest: fix an arm64 Linux warning
Paul Floyd [Thu, 24 Apr 2025 10:52:52 +0000 (12:52 +0200)] 
Regtest: fix an arm64 Linux warning

Just a gcc warning for the deliberate use of an uninitialised
variable in arm64-linux/scalar.

3 months agoSet version to 3.25.0-RC2
Mark Wielaard [Thu, 24 Apr 2025 01:30:58 +0000 (03:30 +0200)] 
Set version to 3.25.0-RC2