]> sourceware.org Git - valgrind.git/log
valgrind.git
13 months agoBug 401284 - False positive "Source and destination overlap in strncat"
Paul Floyd [Thu, 9 Nov 2023 21:19:43 +0000 (22:19 +0100)]
Bug 401284 - False positive "Source and destination overlap in strncat"

Need to also look at strlcat and plain strcat.

13 months agoregtest: add a deliberately false address to drd and helgrind getaddrinfo
Paul Floyd [Thu, 9 Nov 2023 19:43:55 +0000 (20:43 +0100)]
regtest: add a deliberately false address to drd and helgrind getaddrinfo

Make sure that at least one call fails.

13 months agolinux regtest: reallocarray was only added in glibc 2.29
Paul Floyd [Thu, 9 Nov 2023 19:16:10 +0000 (20:16 +0100)]
linux regtest: reallocarray was only added in glibc 2.29

Add a feature check

13 months agoBug 475498 - Add reallocarray wrapper
Paul Floyd [Thu, 9 Nov 2023 06:58:02 +0000 (07:58 +0100)]
Bug 475498 - Add reallocarray wrapper

13 months agomassif regtest: add an existence check to overloaded-new
Paul Floyd [Mon, 6 Nov 2023 07:10:27 +0000 (08:10 +0100)]
massif regtest: add an existence check to overloaded-new

For old old compilers that don't have aligned new

13 months agomassif regtest: add 'pool' to ignore functions for Arch Linux
Paul Floyd [Sun, 5 Nov 2023 13:00:51 +0000 (13:00 +0000)]
massif regtest: add 'pool' to ignore functions for Arch Linux

13 months agomassif regtest: typo in Makefile.am
Paul Floyd [Sun, 5 Nov 2023 12:45:59 +0000 (13:45 +0100)]
massif regtest: typo in Makefile.am

13 months agoBug 476535 - Difference in allocation size for massif/tests/overloaded-new between...
Paul Floyd [Sun, 5 Nov 2023 12:35:01 +0000 (13:35 +0100)]
Bug 476535 - Difference in allocation size for massif/tests/overloaded-new between clang++/libc++ and g++/libstdc++

In the end all I could do was filter the results.

libc++ and libstdc++ allocate different sizes of stuff for their own usr.
That means that when we get to allocating aligned blocks there is some
slop (up to the alignment size) that gets counted. And the amount of
that slop depends on the prior (internal) allocations.

13 months agomassif regtest: stray space in expected
Paul Floyd [Sun, 5 Nov 2023 10:03:16 +0000 (11:03 +0100)]
massif regtest: stray space in expected

13 months agomassif regtest: make verbose tests work on both 32bit and 64bit
Paul Floyd [Sun, 5 Nov 2023 09:59:43 +0000 (10:59 +0100)]
massif regtest: make verbose tests work on both 32bit and 64bit

Now alloc fns only have the appropriate new overloads which
means 32bit has unsigned size but 64bit has unsigned long.
Filter the unsigned long to unsigned.

13 months agomassif regtest: update aloc fns in verbose expecteds
Paul Floyd [Sun, 5 Nov 2023 09:25:09 +0000 (10:25 +0100)]
massif regtest: update aloc fns in verbose expecteds

13 months agomassif regtest: try adding a new expected for overloaded-new
Paul Floyd [Sun, 5 Nov 2023 09:06:56 +0000 (09:06 +0000)]
massif regtest: try adding a new expected for overloaded-new

Added a filter for "pool" that's used on Arch Linux
I'm not too confident that the new expected will work for
all architectures or even versions of libstdc++

13 months agomassif: clean up alloc functions
Paul Floyd [Sun, 5 Nov 2023 08:30:18 +0000 (09:30 +0100)]
massif: clean up alloc functions

Missed out aligned_alloc
Left in the alignment argument name and didn't use east const for
nothrow.

13 months agomassif regtest: keep churning with overloaded-new test
Paul Floyd [Sat, 4 Nov 2023 15:35:05 +0000 (16:35 +0100)]
massif regtest: keep churning with overloaded-new test

Solaris 11.3 doesn't have aligned_alloc so remove it.

In any case I think it's better to use dummy allocators since
that means there is no risk of accidentally falling through
to malloc/free.

13 months agomassif regtest: use the correct aligned delete overloads
Paul Floyd [Sat, 4 Nov 2023 07:26:57 +0000 (08:26 +0100)]
massif regtest: use the correct aligned delete overloads

Still trying to see why libstdc++ and libc++ allocate different amounts

13 months agomassif regtest: remove overloaded-new.post.exp-freebsd
Paul Floyd [Fri, 3 Nov 2023 21:41:03 +0000 (22:41 +0100)]
massif regtest: remove overloaded-new.post.exp-freebsd

There was a duplicate at the end of the list

13 months agomassif regtest: fix building aligned new overloads with pre-C++17 compilers
Paul Floyd [Fri, 3 Nov 2023 21:23:26 +0000 (22:23 +0100)]
massif regtest: fix building aligned new overloads with pre-C++17 compilers

13 months agoFreeBSD: remove some massif regtest expecteds
Paul Floyd [Fri, 3 Nov 2023 20:46:13 +0000 (21:46 +0100)]
FreeBSD: remove some massif regtest expecteds

These were added mainly to have a cleanish slate with GCC on FreeBSD.
Unfortunately FreeBSD doesn't have dependent packages, so no debuginfo
for libstdc++ and the GCC port libstdc++ is stripped. That means that
the filters for internal GCC allocations don't work.

Since I hardly use GCC any more I'm getting rid of these expecteds.

13 months agomassif: add C++ aligned operator new to allocator functions
Paul Floyd [Fri, 3 Nov 2023 20:40:22 +0000 (21:40 +0100)]
massif: add C++ aligned operator new to allocator functions

Also make the unsigned (32bit) and unsigned long (64bit) for size_t
conditional on the wordsize.

13 months agoDo not run memcheck/tests/x86-linux/scalar when root
Mark Wielaard [Thu, 2 Nov 2023 18:50:07 +0000 (19:50 +0100)]
Do not run memcheck/tests/x86-linux/scalar when root

The test expects some syscalls to fail, but when run as root
the user actually has permission to do silly things. So skip
the test if we notice we are root.

13 months agoNon-FreeBSD regtest: fix build of memcheck/tests/x86/pcmpgt
Paul Floyd [Wed, 1 Nov 2023 19:20:38 +0000 (19:20 +0000)]
Non-FreeBSD regtest: fix build of memcheck/tests/x86/pcmpgt

As suggested by Mark Wielaard. It looks like AM conditionals
behave as though they have an implicit, empty, else.

13 months agoBug 476320 - Build failure with GCC
Paul Floyd [Wed, 1 Nov 2023 09:59:08 +0000 (10:59 +0100)]
Bug 476320 - Build failure with GCC

A few fixes for building regression tests with GCC on FreeBSD.

13 months agoUpdate version to 3.23.0.GIT, split NEWS files and create NEWS.older
Paul Floyd [Wed, 1 Nov 2023 09:56:39 +0000 (10:56 +0100)]
Update version to 3.23.0.GIT, split NEWS files and create NEWS.older

13 months ago-> 3.22.0 final VALGRIND_3_22_0
Mark Wielaard [Tue, 31 Oct 2023 17:19:05 +0000 (18:19 +0100)]
-> 3.22.0 final

13 months agoregtest: run memcheck overlap test on non-linux amd64 platforms
Paul Floyd [Tue, 31 Oct 2023 08:00:19 +0000 (09:00 +0100)]
regtest: run memcheck overlap test on non-linux amd64 platforms

13 months agoDisable memcpy overlap check and test on amd64 linux
Mark Wielaard [Mon, 30 Oct 2023 22:30:06 +0000 (23:30 +0100)]
Disable memcpy overlap check and test on amd64 linux

Almost all newer distros have ifunc based memcpy/memmove glibc
implementation which cause false positives. Disable the overlap check
and test on these systems for now.

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

13 months agoClear vbits after the test is done.
Eyal Soha [Mon, 30 Oct 2023 16:46:38 +0000 (10:46 -0600)]
Clear vbits after the test is done.

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

13 months agobug340392 doesn't work on power because of bug352364
Mark Wielaard [Mon, 30 Oct 2023 20:41:57 +0000 (21:41 +0100)]
bug340392 doesn't work on power because of bug352364

Add a prereq to bug340392.vgtest to skip on Power for now.

13 months agoSet version to 3.22.0-RC2
Mark Wielaard [Thu, 26 Oct 2023 12:33:16 +0000 (14:33 +0200)]
Set version to 3.22.0-RC2

13 months agos390x regtest: Activate 128 bit SIMD tests for s390x in vbit-test
Andreas Arnez [Thu, 26 Oct 2023 12:00:52 +0000 (14:00 +0200)]
s390x regtest: Activate 128 bit SIMD tests for s390x in vbit-test

The vbit-test test case is currently configured to exclude s390x from the
platforms that execute the 128 bit SIMD irop tests.  Since there's no
known issue with those, they can be activated on s390x as well.

13 months agoAdd new exp files to EXTRA_DIST in memcheck/tests/Makefile.am
Mark Wielaard [Thu, 26 Oct 2023 11:40:59 +0000 (13:40 +0200)]
Add new exp files to EXTRA_DIST in memcheck/tests/Makefile.am

13 months agoAdd x86 variant of origin5-bz2.stderr.exp-glibc25-amd64-b
Mark Wielaard [Thu, 26 Oct 2023 11:17:13 +0000 (13:17 +0200)]
Add x86 variant of origin5-bz2.stderr.exp-glibc25-amd64-b

This matches the expected output on newer fedora 32bit x86.

13 months agoAdd 32bit variant of new_aligned_delete_default.stderr.exp
Mark Wielaard [Thu, 26 Oct 2023 10:51:57 +0000 (12:51 +0200)]
Add 32bit variant of new_aligned_delete_default.stderr.exp

On 32bit architectures sized delete takes an unsigned int instead of
an unsigned long as first argument.

13 months agovg_replace_malloc DELETE should not check size
Mark Wielaard [Thu, 26 Oct 2023 10:25:44 +0000 (12:25 +0200)]
vg_replace_malloc DELETE should not check size

The DELETE replacement functions check the size argument, but this
doesn't actually exist.  Only the DELETE_SIZED replacement functions
get a size (and should check it).

On i386 (fedora gnu/linux) this causes the following failures:

memcheck/tests/cxx17_aligned_new         (stderr)
memcheck/tests/leak_cpp_interior         (stderr)
memcheck/tests/mismatches                (stderr)
memcheck/tests/mismatches_xml            (stderr)
memcheck/tests/new_aligned_delete_default (stderr)
memcheck/tests/new_nothrow               (stderr)
memcheck/tests/realloc_size_zero_mismatch (stderr)

All showing "size" being undefined:

+Conditional jump or move depends on uninitialised value(s)
+   at 0x........: ...operator delete[]... (vg_replace_malloc.c:...)

or

+Mismatched new/delete size value: 4
+   at 0x........: ...operator delete... (vg_replace_malloc.c:...)

Oddly no other architecture seems to show issues. Maybe we just got lucky?

This patch fixes the issues on i386 (and shows no regressions on x86_64)

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

14 months agoChange the vbit test specification for Iop_CmpGT64Ux2
Carl Love [Wed, 25 Oct 2023 15:20:30 +0000 (11:20 -0400)]
Change the vbit test specification for Iop_CmpGT64Ux2

The test should be specified as UNDEF_UNKNOWN not UNDEF_ALL_64x2.
No architectures should be enaabled for the test.

14 months agoRevert "Bug 476025 - Powerpc, update expected results for the vbit-test"
Carl Love [Tue, 24 Oct 2023 20:33:34 +0000 (16:33 -0400)]
Revert "Bug 476025 - Powerpc, update expected results for the vbit-test"

This reverts commit 5396fc8d0197e843657736ef8f7d9774400980c9.

The commited expect file is completely wrong.

14 months agoBug 476025 - Powerpc, update expected results for the vbit-test
Carl Love [Mon, 23 Oct 2023 23:15:00 +0000 (19:15 -0400)]
Bug 476025 - Powerpc, update expected results for the vbit-test

In commit:

  commit 26a3abd27db2ef63dafea1ecab00e8239f341f0f
  Author: Eyal Soha <eyalsoha@gmail.com>
  Date:   Thu Feb 10 09:52:54 2022 -0700

      Bug 432801 - Valgrind 3.16.1 reports a jump based on uninitialized
      memory somehow related to clang and signals

      Add support for precise computation of SIMD greater-than on
      amd64 and x86.

      This adds support for 64bit, 16bit, and 8bit to the existing 32bit
      support.

The Iop_CmpGT64Ux2 is only supported on PPC32 and PPC64.  The above
commit adds a more precise method, expensiveCmpGT, for setting the
vibits for the Iop_CmpGT64Ux2 Iop.

The expected results for the vbit test were not updated to the new more
precise results.  This patch updates the expected results for the Iop.

Patch tested on Power 10.

14 months agoAdd arm-linux build artifacts to .gitignore
Mark Wielaard [Thu, 19 Oct 2023 14:34:54 +0000 (16:34 +0200)]
Add arm-linux build artifacts to .gitignore

14 months agoAdd new drd/tests/thrd_create test to .gitignore
Mark Wielaard [Thu, 19 Oct 2023 14:26:34 +0000 (16:26 +0200)]
Add new drd/tests/thrd_create test to .gitignore

14 months agos390x: Adjust .gitignore after commit 7cf98163adb3f
Andreas Arnez [Thu, 19 Oct 2023 13:06:38 +0000 (15:06 +0200)]
s390x: Adjust .gitignore after commit 7cf98163adb3f

The executable of the new test case memcheck/tests/s390x/cli hasn't been
added to .gitignore yet.  Do this now.

14 months agoUpdate NEWS to reflect Clang support for s390x
Andreas Arnez [Thu, 19 Oct 2023 12:16:08 +0000 (14:16 +0200)]
Update NEWS to reflect Clang support for s390x

Small update in NEWS to reflect that Bug 465782 is fixed.

14 months agos390x regtest: Fix memcheck tests for cu21 and cu42 with Clang
Andreas Arnez [Thu, 19 Oct 2023 12:17:35 +0000 (14:17 +0200)]
s390x regtest: Fix memcheck tests for cu21 and cu42 with Clang

When compiled with Clang, the s390x memcheck tests for cu21 and cu42 yield
different line number information for the inline assemblies.  Using gcc,
the inline assemblies do not receive updated line number information
because they are phrased as if they were data, not code.  See also the
discussion in https://sourceware.org/bugzilla/show_bug.cgi?id=30206

Fix this by rephrasing the inline assemblies in cu21 and cu42 to normal
instructions, using the respective mnemonics.  Since this affects the line
number information, adjust the expected test output files as well.

14 months agos390x: Fix memcheck false positives with certain comparisons
Andreas Arnez [Tue, 16 May 2023 18:29:33 +0000 (20:29 +0200)]
s390x: Fix memcheck false positives with certain comparisons

Consider this structure definition:

  struct s {
    unsigned b : 1;
    unsigned c : 1;
  } x;

Then certain compiler optimizations for a big-endian system may transform
the test

  if (x.b || x.c)
     ...

into a comparison `> 0x3f' of the structure's first byte.  Indeed, the
result of this comparison only depends on the two highest bits of the
byte.  Thus, even if the lower bits are undefined, memcheck shouldn't
complain, but it does.

For certain cases this can be fixed.  Do this by detecting comparisons
like this in the condition code helper for S390_CC_OP_UNSIGNED_COMPARE and
transforming them to a test for the selected bits instead.  Add a small
test to verify the fix.

14 months agoSet version to 3.22.0-RC1
Mark Wielaard [Tue, 17 Oct 2023 22:28:45 +0000 (00:28 +0200)]
Set version to 3.22.0-RC1

14 months agoBug 475652 - Missing suppression for __wcsncpy_avx2 (strncpy-avx2.S:308)?
Paul Floyd [Mon, 16 Oct 2023 21:14:39 +0000 (23:14 +0200)]
Bug 475652 - Missing suppression for __wcsncpy_avx2 (strncpy-avx2.S:308)?

Adds a replace strmem wrapper for wcsncpy

Whilst doing this I noticed that

memcheck/tests/filter_memcheck

wasn't filtering memcheck/tests/freebsd/timingsafe properly.
That's because before filtering vg_replace_strmem.c and
vg_replace_malloc.c there's a check that the test exe filename
does not match the line. In this case the test exe was "timingsafe",
but line contained "timingsafe_memcmp", which matched leaving
vg_replace_strmem.c unfiltered. So I just renamed the testcase.

14 months agoconfigure.ac: Convert the thrd_create() test from C++ to C
Bart Van Assche [Mon, 16 Oct 2023 13:30:55 +0000 (06:30 -0700)]
configure.ac: Convert the thrd_create() test from C++ to C

14 months agodrd/tests/thrd_create: Convert from C++ to C
Bart Van Assche [Mon, 16 Oct 2023 13:21:03 +0000 (06:21 -0700)]
drd/tests/thrd_create: Convert from C++ to C

14 months agoFreeBSD regtest: add required library for C11 threads
Paul Floyd [Sun, 15 Oct 2023 18:42:29 +0000 (20:42 +0200)]
FreeBSD regtest: add required library for C11 threads

14 months agodrd: Add support for C11 thrd_create()
Bart Van Assche [Sun, 15 Oct 2023 14:36:33 +0000 (07:36 -0700)]
drd: Add support for C11 thrd_create()

14 months agoillumos: finish refactoring of DRD internal client requests.
Paul Floyd [Wed, 11 Oct 2023 06:38:43 +0000 (08:38 +0200)]
illumos: finish refactoring of DRD internal client requests.

14 months agomemcheck: add checking that new aligned is not deallocated by plain delete
Paul Floyd [Tue, 10 Oct 2023 22:01:40 +0000 (00:01 +0200)]
memcheck: add checking that new aligned is not deallocated by plain delete

14 months agomemcheck: Fix a typo in aligned alloc error suppression check
Paul Floyd [Tue, 10 Oct 2023 19:24:01 +0000 (21:24 +0200)]
memcheck: Fix a typo in aligned alloc error suppression check

Also update corresponding testcase

14 months agoDHAT: only handle own user reqs, ignore others
Paul Floyd [Mon, 9 Oct 2023 20:54:30 +0000 (22:54 +0200)]
DHAT: only handle own user reqs, ignore others

Make other tools consistent with this as well
(using memcheck as the model). Also refactored
the DRD user req names to make it clearer which
are Valgrind user reqs, which are DRD public
user reqs and which are DRD internal user reqs.

14 months agocoverity: last of the unsigned >= 0 warnings
Paul Floyd [Mon, 9 Oct 2023 06:10:01 +0000 (08:10 +0200)]
coverity: last of the unsigned >= 0 warnings

Also a bit of struct space saving thanks to pahole

14 months agoBug 390871 - ELF debug info reader confused with multiple .rodata* sections
Paul Floyd [Sat, 7 Oct 2023 14:02:24 +0000 (16:02 +0200)]
Bug 390871 - ELF debug info reader confused with multiple .rodata* sections

14 months agoRevert "Bug 390871 - ELF debug info reader confused with multiple .rodata* sections"
Paul Floyd [Sun, 8 Oct 2023 07:43:15 +0000 (09:43 +0200)]
Revert "Bug 390871 - ELF debug info reader confused with multiple .rodata* sections"

This reverts commit 5472a7a54000692f9f58e9b551d36b8c68c44873.

14 months agoBug 390871 - ELF debug info reader confused with multiple .rodata* sections
Jogn Reiser [Sat, 7 Oct 2023 14:02:24 +0000 (16:02 +0200)]
Bug 390871 - ELF debug info reader confused with multiple .rodata* sections

14 months agocoverity: most of the remaining unsigned comparisons >= 0 warnings
Paul Floyd [Sun, 8 Oct 2023 07:21:12 +0000 (09:21 +0200)]
coverity: most of the remaining unsigned comparisons >= 0 warnings

14 months agoMinor tweaks for Python tooling updates.
Nicholas Nethercote [Mon, 2 Oct 2023 21:11:42 +0000 (08:11 +1100)]
Minor tweaks for Python tooling updates.

Annoying that these are necessary, but that seems to be standard for
this stuff.

14 months agoImplement DW_OP_{bregx,consts,const8s,const8u,constu} in dwarfexpr_to_dag
Mark Wielaard [Sun, 1 Oct 2023 22:37:24 +0000 (00:37 +0200)]
Implement DW_OP_{bregx,consts,const8s,const8u,constu} in dwarfexpr_to_dag

readdwarf.c (dwarfexpr_to_dag) didn't hanle various DW_OP expressions
causing Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode and errors
m_debuginfo/readdwarf.c:2822 (copy_convert_CfiExpr_tree): Assertion
'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed.

Implement DW_OP_bregx and DW_OP_consts as reported in bug #461074.
Also add implementations for DW_OP_const8s, DW_OP_const8u and
DW_OP constu.

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

14 months agocoverity: most of the remaining unsigned >= 0 comparison warnings
Paul Floyd [Sun, 1 Oct 2023 18:51:59 +0000 (20:51 +0200)]
coverity: most of the remaining unsigned >= 0 comparison warnings

14 months agocachegrind: exit with error if line size or associativity is zero
Paul Floyd [Sat, 30 Sep 2023 19:54:21 +0000 (21:54 +0200)]
cachegrind: exit with error if line size or associativity is zero

Detected with Coverity

14 months agocoverity: use some event tags and ensure some shift expression size promotion
Paul Floyd [Sat, 30 Sep 2023 15:35:54 +0000 (17:35 +0200)]
coverity: use some event tags and ensure some shift expression size promotion

The shifts are protected by tests so there was no risk.

14 months agocoverity: mostly unsigned >= 0 comparisons
Paul Floyd [Sat, 30 Sep 2023 14:34:45 +0000 (16:34 +0200)]
coverity: mostly unsigned >= 0 comparisons

14 months agocoverity: lots of checks that unsigned are >= 0 which is always true
Paul Floyd [Fri, 29 Sep 2023 20:45:32 +0000 (22:45 +0200)]
coverity: lots of checks that unsigned are >= 0 which is always true

Also put back the isFF flag initialization (used for FreeBSD
non-fixed RO ELF segmentd) . I had intended to delete it but
in the end kept it for traces but had already deleted the init code.

14 months agos390x: Make z16 machine model known to Valgrind
Andreas Arnez [Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)]
s390x: Make z16 machine model known to Valgrind

The z16 machine model hasn't been fully introduced to Valgrind yet.  Add
the missing support:

* Add z16 to the list of machine models in each of `libvex.h',
  `tests/s390x_features.c', and `s390-check-opcodes.pl'.

* Starting with z16, the "store facility list extended" (STFLE)
  instruction can write four instead of three words.  Reflect this in the
  STFLE-helper and in the `stfle' test case.

* Pass the new STFLE-bits unchanged, except for the vector-packed-decimal
  facility, which is unsupported by Valgrind.

14 months agos390x regtest: Adjust vec2_float for Clang
Andreas Arnez [Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)]
s390x regtest: Adjust vec2_float for Clang

The vec2_float test case doesn't compile with Clang, due to two issues:

* Clang doesn't correctly support `long double' vectors, as documented in
  this GitHub issue: https://github.com/llvm/llvm-project/issues/61291

* llvm-as behaves differently from gas for the reserved field in the
  `.insn vrr' directive.  Instead of inserting the given data from the
  first operand, it initializes the reserved field with zeros.

Circumvent these issues.

14 months agos390x regtest: Additional test case fixes
Andreas Arnez [Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)]
s390x regtest: Additional test case fixes

While fixing Clang compilation issues, I noticed additional problematic
constructs in s390x test cases, some of which are uncovered with compiler
optimization options such as -O3:

* `bic.c' relies on an int to be sign-extended when passing it in a
  register to an inline-assembly.

* `cksm.c' clobbers a register in an inline assembly without specifying
  that.

* `cu12.c' and `cu14.c' read the variable `pattern1' beyond its size.

* `mvst.c' modifies input operands in inline assemblies.

* `srnmb.c' relies on Valgrind's error message for a bad rounding mode to
  point to the line number where get_rounding_mode() is called, not to the
  function itself.

* `stfle.c' has a code path with an uninitialized variable that may cause
  a compiler warning.

* `stmg.c' modifies r15 in an inline assembly and doesn't expect the
  compiler to use r15 as the base address for an input operand.

* Various inline assemblies use the "=m" constraint even when the
  instruction only supports more restricted address operands.

Fix all of the above.  For consistency and clarity, avoid the "=m"
constraint even when it would be applicable.

14 months agos390x regtest: Refactor mul test cases for Clang support
Andreas Arnez [Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)]
s390x regtest: Refactor mul test cases for Clang support

The mul test case crashes when compiled with clang because of register
clashes in some inline assemblies.  Obviously clang does not treat
register clobbers as "early clobbers", but sometimes uses the same
registers for inputs as well.

Rewrite the inline assemblies in mul.h to avoid this issue.  Also, reduce
the code duplication in the process.  Adjust mul_GE.c accordingly.  Keep
the expected output for all mul test cases the same as before.

14 months agos390x regtest: Adjust op00 and op_exception tests for Clang
Andreas Arnez [Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)]
s390x regtest: Adjust op00 and op_exception tests for Clang

As part of fixing Bug 465782, adjust the op00 and op_exception tests.

The op00 test case doesn't compile with clang because the .hword assembler
directive is not known to llvm-as.  When replacing it with .short, the
test case fails because clang/llvm-as generates different line number
information from gcc/gas.  Using gcc, Valgrind's error message locates the
unrecognised instruction

   at 0x........: main (op00.c:3)

whereas with clang, it shows:

   at 0x........: main (op00.c:4)

The asm statement in op00.c is indeed located at line 4, so when compiling
with gcc, the indicated line number is just wrong.  This is because gas
only updates line number information for instruction directives, not for
directives like `.short' as used here.  See also the discussion in
https://sourceware.org/bugzilla/show_bug.cgi?id=30206

The same applies to the op_exception test case, where `.long' is used to
emit illegal instructions.

Make these test cases independent from this difference, by replacing the
`.short' and `.long' directives by equivalent `.insn' directives.  Also
drop the unnecessary duplication of op00.stderr.exp.

14 months agos390x regtest: Adjust various test cases for Clang
Andreas Arnez [Fri, 29 Sep 2023 14:11:31 +0000 (16:11 +0200)]
s390x regtest: Adjust various test cases for Clang

There are various issues when compiling the s390x test cases with
Clang (see Bug 465782):

* Bugs in inline assemblies tolerated/obscured by GCC:

  - "d" (or "r") constraint instead of "a" where a register from 1-15 is
    needed
  - mix-up between vector register and general register in inline assembly
  - too unspecific constraints such as "m" or "g"
  - use of input operand for output
  - missing register clobber declaration

* Missing Clang features:

  - "%R" (register) and "%O" (offset) modifiers with address constraints
    in inline assemblies
  - variable-length array within a struct

* Use of the -mlong-double-128 command line option -- has been redundant
  for some time with GCC, and Clang only supports 128-bit long double

* Bad definition of _FPU_SETCW/_FPU_GETCW in <fpu_control.h>
  (See https://sourceware.org/bugzilla/show_bug.cgi?id=30130)

* Use of pow() function without linking libm -- GCC optimizes the call
  away, while Clang keeps a reference to pow()

Perform appropriate changes to the test cases such that they can be
compiled both with Clang and with GCC.

14 months agoREADME / comments: update debugging advice
Paul Floyd [Fri, 29 Sep 2023 06:57:42 +0000 (08:57 +0200)]
README / comments: update debugging advice

And add an explanation for the odd FreeBSD amd64 startup stack alignment.

15 months agoFreeBSD: fix reading debuginfo of the tool itself
Paul Floyd [Sat, 23 Sep 2023 14:11:55 +0000 (16:11 +0200)]
FreeBSD: fix reading debuginfo of the tool itself

Not sure if this was ever functional since I started working on it,
but FreeBSD parse_procselfmaps doesn't handle the RW PT_LOAD
correctly. Also since FreeBSD was ignoring non-fixed RO PT_LOAD
mappings ML_(read_elf_object) didn't see the right number of
debuginfo mappings compared to the ELF header.

The code is fairly hacky and brute force.

15 months agodebuginfo.c: Add more hooks for lazy loading debuginfo
Aaron Merey [Wed, 20 Sep 2023 17:00:02 +0000 (13:00 -0400)]
debuginfo.c: Add more hooks for lazy loading debuginfo

Add calls to di_load_di in search_one_{symtab,loctab,cfitab} to ensure
that debuginfo is always loaded before searching these tables.

This fixes a bug introduced in commit 60f7e89ba32 that results in
callgrind failing to read source filenames from debuginfo.

Also add a test which checks that callgrind successfully finds a
filename from debuginfo.

Co-Authored-By: Philippe Waroquiers <philippe.waroquiers@skynet.be>
15 months agoTry to find section .opd in read_elf_object
Aaron Merey [Mon, 18 Sep 2023 21:42:42 +0000 (17:42 -0400)]
Try to find section .opd in read_elf_object

read_elf_debug skips checking for .opd ELF section, causing
assert failures on PPC BE.

This patch adds the missing check for .opd.

15 months agoFreeBSD: update README.freebsd
Paul Floyd [Wed, 20 Sep 2023 19:03:25 +0000 (21:03 +0200)]
FreeBSD: update README.freebsd

Remove specific version numbers for availability.
Add more details about releases of devel/valgrind and
devel/valgrind-devel

15 months agoDarwin: fix build with lazy debuginfo reading
Paul Floyd [Wed, 20 Sep 2023 06:47:14 +0000 (08:47 +0200)]
Darwin: fix build with lazy debuginfo reading

Needs the macho reader, not ELF.

15 months agoFreeBSD: add intercepts to timingsafe variants of memcmp and bcmp
Paul Floyd [Wed, 20 Sep 2023 06:16:43 +0000 (08:16 +0200)]
FreeBSD: add intercepts to timingsafe variants of memcmp and bcmp

15 months agoFreeBSD: refactor VG_(load_all_debuginfo)
Paul Floyd [Tue, 19 Sep 2023 17:53:06 +0000 (19:53 +0200)]
FreeBSD: refactor VG_(load_all_debuginfo)

Thanks to Philippe Waroquiers for the suggestion

15 months agoBug 432801 - Valgrind 3.16.1 reports a jump based on uninitialized memory somehow...
Eyal Soha [Thu, 10 Feb 2022 16:52:54 +0000 (09:52 -0700)]
Bug 432801 - Valgrind 3.16.1 reports a jump based on uninitialized memory somehow related to clang and signals

Add support for precise computation of SIMD greater-than on
amd64 and x86.

This adds support for 64bit, 16bit, and 8bit to the existing 32bit
support.

15 months agoHelgrind s390: add a suppression for __printf_buffer_write
Paul Floyd [Tue, 19 Sep 2023 05:48:26 +0000 (07:48 +0200)]
Helgrind s390: add a suppression for __printf_buffer_write

Again Fedora 38

15 months agoDRD s390: add a suppression for _dl_exception_create_format
Paul Floyd [Tue, 19 Sep 2023 05:31:17 +0000 (07:31 +0200)]
DRD s390: add a suppression for _dl_exception_create_format

Seen on Fedora 38

15 months agoregtest: copy and paste error in new_delete_mismatch_size vgtest files
Paul Floyd [Mon, 18 Sep 2023 18:19:56 +0000 (20:19 +0200)]
regtest: copy and paste error in new_delete_mismatch_size vgtest files

15 months agotest scripts: add cachegrind to list of tools with export headers
Paul Floyd [Sun, 17 Sep 2023 08:12:48 +0000 (10:12 +0200)]
test scripts: add cachegrind to list of tools with export headers

15 months agoFreeBSD: add syscall wrapper for membarrier (added in FreeBSD 15)
Paul Floyd [Sun, 17 Sep 2023 09:50:54 +0000 (11:50 +0200)]
FreeBSD: add syscall wrapper for membarrier (added in FreeBSD 15)

I also noticed that the Linux membarrier syscall wrapper
is out of date. It only takes one argument. Depending on the kernel
version it can also take 2 or 3 arguments (3 being the latest).

15 months agoFreeBSD: Add syscall wrapper for kqueuex (FreeBSD 15)
Paul Floyd [Sun, 17 Sep 2023 09:06:05 +0000 (11:06 +0200)]
FreeBSD: Add syscall wrapper for kqueuex (FreeBSD 15)

15 months agoUpdate .gitignore
Paul Floyd [Sat, 16 Sep 2023 20:44:21 +0000 (22:44 +0200)]
Update .gitignore

15 months agoLinux: change timerfd wrapper names used for arguments
Paul Floyd [Sat, 16 Sep 2023 13:00:39 +0000 (15:00 +0200)]
Linux: change timerfd wrapper names used for arguments

The  now match the manpage names:

SYNOPSIS
       #include <sys/timerfd.h>

       int timerfd_create(int clockid, int flags);

       int timerfd_settime(int fd, int flags,
                           const struct itimerspec *new_value,
                           struct itimerspec *old_value);
       int timerfd_gettime(int fd, struct itimerspec *curr_value);

15 months agoFreeBSD: add wrapperd for timerfd_create timerfd_gettime and timerfd_settime for...
Paul Floyd [Sat, 16 Sep 2023 14:06:12 +0000 (16:06 +0200)]
FreeBSD: add wrapperd for timerfd_create timerfd_gettime and timerfd_settime for FreeBSD 15

Mostly copied from the Linux implementation.
Add a testcase and a scalar for FreeBSD 15

15 months agoAdd some client requests to Cachegrind.
Nicholas Nethercote [Thu, 10 Aug 2023 04:10:36 +0000 (14:10 +1000)]
Add some client requests to Cachegrind.

15 months agoLinux regtest: update MUSL version of aligned_alloc test
Paul Floyd [Sun, 10 Sep 2023 16:15:38 +0000 (18:15 +0200)]
Linux regtest: update MUSL version of aligned_alloc test

15 months agoLinux regtest: Update aligned_alloc test for GNU libc 2.38
Paul Floyd [Sun, 10 Sep 2023 15:53:05 +0000 (15:53 +0000)]
Linux regtest: Update aligned_alloc test for GNU libc 2.38

15 months agoBug 474332 - aligned_alloc under Valgrind returns nullptr when alignment is not a...
Paul Floyd [Sun, 10 Sep 2023 13:05:57 +0000 (15:05 +0200)]
Bug 474332 - aligned_alloc under Valgrind returns nullptr when alignment is not a multiple of sizeof(void *)

At configure time use glibc version to set a HAVE flag for C17 aligned_alloc.
The use the HAVE flag to select which redir macro to use.
Also make the (normally unused) glibc ALIGNED_ALLOC macro
the same as MEMALIGN, just in case.

15 months agoFreeBSD: close_range versioning issues
Paul Floyd [Sun, 10 Sep 2023 08:39:34 +0000 (10:39 +0200)]
FreeBSD: close_range versioning issues

I mixed up a bit the syscall wrapper versioning.
Also for some reason the syscall has been backported to FreeBSD 12.2
but not the CLOEXEC flag. So I had to modify the testcase for that.

15 months agoIllumos regtest: update expected for aligned_alloc
Paul Floyd [Sat, 9 Sep 2023 10:26:40 +0000 (12:26 +0200)]
Illumos regtest: update expected for aligned_alloc

15 months agocoverity: various minor fixes
Paul Floyd [Sat, 9 Sep 2023 06:53:43 +0000 (08:53 +0200)]
coverity: various minor fixes

mostly asserts that unsigned values are 0 or positive

15 months agoFreeBSD: add syscall wrapper for close_range
Paul Floyd [Fri, 8 Sep 2023 21:40:12 +0000 (23:40 +0200)]
FreeBSD: add syscall wrapper for close_range

15 months agos390x regtest: Reduce test output for vector test cases
Andreas Arnez [Thu, 7 Sep 2023 15:00:42 +0000 (17:00 +0200)]
s390x regtest: Reduce test output for vector test cases

The s390x test cases `vector', `vector_integer', `vector_float' and
`vector_string' generate a lot of unnecessary output, because for each
tested instruction they usually dump more registers than the instruction
modifies.

Without changing the test approach itself and without losing information,
the output can still be reduced significantly by comparing the register
states before and after the tested instruction and then only dumping the
changed parts.

15 months agos390x regtest: Fix typo in previous commit
Andreas Arnez [Thu, 7 Sep 2023 15:00:42 +0000 (17:00 +0200)]
s390x regtest: Fix typo in previous commit

This amends the commit "Build DFP test cases unconditionally", where
"pfpo" was accidentally replaced by "pfpfo" in Makefile.am.

15 months agos390x regtest: Build DFP test cases unconditionally
Andreas Arnez [Thu, 7 Sep 2023 14:43:25 +0000 (16:43 +0200)]
s390x regtest: Build DFP test cases unconditionally

Now that the DFP test cases no longer depend on the compiler's support for
`_Decimal*' types, they can be enabled unconditionally.  Do this in the
"Makefile.am".

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