16072 Commits

Author SHA1 Message Date
Petar Jovanovic
c6fbcbb12d mips64: change memcheck/tests/mips64/filter_stderr
This change removes backtrace line (posix_fadvise64.c) that is not always in
output of the failing test (fadvise64).
It fixes memcheck/tests/mips64/fadvise64 on MIPS64 platforms with glibc 2.27
or newer.

Patch by Dimitrije Nikolic.
2018-08-09 12:43:57 +02:00
Petar Jovanovic
f9606bc01c mips: add membarrier system call support
Fixes none/tests/linux/membarrier on MIPS platforms.
2018-08-07 14:09:43 +02:00
Mark Wielaard
2eb2df759f Bug 397012 - glibc ld.so uses arch_prctl on i386.
arch_prctl used to be amd64 only. But since linux 4.12 it is also
implemented for i386. And since glibc 2.28 ld.so will use it to see
if the cpu/kernel provides CET support.

To prevent seeing:

WARNING: unhandled x86-linux syscall: 384
You may be able to write your own handler.
Read the file README_MISSING_SYSCALL_OR_IOCTL.
Nevertheless we consider this a bug.  Please report
it at http://valgrind.org/support/bug_reports.html.

on every program run under valgrind just make it explicitly
not implemented (ENOSYS). This is fine for the glibc usage.
It just indicates there is no CET support.
2018-08-06 14:58:01 +02:00
Julian Seward
e527a93204 Update. 2018-08-06 11:05:31 +02:00
Philippe Waroquiers
b9cfb2d154 Fix a few leaks in VG_(make_core_dump)
Probably not very critical, as very surely the process will die
shortly after, but better still clean the memory, as the code
was already doing some effort to free memory (e.g. VG_(free)(seg_starts);).

Note that when testing on debian 9/amd64, the resulting core dump
was not very usable (e.g. was not really showing what the guest threads
are doing). So, there must be a bug in the core dumping logic.
2018-08-01 21:49:07 +02:00
Philippe Waroquiers
c97f132676 Fix segmentation violation caused by stack misalignment when vgdb use ptrace to force activate gdbserver
On amd64, on a big application, a vgdb call that wakes up the application
using ptrace fails unfrequently (we speak about one failure every few thousands vgdb calls).
The failure started to appear when valgrind was compiled with gcc 7.3 instead of gcc 6.4

After investigation:
* gcc 7.3 is using (more) sse instructions
* Such instructions imply to have a stack pointer aligned on 16 bytes.
* vgdb-invoker-ptrace.c 'ptrace' modification of the stack pointer was
  not respecting the amd64 ABI convention to align on 16 bytes.
  It was also not protecting the red zone (unclear if this could cause
  the problem, but in any case, this ptrace logic is similar to a
  signal handler, and cannot modify the redzone.

The fix consists in respecting the ABI.

Without the patch, segmentation violation due to an sse instruction
being executed with an address on the stack not aligned on 16 bytes,
happening something like every 5000 vgdb execution.
With the patch, 250_000 executions without problems.
2018-08-01 19:37:13 +02:00
Philippe Waroquiers
5f900edef1 Remove the useless (Addr) cast when calculating the highest stack byte addr
Cast not needed, as stack_low_addr is an Addr.
2018-07-31 00:08:38 +02:00
Philippe Waroquiers
400e0e2afe Fix wrong stack range output by commit 7daa08611 (more info in scheduler state)
The stack base starts at the beginning of the protection page/zone,
so we need to add VG_STACK_GUARD_SZB to get the real lowest usable
byte.
As the VgStack is an opaque type, add a function in aspacemgr to
return the Addr of the first lowest usable byte.
2018-07-30 22:56:31 +02:00
Mark Wielaard
21a01b13e2 Bug 396887 - arch_prctl should return EINVAL on unknown option.
Currently arch_prctl calls VG_(core_panic) when it sees an unknown
arch_prctl option which kills the process. glibc uses arch_prctl with
an (as yet) unknown option to see if the kernel supports CET. This
breaks any application running under valgrind on x86_64 with:

valgrind: the 'impossible' happened:
   Unsupported arch_prctl option

Thread 1: status = VgTs_Runnable (lwpid 19934)
==19934==    at 0x121A15: get_cet_status (cpu-features.c:28)
==19934==    by 0x121A15: init_cpu_features (cpu-features.c:474)
==19934==    by 0x121A15: dl_platform_init (dl-machine.h:228)
==19934==    by 0x121A15: _dl_sysdep_start (dl-sysdep.c:231)
==19934==    by 0x10A1D7: _dl_start_final (rtld.c:413)
==19934==    by 0x10A1D7: _dl_start (rtld.c:520)

We already handle all known options. It would be better to do as the
kernel does and just return failure with EINVAL instead.
2018-07-30 12:20:16 +02:00
Philippe Waroquiers
f772902b65 Fix uninitialised epoch when recording execontext.
A fresh execontext must have a DiEpoch_INVALID()
but the epoch was left uninitialised.

This was detected by self-hosting valgrind.
2018-07-29 21:37:25 +02:00
Julian Seward
6ab5152de6 Even more triaging. 2018-07-29 00:06:02 +02:00
Philippe Waroquiers
7daa086114 Give some more information in the scheduler information thread status
* In case a thread is executing a syscall, give the syscall no being
  executed.
* Show the address range of the valgrind stack, similarly to the client
  stack
2018-07-28 00:36:35 +02:00
Julian Seward
4cbc7f35da Update bug status. 2018-07-27 17:22:43 +02:00
Julian Seward
4a89cd323b Somewhat update bug status. 2018-07-27 16:52:38 +02:00
Philippe Waroquiers
496f7e50ac Show the stack trace info in case of Valgrind crash
The stack information can be useful together with the stacktraces.
2018-07-26 23:16:53 +02:00
Julian Seward
e3033e8908 Add 3_13_BUGSTATUS.txt to EXTRA_DIST. 2018-07-25 06:54:59 +02:00
Julian Seward
73e5bed5d1 Reorder bug sections in alphabetical order, for easier navigation. 2018-07-25 06:54:09 +02:00
Julian Seward
cf1561e30e Create 3_13_BUGSTATUS.txt and pull all new bug reports into it. 2018-07-25 06:19:45 +02:00
Julian Seward
d44563c49e Bug 385412 - s390x: new non-vector z13 instructions not implemented
Apart from instructions with vector operands, Valgrind does not implement the
additional z/Architecture instructions introduced with z13.

These are:
- load and zero rightmost byte (LZRF, LZRG);
- load logical and zero rightmost byte (LLZRGF);
- load halfword high immediate on condition (LOCHHI);
- load halfword immediate on condition (LOCHI, LOCGHI);
- load high on condition (LOCFHR, LOCFH);
- store high on condition (STOCFH);
- perform pseudorandom number operation (PPNO), with the functions
  PPNO-Query and PPNO-SHA-512-DRNG;
- load count to block boundary (LCBB).

Patches from Vadim Barkov (vbrkov@gmail.com), with coordination, testing
and format cleanups from Andreas Arnez (arnez@linux.ibm.com).
2018-07-24 10:10:40 +02:00
Julian Seward
53cf5739b3 Fix the test VPCMPESTRM_0x45_128 so that it doesn't depend on random junk in RAX and RDX.
This test fails sporadically (eg, on Fedora 27 with gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5))
because the tested instruction uses RAX and RDX as input, but the test framework doesn't
set them :-/, so the outcome basically depends on whatever junk the compiler left in those
registers beforehand.  As a result of this, all previous uses of RAX in the test have
been changed to use RSI instead.  n-i-bz.
2018-07-23 14:52:19 +02:00
Mark Wielaard
64aa729bfa Accept read-only PT_LOAD segments and .rodata.
The new binutils ld -z separate-code option creates multiple read-only
PT_LOAD segments and might place .rodata in a non-executable segment.

Allow and keep track of separate read-only segments and allow a readonly
page with .rodata section.

Based on patches from Tom Hughes <tom@compton.nu> and
H.J. Lu <hjl.tools@gmail.com>.

https://bugs.kde.org/show_bug.cgi?id=395682
2018-07-16 15:09:35 +02:00
Julian Seward
f5a206ccae arm64 front end: do early writeback for "str dX, [sp, #-imm]!". n-i-bz.
This is needed to make Memcheck usable on arm64 code generated by clang 6.
2018-07-14 15:50:43 +02:00
Julian Seward
2a459a7d07 arm64 front end: add spec rules for {EQ,NE} after {LOGIC32,LOGIC64}. 2018-07-14 15:47:32 +02:00
Julian Seward
5b7b6662f2 Add some initialisations that seemed to be required as a result of an LTO build with a gcc 8 prerelease. 2018-07-14 15:39:59 +02:00
Philippe Waroquiers
f008d35bb3 Minor reformatting
Fix a few inconsistencies in formatting.
In particular, when an expression is split on several lines,
put the operators (e.g. && , ||, +, -, ...) at the beginning
of the new line : this seems to be more common
in the code, and is the coding convention used e.g. in gcc/gdb
(and incidently also at my work :)).
2018-06-29 22:46:24 +02:00
Ivo Raisr
a9006c7e92 Follow up to changeset 410d736a9928f535e2591c9d5f32e8e0941f96d8.
Fixes BZ#390471.
Patch by: Matthias Schwarzott <zzam@gentoo.org>
2018-06-26 22:49:42 +02:00
Carl Love
3df8d81f00 PPC32, update expected results for jm_vec_isa_2_07.c.
Add missing mtvsrwa, mtfprd, mtvrwa, mtvrd results.

Signed-off-by: Carl Love <carll@us.ibm.com>
2018-06-26 09:51:44 -05:00
Carl Love
1f69ed86e9 Fix ppc32 results for test_isa_2_06_part3.c.
The ppc32 results were not updated when the xvnegsp instruction support
was added.  Add the xvnegsp 32-bit results to
ppc/test_isa_2_06_part3.stdout.exp.

Signed-off-by: Carl Love <carll@us.ibm.com>
2018-06-26 09:46:26 -05:00
Ivo Raisr
410d736a99 Ability to add suppressions based on source file name and line number.
Fixes BZ#390471.
Patch based on work by: Jeff Frontz <jeff.frontz@gmail.com> and Joseph M Link.
2018-06-26 06:36:12 +02:00
Carl Love
9c5d762904 PPC64, add support for the xvnegsp instruction. Add test case for the instruction.
https://bugs.kde.org/show_bug.cgi?id=395709

Signed-off-by: Carl Love <carll@us.ibm.com>
2018-06-21 17:27:40 -05:00
Petar Jovanovic
1910188124 Add processing of sized delete operators into filter_libc
C++14 introduces sized delete operators and Valgrind support is added
by 6ef6f73. In addition, stderr filter which is used by Regtest should
be able to recognize this particular form in error report (just like
the other kinds of delete operators) in order to provide uniform output.

Fixes memcheck/tests/mismatches failure on non C++14 builds.

Patch by Aleksandar Rikalo.
2018-06-21 11:59:51 +02:00
Mark Wielaard
6fbd9bf771 Implement ptrace syscall wrapper for arm64-linux.
With this valgrind is able to run gdb on arm64.
Also fixes the memcheck/tests/linux/getregset testcase.

https://bugs.kde.org/show_bug.cgi?id=368913
2018-06-21 08:17:41 +02:00
Mark Wielaard
fbbb696c5d Mask AT_HWCAPS on arm64 to those instructions VEX implements.
This patch makes sure that the process running under valgrind only sees
the AES, PMULL, SHA1, SHA2, CRC32, FP, and ASIMD features in auxv AT_HWCAPS.

https://bugs.kde.org/show_bug.cgi?id=381556
2018-06-21 08:17:11 +02:00
Petar Jovanovic
90daa486e8 Update .gitignore
Add none/tests/linux/membarrier to .gitignore.
It was introduced with e9a82f3d759189868f7bdb33729dfe4c0bbc119c.
2018-06-20 13:20:24 +00:00
Mark Wielaard
ad4481d23a Add workaround for arm64 AT_HWCAP on newer kernels. Bug KDE#381556.
Starting with linux 4.11 the kernel started to populate the AT_HWCAPS
auxv entry. And glibc 2.26 now uses this to see whether it can use the
mrs instruction and certain feature registers on arm64. Since these
are not supported under valgrind this causes an unhandled instruction
error. Workaround this for now my just clearing the AT_HWCAPS on arm64.

This should be fixed properly by someone with knowledge of what each
of the arm64 HWCAPS bits mean and which bits correspond to instructions
and registers supported by VEX or not.
https://bugs.kde.org/show_bug.cgi?id=381556
2018-06-18 15:07:27 +02:00
Mark Wielaard
c76123d32c none/tests/linux/membarrier.vgtest: Only execute if membarrier exists. 2018-06-16 23:25:48 +02:00
Mark Wielaard
7f4e06881c none/tests/linux/Makefile.am: Fix membarrier.st[d]err.exp typo. 2018-06-16 23:02:39 +02:00
Bart Van Assche
e9a82f3d75 Add a test program for the membarrier() system call
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-06-15 08:25:32 -07:00
Bart Van Assche
959a54cb3a Add support for the Linux membarrier() system call
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-06-15 08:25:28 -07:00
Petar Jovanovic
2e46d39c89 Update .ignore for gdbserver_tests directory
Ignore all *.diff* files (such as *.diff-solaris*).
2018-06-15 13:50:58 +00:00
Petar Jovanovic
925414b384 fix make distclean failure
commit 85cd72c0a80d64ddbfd3156743037925bb7f8f5f
"Add the drd/tests/bug322621 regression test"

introduced make distclean failure.
Fix it by using symlink instead of a relative path in
drd/tests/Makefile.

Also, revert "ignore .dirstamp file appearing in helgrind/tests directory"
This reverts commit 718b47e184bc090b9f2a5f22904f59a272c9018d.
2018-06-15 13:44:14 +00:00
Petar Jovanovic
93a1edae3f mips64: add N32 ABI support in NEWS
Announce support for MIPS N32 ABI.
2018-06-14 18:25:47 +00:00
Petar Jovanovic
58c1c98db4 mips64: update tests for N32 ABI
Fix n32/n64 types mismatch in none, memcheck and helgrind tests.

BZ issue - #345763.

Contributed by:
  Dimitrije Nikolic, Aleksandar Rikalo, Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Petar Jovanovic
9a6cf7a41c mips64: add N32 ABI support
Adding MIPS N32 ABI support.

BZ issue - #345763.

Contributed and maintained by mulitple people over the years:
  Crestez Dan Leonard, Maran Pakkirisamy, Dimitrije Nikolic,
  Aleksandar Rikalo, Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Petar Jovanovic
ac58a6b857 mips64: use RegWord where appplicable
Use RegWord type in mips64.

Part of the changes required for MIPS N32 ABI support.
BZ issue - #345763.

Contributed by:
  Dimitrije Nikolic, Aleksandar Rikalo and Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Petar Jovanovic
8b2fe98aca additional use of RegWord
Follow up to "Introduce RegWord type" change.

Part of the changes required for BZ issue - #345763.

Contributed by:
  Tamara Vlahovic and Dimitrije Nikolic.
2018-06-14 17:40:08 +00:00
Petar Jovanovic
06546d831d mips64: define _VKI_NSIG_BPW based on the size of long
Define _VKI_NSIG_BPW in a similar way to how _NSIG_BPW is defined in kernel.

This will be important for N32 ABI changes. (BZ #345763)
2018-06-14 17:38:20 +00:00
Rhys Kidd
92d6a53886 Fix missing kevent_qos syscall (macOS 10.11). bz#383723
Based upon patch from Alexandru Croitor.
2018-06-03 12:53:18 -04:00
Julian Seward
3217cfbfdf arm64-linux: VG_(sigframe_destroy): restore int regs, PC and SP from the sigcontext previously presented to the handler. n-i-bz.
So as to correctly (well, less incorrectly) simulate handlers that change
register state in the sigcontext they are given in the expectation that the
change will take effect immediately upon the handler returning.
2018-05-31 17:03:08 +02:00
Philippe Waroquiers
6ef6f738ac Fix 372347 - Replacement problem of the additional c++14/c++17 new and delete operators
Patch by Paul Floyd, with comments slightly updated.

At the same time, cleanup of the trailing whitespaces in the whole file.

memcheck/tests/mismatches now shows the 'operator delete(void*, unsigned long)'
in the stacktrace, so updated the test expected output.
2018-05-29 21:10:13 +02:00