]> sourceware.org Git - valgrind.git/log
valgrind.git
15 months agos390x regtest: Fix issues with DFP_VAL_PRINT()
Andreas Arnez [Thu, 7 Sep 2023 14:43:24 +0000 (16:43 +0200)]
s390x regtest: Fix issues with DFP_VAL_PRINT()

The DFP_VAL_PRINT macro used by the dfp test cases has some issues:

* It performs illegal pointer type aliasing.

* It suppresses zero digits in 128-bit integers, since it prints their
  second halves with "%08lx" instead of "%016lx".

Fix these.  Due to the latter, this affects the output of all DFP test
cases, so adjust them as well.

15 months agos390x regtest: Reduce pfpo test case output
Andreas Arnez [Thu, 7 Sep 2023 14:43:24 +0000 (16:43 +0200)]
s390x regtest: Reduce pfpo test case output

The `pfpo' test case prints floating-point values with the "%f" and "%Lf"
formats.  Sometimes also "%lf" is used, but that's equivalent to "%f"
since the "l" length modifier doesn't affect floating-point formatting.

These "f"-style formats are not well suited for such a test case:

* They generate excessively long output for numbers with large absolute
  values.  This makes `pfpo.stdout.exp' difficult to handle.

* They can lose precision, in particular for numbers close to zero, where
  they just print zeros.

Use the formats "%a" and "%La" instead and adjust pfpo.stdout.exp
accordingly.

15 months agoSolaris regtest: aligned / sized expecteds and an improved filter
Paul Floyd [Sun, 3 Sep 2023 12:20:42 +0000 (14:20 +0200)]
Solaris regtest: aligned / sized expecteds and an improved filter

A couple of testcases fail due to ever changing output for floating
point infinity.

Add memalign and aligned_alloc expecteds for Solaris 11.3
(which doesn't have aligned_allloc).

15 months agocoverity: various fixes
Paul Floyd [Sun, 3 Sep 2023 06:28:26 +0000 (08:28 +0200)]
coverity: various fixes

Null check, uninitialized variable and several print format uses of size_t.
clang-tidy also complains about most of them.

15 months agoFreeBSD: clarify which package GNU cp is in (needed for nightly tests)
Paul Floyd [Sun, 3 Sep 2023 06:27:19 +0000 (08:27 +0200)]
FreeBSD: clarify which package GNU cp is in (needed for nightly tests)

15 months agocoverity: fix a couple of forward nulls
Paul Floyd [Sat, 2 Sep 2023 21:43:31 +0000 (23:43 +0200)]
coverity: fix a couple of forward nulls

In the new sized/aligned memcheck code.

15 months agocoverity: a few bits of dead code and one vgdb command line leak
Paul Floyd [Sat, 2 Sep 2023 21:19:17 +0000 (23:19 +0200)]
coverity: a few bits of dead code and one vgdb command line leak

15 months agoregtest: silence some more warnings
Paul Floyd [Sat, 2 Sep 2023 15:33:35 +0000 (17:33 +0200)]
regtest: silence some more warnings

A massif test that checks that --ignore-fn
Sadly neither C nor C++ has a standard way of specifying functons
to _never_ inline, and GCC and LLVM seem to have different extensions.
GCC complains about __attribute__((optnone)).

15 months agoregtest: silence a few warnings
Paul Floyd [Sat, 2 Sep 2023 15:12:23 +0000 (17:12 +0200)]
regtest: silence a few warnings

A couple of testcases that use 'new' that will throw an
uncaught exception. The variable doesn't get used, there
is only an assert to check that nothing is reached after the
new expressions.

15 months agoAdd memcheck errors for aligned and sized allocations and deallocations
Paul Floyd [Sun, 12 Mar 2023 07:26:04 +0000 (08:26 +0100)]
Add memcheck errors for aligned and sized allocations and deallocations

Bug 433857 Add validation to C++17 aligned new/delete alignment size
Bug 433859 Add mismatched detection to C++ 17 aligned new/delete
Bug 466105 aligned_alloc problems, part 2
Bug 467441 Add mismatched detection to C++ 14 sized delete

Memcheck now tests and warns about the values used for
alignment and size. These apply to various functions: memalign,
posix_memalign and aligned_alloc in C and various overloads
of operators new and delete in C++. The kinds of error that can
be detected are
- invalid alignment, for instance the alignment is usually required
  to be a power of 2
- mismatched alignment between aligned allocation and aligned
  deallocation
- mismatched size when sized delete is used
- bad size for functions that have implementation defined behaviour
  when the requested size is zero

An example of the new errors is:

int *pi = memalign(31, 100);

which will generate the following error

==96206== Invalid alignment value: 31 (should be power of 2)
==96206==    at 0x485195E: memalign (vg_replace_malloc.c:1886)
==96206==    by 0x20200E: main (memalign.c:59)

15 months agoregtest: make memcheck sem test quiet
Paul Floyd [Sat, 2 Sep 2023 12:08:07 +0000 (14:08 +0200)]
regtest: make memcheck sem test quiet

On Solaris the summary shows 7 allocations causing a diff.

15 months agoSolaris: fix a few compiler warnings
Paul Floyd [Sat, 2 Sep 2023 11:52:12 +0000 (13:52 +0200)]
Solaris: fix a few compiler warnings

15 months agoFreeBSD: Add support for building on FreeBSD 15.0
Paul Floyd [Sat, 2 Sep 2023 13:20:36 +0000 (15:20 +0200)]
FreeBSD: Add support for building on FreeBSD 15.0

15 months agoExplicitly load libc and any sonames that contain mandatory specs
Mark Wielaard [Fri, 1 Sep 2023 17:10:17 +0000 (19:10 +0200)]
Explicitly load libc and any sonames that contain mandatory specs

We really need symtab for glibc and ld.so libraries early for redir.
Some distros move these into separate debuginfo files, which means
we need to fully load them early.

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

15 months agoFix lazy debuginfo loading on ppc64le
Aaron Merey [Wed, 30 Aug 2023 18:49:09 +0000 (14:49 -0400)]
Fix lazy debuginfo loading on ppc64le

Lazy debuginfo loading introduced in commit 60f7e89ba32 assumed that
either describe_IP or find_DiCfSI will be called before stacktrace
printing.  describe_IP and find_DiCfSI cause debuginfo to be lazily
loaded before symtab lookup occurs during stacktraces.

However this assumption does not hold true on ppc64le, resulting
in debuginfo failing to load in time for stacktraces.  Fix this
by loading debuginfo during get_StackTrace_wrk on ppc arches.

15 months agoFix 473944 Handle mold linker split RW PT_LOAD segments correctly
Philippe Waroquiers [Fri, 1 Sep 2023 18:23:46 +0000 (20:23 +0200)]
Fix 473944  Handle mold linker split RW PT_LOAD segments correctly

Condition to consider segments will be merged has to be more specific
than just having a page rounded file offset p_offset.

Regtested on debian, somewhat poorly due to the amount of tests
failing due to:
473745 must-be-redirected function - strlen - for valgrind 3.22 but not 3.21

15 months agoFreeBSD: add common failure causes to README.freebsd
Paul Floyd [Fri, 1 Sep 2023 06:26:24 +0000 (08:26 +0200)]
FreeBSD: add common failure causes to README.freebsd

Also fix the name of one of the fields of vki_kinfo_vmentry.

15 months agoBug 473870 - FreeBSD 14 applications fail early at startup
Paul Floyd [Thu, 31 Aug 2023 13:32:21 +0000 (15:32 +0200)]
Bug 473870 - FreeBSD 14 applications fail early at startup

FreeBSD recently started adding some functions using @gnu_indirect_function,
specifically strpcmp which was causing this crash.

When running and encountering this ifunc Valgrind looked for the
ifunc_handler. But there wasn't one for FreeBSD so Valgrind asserted.

15 months agoFreeBSD: a bit of cleanup of README.freebsd
Paul Floyd [Wed, 30 Aug 2023 06:06:00 +0000 (08:06 +0200)]
FreeBSD: a bit of cleanup of README.freebsd

15 months agoFreeBSD: add memcheck suppression for libc newlocale still reachable memory
Paul Floyd [Tue, 29 Aug 2023 05:55:31 +0000 (07:55 +0200)]
FreeBSD: add memcheck suppression for libc newlocale still reachable memory

16 months agoLinux: remove a couple of cpmpiler warnings
Paul Floyd [Sun, 27 Aug 2023 16:03:07 +0000 (18:03 +0200)]
Linux: remove a couple of cpmpiler warnings

16 months agoFreeBSD: remove testing code
Paul Floyd [Sun, 27 Aug 2023 15:27:57 +0000 (17:27 +0200)]
FreeBSD: remove testing code

16 months agoFreeBSD: add an extra libc filter for _start in massif deep-D test
Paul Floyd [Sun, 27 Aug 2023 16:45:03 +0000 (18:45 +0200)]
FreeBSD: add an extra libc filter for _start in massif deep-D test

16 months agoRemove merge file added by mistake
Paul Floyd [Sun, 27 Aug 2023 16:33:03 +0000 (18:33 +0200)]
Remove merge file added by mistake

16 months agoFreeBSD: Add a new testcase for FreeBSD 14 _umtx_op set timeout
Paul Floyd [Sun, 27 Aug 2023 16:29:30 +0000 (18:29 +0200)]
FreeBSD: Add a new testcase for FreeBSD 14 _umtx_op set timeout

Uses an existing testcase with pthread APIs that use timeouts
and sets LIBPTHREAD_UMTX_MIN_TIMEOUT to 100 (ns, so almost no
effect other than exercising the syscall).

16 months agoFreeBSD: add 2 new _umtx_op op codes for FreeBSD 14
Paul Floyd [Sun, 27 Aug 2023 14:14:00 +0000 (16:14 +0200)]
FreeBSD: add 2 new _umtx_op op codes for FreeBSD 14

16 months agoregtest: fix compiler warnings with clang 16
Paul Floyd [Sun, 27 Aug 2023 14:57:24 +0000 (16:57 +0200)]
regtest: fix compiler warnings with clang 16

Mostly warnings about deprecated use of K&R function definitions.

16 months agoFreeBSD regtest: add suppression to bug392331_supp for FreeBSD 14.0
Paul Floyd [Sun, 27 Aug 2023 14:41:36 +0000 (16:41 +0200)]
FreeBSD regtest: add suppression to bug392331_supp for FreeBSD 14.0

16 months agoAllow spaces in .valgrindrc files
Paul Floyd [Sun, 27 Aug 2023 07:35:03 +0000 (09:35 +0200)]
Allow spaces in .valgrindrc files

The patch for m_commandline.c comes from the Debian package files.
Also add a regtest and allow --command-line-only=no to override
--command-line-only=yes

16 months agoFreeBSD regtest: use a filter to make eventfd2 consistent
Paul Floyd [Sat, 26 Aug 2023 10:57:34 +0000 (12:57 +0200)]
FreeBSD regtest: use a filter to make eventfd2 consistent

16 months agoSolaris: remove cxx17_aligned_new expected
Paul Floyd [Sat, 26 Aug 2023 05:58:10 +0000 (07:58 +0200)]
Solaris: remove cxx17_aligned_new expected

No longer needed after last cleanup

16 months agoFix various clang warnings
Paul Floyd [Fri, 25 Aug 2023 21:00:58 +0000 (23:00 +0200)]
Fix various clang warnings

Mostly missing 'void' in function prototypes.

16 months agoBug 473677 - make check compile failure with Clang 16 based on GCC 13.x
Paul Floyd [Fri, 25 Aug 2023 20:11:27 +0000 (22:11 +0200)]
Bug 473677 - make check compile failure with Clang 16 based on GCC 13.x

16 months agoSolaris: update cxx17_aligned_new expected
Paul Floyd [Thu, 24 Aug 2023 19:38:46 +0000 (21:38 +0200)]
Solaris: update cxx17_aligned_new expected

16 months agoregtest: fix wrong interfaces in calls to operator delete
Paul Floyd [Thu, 24 Aug 2023 19:06:23 +0000 (21:06 +0200)]
regtest: fix wrong interfaces in calls to operator delete

Will update Solaris later

16 months agoFix an error in `docs/README`.
Nicholas Nethercote [Wed, 23 Aug 2023 06:45:23 +0000 (16:45 +1000)]
Fix an error in `docs/README`.

16 months agoUpdate Cachegrind description in the usage message and header comments.
Nicholas Nethercote [Thu, 10 Aug 2023 04:19:36 +0000 (14:19 +1000)]
Update Cachegrind description in the usage message and header comments.

This matches an earlier change to the description in the user manual.

And fix indentation of the license in a couple of files.

16 months agoCorrect an error in Cachegrind's usage message.
Nicholas Nethercote [Wed, 23 Aug 2023 04:20:42 +0000 (14:20 +1000)]
Correct an error in Cachegrind's usage message.

16 months agoBug 473604 - Fix bug472219.c compile failure with Clang 16
Paul Floyd [Tue, 22 Aug 2023 19:35:00 +0000 (21:35 +0200)]
Bug 473604 - Fix bug472219.c compile failure with Clang 16

16 months agoAdd bug 426751 to NEWS
Paul Floyd [Tue, 22 Aug 2023 19:23:00 +0000 (21:23 +0200)]
Add bug 426751 to NEWS

16 months agogdb --multi mode stdout redirecting to stderr
Mark Wielaard [Thu, 17 Aug 2023 13:40:30 +0000 (15:40 +0200)]
gdb --multi mode stdout redirecting to stderr

When in stdio mode (talking to gdb through stdin/stdout, not
through a socket), redirect stdout to stderr and close stdin
for the inferior. That way at least some output can be seen,
but there will be no input.

This is workaround till we have real terminal handling.

     * coregrind/vgdb.c (main): Pass in_port to do_multi_mode.
     (do_multi_mode): Pass in_port to fork_and_exec_valgrind.
     (fork_and_exec_valgrind): Close stdin, redirect stdout to
     stderr if in_port <= 0.

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

16 months agomusl: enable libstdc++ freeres
Paul Floyd [Sun, 20 Aug 2023 13:24:25 +0000 (15:24 +0200)]
musl: enable libstdc++ freeres

Both libc and libstdc++ freeres were disabled for musl.
That means that libstdc++ was showing still reachable
memory on systems like Alpine.

16 months agoFreeBSD: try to make eventfd2 testcase deterministic
Paul Floyd [Sun, 20 Aug 2023 07:04:17 +0000 (09:04 +0200)]
FreeBSD: try to make eventfd2 testcase deterministic

Add a sleep to give child 1 a chance to run.
Flush stdout every time.

16 months agoFreeBSD: complete loading debuginfo if entering capability mode
Paul Floyd [Sun, 20 Aug 2023 06:52:36 +0000 (08:52 +0200)]
FreeBSD: complete loading debuginfo if entering capability mode

16 months agoAlways cleanup on exit from ML_(read_elf_object)
Paul Floyd [Sat, 19 Aug 2023 19:37:33 +0000 (21:37 +0200)]
Always cleanup on exit from ML_(read_elf_object)

I'm still a but baffled as to why this wasn't seen earlier.
A FreeBSD testcase started failing with kernel 13.2 patch 2,
which is quite a minor change. The testcase gets an fd from
pdfork and the parent does a printf with the fd then zaps the
process with pdkill. Standalone the fd is 3, and that's what
the expected contains. However, when it started failing I saw
with lsof that fds 3 and 4 were associated with the guest exe
and ld-elf.so.1.

16 months agoSolaris: explain configure detection of scf repository door version
Paul Floyd [Fri, 18 Aug 2023 06:12:53 +0000 (08:12 +0200)]
Solaris: explain configure detection of scf repository door version

16 months agoBug 472963 - Broken regular expression in configure.ac
Paul Floyd [Thu, 17 Aug 2023 20:05:47 +0000 (22:05 +0200)]
Bug 472963 - Broken regular expression in configure.ac

Was extracting the last two decimal digits from a hex humber.

I switched to using grep and sed because the proposed solution
didn't work on Solaris 11.3.

16 months agoSupport lazy reading and downloading of DWARF debuginfo
Aaron Merey [Fri, 30 Jun 2023 22:31:42 +0000 (18:31 -0400)]
Support lazy reading and downloading of DWARF debuginfo

Currently valgrind attempts to read DWARF .debug_* sections as well
as separate debuginfo files for ELF binaries as soon as a shared library
is loaded.  This might also result in the downloading of separate debuginfo
files via debuginfod.

This is inefficient when some of this debuginfo never ends up being used
by valgrind while running the client process.

This patch adds support for lazy reading and downloading of DWARF
debuginfo.  When an ELF shared library is loaded, the reading of .debug_*
sections as well as separate or alternate debuginfo is deferred until
valgrind handles an instruction pointer corresponding to a text segment
of the shared library.  At this point the deferred sections and separate
debug files are loaded.

This feature is only supported on ELF platforms.

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

ChangeLog
* debuginfo.c (di_notify_ACHIEVE_ACCEPT_STATE): Replace
read_elf_debug_info with read_elf_object.
(addr_load_di): New function.  Attempts to load deferred debuginfo
associated with a given address.
(load_di): New function.  Attempts to load a given deferred
debuginfo associated with a given address.
(describe_IP): Add calls to load_di and addr_load_di.
(find_DiCfSI): Add call to load_di.

* priv_readelf.h (read_elf_object): New declaration.
(read_elf_debug): Ditto.

* priv_storage.h (struct _DebugInfo): New field 'bool deferred'.

* readelf.c (read_elf_debug_info): Split into read_elf_object and
read_elf_debug.
(read_elf_object): Read non .debug_* section from an ELF binary.
(read_elf_debug): Read .debug_* sections from an ELF binary as
as well any separate/alternate debuginfo files.

* storage.c (canonicaliseSymtab): Remove assert in order to support
canonicalization of deferred _DebugInfo.
(finish_CFSI_arrays): Add early return if _DebugInfo is
deferred in order to avoid freeing memory that will be needed
when reading debuginfo at a later time.
(canonicaliseTables): Ditto.

* pub_core_debuginfo.h (addr_load_di): New declaration.
(load_di): New declaration.

17 months agoBug 472219 - Syscall param ppoll(ufds.events) points to uninitialised byte(s)
Paul Floyd [Mon, 24 Jul 2023 20:06:00 +0000 (22:06 +0200)]
Bug 472219 - Syscall param ppoll(ufds.events) points to uninitialised byte(s)

Add checks that (p)poll fd is not negative. If it is negative, don't check
the events field.

17 months agoSolaris: add a configure test for getaddrinfo
Paul Floyd [Mon, 24 Jul 2023 19:32:45 +0000 (21:32 +0200)]
Solaris: add a configure test for getaddrinfo

Not available on Solaris 11.3

17 months agoFreeBSD: Add a DRD supppression for getaddrinfo
Paul Floyd [Sun, 23 Jul 2023 17:22:51 +0000 (19:22 +0200)]
FreeBSD: Add a DRD supppression for getaddrinfo

On FreeBSD 13.2 x86

17 months agoBug 470132 - s390x: Increase test coverage for VGM
Andreas Arnez [Mon, 22 May 2023 17:49:08 +0000 (19:49 +0200)]
Bug 470132 - s390x: Increase test coverage for VGM

Add more tests for the VGM instruction, to verify the fix for the VGM
wrap-around case.  Also test setting unused bits in the I2 and I3 fields,
to check that Valgrind ignores them as it should.

17 months agoBug 470132 - s390x: Fix the wrap-around case in VGM
Andreas Arnez [Mon, 22 May 2023 16:57:35 +0000 (18:57 +0200)]
Bug 470132 - s390x: Fix the wrap-around case in VGM

Valgrind's implementation of VGM is incomplete:

* It doesn't support generating a wrap-around bit mask.  Such a mask
  should result when the ending bit position is smaller than the starting
  bit position.  Valgrind runs into an assertion failure instead.

* It doesn't ignore unused bits in the I2 and I3 fields of the
  instruction, as it should.

Fix this by re-implementing the main logic in s390_irgen_VGM().

17 months agoFreeBSD: add default to configure.ac FreeBSD 13 versions
Paul Floyd [Sun, 2 Jul 2023 10:59:40 +0000 (12:59 +0200)]
FreeBSD: add default to configure.ac FreeBSD 13 versions

Also add comment to README.freebsd about ensuring that
jails set "uname -r" to be something compatible with the
normal RELEASE/STABLE/CURRENT releases.

18 months agoBug 470978 - s390x: Link the tools with -Wl,--s390-pgste
Andreas Arnez [Thu, 15 Jun 2023 15:24:53 +0000 (17:24 +0200)]
Bug 470978 - s390x: Link the tools with -Wl,--s390-pgste

Programs that require the PGSTE mode to be enabled may currently fail
under Valgrind.  In particular this affects qemu-kvm.

While it is also possible to enable the PGSTE mode globally with

  sysctl vm.allocate_psgte=1

the problem can more easily be prevented by linking the Valgrind tools
with -Wl,--s390-pgste.  Add a configure check if the linker supports this,
and activate the flag if it does.

To verify the intended result, the following shell command can be used to
list the executables having this flag set:

  find . -type f -perm -u+x -execdir \
       /bin/sh -c 'readelf -lW $0 2>/dev/null | grep PGSTE' {} \; -print

18 months agoDon't print action vgdb me ... and continuing ... in vgdb --multi mode
Mark Wielaard [Fri, 9 Jun 2023 13:21:57 +0000 (15:21 +0200)]
Don't print action vgdb me ... and continuing ... in vgdb --multi mode

Guard each (action) vgdb me ... VG_(umsg) printing with
  !(VG_(clo_launched_with_multi))

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

18 months agos390x: Replace absolute jump for a relative one
Tulio Magno Quites Machado Filho [Wed, 14 Jun 2023 14:28:38 +0000 (11:28 -0300)]
s390x: Replace absolute jump for a relative one

The bne instruction expects an absolute target address and it isn't
best-suited for implementing a short range jump, such as the one in
XCHG_M_R().
Replace it with jne which expects a relative address that can be
correctly computed a link time.

Interestingly, the jump is almost never taken. If it would, this would
crash the test.  However, linkers may complain when relacating the
target address used in bne.

18 months ago470121 - Can't run callgrind_control with valgrind 3.21.0 because of perl errors
Paul Floyd [Fri, 9 Jun 2023 11:17:58 +0000 (13:17 +0200)]
470121 - Can't run callgrind_control with valgrind 3.21.0 because of perl errors

18 months agoMerge error, missing continuation in Makefile.am
Paul Floyd [Wed, 7 Jun 2023 20:54:22 +0000 (22:54 +0200)]
Merge error, missing continuation in Makefile.am

18 months agoBug 470713 - Failure on the Yosys project: valgrind: m_libcfile.c:1802 (Bool vgPlain...
Paul Floyd [Wed, 7 Jun 2023 20:27:08 +0000 (22:27 +0200)]
Bug 470713 -  Failure on the Yosys project: valgrind: m_libcfile.c:1802 (Bool vgPlain_realpath(const HChar *, HChar *)): Assertion 'resolved' failed

    When using sysctl kern proc pathname with the pid of the guest or -1
    we need to intercept the call otherwise the syscall will return the path
    of the memcheck tool and not the path of the guest.

    This uses VG_(realpath), which asserts if it doesn't get valid
    input pointers.

    sysctl kern proc pathname can use a NULL pointer in order to
    determine the length of the path (so users can allocate the minumum
    necessary). The NULL pointer was being passed on to VG_(realpath)
    without being checked, resulting in an assert.

18 months agomemcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)
Mark Wielaard [Thu, 1 Jun 2023 14:10:56 +0000 (16:10 +0200)]
memcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)

When an realloc size zero error is emitted MC_(eq_Error) is called to
see if the errors can be deduplicated. This crashed since
Err_ReallocSizeZero wasn't handled. Handle it like Err_Free.

Also add a testcase for this case and test with both
--realloc-zero-bytes-frees=yes and
--realloc-zero-bytes-frees=no.
Which will report a different number of errors.

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

19 months agoAdd --with-gdbscripts-dir=PATH configure option
Mark Wielaard [Sun, 14 May 2023 21:34:05 +0000 (23:34 +0200)]
Add --with-gdbscripts-dir=PATH configure option

Currently the gdb valgrind scripts are installed under VG_LIBDIR
which is normally pkglibexecdir which is likely not in the default
gdb safe-path (a list of directories from which it is safe to
auto-load files). So users will have to add the directory to their
.gdbinit file.

This patch adds a --with-gdbscripts-dir=PATH configure option that
sets VG_GDBSCRIPTS_DIR to the given PATH (${libexecdir}/valgrind if
not given). A user can also configure --without-gdbscripts-dir to
disable adding a .debug_gdb_scripts section to the vgpreload library
and installing the valgrind-monitor python scripts completely.

Use VG_GDBSCRIPTS_DIR as gdbscriptsdir to install the valgrind-monitor
python files and pass it with CPPFLAGS when building vg_preloaded.c
and vgdb.c to use instead of VG_LIBDIR.

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

19 months agoAdd epoll_pwait2
Olli Vanhoja [Mon, 10 Oct 2022 09:44:22 +0000 (11:44 +0200)]
Add epoll_pwait2

The only difference between epoll_pwait and epoll_pwait2 is the
timeout argument. For epoll_pwait2 this is a timespec (which is
always 64bit).

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

19 months agoTypo in massif tests Makefile.am
Paul Floyd [Wed, 17 May 2023 06:09:39 +0000 (08:09 +0200)]
Typo in massif tests Makefile.am

19 months agoLinux regtest: fixes for building on musl x86
Paul Floyd [Tue, 16 May 2023 06:20:59 +0000 (08:20 +0200)]
Linux regtest: fixes for building on musl x86

19 months agoDRD: Make libgomp suppression work for any destdir
Paul Floyd [Sat, 13 May 2023 18:44:46 +0000 (20:44 +0200)]
DRD: Make libgomp suppression work for any destdir

19 months agos390x: XC instruction: clear in 8-byte increments if possible
Andreas Arnez [Thu, 26 Jan 2023 16:41:18 +0000 (17:41 +0100)]
s390x: XC instruction: clear in 8-byte increments if possible

The XC instruction is frequently executed in many programs, mainly for
clearing memory.  It can target from 1 to 256 bytes.  If the size is
constant and XC is actually used for clearing memory, Valgrind implements
it as a byte-wise loop and rolls out the loop for <= 8 bytes.

Instead of clearing byte-wise, it is more efficient to clear in 64-bit
increments, so do this for sizes >= 8 bytes.  Roll out the loop for up to
32 bytes.  Overall, this reduces the number of insns by a few percent and
provides a slight performance improvement for some programs.

19 months agos390x: Optimize CLC for 1, 2, 4, and 8 bytes
Andreas Arnez [Fri, 5 May 2023 15:48:31 +0000 (17:48 +0200)]
s390x: Optimize CLC for 1, 2, 4, and 8 bytes

The CLC instruction compares two memory areas with sizes from 1 up to 256
bytes.  Currently Valgrind always implements it with a bytewise loop.

Add special handling for the sizes 1, 2, 4, and 8.  Realize CLC with an
8-, 16-, 32-, and 64-bit integer comparison, respectively, in those cases.
Apart from a slight optimization this also improves the diagnostics for
uninitialized values since it avoids the manufactured conditional jump
that breaks out of the loop over the individual bytes.

19 months agos390x: Update information in README.s390
Andreas Arnez [Tue, 24 Jan 2023 15:11:12 +0000 (16:11 +0100)]
s390x: Update information in README.s390

Refresh some of the information in README.s390:

* update links to Principles of Operation and Reference Summary

* no longer recommend compiling with '-fno-builtin', since there are no
  known false positives due to builtin string operations anymore

* don't mention callgrind as being unsupported, since there are no known
  issues with it

19 months agoBug 465782 - s390x: Avoid __builtin_setjmp
Andreas Arnez [Wed, 15 Feb 2023 17:02:37 +0000 (18:02 +0100)]
Bug 465782 - s390x: Avoid __builtin_setjmp

Currently Clang doesn't support __builtin_setjmp() on s390x.  Since
Valgrind already has an alternate implementation of setjmp/longjmp for
many other platforms, just add one for s390x as well, to get rid of this
dependency.

19 months agoBug 465782 - s390x: Adjust inline assemblies for Clang
Andreas Arnez [Tue, 14 Feb 2023 14:35:48 +0000 (15:35 +0100)]
Bug 465782 - s390x: Adjust inline assemblies for Clang

Some s390x inline assemblies are written in such a way that they are
understood by GCC but not by Clang:

* use of "f" constraint for unsigned long variable

* use of "b" modifier when passing a constant

* use of the register notation "r11" in ".cfi_def_cfa"

Adjust the affected inline assemblies to avoid these constructs.

19 months agoBug 465782 - s390x: Drop -mzarch -march=z900 from assembler options
Andreas Arnez [Thu, 1 Sep 2022 13:03:01 +0000 (15:03 +0200)]
Bug 465782 - s390x: Drop -mzarch -march=z900 from assembler options

The -mzarch flag is unsupported by Clang, and it is redundant on 64-bit
build systems.  Remove it.

Also remove '-march=z900', since it is unsupported by Clang as well.  It
would only be needed on build systems with a default architecture lower
than z900.  Such systems are out of service for some time now.

19 months agomusl: another fix for building testcases
Paul Floyd [Tue, 9 May 2023 20:13:28 +0000 (22:13 +0200)]
musl: another fix for building testcases

19 months agoUpdate libiberty demangler
Mark Wielaard [Tue, 9 May 2023 11:15:26 +0000 (13:15 +0200)]
Update libiberty demangler

Update the libiberty demangler using the auxprogs/update-demangler
script to gcc git commit 1719fa40c4ee4def60a2ce2f27e17f8168cf28ba.

This update includes:

- Update copyright years.
- ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): Add __.
- demangler: Templated lambda demangling
- cp-demangle.h (D_BUILTIN_TYPE_COUNT): Increment.
- cp-demangle.c (cplus_demangle_builtin_types): Add std::bfloat16_t
  entry.
- cp-demangle.c (cplus_demangle_type): Demangle DF16b.
- libiberty: Demangling 'M' prefixes
- libiberty: Demangle variadic template lambdas
- demangle.h (enum demangle_component_type): Add
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
- demangle.h (struct demangle_component): Add u.s_extended_builtin
  member.
- cp-demangle.c (d_dump): Handle
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
  DEMANGLE_COMPONENT_FIXED_TYPE.
- cp-demangle.c (d_make_extended_builtin_type): New function.
- cp-demangle.c (cplus_demangle_builtin_types): Add _Float entry.
- cp-demangle.c(cplus_demangle_type): For DF demangle it as _Float<N>
  or _Float<N>x rather than fixed point which conflicts with it.
- cp-demangle.c (d_count_templates_scopes): Handle
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
  DEMANGLE_COMPONENT_FIXED_TYPE.
- cp-demangle.c (d_find_pack): Handle
  DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
  Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
- cp-demangle.c (d_print_comp_inner): Likewise.
- cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
- rust-demangle.c (demangle_const): Add a missing goto pass_return
  at the end of the function.
- rust-demangle.c (demangle_path_maybe_open_generics): Add
  recursion limit.
- rust-demangle.c (demangle_const): Add recursion limit.
- libiberty: remove FINAL and OVERRIDE from ansidecl.h
- demangler: C++ modules support
- demangler: Reorganize for module demangling
- demangler: Structured Bindings
- Remove non-ANSI C macros in ansidecl.h.
- Remove non-ANSI C path in ansidecl.h.

19 months agoFreeBSD: update auxv test for x86
Paul Floyd [Tue, 9 May 2023 06:42:07 +0000 (08:42 +0200)]
FreeBSD: update auxv test for x86

19 months agoFreeBSD: add Helgrind suppression for getaddrinfo
Paul Floyd [Mon, 8 May 2023 20:27:40 +0000 (22:27 +0200)]
FreeBSD: add Helgrind suppression for getaddrinfo

Testcase was failing on x86

19 months agoregtest: remove FreeBSD version of expected for memcheck memalign_test
Paul Floyd [Sun, 7 May 2023 19:42:21 +0000 (21:42 +0200)]
regtest: remove FreeBSD version of expected for memcheck memalign_test

During recent aligned allocations cleanup, the output became more
consistend and this is no longer needed.

19 months agoregtest: Deactivate tall call optimization in Massif bug469146
Paul Floyd [Sun, 7 May 2023 10:02:54 +0000 (12:02 +0200)]
regtest: Deactivate tall call optimization in Massif bug469146

This optimization truncates the callstack causing fails on some platforms

19 months agoHelgrind Linux: make nss gethostbyname4 suppression cover all variants
Paul Floyd [Sun, 7 May 2023 10:01:06 +0000 (12:01 +0200)]
Helgrind Linux: make nss gethostbyname4 suppression cover all variants

19 months agoLinux Helgrind: broaden _nss_dns_gethostbyname4_r to also cover _nss_files_gethostbyn...
Paul Floyd [Sun, 7 May 2023 08:11:08 +0000 (10:11 +0200)]
Linux Helgrind: broaden _nss_dns_gethostbyname4_r to also cover _nss_files_gethostbyname4_r

19 months agoLinux Helgrind: add another suppression for intermittent failure in dl lookup
Paul Floyd [Sun, 7 May 2023 08:00:48 +0000 (10:00 +0200)]
Linux Helgrind: add another suppression for intermittent failure in dl lookup

19 months agoLinux Helgrind: add suppression for intermittent failure in getaddrinfo regtest
Paul Floyd [Sun, 7 May 2023 07:54:50 +0000 (09:54 +0200)]
Linux Helgrind: add suppression for intermittent failure in getaddrinfo regtest

Causes intermittent failure on gcc110 ppc

19 months agoFreeBSD regtest: add small hack to mcclean_after_fork gdb script
Paul Floyd [Sat, 6 May 2023 11:30:44 +0000 (13:30 +0200)]
FreeBSD regtest: add small hack to mcclean_after_fork gdb script

As far as I can tell this was a regression in FreeBSD gdb around
Aug 2022 when the default install upgraded from 11.2 to 12.1

19 months agoBug 469049 - link failure on ppc64 (big endian) valgrind 3.20
Paul Floyd [Sat, 6 May 2023 05:54:45 +0000 (07:54 +0200)]
Bug 469049 - link failure on ppc64 (big endian) valgrind 3.20

19 months agoBug 469146 - massif --ignore-fn does not ignore inlined functions
Paul Floyd [Sat, 6 May 2023 05:45:47 +0000 (07:45 +0200)]
Bug 469146 - massif --ignore-fn does not ignore inlined functions

19 months agoFreeBSD: deactivate helgrind/tests/tls_threads
Paul Floyd [Sat, 6 May 2023 05:28:51 +0000 (07:28 +0200)]
FreeBSD: deactivate helgrind/tests/tls_threads

No libc tunable, and I haven't seen any way to hack the libc
internals via debuginfo as was previously done on Linux.

19 months agoAdd Helgrind and DRD tests and suppressions for getaddrinfo on Linux
Paul Floyd [Fri, 5 May 2023 20:05:36 +0000 (22:05 +0200)]
Add Helgrind and DRD tests and suppressions for getaddrinfo on Linux

Bump version to 3.22.0.GIT

The testcase was posted on the freebsd-hackers mailing list.
I had time to get suppressions for FreeBSD into 3.21 but
ran out of time for the test and Linux suppressions.

I did take a look at how thread sanitizer handles this.
Basically it intercepts the call, turns off checking,
calls the resl function then turns checking back on.

I don't see many other similar examples. Might be worth
looking at dlopen and atexit.

19 months ago-> 3.21.0 final VALGRIND_3_21_0
Mark Wielaard [Fri, 28 Apr 2023 15:30:04 +0000 (17:30 +0200)]
-> 3.21.0 final

19 months agoAdd bug 469049 (--enable-lto=yes) to known issues
Mark Wielaard [Fri, 28 Apr 2023 15:27:35 +0000 (17:27 +0200)]
Add bug 469049 (--enable-lto=yes) to known issues

19 months agoSupport SCV_FLAG also on VGP_ppc64be_linux
Mark Wielaard [Fri, 28 Apr 2023 11:34:48 +0000 (13:34 +0200)]
Support SCV_FLAG also on VGP_ppc64be_linux

Running on a kernel that supports the SCV instruction (sets
PPC_FEATURE2_SCV in auxv AT_HWCAPS2) valgrind will assert: valgrind:
m_syswrap/syswrap-main.c:549 (getSyscallArgsFromGuestState): Assertion
'gst->guest_syscall_flag == SC_FLAG' failed.

Removing that assert makes most things work. But also filter out
PPC_FEATURE2_SCV from AT_HWCAPS2 for the client, so it shouldn't try
using the SCV instruction.

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

20 months agoOnly do git configuration if in a git repo.
Nicholas Nethercote [Fri, 28 Apr 2023 00:28:30 +0000 (10:28 +1000)]
Only do git configuration if in a git repo.

20 months agodhat: remove initial count value from access count histogram user requests
Paul Floyd [Thu, 27 Apr 2023 07:19:46 +0000 (09:19 +0200)]
dhat: remove initial count value from access count histogram user requests

Based on feedback from Nick Nethercote.

20 months agoFreeBSD: add libc suppressions for Helgrind and DRD
Paul Floyd [Wed, 26 Apr 2023 20:17:16 +0000 (22:17 +0200)]
FreeBSD: add libc suppressions for Helgrind and DRD

20 months agovgdb: Use --wait argument in multi mode
Alexandra Hájková [Tue, 25 Apr 2023 15:28:52 +0000 (17:28 +0200)]
vgdb: Use --wait argument in multi mode

when waiting for valgrind to start.

20 months agoFix typos in NEWS and valgrind-monitor-def.py
Mark Wielaard [Wed, 26 Apr 2023 19:31:13 +0000 (21:31 +0200)]
Fix typos in NEWS and valgrind-monitor-def.py

NEWS: who_point_at -> who_points_at
valgrind-monitor-def.py: MEN -> LEN

20 months agoClarify try push instructions.
Nicholas Nethercote [Wed, 26 Apr 2023 07:00:32 +0000 (17:00 +1000)]
Clarify try push instructions.

20 months agoAdd a .git-blame-ignore-revs file.
Nicholas Nethercote [Wed, 26 Apr 2023 06:11:26 +0000 (16:11 +1000)]
Add a .git-blame-ignore-revs file.

This prevents large-scale changes (e.g. auto-formatting) from negatively
affecting `git blame`.

20 months agoAdd new DHAT userreqs to NEWS
Paul Floyd [Tue, 25 Apr 2023 05:36:10 +0000 (07:36 +0200)]
Add new DHAT userreqs to NEWS

20 months agoFix spelling in NEWS
Paul Floyd [Mon, 24 Apr 2023 18:56:16 +0000 (20:56 +0200)]
Fix spelling in NEWS

20 months agoAdd memfd_create.stderr.exp-fcntl64 to EXTRA_DIST
Paul Floyd [Mon, 24 Apr 2023 18:53:13 +0000 (20:53 +0200)]
Add memfd_create.stderr.exp-fcntl64 to EXTRA_DIST

This page took 0.069484 seconds and 5 git commands to generate.