Skip to content

Conversation

LouisBrunner
Copy link
Owner

No description provided.

Florian Krohm and others added 30 commits April 3, 2025 09:43
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
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.
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.
…ck_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.
filter a change for the bottom of thread stacks and
add use the same pre check as Linux for DRD OpenMP tests.
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.
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.
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.
Illumos GCC doesn't have -pie. Also use it for the link command.
No impact, typo in a comment.
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.
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.
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.
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
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.
I missed one level of ../ and didn't see that there was already
a prereq: in each of these two files.
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,...]
These messages were missing for the test

none/tests/solaris/stack_overflow

on Illumos. The test now passes.
…text_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.
rh-mcermak and others added 21 commits August 6, 2025 19:13
Update futimesat syscall wrapper so that it doesn't consider the
special value AT_FDCWD (-100) an invalid file descriptor.

https://bugs.kde.org/show_bug.cgi?id=507868
Make sure pybuild.sh, ltp-tester.sh, ltp-apply-patches.sh,
s390-check-opcodes.pl, s390-runone scripts, ltp filters, ltp patches
and pylintrc are added to the dist.

This makes sure users can run the scripts and make ltpchecks not just
from a git checkout, but also from a release or snapshots tar.

Also use the ustar format to package files, the path under
valgrind-x.yy.z/auxprogs/ltp-patches might be larger than 99
chars. automake 1.18 already defaults to the ustar format.
Reuse the vmsplice syscall wrapper in coregrind/m_syswrap/syswrap-linux.c
for mips64 as well. And make sure arm64-linux and riscv64-linux also use
the POST vmsplice wrapper.
Specifically:

sys_getrlimit
sys_mincore
sys_tkill
sys_unshare
sys_splice
sys_tee
sys_vmsplice
sys_fanotify_init
sys_fanotify_mark
sys_kcmp
sys_bpf

https://bugs.kde.org/show_bug.cgi?id=508030
Do more fine-grained checks within sys_faccessat and sys_faccessat2
syscall wrappers.  Allow passing special value of VKI_AT_FDCWD as a
file descriptor.  Check for valid flags.

https://bugs.kde.org/show_bug.cgi?id=507853
Define __NR_statmount and __NR_listmount.
This update makes the source buildable on the mips32 arch.

https://bugs.kde.org/show_bug.cgi?id=508027
Command line flags that modify variable vex_control did not have the
desired effect when processed dynamically via VALGRIND_CLO_CHANGE.

The fix is to call the new function LibVEX_set_VexControl in
process_dynamic_option.

Fixes https://bugs.kde.org/show_bug.cgi?id=508093
No need to run random tests for binary IROps with 1-bit wide operands.
Defaults to "yes".
Add VexControl::iropt_fold_expr and observe it in fold_Expr_WRK.

This flag will be used shortly in the iropt-test program.
Users are not expected to use it which is why I'm not announcing
it in NEWS.
Multiple `make ltpchecks` failures seem tp be caused by
PRE(sys_fchownat) not handling VKI_AT_FDCWD properly.
This specifically impacts aarch64 test results these days.

https://bugs.kde.org/show_bug.cgi?id=508154
Using LHI is wrong as it sign-extends. Use IILF instead.
This has been wrong since day #1. Found by iropt-test.
When dlopen is used we might end up in an assembly powerpc/strcmp.S
variant that is optimized in a way memcheck cannot proof correct. We
try to intercept strcmp in ld.so, but might fail when strcmp is called
before our interception code is loaded. Having an hardwire for ld.so
strcmp (earlier intercept) would solve this.

https://bugs.kde.org/show_bug.cgi?id=508145
Multiplication is performed using 4-byte values.
There were two bugs:
(1) Iop_MullS8/16 operands weren't sign-extended
(2) No shifting and OR'ing required to access the result. r11[32:63] has it.

Found by iropt-test.
Easy as pie and fewer special cases for iropt-test.
Easy as pie and fewer special cases for iropt-test.
Bug was introduced by yours truly in e3f078d.
@LouisBrunner LouisBrunner self-assigned this Aug 20, 2025
Copy link
Contributor

Smart Diff (ubuntu-24.04): Failure

Expected tolerance same but got mixed-better instead

===================================================================
--- .github/ubuntu-24.04-expected.txt
+++ .github/test/filtered-results.txt
@@ -1,14 +1,3 @@
-none/tests/fdleak_cmsg                   (stderr)
-none/tests/fdleak_cmsg_supp              (stderr)
-none/tests/fdleak_creat                  (stderr)
-none/tests/fdleak_creat_sup              (stderr)
-none/tests/fdleak_dup                    (stderr)
-none/tests/fdleak_dup2                   (stderr)
-none/tests/fdleak_fcntl                  (stderr)
-none/tests/fdleak_ipv4                   (stderr)
-none/tests/fdleak_open                   (stderr)
-none/tests/fdleak_pipe                   (stderr)
-none/tests/fdleak_socketpair             (stderr)
-none/tests/file_dclose                   (stderr)
-none/tests/file_dclose_sup               (stderr)
-none/tests/socket_close                  (stderr)
+memcheck/tests/wcpncpy                   (stderr)
+none/tests/track_high                    (stderr)
+none/tests/track_yes                     (stderr)

Copy link
Contributor

Smart Diff (macos-14): Failure

Expected tolerance same but got mixed-better instead

===================================================================
--- .github/macos-14-expected.txt
+++ .github/test/filtered-results.txt
@@ -91,8 +91,9 @@
 memcheck/tests/pointer-trace             (stderr)
 memcheck/tests/posix_memalign_xml        (stderr)
 memcheck/tests/realloc_size_zero_again_no (stderr)
 memcheck/tests/realloc_size_zero_again_yes (stderr)
+memcheck/tests/realloc_size_zero_xml     (stderr)
 memcheck/tests/recursive-merge           (stderr)
 memcheck/tests/resvn_stack               (stderr)
 memcheck/tests/sendmsg                   (stderr)
 memcheck/tests/sh-mem-random             (stdout)
@@ -109,9 +110,8 @@
 memcheck/tests/test-plo-no               (stderr)
 memcheck/tests/test-plo-yes              (stderr)
 memcheck/tests/thread_alloca             (stderr)
 memcheck/tests/threadname                (stderr)
-memcheck/tests/threadname_xml            (stderr)
 memcheck/tests/trivialleak               (stderr)
 memcheck/tests/undef_malloc_args         (stderr)
 memcheck/tests/varinfo1                  (stderr)
 memcheck/tests/varinfo2                  (stderr)
@@ -369,28 +369,23 @@
 none/tests/fdbaduse                      (stderr)
 none/tests/fdleak_cmsg                   (stderr)
 none/tests/fdleak_cmsg_supp              (stderr)
 none/tests/fdleak_cmsg_xml               (stderr)
-none/tests/fdleak_creat                  (stderr)
 none/tests/fdleak_creat_sup              (stderr)
 none/tests/fdleak_creat_xml              (stderr)
-none/tests/fdleak_dup                    (stderr)
-none/tests/fdleak_dup2                   (stderr)
+none/tests/fdleak_doubleclose0           (stderr)
 none/tests/fdleak_dup2_xml               (stderr)
 none/tests/fdleak_dup_xml                (stderr)
-none/tests/fdleak_fcntl                  (stderr)
 none/tests/fdleak_fcntl_xml              (stderr)
 none/tests/fdleak_ipv4                   (stderr)
 none/tests/fdleak_ipv4_xml               (stderr)
-none/tests/fdleak_open                   (stderr)
-none/tests/fdleak_pipe                   (stderr)
 none/tests/fdleak_pipe_xml               (stderr)
-none/tests/fdleak_socketpair             (stderr)
 none/tests/fdleak_socketpair_xml         (stderr)
 none/tests/file_dclose                   (stderr)
 none/tests/file_dclose_sup               (stderr)
 none/tests/file_dclose_xml               (stderr)
 none/tests/ioctl_moans                   (stderr)
+none/tests/iropt-test/iropt-test         (stderr)
 none/tests/libvex_test                   (stderr)
 none/tests/libvexmultiarch_test          (stderr)
 none/tests/map_unmap                     (stdout)
 none/tests/map_unmap                     (stderr)
@@ -404,6 +399,10 @@
 none/tests/socket_close                  (stderr)
 none/tests/socket_close_xml              (stderr)
 none/tests/stackgrowth                   (stdout)
 none/tests/stackgrowth                   (stderr)
+none/tests/track_bad                     (stderr)
+none/tests/track_high                    (stderr)
+none/tests/track_new                     (stderr)
+none/tests/track_yes                     (stderr)
 none/tests/use_after_close               (stderr)
 none/tests/vgprintf                      (stderr)

Copy link
Contributor

Smart Diff (macos-13): Failure

Expected tolerance same but got mixed-better instead

===================================================================
--- .github/macos-13-expected.txt
+++ .github/test/filtered-results.txt
@@ -62,8 +62,9 @@
 memcheck/tests/posix_memalign_xml        (stderr)
 memcheck/tests/post-syscall              (stderr)
 memcheck/tests/realloc_size_zero_again_no (stderr)
 memcheck/tests/realloc_size_zero_again_yes (stderr)
+memcheck/tests/realloc_size_zero_xml     (stderr)
 memcheck/tests/recursive-merge           (stderr)
 memcheck/tests/sendmsg                   (stderr)
 memcheck/tests/sized_aligned_new_delete_misaligned1_xml (stderr)
 memcheck/tests/sized_aligned_new_delete_misaligned2_xml (stderr)
@@ -73,9 +74,8 @@
 memcheck/tests/strchr                    (stderr)
 memcheck/tests/supponlyobj               (stderr)
 memcheck/tests/test-plo-no               (stderr)
 memcheck/tests/thread_alloca             (stderr)
-memcheck/tests/threadname_xml            (stderr)
 memcheck/tests/trivialleak               (stderr)
 memcheck/tests/undef_malloc_args         (stderr)
 memcheck/tests/varinfo1                  (stderr)
 memcheck/tests/varinfo2                  (stderr)
@@ -314,20 +314,15 @@
 none/tests/fdbaduse                      (stderr)
 none/tests/fdleak_cmsg                   (stderr)
 none/tests/fdleak_cmsg_supp              (stderr)
 none/tests/fdleak_cmsg_xml               (stderr)
-none/tests/fdleak_creat                  (stderr)
 none/tests/fdleak_creat_sup              (stderr)
-none/tests/fdleak_dup                    (stderr)
-none/tests/fdleak_dup2                   (stderr)
-none/tests/fdleak_fcntl                  (stderr)
+none/tests/fdleak_doubleclose0           (stderr)
 none/tests/fdleak_ipv4                   (stderr)
-none/tests/fdleak_open                   (stderr)
-none/tests/fdleak_pipe                   (stderr)
-none/tests/fdleak_socketpair             (stderr)
 none/tests/file_dclose                   (stderr)
 none/tests/file_dclose_sup               (stderr)
 none/tests/ioctl_moans                   (stderr)
+none/tests/iropt-test/iropt-test         (stderr)
 none/tests/map_unmap                     (stdout)
 none/tests/map_unmap                     (stderr)
 none/tests/mmap_fcntl_bug                (stderr)
 none/tests/nocwd                         (stdout)
@@ -339,5 +334,9 @@
 none/tests/socket_close                  (stderr)
 none/tests/stackgrowth                   (stdout)
 none/tests/stackgrowth                   (stderr)
 none/tests/syscall-restart1              (stderr)
+none/tests/track_bad                     (stderr)
+none/tests/track_high                    (stderr)
+none/tests/track_new                     (stderr)
+none/tests/track_yes                     (stderr)
 none/tests/use_after_close               (stderr)

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
6.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@LouisBrunner LouisBrunner merged commit 62e0942 into main Aug 21, 2025
10 of 13 checks passed
@LouisBrunner LouisBrunner deleted the feat/up-1755708939 branch August 21, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants