17005 Commits

Author SHA1 Message Date
Paul Floyd
49fe0dc74a Anticipate testcase problems with GCC 12
There will be a lot more to come.

On amd64 Linux
In faultstatus was seeing the division by zero and emitting a ud2 opcode.
In wrap3 a pair of mutually recursive functions were being inlined.
When forced not to be inlined GCC merged them into a single function.
It cannot see that the client requests have diffeent behaviour.
2021-11-23 23:37:02 +01:00
Paul Floyd
01e05ea81c Disable auxv PAGESIZES workaround on FreeBSD 13
Leaving it in place for 11 (which is now EOL) and 12 - not
woth the complexity for them. Improve comment for supporession.

Also add a pointer to the illumos source web page for lwp_unlock_mutex
in case the syswrap ever needs improving.
2021-11-23 21:58:45 +01:00
Paul Floyd
49d6d73c25 Add missing syscall wrapper on Solaris
I tried to test drd/tests/pth_mutex_signal on Solaris
(you never know) but encountered a missing syscall
wrapper. So this adds a very basic wrapper for lwp_mutex_unlock.

Also update a Solaris expected that I missed amongst the FreeBSD changes.
2021-11-22 04:12:16 +01:00
Mark Wielaard
542447d470 readdwarf3.c (parse_inl_DIE) inlined_subroutine can appear in namespaces
This was broken by commit 75e3ef0f3 "readdwarf3: Skip units without
addresses when looking for inlined functions". Specifically by this
part: "Also use skip_DIE instead of read_DIE when not parsing
(skipping) children"

rustc puts concrete function instances in namespaces (which is
allowed in DWARF since there is no strict separation between type
declarations and program scope entries in a DIE tree), the inline
parser didn't expect this and so skipped any DIE under a namespace
entry. This wasn't an issue before because "skipping" a DIE tree was
done by reading it, so it wasn't actually skipped. But now that we
really skip the DIE (sub)tree (which is faster than actually parsing
it) some entries were missed in the rustc case.

https://bugs.kde.org/show_bug.cgi?id=445668
2021-11-22 13:15:36 +01:00
Paul Floyd
e484eee0bd Bug 445300 [PATCH] Fix building tests with Musl
Patch contributed by
   Alyssa Ross <hi@alyssa.is>
2021-11-22 08:42:53 +01:00
Paul Floyd
02ce9addfa Add drd pthread_mutex_signal testcase executable to .gitignore 2021-11-22 08:40:07 +01:00
Mark Wielaard
5db4f35edf drd-manual.xml: Fix link to libstdc++ manual GLIBCXX_FORCE_NEW reference. 2021-11-21 15:25:14 +01:00
Bart Van Assche
bf0579a44a drd: Add a test program that interrupts pthread_mutex_lock()
This test fails, probably due to differences between native signal handling
and signal handling in the Valgrind core.
2021-11-20 14:28:05 -08:00
Mark Wielaard
8ad4c01880 memcheck/tests/libstdc++.supp: rename suppression
The name malloc-leaks-cxx-stl-string-classes-debug was confusing
since the suppression wasn't a leak, not part of stl, string,
classes or debug. Rename it to libstdcxx-emergency-eh-alloc-pool
to indicate it is part of the emergency exception handling memory
pool.

Note that suppression is only needed for some test cases, normally
the pool is cleaned up as part of cxx_freeres.
2021-11-19 15:00:30 +01:00
Paul Floyd
9abfed23c0 Bug 445504 Using C++ condition_variable results in bogus "mutex is locked simultaneously by two threads" warning(edit)
Add intercepts for pthread_cond_clockwait to DRD and Helgrind
Also testcase from bugzilla done by Bart, with configure check
2021-11-19 08:34:53 +01:00
Paul Floyd
b754b7b48a Add some details for running regtests on FreeBSD. 2021-11-18 19:52:46 +01:00
Paul Floyd
f13667b1ef Bug 445607 Unhandled amd64-freebsd syscall: 247
I can't find much in the way of documentation for this.
Added to scalar, but no specific tests.
2021-11-17 23:15:23 +01:00
Paul Floyd
83dda2b71a Bug 444925 fexecve syscall wrapper not properly implemented
Implement fexecve and a few testcases on FreeBSD.
2021-11-14 22:06:14 +01:00
Paul Floyd
5f8211aa60 Add a FreeBSD suppression for fun:_malloc_postfork
This was causing drd/tests/fork-parallel to fail intermittently.
It's due to the use of a jemalloc-specific mutex.
2021-11-14 16:42:31 +01:00
Julian Seward
595341b150 amd64 front end: add more spec rules:
S  after SHRQ
   Z  after SHLQ
   NZ after SHLQ
   Z  after SHLL
   S  after SHLL

The lack of at least one of these was observed to cause occasional false
positives in Memcheck.

Plus add commented-out cases so as to complete the set of 12 rules
{Z,NZ,S,NS} after {SHRQ,SHLQ,SHLL}.  The commented-out ones are commented
out because I so far didn't find any use cases for them.
2021-11-13 19:59:07 +01:00
Paul Floyd
4fd9bd3ed0 Remove a default suppession for GCC/libstdc++
This is covered by cxx-freeres
2021-11-13 18:09:20 +01:00
Paul Floyd
39b4bbe3a1 Bugs 435732 and 403802 again
This time with debuginfo removed.

Also update the vgtest files for a couple of massif tests
(and also the expected because of the commmand line change).
Not yet tested these two with debuginfo installed.
2021-11-13 12:31:41 +01:00
Julian Seward
2be719921e Bug 445415 - arm64 front end: alignment checks missing for atomic instructions.
For the arm64 front end, none of the atomic instructions have address
alignment checks included in their IR.  They all should.  The effect of
missing alignment checks in the IR is that, since this IR will in most cases
be translated back to atomic instructions in the back end, we will get
alignment traps (SIGBUS) on the host side and not on the guest side, which is
(very) incorrect behaviour of the simulation.
2021-11-13 09:27:01 +01:00
Julian Seward
92e56be59b Add missing NEWS entry for bug 444399 (== 434283). 2021-11-13 09:08:27 +01:00
Paul Floyd
7d47865aa7 No longer need FreeBSD expected for C++ demangle test 2021-11-13 00:25:43 +01:00
Paul Floyd
e24f3b6b21 Bugs 435732 and 403802
The problem is that the testcase specific suppression has stacks
that are too specific. This causes breakage with different versions
of GCC and libstdc++. The suppression only needs to mask the memory
pool used for standard io.

There are several suppression stanzas so future tweaks may still be
necessary.
2021-11-13 00:00:38 +01:00
Paul Floyd
c09706352a Make memcheck tests demangle and demangle-rust clang-friendly.
Clang uses CMOV for ternary operators which does not immediately
trigger an error. Using double free and new/free mismatch still
poses no problem with clang but still uses the demangling.

Also update .gitignore
2021-11-12 23:44:54 +01:00
Julian Seward
0d38ca5dd6 Bug 444399 - disInstr(arm64): unhandled instruction 0xC87F2D89 (LD{,A}XP and ST{,L}XP). FOLLOWUP FIX.
This is an attempt to un-break 'make dist', as broken by the main commit for
this bug, which was 530df882b8f60ecacaf2b9b8a719f7ea1c1d1650.
2021-11-12 13:08:45 +01:00
Julian Seward
530df882b8 Bug 444399 - disInstr(arm64): unhandled instruction 0xC87F2D89 (LD{,A}XP and ST{,L}XP).
This is unfortunately a big and complex patch, to implement LD{,A}XP and
ST{,L}XP.  These were omitted from the original AArch64 v8.0 implementation
for unknown reasons.

(Background) the patch is made significantly more complex because for AArch64
we actually have two implementations of the underlying
Load-Linked/Store-Conditional (LL/SC) machinery: a "primary" implementation,
which translates LL/SC more or less directly into IR and re-emits them at the
back end, and a "fallback" implementation that implements LL/SC "manually", by
taking advantage of the fact that V serialises thread execution, so we can
"implement" LL/SC by simulating a reservation using fields LLSC_* in the guest
state, and invalidating the reservation at every thread switch.

(Background) the fallback scheme is needed because the primary scheme is in
violation of the ARMv8 semantics in that it can (easily) introduce extra
memory references between the LL and SC, hence on some hardware causing the
reservation to always fail and so the simulated program to wind up looping
forever.

For these instructions, big picture:

* for the primary implementation, we take advantage of the fact that
  IRStmt_LLSC allows I128 bit transactions to be represented.  Hence we bundle
  up the two 64-bit data elements into an I128 (or vice versa) and present a
  single I128-typed IRStmt_LLSC in the IR.  In the backend, those are
  re-emitted as LDXP/STXP respectively.  For LL/SC on 32-bit register pairs,
  that bundling produces a single 64-bit item, and so the existing LL/SC
  backend machinery handles it.  The effect is that a doubleword 32-bit LL/SC
  in the front end translates into a single 64-bit LL/SC in the back end.
  Overall, though, the implementation is straightforward.

* for the fallback implementation, it is necessary to extend the guest state
  field `guest_LLSC_DATA` to represent a 128-bit transaction, by splitting it
  into _DATA_LO64 and DATA_HI64.  Then, the implementation is an exact
  analogue of the fallback implementation for single-word LL/SC.  It takes
  advantage of the fact that the backend already supports 128-bit CAS, as
  fixed in bug 445354.  As with the primary implementation, doubleword 32-bit
  LL/SC is bundled into a single 64-bit transaction.

Detailed changes:

* new arm64 guest state fields LLSC_DATA_LO64/LLSC_DATA_LO64 to replace
  guest_LLSC_DATA

* (ridealong fix) arm64 front end: a fix to a minor and harmless decoding bug
  for the single-word LDX/STX case.

* arm64 front end: IR generation for LD{,A}XP/ST{,L}XP: tedious and
  longwinded, but per comments above, an exact(ish) analogue of the singleword
  case

* arm64 backend: new insns ARM64Instr_LdrEXP / ARM64Instr_StrEXP to wrap up 2
  x 64 exclusive loads/stores.  Per comments above, there's no need to handle
  the 2 x 32 case.

* arm64 isel: translate I128-typed IRStmt_LLSC into the above two insns

* arm64 isel: some auxiliary bits and pieces needed to handle I128 values;
  this is standard doubleword isel stuff

* arm64 isel: (ridealong fix): Ist_CAS: check for endianness of the CAS!

* arm64 isel: (ridealong) a couple of formatting fixes

* IR infrastructure: add support for I128 constants, done the same as V128
  constants

* memcheck: handle shadow loads and stores for I128 values

* testcase: memcheck/tests/atomic_incs.c: on arm64, also test 128-bit atomic
  addition, to check we really have atomicity right

* testcase: new test none/tests/arm64/ldxp_stxp.c, tests operation but not
  atomicity.  (Smoke test).
2021-11-12 12:13:45 +01:00
Julian Seward
7dbe2fed72 Bug 445354 - arm64 backend: incorrect code emitted for doubleword CAS.
The sequence of instructions emitted by the arm64 backend for doubleword
compare-and-swap is incorrect.  This could lead to incorrect simulation of the
AArch8.1 atomic instructions (CASP, at least).  It also causes failures in the
upcoming fix for v8.0 support for LD{,A}XP/ST{,L}XP in bug 444399, at least
when running with the fallback LL/SC implementation
(`--sim-hints=fallback-llsc`, or as autoselected at startup).  In the worst
case it can cause segfaulting in the generated code, because it could jump
backwards unexpectedly far.

The problem is the sequence emitted for ARM64in_CASP:

* the jump offsets are incorrect, both for `bne out` (x 2) and `cbnz w1, loop`.

* using w1 to hold the success indication of the stxp instruction trashes the
  previous value in x1.  But the value in x1 is an output of ARM64in_CASP,
  hence one of the two output registers is corrupted.  That confuses any code
  downstream that want to inspect those values to find out whether or not the
  transaction succeeded.

The fixes are to

* fix the branch offsets

* use a different register to hold the stxp success indication.  w3 is a
  convenient check.
2021-11-12 10:40:48 +01:00
Mark Wielaard
d151907e5d Add demangle-rust to check_PROGRAMS
The demangle-rust.vgtest would fail because the demangle-rust binary
wasn't build by default. Add it to check_PROGRAMS and define
demangle_rust_SOURCES to make sure it is always build.
2021-11-11 18:02:18 +01:00
Mark Wielaard
a0ee664023 Add scalar.stderr.exp-freebsd130-x86 to EXTRA_DIST 2021-11-10 09:05:20 +01:00
Mark Wielaard
c1bfa115f9 Add demangle-rust.vgtest demangle-rust.stderr.exp to EXTRA_DIST 2021-11-10 09:02:36 +01:00
Nicholas Nethercote
4831385c67 Fix Rust v0 demangling.
It's currently broken due to a silly test that prevents the v0
demangling code from even running.

The commit also adds a test, to avoid such problems in the future.
2021-11-10 10:03:06 +11:00
Paul Floyd
d1d74d7985 Some FreeBSD cleaning
Add a scalar expected for FreeBSD 13 i386
Add SIGLIBRT define
2021-11-09 23:19:19 +01:00
Paul Floyd
4b8eddfde1 Bug 445032 valgrind/memcheck crash with SIGSEGV when SIGVTALRM timer used and libthr.so associated
The problem was that 'struct sigframe' has both a uContext struct
member and a puContext pointer to that struct. And puContext wasn't
being initialized to point to uContext.

It seems that the pthread sigreturn code uses puContext on i386.
amd64, with register arguments, didn't have this problem.
2021-11-09 23:17:40 +01:00
Mark Wielaard
f1afb63ffd vbit-test F16 Iops are tested on the wrong architectures
Because of what looks like some copy/paste issues the new F16 Iops
seem to be tested on the wrong architectures. They are only implemented
on arm64. So this patch only enables them for arm64.

https://bugs.kde.org/show_bug.cgi?id=444831
2021-11-08 17:12:12 +01:00
Carl Love
3950c5d661 Valgrind Add powerpc R=1 tests
Contributed by Will Schmidt <will_schmidt@vnet.ibm.com>

This includes updates and adjustments as suggested by Carl.

Add tests that exercise PCRelative instructions.
These instructions are encoded with R==1, which indicate that
the memory accessed by the instruction is at a location
relative to the currently executing instruction.

These tests are built using -Wl,-text and -Wl,-bss
options to ensure the location of the target array is at a
location with a specific offset from the currently
executing instruction.

The write instructions are aimed at a large buffer in
the bss section; which is checked for updates at the
completion of each test.

In order to ensure consistent output across assorted
systems, the tests have been padded with ori, nop instructions
and align directives.

Detailed changes:
 * Makefile.am: Add test_isa_3_1_R1_RT and test_isa_3_1_R1_XT tests.
 * isa_3_1_helpers.h: Add identify_instruction_by_func_name() helper function
   to indicate if the test is for R==1.
   Add helpers to initialize and print changes to the pcrelative_write_target
   array.
   Add #define to help pad code with a series of eyecatcher ORI instructions.
     * test_isa_3_1_R1_RT.c: New test.
     * test_isa_3_1_R1_XT.c: New test.
     * test_isa_3_1_R1_XT.stdout.exp: New expected output.
     * test_isa_3_1_R1_XT.stdout.exp: New expected output.
     * test_isa_3_1_R1_RT.stderr.exp: New expected output.
     * test_isa_3_1_R1_RT.stderr.exp: New expected output.

     * test_isa_3_1_R1_RT.vgtest: New test handler.
     * test_isa_3_1_R1_XT.vgtest: New test handler.

     * test_isa_3_1_common.c: Add indicators (updates_byte,updates_halfword,
       updates_word) indicators to control the output from the R==1 tests.
       Add helper check for "_R1" to indicate if instruction is coded with R==1.
       Add init and print helpers for the pcrelative_write_target array.
2021-11-02 11:07:37 -05:00
Carl Love
ae8c6de014 Fix for the prefixed stq instruction in PC relative mode.
The pstq instruction for R=1, was not using the correct effective address.
The EA_hi and EA_lo should have been based on the value of EA as calculated
by the function calculate_prefix_EA.  Unfortuanely, the EA_hi and EA_lo
addresses were still using the previous code (not PC relative) to calculate
the address from the contants of RA plus the offset.
2021-11-02 10:50:43 -05:00
Mark Wielaard
64ab891629 gdbserver_tests: Filter out glibc hwcaps libc.so
On some systems the gdbserver_tests would fail because the filter
for the optimized hwcaps subdir didn't match because the file is
called slightly differently, with the version number before .so
instead of after. For example: /lib64/glibc-hwcaps/power9/libc-2.28.so

Add one extra filter for this pattern.
2021-11-02 14:27:45 +01:00
Carl Love
6e08ee95f7 Bug 444571 - PPC, fix the lxsibzx and lxsihzx so they only load their respective sized data.
The lxsibzx was doing a 64-bit load.  The result was initializing
additional bytes in the register that should not have been initialized.
The memcheck/tests/linux/dlclose_leak test detected the issue.  The
code generation uses lxsibzx and stxsibx with -mcpu=power9.  Previously
the lbz and stb instructions were generated.

The same issue was noted and fixed with the lxsihzx instruction.  The
memcheck/tests/linux/badrw test now passes as well.

https://bugs.kde.org/show_bug.cgi?id=444571
2021-11-01 12:51:32 -05:00
Andreas Arnez
b77dbefe72 Bug 444242 - s390x: Sign-extend "relative long" offset in EXRL
In s390_irgen_EXRL, the offset is zero-extended instead of sign-extended,
typically causing Valgrind to crash when a negative offset occurs.

Fix this with a new helper function that calculates a "relative long"
address from a 32-bit offset.  Replace other calculations of "relative
long" addresses by invocations of this function as well.  And for
consistency, do the same with "relative" (short) addresses.
2021-10-28 15:08:20 +02:00
Mark Wielaard
0cf05f82d4 Set version to 3.19.0.GIT in configure.ac
And update docs/internals/release-HOWTO.txt.
2021-10-28 14:10:56 +02:00
Andreas Arnez
ffb3f77a22 Prepare NEWS for the next release
Add a placeholder for the next release to the NEWS file and start the list
of fixed bugs with Bug 444495.
2021-10-28 13:46:49 +02:00
Paul Floyd
33aba8eef6 Bug 444495 - dhat/tests/copy fails on s390x
Add -fno-builtin to ensure that the copy functions get called and so dhat
can intercept and count them.
2021-10-27 21:37:00 +02:00
Paul Floyd
eaf0525704 Change nightly script to only print assembler if it is present.
On FreeBSD 'as' is part of the optional 'binutils' packkage.
By default, clang uses its built-in assembler and 'as' is not
used.
2021-10-23 09:02:58 +02:00
Paul Floyd
717a82afe0 Make the nightly conf files for FreeBSD more generic
I don't want to either rename or add new versions of these files
for every release.
2021-10-19 21:31:10 +02:00
Paul Floyd
aea6ca5ce7 Update a few FreeBSD suppressions
Make one more generic
Add one for the libc buffer used by libc++ std::cout
2021-10-19 20:03:39 +02:00
Julian Seward
3abc6d815c guest_amd64_toIR.c: use the VexAbiInfo mechanism to remove an ifdef freebsd. n-i-bz. 2021-10-19 16:19:31 +02:00
Mark Wielaard
5aca524f5a Set version once in configure.ac, use in valgrind.h andvg-entities.xml
Currently the version is updated in 3 places, configure.ac,
include/valgrind.h and docs/xml/vg-entities.xml. This goes wrong from
time to time. So only define the version (and release date) once in
configure.ac and update both other places at configure time.
2021-10-17 23:14:50 +02:00
Mark Wielaard
95468b34f1 Remove executable bits from source files (drd_main.c, pub_tool_machine.h) 2021-10-15 18:02:25 +02:00
Mark Wielaard
42b08ed5bd -> 3.18.1 final
Now with __VALGRIND_MINOR__ set to 18 in include/valgrind.h
2021-10-15 14:23:59 +02:00
Mark Wielaard
048e16ea5a -> 3.18.0 final 2021-10-15 13:11:34 +02:00
Mark Wielaard
ecc22f252f coregrind: Vg_FnNameKind recognize __libc_start_call_main as below main
Depending on architecture glibc has various functions that set things
up to call "main". glibc 2.34 added  __libc_start_call_main (at least
on ppc64le and s390x). Other variants recognized are __libc_start_main,
generic_start_main and variants of those names.

This fixes the massif/tests/deep-D and massif/tests/mmapunmap on ppc64le.
2021-10-13 17:13:39 +02:00
Julian Seward
eb41d3be47 Very minor updates for 3.18. 2021-10-13 17:06:10 +02:00