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.
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.
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.
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.
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_...
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.
Remove functions s390_format_RS_RURD, s390_format_RS_RRRD and
s390_format_RS_AARD. Use s390_format_RS instead.
Actually, Principles of Ops has RS-a and RS-b formats. But those
differ only in how they name a particular opcode field and not how
the opcode's 4 bytes are divided up into fields. I did not bother
with that.
Mark [Sat, 17 Jan 2026 16:22:59 +0000 (17:22 +0100)]
Add support for fnop instruction on x86 and amd64
This implements FNOP in guest_amd64_toIR.c and guest_x86_toIR.c by
simply skipping the instruction. Which is OK for now since one of the
x87 FP Limitations is no FP exceptions, except for handling stack
over/underflow.
Add fnop to none/tests/{amd64,x86}/insn_fpu.{def,stdout.exp}.
Also update old 3_1_BUGSTATUS.txt to correct bug number.
Florian Krohm [Thu, 15 Jan 2026 20:16:08 +0000 (20:16 +0000)]
Update s390-check-opcodes.pl
Remove the --check-formats option. The specialisation of opcode names in
<binutils>/opcode/s390_opc.txt is no longer interesting as we do not need
to distinguish whether a register number in an opcode denotes a GPR od FPR
or whatever.
Instead it is better to use those opcode format names as shown in the
Principles of Ops wherever possible. Simplifies proofreading.
Florian Krohm [Thu, 15 Jan 2026 11:10:30 +0000 (11:10 +0000)]
s390: Remove s390_format_RIL and friends.
This patch removes the functions: s390_format_RIL, s390_format_RIL_RU,
s390_format_RIL_RI, s390_format_RIL_RP and s390_format_RIL_UP.
Cf. fa21e88ac38 for a rationale.
Florian Krohm [Thu, 15 Jan 2026 10:08:59 +0000 (10:08 +0000)]
s390: Remove s390_format_RRE and friends.
This patch removes the functions: s390_format_RRE, s390_format_RRE_RR,
s390_format_RRE_FF, s390_format_RRE_RF, s390_format_RRE_FR,
s390_irgen_RRE_R0 and s390_irgen_RRE_F0.
Cf. fa21e88ac38 for a rationale.
Florian Krohm [Thu, 15 Jan 2026 09:19:10 +0000 (09:19 +0000)]
s390: Remove s390_format_RR and friends.
This patch removes the functions: s390_format_RR, s390_format_RR_RR
and s390_format_RR_FF.
First, because of the disassembly changes in 370531396ad there is no
longer a need to specialise s390_format_RR because the register class
of its operands is now irrelevant. Hence s390_format_RR_RR and
s390_format_RR_FF can go.
Secondly, s390_irgen_RR only calls the function pointer being passed in.
So we can call that function directly and s390_irgen_RR can go as well.
The same reasoning also applies to other opcode formats. Patches will
follow soon. Having several installments gives a chance to actually
proofread them.
Florian Krohm [Sun, 11 Jan 2026 17:54:59 +0000 (17:54 +0000)]
vg_regtest: Miscellaneous tweaks
Drop the requirement that there must be at least one .stderr.exp
file. That way we can eliminate some 440 empty stderr.exp files and
a few stderrB.exp files.
Drop the requirement that there must be a "filter_stderr" script.
If there is nothing to filter (e.g. iropt-test) a filter script is
not meaningful. In that is so desired, specify an empty stderr_filter
and stderrB_filter in the .vgtest file.
Paul Floyd [Sat, 10 Jan 2026 14:53:43 +0000 (15:53 +0100)]
regtest: undo changes to str_tester as a workaround for darwin checked functions
I had added parens to force the use of the function rarther than a
macro expanding to the _chk version. The _chk functions are now wrapped
so no longer need to keep the workaround.
Mark Wielaard [Wed, 7 Jan 2026 21:20:49 +0000 (22:20 +0100)]
Disable linux madvise MADV_GUARD_INSTALL
glibc 2.42+ (with linux 6.13+) uses MADV_GUARD_INSTALL to setup stack
guard pages. valgrind currently isn't able to track this and such
guard pages also don't show up in /proc maps (only in /proc pagemap
since linux 6.14). For now valgrind fails a madvise MADV_GUARD_INSTALL
syscall with EINVAL. This causes glibc to fall back to mprotect
PROT_NONE which valgrind is able to track.
Mark Wielaard [Sat, 3 Jan 2026 13:08:08 +0000 (14:08 +0100)]
VEX: Fix srcdir != builddir build
commit 370531396ad1 ("s390: Use objdump machinery to disassemble insns")
broke srcdir != builddir builds with:
../../../VEX/priv/objdump/s390-dis.c:26:10: fatal error: main_util.h: No such file or directory
26 | #include "main_util.h" // vex_strlen
| ^~~~~~~~~~~~~
This comes from including the "wrong" priv directory for main_util.h
in Makefile.vex.am. Fix this by adding -I$(srcdir)/priv. This was
always wrong but didn't cause issues till now because of the extra
objdump subdir.
Paul Floyd [Fri, 26 Dec 2025 13:20:34 +0000 (14:20 +0100)]
Darwin regtest: ensure no stdout output for memcheck/tests/darwin/deep_badparam
The test was doing a write of an uninit ilocal 32byte char buffer.
This has started outputting junk resulting in a stdout diff. So
make sure that the buffer only contains zeros (but still uninit).
Hope the compiler doesn't get too smart.
Support pmulld (packed multiply 32-bit doubleword integers) instruction
in guest_x86_toIR.c and host_x86_isel.c. Add test function to
sse4-common.h and update none/tests/x86/sse4-x86.c to test the
instruction.
Paul Floyd [Tue, 23 Dec 2025 20:22:17 +0000 (21:22 +0100)]
Darwin mmap: use ARG5 for VG_(di_notify_mmap)
The fix for bug280965 (a long long time ago) changed VG_(di_notify_mmap)
so that instead of opening a new fd to peek at the ELF header it would
reuse the same mmap fd with pread() to avoid resetting fcntl flags.
Except that the patch was applied to mmap in syswrap-generic but not
to the mmap in syswrap-darwin. So the problem remained there on Darwin
for 14 years.
Paul Floyd [Mon, 22 Dec 2025 09:19:30 +0000 (10:19 +0100)]
Helgrind regtest: add asserts to cond_timedwait_test.c
This test fails on Darwin, It looks like Darwin uses another mutex
and it's complaining that the condition mutex is not locked when
the unlock call is made. I made these changes when checking that the
testcase has the same behaviour on FreeBSD.