]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
4 months agoHandle top __syscall_cancel frames when getting stack traces VALGRIND_3_24_BRANCH
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
(cherry picked from commit 41441379baa63b5471385361d08c8df317705b69)

4 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

(cherry picked from commit ddcb3aa3ed3188cd28c193225245a76e928b850b)

4 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)?

(cherry picked from commit f87c58e89c4a0e85c59f39a7ae01027686bfff73)

4 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

(cherry picked from commit f3f30becff5851b0d0b2caa7e96e661c7889f7d1)

5 months agogdbserver_tests: filter out new Missing rpms message
Mark Wielaard [Thu, 16 Jan 2025 16:30:37 +0000 (17:30 +0100)] 
gdbserver_tests: filter out new Missing rpms message

As seen on the fedora 40 s390x tester. GDB now might output something
like:

Missing rpms, try: dnf --enablerepo='*debug*' install glibc-debuginfo-2.39-33.fc40.s390x

Filter those messages out to get zero fail test results again.

(cherry picked from commit 090f8ce59b5f3d3ec39e032ee5e9524ce4f51a44)

5 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>
(cherry picked from commit 9ffdeb4927b8505cc5a9ea54f608f4972166bb0e)

5 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.

(cherry picked from commit 838dc01d2c42f7f22785c771bd74bc4e595da444)

6 months agoppc test_dfp2 build fix for GCC 15
Mark Wielaard [Wed, 15 Jan 2025 15:27:12 +0000 (16:27 +0100)] 
ppc test_dfp2 build fix for GCC 15

GCC 15 defaults to C23 which changes the meaning of unprototyped
functions, those declaring no arguments with (). Causing some errors:

test_dfp2.c:412:26: error: initialization of 'void (*)(void)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types]
  412 |                        { &_test_dscri,  "dscri",   dfp_2args_x1, 20, LONG_TEST, ">>", True},
      |                          ^
test_dfp2.c:412:26: note: (near initialization for 'dfp_two_arg_tests[0].test_func')
test_dfp2.c:110:13: note: '_test_dscri' declared here
  110 | static void _test_dscri (int shift)
      |             ^~~~~~~~~~~

test_dfp2.c:664:17: error: assignment to 'test_func_t' {aka 'void (*)(void)'} from incompatible pointer type 'test_func_main_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
  664 |    while ((func = all_tests[i].test_category)) {
      |                 ^
test_dfp2.c:237:16: note: 'test_func_t' declared here
  237 | typedef void (*test_func_t)();
      |                ^~~~~~~~~~~
test_dfp2.c:238:16: note: 'test_func_main_t' declared here
  238 | typedef void (*test_func_main_t)(int);
      |                ^~~~~~~~~~~~~~~~
test_dfp2.c:667:8: error: too many arguments to function 'func'; expected 0, have 1
  667 |       (*func)(has_vsx);
      |       ~^~~~~~ ~~~~~~~

Fix this by just explicitly compiling that code with -std=gnu99.

6 months agolinux: support EVIOCGRAB ioctl
Mark Wielaard [Wed, 8 Jan 2025 15:52:03 +0000 (16:52 +0100)] 
linux: support EVIOCGRAB ioctl

EVIOCGRAB just takes an int argument.

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

(cherry picked from commit 59eb5a4af60d4beb2c6910a1fa6cdf8d1f3a56f2)

6 months agoBug 498317 - FdBadUse is not a valid CoreError type in a suppression even though...
Paul Floyd [Tue, 7 Jan 2025 07:05:20 +0000 (08:05 +0100)] 
Bug 498317 - FdBadUse is not a valid CoreError type in a suppression even though it's generated by --gen-suppressions=yes

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

(cherry picked from commit 47bdc4a6f3de8e2071561d349fdd5f830388c489)

8 months agoRecognize new DWARF5 DW_LANG constants
Mark Wielaard [Fri, 6 Dec 2024 14:39:25 +0000 (15:39 +0100)] 
Recognize new DWARF5 DW_LANG constants

When using --read-var-info=yes readdwarf3 will try to read and
interpret the CU DW_AT_langauge attribute. Since DWARF5 was released a
number if new language constants have been introduced. See
https://dwarfstd.org/languages.html

GCC15 might start emitting some of these when switching to C23 by
default.

When valgrind --read-var-info=yes encounters an unknown DW_LANG
constant it will produce an error and stop processing any further
DWARF.

Recognize all currently known language constants. In particular
recognize DW_LANG_C17, DW_LANG_C23, DW_LANG_C_plus_plus_17,
DW_LANG_C_plus_plus_20, DW_LANG_C_plus_plus_23, DW_LANG_Fortran18,
DW_LANG_Fortran23, DW_LANG_Ada2005, DW_LANG_Ada2012 and DW_LANG_Rust.

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

(cherry picked from commit 7136316123c54aba37fdab166e1bf860e452a4ae)

8 months agoAdd open_tree, move_mount, fsopen, fsconfig, fsmount, fspick linux syswraps
Mark Wielaard [Tue, 26 Nov 2024 18:00:34 +0000 (19:00 +0100)] 
Add open_tree, move_mount, fsopen, fsconfig, fsmount, fspick linux syswraps

Shared linux syscalls implementing various file system mount tasks.
Since linux kernel version 5.2.

Check arguments and track file descriptors.

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

(cherry picked from commit 4044bcea0427853fc44a3d02a0fc0b2a81935452)

8 months agonone/tests/bug234814.c: sa_handler take an int as argument
Mark Wielaard [Sat, 23 Nov 2024 21:59:21 +0000 (22:59 +0100)] 
none/tests/bug234814.c: sa_handler take an int as argument

GCC15 will turn this warning into an error:

bug234814.c: In function 'main':
bug234814.c:20:18: error: assignment to '__sighandler_t' {aka 'void (*)(int)'} from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
   20 |    sa.sa_handler = mysigbus;
      |                  ^

(cherry picked from commit 8f6cef269b91739f6a2e7f3b4b1e0a429db3e748)

8 months agodrd/tests/swapcontext.c: Rename typedef struct thread_local to threadlocal
Mark Wielaard [Sat, 23 Nov 2024 21:48:03 +0000 (22:48 +0100)] 
drd/tests/swapcontext.c: Rename typedef struct thread_local to threadlocal

Since C23 thread_local is a keyword (thread storage duration).

swapcontext.c:23:16: error: expected '{' before 'thread_local'
   23 | typedef struct thread_local {
      |                ^~~~~~~~~~~~
swapcontext.c:23:16: warning: 'thread_local' is not at beginning of declaration [-Wold-style-declaration]
swapcontext.c:23:16: error: 'thread_local' used with 'typedef'
swapcontext.c:26:3: warning: data definition has no type or storage class
   26 | } thread_local_t;
      |   ^~~~~~~~~~~~~~

(cherry picked from commit 907b985725805f1537396a6d76539bf490cc6c7e)

8 months agohelgrind/tests/tc17_sembar.c: Remove bool typedef
Mark Wielaard [Sat, 23 Nov 2024 21:37:14 +0000 (22:37 +0100)] 
helgrind/tests/tc17_sembar.c: Remove bool typedef

Since C23 bool is a keyword. Also bool wasn't actually used.

tc17_sembar.c:45:14: error: both 'long' and '_Bool' in declaration specifiers
   45 | typedef long bool;
      |              ^~~~
tc17_sembar.c:45:1: warning: useless type name in empty declaration
   45 | typedef long bool;
      | ^~~~~~~

(cherry picked from commit 932bf2c027579c8d933b57ed80bb5842b390bdb3)

8 months agoAdd support for landlock_create_ruleset (444), landlock_add_rule (445) and landlock_r...
Peter Seiderer [Mon, 8 Jul 2024 09:05:47 +0000 (11:05 +0200)] 
Add support for landlock_create_ruleset (444), landlock_add_rule (445) and landlock_restrict_self (446) syscalls

- add support for landlock_create_ruleset (444) syscall
- add support for landlock_add_rule (445) syscall
- add support for landlock_restrict_self (446) syscall

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

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
(cherry picked from commit b1453546fe7396e7d4b4b2fc8ec7e64b71d18611)

8 months agoAdd additional exp-ppc64le files to EXTRA_DIST
Paul Floyd [Sun, 24 Nov 2024 07:10:51 +0000 (08:10 +0100)] 
Add additional exp-ppc64le files to EXTRA_DIST

(cherry picked from commit 7241959ebb88a588eebe5a9fd35d1642db71474b)

8 months agoAdd exp and supp patterns for missing main frame for ppc64le
Mark Wielaard [Sat, 23 Nov 2024 20:28:13 +0000 (21:28 +0100)] 
Add exp and supp patterns for missing main frame for ppc64le

In some cases on ppc64le we are missing the main frame.
Add alternative .exp-ppc64le variants for socket_close_xml,
fdleak_cmsg_xml and fdleak_ipv4_xml. And extra suppressions
without a main frame for fdleak_cmsg_supp.

See also commit 04d30049b "Filter away "main" differences in filter_fdleak"

(cherry picked from commit e6960c2e41b103ab8d393cbe13dc6473fb89bffc)

8 months agoregtest: add a fdleak filter for write on write on linux arm64
Paul Floyd [Thu, 21 Nov 2024 07:44:04 +0000 (08:44 +0100)] 
regtest: add a fdleak filter for write on write on linux arm64

(cherry picked from commit 9150b3c7cfad2fdbeb7cf707175c359ee12d8f75)

8 months agovgdb.c (fork_and_exec_valgrind): Fix another off-by-one error write
Mark Wielaard [Tue, 12 Nov 2024 12:34:09 +0000 (13:34 +0100)] 
vgdb.c (fork_and_exec_valgrind): Fix another off-by-one error write

commit 646978d9adc5 ("vgdb: Handle EINTR and EAGAIN more
consistently") introduced another off-by-one issue trying to write
back the error from child to parent.

Instead of +1 it should have been +written (which initially is zero).

This is when the child needs to do a chdir and that chdir fails. If
that happens the parent would have gotten the wrong error code.

(cherry picked from commit 747ca4eb5fed5dd58a14391a997bb9e658e3b1c8)

8 months agovgdb.c (fork_and_exec_valgrind): Fix off-by-one error write
Mark Wielaard [Tue, 12 Nov 2024 12:23:03 +0000 (13:23 +0100)] 
vgdb.c (fork_and_exec_valgrind): Fix off-by-one error write

commit 646978d9adc5 ("vgdb: Handle EINTR and EAGAIN more
consistently") introduced an off-by-one issue trying to write back the
error from child to parent.

Instead of +1 it should have been +written (which initially is zero).

This is in an "should never happen" path, so hopefully didn't really
cause issues. But if it did happen the parent would have gotten the
wrong error code.

(cherry picked from commit f4fe5faf3d0f45b3824bbb9070232682df52a582)

8 months agoPrepare NEWS for branch 3.24 fixes
Mark Wielaard [Sat, 23 Nov 2024 01:09:27 +0000 (02:09 +0100)] 
Prepare NEWS for branch 3.24 fixes

8 months agoSet version to 3.24.1.GIT
Mark Wielaard [Sat, 23 Nov 2024 01:07:47 +0000 (02:07 +0100)] 
Set version to 3.24.1.GIT

9 months ago-> 3.24.0 final VALGRIND_3_24_0
Mark Wielaard [Fri, 1 Nov 2024 04:19:38 +0000 (05:19 +0100)] 
-> 3.24.0 final

9 months agoMake const OpenFd *ML_(find_OpenFd) static
Mark Wielaard [Fri, 1 Nov 2024 03:40:22 +0000 (04:40 +0100)] 
Make const OpenFd *ML_(find_OpenFd) static

9 months agoDRM_IOCTLs SYNCOBJ_HANDLE_TO_FD, PRIME_HANDLE_TO_FD and MODE_CREATE_LEASE
Mark Wielaard [Fri, 1 Nov 2024 03:26:45 +0000 (04:26 +0100)] 
DRM_IOCTLs SYNCOBJ_HANDLE_TO_FD, PRIME_HANDLE_TO_FD and MODE_CREATE_LEASE

These three DRM_IOCTLs create new file descriptors, so track them using
ML_(record_fd_open_nameless).

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

9 months agogsl19test does not work properly when /bin/sh is /bin/dash
Florian Krohm [Thu, 31 Oct 2024 23:31:27 +0000 (00:31 +0100)] 
gsl19test does not work properly when /bin/sh is /bin/dash

There were 2 issues:

1) The output redirect operators seem to be bash specific. All output
   went to the terminal.....

2) When invoking valgrind the 'eval' needs to precede
  GSL_TEST_VERBOSE=1. Otherwise that environment variable is not seen
  by valgrind.

Two tweaks:

1) Determine the number of available processors and use that in make
   -j when building gsl-1.9

2) Replace -v with -q in the valgrind invocation. The file out-V is
   already quite large (approx 600 MB). It would be enormous with -v.

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

9 months agoReport track-fd errors for fd used which was not opened or already closed
Alexandra Hájková [Wed, 16 Oct 2024 17:38:48 +0000 (13:38 -0400)] 
Report track-fd errors for fd used which was not opened or already closed

Add (optional) pathname, description, where_closed and where_opened
fields to struct FdBadUse. Print those fields when set in fd_pp_Error.

Add a new function ML_(find_OpenFd) that provides a recorded OpenFd
given an fd (or NULL when the fd was never recorded).

In ML_(fd_allowed) when using a file descriptor use ML_(find_OpenFd)
to see if the fd was ever created, if not create an "was never
created" FdBadUse error. If it was created, but already closed create
an "was closed already", filling in as much details as we can.

Add none/tests/use_after_close.vgtest to test, already closed, never
created, invalid, double (double) close and invalid close issues.

Adjust error message in none/tests/fdbaduse.stderr.exp.

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

9 months agoIllumos: fix wartnings
Paul Floyd [Tue, 29 Oct 2024 20:02:38 +0000 (21:02 +0100)] 
Illumos: fix wartnings

Macro redefinition, calculating the size of an array and printf
format specifiers.

9 months agomacOS: compiler warnings
Paul Floyd [Tue, 29 Oct 2024 19:31:06 +0000 (20:31 +0100)] 
macOS: compiler warnings

Debug traces in vgdb.

9 months agoBug 495470 - s390x: Add s390-opcodes.csv to distribution
Andreas Arnez [Tue, 29 Oct 2024 16:43:15 +0000 (17:43 +0100)] 
Bug 495470 - s390x: Add s390-opcodes.csv to distribution

Include s390-opcodes.csv in the distribution, since it is referenced in
README.s390.

9 months agoBug 493959 - s390x: Fix regtest failure for op00 with /bin/dash
Florian Krohm [Tue, 29 Oct 2024 15:24:31 +0000 (16:24 +0100)] 
Bug 493959 - s390x: Fix regtest failure for op00 with /bin/dash

On different machines /bin/sh may be impersonated by different shells, and
those behave differently as to whether they write "Illegal instruction ..."
to stderr.  While newer versions of bash do not, dash does.

For the op00 test case this means that an additional line may be written
to `op00.stderr.out', depending on which shell is being used.  Hence
adding "Illegal instruction ..." as an expected line to `op00.stderr.exp'
wouldn't work on all systems.

Instead, fix this issue by adding the case of "illegal instruction" to the
general filtering logic in filter_stderr_basic.in, where various other
messages of this kind are already filtered out.

Reviewed-by: Andreas Arnez <arnez@linux.ibm.com>
9 months agomacOS Helgrind: fix wrong wrapper for sem_trywait.
Paul Floyd [Mon, 28 Oct 2024 21:10:30 +0000 (22:10 +0100)] 
macOS Helgrind: fix wrong wrapper for sem_trywait.

9 months agoBug 495469 - aligned_alloc and posix_memalign missing MALLOC_TRACE with returned...
Paul Floyd [Mon, 28 Oct 2024 19:36:17 +0000 (20:36 +0100)] 
Bug 495469 - aligned_alloc and posix_memalign missing MALLOC_TRACE with returned pointer

9 months agoLinux regtest: update arm64 expected with sigaltstack extra details.
Paul Floyd [Mon, 28 Oct 2024 18:56:37 +0000 (19:56 +0100)] 
Linux regtest: update arm64 expected with sigaltstack extra details.

9 months agoSet version to 3.24.0-RC1
Mark Wielaard [Sun, 27 Oct 2024 23:13:19 +0000 (00:13 +0100)] 
Set version to 3.24.0-RC1

Also update vg-lifespan which is used for documentation copyright years.

9 months agoFreeBSD regtest: final part of scalar rationalisation, x86 expected
Paul Floyd [Sun, 27 Oct 2024 21:58:32 +0000 (22:58 +0100)] 
FreeBSD regtest: final part of scalar rationalisation, x86 expected

9 months agoFreeBSD regtest: add fakes for older versions in scalar
Paul Floyd [Sun, 27 Oct 2024 20:54:55 +0000 (21:54 +0100)] 
FreeBSD regtest: add fakes for older versions in scalar

Syscalls added for FreeBSD 15 or thereabouts.

9 months agoFreeBSD regtest: remove scalar for version 15+
Paul Floyd [Sun, 27 Oct 2024 20:21:51 +0000 (21:21 +0100)] 
FreeBSD regtest: remove scalar for version 15+

Now also merged into scalar.c

9 months agoFreeBSD regtest: remove test for version 13+ syscalls
Paul Floyd [Sun, 27 Oct 2024 19:17:03 +0000 (20:17 +0100)] 
FreeBSD regtest: remove test for version 13+ syscalls

Now merged into main scalar.c

9 months agoFreeBSD regtest: add fakes for FreeBSD < 13
Paul Floyd [Sun, 27 Oct 2024 17:59:12 +0000 (18:59 +0100)] 
FreeBSD regtest: add fakes for FreeBSD < 13

Also try again to make mprotect fail. It doesn't fail
with a bogus 'prot' on FreeBSD 12.4.

9 months agoFreeBSD regtest: start removing versioned scalar variants
Paul Floyd [Sun, 27 Oct 2024 17:14:20 +0000 (18:14 +0100)] 
FreeBSD regtest: start removing versioned scalar variants

9 months agoFreeBSD: put back stacktrace hack for syscalls in older versions
Paul Floyd [Sun, 27 Oct 2024 16:48:58 +0000 (17:48 +0100)] 
FreeBSD: put back stacktrace hack for syscalls in older versions

9 months agoFreeBSD regtest: x86 scalar expected
Paul Floyd [Sun, 27 Oct 2024 14:27:38 +0000 (15:27 +0100)] 
FreeBSD regtest: x86 scalar expected

9 months agoFreeBSD regtest: cleanup scalar
Paul Floyd [Sun, 27 Oct 2024 13:22:58 +0000 (14:22 +0100)] 
FreeBSD regtest: cleanup scalar

Make more tests fail. Add a few more tests. Add some asserts
for tests that don't return -1 on failure.

9 months agoFreeBSD x86 scalar: update expected after fix for sigwait
Paul Floyd [Sun, 27 Oct 2024 09:54:23 +0000 (10:54 +0100)] 
FreeBSD x86 scalar: update expected after fix for sigwait

9 months agoFreeBSD sigwait syscall: fixes for unusual return codes
Paul Floyd [Sun, 27 Oct 2024 08:15:31 +0000 (09:15 +0100)] 
FreeBSD sigwait syscall: fixes for unusual return codes

sigwait doesn't follow the usual syscall convention of
returning -1 on error and setting errno. Instead it
returns errno and 0 means success.

Previously the POST was getting called on failure, potentially
resulting in memory getting incorrectly marked as accessible and
initialized.

Also only flag 'may block' if the first sigset argument is
accessible.

9 months agoFreeBSD Helgrind: turn off check for locks held on exit for FreeBSD 14.2
Paul Floyd [Fri, 25 Oct 2024 21:25:26 +0000 (23:25 +0200)] 
FreeBSD Helgrind: turn off check for locks held on exit for FreeBSD 14.2

thread-safe exit included in FreeBSD 14.2-PRERELEASE

9 months agoTypos in comments about syscall stacktraces.
Paul Floyd [Fri, 25 Oct 2024 06:40:26 +0000 (08:40 +0200)] 
Typos in comments about syscall stacktraces.

9 months agoPowerPC, dcbf instruction
Carl Love [Wed, 23 Oct 2024 23:25:23 +0000 (18:25 -0500)] 
PowerPC, dcbf instruction

ISA 2.7 and ISA 3.0 "accepts" L = 0 to 3, ISA 3.1 "accepts: L = 0 to 7.
Removed the L field check so valgrind will match the real hardware.  For
the purposes of Valgrind the dcbf instruction is a NOP anyway so it will
not change the behavior of Valgrind.

9 months agoHelgrind: use static asserts in client requests
Paul Floyd [Tue, 15 Oct 2024 06:23:43 +0000 (08:23 +0200)] 
Helgrind: use static asserts in client requests

Thanks, clangd.

9 months agoBug 494218 - Remove FREEBSD_VERS from configure and build
Paul Floyd [Sun, 6 Oct 2024 19:12:44 +0000 (21:12 +0200)] 
Bug 494218 - Remove FREEBSD_VERS from configure and build

9 months agoBug 445235 - Java/Ada/D demangling is probably broken
Paul Floyd [Sat, 12 Oct 2024 14:03:22 +0000 (16:03 +0200)] 
Bug 445235 - Java/Ada/D demangling is probably broken

Ada demangling is now functional.

There maybe some missing functionality like the _GLOBAL_
mentioned in the bugzilla item.

9 months agoFreeBSD regtest: add missing helgrind expecteds
Paul Floyd [Sat, 12 Oct 2024 11:18:41 +0000 (13:18 +0200)] 
FreeBSD regtest: add missing helgrind expecteds

9 months agoFreeBSD helgrind: temporary (?) fix for Bug 494337
Paul Floyd [Sat, 12 Oct 2024 07:10:21 +0000 (09:10 +0200)] 
FreeBSD helgrind: temporary (?) fix for Bug 494337

FreeBSD 15 has added a pthread lock to exit() to ensure that atexit handling
is thread safe. Unfortunately that lock gets leaked which messes up just about
all of the Helgrind tests.

Supression won't work as the callstack is the same for both genuine leaks
and this deliberate leak.

This change simply turns off the check for FreeBSD >= 15.

I see two possible proper fixes. One would be to allow one lock on exit.
The problem with that is that we will need to tell apart a clean exit
(1 lock allowed) and any kind of abort that doesn't call exit (no locks
allowed). That's going to be tricky as the Helgrind check is done before
we get back to core and know whether it is an abort or a clean exit.

The other thing would be to hack the lock counting. If we can detect that
it's a pthread_mutex_lock called from exit() then we could ignore that for
counting purposes. That would mean a possibly significant overhead for
each call to pthread_mutex_lock on FreeBSD.

9 months agoAdd none/tests/fdbaduse to .gitignore
Paul Floyd [Sat, 12 Oct 2024 06:24:09 +0000 (08:24 +0200)] 
Add none/tests/fdbaduse to .gitignore

9 months agofd regtest: add filter to new fdbaduse testcase
Paul Floyd [Sat, 12 Oct 2024 05:39:00 +0000 (07:39 +0200)] 
fd regtest: add filter to new fdbaduse testcase

9 months agoAdd BadFdExtra core error.
Alexandra Hájková [Tue, 25 Jun 2024 15:27:16 +0000 (11:27 -0400)] 
Add BadFdExtra core error.

Introduce a new FdBadFd type with associated extra info struct.
Which for now just holds the fd number (no path or description).
fd_pp_Error and fd_update_extra have been updated to handle the
new type and produce xml when requested.

Rename showing_core_errors to showing_core_warning
(returns yes when the tools wants to show core errors,
-q isn't given and we aren't producing xml).

In ML_(fd_allowed) we now call VG_(maybe_record_error) to
generate a real error (that can be suppressed and shows up
in the xml output with full execution backtrace). For now
we also produce the legacy warnings when --track-fds=yes
isn't given.

Add none/tests/fdbaduse.vgtest to test the new FdBadUse
core error.

This is the first part of reporting bad fd usage errors.
We are also tracking already closed file descriptors which
should also produce errors like these. The current bad file
descriptors are just those that are negative or above the
current file limit of the process.

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

10 months agoBug 494252 - s390x: Fix disassembly for LOCHI and friends
Florian Krohm [Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)] 
Bug 494252 - s390x: Fix disassembly for LOCHI and friends

The disassembly for LOCHI, LOCGHI, and LOCHHI is bogus.  For instance, the
instruction

    lochi  %r3,7,5

is disassembled as

    lochi  %r5,3,0,.+10

instead of

    lochinhe %r3,7

It seems that s390_format_RIE_RUPIX was copy-pasted from
s390_format_RIS_RUPI without adjusting it appropriately.  Fix this.

Reviewed-by: Andreas Arnez <arnez@linux.ibm.com>
10 months agos390x: Add missing early-clobber to GET_STARTREGS
Andreas Arnez [Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)] 
s390x: Add missing early-clobber to GET_STARTREGS

The inline assembly for GET_STARTREGS in m_libcassert.c writes to its
output before using the input argument.  But since the compiler doesn't
know this, it is allowed to allocate the same register for both, causing
problems.  This has been seen when compiling Valgrind with -O0, after
which memcheck/tests/leak-autofreepool-5 fails due to SIGSEGV.

Fix this by declaring the output as early-clobber, so the compiler knows
about the restriction.

10 months agoBug 493970 - s390x: Drop saving/restoring FPC upon helper call
Andreas Arnez [Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)] 
Bug 493970 - s390x: Drop saving/restoring FPC upon helper call

Saving the FPC before each helper call and restoring it afterwards creates
unnecessary overhead, and it may also not be desirable.

Drop it.  Also remove the functions in host_s390_defs.c responsible for
emitting LFPC and STFPC instructions.  And since this frees up the FPC
save slot on the stack, adjust the stack layout accordingly.

10 months agoFix some issues with GSL for `make auxchecks'
Andreas Arnez [Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)] 
Fix some issues with GSL for `make auxchecks'

When trying to reproduce Bug 423908, I ran into some trouble performing
`make auxchecks', due to problems in GSL:

Newer compilers complain about incompatible pointer types in argument
passing between

  unsigned int *

and

  size_t *

This affects the fifth argument of function gsl_eigen_jacobi() in
eigen/jacobi.c.  Fix this by passing the right pointer type at invocation.

Also, the configure checks for IEEE comparisons and for IEEE denormalized
values don't work as intended, because they call exit() without declaring
it and thus fail independently from those features being supported.  Fix
this by using `return' instead.

10 months agoFreeBSD regtest: one more scalar twiddle
Paul Floyd [Wed, 9 Oct 2024 06:03:36 +0000 (08:03 +0200)] 
FreeBSD regtest: one more scalar twiddle

10 months agoAdd change to sigaltstack error messages to NEWS.
Paul Floyd [Tue, 8 Oct 2024 19:37:10 +0000 (21:37 +0200)] 
Add change to sigaltstack error messages to NEWS.

10 months agoSolaris regtest: update scalar for sigaltstack changes
Paul Floyd [Tue, 8 Oct 2024 14:50:12 +0000 (16:50 +0200)] 
Solaris regtest: update scalar for sigaltstack changes

10 months agomacOS regtest: give up trying to build bug492210.c
Paul Floyd [Tue, 8 Oct 2024 19:03:17 +0000 (21:03 +0200)] 
macOS regtest: give up trying to build bug492210.c

macOS has to make everything difficult. Global names need
to be decorated with an underscore prefix. And you can't
just read from global variables, you have to do something
like a rip-relative lea.

10 months agoLinux regtest: update scalar expected for sigaltstack
Paul Floyd [Tue, 8 Oct 2024 12:09:52 +0000 (14:09 +0200)] 
Linux regtest: update scalar expected for sigaltstack

10 months agoFreeBSD regtest: update x86 scalar expected
Paul Floyd [Tue, 8 Oct 2024 13:52:09 +0000 (15:52 +0200)] 
FreeBSD regtest: update x86 scalar expected

10 months agosigaltstack syscall: improve error messages
Paul Floyd [Tue, 8 Oct 2024 11:19:08 +0000 (13:19 +0200)] 
sigaltstack syscall: improve error messages

Previously the same message was generated for the 3 members of
stack_t.

Also on FreeBSD I get a Conditional jump error with this syscall
but not on all platforms, so I've added a suppression.

10 months agoFreeBSD regtest: fake missing syscalls on arm64 in scalar test
Paul Floyd [Mon, 7 Oct 2024 19:59:58 +0000 (21:59 +0200)] 
FreeBSD regtest: fake missing syscalls on arm64 in scalar test

10 months agoFreeBSD regtest: add FAKE macros for scalar
Paul Floyd [Mon, 7 Oct 2024 05:34:59 +0000 (07:34 +0200)] 
FreeBSD regtest: add FAKE macros for scalar

FreeBSD 15 removed the never-implemented sbrk syscall.
Arm64 also has a few missing syscalls (backward compat ones
that predate the arm64 port). Rather than having an ever
increasing number of expecteds the aim is to use these
FAKE macros. It's a bit fiddly to get the matching text.

10 months agoFreeBSD regtest: auxv test string map has version dependend size
Paul Floyd [Sat, 5 Oct 2024 14:10:02 +0000 (16:10 +0200)] 
FreeBSD regtest: auxv test string map has version dependend size

10 months agoImplement /proc/self/exe readlink[at] fallback in POST handler
Mark Wielaard [Sun, 22 Sep 2024 21:24:34 +0000 (23:24 +0200)] 
Implement /proc/self/exe readlink[at] fallback in POST handler

Calling the readlink[at] syscall directly from the PRE handler defeats
the FUSE_COMPATIBLE_MAY_BLOCK (SfMayBlock) flag. Add a POST handler
that only explicitly calls the readlink[at] handler for the
/proc/self/exe fallback (this should be fine unless /proc is also
implemented as fuse in this process).

Adjust readlink[at] GENX_ and LINX_ syswrap macros to GENXY and LINXY.

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

10 months agoAdd missing FUSE_COMPATIBLE_MAY_BLOCKs
Mark Wielaard [Sat, 21 Sep 2024 20:27:24 +0000 (22:27 +0200)] 
Add missing FUSE_COMPATIBLE_MAY_BLOCKs

Various syscalls (in particular "at" variants) PRE handlers were
missing a FUSE_COMPATIBLE_MAY_BLOCK statement.

Add it to the generic PRE handlers of access and statfs64. And the
linux PRE handlers of mknodat, fchownat, futimesat, utimensat,
utimensat_time64, renameat, renameat2, readlinkat, fchmodat,
fchmodat2, faccessat and faccessat2.

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

10 months agoImplement stable variant of sync_file ioctls
Mark Wielaard [Sat, 31 Aug 2024 17:47:27 +0000 (19:47 +0200)] 
Implement stable variant of sync_file ioctls

We implemented an old staging android variant of the sync_file
ioctls. But the data structures and ioctl numbers changed when these
were upstreamed in the table linux kernel.

This implements the SYNC_IOC_MERGE, SYNC_IOC_FILE_INFO and
SYNC_IOC_SET_DEADLINE ioctls. And makes sure to record the new file
descriptor created by SYNC_IOC_MERGE.

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

10 months agoUpdate README.s390
Andreas Arnez [Tue, 1 Oct 2024 11:20:29 +0000 (13:20 +0200)] 
Update README.s390

The link to the "z/Architecture Principles of Operation" document is out
of date.  Update it.

10 months agos390x: Add bug 440180 to NEWS
Andreas Arnez [Tue, 1 Oct 2024 11:12:44 +0000 (13:12 +0200)] 
s390x: Add bug 440180 to NEWS

As reported in Bug 440180, the s390x disassembler could run into an
assertion failure due to the maximum mnemonic length being exceeded.  This
was fixed with commit 67a2bb759a7c9c76fd6aa142bdb6fe342a5998e2.

10 months agoFreeBSD regtest: remove unneeded expected file
Paul Floyd [Mon, 30 Sep 2024 19:09:15 +0000 (21:09 +0200)] 
FreeBSD regtest: remove unneeded expected file

Previously I had #ifdef'd the freebsd7 compatibility syscalls
in the scalar test for all platforms when adding the arm64
port. They are now back for amd64 and x86 so the previous
expected also covers FreeBSD >= 14.0 and the extra expected
file is now superfluous and removed.

10 months agoFreeBSD syscalls and regtest, cleanup freebsd7 compatible syscalls on arm64
Paul Floyd [Mon, 30 Sep 2024 18:52:58 +0000 (20:52 +0200)] 
FreeBSD syscalls and regtest, cleanup freebsd7 compatible syscalls on arm64

None of the freebsd7 interfaces exist on arm64 as the OS
wasn't ported until well after FreeBSD 7.

10 months agoLinux regtest: fix for memcheck/tests/amd64/bug492210
Paul Floyd [Sun, 29 Sep 2024 18:22:10 +0000 (18:22 +0000)] 
Linux regtest: fix for memcheck/tests/amd64/bug492210

On Arch Linux I get an error concerning the use of PIE and
an uninitialized variable warning. Add the no PIE flag
and also turn off the warning.

10 months agomacOS: fix build after changes for Bug 492663
Paul Floyd [Sun, 29 Sep 2024 18:08:21 +0000 (20:08 +0200)] 
macOS: fix build after changes for Bug 492663

Missed updating the macOS sections.

10 months agoFreeBSD procctl syscall: change arg name in error messages
Paul Floyd [Sun, 29 Sep 2024 08:02:33 +0000 (10:02 +0200)] 
FreeBSD procctl syscall: change arg name in error messages

The man page was inconsistent in the use of 'data' or 'arg'
for the fourth argument. I chose to use 'arg'. The manpage
has now been cleaned up and uses 'data'. So I'm switching to
use the same name.

10 months agoFreeBSD: start reducing uses of FREEBSD_VERS
Paul Floyd [Sun, 29 Sep 2024 07:32:11 +0000 (09:32 +0200)] 
FreeBSD: start reducing uses of FREEBSD_VERS

The goal is to remove version checking from configure.ac,
like Linux. There's a long way to go still.

10 months agoCompiler warning in ML_(check_elf_and_get_rw_loads) again
Paul Floyd [Sat, 28 Sep 2024 06:32:35 +0000 (08:32 +0200)] 
Compiler warning in ML_(check_elf_and_get_rw_loads) again

This fime for p_vaddr

10 months agoCompiler warning in ML_(check_elf_and_get_rw_loads)
Paul Floyd [Sat, 28 Sep 2024 06:20:25 +0000 (08:20 +0200)] 
Compiler warning in ML_(check_elf_and_get_rw_loads)

GCC 12.2 complains that
 previous_rw_a_phdr.p_vaddr + previous_rw_a_phdr.p_filesz
may be using p_filesz uninitialized

That's only possible if ML_(img_get) somehow fails to read all
of a program header such that p_memsz is greater than 0 but
p_filesz remains uninitialized. Hardly likely since p_memsz
comes after p_filesz in the structure.

10 months agoFreeBSD: remove code for FreeBSD 10
Paul Floyd [Fri, 27 Sep 2024 20:18:24 +0000 (22:18 +0200)] 
FreeBSD: remove code for FreeBSD 10

FreeBSD 10 was never really tested - fully working FreeBSD support
arrived around the time of FreeBSD 11.3 and 12.1. FreeBSD had
already been EOL around 2 years by then.

10 months agoFreeBSD regtest: fix "filter_fdleak is missing in dist_noinst_SCRIPTS"
Paul Floyd [Mon, 16 Sep 2024 06:13:15 +0000 (08:13 +0200)] 
FreeBSD regtest: fix "filter_fdleak is missing in dist_noinst_SCRIPTS"

10 months agoComments: update comments added for Bug 492663
Paul Floyd [Mon, 16 Sep 2024 06:07:15 +0000 (08:07 +0200)] 
Comments: update comments added for Bug 492663

10 months agoBug 492210 - False positive on x86/amd64 with ZF taken directly from addition
Paul Floyd [Sun, 15 Sep 2024 07:52:56 +0000 (09:52 +0200)] 
Bug 492210 - False positive on x86/amd64 with ZF taken directly from addition

Also adds similar checks for short and char equivalents to the
original int reproducer.

Initial fix provided by
   Alexander Monakov <amonakov@gmail.com>

Two versions of the testcase, one with default options and one with
-expensive-definedness-checks=yes because the byte operations
subb and addb need the flag turned on explicitly.

10 months agoFreeBSD: add file descriptor tracking for _umtx_op
Paul Floyd [Sat, 14 Sep 2024 18:56:54 +0000 (20:56 +0200)] 
FreeBSD: add file descriptor tracking for _umtx_op

UMTX_OP_SHM with a sub request of UMTX_SHM_CREAT creates
an anonymous shared memory object and returns a file
descriptor. This fd is now tracked when required.

10 months agoFreeBSD 13.4: change conditional compilation for recent syscalls
Paul Floyd [Fri, 13 Sep 2024 07:34:26 +0000 (09:34 +0200)] 
FreeBSD 13.4: change conditional compilation for recent syscalls

10 months agoFreeBSD: initial support for version 13.4
Paul Floyd [Fri, 13 Sep 2024 06:47:23 +0000 (08:47 +0200)] 
FreeBSD: initial support for version 13.4

11 months agos390x: Add MSA support
Andreas Arnez [Tue, 10 Sep 2024 16:38:49 +0000 (18:38 +0200)] 
s390x: Add MSA support

Handle instructions that were added to z/Architecture with the
message-security assist (MSA) facility or with one of its extensions up to
MSA extension 9:

   km -- ``cipher message''
   kmc -- ``cipher message with chaining''
   kimd -- ``compute intermediate message digest''
   klmd -- ``compute last message digest''
   kmac -- ``compute message authentication code''
   kmf -- ``cipher message with cipher feedback''
   kmctr -- ``cipher message with counter''
   kmo -- ``cipher message with output feedback''
   pcc -- ``perform cryptographic computation''
   kma -- ``cipher message with authentication''
   kdsa -- ``compute digital signature authentication''

Each of these instructions has multiple functions.  Support all functions
described by MSA levels up to extension 9.  Handle the instructions as
"extensions" and essentially forward them to the instructions themselves,
as long as they are available on the host.

Note that the MSA-3 instruction

   pkcmo -- ``perform cryptographic key management operation''

will not be handled by this change, since it is privileged and should not
occur in user-space programs.

The MSA facilities are typically used by cryptographic libraries like
OpenSSL or openCryptoki.  So far Valgrind suppresses the facility bits
indicating any MSA support, which causes such libraries to revert to a
software implementation.

This change enables running cryptographic applications under Valgrind
without reverting to an alternate code path.

11 months agoFreeBSD nightly: increase parallel build to 4 jobs
Paul Floyd [Mon, 9 Sep 2024 05:51:51 +0000 (07:51 +0200)] 
FreeBSD nightly: increase parallel build to 4 jobs

16 months agoAdd 492663 to NEWS
Paul Floyd [Sat, 16 Mar 2024 03:51:37 +0000 (04:51 +0100)] 
Add 492663 to NEWS

11 months agoFreeBSD suppression: reachables from libc scanf and srand
Paul Floyd [Sat, 7 Sep 2024 10:02:50 +0000 (12:02 +0200)] 
FreeBSD suppression: reachables from libc scanf and srand

Still no libc freeres on FreeBSD.

11 months agoBug 492663 - Valgrind ignores debug info for some binaries
Paul Floyd [Sat, 7 Sep 2024 07:06:03 +0000 (09:06 +0200)] 
Bug 492663 - Valgrind ignores debug info for some binaries

ML_(check_elf_and_get_rw_loads) now always checks for
merged PT_LOADs when called from valgrind_main when
iterating over nsegments.

Updated comments and changed variable names and the
debug message when the number of expected RW PT_LOADs
hasn't been reached.

11 months agoLinux regtest: add gdbserver filter for debuginfod messages
Paul Floyd [Fri, 6 Sep 2024 19:47:38 +0000 (21:47 +0200)] 
Linux regtest: add gdbserver filter for debuginfod messages

11 months agovalgrind testing: fix vg_regtest individual-test mode
Frank Ch. Eigler [Tue, 3 Sep 2024 17:30:13 +0000 (13:30 -0400)] 
valgrind testing: fix vg_regtest individual-test mode

One of the new log files was created in a way that was
oblivious to the chdir()'s in effect in the perl script.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
11 months agoNEWS: Add 492214 sys_statx: support for statx(fd, NULL, AT_EMPTY_PATH)
Mark Wielaard [Mon, 2 Sep 2024 17:17:05 +0000 (19:17 +0200)] 
NEWS: Add 492214 sys_statx: support for statx(fd, NULL, AT_EMPTY_PATH)

This was resolved in commit de408f75bf28d76a0016325b75f14be45631472a