16973 Commits

Author SHA1 Message Date
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
Mark Wielaard
d37cedc1ef NEWS: add various core changes and arm64 additions
Add demangler update, __libc_freeres not being called on fatal signal,
DWARF reader improvements, glibc 2.34 support and various new arm64
v8.2 updates.

Remove Tool Changes section, since there were no user visible
changes to the tools in 3.18.0.
2021-10-13 13:50:32 +02:00
Mark Wielaard
20abe9e148 -> 3.18.0.RC1 2021-10-12 23:57:00 +02:00
Paul Floyd
5675b90cc0 Previous fix was out by one version tag.
memalign must have been added with FreeBSD 12.2
2021-10-12 23:33:17 +02:00
Mark Wielaard
970820852e vgdb: only queue up to 64 pending signals when waiting for SIGSTOP
We should not queue infinite pending signals so we won't run out of
memory when the SIGSTOP never arrives.
2021-10-12 23:25:40 +02:00
Mark Wielaard
ef95220dda Implement BPF_MAP_LOOKUP_AND_DELETE_ELEM and BPF_MAP_FREEZE
Implement BPF_MAP_LOOKUP_AND_DELETE_ELEM (command 21) and
BPF_MAP_FREEZE (command 22) and produce a WARNING instead of a fatal
error for unrecognized BPF commands.

https://bugs.kde.org/show_bug.cgi?id=426148
2021-10-12 23:15:41 +02:00
Lubomir Rintel
a21e890f82 Add close_range(2) support
This is a system call introduced in Linux 5.9.

It's typically used to bulk-close file descriptors that a process inherited
without having desired so and doesn't want to pass them to its offspring
for security reasons. For this reason the sensible upper limit value tends
to be unknown and the users prefer to stay on the safe side by setting it
high.

This is a bit peculiar because, if unfiltered, the syscall could end up
closing descriptors Valgrind uses for its purposes, ending in no end of
mayhem and suffering.

This patch adjusts the upper bounds to a safe value and then skips over
the descriptor Valgrind uses by potentially calling the real system call
with sub-ranges that are safe to close.

The call can fail on negative ranges and bad flags -- we're dealing with
the first condition ourselves while letting the real call fail on bad
flags.

https://bugs.kde.org/show_bug.cgi?id=439090
2021-10-12 22:58:45 +02:00
Mark Wielaard
cf9ebf8313 coregrind: Don't call final_tidyup (__libc_freeres) on FatalSignal
When a program gets a fatal signal (one it doesn't handle) valgrind
terminates the program. Before termination it will try to call
final_tidyup which tries to run __libc_freeres and
__gnu_cxx::__freeres to get rid of some memory glibc or libstdc++
don't normally release.

But when the program got the fatal signal in a critical section inside
glibc it might leave the datastructures in a bad state and cause
__libc_freeres to crash.  This makes valgrind itself crash just before
producing its own error summary, making the valgrind run unusable.

A reproducer can found at
https://bugzilla.redhat.com/show_bug.cgi?id=1952836 and
https://bugzilla.redhat.com/show_bug.cgi?id=1225994#c7

This reproducer is really a worse case scenario with multiple threads
racing to get into the critical section that when interrupted will
make __libc_freeres unable to cleanup. But it seems a good policy in
general. If a program is terminated by a fatal signal instead of
normal termination, it seems not having some of the glibc/libstdc++
resource cleaned up is an expected thing.

https://bugs.kde.org/show_bug.cgi?id=443605
2021-10-12 22:48:02 +02:00
Mark Wielaard
3eba47604d filter_gdb: Handle r = SYSCALL_CANCEL as alternative for return SYSCALL_CANCEL
This happens with glibc 2.33 when debuginfo is installed.
2021-10-12 22:44:08 +02:00
Paul Floyd
79a1439786 Fix building memalign2 test on older FreeBSD 2021-10-12 21:47:45 +02:00
Mark Wielaard
0b86d267c6 filter_xml: Filter out '@*' from <fn> symbol names
With glibc 2.34 we would start seeing some function names ending in
'@*' this was already filtered out using drd/tests/filter_stderr.in
but not when using the drd xml tests. This would make
drd/tests/thread_name_xml and drd/tests/bar_bad_xml fail.

Filter this out in the memcheck/tests/filter_xml script, which is
also used by the drd test filters.

Tested against glibc 2.34, 2.33 and 2.17 on x86_64.
2021-10-12 20:01:52 +02:00
Paul Floyd
22857ddd1d filter_stderr also needs to handle FreeBSD libthr 2021-10-12 19:31:04 +02:00
Mark Wielaard
df838bccab drd/tests: Extract start_thread which can come from libpthread or libc
The drd/tests/tc21_pthonce and drd/tests/annotate_barrier tests
would fail if start_thread came from libc (as it does in glibc 2.34)
instead of from libpthread. Extract start_thread in filter_stderr.in
and update the backtraces in annotate_barrier.stderr.exp and in
tc21_pthonce.stderr.exp

Tested against glibc 2.34, 2.33 and 2.17 on x86_64.
2021-10-12 18:51:23 +02:00
Paul Floyd
2269aeb76c Dnother iteration for getting the right expected line numbers. 2021-10-11 08:16:32 +02:00
Paul Floyd
46607a76bd memalign is available on FreeBSD as a non-portable interface
Remove #if block protecting memalign calls
2021-10-10 22:15:59 +02:00
Paul Floyd
8c0f72667e Fix the ramaining easily fixable warnings with clang
There's one remaining
memalign2.c:29:9: warning: unused variable 'piece' [-Wunused-variable]
because of a block of #if FreeBSD for memalign that looks unnecessary

Otherwise all that is left is a few like

warning: unknown warning option '-Wno-alloc-size-larger-than'; did you mean '-Wno-frame-larger-than='? [-Wunknown-warning-option]

because there is no standard for compiler arguments.
2021-10-10 21:56:49 +02:00
Paul Floyd
03f1c090f6 Remove a couple more warnings
suffix rule with dependency generates a warning
https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
(bottom of page)

the other is a short initialized with an int literal that wraps to
a negative short value
2021-10-10 20:32:44 +02:00
Mark Wielaard
bfd28bb9f8 Remove more warnings from tests
GCC12 catches various issues in tests at compile time that we want to
catch at runtime. Also glibc 2.34 deprecated various mallinfo related
functions. Add the relevant -Wno-foobar flags to those tests.  In one
case, unit_oset.c, the warning was correct and the uninitialized
variable was explicitly set.
2021-10-10 17:19:34 +02:00
Mark Wielaard
7b1a2b1edd Fix printf warning in libmpiwrap.c
libmpiwrap.c:1379:45: warning: format '%d' expects argument of type 'int',
but argument 5 has type 'MPI_Request' {aka 'struct ompi_request_t *'}

Unfortunately MPI_Request is an opaque type (we don't really know what
is in struct ompi_request_t) so we cannot simply print it as int. In
other places we print an MPI_Request as 0x%lx by casting it to an
unsigned long. Do the same here.
2021-10-10 16:38:24 +02:00
Mark Wielaard
4015813336 Remove some warnings from tests
Various tests do things which we want to detect at runtime, like
ignoring the result of malloc or doing a deliberate impossibly large
allocation or operations that would result in overflowing or
truncated strings, that generate a warning from gcc.

In once case, mq_setattr called with new and old attrs overlapping,
this was explicitly fixed, in others -Wno-foobar was added to silence
the warning. This is safe even for older gcc, since a compiler will
ignore any -Wno-foobar they don't know about - since they do know they
won't warn for foobar.
2021-10-10 15:56:50 +02:00
Paul Floyd
d187106a76 Updating a few expecteds based on valgrind-testresults
I tried to work out what the expecteds should be based on the changes to
the testcase source so there may be a bit more to do.
2021-10-10 12:03:38 +02:00
Paul Floyd
1c57706fbd Bug 443314 - In the latest GIT version, Valgrind with "--trace-flags" crashes at "al" register 2021-10-09 23:02:28 +02:00
Paul Floyd
c3002642d3 Bug 439326 - Valgrind 3.17.0 won't compile with Intel 2021 oneAPI compilers
Also reorder NEWS
2021-10-09 21:25:22 +02:00
Paul Floyd
80459895c4 FreeBSD support, last loose ends
One merge I missed and make a couple of changes to remove
compiler warnings.
2021-10-09 15:13:50 +02:00
Paul Floyd
68bb7c063f FreeBSD support, patch 12
coregrind modified files
2021-10-09 15:01:08 +02:00
Paul Floyd
e2e5d75f5c FreeBSD support, patch 11
coregrind added files
the key mechanics and the syscall wrappers
2021-10-09 14:11:48 +02:00
Paul Floyd
1bbd829adb FreeBSD support, patch 10
Missing new expected file
2021-10-09 12:51:41 +02:00
Paul Floyd
7c5d720a2b FreeBSD support, patch 10
memcheck
No code changes. A few modified tests. Adds new FreeBSD specific tests.
2021-10-09 12:37:17 +02:00
Paul Floyd
3c53eea626 Add copyright statements to added FreeBSD headers 2021-10-08 22:08:12 +02:00
Paul Floyd
a456fcef6d FreeBSD support, patch 9 supplemental
These files are now derived objects and should have been removed in the
previous change.
2021-10-07 23:02:29 +02:00
Paul Floyd
53dd9bd255 FreeBSD support, patch 9
cachegrind callgrind dhat exp-bbv gdbserver_tests massif none mpi shared

Mostly these are just updates (and new testcases) under new/tests
The other directories have just #ifdef changes
2021-10-07 22:41:22 +02:00
Paul Floyd
3d25fd4a6c FreeBSD support, patch 8b
nightly directory
2021-10-07 21:39:25 +02:00
Paul Floyd
85bbe2853e FreeBSD support, patch 5
drd and helgrind tests
2021-10-07 21:33:45 +02:00