]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
7 hours agoUpdate NEWS entries master
Mark Wielaard [Mon, 20 Apr 2026 15:24:23 +0000 (17:24 +0200)] 
Update NEWS entries

- New VALGRIND_REPLACES_MALLOC and VALGRIND_GET_TOOLNAME client requests.
- Linux lightweight guard pages support (--max-guard-pages=N).
- x86 (32bit) (partial) SSE4.1 instruction support.
- Linux Test Project (LTP) v20260130 was integrated.

7 hours agoAdd documentation for new client requests in manual-core-adv.xml
Mark Wielaard [Mon, 20 Apr 2026 15:12:10 +0000 (17:12 +0200)] 
Add documentation for new client requests in manual-core-adv.xml

Document VALGRIND_REPLACES_MALLOC and VALGRIND_GET_TOOLNAME.

2 days agoSet version to 3.27.0-RC2
Mark Wielaard [Sat, 18 Apr 2026 00:18:20 +0000 (02:18 +0200)] 
Set version to 3.27.0-RC2

3 days agoAdd MOVNTDQA SSE4.1 support for x86
Mark Wielaard [Wed, 18 Feb 2026 16:48:15 +0000 (17:48 +0100)] 
Add MOVNTDQA SSE4.1 support for x86

Add handling of MOVNTDQA to VEX/priv/guest_x86_toIR.c based on the
guest_amd64_toIR.c implementation.

Move test_MOVNTDQA from none/tests/amd64/sse4-64.c to
none/tests/sse4-common.h and add the same test to
none/tests/x86/sse4-x86.c with new MOVNTDQA output in stdout.exp.

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

3 days agoAdd SSE4.1 MPSADBW for x86 32-bit
Alexandra Hájková [Wed, 15 Apr 2026 15:42:38 +0000 (11:42 -0400)] 
Add SSE4.1 MPSADBW for x86 32-bit

Move the MPSADBW computation helper and IR builder from
guest_amd64_helpers.c and guest_amd64_toIR.c into a new
header guest_generic_helpers.h and guest_generic_sse.h,
so the helpers could be shared between x86 and amd64
implementaions.

Move MPSADBW tests into the shared sse4-common.h so they are
also exercised on x86.

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

4 days agoDarwin suppressions and massif ignore function
Paul Floyd [Thu, 16 Apr 2026 19:25:08 +0000 (21:25 +0200)] 
Darwin suppressions and massif ignore function

Suppresss a few more still reachables. Suppress a Helgrind race in
getaddrinfo. Add another massif --ignore-fn.

4 days agoAdd PCMPEQQ SSE4.1 support for x86
Mark Wielaard [Thu, 12 Mar 2026 00:22:32 +0000 (01:22 +0100)] 
Add PCMPEQQ SSE4.1 support for x86

Add handling of PCMPEQQ to VEX/priv/guest_x86_toIR.c based on the
guest_amd64_toIR.c implementation. Handle Iop_CmpEQ64x2 using
h_generic_calc_CmpEQ64x2 in VEX/priv/host_x86_isel.c.

Move test_PCMPEQQ from none/tests/amd64/sse4-64.c to
none/tests/sse4-common.h and add the same test to
none/tests/x86/sse4-x86.c with new PCMPEQQ output in stdout.exp.

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

4 days agoDarwin massif: another load of functions to ignore for macOS 10.14
Paul Floyd [Thu, 16 Apr 2026 06:56:54 +0000 (08:56 +0200)] 
Darwin massif: another load of functions to ignore for macOS 10.14

overloaded-new is still failing due to a 64byte allocation diff that
is hiding somewhere.

5 days agoDarwin distribution: add m_mach/priv_dyld_internals.h to noinst_HEADERS
Paul Floyd [Wed, 15 Apr 2026 19:37:41 +0000 (21:37 +0200)] 
Darwin distribution: add m_mach/priv_dyld_internals.h to noinst_HEADERS

This caused build failure of 3.27 RC1 on macOS 11 to 13.

6 days agos390: Bug fix in insn selection
Florian Krohm [Tue, 14 Apr 2026 21:36:18 +0000 (21:36 +0000)] 
s390: Bug fix in insn selection

The bug was introduced in b3830b82f4 and exposed by GCC when compiling
with -g (without -O2). Here's the thing:

      if (expr->Iex.Binop.op == Iop_Add64) {
--->     ULong disp = arg2->Iex.Const.con->Ico.U64;
         if (arg2->tag == Iex_Const && ulong_fits_signed_20bit(disp)) {
            h1 = s390_isel_int_expr(env, arg1);

This possibly segfaults when arg2 is not a constant.
Optimising GCC figures it can first check arg2->tag == Iex_Const
which is cheaper than disp = arg2->Iex.Const.con->Ico.U64;
Nice one.

Regtested with both default compiler flags and -g only.

6 days agoBug 518951: Fix the fsconfig() syscall retval
Martin Cermak [Tue, 14 Apr 2026 19:48:05 +0000 (21:48 +0200)] 
Bug 518951: Fix the fsconfig() syscall retval

Make the fsconfig02 LTP testcase happy by fixing the
fsconfig() retval.

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

6 days agoSoalris regtest: remove unused expected
Paul Floyd [Tue, 14 Apr 2026 19:14:23 +0000 (21:14 +0200)] 
Soalris regtest: remove unused expected

With the previous commit one expected is no longer needed since
Solaris now generates callstacks similar to other OSes.

6 days agoSolaris helgrind wrapper and regtest
Paul Floyd [Tue, 14 Apr 2026 19:01:21 +0000 (21:01 +0200)] 
Solaris helgrind wrapper and regtest

Modify the pthread_rwlock_init wrapper so that it is similar
to other OSes (it was not using a _WRK function). Update the
Solaris stderr filter and one Solaris specific expexted.

6 days agos390x: Update some IBM copyright notices
Andreas Arnez [Tue, 14 Apr 2026 11:38:11 +0000 (13:38 +0200)] 
s390x: Update some IBM copyright notices

Some of the copyright notices in `*s390*' source files were really
outdated.  Fix this.

6 days agoFreeBSD suppression: broaden rtld sigprocmask param suppression
Paul Floyd [Tue, 14 Apr 2026 06:05:52 +0000 (08:05 +0200)] 
FreeBSD suppression: broaden rtld sigprocmask param suppression

Make sure that it suppresses even if rtld debuginfo is not
installed.

6 days agoUpdate copyright notices in FreeBSD-related source files
Paul Floyd [Tue, 14 Apr 2026 05:46:09 +0000 (07:46 +0200)] 
Update copyright notices in FreeBSD-related source files

6 days agoUpdate Valgrind and Tool printed copyright years
Paul Floyd [Tue, 14 Apr 2026 05:29:18 +0000 (07:29 +0200)] 
Update Valgrind and Tool printed copyright years

I've limited this to only those that have changed since the last
copyright year update.

6 days agoSet version to 3.27.0-RC1
Mark Wielaard [Tue, 14 Apr 2026 00:34:26 +0000 (02:34 +0200)] 
Set version to 3.27.0-RC1

6 days agoUpdate libiberty demangler
Mark Wielaard [Tue, 14 Apr 2026 00:26:44 +0000 (02:26 +0200)] 
Update libiberty demangler

Update the libiberty demangler using the auxprogs/update-demangler
script to gcc git commit a8290fb163443276c3df6b20024c6874f93c560c.

This update includes:

- Fix resource exhaustion in rust demangler (PR demangler/106641)
- Update copyright years.

6 days agohelgrind: add --track-destroy command line option
Aaron Merey [Mon, 13 Apr 2026 03:46:19 +0000 (23:46 -0400)] 
helgrind: add --track-destroy command line option

Add --track-destroy=no|yes|all that if enabled warns if
pthread_mutex_init or pthread_rwlock_init is called using a guest
address that helgrind has already associated with another rwlock or
mutex, suggesting a missing pthread_*_destroy call.

Additionally if --track-destroy=all, then at process exit
helgrind will report all rwlocks and mutexes that were explicitly
initialized but never destroyed.

This option defaults to off since missing calls to pthread_*_destroy
are not necessarily bugs.  Locks that weren't explicitly initialized
are skipped to reduce the number of spurious warnings.

6 days agohelgrind: fix lock-kind mismatch assert failure
Aaron Merey via Valgrind-developers [Mon, 13 Apr 2026 03:46:18 +0000 (23:46 -0400)] 
helgrind: fix lock-kind mismatch assert failure

tl_assert(lk->kind == LK_rdwr) in evhH__post_thread_r_acquires_lock
may fail in cases where memory containing an rwlock or mutex is
reused for a lock of a different kind without having called
pthread_*_destroy on the first lock.

Fix this by having map_locks_lookup_or_create detect when a lock kind at
a given guest address has changed from an rwlock to mutex or mutex to
rwlock.  The old lock record is removed and a new one is added reflecting
the current lock kind.

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

7 days agohelgrind: add --show-events debug cmdline option
Aaron Merey via Valgrind-developers [Mon, 13 Apr 2026 03:46:17 +0000 (23:46 -0400)] 
helgrind: add --show-events debug cmdline option

SHOW_EVENTS in hg_main.c controls whether helgrind prints a trace of its
internal synchronization, threading and memory events.  It is set to 0
by default to disable the trace and the only way to enable it is to
modify the source code and rebuild valgrind.

This patch replaces SHOW_EVENTS with clo_show_events that is set using
the new helgrind cmdline option --show-events.  Information about this
option is included under helgrind's --help-debug.

7 days agoDarwin regtest: add an expected for drd tc22_exit_w_lock
Paul Floyd [Mon, 13 Apr 2026 06:29:30 +0000 (08:29 +0200)] 
Darwin regtest: add an expected for drd tc22_exit_w_lock

The callstack is much the same as the Solaris expected, just with
an extre 'kill()'.

8 days agoBug 518609 - Setting double verbose interferes with symbol loading (FreeBSD 16)
Paul Floyd [Sun, 12 Apr 2026 19:44:45 +0000 (21:44 +0200)] 
Bug 518609 - Setting double verbose interferes with symbol loading (FreeBSD 16)

More complete fix, not just libc.

8 days agoFreeBSD regtest: add a (below main) filter for one of the massif tests.
Paul Floyd [Sun, 12 Apr 2026 14:36:27 +0000 (16:36 +0200)] 
FreeBSD regtest: add a (below main) filter for one of the massif tests.

deep-D.post.out did contain "__libc_start1 (worktrees/main/lib/libc/csu/libc_start1.c:180)"
rather than "(below main)"

(on FreeBSD 16).

8 days agoBug 518609 - Setting double verbose interferes with symbol loading (FreeBSD 16)
Paul Floyd [Sat, 11 Apr 2026 19:55:26 +0000 (21:55 +0200)] 
Bug 518609 - Setting double verbose interferes with symbol loading (FreeBSD 16)

This change uses the same forced loading of libc.so as Linux uses.
Each OS has its own version for libc.so (6 for Linux, 7 for FreeBSD,
1 for Solaris and Darwin has a completely different system).

This papers over the real problem - a split debug file is being treated like
an ELF object.

9 days agoFreeBSD suppression: sigprocmask param from rtld
Paul Floyd [Sat, 11 Apr 2026 17:50:47 +0000 (19:50 +0200)] 
FreeBSD suppression: sigprocmask param from rtld

Intermittent and difficult to reproduce.

Hopefully this will resolve thread_alloca and/or
lsframe1 regtest fails (as well as false positives
in the real world).

9 days agoFreeBSD regtest: make timing_safe more consistent
Paul Floyd [Sat, 11 Apr 2026 15:09:52 +0000 (17:09 +0200)] 
FreeBSD regtest: make timing_safe more consistent

This test was failing on FreeeBSD 16 arm64. I don't think that
it's anything that has changed, just that the test was flaky.

The problem is in the MEMCMP replacement code which has a word
alignment check before doing word sized comparisons. The test
was comparing a string literal on the stack with an strdup'd
copy. strdup should give 8/16 byte alignment for 32bit/64bit
platforms. There's no guarantee for the string literal.

To make this stable I've changed the literal from pointer to
alignas(16) array and replaced the strdup with aligned_alloc and
memcpy. I've also added asserts that the stack and heap addresses
16byte aligned.

10 days agoTestsuite: Patch the LTP sources to fix compile time problem
Martin Cermak [Fri, 10 Apr 2026 13:02:40 +0000 (15:02 +0200)] 
Testsuite:  Patch the LTP sources to fix compile time problem

Patch ltp-full-20260130.tar to fix openat2() compile time problem.

11 days agoDRD: remove a couple of unused function prototypes
Paul Floyd [Thu, 9 Apr 2026 18:31:02 +0000 (20:31 +0200)] 
DRD: remove a couple of unused function prototypes

12 days agoFreeBSD regtest: rename a C variable
Paul Floyd [Wed, 8 Apr 2026 06:30:45 +0000 (08:30 +0200)] 
FreeBSD regtest: rename a C variable

One FreeBSD test was using a varaible called 'nullptr'.
clang 22 now complains about that because it is a reserved
keyword in C 23. Rename it to 'nullpointer'.

13 days agoDarwin syswrap: add a wrapper for persona
Paul Floyd [Tue, 7 Apr 2026 20:21:53 +0000 (22:21 +0200)] 
Darwin syswrap: add a wrapper for persona

2 weeks agos390: Fix s390_emit_IPM which has one (not two) register operands.
Florian Krohm [Mon, 6 Apr 2026 20:04:18 +0000 (20:04 +0000)] 
s390: Fix s390_emit_IPM which has one (not two) register operands.

This has been wrong (in a harmless way) since day #1.

2 weeks agoFreeBSD helgrind: add a suppression for ostream padding
Paul Floyd [Mon, 6 Apr 2026 13:59:53 +0000 (15:59 +0200)] 
FreeBSD helgrind: add a suppression for ostream padding

2 weeks agoFreeBSD helgrind: broaden suppression for pthread_create
Paul Floyd [Mon, 6 Apr 2026 11:33:20 +0000 (13:33 +0200)] 
FreeBSD helgrind: broaden suppression for pthread_create

Previous suppression worked on a source build of FreeBSD but not a binary install.

2 weeks agoFreeBSD arm64: fix do_syscall_WRK
Paul Floyd [Sun, 5 Apr 2026 15:29:43 +0000 (17:29 +0200)] 
FreeBSD arm64: fix do_syscall_WRK

Back in Sept 2025 this function was refactored a bit because
is was being passed an argument that was never used. That
shifted down the sysno by one slot. Because I can't count
I changed it from moving from the stack to moving from x9
into x8. The source should be x7. This worked by accident
in optimised builds probably because sysno was in x9
from an earlier function that shuffles the arguments.

2 weeks agoFreeBSD helgrind: add a default suppression for pthread_create
Paul Floyd [Sun, 5 Apr 2026 08:34:25 +0000 (10:34 +0200)] 
FreeBSD helgrind: add a default suppression for pthread_create

New with FreeBSD 16.

2 weeks agoFreeBSD regtest: filters for source installs of FreeBSD, part 2
Paul Floyd [Sun, 5 Apr 2026 06:18:44 +0000 (08:18 +0200)] 
FreeBSD regtest: filters for source installs of FreeBSD, part 2

There are a few exceptions to the general rules that were added
in the previous commit.

2 weeks agoFreeBSD regtest: filters for source installs of FreeBSD
Paul Floyd [Sat, 4 Apr 2026 20:17:02 +0000 (22:17 +0200)] 
FreeBSD regtest: filters for source installs of FreeBSD

It looks like cfarm427 and cfarm430 are installed from source.
That changes some of the error callstacks (due to generated
filenames and paths in the source build). This adds filters
for the syscalls.

I'm still seeing quite a few helgrind and massif fails.

2 weeks agoBug 518482 - FreeBSD: assert in parse_procselfmaps when built with GNU binutils
Paul Floyd [Fri, 3 Apr 2026 19:05:50 +0000 (21:05 +0200)] 
Bug 518482 - FreeBSD: assert in parse_procselfmaps when built with GNU binutils

parse_procselfmaps rewritten to not use any hard coded counts.

Previously the code was counting mappings from sysctl KERN_PROC_VMMAP
and when it saw the host rx mapping it was saving state for the next
pass in the loop, which it was assuming would be the rw segment
mapped to swap.  The counts were hard coded for GCC and clang and
assumed GCC used ld.bfd and clang used ld.lld. That assumption
is not safe.

Now the code uses a lookahead. Something that I had not previously seen
is that the host RW PT_LOAD can be partially or wholly mapped as swap.
The lookahead checks for the first rw swap mapping that follows
an RX file mapping (RW wholly mapped as swap) or an RW file
mapping (RW partially mapped as swap). The first time that condition
is met the RW swap mapping will also be recorded as if it were a
file mapping. The current iteration then skips two kinfo_vmentry
records rather than one.

2 weeks agoconfigure: fix issue with PUSH/POP C++ language
Paul Floyd [Thu, 2 Apr 2026 17:48:22 +0000 (19:48 +0200)] 
configure: fix issue with PUSH/POP C++ language

2 weeks agoDarwin syswrap: add fcntl F_GETPROTECTIONCLASS
Paul Floyd [Thu, 2 Apr 2026 11:53:34 +0000 (13:53 +0200)] 
Darwin syswrap: add fcntl F_GETPROTECTIONCLASS

This is in Louis Brunner's port, but tagged macOS 14 whilst I see
it on macOS 13.

I've used #if defined(VKI_F_GETPROTECTIONCLASS) rather than
use DARWIN_VERS as little as possible.

2 weeks agomemcheck: Small simplification when ANDing guard conditions
Andreas Arnez [Thu, 2 Apr 2026 11:20:44 +0000 (13:20 +0200)] 
memcheck: Small simplification when ANDing guard conditions

Memcheck's complainIfUndefined() function contains logic where a Boolean
AND is "emulated" by converting both operands to I32, applying Iop_And32,
and converting the result back to I1.

Since Iop_And1 was introduced a while ago, just use that directly instead.

2 weeks agomemcheck: Optimize AND/OR with constant
Andreas Arnez [Thu, 2 Apr 2026 10:50:17 +0000 (12:50 +0200)] 
memcheck: Optimize AND/OR with constant

In memcheck, when instrumenting a bitwise AND/OR with a constant, the
current logic yields unnecessarily complicated code.

For instance, the general formula for the resulting vbits of `a1 OR a2' is

  (v1 | v2) & (~a1 | v1) & (~a2 | v2)

But when a2 is a constant, this could be reduced to

  v1 & ~a2

To do this, we could alternatively

  (A) add an appropriate optimization to ir_opt.c
  (B) prevent the complicated code from being generated in the first place

The latter should result in better performance overall, because fewer
objects have to be generated (and eliminated again).

So this implements (B).  The implementation follows the spirit of the
existing logic.

2 weeks agoconfigure: group together C++ checks
Paul Floyd [Mon, 13 Oct 2025 19:13:04 +0000 (21:13 +0200)] 
configure: group together C++ checks

2 weeks agoAdd PTEST SSE4.1 support for x86
Mark Wielaard [Wed, 18 Mar 2026 17:18:38 +0000 (18:18 +0100)] 
Add PTEST SSE4.1 support for x86

Add handling of PTEST to VEX/priv/guest_x86_toIR.c based on the
guest_amd64_toIR.c implementation (dis_xTESTy_128 and finish_xTESTy,
but only for 128 bit PTEST). Take tests from amd64/sse4-64.c with same
test vectors to make sure flag results are the same.

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

2 weeks agoFreeBSD sanity-level checks: clean up maybe_merge_procmap_stack()
Paul Floyd [Wed, 1 Apr 2026 19:42:52 +0000 (21:42 +0200)] 
FreeBSD sanity-level checks: clean up maybe_merge_procmap_stack()

This was using hard coded max stack size values. Use sysctl instead,
as suggested in the comments.

S$xlight complication for x86 on amd64 - need to checks
compat.ia32.maxssiz first. If that fails then the binary is
running on an x86 kernel and fall back to using kern.maxssiz.

2 weeks agoAdd SSE4.1 PBLENDVB, BLENDVPS and BLENDVPD
Alexandra Hájková [Wed, 18 Feb 2026 16:43:28 +0000 (11:43 -0500)] 
Add SSE4.1 PBLENDVB, BLENDVPS and BLENDVPD

Add decoding of PBLENDVB (0x66 0F 38 10), BLENDVPS (0x66 0F 38 14)
and BLENDVPD (0x66 0F 38 15) for x86 32-bit in guest_x86_toIR.c.

Copy do_SseAssistedVectorAndScalar from VEX/priv/host_amd64_isel.c
to VEX/priv/host_x86_isel.c and modify it for x86 32 bit.

Also fix h_generic_calc_SarN64x2 and h_generic_calc_SarN8x16 to use
VEX_REGPARM(3), required for the x86 helper call convention.

Move PBLENDVB, BLENDVPS and BLENDVPD tests from sse4-64.c into
the shared sse4-common.h so they are also exercised on x86.

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

2 weeks agoHide the --max-guard-pages cmdline switch on non-linux
Martin Cermak [Wed, 1 Apr 2026 12:46:11 +0000 (14:46 +0200)] 
Hide the --max-guard-pages cmdline switch on non-linux

Hide the --max-guard-pages command line switch on non-linux,
update none/tests/cmdline{1,2} accordingly.  Related to bug

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

2 weeks agoBug 514297 - Track madvise MADV_GUARD_INSTALL in address space manager
Martin Cermak [Tue, 31 Mar 2026 15:50:48 +0000 (17:50 +0200)] 
Bug 514297 - Track madvise MADV_GUARD_INSTALL in address space manager

Linux 6.13+ and Glibc 2.42+ introduce lightweight stack guard
pages based on madvise() syscall.

The purpose of a guard page is to prevent buggy (or malicious)
code from overrunning a memory region. An inaccessible page
placed at the end of a region will cause a segmentation fault
should the running process try to read or write to it;
well-placed guard pages can trap a number of common buffer
overruns and similar problems. Prior to 6.13, though, the only
way to put a guard page into a process's address space was to set
the protections on one or more pages with mprotect(); that works,
but at the cost of creating a new virtual memory area (VMA) to
contain the affected page(s). Placing a lot of guard pages will
create a lot of VMAs, which can slow down many memory-management
functions.

The new guard-page feature addresses this problem by working at
the page-table level rather than creating a new VMA. A process
can create guard pages with a call to madvise(), requesting the
MADV_GUARD_INSTALL operation. The indicated range of memory will
be rendered inaccessible; any data that might have been stored
there prior to the operation will be deleted. There is an
operation (MADV_GUARD_REMOVE) to remove guard pages as well.

https://lwn.net/Articles/1011366/

With glibc commit a6fbe36b7f31 and others, a guard page is
installed for each new thread.  In the future, guard pages might
be used also for DSOs supporting multiple kernel page sizes.
Except for madvise, a guard page may also be removed via
munmap().  This update introduces the support for this new type
of linux guard pages into Valgrind.

Add new --max-guard-pages command line switch to allow
customizing the maximal count of guard pages Valgrind can handle.
Add new testcase memcheck/tests/linux/madv_guard.

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

2 weeks agoDarwin suppressions: several helgrind suppressions
Paul Floyd [Tue, 31 Mar 2026 11:40:08 +0000 (13:40 +0200)] 
Darwin suppressions: several helgrind suppressions

Mainly from our friend, getaddrinfo.
I'm still seeing a lock held at exit.

3 weeks agoppc: Fix BZ 517596
Florian Krohm [Mon, 30 Mar 2026 20:06:03 +0000 (20:06 +0000)] 
ppc: Fix BZ 517596

Found by cppcheck. Reported by dcb314@hotmail.com.

3 weeks agoDarwin regtest and suppressions: more for Darwin 19
Paul Floyd [Mon, 30 Mar 2026 11:25:52 +0000 (13:25 +0200)] 
Darwin regtest and suppressions: more for Darwin 19

I upgraded my VM host and I suspect that this changed the default
CPU features and CPUID. Result: new races for DRD and Helgrind
in the getaddrinfo, one new leak in dyd and lots of new allocations
picked up by the massif tests.

3 weeks agoBug 518159 - pth_once issues on Darwin
Paul Floyd [Thu, 26 Mar 2026 08:05:13 +0000 (09:05 +0100)] 
Bug 518159 - pth_once issues on Darwin

3 weeks agoVEX: Remove VEXGLO_N_ALWAYSDEFD
Florian Krohm [Fri, 27 Mar 2026 15:14:59 +0000 (15:14 +0000)] 
VEX: Remove VEXGLO_N_ALWAYSDEFD

Use flexible array instead.

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

3 weeks agoDarwin regtest: add an expected for none empty-exe
Paul Floyd [Thu, 26 Mar 2026 20:12:48 +0000 (21:12 +0100)] 
Darwin regtest: add an expected for none empty-exe

A bit like the previous commit, the bahaviour of /bin/sh
has changed with macOS 10.15.

Up to and including 10.14 (and other OSes) the shell just reads
the empty file and does nothing.

With macOS 10.15, the shell reads the empty file and then starts
a subshell which does nothing.

The result is a missing carriage return on stderr.

3 weeks agoDarwin regtest: make new version of scripts shell test
Paul Floyd [Thu, 26 Mar 2026 19:28:14 +0000 (20:28 +0100)] 
Darwin regtest: make new version of scripts shell test

The behaviour of /bin/sh changed with macOS 10.15. When trying to
exec a new process that will fail the child process still gets
created. On older versions of macOS execve fails like it does on
Linux and FreeBSD.

On Darwin, the shell test now gets run twice, once normally and
once with --trace-children=yes.

3 weeks agos390x: Exploit "load address" in isel
Andreas Arnez [Thu, 26 Mar 2026 12:33:17 +0000 (13:33 +0100)] 
s390x: Exploit "load address" in isel

Compared to AGHI, the "load address" instrucions LA and LAY can be
beneficial for register allocation since they allow for distinct source
and destination operands.  This can often avoid unnecessary register
moves.

Exploit them when appropriate in isel.

3 weeks agos390x: Exploit instructions for bitwise NAND and NOR in isel
Andreas Arnez [Thu, 26 Mar 2026 12:33:17 +0000 (13:33 +0100)] 
s390x: Exploit instructions for bitwise NAND and NOR in isel

Newer z/Architecture machines have the instructions NORK and NOGRK for
calculating bit-wise NOR, as well as NNRK and NNGRK for bitwise NAND.
Exploit those when applicable.

3 weeks agos390x: Exploit `and/or with complement' in isel
Andreas Arnez [Thu, 26 Mar 2026 12:33:17 +0000 (13:33 +0100)] 
s390x: Exploit `and/or with complement' in isel

The miscellaneous-instruction-extensions facility 3 provides the
z/Architecture instructions NCRK, NCGRK, OCRK, and OCGRK.  For operands
`a' and `b' these bitwise operations yield

    a and not(b)
    a or not(b)

Exploit these instructions in the instruction selector.

3 weeks agoBug 486180 - [Valgrind][MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SY...
Paul Floyd [Fri, 20 Mar 2026 06:28:09 +0000 (07:28 +0100)] 
Bug 486180 - [Valgrind][MIPS] 'VexGuestArchState' has no member named 'guest_IP_AT_SYSCALL'

This change completely removes IP_AT_SYSCALL.

It used to be used during syscall handling to get the IP in the case
of a syscall restart. Now all platforms use simplys
 "IP -= size of op syscall".

It was also used by s390 for extension handling, That now uses
VG_(get_IP)(tid);

3 weeks agoBug 518078 - Configure should accept names for GDB other than "gdb"
Paul Floyd [Wed, 25 Mar 2026 12:19:56 +0000 (13:19 +0100)] 
Bug 518078 - Configure should accept names for GDB other than "gdb"

3 weeks agoVEX: Remove unused files
Florian Krohm [Wed, 25 Mar 2026 10:01:08 +0000 (10:01 +0000)] 
VEX: Remove unused files

These files are leftovers from the time when VEX code was stored in a
separate repository. The files were never shipped, were intended for
developer use only and are no longer useful.

Related commits are:
721ac5231f6bda17f592ebdc8efdfeff36f4ef86
c5218ff4c1215ceaee76bc8bafadbc23484d4be0

3 weeks agoBug 518076 - FreeBSD: add syscall wrapper for renameat2
Paul Floyd [Tue, 24 Mar 2026 19:50:34 +0000 (20:50 +0100)] 
Bug 518076 - FreeBSD: add syscall wrapper for renameat2

Made the existing Linux renameat2 wrapper generic.

3 weeks agoFreeBSD regtest: add another expected for realpathat2
Paul Floyd [Tue, 24 Mar 2026 20:01:19 +0000 (21:01 +0100)] 
FreeBSD regtest: add another expected for realpathat2

FreeBSD 16 has added several changes to realpathat. Some of those
are just swapping strlcat with strlcpy. I could add that to the
filter. However, the strlcat also has an extra invalid read.

3 weeks agoDarwin: add a hardwired redir for bcmp
Paul Floyd [Tue, 24 Mar 2026 12:57:31 +0000 (13:57 +0100)] 
Darwin: add a hardwired redir for bcmp

This allows 2 suppressions to be removed.

3 weeks agoDarwin env vars: mostly revert not setting DYLD_SHARED_REGION for Darwin 20 and later.
Paul Floyd [Tue, 24 Mar 2026 07:48:57 +0000 (08:48 +0100)] 
Darwin env vars: mostly revert not setting DYLD_SHARED_REGION for Darwin 20 and later.

Sigh. The default value ought to work. Tested on macOS 10.14. It worked.
Tested on macOS 10.15. It worked. Tested on macOS 11. It worked.
Tested on macOS 12. It worked. Pushed the code.

Tested on macOS 13. It failed. No idea why.

3 weeks agoDarwin regtest: add DRD filter _pthread_start -> start_thread
Paul Floyd [Tue, 24 Mar 2026 07:09:28 +0000 (08:09 +0100)] 
Darwin regtest: add DRD filter _pthread_start -> start_thread

3 weeks agoDarwin regtest: add a couple of ignore functions to massif mmapunmap
Paul Floyd [Tue, 24 Mar 2026 06:37:30 +0000 (07:37 +0100)] 
Darwin regtest: add a couple of ignore functions to massif mmapunmap

These function names are for macOS 13. There may be more for other versions
of Darwin.

3 weeks agoDarwin suppression: another one for getaddrinfo
Paul Floyd [Tue, 24 Mar 2026 06:24:54 +0000 (07:24 +0100)] 
Darwin suppression: another one for getaddrinfo

4 weeks agoHelgrind xml filter: fix for hex value filtering
Paul Floyd [Sun, 22 Mar 2026 18:45:42 +0000 (19:45 +0100)] 
Helgrind xml filter: fix for hex value filtering

The hex raplacement was using

    "0x([0-9a-zA-Z]+)"      => "........",

On Darwin 17 one testcase has a line

   <unique>0xe</unique>

After matching we do global replacement of capture $1. In this case
that was 'e' and the result of global replacement was

   <uniqu........>0x........</uniqu........>

That then failed to match the replacement

   "<unique>(.*)</unique>" => "...",

I've just moved the '0x' into both the key and the pattern.
That reduces the chances of accidental matches. A better fix
would be to use more context for the replacement.

4 weeks agoNEWS: add bug 511461 Darwin 17 (MacOS X 10.13) memcheck issues
Paul Floyd [Sun, 22 Mar 2026 16:18:41 +0000 (17:18 +0100)] 
NEWS: add bug 511461 Darwin 17 (MacOS X 10.13) memcheck issues

I think I've done about as much as I can reasonably do for this.

Will open new issues if necessary.

Remaining regtest faulures are due to:
many many many Darwin leaks
debuginfo differences
unsupported x86 opcodes
libpthread race in stack teardown (?) - fixed in macOS 10.14
Darwin has different output of v.info monitor request

4 weeks agos390: Fix typos.
Florian Krohm [Sat, 21 Mar 2026 18:43:52 +0000 (18:43 +0000)] 
s390: Fix typos.

4 weeks agos390: Fix compilation of testcases with clang 20.1.8
Florian Krohm [Sat, 21 Mar 2026 18:04:25 +0000 (18:04 +0000)] 
s390: Fix compilation of testcases with clang 20.1.8

bfp-fpc.c: The SRNMB insn requires the floating-point extension.
Add -march=arch9 to compile flags which corresponds to z196 which is
the minimum requires machine model.
The clang error is apparently triggered by the mnemonic. C.f. bfp-convert.c
which also uses insns requiring the floating-point extension. But those insns
are pieced together in a different way avoiding the mnemonic.

ex.c, exrl.c: The SGRK insn requires the distinct-operands facility.
Add -march=arch9.

vecdiv.c, vme.c: The insns require the vector facility.
Add -march=z13.

tmxx.c: The LOCGR insn requires the load/store-on-condition facility.
Add -march=arch9.

4 weeks agoRemove s390_disasm.c from VEX/Makefile-gcc
Paul Floyd [Sat, 21 Mar 2026 06:40:29 +0000 (07:40 +0100)] 
Remove s390_disasm.c from VEX/Makefile-gcc

The file was removed as part of the switch to using objdump for
disasm on s390.

4 weeks agoDarwin: add only necessary env vars
Paul Floyd [Fri, 20 Mar 2026 21:03:14 +0000 (22:03 +0100)] 
Darwin: add only necessary env vars

We were always adding DYLD_SHARED_REGION. On macOS 11+ this isn't
necessary and we can just leave dyld do its thing. If we
don't add it we don't need to remove it either.

4 weeks agoFix a few VexGuestXxxState offset comments
Paul Floyd [Fri, 20 Mar 2026 20:01:18 +0000 (21:01 +0100)] 
Fix a few VexGuestXxxState offset comments

I haven't checked them all, but a few were wrong. This is part of
the preparation for a patch for bug 486180.

4 weeks agos390x: Fix vec3 test case when using clang
Andreas Arnez [Fri, 20 Mar 2026 12:11:03 +0000 (13:11 +0100)] 
s390x: Fix vec3 test case when using clang

The llvm assembler behaves differently from gas when dealing with
unassigned bits in an .insn directive.  While gas fills them with the
given instruction text, clang sets them to zeroes.

In the VRR format this affects bits 20-23:

+--------+----+----+----+---+----+----+----+------------+
| OpCode | V1 | V2 | V3 |///| M6 | M5 | M4 |   Opcode   |
+--------+----+----+----+---+----+----+----+------------+
0        8    12   16       24   28   32   36           47

The `vec3' test case exploits filling these bits in TEST_V3OP, thus it
fails when compiled with clang.  Fix this by using VRI instead of VRR and
assigning fixed registers to the missing vector operands in that format.

The issue also applies to TEST_VBLEND, but since VBLEND is just another
3-input-operand instruction, treat it like that and drop the special
handling.

4 weeks agoDarwin regtest: add some more ignore-fn for massif overloaded-new
Paul Floyd [Thu, 19 Mar 2026 20:21:32 +0000 (21:21 +0100)] 
Darwin regtest: add some more ignore-fn for massif overloaded-new

On Darwin 18.

4 weeks agoDarwin regtest: small change for memcheck descr_belowsp
Paul Floyd [Thu, 19 Mar 2026 19:05:18 +0000 (20:05 +0100)] 
Darwin regtest: small change for memcheck descr_belowsp

On Darwin reading below the bottom of the allowed stack produces a SIGBUS
not a SIGSEGV. So handle that as well.

The test still fails as the macOS describe mechanism is very different,
relying on OS vm functions.

4 weeks agoDarwin: don't remove VALGRIND_LAUNCHER from vg_cleanup_env
Paul Floyd [Thu, 19 Mar 2026 13:10:49 +0000 (14:10 +0100)] 
Darwin: don't remove VALGRIND_LAUNCHER from vg_cleanup_env

It gets put there by launcher-darwin.c but it was already removed
by initimg-darwin.c by the time the preloads get loaded and this
function marked constructor runs.

I'll probably also look at not bothering to set DYLD_SHARED_REGION=use
on macOS >= 11 since that is the default.

4 weeks agoBug 517748 - Add ability to redirect global functions to Darwin
Paul Floyd [Thu, 19 Mar 2026 07:53:23 +0000 (08:53 +0100)] 
Bug 517748 - Add ability to redirect global functions to Darwin

4 weeks agoconfigure: was missing SOLARIS_HAVE_SYS_CRYPTO_IOCTL_H set to false for non-Solaris...
Paul Floyd [Wed, 18 Mar 2026 20:37:27 +0000 (21:37 +0100)] 
configure: was missing SOLARIS_HAVE_SYS_CRYPTO_IOCTL_H set to false for non-Solaris OSes.

4 weeks agoBug 517697 - Implement CLRSSONSTACK and SETUJMPBUF handling on Solaris.
Paul Floyd [Wed, 18 Mar 2026 19:51:42 +0000 (20:51 +0100)] 
Bug 517697 - Implement CLRSSONSTACK and SETUJMPBUF handling on Solaris.

Patch provided by Casper H. S. Dik. Thanks!

4 weeks agoBug 512291 - Valgrind on Solaris should drop support for long gone /dev/crypto framework
Paul Floyd [Wed, 18 Mar 2026 19:41:00 +0000 (20:41 +0100)] 
Bug 512291 - Valgrind on Solaris should drop support for long gone /dev/crypto framework

Initial patch provided by Vladimír Marek <vlmarek13@gmail.com>.
I've changed it a bit to add a configure test and break out a new
solaris regtest, scalar_crypto.

4 weeks agoSolaris: compiler warnings and one regtest compile error
Paul Floyd [Wed, 18 Mar 2026 19:36:46 +0000 (20:36 +0100)] 
Solaris: compiler warnings and one regtest compile error

4 weeks agos390x: Slightly optimize AND/OR/XOR with immediates
Andreas Arnez [Wed, 18 Mar 2026 17:27:44 +0000 (18:27 +0100)] 
s390x: Slightly optimize AND/OR/XOR with immediates

In host_s390_defs.c, when generating code for AND, OR, or XOR with a
64-bit immediate value, two instructions are emitted: one for each 32-bit
half of the full 64-bit value.  In cases where the value only affects the
low or the high half of the result, one of these instructions becomes a
no-op.

For these cases, just suppress the effective no-op instructions.

4 weeks agos390x: Fix negative signed immediate operands in code gen
Andreas Arnez [Wed, 18 Mar 2026 17:27:44 +0000 (18:27 +0100)] 
s390x: Fix negative signed immediate operands in code gen

The helper functions that check whether an integer constant fits into a
16-bit or 32-bit signed immediate operand always return false for negative
values.  This prevents the use of negative immediate operands altogether
and may lead to unnecessarily clumsy code being emitted, such as

  v-add    %r8,-160               8 bytes
  iihf      %r0,4294967295
  iilf      %r0,4294967136
  agr       %r8,%r0

instead of

  v-add    %r8,-160               8 bytes
  aghi      %r8,-160

This behavior is a regression; it was introduced by

  commit #0282c1cfc9015b69d09 -- s390: Tweak a few helper functions.

However, the previous code was perhaps a bit obscure.  So instead of
reverting to that, use simple checks like "val + 0x8000 <= 0xFFFF",
exploiting standard C integer semantics.

4 weeks agoDarwin regtest: fix compilation of gdbserver_tests/self_invalidate.c
Paul Floyd [Wed, 18 Mar 2026 06:48:39 +0000 (07:48 +0100)] 
Darwin regtest: fix compilation of gdbserver_tests/self_invalidate.c

This test checks for amd64 or mips. For amd64 it uses syscall 64.
That is 'exit' on Linux, 'umask' on both FreeBSD and Solaris
(which seems to work by accident). On Darwin it isn't a valid
syscall number which causes a Valgrind error.

Now Darwin uses syscall 0x02000001 (exit) and the test passes.

4 weeks agos390x: Mention "mi3" in show_hwcaps()
Andreas Arnez [Tue, 17 Mar 2026 15:21:27 +0000 (16:21 +0100)] 
s390x: Mention "mi3" in show_hwcaps()

When the miscellaneous-instruction-extensions facility 3 is present, it's
missing from the list shown by show_hwcaps().  Fix that.

4 weeks agoDarwin stack creation: hack to keep apple pointer conrrect on macOS 12+
Paul Floyd [Tue, 17 Mar 2026 07:46:34 +0000 (08:46 +0100)] 
Darwin stack creation: hack to keep apple pointer conrrect on macOS 12+

From Louis Brunner's port.

4 weeks agoBug 517597 - auxprogs/getoff.c:151: pointless test ?
Paul Floyd [Tue, 17 Mar 2026 06:15:52 +0000 (07:15 +0100)] 
Bug 517597 - auxprogs/getoff.c:151: pointless test ?

5 weeks agos390: Fix compilation with clang.
Florian Krohm [Mon, 16 Mar 2026 14:49:44 +0000 (14:49 +0000)] 
s390: Fix compilation with clang.

BFP testcases were broken when compiling with clang which does not
recognise -mlong-double-128 on s390

5 weeks agoLinux syswrap: several LINX_ that should be LINXY
Paul Floyd [Sun, 15 Mar 2026 12:56:55 +0000 (13:56 +0100)] 
Linux syswrap: several LINX_ that should be LINXY

5 weeks agoDarwin regtst: turn off debug traces in none apple-main-arg
Paul Floyd [Sun, 15 Mar 2026 17:43:13 +0000 (18:43 +0100)] 
Darwin regtst: turn off debug traces in none apple-main-arg

5 weeks agoDarwin regtest: add an expected for memcheck dw4
Paul Floyd [Sun, 15 Mar 2026 17:21:45 +0000 (18:21 +0100)] 
Darwin regtest: add an expected for memcheck dw4

This test uses sbrk(). The macOS man page starts with

     The brk and sbrk functions are historical curiosities left over from earlier days before
     the advent of virtual memory management.

Looks like they have a bit of an opinion there. This change also
turns off the sbrk() tests on Darwin.

5 weeks agoSolaris syswrap: fix a wrapper uising SOLX_ which should be SOLXY
Paul Floyd [Sun, 15 Mar 2026 12:55:12 +0000 (13:55 +0100)] 
Solaris syswrap: fix a wrapper uising SOLX_ which should be SOLXY

5 weeks agoRegtest build: fix exp-bbv build on amd64 Linux
Paul Floyd [Sun, 15 Mar 2026 07:36:52 +0000 (08:36 +0100)] 
Regtest build: fix exp-bbv build on amd64 Linux

I was overwriting the ld flags with @LDFLAG_NO_PIE@ rather than
adding to them.

5 weeks agoDarwin and FreeBSD syswrap: fix use of MACXY and BSDXY macros
Paul Floyd [Sat, 14 Mar 2026 20:39:15 +0000 (21:39 +0100)] 
Darwin and FreeBSD syswrap: fix use of MACXY and BSDXY macros

PRE and POST ae defined but only BSDX_ / MACX_ used.

5 weeks agoRegtest: fix use of -no-pie
Paul Floyd [Sat, 14 Mar 2026 13:30:34 +0000 (14:30 +0100)] 
Regtest: fix use of -no-pie

This should be a linker option only (-fno-pie is the compiler equivalent
which we don't need with out small one file testcases). Use it with
-Wl,-no-pie because not all platforms support PIE and it may produce
a warning when used with the compiler as linker driver.