]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
7 years agoUpdate bug status.
Julian Seward [Fri, 27 Jul 2018 15:22:43 +0000 (17:22 +0200)] 
Update bug status.

7 years agoSomewhat update bug status.
Julian Seward [Fri, 27 Jul 2018 14:51:10 +0000 (16:51 +0200)] 
Somewhat update bug status.

7 years agoShow the stack trace info in case of Valgrind crash
Philippe Waroquiers [Thu, 26 Jul 2018 21:16:53 +0000 (23:16 +0200)] 
Show the stack trace info in case of Valgrind crash

The stack information can be useful together with the stacktraces.

7 years agoAdd 3_13_BUGSTATUS.txt to EXTRA_DIST.
Julian Seward [Wed, 25 Jul 2018 04:54:59 +0000 (06:54 +0200)] 
Add 3_13_BUGSTATUS.txt to EXTRA_DIST.

7 years agoReorder bug sections in alphabetical order, for easier navigation.
Julian Seward [Wed, 25 Jul 2018 04:54:09 +0000 (06:54 +0200)] 
Reorder bug sections in alphabetical order, for easier navigation.

7 years agoCreate 3_13_BUGSTATUS.txt and pull all new bug reports into it.
Julian Seward [Wed, 25 Jul 2018 04:19:45 +0000 (06:19 +0200)] 
Create 3_13_BUGSTATUS.txt and pull all new bug reports into it.

7 years agoBug 385412 - s390x: new non-vector z13 instructions not implemented
Julian Seward [Tue, 24 Jul 2018 08:10:40 +0000 (10:10 +0200)] 
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).

7 years agoFix the test VPCMPESTRM_0x45_128 so that it doesn't depend on random junk in RAX...
Julian Seward [Mon, 23 Jul 2018 12:52:19 +0000 (14:52 +0200)] 
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.

7 years agoAccept read-only PT_LOAD segments and .rodata.
Mark Wielaard [Thu, 12 Jul 2018 11:56:00 +0000 (13:56 +0200)] 
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

7 years agoarm64 front end: do early writeback for "str dX, [sp, #-imm]!". n-i-bz.
Julian Seward [Sat, 14 Jul 2018 13:50:43 +0000 (15:50 +0200)] 
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.

7 years agoarm64 front end: add spec rules for {EQ,NE} after {LOGIC32,LOGIC64}.
Julian Seward [Sat, 14 Jul 2018 13:47:32 +0000 (15:47 +0200)] 
arm64 front end: add spec rules for {EQ,NE} after {LOGIC32,LOGIC64}.

7 years agoAdd some initialisations that seemed to be required as a result of an LTO build with...
Julian Seward [Sat, 14 Jul 2018 13:39:59 +0000 (15:39 +0200)] 
Add some initialisations that seemed to be required as a result of an LTO build with a gcc 8 prerelease.

7 years agoMinor reformatting
Philippe Waroquiers [Fri, 29 Jun 2018 20:46:24 +0000 (22:46 +0200)] 
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 :)).

7 years agoFollow up to changeset 410d736a9928f535e2591c9d5f32e8e0941f96d8.
Ivo Raisr [Tue, 26 Jun 2018 17:17:23 +0000 (19:17 +0200)] 
Follow up to changeset 410d736a9928f535e2591c9d5f32e8e0941f96d8.

Fixes BZ#390471.
Patch by: Matthias Schwarzott <zzam@gentoo.org>

7 years agoPPC32, update expected results for jm_vec_isa_2_07.c.
Carl Love [Tue, 26 Jun 2018 14:51:11 +0000 (09:51 -0500)] 
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>
7 years agoFix ppc32 results for test_isa_2_06_part3.c.
Carl Love [Mon, 25 Jun 2018 21:24:14 +0000 (16:24 -0500)] 
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>
7 years agoAbility to add suppressions based on source file name and line number.
Ivo Raisr [Mon, 25 Jun 2018 19:52:08 +0000 (21:52 +0200)] 
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.

7 years agoPPC64, add support for the xvnegsp instruction. Add test case for the instruction.
Carl Love [Thu, 21 Jun 2018 22:27:40 +0000 (17:27 -0500)] 
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>
7 years agoAdd processing of sized delete operators into filter_libc
Petar Jovanovic [Thu, 21 Jun 2018 09:59:20 +0000 (11:59 +0200)] 
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.

7 years agoImplement ptrace syscall wrapper for arm64-linux.
Mark Wielaard [Tue, 19 Jun 2018 16:26:43 +0000 (18:26 +0200)] 
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

7 years agoMask AT_HWCAPS on arm64 to those instructions VEX implements.
Mark Wielaard [Tue, 19 Jun 2018 16:00:45 +0000 (18:00 +0200)] 
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

7 years agoUpdate .gitignore
Petar Jovanovic [Wed, 20 Jun 2018 13:20:24 +0000 (13:20 +0000)] 
Update .gitignore

Add none/tests/linux/membarrier to .gitignore.
It was introduced with e9a82f3d759189868f7bdb33729dfe4c0bbc119c.

7 years agoAdd workaround for arm64 AT_HWCAP on newer kernels. Bug KDE#381556.
Mark Wielaard [Mon, 18 Jun 2018 13:07:27 +0000 (15:07 +0200)] 
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

7 years agonone/tests/linux/membarrier.vgtest: Only execute if membarrier exists.
Mark Wielaard [Sat, 16 Jun 2018 21:25:48 +0000 (23:25 +0200)] 
none/tests/linux/membarrier.vgtest: Only execute if membarrier exists.

7 years agonone/tests/linux/Makefile.am: Fix membarrier.st[d]err.exp typo.
Mark Wielaard [Sat, 16 Jun 2018 21:02:39 +0000 (23:02 +0200)] 
none/tests/linux/Makefile.am: Fix membarrier.st[d]err.exp typo.

7 years agoAdd a test program for the membarrier() system call
Bart Van Assche [Thu, 14 Jun 2018 20:39:30 +0000 (13:39 -0700)] 
Add a test program for the membarrier() system call

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
7 years agoAdd support for the Linux membarrier() system call
Bart Van Assche [Fri, 15 Jun 2018 15:24:53 +0000 (08:24 -0700)] 
Add support for the Linux membarrier() system call

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
7 years agoUpdate .ignore for gdbserver_tests directory
Petar Jovanovic [Fri, 15 Jun 2018 13:50:58 +0000 (13:50 +0000)] 
Update .ignore for gdbserver_tests directory

Ignore all *.diff* files (such as *.diff-solaris*).

7 years agofix make distclean failure
Petar Jovanovic [Fri, 15 Jun 2018 12:37:33 +0000 (12:37 +0000)] 
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.

7 years agomips64: add N32 ABI support in NEWS
Petar Jovanovic [Thu, 14 Jun 2018 18:25:47 +0000 (18:25 +0000)] 
mips64: add N32 ABI support in NEWS

Announce support for MIPS N32 ABI.

7 years agomips64: update tests for N32 ABI
Petar Jovanovic [Thu, 14 Jun 2018 15:34:38 +0000 (15:34 +0000)] 
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.

7 years agomips64: add N32 ABI support
Petar Jovanovic [Thu, 14 Jun 2018 15:26:09 +0000 (15:26 +0000)] 
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.

7 years agomips64: use RegWord where appplicable
Petar Jovanovic [Thu, 14 Jun 2018 14:00:39 +0000 (14:00 +0000)] 
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.

7 years agoadditional use of RegWord
Petar Jovanovic [Wed, 13 Jun 2018 16:26:14 +0000 (16:26 +0000)] 
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.

7 years agomips64: define _VKI_NSIG_BPW based on the size of long
Petar Jovanovic [Wed, 13 Jun 2018 16:16:52 +0000 (16:16 +0000)] 
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)

7 years agoFix missing kevent_qos syscall (macOS 10.11). bz#383723
Rhys Kidd [Sun, 3 Jun 2018 16:40:13 +0000 (12:40 -0400)] 
Fix missing kevent_qos syscall (macOS 10.11). bz#383723

Based upon patch from Alexandru Croitor.

7 years agoarm64-linux: VG_(sigframe_destroy): restore int regs, PC and SP from the sigcontext...
Julian Seward [Thu, 31 May 2018 15:03:08 +0000 (17:03 +0200)] 
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.

7 years agoFix 372347 - Replacement problem of the additional c++14/c++17 new and delete operators
Philippe Waroquiers [Tue, 29 May 2018 18:48:15 +0000 (20:48 +0200)] 
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.

7 years agoPoint the kcachegrind link to the up to date page
Philippe Waroquiers [Wed, 16 May 2018 21:43:15 +0000 (23:43 +0200)] 
Point the kcachegrind link to the up to date page

http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindIndex
page indicates to rather go to
https://kcachegrind.github.io/html/Home.html
so update the doc accordingly.

7 years agoannounce fix 392449 callgrind not clearing the number of calls properly
Philippe Waroquiers [Wed, 16 May 2018 20:44:24 +0000 (22:44 +0200)] 
announce fix 392449  callgrind not clearing the number of calls properly

(fix in commit d48686)

7 years agocallgrind: fix setting call counter to zero if requested
Josef Weidendorfer [Tue, 15 May 2018 18:11:41 +0000 (20:11 +0200)] 
callgrind: fix setting call counter to zero if requested

We did not set the call cost counters in CLG_(zero_bbcc) to zero,
which gets called by requests to set counters to zero
- via client request
- when entering a function if configured so
- via gdb monitor command (used by callgrind_control -z)

Counters are also set to zero after they are dumped out to a file.
This does not use CLG_(zero_bbcc), and was doing the right thing.

This fixes bug 392449.

7 years agoemit_ARM64Instr: fix assertion failures associated with chaining patching (ARM64in_XD...
Julian Seward [Sat, 5 May 2018 08:03:26 +0000 (10:03 +0200)] 
emit_ARM64Instr: fix assertion failures associated with chaining patching (ARM64in_XDirect).  n-i-bz.

This has happened because (I think!) this has never before been tested with
guest code addresses >= 2^48.  This in turn means that this is the first
time that

  p = imm64_to_ireg(p, /*x*/9, i->ARM64in.XDirect.dstGA);

has been called upon to emit a constant which is non-zero in all four 16-bit
chunks, so it generates 4 instructions rather than (at most, in all previous
runs) 3, and so the "how many insns at max" assertions failed.  This commit
fixes the assertions.

7 years agoAdd extra __ubsan failure functions needed to un-break ubsanified builds with gcc 8.
Julian Seward [Sat, 5 May 2018 08:00:46 +0000 (10:00 +0200)] 
Add extra __ubsan failure functions needed to un-break ubsanified builds with gcc 8.

7 years agoComment out test "(INSNA(6,6) == 0 || INSNA(6,6) == 1)" that gcc 8 complains (correc...
Julian Seward [Sat, 5 May 2018 07:49:02 +0000 (09:49 +0200)] 
Comment out test "(INSNA(6,6)  == 0 || INSNA(6,6) == 1)" that gcc 8 complains (correctly) is always true.  No functional change.

7 years agoAdd missing EXTRA_DIST file libstdc++.supp
Philippe Waroquiers [Sun, 22 Apr 2018 21:31:54 +0000 (23:31 +0200)] 
Add missing EXTRA_DIST file libstdc++.supp

Otherwise leak_cpp_interior test fails from a make dist tarball

7 years agocompilation of dist tarball fails due to missing libvex_inner.h
Philippe Waroquiers [Sun, 22 Apr 2018 20:49:50 +0000 (22:49 +0200)] 
compilation of dist tarball fails due to missing libvex_inner.h

Problem found by/patch by: Roman Kapl

7 years agoDon't read build-id ELF Note in .debug file through phdrs.
Mark Wielaard [Mon, 16 Apr 2018 14:53:56 +0000 (16:53 +0200)] 
Don't read build-id ELF Note in .debug file through phdrs.

Bug #393062 - Reading build-id ELF note through phdrs triggers
              "debuginfo reader: ensure_valid failed"

Skip the phdrs when we have to search the shdrs. In separate
.debug files the phdrs might not be valid (they are a copy of
the main ELF file) and might trigger assertions when getting
image notes based on them.

7 years agoFix 393023 - callgrind_control risks using the wrong vgdb
Philippe Waroquiers [Sun, 15 Apr 2018 10:41:48 +0000 (12:41 +0200)] 
Fix 393023 - callgrind_control risks using the wrong vgdb

Search for a vgdb executable in the same dir as callgrind_control perl file.
If not found, search for a vgdb executable in a sibling coregrind dir
   (covers the case of :   perl  callgrind/callgrind_control)
Otherwise, just hope we find a vgdb executable in PATH

7 years agoAnnounce fix for 393099 - posix_memalign() invalid write if alignment == 0
Philippe Waroquiers [Sun, 15 Apr 2018 06:08:38 +0000 (08:08 +0200)] 
Announce fix for 393099 - posix_memalign() invalid write if alignment == 0

Fix was committed in d9204e9eedc

7 years agoFix 393099 - posix_memalign() invalid write if alignment == 0
Philippe Waroquiers [Sun, 15 Apr 2018 06:06:43 +0000 (08:06 +0200)] 
Fix 393099 - posix_memalign() invalid write if alignment == 0

Bug and analysis by Gabriel Ganne

7 years agoignore .dirstamp file appearing in helgrind/tests directory
Philippe Waroquiers [Sat, 14 Apr 2018 19:45:08 +0000 (21:45 +0200)] 
ignore .dirstamp file appearing in helgrind/tests directory

7 years agoUnbreak build on macos,
Philippe Waroquiers [Sat, 14 Apr 2018 19:27:26 +0000 (21:27 +0200)] 
Unbreak build on macos,

(problem introduced by 54145019b045fffde625447b64f3a91f663de718)

7 years agoFix 393017 - Add missing support for xsmaxcdp instruction, bug fixes for xsm
Carl Love [Wed, 11 Apr 2018 19:03:29 +0000 (14:03 -0500)] 
Fix 393017 - Add missing support for xsmaxcdp instruction, bug fixes for xsm

Missed the update to none/tests/ppc64/Makefile.am to remove the
expected output files test_isa_3_0_altivec.stdout.exp and
test_isa_3_0_other.stdout.exp.

7 years agoFix 393017 - Add missing support for xsmaxcdp instruction, bug fixes for xsmincdp...
Carl Love [Wed, 11 Apr 2018 17:51:21 +0000 (12:51 -0500)] 
Fix 393017 - Add missing support for xsmaxcdp instruction, bug fixes for xsmincdp, lxssp, stxssp and stxvl instructions.

Add support for instruction xsmaxcdp in VEX/priv/guest_ppc_toIR.c.

Fixes in file VEX/priv/guest_ppc_toIR.c for xsmaxcdp, xsmincdp, lxssp,
stxssp and stxvl instructions.

Fix compiler issues with optimization option -O2 for test
none/tests/ppc64/test_isa_3_0.c.

Add test case test_xsmaxcdpi to test file none/tests/ppc64/test_isa_3_0.c.

Fixes to test none/tests/ppc64/test_isa_3_0.c for compiling inline functions
with optimization -O0.  Assembly instruction fixes, test argument array size
fixes, max loop index fixes. Condition code register fixes to fix control
flow issues when compiled with optimization.

Update expected results for test_isa_3_0_altivec.stdout.exp-LE and
test_isa_3_0_other.stdout.exp-LE.

7 years agoIntroduce RegWord type
Petar Jovanovic [Tue, 10 Apr 2018 12:09:08 +0000 (14:09 +0200)] 
Introduce RegWord type

On majority of architectures size of long matches register width.
On mips n32 size of long is 32 bits and register width is 64 bits.
Valgrind is written with assumption that long size matches register
width. This is the reason why both UWord for Valgrind and HWord for VEX
match size of long. Long size differs from register size on mips n32 ABI.

Introducing RegWord type that will match size of registers.

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

Contributed by:
  Tamara Vlahovic and Dimitrije Nikolic.

7 years agomips64: use register numbers instead of aliases for inline assembly
Petar Jovanovic [Wed, 4 Apr 2018 09:51:05 +0000 (11:51 +0200)] 
mips64: use register numbers instead of aliases for inline assembly

There is an inconsistency in MIPS tools for N32/N64 related to register
aliases. To avoid ambiguity, use register numbers instead of aliases where
needed.

7 years agon-i-bz Fix possible stack trashing by semctl syscall wrapping
Philippe Waroquiers [Sun, 1 Apr 2018 12:31:40 +0000 (14:31 +0200)] 
n-i-bz  Fix possible stack trashing by semctl syscall wrapping

The modified test none/tests/sem crashes with a SEGV when valgrind is compiled
with lto on various amd64 platforms (debian/gcc 6.3, RHEL7/gcc 6.4,
Ubuntu/gcc 7.2)

The problem is that the vki_semid_ds buf is not what is expected by the kernel:
the kernel expects a bigger structure vki_semid64_ds (at least on
these platforms).
Getting the sem_nsems seems to work by chance, as sem_nsems is at
the same offset in both vki_semid_ds and vki_semid64_ds.
However, e.g. the ctime was not set properly after syscall return,
and 2 words after sem_nsems were set to 0 by the kernel, causing
the SEGV, as a spilled register became 0.

Fix consists in using the 64 bit version for __NR_semctl.
Tested on debian/amd64 and s390x.

7 years agohelgrind: properly condition test for bug322621 upon pthread_barrier support
Rhys Kidd [Thu, 29 Mar 2018 00:52:52 +0000 (20:52 -0400)] 
helgrind: properly condition test for bug322621 upon pthread_barrier support

Fixes: 9cf3d01 ("Add the helgrind/tests/bug322621 regression test")
7 years agoFix 391861 - Massif Assertion 'n_ips >= 1 && n_ips <= VG_(clo_backtrace_size)'
Philippe Waroquiers [Wed, 21 Mar 2018 22:24:09 +0000 (23:24 +0100)] 
Fix 391861 - Massif Assertion 'n_ips >= 1 && n_ips <= VG_(clo_backtrace_size)'

Sometimes, at least on arm platforms, we get a stack trace with
only one function.
When this happens and massif removes the top fn, we end up trying
to create an execontext of 0 ips, as the only fn is removed,
and an execontext of 0 ips causes the assert in m_execontext.c

So, do whatever to avoid to crash when having a single fn stacktrace.

The whatever means use a null execontext, which is an execontext
of one single address 0x0.
Note that this is just to bypass the crash.
What is shown by massif is not very nice (but what could we show ?).

Note that instead of using such a null execontext, we could rather
just keep the single ips. But that might create a lot of single fn
entries in the xtree and/or show undesired functions.

So, we the null execontext, which is shown as 0xFFFFFFFFFFFFFFFF ???
in the massif output.

Tested on amd64 by artificially creating stacktrace of one fn.

7 years agoUpdate linux system call numbers.
Tom Hughes [Wed, 21 Mar 2018 12:28:31 +0000 (12:28 +0000)] 
Update linux system call numbers.

7 years agoFix 338252 - building valgrind with -flto (link time optimisation) fails
Philippe Waroquiers [Sun, 11 Mar 2018 21:26:08 +0000 (22:26 +0100)] 
Fix 338252 - building valgrind with -flto (link time optimisation) fails

* Addition of a new configure option --enable-lto=yes or --enable-lto=no
  Default value is --enable-lto=no, as the build is significantly slower,
  so is not appropriate for valgrind development : this should be used
  only on buildbots and/or by packagers.

* Some files containins asm functions have to be compiled without lto:
    coregrind/m_libcsetjmp.c
    coregrind/m_main.c
  If these are compiled with lto, that gives undefined symbols at link time.
  The files to compile without lto are
    coregrind/m_libcsetjmp.c
    coregrind/m_main.c

  To compile these files with other options, a noinst target lib is defined.
  The objects of this library are then added to the libcoregrind.

* memcheck/mc_main.c : move the handwritten asm helpers to mc_main_asm.c.
  This avoids undefined symbols on some toolchains. Due to this,
  the preprocessor symbols that activate the fast or asm memcheck helpers
  are moved to mc_include.h
  Platforms with handwritten helpers will also have the memcheck primary
  map defined non static.

* In VEX, auxprogs/genoffsets.c also has to be compiled without lto,
  as the asm produced by the compiler is post-processed to produce
  pub/libvex_guest_offsets.h. lto not producing asm means the generation
  fails if we used -flto to compile this file.

* all the various Makefile*am are modified to use LTO_CFLAGS for
  (most) targets. LTO_CFLAGS is empty when --enable-lto=no,
  otherwise is set to the flags needed for gcc.
  If --enable-lto=no, LTO_AR and LTO_RANLIB are the standard AR and RANLIB,
  otherwise they are the lto capable versions (gcc-ar and gcc-ranlib).

* This has been tested on:
    debian 9.4/gcc 6.3.0/amd64+x86
    rhel 7.4/gcc 6.4.0/amd64
    ubuntu 17.10/gcc 7.2.0/amd64+x86
    fedora26/gcc 7.3.1/s390x

  No regressions on the above.

7 years agoAdd the drd/tests/bug322621 regression test
Bart Van Assche [Sun, 18 Mar 2018 05:12:31 +0000 (22:12 -0700)] 
Add the drd/tests/bug322621 regression test

7 years agoAdd DRD suppression patterns for races triggered by std::ostream
Bart Van Assche [Sat, 17 Mar 2018 21:28:36 +0000 (14:28 -0700)] 
Add DRD suppression patterns for races triggered by std::ostream

7 years agoAdd the helgrind/tests/bug322621 regression test
Bart Van Assche [Sat, 17 Mar 2018 20:50:05 +0000 (13:50 -0700)] 
Add the helgrind/tests/bug322621 regression test

7 years agodrd/tests/Makefile.am: Use -faligned-new for C++ code if supported
Bart Van Assche [Sat, 17 Mar 2018 22:02:10 +0000 (15:02 -0700)] 
drd/tests/Makefile.am: Use -faligned-new for C++ code if supported

7 years agoconfigure.ac: Detect support for -faligned-new
Bart Van Assche [Sat, 17 Mar 2018 22:01:35 +0000 (15:01 -0700)] 
configure.ac: Detect support for -faligned-new

7 years agoIgnore redundant addr16 prefix on relative call
Tom Hughes [Thu, 31 Aug 2017 14:58:11 +0000 (15:58 +0100)] 
Ignore redundant addr16 prefix on relative call

BZ#384230

7 years agoLinux: Add support for the zoned block device ioctls
Bart Van Assche [Thu, 8 Mar 2018 20:57:41 +0000 (12:57 -0800)] 
Linux: Add support for the zoned block device ioctls

Shingled magnetic recording drives support a command set called ZBC
(Zoned Block Commands). Two new ioctls have been added to the Linux
kernel to support such drives, namely VKI_BLKREPORTZONE and
VKI_BLKRESETZONE. Add support to Valgrind for these ioctls.

7 years agoLinux: Add support for the BLKFLSBUF ioctl
Bart Van Assche [Mon, 12 Mar 2018 16:43:38 +0000 (09:43 -0700)] 
Linux: Add support for the BLKFLSBUF ioctl

7 years agoFix 389373 - exp-sgcheck the 'impossible' happened as Ist_LoadG is not instrumented
Philippe Waroquiers [Sun, 11 Mar 2018 14:57:46 +0000 (15:57 +0100)] 
Fix 389373 - exp-sgcheck the 'impossible' happened as Ist_LoadG is not instrumented

So, (try to) instrument a guarded load.

(there was a discussion about dropping exp-sgcheck but this was
causing all tests to fail, so doing a quick fix in the meantime).

7 years agoauxprogs/make_or_upd_vgversion_h : accept a git worktree as a git dir
Philippe Waroquiers [Sun, 11 Mar 2018 14:12:54 +0000 (15:12 +0100)] 
auxprogs/make_or_upd_vgversion_h : accept a git worktree as a git dir

A directory can be a git directory in 2 cases:
  * it is a git repository, checked with -d .git
  + it is a git worktree directory (see git help worktree)

Modify auxprogs/make_or_upd_vgversion_h so that it detects worktree directory
and produces a correct git version for --version -v

7 years agoremove obsolete/non working ways to modify CFLAGS in memcheck/Makefile.am
Philippe Waroquiers [Sat, 10 Mar 2018 12:54:24 +0000 (13:54 +0100)] 
remove obsolete/non working ways to modify CFLAGS in memcheck/Makefile.am

memcheck/Makefile.am contains 2 CFLAGS modifications lines that
are not working.
Remove these confusing lines.

(I have checked that the proper flags are still used for the 2 involved files)

7 years agoVG_(archive_ExeContext_in_range): add missing comma in message to user.
Julian Seward [Fri, 9 Mar 2018 18:21:30 +0000 (19:21 +0100)] 
VG_(archive_ExeContext_in_range): add missing comma in message to user.

7 years agoVG_(di_notify_mmap): don't complain about being unable to stat64/stat files in /dev...
Julian Seward [Fri, 9 Mar 2018 18:17:06 +0000 (19:17 +0100)] 
VG_(di_notify_mmap): don't complain about being unable to stat64/stat files in /dev/shm/.

Some applications cause this message to be emitted hundreds of times, which is annoying.

7 years agocoregrind/m_debuglog.c: fix incorrect inline assembly for amd64-linux.
Julian Seward [Fri, 9 Mar 2018 18:03:26 +0000 (19:03 +0100)] 
coregrind/m_debuglog.c: fix incorrect inline assembly for amd64-linux.

This adds rcx and r11 to the trash lists for inline assembly in
local_sys_write_stderr and local_sys_getpid, since those registers are not
preserved across the embedded syscall that takes us into the kernel.  I
believe this to be the root cause of the apparent code generation bug
addressed in 53faacfda4ad6a27bc0e8ab859c1cc5388a61a5e (16 Nov 2017).  This
commit also undoes that commit, because I think it is no longer necessary.

7 years agoAdd spec rules so as to complete the set {BE/NBE, B/NB, Z/NZ and P/NP} after COPY.
Julian Seward [Fri, 9 Mar 2018 17:55:57 +0000 (18:55 +0100)] 
Add spec rules so as to complete the set {BE/NBE, B/NB, Z/NZ and P/NP} after COPY.

These are primarily used in floating point comparisons.

7 years agoMEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup.
Julian Seward [Fri, 9 Mar 2018 17:51:39 +0000 (18:51 +0100)] 
MEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup.

7 years agoAdd replacements for wmemchr() and wcsnlen() on Linux.
Nick Alcock [Wed, 28 Feb 2018 15:20:11 +0000 (15:20 +0000)] 
Add replacements for wmemchr() and wcsnlen() on Linux.

These have gained ifunc support in recent glibc releases,
so need replacement.
Fixes BZ#388862

Patch by: Nix <nix@esperi.org.uk>

7 years agoPPC64, Fix tests for mtvsrwa and mtfprd.
Carl Love [Thu, 1 Mar 2018 19:50:56 +0000 (13:50 -0600)] 
PPC64, Fix tests for mtvsrwa and mtfprd.

Fix the register constraints for the vtvsrwa and mtfprd instructions
in test_isa_2_07_part2.c.  Update the expected output in
none/tests/jm_vec_isa_2_07.stdout.exp.

7 years agoPPC64, Missing tests for mtvsrwa, mtvrwa, mtvrd, and mtfprd.
Carl Love [Tue, 27 Feb 2018 23:52:01 +0000 (17:52 -0600)] 
PPC64, Missing tests for mtvsrwa, mtvrwa, mtvrd, and mtfprd.

Add the missing tests to none/tests/ppc64/test_isa_2_07_part1.c.  Update the
expected output file with the new test outputs.

7 years agoBug 391164: constraint bug in tests/ppc64/test_isa_2_07_part1.c for mtfprwa
Carl Love [Tue, 27 Feb 2018 18:41:43 +0000 (12:41 -0600)] 
Bug 391164:  constraint bug in tests/ppc64/test_isa_2_07_part1.c for mtfprwa

Fix destination register constraint in assembly code in function
test_mtfprwa in file none/tests/ppc64/test_isa_2_07_part1.c.  Constraint
changed from "=ws" to "=d".

7 years agoHandle properly the case of an inlined call that has no abstract origin attribute.
Philippe Waroquiers [Sat, 24 Feb 2018 17:31:45 +0000 (18:31 +0100)] 
Handle properly the case of an inlined call that has no abstract origin attribute.

Normally, an inlined call has a dwarf entry that points at the abstract origin, i.e. the
function that was inlined.
However, in some cases, the abstract origin tag is not present (observed with gcc 6.3.0, when
compiling with link time optimisation).
Such missing abstract origin was then causing an error message when reading the dwarf debug info.

This patch ensures we handle this case more gracefully, by using UnknownInlinedFun as inlined
function name for such a missing abstract origin;

7 years agoMake xtree dump files world wide readable, similar to log files.
Ivo Raisr [Mon, 19 Feb 2018 09:24:52 +0000 (10:24 +0100)] 
Make xtree dump files world wide readable, similar to log files.

Fixes BZ#390723.

7 years agoBug 384930 - Valgrind fails to compute correctly some code using the GMP library.
Julian Seward [Fri, 16 Feb 2018 07:02:00 +0000 (08:02 +0100)] 
Bug 384930 - Valgrind fails to compute correctly some code using the GMP library.

For the ADCX and ADOX instructions, the VEX front end failed to create a PUT to
the result register in the case where one of the operands is from memory, for
example in

   adoxq 48(%rdi),%r12

where %r12 is never written.  This commit fixes it.

7 years agomacos: Fix unhandled syscall: mach:43 (mach_generate_activity_id). bz#385279
Rhys Kidd [Sun, 11 Feb 2018 22:16:38 +0000 (17:16 -0500)] 
macos: Fix unhandled syscall: mach:43 (mach_generate_activity_id). bz#385279

Based upon a patch provided by Louis Brunner <louis.brunner.fr@gmail.com> and
tested by:
  FX           <fxcoudert@gcc.gnu.org>
  Chris Wilson <chris+kde@qwirx.com>

7 years agoauxprogs: Remove stray Haskell file references
Rhys Kidd [Wed, 7 Feb 2018 00:44:41 +0000 (19:44 -0500)] 
auxprogs: Remove stray Haskell file references

Fix the building of a distribution tarball package via 'make dist' by
removing these stray references to former Haskell scripts. n-i-bz.

Fixes: c5218ff4c ("Remove old Haskell and orig diff files.")
7 years agoamd64: implement PCMPxSTRx case 0x41. This is generated by recent MSVCs. n-i-bz.
Julian Seward [Tue, 6 Feb 2018 14:19:24 +0000 (15:19 +0100)] 
amd64: implement PCMPxSTRx case 0x41.  This is generated by recent MSVCs.  n-i-bz.

7 years agoBug 384631 - Sanitise client args as printed with -v
Julian Seward [Tue, 6 Feb 2018 11:54:03 +0000 (12:54 +0100)] 
Bug 384631 - Sanitise client args as printed with -v

umsg_arg, xml_arg: sanitise the guest's command line arguments that we print
in a "Command: " line as part of the preamble, when -v is given.  This
changes any character outside the range 32 .. 127 to '_'.  Printing
unsanitised command line args has been observed to cause xfce4-terminal to
assert.  Of course the command line args actually given to the guest aren't
changed -- this just changes how they are printed.

This fixes #384631.

7 years agomips: remove several compiler warnings
Petar Jovanovic [Sat, 3 Feb 2018 22:28:30 +0000 (23:28 +0100)] 
mips: remove several compiler warnings

A few warnings have showed up with recent changes on trunk:

warning: parameter names (without types) in function declaration
warning: no previous prototype for 'showRotxOp'
warning: unused variable 'src1' [-Wunused-variable]

Fixing it.
Thanks Paul Floyd for reporting one of the issues.

7 years agomips: update .gitignore
Petar Jovanovic [Fri, 2 Feb 2018 00:36:23 +0000 (01:36 +0100)] 
mips: update .gitignore

Add 6 recently added entries from /none/tests/mips64/ to .gitignore.

7 years agomips: update NEWS about MIPS32/64 Revision 6 support
Petar Jovanovic [Thu, 1 Feb 2018 17:57:00 +0000 (18:57 +0100)] 
mips: update NEWS about MIPS32/64 Revision 6 support

Spread the word about MIPS Rev6 support.

Related BZ issue - #387410.

7 years agomips: add tests for mips32/mips64 R6
Petar Jovanovic [Thu, 1 Feb 2018 17:37:28 +0000 (18:37 +0100)] 
mips: add tests for mips32/mips64 R6

This set of tests covers MIPS r6 specific instructions:

  none/tests/mips32/MIPS32r6int
  none/tests/mips32/branch_pc
  none/tests/mips32/branches_r6
  none/tests/mips32/fp_r6
  none/tests/mips32/pc_instructions_r6

  none/tests/mips64/MIPS64r6int
  none/tests/mips64/branch_pc
  none/tests/mips64/branches_r6
  none/tests/mips64/fp_r6
  none/tests/mips64/pc_instructions_r6
  none/tests/mips64/r6_instructions

The following tests had to be changed to be applicaple for Rev6:

  none/tests/libvex_test.c

  none/tests/mips32/LoadStore
  none/tests/mips32/LoadStore1
  none/tests/mips32/MIPS32int
  none/tests/mips32/MoveIns
  none/tests/mips32/branches
  none/tests/mips32/change_fp_mode
  none/tests/mips32/mips32_dsp
  none/tests/mips32/vfp

  none/tests/mips64/arithmetic_instruction
  none/tests/mips64/branches
  none/tests/mips64/fpu_arithmetic
  none/tests/mips64/fpu_load_store
  none/tests/mips64/load_store
  none/tests/mips64/load_store_multiple
  none/tests/mips64/move_instructions

The following tests are not applicable for Rev6:

  none/tests/mips32/fpu_branches
  none/tests/mips32/unaligned_load_store

  none/tests/mips64/branch_and_jump_instructions
  none/tests/mips64/change_fp_mode
  none/tests/mips64/fpu_branches
  none/tests/mips64/load_store_unaligned
  none/tests/mips64/unaligned_load
  none/tests/mips64/unaligned_load_store.

Contributed by:
  Tamara Vlahovic, Aleksandar Rikalo and Aleksandra Karadzic.

Related BZ issue - #387410.

7 years agomips: add support for mips32/mips64 R6 to coregrind
Petar Jovanovic [Thu, 1 Feb 2018 17:26:01 +0000 (18:26 +0100)] 
mips: add support for mips32/mips64 R6 to coregrind

Changes in PRE(sys_prctl), necessary to support new floating-point modes
in MIPS R6.

Part of MIPS32/64 Revision 6 changes.

Contributed by:
  Tamara Vlahovic, Aleksandar Rikalo and Aleksandra Karadzic.

Related BZ issue - #387410.

7 years agomips: add support for mips32/mips64 R6 to VEX
Petar Jovanovic [Thu, 1 Feb 2018 17:19:24 +0000 (18:19 +0100)] 
mips: add support for mips32/mips64 R6 to VEX

Full support of MIPS R6 instruction set.

Special implementation for MIPS R6 has been added for following IOPs:

  Iop_Max32U, Iop_Mul32, Iop_Mul64, Iop_MullS32, Iop_MullU32,
  Iop_MullU8, Iop_MullS8, Iop_MullU16, Iop_MullS16, Iop_CmpF64,
  Iop_DivModU32to32, Iop_DivModS32to32, Iop_DivS32, Iop_DivU32,
  Iop_DivS64, Iop_DivU64, Iop_MullU64, Iop_MullS64,
  Iop_DivModU64to64, Iop_DivModS64to64,
  Iop_Shr64, Iop_Shl64, Iop_Sar64,
  Iop_RoundF32toInt, Iop_RoundF64toInt,
  Iop_MAddF32, Iop_MAddF64, Iop_MSubF32, Iop_MSubF64

Following IOPs have been implemented using MIPS R6 instructions:

  Iop_MaxNumF32, Iop_MaxNumF64 Iop_MinNumF32, Iop_MinNumF64,
  Iop_CmpF32, Iop_Rotx32, Iop_Rotx64

Following IOPs have been implemented without using MIPS R6 instructions:

  Iop_F64toI64S, Iop_F32toI32S, Iop_I64StoF64.

Part of MIPS32/64 Revision 6 changes.

Contributed by:
  Tamara Vlahovic, Aleksandar Rikalo and Aleksandra Karadzic.

Related BZ issue - #387410.

7 years agoadd Iops Iop_Rotx32 and Iop_Rotx64
Petar Jovanovic [Thu, 1 Feb 2018 17:09:56 +0000 (18:09 +0100)] 
add Iops Iop_Rotx32 and Iop_Rotx64

Part of MIPS32/64 Revision 6 changes.

Contributed by:
  Tamara Vlahovic, Aleksandar Rikalo and Aleksandra Karadzic.

Related BZ issue - #387410.

7 years agomips: add support for Iop_Shr16 and Iop_Sar16
Petar Jovanovic [Wed, 31 Jan 2018 16:27:13 +0000 (17:27 +0100)] 
mips: add support for Iop_Shr16 and Iop_Sar16

This should fix memcheck/tests/vbit-test/vbit-test on mips32/64 platforms.

7 years agoarm: fix build failure introduced with "Bug 79362 - Debug info ...".
Julian Seward [Mon, 29 Jan 2018 11:58:33 +0000 (12:58 +0100)] 
arm: fix build failure introduced with "Bug 79362 - Debug info ...".

7 years agoEnable -Wlogical-op for Valgrind; fix an obvious typo.
Ivo Raisr [Thu, 18 Jan 2018 16:20:02 +0000 (17:20 +0100)] 
Enable -Wlogical-op for Valgrind; fix an obvious typo.

Fixes BZ#389065.
Reported by: dcb314@hotmail.com

7 years agoAdd a simple progress-reporting facility.
Ivo Raisr [Fri, 19 Jan 2018 16:12:34 +0000 (16:12 +0000)] 
Add a simple progress-reporting facility.

Fixes BZ#384633.
Patch by: Julian Seward <jseward@acm.org>

7 years agoRemove all extra -std=c99 flags from Makefiles.
Mark Wielaard [Fri, 19 Jan 2018 12:52:24 +0000 (13:52 +0100)] 
Remove all extra -std=c99 flags from Makefiles.

Configure now makes sure we build everything in c99 mode already.
No need to have extra special cases in the Makefiles.