]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
5 weeks agoClean up initimg-freebsd ascii stack drawing and rationalise darwin VG_STACK_REDZONE_...
Paul Floyd [Wed, 4 Mar 2026 12:10:06 +0000 (13:10 +0100)] 
Clean up initimg-freebsd ascii stack drawing and rationalise darwin VG_STACK_REDZONE_SZB etc

VG_STACK_REDZONE_SZB and related have the same groups of values on x86 and amd64.
Darwin had duplicate definitions so I stuck them all together.

values

5 weeks agos390: Print guest register names symbolically
Florian Krohm [Wed, 4 Mar 2026 11:12:50 +0000 (11:12 +0000)] 
s390: Print guest register names symbolically

This is quite convenient when looking at VEX traces obtained during
insn selection and register allocation.

Today this looks like this:
------------------------ Register-allocated code ------------------------

  0   v-evcheck counter = 804(%r13), fail-addr = 808(%r13)
  1   v-test   1424(%r13)             8 bytes
  2   v-call   if (not equal) MC_(helperc_value_check0_fail_no_o){0x8000100C0}()
  3   v-loadi  %r5,0                  8 bytes
  4   v-cmpu   %r5,608(%r13)          8 bytes
  5   v-xdirect if (not equal) 720(%r13) = 0x4038182  fast
  6   v-xdirect if (always) 720(%r13) = 0x4038190  fast

With the change:
------------------------ Register-allocated code ------------------------

  0   v-evcheck counter = guest_EvC_COUNTER, fail-addr = guest_EvC_FAILADDR
  1   v-test   shadow1_r4             8 bytes
  2   v-call   if (not equal) MC_(helperc_value_check0_fail_no_o){0x800010060}()
  3   v-loadi  %r5,0                  8 bytes
  4   v-cmpu   %r5,guest_r4           8 bytes
  5   v-xdirect if (not equal) guest_IA = 0x4038182  fast
  6   v-xdirect if (always) guest_IA = 0x4038190  fast

Guest registers are now written out symbolically:
1424(%r13) becomes shadow1_r4
608(%r13)  becomes guest_r4
720(%r13)  becomes guest_IA

The new behaviour is enabled by default but can be controlled at compile
time by defining SYMBOLIC_REGNAMES as desired.

5 weeks agoBug 390754 - unhandled amd64-darwin syscall: unix:216 (open_dprotected_np)
Paul Floyd [Tue, 3 Mar 2026 13:02:16 +0000 (14:02 +0100)] 
Bug 390754 - unhandled amd64-darwin syscall: unix:216 (open_dprotected_np)

5 weeks agoSimplify condition in VG_(post_syscall)
Paul Floyd [Tue, 3 Mar 2026 11:46:45 +0000 (12:46 +0100)] 
Simplify condition in VG_(post_syscall)

5 weeks agoDarwin syscall: sigwait arguments are not optionally NULL
Paul Floyd [Mon, 2 Mar 2026 20:27:26 +0000 (21:27 +0100)] 
Darwin syscall: sigwait arguments are not optionally NULL

So always PRE_MEM_READ/WRITE them.

5 weeks agoFreeBSD syscall: clean up sigwait wrapper
Paul Floyd [Mon, 2 Mar 2026 20:12:13 +0000 (21:12 +0100)] 
FreeBSD syscall: clean up sigwait wrapper

This is another that returns 0 / errno code. The POST was already
doing the right thing. Changed the PRE to always set SfMayBlock
rather than only if ARG1 is safe to dereference.

Updated testcase.

5 weeks agoBug 516748 - clock_nanosleep was also wrong
Paul Floyd [Mon, 2 Mar 2026 19:15:32 +0000 (20:15 +0100)] 
Bug 516748 - clock_nanosleep was also wrong

clock_nanosleep returns 0 or an errno error code, not 0/-1 and it does not set errno.

The code was copied and pasted from Linux which does return 0/-1.
That means that the POST only needs a POST_MEM_WRITE for ARG4 if
the remainder timespec pointer is not NULL and RES is EINTR.
The error flag is not set so the syscall appears to have succeeded.

5 weeks agoFreeBSD README: add a section on syscalls.
Paul Floyd [Sun, 1 Mar 2026 20:51:29 +0000 (21:51 +0100)] 
FreeBSD README: add a section on syscalls.

With an emphasis on syscall SYS_syscall argument shuffling.

5 weeks agoFreeBSD regtest: add lsframe1 and lsframe2
Paul Floyd [Sun, 1 Mar 2026 18:55:56 +0000 (19:55 +0100)] 
FreeBSD regtest: add lsframe1 and lsframe2

Not only Darwin does not have a version of these tests.

I've been trying to see why lsframe2 is failing on illumos and I saw that
these tests are only for Linux and Solaris. So this adds FreeBSD to
the mix.

5 weeks agoExplain why realloc_size_zero does not use Addr.Block and clean up a volatile cast
Paul Floyd [Sun, 1 Mar 2026 17:19:46 +0000 (18:19 +0100)] 
Explain why realloc_size_zero does not use Addr.Block and clean up a volatile cast

5 weeks agoDarwin syscall: clean up posix_spawn and add to scalar
Paul Floyd [Sat, 28 Feb 2026 15:43:38 +0000 (16:43 +0100)] 
Darwin syscall: clean up posix_spawn and add to scalar

5 weeks agoDarwin syscall: add missing attr argument to posix_spawn wrapper
Paul Floyd [Sat, 28 Feb 2026 13:48:14 +0000 (14:48 +0100)] 
Darwin syscall: add missing attr argument to posix_spawn wrapper

5 weeks agoFreeBSD syscall: add wrapper for pdwait system call
Paul Floyd [Sat, 28 Feb 2026 11:01:31 +0000 (12:01 +0100)] 
FreeBSD syscall: add wrapper for pdwait system call

Also add 516748 to NEWS. It's done for FreeBSD and finding syscalls
like that is quite hard.

6 weeks agoClean up setting carry flag in VG_(fixup_guest_state_after_syscall_interrupted)
Paul Floyd [Fri, 27 Feb 2026 20:26:23 +0000 (21:26 +0100)] 
Clean up setting carry flag in VG_(fixup_guest_state_after_syscall_interrupted)

This wasn't consistent (not at all for Darwin, not checking SfNoWriteResult
on Solaris and a bit long winded on FreeBSD). Simplify the code for all
3 platforms.

6 weeks agoFreeBSD syscall: add pdrfork as sys_ni_syscall
Paul Floyd [Fri, 27 Feb 2026 19:31:10 +0000 (20:31 +0100)] 
FreeBSD syscall: add pdrfork as sys_ni_syscall

rfork with a process descriptor. I'm not sure if we'll ever properly
support any form of rfork.

6 weeks agoFreeBSD syscall: typo or copy/paste error in copy_file_range
Paul Floyd [Thu, 26 Feb 2026 19:30:16 +0000 (20:30 +0100)] 
FreeBSD syscall: typo or copy/paste error in copy_file_range

Was using
       !ML_(fd_allowed)(ARG3, "copy_file_range(infd)", tid, False))
whilst ARGS is outfd, not infd.

6 weeks agoFreeBSD syscall: add wrapper for kexec_load
Paul Floyd [Thu, 26 Feb 2026 12:41:31 +0000 (13:41 +0100)] 
FreeBSD syscall: add wrapper for kexec_load

Not sure if it was worth bothering with this (and the checking is
probably incomplete).

Linux and Darwin have this where it is not implemented or sys_ni_syscall.

6 weeks agoBug 516748 - initial fix for FreeBSD posix_fallocate and posix_fadvise
Paul Floyd [Thu, 26 Feb 2026 12:13:28 +0000 (13:13 +0100)] 
Bug 516748 - initial fix for FreeBSD posix_fallocate and posix_fadvise

All I wanted to do was add a syscall wrapper for kexec_load and then
I discovered this problem :-(.

When I'm done with kexec_load (and pdrfork and pdwait) I'll get back to this.

6 weeks agoFreeBSD regtest: update scalar testcase to check syscalls that return error codes
Paul Floyd [Thu, 26 Feb 2026 11:53:58 +0000 (12:53 +0100)] 
FreeBSD regtest: update scalar testcase to check syscalls that return error codes

Leading to Bug 516748

6 weeks agomemcheck warnings: cast addresses to void* for %p args in mc_main DEBUG macros
Paul Floyd [Mon, 23 Feb 2026 06:39:19 +0000 (07:39 +0100)] 
memcheck warnings: cast addresses to void* for %p args in mc_main DEBUG macros

7 weeks agos390 disasm-test: Add new opcodes from Principles of Ops 15th edition
Florian Krohm [Fri, 20 Feb 2026 22:03:38 +0000 (22:03 +0000)] 
s390 disasm-test: Add new opcodes from Principles of Ops 15th edition

Add opcodes: BDEPG, BEXTG, CLZF, CTZG, LXA[BHFGQ], LLXA[BHFGQ], VBLEND,
VGEM, VD, VDL, VEVAL, VR, VRL
Adjust prerequisite test (needs -march=arch15 now) and expected results.

Fix s390_irgen_VDx: M5 values with one or more reserved bits set do not
cause a specification exception. Found by disasm-test.

7 weeks agoSolaris debuglog: fix clobber list for local_sys_write_stderr
Paul Floyd [Fri, 20 Feb 2026 21:26:40 +0000 (22:26 +0100)] 
Solaris debuglog: fix clobber list for local_sys_write_stderr

There were no registers in the clobber list. RDI is clobbered by the
value 2 for stderr. So back in 'add_to_buf' the next character to
be added to the VG_(debugLog) buffer was getting clobbered with a 2.
Also clobber RCX and R11 (syscall scratch registers).

7 weeks agoBug 503239 - s390x: Vector-enhancements facility 3, division
Andreas Arnez [Thu, 19 Feb 2026 13:44:17 +0000 (14:44 +0100)] 
Bug 503239 - s390x: Vector-enhancements facility 3, division

Add support for the vector instructions VD, VDL, VR, and VRL.  These
perform integer division and remainder operations for lane widths of 32,
64, and 128 bits.

For lane widths up to 64 bit emulate them with existing instructions, by
handling each lane individually.  Also emulate the masking of bad
divisions when the "integer-divide control" bit is set.

For 128-bit integers exploit the new instructions in the emitted code,
since no previous instructions can perform the required calculations, and
emulation would be quite expensive.  Represent the operations in IR with
the existing Iop_DivS128, Iop_DivU128, Iop_ModS128, and Iop_ModU128, and
handle those in host_s390_isel.c appropriately.

This concludes vector-enhancements facility 3 support, so set facility bit
198 on CPUs that have the facility installed.

7 weeks agoBug 503239 - s390x: Vector-enhancements facility 3 (w/o division)
Andreas Arnez [Thu, 19 Feb 2026 13:44:17 +0000 (14:44 +0100)] 
Bug 503239 - s390x: Vector-enhancements facility 3 (w/o division)

Add support for most of the vector-enhancements facility 3, except for the
vector division and vector remainder instructions.

New instructions:
  VBLEND, VGEM, VEVAL

Added doubleword (64-bit) support:
  VUPH, VUPLH, VUPL, VUPLL
  VMAE, VMALE, VMAO, VMALO
  VME, VMLE, VMO, VMLO

Doubleword and quadword support:
  VMAL, VMAH, VMALH
  VML, VMH, VMLH

Quadword (128-bit) support:
  VAVG, VAVGL
  VEC, VECL
  VCEQ, VCH, VCHL
  VCLZ, VCTZ
  VLC, VLP
  VMX, VMXL, VMN, VMNL

So far the instructions VCEQ, VMAH, VMALH, VCH, and VCHL had been
implemented with the use of dirty helpers.  Replace this by full
emulation.  In particular, now generate IR that calculates the resulting
condition code of VCEQ, VCH, and VCHL.  Since that calculation works the
same for VCEQ, VCH, and VCHL, move it to a new helper routine,
s390_V128_setcc_for_cmp().

Add more routines for common logic where appropriate, such as
s390_V128_add(), s390_V128_CmpGTU(), etc.  This results in code changes
for some instructions that are not touched by the new facility, such as VA
and VREPI.

Since the new support results in fewer specification exceptions, adjust
disasm-test accordingly.

7 weeks agoBug 503238 - s390x: Support misc.-instruction-extensions facility 4
Andreas Arnez [Thu, 19 Feb 2026 13:44:17 +0000 (14:44 +0100)] 
Bug 503238 - s390x: Support misc.-instruction-extensions facility 4

Enable Valgrind to provide the "miscellaneous-instruction-extensions
facility 4", which is first introduced in IBM z17 CPUs and may be
exploited by the compiler when specifying `march=z17'.

In particular, the following new instructions are added:

 * BDEPG and BEXTG -- "bit deposit" and "bit extract"

 * CLZG and CTZG -- "count leading/trailing zeros"

 * LXAB, LLXAB, LXAH, LLXAH, LXAF, LLXAF, LXAG, LLXAG, LXAQ, and LLXAQ --
   "load indexed" and "load logical indexed" with various element sizes

The new instructions are fully emulated.  Still, as usual, Valgrind will
only set the respective facility bit on CPUs that have the bit set
themselves.

7 weeks agos390-runone: --insn now implies --template
Florian Krohm [Thu, 19 Feb 2026 09:46:58 +0000 (09:46 +0000)] 
s390-runone: --insn now implies --template

In other words: when --insn is given, --template can be omitted.

7 weeks agoregtest: Fix prereq test for existence of xmllint.
Florian Krohm [Wed, 18 Feb 2026 12:37:39 +0000 (12:37 +0000)] 
regtest: Fix prereq test for existence of xmllint.

As suggested by Mark.

7 weeks agoBug 406674 - False positive when reading bitfield value on code compiled with clang 7.0
Paul Floyd [Tue, 17 Feb 2026 19:26:09 +0000 (20:26 +0100)] 
Bug 406674 - False positive when reading bitfield value on code compiled with clang 7.0

7 weeks agos390: Use Iop_PopCount64 and emit "popcnt" insn when possible
Florian Krohm [Tue, 17 Feb 2026 19:32:53 +0000 (19:32 +0000)] 
s390: Use Iop_PopCount64 and emit "popcnt" insn when possible

This requires the miscellaneous-instruction-extensions facility 3.
Detect it in m_machine.c, test for it in s390x_features.c.
Add VEX_HWCAPS_S390X_MI3, s390_host_has_mi3 and S390_INSN_POPCNT.
New functions s390_insn_popcnt and s390_insn_popcnt_emit and s390_emit_POPCNT.
New testcase popcnt-mi3.c carved out of misc3.c

7 weeks agoBug 516090 - Regression : Linux FreeBSD and Darwin: refactor *at syscall dirfd check
Paul Floyd [Mon, 16 Feb 2026 18:49:02 +0000 (19:49 +0100)] 
Bug 516090 - Regression : Linux FreeBSD and Darwin: refactor *at syscall dirfd check

7 weeks agoBug 514343 - Add a valgrind.h macro VALGRIND_REPLACES_MALLOC
Paul Floyd [Fri, 6 Feb 2026 07:47:12 +0000 (08:47 +0100)] 
Bug 514343 - Add a valgrind.h macro VALGRIND_REPLACES_MALLOC

Also a macro VALGRIND_GET_TOOLNAME

7 weeks agoBug 233298 - Reflect MEMPOOL_FREE in heap summary
Paul Floyd [Sat, 11 Jan 2025 16:39:44 +0000 (17:39 +0100)] 
Bug 233298 - Reflect MEMPOOL_FREE in heap summary

There was one missing free increment for autoref pools.

Also added testcases based on memcheck mempool2 and leak-autorefpool.

Original patch contributed by 8dcc <8dcc.git@gmail.com>

This is an update on a patch from 2010:
https://bugsfiles.kde.org/attachment.cgi?id=42491

7 weeks agoFreeBSD resgtest: make sure that /proc is mounted as procfs for open_client test
Paul Floyd [Sat, 14 Feb 2026 21:07:03 +0000 (22:07 +0100)] 
FreeBSD resgtest: make sure that /proc is mounted as procfs for open_client test

7 weeks agoReplace which and type with command -v
Mark Wielaard [Sat, 14 Feb 2026 20:36:47 +0000 (21:36 +0100)] 
Replace which and type with command -v

which is an external (csh) command which might not be available. type
is a bourn shell builtin, but not necessarily available outside bash.
Use command -v which is POSIX and should work everywhere.

7 weeks agoregtest: move /proc test to freebsd for none procfs-cmdline-exe
Paul Floyd [Sat, 14 Feb 2026 20:15:52 +0000 (21:15 +0100)] 
regtest: move /proc test to freebsd for none procfs-cmdline-exe

7 weeks agoFix none/tests/freebsd/Makefile.am: procfs-cmdline-exe..stderr.exp typo
Mark Wielaard [Sat, 14 Feb 2026 19:43:47 +0000 (20:43 +0100)] 
Fix none/tests/freebsd/Makefile.am: procfs-cmdline-exe..stderr.exp typo

Should have just one dot ('.').

7 weeks agoBug 515992 - Add FreeBSD /proc virtualisation for cmdline and file
Paul Floyd [Sat, 14 Feb 2026 17:52:12 +0000 (18:52 +0100)] 
Bug 515992 - Add FreeBSD /proc virtualisation for cmdline and file

7 weeks agoregtest: clean out procfs-cmldline-exe vgtest and exp files from Makefile.am
Paul Floyd [Sat, 14 Feb 2026 15:58:44 +0000 (16:58 +0100)] 
regtest: clean out procfs-cmldline-exe vgtest and exp files from Makefile.am

7 weeks agoRegtest: split none procfs-cmdline-exe into one version per platform
Paul Floyd [Sat, 14 Feb 2026 15:37:42 +0000 (16:37 +0100)] 
Regtest: split none procfs-cmdline-exe into one version per platform

This was linux and non-linux where non-linux really meant
non-linux non-solaris non-freebsd i.e., darwin only.

I need to add a FreeBSD version (and /proc support for cmdline).

7 weeks agoSolaris regtest: make Solaris specific procfs-cmdline-exe.c
Paul Floyd [Sat, 14 Feb 2026 15:57:45 +0000 (16:57 +0100)] 
Solaris regtest: make Solaris specific procfs-cmdline-exe.c

Use /proc/pid_or_self/path/a.out rather than /proc/pid_or_self/exe
as in the parent directory.

I'm going to split this test into versions for each platform,
Darwin (with no /proc) can use the Linux one. FreeBSD optionally
has /proc but uses currproc instead of self.

7 weeks agoAdd bacck the return type for handle_self_exe_open
Paul Floyd [Sat, 14 Feb 2026 14:25:44 +0000 (15:25 +0100)] 
Add bacck the return type for handle_self_exe_open

7 weeks agoLinux syswrap: handle_self_exe_open is also now static and Linux only.
Paul Floyd [Sat, 14 Feb 2026 14:23:06 +0000 (15:23 +0100)] 
Linux syswrap: handle_self_exe_open is also now static and Linux only.

7 weeks agoSolaris syswrap: make handle_auxx_open a static function
Paul Floyd [Sat, 14 Feb 2026 15:12:21 +0000 (16:12 +0100)] 
Solaris syswrap: make handle_auxx_open a static function

handle_psinfo_open and handle_cmdline_open are Solaris statics but
ML_(handle_auxv_open) was shared between Linux and Solaris. There is
some common code but I find it less confusing to have all 3 statics
in the same place for Solaris.

This makes handle_auxv_open static for both.

7 weeks agosyswrap cleanup: remove Solaris references in generic sys_open
Paul Floyd [Sat, 14 Feb 2026 12:36:02 +0000 (13:36 +0100)] 
syswrap cleanup: remove Solaris references in generic sys_open

On Solaris sys_open is handled in syswrap-solaris.c

7 weeks agoSolaris syscall wrapper: add procfs cmdline sp[ecial handling to sys_open
Paul Floyd [Sat, 14 Feb 2026 13:22:18 +0000 (14:22 +0100)] 
Solaris syscall wrapper: add procfs cmdline sp[ecial handling to sys_open

Generally it seems that older Solaris (11.3) and OpenIndiana use 'old'
sys_open and do not have procfs cmdline. Newer Solaris (11.4) uses
sys_openat and has procfs cmdline.

OmniOS mixes both, it uses old sys_open and has procfs cmdline.

8 weeks agos390x: Rename s390_format_VRR*() functions
Andreas Arnez [Fri, 13 Feb 2026 16:12:00 +0000 (17:12 +0100)] 
s390x: Rename s390_format_VRR*() functions

After having renamed most of the s390_format_*() functions to match the
names in the z/Architecture Principles of Operation, the last remaining
format functions yet to be renamed are the ones dealing with variants of
the VRR format.

Rename the functions accordingly:

  current       new     sample insn
  ------------  -----   -----------
  VRR_VV        VRRa0   vlr
  VRR_VVM       VRRa1   vclz
  VRRa_VVMM     VRRa2   vfsq
  VRRa_VVMMM    VRRa    vcdg
  VRR_VVVMM     VRRb    vceq
  VRR_VVV       VRRc0   vn
  VRR_VVVM      VRRc1   va
  VRRa_VVVMM    VRRc2   vfa
  VRRa_VVVMMM   VRRc    vfmin
  VRRd_VVVVM    VRRd1   vac
  VRRd_VVVVMM   VRRd    vmsl
  VRR_VVVV      VRRe0   vperm
  VRRe_VVVVMM   VRRe    vfma
  VRR_VRR       VRRf    vlvgp

Note that none of these directly cover the VISTR instruction.  But that
can be treated as the VRRa format, where m4 is left unused.  So do that
and remove s390_VRR_VVMM(), which previously existed just for this
purpose.

Also, adjust the names of the VRR*() macros to match the format names.
Drop VRRa_v*() and VRRd_v*() and use VRR_v*() instead, since the vector
fields' positions don't depend on the VRR format variant.

8 weeks agos390x: Simplify interface of vector format functions
Andreas Arnez [Fri, 13 Feb 2026 11:38:52 +0000 (12:38 +0100)] 
s390x: Simplify interface of vector format functions

Same as with the non-vector instructions, simplify the interface of the
vector format functions.

8 weeks agos390x: Simplify interface of non-vector insn format functions
Andreas Arnez [Fri, 13 Feb 2026 11:38:52 +0000 (12:38 +0100)] 
s390x: Simplify interface of non-vector insn format functions

Each of the format functions in the translator provides common logic for
handling a specific instruction format.  So far a format function's
interface is defined such that it receives instruction operands as
individual arguments.

This means that the extraction of operands from the opcode -- despite
being common for all invocations of the same format function -- is
duplicated every time.  This is error-prone, results in longer code
overall, and makes the invocations more difficult to read.

The code duplication can be avoided by moving the operand extraction to
the format functions themselves.

Do this for all non-vector instruction formats.

8 weeks agoUpdate the LTP version in valgrind testsuite to v20260130
Martin Cermak [Fri, 13 Feb 2026 11:26:52 +0000 (12:26 +0100)] 
Update the LTP version in valgrind testsuite to v20260130

Update the LTP version in valgrind testsuite to v20260130.
All patches from auxprogs/ltp-patches were accepted by LTP
upstream and included in the release, so these can now be
dropped locally.

8 weeks agoSolaris regtest: fix build of one x86 SSE test on OmniOS
Paul Floyd [Thu, 12 Feb 2026 19:48:01 +0000 (20:48 +0100)] 
Solaris regtest: fix build of one x86 SSE test on OmniOS

8 weeks agodoc: mention other realloc family functions in realloc size zero error description
Paul Floyd [Thu, 12 Feb 2026 12:05:03 +0000 (13:05 +0100)] 
doc: mention other realloc family functions in realloc size zero error description

Also add C23 making realloc size zero UB.

8 weeks agoBug 515731 - Distinguish between realloc functions in realloc size 0 error messages
Paul Floyd [Mon, 9 Feb 2026 06:22:52 +0000 (07:22 +0100)] 
Bug 515731 - Distinguish between realloc functions in realloc size 0 error messages

8 weeks agos390: Fix VG_(machine_get_size_of_largest_guest_register)
Florian Krohm [Tue, 10 Feb 2026 22:27:40 +0000 (22:27 +0000)] 
s390: Fix VG_(machine_get_size_of_largest_guest_register)

Return 16 if the machine has vector registers.

8 weeks agos390x: Fix handling of KIMD-GHASH
Andreas Arnez [Tue, 10 Feb 2026 11:57:48 +0000 (12:57 +0100)] 
s390x: Fix handling of KIMD-GHASH

The KIMD-GHASH function of the "compute intermediate message digest"
instruction is missing from the list returned by KIMD-Query, because the
appropriate bit is set in the wrong field of the returned array.  Fix
this.

8 weeks agoDarwin: don't print "run:dsymutil" unless VG_(clo_verbosity) > 0
Paul Floyd [Mon, 9 Feb 2026 11:04:25 +0000 (12:04 +0100)] 
Darwin: don't print "run:dsymutil" unless VG_(clo_verbosity) > 0

This causes something to end up in stderr.out in regression tests.
There is a filter for it, but that does not apply to tests like
iropt-test that really expect no output and have no stderr filter.

2 months agoLinux reallocarray: update testcase and expected
Paul Floyd [Sun, 8 Feb 2026 18:09:25 +0000 (19:09 +0100)] 
Linux reallocarray: update testcase and expected

2 months agoFreeBSD reallocarray: behaves like realloc on allocation failure
Paul Floyd [Sun, 8 Feb 2026 16:57:30 +0000 (17:57 +0100)] 
FreeBSD reallocarray: behaves like realloc on allocation failure

It was behaving like reallocf which frees the ptr if the allocation
fails. That's wrong, it behaves like realloc which does not free
ptr. Updated the one regression test.

I also noticed that the error message always mentions realloc
even for reallocf and reallocarray.

2 months agoAdd --num-callers change to NEWS
Paul Floyd [Sun, 8 Feb 2026 15:03:30 +0000 (16:03 +0100)] 
Add --num-callers change to NEWS

2 months agoppc regtest: add another expected for memcheck/tests/linux/rfcomm
Paul Floyd [Sun, 8 Feb 2026 09:03:21 +0000 (10:03 +0100)] 
ppc regtest: add another expected for memcheck/tests/linux/rfcomm

This was failing on cfarm120 with diffs like

- in frame #1, created by main (rfcomm.c:26)
+ in frame #0, created by bind (???:)

I'm not sure why there is a change for the frame where the socket
struct is created. cfarm120 doesn't have the glibc dedbuginfo
package installed.

2 months agoppc regtest: update expected for none fdleak_ipv4_xml
Paul Floyd [Sun, 8 Feb 2026 08:55:28 +0000 (09:55 +0100)] 
ppc regtest: update expected for none fdleak_ipv4_xml

Should now pass on cfarm120

2 months agoppc64le regtest: update a few xml expecteds
Paul Floyd [Sat, 7 Feb 2026 11:04:12 +0000 (12:04 +0100)] 
ppc64le regtest: update a few xml expecteds

2 months agoDRD regtest: delete second line in callstack of std_thread2 test
Paul Floyd [Sat, 7 Feb 2026 10:02:38 +0000 (11:02 +0100)] 
DRD regtest: delete second line in callstack of std_thread2 test

Older GCCs generate something quite different. No point trying to
massage it into something common so just delete it.

2 months agoregtest: broaden a suppression used in memcheck/tests/leak_cpp_interior
Paul Floyd [Sat, 7 Feb 2026 09:02:10 +0000 (10:02 +0100)] 
regtest: broaden a suppression used in memcheck/tests/leak_cpp_interior

The test should now pass on PPC machines.

2 months agoillumos warnings: malinfo struct fields are 64bit on illumos
Paul Floyd [Fri, 6 Feb 2026 16:46:33 +0000 (17:46 +0100)] 
illumos warnings: malinfo struct fields are 64bit on illumos

2 months agoSanity check VG_(realpath) and VG_(readlink) return values
Mark Wielaard [Fri, 6 Feb 2026 12:57:24 +0000 (13:57 +0100)] 
Sanity check VG_(realpath) and VG_(readlink) return values

When VG_(realpath) calls VG_(readlink) it failed to check if
VG_(readlink) succeeds, possibly writing to tmp[-1] (on the stack). It
also didn't check the getcwd syscall succeeded, which would cause the
resolved name to start with undefined bits (from the stack).

VG_(data_size) was using too small a (stack) buffer for the
VG_(realpath) call and didn't check whether the call actually
succeeded.

At startup initimg-{darwin,freebsd,linux,solaris} also didn't check
VG_(realpath) would resolve before setting VG_(resolved_exename) to
possibly random bits on the stack. Fix that by using the (unresolved)
exe_name in those cases.

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

2 months agoDRD regtest: one more test case with --num-callers=1
Paul Floyd [Fri, 6 Feb 2026 12:10:19 +0000 (13:10 +0100)] 
DRD regtest: one more test case with --num-callers=1

2 months agoillumos regtest: another assignment in assert for errno
Paul Floyd [Fri, 6 Feb 2026 09:20:01 +0000 (10:20 +0100)] 
illumos regtest: another assignment in assert for errno

2 months agoilumos regtest: update one test that uses --num-callers=1
Paul Floyd [Fri, 6 Feb 2026 07:40:47 +0000 (08:40 +0100)] 
ilumos regtest: update one test that uses --num-callers=1

2 months agoBug 515183 - Error occurred while executing the command `valgrind --num-callers=1...
Paul Floyd [Thu, 5 Feb 2026 19:41:07 +0000 (20:41 +0100)] 
Bug 515183 - Error occurred while executing the command `valgrind --num-callers=1 ./hello_world`

2 months agoFreeBSD regtest: incorrect use of = rather then == in asserts
Paul Floyd [Thu, 5 Feb 2026 18:55:34 +0000 (19:55 +0100)] 
FreeBSD regtest: incorrect use of = rather then == in asserts

2 months agos390: disasm-test: use s390_disasm
Florian Krohm [Thu, 5 Feb 2026 18:03:05 +0000 (18:03 +0000)] 
s390: disasm-test: use s390_disasm

No need to capture the disassembled insn from a tracing side effect.
Call s390_disasm directly with mnemonic-padding disabled.

2 months agos390: Change s390_disasm and tweak specification exception message
Florian Krohm [Thu, 5 Feb 2026 17:39:49 +0000 (17:39 +0000)] 
s390: Change s390_disasm and tweak specification exception message

s390_disasm now returns a pointer to the disassembled insn string or NULL.
A new parameter controls whether the mnemonic should be padded with blanks
to the max. insn length.

When reporting a specification exception also write out the disassembled insn.

2 months agos390: Fix s390_irgen_VGE[FG] and s390_irgen_VSCE[FG]
Florian Krohm [Wed, 4 Feb 2026 22:34:30 +0000 (22:34 +0000)] 
s390: Fix s390_irgen_VGE[FG] and s390_irgen_VSCE[FG]

Instead of creating a specification exception these run into an assertion:

VEX: s390_vr_offset_by_index: invalid index for given type

There are proper s390_insn_assert in s390_irgen_VGEF etc. However, the
vassert happens in s390_format_VRV --> get_vr --> s390_vr_offset_by_index
prior to s390_irgen_... being called.
Fixed by adding s390_insn_assert to s390_format_VRV.

Found by disasm-test.

2 months agos390: Fix s390_irgen_VSTEF
Florian Krohm [Wed, 4 Feb 2026 20:51:48 +0000 (20:51 +0000)] 
s390: Fix s390_irgen_VSTEF

Fix the s390_insn_assert. There are 4, not 8, word-sized elements in a
vector register.

Found by disasm-test.

2 months agos390: Fix s390_irgen_SRNMB
Florian Krohm [Wed, 4 Feb 2026 20:36:09 +0000 (20:36 +0000)] 
s390: Fix s390_irgen_SRNMB

When B2 is 0 the least significant 8 bits in D2 must designate a valid
rounding mode. Bits D2[0:55] are ignored. Mask D2 accordingly.

Found by disasm-test.

2 months agos390: Fix s390_irgen_VMSL
Florian Krohm [Wed, 4 Feb 2026 20:16:03 +0000 (20:16 +0000)] 
s390: Fix s390_irgen_VMSL

The reserved bits in M3, when set, do not cause a specification exception.
However, disasm-test reports e.g:

error: Unexpected spec. exc. detected for E764 1310 92B8   vmslg %v6,%v4,%v17,%v9,1

Now fixed.

2 months agos390: Fix s390_irgen_VSTER
Florian Krohm [Wed, 4 Feb 2026 19:59:41 +0000 (19:59 +0000)] 
s390: Fix s390_irgen_VSTER

M3 == 4 is a reserved value and causes a specification exception.
However, disasm-test reports:

error: Spec. exc. not detected for E660 0000 400F   vster %v6,0,4

Now fixed.

2 months agos390: Fix s390_irgen_POPCNT
Florian Krohm [Wed, 4 Feb 2026 19:08:20 +0000 (19:08 +0000)] 
s390: Fix s390_irgen_POPCNT

The POPCNT insn does not cause a specification exception when reserved
bits in m3 are not zero.
Found by disasm-test.

2 months agoAdd BLENDPS and PBLENDW support for x86 32 bit
Alexandra Hájková [Fri, 30 Jan 2026 10:06:17 +0000 (05:06 -0500)] 
Add BLENDPS and PBLENDW support for x86 32 bit

Add decode_sse4_blend_imm which allows to reuse BLENDPD decoder code
for BLENDPS and PBLENDW. Moved math_BLENDPS_128, math_PBLENDW_128
and math_PBLENDVB_128 from VEX/priv/guest_amd64_toIR.c
to VEX/priv/guest_generic_sse.h to be able to reuse existing amd64 code
for x86 implementation.

Moved test_BLENDPS and test_PBLENDW from none/tests/amd64/sse4-64.c to
none/tests/sse4-common.h and updated the expected tests output to match
the new implementation. Removed vassert(0) in VEX/priv/host_x86_defs.c
in push_word_from_tags in order for test_PBLENDW to be able to pass.

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

2 months agos390: The 2nd coming of disasm-test
Florian Krohm [Wed, 4 Feb 2026 16:03:30 +0000 (16:03 +0000)] 
s390: The 2nd coming of disasm-test

With the advent of objdump-based disassembly there is no need anymore to
ensure that the disassembled insns out of valgrind match those from objdump.
This is now correct by construction.

In this patch the disasm-test functionality is changed to ensure that all
expected specification exceptions as specified in the Principles of
Operations are detected and no unexpected specification exceptions are found.

For a given opcode 2 sets of testcases will now be generated:
- one where every insn causes a specification exception
  This catches missed specification exceptions.
- one where no insn causes a specification exception
  This catches unexpected specification exceptions.

Changes:
Remove command line options --generate and --verify. Those were useful
in the early stages of development but not anymore.
Remove command line options --show-spec-exc and --no-show-miscompares
which are obsolete now.
Replace command line option --check-prereq with --check-march=ARCH.
Remove command line option --all-except-exrl. Add --exclude option which
is more general.
Add command line options --spec-exc and --no-spec-exc.
Remove functions check_objdump and disasm_same.
From verify_stats remove num_mismatch and num_verified members.
Rename verify_stats --> test_stats and add num_generated member.
Rename verify_disassembly --> verify_spec_exceptions.
No longer write .vex file. Write .spec-exc file instead.
Factor out functions run_opcode and choose_int_and_iterate.
New functions asm_detects_spec_exc and insn_bytes_as_string.

Opcode table in opcode.c:
- Remove all constraints that do not cause a specification exception.
- Change modelling of the "Rotate and ...." opcodes. Previously the
  i3, i4 and i5 fields are modelled as masks. That was a work-around in
  order to be able to specify interesting values and is no longer
  needed. Model those fields as integers instead.

Update disasm-test.vgtest.
Update README.
Copyright year updated.

2 months agoregtest: add -std=c++17 for memcheck xmas_tree
Paul Floyd [Wed, 4 Feb 2026 12:10:18 +0000 (13:10 +0100)] 
regtest: add -std=c++17 for memcheck xmas_tree

For middle-aged compilers that support C++17 but not by default.

2 months agoFix asserts in testcases close_range, bug514094 and readlinkat_self.
Mark Wielaard [Tue, 3 Feb 2026 18:28:46 +0000 (19:28 +0100)] 
Fix asserts in testcases close_range, bug514094 and readlinkat_self.

These tests did an assert (errno = EFAULT) instead of an assert on
errno == EFAULT. close_range was also using an valid flag 2
(CLOSE_RANGE_UNSHARE) instead of a bad one.

2 months agoMake configure.ac POSIX-friendly
Paul Floyd [Tue, 3 Feb 2026 12:56:24 +0000 (13:56 +0100)] 
Make configure.ac POSIX-friendly

Reported by Thomas Klausner

2 months agoRegtest: fix build for old compilers without aligned new/delete
Paul Floyd [Fri, 30 Jan 2026 20:21:57 +0000 (21:21 +0100)] 
Regtest: fix build for old compilers without aligned new/delete

2 months agoMore warning cleanup
Paul Floyd [Thu, 29 Jan 2026 19:32:05 +0000 (20:32 +0100)] 
More warning cleanup

Fix a cast from volatile that has been bothering me for a while.
Also a warning dur to some Darwin code that reuses a ULong
for a memory address. That causes a warning on 32bits because
pointers are 32bit but ULong is always 64bit.

2 months agoWarning cleanup
Paul Floyd [Thu, 29 Jan 2026 12:45:21 +0000 (13:45 +0100)] 
Warning cleanup

2 months agoBug 514613 again (closing </still_reachable> xml tag)
Paul Floyd [Wed, 28 Jan 2026 12:38:39 +0000 (13:38 +0100)] 
Bug 514613 again (closing </still_reachable> xml tag)

Always close the tag after the heuristic details.

Add 4 testcases, one with no errors, one with a simple leak,
one with a simple reachable and one "Xmas tree" test (in
reference to the TCP/IP Christmas tree packet
https://en.wikipedia.org/wiki/Christmas_tree_packet). That
has most of the errors that memcheck can produce.

All of these tests get checked by xmllint.

2 months agoBug 253436 - vex amd64->IR: unhandled instruction bytes: 0xF2 0xA6 (repne cmps)
Paul Floyd [Sat, 24 Jan 2026 07:20:29 +0000 (08:20 +0100)] 
Bug 253436 - vex amd64->IR: unhandled instruction bytes: 0xF2 0xA6 (repne cmps)

Patch submitted by jacobly.alt@gmail.com
Regtest update submitted by Lukas Dullinger <itislu.git@gmail.com>

2 months agos390: s390_format_VRI related changes
Florian Krohm [Thu, 22 Jan 2026 21:39:49 +0000 (21:39 +0000)] 
s390: s390_format_VRI related changes

Rename:
s390_format_VRI_V0UUU  --> s390_format_VRIb
s390_format_VRI_VVIMM  --> s390_format_VRIe
s390_format_VRId_VVVI  --> s390_format_VRId
s390_format_VRId_VVVIM --> s390_format_VRIdm
s390_format_VRI_VVIM   --> s390_format_VRIc
s390_format_VRI_VIM    --> s390_format_VRIa
s390_format_VRI_V0U    --> s390_format_VRIa0

Remove s390_format_VRI_V0IU (same as s390_format_VRI_VIM).

2 months agos390: Rename s390_format_VRS_VRRD[M]
Florian Krohm [Thu, 22 Jan 2026 20:39:48 +0000 (20:39 +0000)] 
s390: Rename s390_format_VRS_VRRD[M]

s390_format_VRS_VRRD  -->  s390_format_VRSb
s390_format_VRS_VRRDM -->  s390_format_VRSbm

Add missing VRSb_... field access macros.

2 months agos390: Rename s390_format_VRS_RRDV --> s390_format_VRSd
Florian Krohm [Thu, 22 Jan 2026 20:18:55 +0000 (20:18 +0000)] 
s390: Rename s390_format_VRS_RRDV  -->  s390_format_VRSd

Add missing VRSd_... field access macros.

2 months agos390: Merge s390_format_VRS_VRDV and s390_format_VRS_VRDVM
Florian Krohm [Thu, 22 Jan 2026 20:03:37 +0000 (20:03 +0000)] 
s390: Merge s390_format_VRS_VRDV and s390_format_VRS_VRDVM

Add unused m4 parameter to s390_irgen_VLM / _VSTM. That way we no longer need
to distinguish between s390_format_VRS_VRDV and s390_format_VRS_VRDVM.
Rename remaining function to s390_format_VRSa and use it throughout.

Add field access macros VRSa_v1 and so on.

2 months agos390: Rename s390_format_VRV_VVRDMT and s390_format_VRS_RRDVM
Florian Krohm [Thu, 22 Jan 2026 18:40:35 +0000 (18:40 +0000)] 
s390: Rename s390_format_VRV_VVRDMT and s390_format_VRS_RRDVM

Rename s390_format_VRV_VVRDMT --> s390_format_VRV
Rename s390_format_VRS_RRDVM  --> s390_format_VRSc

2 months agos390: Rename s390_format_VSI_URDV to s390_format_VSI
Florian Krohm [Thu, 22 Jan 2026 17:27:30 +0000 (17:27 +0000)] 
s390: Rename s390_format_VSI_URDV to s390_format_VSI

Also make the order of function parameters consistent with other s390_format_...
functions.

2 months agos390: Merge s390_format_VRX_VRRDM and s390_format_VRX_VRRD
Florian Krohm [Thu, 22 Jan 2026 17:05:42 +0000 (17:05 +0000)] 
s390: Merge s390_format_VRX_VRRDM and s390_format_VRX_VRRD

Add unused m3 parameter to s390_irgen_VL / _VST. That way we no longer need
to distinguish between s390_format_VRX_VRRDM and s390_format_VRX_VRRD.
Rename remaining function to s390_format_VRX and use it throughout.

2 months agos390: Remove various s390_format_RXY_... functions.
Florian Krohm [Wed, 21 Jan 2026 23:00:06 +0000 (23:00 +0000)] 
s390: Remove various s390_format_RXY_... functions.

Rename s390_format_RSY_RRRD  ->  s390_format_RSY
Remove s390_format_RSY_R0RD  ->  s390_format_RSYb
Rename s390_format_RSY_RDRM  ->  s390_format_RSYcond
Remove s390_format_RSY_AARD use s390_format_RSY instead
Remove s390_format_RSY_RURD use s390_format_RSYb instead

2 months agos390: Rename s390_format_RXF_FRRDF --> s390_format_RXF
Florian Krohm [Wed, 21 Jan 2026 20:51:10 +0000 (20:51 +0000)] 
s390: Rename s390_format_RXF_FRRDF --> s390_format_RXF

2 months agos390: Remove unused functions s390_format_RRF_....
Florian Krohm [Wed, 21 Jan 2026 20:42:15 +0000 (20:42 +0000)] 
s390: Remove unused functions s390_format_RRF_....

Remove s390_format_RRFa_U0RR
Remove s390_format_RRF_FFRU
Remove s390_format_RRF_FUFF
Remove s390_format_RRF_FUFF2
Remove s390_format_RRF_F0FF
Remove s390_format_RRF_F0FF2
Remove s390_format_RRF_F0FR
Remove s390_format_RRF_M0RERE
Remove s390_format_RRF_RURR
Remove s390_format_RRF_R0RR2
Remove s390_format_RRF_UUFF
Remove s390_format_RRF_UUFF2
Remove s390_format_RRF_UUFR
Remove s390_format_RRF_UURF
Remove s390_format_RRF_U0RR
Remove s390_format_RRF_0UFF

Add field access macros for formats RRFa, RRFb, RRFc, RRFd and RRFe
as per Principles of Ops.
Add field access macros RRD_r1, RRD_r2, RRD_m3.
Remove field access macros RRF_..., RRF2_..., RRF3_..., RRF4_... and RRF5_...

2 months agoAdd SSE4.1 BLENDPD instruction for x86 32 bit
Alexandra Hájková [Wed, 14 Jan 2026 14:23:55 +0000 (09:23 -0500)] 
Add SSE4.1 BLENDPD instruction for x86 32 bit

Support blendpd (Blend Packed Double Precision Floating-Point
Values (XMM)) instruction in guest_x86_toIR.c. To be able to
use amd64 math_BLENDPD_128 function for x86 implementation, add
a new VEX/priv/guest_generic_sse.h header and move math_BLENDPD_128
there.

mkV128() was moveda from line 1671 in guest_amd64_toIR.c to line 295,
grouping it with other mkU* constant-creation helpers (mkU8, mkU16,
mkU32, mkU64). This allows guest_generic_sse.h to be included much
earlier (line 300 vs. line 1676), making the code organization more
natural.

The header includes an explaination why it must be included mid-file
(after IR helpers like newTemp, assign, binop, etc. are defined) and
why those helpers cannot be moved to a shared header (they depend on
file-local global state, particularly the 'irsb'
variable).

Add test function to sse4-common.h and update none/tests/x86/sse4-x86.c
to test the instruction.

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

2 months agoBug 514206 - Assertion '!sr_isError(sr)' failed - mmap fd points to an open descripto...
Paul Floyd [Tue, 20 Jan 2026 06:44:31 +0000 (07:44 +0100)] 
Bug 514206 - Assertion '!sr_isError(sr)' failed - mmap fd points to an open descriptor to a PCI device

Also reindent set_CEnt() a bit