]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
2 months agoAdd --modify-fds=[no|high] option users/mark/try-modify-fds
Alexandra Hájková [Wed, 20 Nov 2024 17:00:47 +0000 (12:00 -0500)] 
Add --modify-fds=[no|high] option

Normally a newly recreated file descriptor gets the lowest number
available. This might cause old file descriptor numbers to be reused
and hides bad file descriptor accesses (because the old number is
new again).

When enabled, when the program opens a new file descriptor,
the highest available file descriptor is returned instead of the
lowest one.

Add the none/tests/track_new.stderr.exp test to test this new option.

Adjust none/tests/filter_fdleak to filter the track_new.vgtest,
removing some internal glibc functions from the backtraces and remove
symbol versioning. The output of the use_after_close test also had to
be adjusted. Also adjust the none/tests/cmdline1 and
none/tests/cmdline2 output as the new --modify-fds=no|high is
displayed.

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

2 months agoIllumos regtest: update expected for memcheck/tests/amd64-solaris/context_fpu
Paul Floyd [Tue, 15 Apr 2025 19:18:33 +0000 (21:18 +0200)] 
Illumos regtest: update expected for memcheck/tests/amd64-solaris/context_fpu

The expected contains 8 errors for

   if (inhandler[1] || inhandler[3] || inhandler[5] || inhandler[7])
      assert(0);

whilst I would expect 4 (the 4 array elements are uninitialised).

It is also failing on Solaris 11.4.

2 months agoFlush stack overflow / failure to grow stack messages.
Paul Floyd [Tue, 15 Apr 2025 18:52:59 +0000 (20:52 +0200)] 
Flush stack overflow / failure to grow stack messages.

These messages were missing for the test

none/tests/solaris/stack_overflow

on Illumos. The test now passes.

2 months agonightly: fix check for Illumos libc
Paul Floyd [Tue, 15 Apr 2025 18:39:22 +0000 (20:39 +0200)] 
nightly: fix check for Illumos libc

On Illumos `uname -o` outputs "illumos". We weren't testing for
that so it fell through to the Linux block which runs libc.so to
get the version string. On Illumos that outputs

usage: ld.so.1 [-e option,...] dynamic-object [object args,...]

2 months agoIllumos readelf: patch for detection of DTrace .data sections
Paul Floyd [Mon, 14 Apr 2025 20:05:57 +0000 (22:05 +0200)] 
Illumos readelf: patch for detection of DTrace .data sections

Taken from
    https://github.com/oracle/solaris-userland/blob/master/components/valgrind/patches/03-dtrace-section.patch

2 months agoAdd 'scripts' directory to dirs_to_ignore in check_headers_and_includes
Paul Floyd [Mon, 14 Apr 2025 19:06:45 +0000 (21:06 +0200)] 
Add 'scripts' directory to dirs_to_ignore in check_headers_and_includes

2 months agoIllumos regtest: fix threadname vgtest files
Paul Floyd [Mon, 14 Apr 2025 18:43:20 +0000 (20:43 +0200)] 
Illumos regtest: fix threadname vgtest files

I missed one level of ../ and didn't see that there was already
a prereq: in each of these two files.

2 months agoIllumos nightly: enable sending results to valgrind-testresults
Paul Floyd [Mon, 14 Apr 2025 17:38:03 +0000 (19:38 +0200)] 
Illumos nightly: enable sending results to valgrind-testresults

2 months agoIllumos nightly: add conf files for Illumos
Paul Floyd [Mon, 14 Apr 2025 10:30:52 +0000 (12:30 +0200)] 
Illumos nightly: add conf files for Illumos

2 months agos390x: Regtest integration of none/tests/s390x/disasm-test
Florian Krohm [Sun, 13 Apr 2025 12:06:33 +0000 (12:06 +0000)] 
s390x: Regtest integration of none/tests/s390x/disasm-test

The checker requires objdump --version >= 2.44
Add command line flag --check-prereq to disasm-test and use it in
disasm-test.vgtest.
New file none/tests/s390x/disasm-test/disasm-test.post.exp as the
checker is run in the "post" hook.

2 months agos390x: Final change to fix BZ 495817
Florian Krohm [Sun, 13 Apr 2025 11:05:08 +0000 (11:05 +0000)] 
s390x: Final change to fix BZ 495817

This patch makes VEX disassembly match objdump disassembly for
objdump versions >= 2.44. Prior objdump versions did not handle the
nuances of the "rotate and ..." set of opcodes and there was also a
bug disassembling BC insns.

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

2 months agoIllumos regtest: use LC_ALL=C for execx test
Paul Floyd [Sat, 12 Apr 2025 21:57:58 +0000 (23:57 +0200)] 
Illumos regtest: use LC_ALL=C for execx test

There's an uninitialized read in /usr/bin/printf when using the
default en_US.UTF-8 locale. This isn't a printf test, and using
the C locale makes the error go away.

2 months agos390x: Fix IR generation for SRNMB
Florian Krohm [Sat, 12 Apr 2025 21:45:22 +0000 (21:45 +0000)] 
s390x: Fix IR generation for SRNMB

disasm-test generated this test:

  asm volatile("srnmb 4095(%r0)");

which was disassembled in VEX to

  srnmb 0

causing a mismatch with what objdump does.

4095 is not a valid bfp rounding mode and the old implementation of
s390_irgen_SRNMB let it slide by with a warning. However, POP calls for a
specification exception in this case. This is what this patch changes.i
It also eliminates the s390_irgen_srnmb_wrapper function along the way.

While adjusting none/tests/s390x/srnmb.* I noticed that the line
number shown in the specification exception is incorrect. This
is not a regression. It has been incorrect before as well.

I have opened https://bugs.kde.org/show_bug.cgi?id=502729 fro the line
number issue.

2 months agoIllumos regtest: add 'illumos' to os_test and turn off a few tests
Paul Floyd [Sat, 12 Apr 2025 16:27:06 +0000 (18:27 +0200)] 
Illumos regtest: add 'illumos' to os_test and turn off a few tests

The threadname tests fail on Illumos. Solaris has a syscall,
sys_lwp_name, which we intercept and record. Illumos doesn't
have that, with the pthread name functions looking ofr the name in /proc
That's not implemented in Valgrind so I'm turning those 2 tests off.

The other 3 are all based on none faultstatus. This test checks 4 things,
one of which is reading from a 32k mmap that is PRIVATE and READ but is
only backed by a 16k file. All other OSes generate a SIGBUS. Illumos
just reads 0 from the address.

2 months agoFreeBSD nightly: automatically use all CPUs
Paul Floyd [Sat, 12 Apr 2025 06:34:13 +0000 (08:34 +0200)] 
FreeBSD nightly: automatically use all CPUs

2 months agoFix typo: segement -> segment
Philippe Waroquiers [Fri, 11 Apr 2025 19:37:18 +0000 (21:37 +0200)] 
Fix typo:  segement -> segment

No impact, typo in a comment.

2 months agoRegtest: use FLAG_PIE for bug290061
Paul Floyd [Fri, 11 Apr 2025 18:29:58 +0000 (20:29 +0200)] 
Regtest: use FLAG_PIE for bug290061

Illumos GCC doesn't have -pie. Also use it for the link command.

2 months agos390x: Implement VTM without dirty helper
Andreas Arnez [Thu, 10 Apr 2025 15:27:30 +0000 (17:27 +0200)] 
s390x: Implement VTM without dirty helper

The VTM instruction is currently translated to a dirty helper call, which
comes with the usual drawbacks.

Replace its implementation and remove the dirty helper.

2 months agos390x: disasm-test - minor tweak
Florian Krohm [Fri, 11 Apr 2025 12:00:11 +0000 (12:00 +0000)] 
s390x: disasm-test - minor tweak

2 months agos390x: In s390_disasm_aux - simplify control flow a bit.
Florian Krohm [Fri, 11 Apr 2025 11:55:24 +0000 (11:55 +0000)] 
s390x: In s390_disasm_aux - simplify control flow a bit.

2 months agoBug 290061 - pie elf always loaded at 0x108000
Paul Floyd [Sun, 19 May 2024 09:55:30 +0000 (11:55 +0200)] 
Bug 290061 - pie elf always loaded at 0x108000

Initial patch from Amir Szekely <kichik@gmail.com

2 months agoHelgrind: Fixes for ETIMEDOUT
Paul Floyd [Wed, 9 Apr 2025 06:49:52 +0000 (08:49 +0200)] 
Helgrind: Fixes for ETIMEDOUT

pthread_rwlock_timedrdlock and pthread_rwlock_clockrdlock were
generating API errors if they timed out. This fixes that and
only generates API errors for non-zero and non-ETIMEDOUT
return codes.

2 months agoIllumos helgrind: redir, filter and suppresions
Paul Floyd [Sun, 6 Apr 2025 18:47:39 +0000 (20:47 +0200)] 
Illumos helgrind: redir, filter and suppresions

Add a redir for sem_timedwait (Solaris redirects sema_timedwait
which seems to have been replaced on Illumos).

Filter the arena size for the free_is_write test

Use the Illumos expected for gone_abrt_xml

Add Helgrind suppressions for printf, pthread_barrier_init and
pthread_barrier_destroy.

2 months agoIllumos resgtest: revert previous change to filter_libc and update expected instead
Paul Floyd [Sat, 5 Apr 2025 06:16:54 +0000 (08:16 +0200)] 
Illumos resgtest: revert previous change to filter_libc and update expected instead

2 months agoIllumos regtest: one filter and one pre script fix
Paul Floyd [Fri, 4 Apr 2025 20:00:38 +0000 (22:00 +0200)] 
Illumos regtest: one filter and one pre script fix

filter a change for the bottom of thread stacks and
add use the same pre check as Linux for DRD OpenMP tests.

2 months agoIllumos helgrind: fix for pthread_rwlock_timedrdlock and pthread_rwlock_timedrwlock
Paul Floyd [Thu, 3 Apr 2025 17:56:51 +0000 (19:56 +0200)] 
Illumos helgrind: fix for pthread_rwlock_timedrdlock and pthread_rwlock_timedrwlock

On Illumos these two functions are implemented by calling
pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock respectively.
Since we intercept both it was appearing as though the lock was being
taken recursively when it wasn't. Fixed it by using a static flag for each
and not callinng the client requests if already in a call to the timed
functions.

I think that musl also does this but, ho-hum, Helgrind has never worked on musl.

2 months agos390x: Support the PPA instruction
Andreas Arnez [Thu, 3 Apr 2025 15:40:03 +0000 (17:40 +0200)] 
s390x: Support the PPA instruction

The perform processor assist (PPA) instruction provides the CPU with
special execution hints.  It belongs to the processor-assist facility,
which shares facility bit 49 with the execution-hint and load-and-trap
facilities and with the miscellaneous-instruction-extensions facility 1.

Implementing PPA enables setting facility bit 49 to one.  Similar to other
execution hint instructions, implement PPA as a no-op for now.

2 months agos390x: Reflect renaming of DFP insns in opcode checker
Andreas Arnez [Thu, 3 Apr 2025 17:07:32 +0000 (19:07 +0200)] 
s390x: Reflect renaming of DFP insns in opcode checker

After renaming various DFP instructions to their new name, reflect this in
s390-check-opcodes.pl by ignoring their old names, so the checker doesn't
complain about mismatches.

Also, add the missing documentation in s390-opcodes.csv about the fact
that the "with rounding mode" instruction versions cgdtra, cgxtra, and
cxgtra are implemented.

2 months agos390x: Add missing s390_insn_assert for non-vector opcodes
Florian Krohm [Thu, 3 Apr 2025 13:00:19 +0000 (13:00 +0000)] 
s390x: Add missing s390_insn_assert for non-vector opcodes

Based on the specification in disasm-test/opcode.c

With a few corrections:
- kma: tighten up the assert
- cdftr, cxftr: no emulation failure when floating-point-extension
  facility is not installed
- cgdtra, cgxtra: check for floating-point-extension facility
- ltdtr, ltxtr, lxdtr:  check for DFP facility

2 months agos390x disasm-test: Fix niai opcode spec
Florian Krohm [Thu, 3 Apr 2025 12:58:38 +0000 (12:58 +0000)] 
s390x disasm-test: Fix niai opcode spec

2 months agos390x disasm-test: Fix a few constraints and facility indications.
Florian Krohm [Thu, 3 Apr 2025 09:43:32 +0000 (09:43 +0000)] 
s390x disasm-test: Fix a few constraints and facility indications.

2 months agoIllumos helgrind: pthread wrapper tweaks
Paul Floyd [Wed, 2 Apr 2025 19:39:54 +0000 (21:39 +0200)] 
Illumos helgrind: pthread wrapper tweaks

Wrap pthread_cond_timedwait which seems to have supplanted
cond_reltimedwait on Illumos.

pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock both
exist on illumos, so enable those wrappers.

2 months agoIllumos regtest: fix configure check for GCC using Sun Studio as
Paul Floyd [Wed, 2 Apr 2025 18:13:10 +0000 (20:13 +0200)] 
Illumos regtest: fix configure check for GCC using Sun Studio as

2 months agoBug 502324 - Add test case for TMx memcheck false positives
Andreas Arnez [Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)] 
Bug 502324 - Add test case for TMx memcheck false positives

Add a regression test for Bug 502324.  Before the bug was fixed, this test
failed with various "conditional jump or move depends on uninitialised
value(s)" messages.

2 months agoBug 502324 - s390x: Fix memcheck false positives with TM/TMY
Andreas Arnez [Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)] 
Bug 502324 - s390x: Fix memcheck false positives with TM/TMY

If the condition code of TM/TMY is generated in a different block than it
is used, memcheck can yield false positives for a partially initialized
value even if the checked bits are all defined.

Fix this by storing the operand ANDed with the mask in the flags thunk,
instead of the unmodified operand.  This enables memcheck to track the
defined bits correctly.

2 months agoBug 502324 - s390x: Fix memcheck false positives with TMxx
Andreas Arnez [Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)] 
Bug 502324 - s390x: Fix memcheck false positives with TMxx

The 16-bit "test under mask" instructions TMLL, TMLH, TMHL, and TMHH can
yield memcheck false positives when:

* some of the operand bits in the tested 16-bit chunk (but outside the
  mask) are undefined

* the resulting condition code is used in a different block

In this case the condition code is computed by the helper
s390_call_calculate_cond, with the full 16-bit chunk and the given mask as
arguments.  Since the 16-bit chunk is not fully defined, memcheck
complains.

To fix this, AND the operand with the given mask before storing it for use
as a helper argument.  Also, optimize the frequent case of testing a
single bit.  For this purpose, add S390_CC_OP_BITWISE2 as a new way of
computing the condition code.

2 months agoIllumos: mention the build-essential package in README.solaris
Paul Floyd [Tue, 1 Apr 2025 18:09:14 +0000 (20:09 +0200)] 
Illumos: mention the build-essential package in README.solaris

2 months agoBug 502288 - s390x: Fix false positive with NNPA pad elements
Andreas Arnez [Tue, 1 Apr 2025 15:21:16 +0000 (17:21 +0200)] 
Bug 502288 - s390x: Fix false positive with NNPA pad elements

The size of the non-pad elements in the last dimension of NNPA tensors is
computed incorrectly.  This can lead to memcheck false positives that look
like this:

==3180208== Syscall param NNPA(in_tensor_1) points to uninitialised byte(s)

Fix the computation.

2 months agos390x: Reflect ppno -> prno renaming in opcode checker
Andreas Arnez [Tue, 1 Apr 2025 14:25:05 +0000 (16:25 +0200)] 
s390x: Reflect ppno -> prno renaming in opcode checker

After consequently renaming ppno to prno, the tool s390-check-opcodes.pl
complains:

  *** opcode prno is implemented but CSV file does not say so
  *** opcode ppno is not implemented but CSV file says so
  *** opcode ppno is not handled by the decoder

Fix this by renaming to "prno" in s390-opcodes.csv as well and declaring
"ppno" instead of "prno" as an alias in s390-check-opcodes.pl.

2 months agoBug 498421 - s390x: Add BPP, BPRP, and NIAI insns
Andreas Arnez [Tue, 1 Apr 2025 14:25:05 +0000 (16:25 +0200)] 
Bug 498421 - s390x: Add BPP, BPRP, and NIAI insns

Add support for the branch prediction preload (BPP), branch prediction
relative preload (BPRP), and next instruction access intent (NIAI)
instructions.  These instructions just provide performance hints to the
CPU and have no other effect on program execution.  Thus implement them as
no-ops.

2 months agos390x disasm-test: Remove command line flags --d12, --d20, --sint, --uint
Florian Krohm [Sun, 30 Mar 2025 21:32:37 +0000 (21:32 +0000)] 
s390x disasm-test: Remove command line flags --d12, --d20, --sint, --uint

These were somewhat useful in the early days of development. Not anymore.

2 months agos390x disasm-text: Update to support all implemented opcodes
Florian Krohm [Sun, 30 Mar 2025 21:20:01 +0000 (21:20 +0000)] 
s390x disasm-text: Update to support all implemented opcodes

A few opcodes are commented out in opcode.c because test generation
cannot handle the constraint.

For some opcodes (e.g. fixbra) VEX runs out of memory. Work around
that by calling vex_reset. Also add a tweak so we won't segfault
when generating tests for EXRL.

2 months agos390x: Fix disassembly for various DFP and BFP opcodes (BZ 495817)
Florian Krohm [Sun, 30 Mar 2025 20:51:33 +0000 (20:51 +0000)] 
s390x: Fix disassembly for various DFP and BFP opcodes  (BZ 495817)

Specifically:
- DFP: add, subtract, divide, multiply
- BFP: load FP integer, load rounded

Change function names from e.g. s390_irgen/emit_LDXBR to
s390_irgen/emit_LDXBRA because LDXBR does not have m3 and m4 operands.
Adjust the returned mnemonic accordingly.

New function s390_format_RRF_UUFF2 for FI[DEX]BRA.

Add adtra_like_disasm to disassemble opcodes for DFP arithmetic.

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

2 months agoHandle top __syscall_cancel frames when getting stack traces
Mark Wielaard [Sun, 30 Mar 2025 15:38:21 +0000 (17:38 +0200)] 
Handle top __syscall_cancel frames when getting stack traces

Since glibc 2.41 there are extra frames inserted before doing a
syscall to support proper thread cancellation.  This breaks various
suppressions and regtests involving checking syscall arguments.

Solve this by removing those extra frames from the top of the call
stack when we are processing a linux system call.

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

2 months agofilter_gdb.in: filter out __libc_do_syscall
Mark Wielaard [Sun, 30 Mar 2025 11:08:55 +0000 (13:08 +0200)] 
filter_gdb.in: filter out __libc_do_syscall

On i386 and armhf __libc_do_syscall might be used to invoke a syscall.
Replace __libc_do_syscall with "in syscall ..." and filter out
possible extra (assembly) source file lines containing
libc-do-syscall.S from the gdb output.

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

2 months agoLinux PPC: add a suppression for an invalid read in libaio io_getevents
Paul Floyd [Sun, 30 Mar 2025 07:00:34 +0000 (09:00 +0200)] 
Linux PPC: add a suppression for an invalid read in libaio io_getevents

The testcase memcheck/tests/linux/bug420682_1 should be a straightforward
clean test. On old PPC systems it produces one error.

2 months agos390x: Fix disassembly for BFP/DFP conversion opcodes (BZ 495817)
Florian Krohm [Sat, 29 Mar 2025 22:54:53 +0000 (22:54 +0000)] 
s390x: Fix disassembly for BFP/DFP conversion opcodes  (BZ 495817)

Specifically:
- BFP convert from/to fixed
- BFP convert from/to logical
- DFP convert from/to fixed
- DFP convert from/to logical

Change function names from e.g. s390_irgen/emit_CEFBR to
s390_irgen/emit_CEFBRA because CFEBR does not have m3 and m4 operands.
Adjust the returned mnemonic accordingly.

New functions fp_convf_disasm and fp_convt_disasm.

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

2 months agoarm/v6intThumb: Disable tests for instructions modifying pc (ldr pc, add pc)
Mark Wielaard [Sat, 29 Mar 2025 20:21:45 +0000 (21:21 +0100)] 
arm/v6intThumb: Disable tests for instructions modifying pc (ldr pc, add pc)

The test doesn't compile.

/usr/bin/ld: v6intThumb-v6intThumb.o(.text+0xf2): unresolvable
R_ARM_THM_CALL relocation against symbol `printf@@GLIBC_2.4'

Changing the movw and movt into a ldr as suggested in
https://bugs.kde.org/show_bug.cgi?id=339862#c1
Causes a different compile error.

/tmp/ccveFwf0.s:140: Error: offset out of range

So disable it for now.

2 months agoBug 420682 - io_pgetevents is not supported
Paul Floyd [Fri, 28 Mar 2025 20:45:15 +0000 (21:45 +0100)] 
Bug 420682 - io_pgetevents is not supported

2 months agofilter_gdb.in: __syscall_cancel_arch is just in a syscall
Mark Wielaard [Fri, 28 Mar 2025 12:44:35 +0000 (13:44 +0100)] 
filter_gdb.in: __syscall_cancel_arch is just in a syscall

Since glibc 2.41 some extra syscall_cancel frames are inserted before
that actual syscall is made. Just filter out __syscall_cancel_arch
from the gdb output and replace it with "in syscall ..." to make the
regtest .exp match.

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

2 months agos390x: PRNO tidy
Florian Krohm [Thu, 27 Mar 2025 16:30:03 +0000 (16:30 +0000)] 
s390x: PRNO tidy

The mnemonics PRNO and PPNO denote the same opcode. Both names were used
in the code. Not anymore. From now on: consistent naming PRNO / prno

While I was at it:
- Remove left-overs from the early days when PRNO was implemented by means
  of dirty helpers.
- Fix disassembly to use "prno".
- Fix a bug in s390_irgen_DFLTCC which was using "ppno" as mnemonic.

3 months agos390x: Fix disassembly for various insns (BZ 495817)
Florian Krohm [Wed, 26 Mar 2025 18:32:12 +0000 (18:32 +0000)] 
s390x: Fix disassembly for various insns  (BZ 495817)

Specifically: KMA, KMCTR, CU12, CU14, CU21, CU24, LCBB, TRE,
TROO, TROT, TRTO, TRTT

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

3 months agoFix library dependency for vbit-test and disasm-test.
Florian Krohm [Wed, 26 Mar 2025 15:11:29 +0000 (15:11 +0000)] 
Fix library dependency for vbit-test and disasm-test.

The executables were not relinked when the library was updated.

3 months agos390x: disasm-test: prepare for AR and FPR register support
Florian Krohm [Mon, 24 Mar 2025 21:53:11 +0000 (21:53 +0000)] 
s390x: disasm-test: prepare for AR and FPR register support

- New function random_reg to replace random_gpr, random_vr.
- New function unique_reg to replace unique_gpr, unique_vr.
- New function choose_reg_and_iterate to handle register operands whose
  values are constrained, e.g. only even registers.
- Do not call unique_reg for a register operand whose values are constrained.

3 months agos390x: disasm-test tweaks
Florian Krohm [Mon, 24 Mar 2025 14:44:07 +0000 (14:44 +0000)] 
s390x: disasm-test tweaks

- Give error messages a prefix.
- Do not segfault when the .dump file is empty. This happens when the
  generated testcase has compiler errors.
- Avoid a file leak when reading the .dump file causes an I/O error.

3 months agoFreeBSD: update comments for amd64 do_syscall_WRK
Paul Floyd [Sun, 23 Mar 2025 17:09:14 +0000 (18:09 +0100)] 
FreeBSD: update comments for amd64 do_syscall_WRK

Get the comments about the last two stack arguments right.

3 months agoTweak debuginfod-check.pl
Florian Krohm [Sun, 23 Mar 2025 16:00:19 +0000 (16:00 +0000)] 
Tweak debuginfod-check.pl

Testing the presence of debuginfod causes an error message in
case it is not installed. Suppress that message.

3 months agoBug 501893 - Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)?
Paul Floyd [Sun, 23 Mar 2025 09:21:29 +0000 (10:21 +0100)] 
Bug 501893 - Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)?

3 months agos390x: Fix BZ 498629
Florian Krohm [Sat, 22 Mar 2025 18:56:09 +0000 (18:56 +0000)] 
s390x: Fix BZ 498629

IR generation for S[L]HHHR and S[L]HHLR was broken. Now fixed as obvious.

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

3 months agos390x: Fix BZ 498632
Florian Krohm [Sat, 22 Mar 2025 18:51:04 +0000 (18:51 +0000)] 
s390x: Fix BZ 498632

IR generation for LNGFR was broken. Now fixed.

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

3 months agoBug 501850 - FreeBSD syscall arguments 7 and 8 incorrect.
Paul Floyd [Sat, 22 Mar 2025 07:15:35 +0000 (08:15 +0100)] 
Bug 501850 - FreeBSD syscall arguments 7 and 8 incorrect.

3 months agos390x: Fix disassembly for vector insns
Florian Krohm [Fri, 21 Mar 2025 23:08:49 +0000 (23:08 +0000)] 
s390x: Fix disassembly for vector insns

This was painful because there is a lot of irregularity in the
extended mnemonics. There is also a double-maintenance issue because
S390_DISASM is used both in guest_s390_to_IR.c and in the 'emit'
functions in host_s390_defs.c.  It might be worth exploring whether
the objdump disassembler can be extracted from binutils and re-used
here. That way the disassembly would be correct by construction.
And the double maintenance would go away.

Fix a few things alongside:
- In s390_format_VRI_VIM: is is a signed 16-bit value. So it needs to be
  sign-extended. Fixes disassembly for VLEI[BHFG]
- Fix function dvb_operand. v0 is not special.
- In s390_format_VRX_VRRDM pass forgotten m3 to S390_DISASM.
- In s390_irgen_VCNF: remove s390_insn_assert. VCNF does not have
  specification exceptions.
- Opcope VFLL has no mask m5. So s390_format_VRRa_VVMMM is the wrong format
  function. Change it to s390_format_VRRa_VVMM.
  In s390_irgen_VFLL: the value of m5 is not used in s390_vector_fp_convert
  because rounding == False. So, essentially, m5 is a don't care.
- Add VRR_v3 and use it when a vector register is meant (instead of VRR_r3)
- Add VRR_v4 and use it when a vector register is meant (instead of VRR_m4)
- Add VRS_r3 and use it when a GPR is meant (instead of VRS_v3)
- Add VRR_r2 and use it when a GPR is meant (instead of VRR_v2)
- Add field-access macros for the VRV opcode format. Use them.
- Add field-access macros for the VRIb opcode format. Use them.
- Add field-access macros for the VRIc opcode format. Use them.
- Add field-access macros for the VRSc opcode format. Use them.

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

3 months agoBug 501846 - Add x86 Linux shm wrappers
Paul Floyd [Fri, 21 Mar 2025 20:41:55 +0000 (21:41 +0100)] 
Bug 501846 - Add x86 Linux shm wrappers

3 months agoWrap linux specific userfaultfd syscall
Martin Cermak [Tue, 18 Mar 2025 17:17:30 +0000 (18:17 +0100)] 
Wrap linux specific userfaultfd syscall

userfaultfd takes a flags argument and returns a file descriptor.
It shows up in the Linux Test Project syscalls tests as unhandled.

Declare a sys_userfaultfd 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_userfaultfd in vki-scnums-s390x-linux.h. It was already
defined for all other arches.

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

3 months agoIllumos regtest: add an expected for memcheck/tests/vcpu_fnfns
Paul Floyd [Sun, 16 Mar 2025 17:46:27 +0000 (18:46 +0100)] 
Illumos regtest: add an expected for memcheck/tests/vcpu_fnfns

Minor numerical diffs, 'inf' vs 'infinity' (why isn't that
standardised?).

3 months agos390x: Rework s390_disasm interface (BZ 498942)
Florian Krohm [Sat, 15 Mar 2025 23:18:59 +0000 (23:18 +0000)] 
s390x: Rework s390_disasm interface  (BZ 498942)

The way extended mnemonics were communicated to s390_disasm was a bit messy
and, more importantly, error prone. The primary reason is that extended
mnemonics were added late in the game (at the time) and sort of force-fitted
on top of the existing scheme. Here are a few examples showing the new
way of doing things:

old: s390_disasm(ENC3(MNM, GPR, UINT), mnm, r1, i2);
new: S390_DISASM(MNM(mnm), GPR(r1), UINT(i2));

old: s390_disasm(ENC3(MNM, FPR, UDXB), mnm, r1, d2, x2, b2);
new: S390_DISASM(MNM(mnm), FPR(r1), UDXB(d2, x2, b2));

The arguments to S390_DISASM are essentially constructors for the various
opcode fields. They appear in the same order as written in Principles of Ops.

old: s390_disasm(ENC4(XMNM, GPR, INT, CABM), S390_XMNM_CAB, mnm, m3, r1, i2, m3);
new: S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), INT(i2), MASK(m3));

The 2nd argument to XMNM() is a function that constructs the extended mnemonic
and writes the disassembed insn as appropriate.

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

3 months agos390x: misc. fixes pertaining to vector insns
Florian Krohm [Sat, 15 Mar 2025 22:29:30 +0000 (22:29 +0000)] 
s390x: misc. fixes pertaining to vector insns

This patch is fall-out from working on fixing the disassembly for
the vector insns.

Specifically:
1) replace vassert with s390_insn_assert where appropriate
2) add missing s390_insn_asserts (many)
3) remove incorrect s390_insn_asserts (few)
4) check availability of vector opcodes based on hardware capabilities
   and issue an emulation failure if opcode is not available
5) fix a typo in a mnemonic: vfspo -> vfpso
6) inline function s390_vr_get_n_elem

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

3 months agos390x: Header file tweak
Florian Krohm [Sat, 15 Mar 2025 16:51:00 +0000 (16:51 +0000)] 
s390x: Header file tweak

Thou shalt write header files in a way that they are compilable
entities on their own.

3 months agoBug 501479 - Illumos DRD pthread_mutex_init wrapper errors
Paul Floyd [Fri, 14 Mar 2025 20:56:35 +0000 (21:56 +0100)] 
Bug 501479 - Illumos DRD pthread_mutex_init wrapper errors

3 months agoDarwin: close fd after call to ML_(check_macho_and_get_rw_loads)
Paul Floyd [Thu, 13 Mar 2025 19:47:28 +0000 (20:47 +0100)] 
Darwin: close fd after call to ML_(check_macho_and_get_rw_loads)

I missed changing the code so that the VG_(close) happens for all
platforms, not just non-Darwin.

3 months agoDarwin: change message for failure to open a binary
Paul Floyd [Thu, 13 Mar 2025 07:35:17 +0000 (08:35 +0100)] 
Darwin: change message for failure to open a binary

Previously was always ELF, now either ELF or mach-o.

3 months agos390x: Fix BZ 496950
Florian Krohm [Wed, 12 Mar 2025 23:10:06 +0000 (23:10 +0000)] 
s390x: Fix BZ 496950

Adding a new hardware capability requires changes in several places.
Generally for a new FOO hardware capability:
- add VEX_HWCAPS_S390X_FOO and update VEX_HWCAPS_S390X_ALL in libvex.h
- test the corresponding facility bit in m_machine.c
- add s390_host_has_foo in host_s390_defs.h
- if an insn requiring FOO cannot be implemented on the host by other means
  - add EmFail_S390X_foo in libvex_emnote.h
- handle EmFail_S390X_foo in main_main.c
- update function show_hwcaps_s390x

Occasionally something gets forgotten and this patch adds the forgotten
pieces.
Also add new hardware capabilities vxe2, vxd, msa, msa4, msa8, msa9

Fixes: https://bugs.kde.org/show_bug.cgi?id=496950
3 months agos390x: Remove macro definitions for hardware facilities
Florian Krohm [Wed, 12 Mar 2025 22:36:33 +0000 (22:36 +0000)] 
s390x: Remove macro definitions for hardware facilities

Remove the facility-bit macros S390_FAC_...
They are guaranteed to never change and are used only in m_machine.c

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

3 months agoadd_hardwired_spec for ld-linux-x86-64.so.2 memcmp
Mark Wielaard [Wed, 12 Mar 2025 12:57:19 +0000 (13:57 +0100)] 
add_hardwired_spec for ld-linux-x86-64.so.2 memcmp

With RPATH processing ld.so compiled for x86-64-v3 uses an optimized
avx2 memcmp (bcmp) which causes (false postive) memcheck invalid reads
of size 32 warnings.

Fix this my adding a hardwire spec with a simpler memcmp for
ld-linux-x86-64.so.2.

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

Authored-by: Florian Weimer <fweimer@redhat.com>
3 months agom_debuginfo/debuginfo.c (di_notify_mmap): Ignore memfd_create mappings
Mark Wielaard [Wed, 12 Mar 2025 12:42:12 +0000 (13:42 +0100)] 
m_debuginfo/debuginfo.c (di_notify_mmap): Ignore memfd_create mappings

When valgrind observes a mapping of a memfd_create anonymous file it
would generate a warning:

 WARNING: Serious error when reading debug info
 When reading debug info from /memfd:mozilla-ipc (deleted):
 failed to stat64/stat this file

All such memfd_create anonymous files are always prefixed with
"memfd:" and obviously cannot be stat64/stat. So ignore such warnings.

Tested-by: ishikawa@yk.rim.or.jp
3 months agoSolaris suppressions: add suppressions for Solaris 11.4 getaddrinfo
Paul Floyd [Wed, 12 Mar 2025 07:33:11 +0000 (08:33 +0100)] 
Solaris suppressions: add suppressions for Solaris 11.4 getaddrinfo

getaddrinfo, the bane of all threading tests.

3 months agoSolaris regtest: fdleak filter, change __xnet_socket to just socket
Paul Floyd [Wed, 12 Mar 2025 07:12:10 +0000 (08:12 +0100)] 
Solaris regtest: fdleak filter, change __xnet_socket to just socket

3 months agoIllumos regtest: add a filter for shell 'Abort' messages
Paul Floyd [Tue, 11 Mar 2025 19:50:07 +0000 (20:50 +0100)] 
Illumos regtest: add a filter for shell 'Abort' messages

3 months agoIllumos fdleak: dup2 spurious errors
Paul Floyd [Tue, 11 Mar 2025 19:36:30 +0000 (20:36 +0100)] 
Illumos fdleak: dup2 spurious errors

We should also put back checks that calls like dup2 aren't
using reserved file descriptors.

3 months agoRegtest: filter out pathname from memcheck dw4 test
Paul Floyd [Tue, 11 Mar 2025 08:10:42 +0000 (09:10 +0100)] 
Regtest: filter out pathname from memcheck dw4 test

3 months agoFix more int to pointer warnings.
Paul Floyd [Tue, 11 Mar 2025 06:40:48 +0000 (07:40 +0100)] 
Fix more int to pointer warnings.

No more produced with GCC 14 on OI.

3 months agos390x: disasm-test: Fix thinko
Florian Krohm [Mon, 10 Mar 2025 12:36:21 +0000 (12:36 +0000)] 
s390x: disasm-test: Fix thinko

Remove verbiage about limited support for opcodes with optional operands.
Optional operands are of no concern for disassembly. The reason is that
disassembly sees as its input only a sequence of bytes which have no
indication as to whether some of its bits were explicitly specified or not.
We're testing the disassembler here - not the assembler.

3 months agodocs/Makefile.am: Make sure xml catalog file exists for xmllint check
Mark Wielaard [Sun, 9 Mar 2025 15:46:50 +0000 (16:46 +0100)] 
docs/Makefile.am: Make sure xml catalog file exists for xmllint check

When XML_CATALOG_FILES don't exist on the system xmllint will have to
query those files through various websites. When there is a network
error xmllint will fail. So make sure to only run the validity tests
when both xmllint and XML_CATALOG_FILES exists.

3 months agocoregrind/m_debuginfo: don't try to examine zero sized mmapped files
Mark Wielaard [Sun, 9 Mar 2025 14:59:29 +0000 (15:59 +0100)] 
coregrind/m_debuginfo: don't try to examine zero sized mmapped files

When run on an nfs filesystem memcheck/tests/pointer-trace fails
because it generates warnings "connection to image failed". This is
caused by trying to mmap a deleted file which the nfs file system
represents as a (hidden) regular file. This is normally not a problem
except when that file is empty.

Fix this by not trying to check whether a file is an ELF or MACHO
against an empty (regular) file in di_notify_mmap. An empty file is
never a valid ELF or MACHO file (and cannot be represented as
DiImage).

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

3 months agoFix int to pointer warnings
Paul Floyd [Sat, 8 Mar 2025 08:20:53 +0000 (09:20 +0100)] 
Fix int to pointer warnings

and a minnor correction for a comment about ELF segment handling

3 months agoBug 501194 - Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any...
Paul Floyd [Fri, 7 Mar 2025 22:12:13 +0000 (23:12 +0100)] 
Bug 501194 - Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of segment commands

3 months agoFreeBSD regtest: getrlimitusage on arm64
Paul Floyd [Fri, 7 Mar 2025 06:00:26 +0000 (07:00 +0100)] 
FreeBSD regtest: getrlimitusage on arm64

Resident memory isn't stable even when truncated to a
multiple of ten milllion. I.e., zero digits of useful precision.
So just set this field to zero like the other flaky values.

3 months agos390x: Fix VLRL and VSTRL insns (Bug 498422)
Florian Krohm [Thu, 6 Mar 2025 18:39:26 +0000 (18:39 +0000)] 
s390x: Fix VLRL and VSTRL insns   (Bug 498422)

The replacement field for these insns is 12-bit wide. So its value
cannot possibly be represented by a UChar. Use UShort instead.

This was found by disasm-test like so:

./disasm-test --run vlrl
*** mismatch VEX: |vlrl  %v6,255,4|    objdump: |vlrl  %v6,4095,4|

./disasm-test --run vstrl
*** mismatch VEX: |vstrl  %v6,255(%r4),7|   objdump: |vstrl  %v6,4095(%r4),7|

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

3 months agos390x: Add disassembly checker (Bug 498037)
Florian Krohm [Thu, 6 Mar 2025 17:42:05 +0000 (17:42 +0000)] 
s390x: Add disassembly checker (Bug 498037)

Add program disasm-test to check that s390_disasm generates the same
disassembly for a given insn than objdump -d does.  The focus is on insns
that have extended mnemonics most of which are vector insns.
The checker resides in none/tests/s390x/disasm-test with comprehensive
documentation in the README file there.
It is integrated into the regression testing framework but currently
disabled, because s390_disasm has not been fixed yet.

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

3 months agoFix two outdated comments in VEX.
Florian Krohm [Wed, 5 Mar 2025 23:12:17 +0000 (23:12 +0000)] 
Fix two outdated comments in VEX.

main_util.c: The symbol vg_message no longer exists.

host_s390_defs.c: In b2cc7ea009ae4f0eaa1197ee6f5c07e0ee873b3a the definition
of s390_host_hwcaps was moved to main_main.c

3 months agoriscv64: Avoid warning about missing return value in stat wrapper
Andreas Schwab [Fri, 23 Jun 2023 12:25:27 +0000 (14:25 +0200)] 
riscv64: Avoid warning about missing return value in stat wrapper

m_libcfile.c: In function 'vgPlain_stat':
m_libcfile.c:594:1: error: control reaches end of non-void function [-Werror=return-type]
  594 | }
      | ^

3 months agoNEWS file: Sort fixed bugs by increasing bug number
Florian Krohm [Wed, 5 Mar 2025 22:35:01 +0000 (22:35 +0000)] 
NEWS file: Sort fixed bugs by increasing bug number

3 months agos390x: Add missing NEWS entry
Florian Krohm [Wed, 5 Mar 2025 22:24:32 +0000 (22:24 +0000)] 
s390x: Add missing NEWS entry

Add missing NEWS entry for https://bugs.kde.org/show_bug.cgi?id=495816
which was fixed in 1e694434a5cd2a0352e97f872ebd6922129c0282.

3 months agosyswrap-generic: Emit pp_ExeContext after the file descriptor backtrace
Alexandra Hájková [Mon, 3 Mar 2025 11:14:08 +0000 (06:14 -0500)] 
syswrap-generic: Emit pp_ExeContext after the file descriptor backtrace

Adjust use_after_close test for the change.

3 months agoriscv64: Add hardwire for ld-linux-riscv64-lp64d.so.1 strcmp
Mark Wielaard [Sat, 28 Dec 2024 00:29:58 +0000 (01:29 +0100)] 
riscv64: Add hardwire for ld-linux-riscv64-lp64d.so.1 strcmp

When using dlopen ld.so can end up in glibc strcmp_unaligned_loop
which causes undefined reads. Hardwire strcmp for ld.so with a simple
assembly implementation.

3 months agoriscv64: syswrap various shared linux syscalls
Mark Wielaard [Thu, 26 Dec 2024 12:18:09 +0000 (13:18 +0100)] 
riscv64: syswrap various shared linux syscalls

syswrap-riscv64-linux.c: Hook up open_tree, move_mount, fsopen,
fsconfig, fsmount, fspick, pidfd_open, openat2, pidfd_getfd,
epoll_pwait2, landlock_create_ruleset, landlock_add_rule,
landlock_restrict_self and fchmodat2.

3 months agoVEX/priv/guest_riscv64_toIR.c: Recognize both fence and fence.tso
Mark Wielaard [Sat, 14 Dec 2024 22:11:57 +0000 (22:11 +0000)] 
VEX/priv/guest_riscv64_toIR.c: Recognize both fence and fence.tso

fence.tso is used for __atomic_thread_fence (__ATOMIC_ACQ_REL)

There are 3 fence variants.

fence.tso  fm set to 1000 and pred and succ both set to 0011.
fence with fm set to 0000 and pred and succ both set to 1111.
fence with fm set to 0000 and pred and succ with some iorw flags set.

https://bugs.kde.org/show_bug.cgi?id=468575#c42

3 months agonone/tests/riscv64/integer.c: replace zero by a1
Mark Wielaard [Tue, 24 Dec 2024 23:36:53 +0000 (00:36 +0100)] 
none/tests/riscv64/integer.c: replace zero by a1

Using zero will produce an gas Error: illegal operands `la zero,0'
https://sourceware.org/bugzilla/show_bug.cgi?id=32496

Simplest seems to be to replace the usage of "zero" in the branch
instruction tests by "a1".  It seems that does test something similar
that isn't tested before.

3 months agoriscv64: Add initial support: test modifications
Petr Pavlu [Tue, 11 Apr 2023 19:30:43 +0000 (19:30 +0000)] 
riscv64: Add initial support: test modifications

The following people contributed to the initial RISC-V support:
Petr Pavlu <petr.pavlu@dagobah.cz>
Xeonacid <h.dwwwwww@gmail.com>
laokz <laokz@foxmail.com>
Chelsea E. Manning <me@xychelsea.is>
zhaomingxin <zhaomingxin.zmx@alibaba-inc.com>
Jojo R <rjiejie@linux.alibaba.com>

Some integration fixes were added by Mark Wielaard <mark@klomp.org>
- helgrind/tests/tc11_XCHG.c: Fix XCHG_M_R guard

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

3 months agoriscv64: Add initial support: VEX modifications
Petr Pavlu [Tue, 11 Apr 2023 19:30:43 +0000 (19:30 +0000)] 
riscv64: Add initial support: VEX modifications

The following people contributed to the initial RISC-V support:
Petr Pavlu <petr.pavlu@dagobah.cz>
Xeonacid <h.dwwwwww@gmail.com>
laokz <laokz@foxmail.com>
Chelsea E. Manning <me@xychelsea.is>
zhaomingxin <zhaomingxin.zmx@alibaba-inc.com>
Jojo R <rjiejie@linux.alibaba.com>

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