]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
7 years agomips: make sure configure script checks for correct ABIs
Petar Jovanovic [Mon, 2 Oct 2017 11:28:50 +0000 (13:28 +0200)] 
mips: make sure configure script checks for correct ABIs

For mips64, we currently build for n64.
For mips32, we currently build for o32.

Pass these flags explicitly in configure checks.

7 years agogitignore: Fix up false directory-level .gitignore settings
Rhys Kidd [Mon, 2 Oct 2017 00:57:04 +0000 (20:57 -0400)] 
gitignore: Fix up false directory-level .gitignore settings

So we never intended to ignore all changes from the top-level down in /include
or /cachegrind. Instead allow the filetype-specific .gitignore patterns match
to the contents of these two folders.

Also, don't ignore changes to include/valgrind.h as it exists in the repository
and should be tracked for any changes developers might make.

Changes tested by running a git clean force and then full rebuild. No stray
build artifacts were being tracked erroneously by git after these changes.

7 years agoPreliminary support for Darwin 17.x (macOS 10.13)
Rhys Kidd [Sun, 10 Sep 2017 15:34:32 +0000 (11:34 -0400)] 
Preliminary support for Darwin 17.x (macOS 10.13)

7 years agoFix missing workq_ops operations (macOS)
Rhys Kidd [Sun, 1 Oct 2017 22:56:05 +0000 (18:56 -0400)] 
Fix missing workq_ops operations (macOS)

Related to discussion in bz#383723. Patch based upon one provided by
Andy Maloney.

7 years agomips64: set mips64r2 as default for 64-builds
Petar Jovanovic [Fri, 29 Sep 2017 17:14:42 +0000 (19:14 +0200)] 
mips64: set mips64r2 as default for 64-builds

Set mips64r2 as default. Major 64-bit platforms are Rev2.
This also fixes small issue when -march=octeon is in conflict with -mips64.

7 years agomips: optimize multiplication Iops
Petar Jovanovic [Thu, 28 Sep 2017 17:29:51 +0000 (19:29 +0200)] 
mips: optimize multiplication Iops

Optimize and refactor some of mul* Iop code in VEX/priv/host_mips_.

Patch from Aleksandar Rikalo.

7 years agoMinor refactoring for VEX register allocator v3. No functional change.
Ivo Raisr [Thu, 28 Sep 2017 05:39:12 +0000 (07:39 +0200)] 
Minor refactoring for VEX register allocator v3. No functional change.

7 years agoAdd a .exp file for the dash version in Debian 9
Philippe Waroquiers [Wed, 27 Sep 2017 16:29:58 +0000 (18:29 +0200)] 
Add a .exp file for the dash version in Debian 9

Add shell.stderr.exp-dash3, which differs from shell.stderr.exp-dash2 with:

6c6
< ./shell_binaryfile: 4: ./shell_binaryfile: Syntax error: ")" unexpected
---
> ./shell: 19: ./shell: ./shell_binaryfile: Exec format error

(so the newer dash gives a clearer msg)

7 years agomips: fix typos for the recently added test
Petar Jovanovic [Wed, 27 Sep 2017 14:48:22 +0000 (16:48 +0200)] 
mips: fix typos for the recently added test

Correct name of the recently added test in Makefile.am.

7 years agomips: fix VKI_SIOCATMARK, VKI_SIOCSPGRP and VKI_SIOCGPGRP macros
Petar Jovanovic [Wed, 27 Sep 2017 14:04:31 +0000 (16:04 +0200)] 
mips: fix VKI_SIOCATMARK, VKI_SIOCSPGRP and VKI_SIOCGPGRP macros

Set correct values from Linux kernel.
See ./arch/mips/include/uapi/asm/sockios.h

This issue is covered by newly introduced memcheck test mips32/bad_sioc.

7 years agomips: new Memcheck test, bad_sioc
Petar Jovanovic [Wed, 27 Sep 2017 13:55:16 +0000 (15:55 +0200)] 
mips: new Memcheck test, bad_sioc

Check if Memcheck is able to recognize errors related to uninitialized
parameters in ioctl(SIOCSPGRP / SIOCATMARK) calls.

Test by Aleksandar Rikalo.

7 years agoReorder allocatable registers for s390x so that the callee saved are listed first.
Ivo Raisr [Tue, 26 Sep 2017 07:33:27 +0000 (09:33 +0200)] 
Reorder allocatable registers for s390x so that the callee saved are listed first.

Helper calls always trash all caller saved registers. By listing the callee saved
first then VEX register allocator (both v2 and v3) is more likely to pick them
and does not need to spill that much before helper calls.

7 years agoSupport all Apple clang/LLVM 5.1+
Rhys Kidd [Sun, 10 Sep 2017 15:40:21 +0000 (11:40 -0400)] 
Support all Apple clang/LLVM 5.1+

clang has been reasonably good at standards compliance for a while now, and
the Apple-shipped clang-variant in Xcode remains fairly close to upstream.

Let's assume that the Apple-shipped clang-variant is sufficient for
building valgrind, provided it is above a minimum version of 5.1.

7 years agoFollow up to 'On ppc, add generic_start_main.isra.0 as a below main function'
Philippe Waroquiers [Sat, 23 Sep 2017 14:41:18 +0000 (16:41 +0200)] 
Follow up to 'On ppc, add generic_start_main.isra.0 as a below main function'

massif/tests/mmapunmap on ppc now indicates a below main function.

Note: this ppc53 specific file is needed because the valgrind stack unwinder
does not properly unwind in main.
At the mmap syscall, gdb backtrace gives:
Breakpoint 3, 0x00000000041dbae0 in .__GI_mmap () from /lib64/libc.so.6
(gdb) bt

while the valgrind stack trace gives:
Thread 1: status = VgTs_Runnable (lwpid 64207)
==64207==    at 0x41DBAE0: mmap (in /usr/lib64/libc-2.17.so)
==64207==    by 0x10000833: f (mmapunmap.c:9)
==64207==    by 0x40E6BEB: (below main) (in /usr/lib64/libc-2.17.so)
client stack range: [0x1FFEFF0000 0x1FFF00FFFF] client SP: 0x1FFF00ECE0
valgrind stack top usage: 15632 of 1048576

7 years agoOn ppc, add generic_start_main.isra.0 as a below main function
Philippe Waroquiers [Sat, 23 Sep 2017 11:49:05 +0000 (13:49 +0200)] 
On ppc, add generic_start_main.isra.0 as a below main function

We can have stacktraces such as:
==41840==    by 0x10000927: a1 (deep.c:27)
==41840==    by 0x1000096F: main (deep.c:35)
==41840==    by 0x4126BEB: generic_start_main.isra.0 (in /usr/lib64/libc-2.17.so)
==41840==    by 0x4126E13: __libc_start_main (in /usr/lib64/libc-2.17.so)

So, add generic_start_main.isra.0 as a below main function.
This fixes the test  massif/tests/deep-D

7 years agomassif: match --ignore-fn with the first IP that has a fnname
Philippe Waroquiers [Sat, 23 Sep 2017 11:26:12 +0000 (13:26 +0200)] 
massif: match --ignore-fn with the first IP that has a fnname

Currently, --ignore-fn is only matched with the top IP entries that
have a fnname. With this change, we first search for the first IP that
has a fnname.
This e.g. allows to ignore the allocation for a stacktrace such as:
   0x1 0x2 0x3 fn_to_ignore otherfn

This is then used in massif c++ tests new-cpp and overloaded-new to ignore
the c++ libstdc++ allocation similar to:
==10754== 72,704 bytes in 1 blocks are still reachable in loss record 10 of 10
==10754==    at 0x4C2BBCD: malloc (vg_replace_malloc.c:299)
==10754==    by 0x4EC39BF: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==10754==    by 0x400F8A9: call_init.part.0 (dl-init.c:72)
==10754==    by 0x400F9BA: call_init (dl-init.c:30)
==10754==    by 0x400F9BA: _dl_init (dl-init.c:120)
==10754==    by 0x4000C59: ??? (in /lib/x86_64-linux-gnu/ld-2.24.so)

7 years agoFollow up to 345307 - Warning about "still reachable" memory when using libstdc...
Philippe Waroquiers [Fri, 22 Sep 2017 21:50:35 +0000 (23:50 +0200)] 
Follow up to  345307 - Warning about "still reachable" memory when using libstdc++ from gcc 5

The bug itself was solved in 3.12 by the addition of __gnu_cxx::__freeres
in the libstdc++ and have valgrind calling it before exit.

However, depending on the version of the libstdc++, the test leak_cpp_interior
was giving different results.

This commit adds some filtering specific to the test, so as to not depend
anymore of the absolute number of bytes leaked, and adds a suppression entry to
ignore the memory allocated by libstdc++.

This allows to have only 2 .exp files, instead of 4 (or worse, if
we would have to handle yet other .exp files depending on the libstdc++
version).

7 years agoImplement static TLS code for more platforms
Philippe Waroquiers [Tue, 19 Sep 2017 21:17:48 +0000 (23:17 +0200)] 
Implement static TLS code for more platforms

gdbserver_tests/hgtls is failing on a number of platforms
as it looks like static tls handling is now needed.
So, omplement static tls for a few more platforms.
The formulas that are platform dependent are somewhat wild guesses
obtained with trial and errors.
Note that arm/arm64/ppc32 are not (yet) done

7 years agoFix assert on ppc32 due to typo for GPR28
Philippe Waroquiers [Tue, 19 Sep 2017 21:12:35 +0000 (23:12 +0200)] 
Fix assert on ppc32 due to typo for GPR28

The below commit introduced a regression on ppc32
ommit 00d4667295a821fef9eb198abcb0c942dffb6045
Author: Ivo Raisr <ivosh@ivosh.net>
Date:   Wed Sep 6 08:10:36 2017 +0200

    Reorder allocatable registers for AMD64, X86, and PPC so that the callee saved are listed first.

    Helper calls always trash all caller saved registers. By listing the callee saved
    first then VEX register allocator (both v2 and v3) is more likely to pick them
    and does not need to spill that much before helper calls.

Investigation/fix done by Ivo.

7 years agoFix a typo bug in VEX register allocator v3.
Ivo Raisr [Sat, 16 Sep 2017 16:48:36 +0000 (18:48 +0200)] 
Fix a typo bug in VEX register allocator v3.

Also scanning a few more instructions ahead helps producing
better code.

7 years agomips: finetune none/tests/(mips32|64)/test_math test
Petar Jovanovic [Fri, 15 Sep 2017 16:29:29 +0000 (18:29 +0200)] 
mips: finetune none/tests/(mips32|64)/test_math test

Compiler may optimize out call to cbrt. Change test to prevent that.
Otherwise, the test does not exercise a desired codepath for cbrt, and it
prints precalculated value.

7 years agomips: add clearing $ra to CLEAR_CALLER_SAVED_REGS macro
Petar Jovanovic [Fri, 15 Sep 2017 14:04:18 +0000 (16:04 +0200)] 
mips: add clearing $ra to CLEAR_CALLER_SAVED_REGS macro

Return address register belongs to caller saved registers, and compiler can
use it to store temporary values. Clear it.

7 years agoReorder allocatable registers for AMD64, X86, and PPC so that the callee saved are...
Ivo Raisr [Wed, 6 Sep 2017 06:10:36 +0000 (08:10 +0200)] 
Reorder allocatable registers for AMD64, X86, and PPC so that the callee saved are listed first.

Helper calls always trash all caller saved registers. By listing the callee saved
first then VEX register allocator (both v2 and v3) is more likely to pick them
and does not need to spill that much before helper calls.

7 years agoFix Bug 255603 - exp-sgcheck Assertion '!already_present' failed
Philippe Waroquiers [Wed, 13 Sep 2017 20:47:11 +0000 (22:47 +0200)] 
Fix Bug 255603 - exp-sgcheck Assertion '!already_present' failed

The code handling array bounds is not ready to accept a reference
to something else (not very clear what this reference could be) :
the code only expects directly the value of a bound.
So, it was using the reference (i.e. an offset somewehere in the debug
info) as the value of the bound.
This then gave huge bounds for some arrays, causing an overlap
in the stack variable handling code in exp-sgcheck.

Such references seems to be used sometimes for arrays with variable
size stack allocated.

Fix (or rather bypass) the problem by not considering that we have
a usable array bound when a reference is given.

7 years agoUpdate AUTHORS
Rhys Kidd [Sun, 10 Sep 2017 15:08:20 +0000 (11:08 -0400)] 
Update AUTHORS

7 years agoFix syscall param msg->desc.port.name on macOS 10.12. bz#379373
Rhys Kidd [Sun, 10 Sep 2017 05:12:15 +0000 (01:12 -0400)] 
Fix syscall param msg->desc.port.name on macOS 10.12. bz#379373

Based upon patch from Louis Brunner.

7 years agoReduce number of spill instructions generated by VEX register allocator v3.
Ivo Raisr [Sat, 9 Sep 2017 20:08:21 +0000 (22:08 +0200)] 
Reduce number of spill instructions generated by VEX register allocator v3.

Keeps track whether the bound real register has been reloaded from a virtual
register recently and if this real reg is still equal to that spill slot.
Avoids unnecessary spilling that vreg later, when this rreg needs
to be reserved, usually as a caller save register for a helper call.

Fixes BZ#384526.

7 years agoSmall performance enhancement to VEX register allocator v2.
Ivo Raisr [Mon, 4 Sep 2017 07:21:05 +0000 (09:21 +0200)] 
Small performance enhancement to VEX register allocator v2.

Iterate only over real registers of the target hreg class.

7 years agoFix missing pselect syscall (OS X 10.11). bz#379748
Rhys Kidd [Sun, 3 Sep 2017 16:55:52 +0000 (12:55 -0400)] 
Fix missing pselect syscall (OS X 10.11). bz#379748

Based upon patch from Louis Brunner.

7 years agoSmall fixes to notes about Inner/Outer setup.
Ivo Raisr [Fri, 1 Sep 2017 15:27:08 +0000 (17:27 +0200)] 
Small fixes to notes about Inner/Outer setup.

7 years agoImprove the implementation of expensiveCmpEQorNE.
Julian Seward [Thu, 31 Aug 2017 09:11:25 +0000 (11:11 +0200)] 
Improve the implementation of expensiveCmpEQorNE.

.. so that the code it creates runs in approximately half the time it did
before.  This is in support of making the cost of expensive (exactly)
integer EQ/NE as low as possible, since the day will soon come when we'll
need to enable this by default.

7 years agoFix eflags handling in amd64 instruction tests
Tom Hughes [Wed, 30 Aug 2017 18:26:37 +0000 (19:26 +0100)] 
Fix eflags handling in amd64 instruction tests

In 64 bit mode there's no way to just save eflags so we save the
whole of rflags but we were doing so to a 32 bit variable!

Replace that with proper rflags support that knows it is dealing
with the full 64 bit flags word in 64 bit mode.

7 years agoamd64 back end: handle CmpNEZ64(And64(x,y)) better; ditto the 32 bit case.
Julian Seward [Wed, 30 Aug 2017 17:43:59 +0000 (19:43 +0200)] 
amd64 back end: handle CmpNEZ64(And64(x,y)) better; ditto the 32 bit case.

Handle CmpNEZ64(And64(x,y)) by branching on flags, similarly to
CmpNEZ64(Or64(x,y)).  Ditto the 32 bit equivalents.  Also, remove expensive
DEFINE_PATTERN/DECLARE_PATTERN uses there and hardwire the matching logic.

n-i-bz.  This is in support of reducing the cost of expensiveCmpEQorNE
in memcheck.

7 years agoFix FMRI of built Solaris packages.
Ivo Raisr [Tue, 29 Aug 2017 14:13:02 +0000 (16:13 +0200)] 
Fix FMRI of built Solaris packages.

7 years agoReduce lfedora1.sendmail diff lines.
Mark Wielaard [Tue, 29 Aug 2017 09:09:41 +0000 (11:09 +0200)] 
Reduce lfedora1.sendmail diff lines.

The mailinglist was rejecting the nightly emails because they were too big.

7 years agoFix building Solaris package from git SCM.
Ivo Raisr [Tue, 29 Aug 2017 08:13:20 +0000 (10:13 +0200)] 
Fix building Solaris package from git SCM.

7 years agoMention AddrCheck at Memcheck's command line option --undef-value-errors=no
Ivo Raisr [Mon, 28 Aug 2017 06:00:12 +0000 (08:00 +0200)] 
Mention AddrCheck at Memcheck's command line option --undef-value-errors=no

7 years agoVEX register allocator version 3.
Ivo Raisr [Fri, 25 Aug 2017 22:19:05 +0000 (00:19 +0200)] 
VEX register allocator version 3.

Implements a new version of VEX register allocator which
keeps the main state per virtual registers, as opposed
to real registers in v2. This results in a simpler and
cleaner design and much simpler implementation.
It has been observed that the new allocator executes 20-30%
faster than the previous one but could produce slightly worse
spilling decisions. Overall performance improvement when running
the Valgrind performance regression test suite has been observed
in terms of a few percent.

The new register allocator (v3) is now the default one.
The old register allocator (v2) is still kept around and can be
activated with command line option '--vex-regalloc-version=2'.

Fixes BZ#381553.

7 years agoFollow up to 9f9ad501 : ensure we only have a single X if several files modified
Philippe Waroquiers [Sat, 26 Aug 2017 07:01:42 +0000 (09:01 +0200)] 
Follow up to 9f9ad501 : ensure we only have a single X if several files modified

7 years agoAdd to -v --version commit date+(optional) trailing X char if some files are changed
Philippe Waroquiers [Sat, 26 Aug 2017 06:47:46 +0000 (08:47 +0200)] 
Add to -v --version commit date+(optional) trailing X char if some files are changed

7 years agomips: remove incorrect implementation of several Iops
Petar Jovanovic [Tue, 22 Aug 2017 14:05:00 +0000 (16:05 +0200)] 
mips: remove incorrect implementation of several Iops

Remove incorrect implementation of
  Iop_DivModU64to32
  Iop_DivModS64to32
  Iop_DivModU128to64
  Iop_DivModS128to64

7 years agomips: reimplement handling of div, divu and ddivu
Petar Jovanovic [Tue, 22 Aug 2017 13:53:15 +0000 (15:53 +0200)] 
mips: reimplement handling of div, divu and ddivu

Previous implementation misused some opcodes, and a side effect was
dead code emission.
To reimplement handling of these instructions, three new IoPs have been
introduced:

      Iop_DivModU64to64, // :: I64,I64 -> I128
                         // of which lo half is div and hi half is mod
      Iop_DivModS32to32, // :: I32,I32 -> I64
                         // of which lo half is div and hi half is mod
      Iop_DivModU32to32, // :: I32,I32 -> I64
                         // of which lo half is div and hi half is mod

Patch by Aleksandra Karadzic and Tamara Vlahovic.

7 years agoRecognize signal 151 (SIGLIBRT) sent by gdb.
Ivo Raisr [Fri, 18 Aug 2017 14:53:57 +0000 (16:53 +0200)] 
Recognize signal 151 (SIGLIBRT) sent by gdb.

It has been observed that gdb on Solaris sends this signal to
child processes. Unfortunately array "pass_signals" was too small
to accomodate this signal and subsequently VG_(clo_vex_control).iropt_verbosity
was overwritten.
This has been fixed now.

7 years agoAdd missing error kinds for Memcheck into XML output protocol 4.
Ivo Raisr [Thu, 17 Aug 2017 08:18:21 +0000 (10:18 +0200)] 
Add missing error kinds for Memcheck into XML output protocol 4.

Error kinds have been re-ordered to match MC_ErrorTag.
Patch by: John Davis <jedavis@alumni.cmu.edu>

7 years agoFix out-of-tree build on Solaris.
Ivo Raisr [Thu, 17 Aug 2017 20:38:18 +0000 (22:38 +0200)] 
Fix out-of-tree build on Solaris.

Simply #include config.h with no path at all.
Path by: Rob Boehne <robb@datalogics.com>

7 years agomips32: finetune vfp test to avoid compiler warnings
Petar Jovanovic [Thu, 17 Aug 2017 18:08:17 +0000 (20:08 +0200)] 
mips32: finetune vfp test to avoid compiler warnings

This patch removes two compiler warnings from the test:

vfp.c: In function 'handler':
vfp.c:260:4: warning: implicit declaration of function 'exit'
[-Wimplicit-function-declaration]
    exit(0);
    ^
vfp.c:260:4: warning: incompatible implicit declaration of built-in
function 'exit'
vfp.c: At top level:
vfp.c:258:13: warning: 'handler' defined but not used [-Wunused-function]
 static void handler(int sig)
             ^

7 years agomips: mute 'uninitialized' value compiler warning
Petar Jovanovic [Thu, 17 Aug 2017 17:10:25 +0000 (19:10 +0200)] 
mips: mute 'uninitialized' value compiler warning

fadvise64.c deliberately uses uninitialized value.
This patch removes the following warning:

warning: 'x' is used uninitialized in this function

7 years agoAdd nightly config file for Solaris Trunk x86.
Ivo Raisr [Tue, 15 Aug 2017 21:37:41 +0000 (21:37 +0000)] 
Add nightly config file for Solaris Trunk x86.

7 years ago Small improvement to user manual: capitalise another occurence of memcheck
Philippe Waroquiers [Tue, 15 Aug 2017 21:30:46 +0000 (23:30 +0200)] 
 Small improvement to user manual: capitalise another occurence of memcheck

   (yes, I am experimenting with valgrind git repository :)

7 years agoSmall improvement to user manual: capitalise one occurence of memcheck
Philippe Waroquiers [Tue, 15 Aug 2017 21:06:28 +0000 (23:06 +0200)] 
Small improvement to user manual: capitalise one occurence of memcheck

7 years agoAdd nightly config file for Solaris 11.3 x86.
Ivo Raisr [Tue, 15 Aug 2017 20:06:25 +0000 (22:06 +0200)] 
Add nightly config file for Solaris 11.3 x86.

7 years agoFix bin/nightly.
Ivo Raisr [Tue, 15 Aug 2017 20:05:02 +0000 (22:05 +0200)] 
Fix bin/nightly.

Reported and patch suggested by: Rich Coe <rcoe@wi.rr.com>

7 years agoAdd missing entries to .gitignore.
Ivo Raisr [Wed, 9 Aug 2017 10:35:50 +0000 (12:35 +0200)] 
Add missing entries to .gitignore.

7 years agogit-HOWTO.txt: Add to repository
Bart Van Assche [Mon, 26 Jun 2017 12:56:52 +0000 (14:56 +0200)] 
git-HOWTO.txt: Add to repository

7 years agoConvert release-HOWTO.txt from SVN to GIT
Ivo Raisr [Sat, 4 Mar 2017 21:21:33 +0000 (22:21 +0100)] 
Convert release-HOWTO.txt from SVN to GIT

7 years agoChange Subversion to GIT in various places
Ivo Raisr [Sat, 4 Mar 2017 21:10:03 +0000 (22:10 +0100)] 
Change Subversion to GIT in various places

7 years agofix verbose version reporting for git
Austin English [Sun, 26 Feb 2017 08:05:24 +0000 (02:05 -0600)] 
fix verbose version reporting for git

Signed-off-by: Austin English <austinenglish@gmail.com>
7 years agoFix nightly build script to work with new Valgrind GIT repository.
Ivo Raisr [Sun, 26 Feb 2017 14:00:42 +0000 (15:00 +0100)] 
Fix nightly build script to work with new Valgrind GIT repository.

7 years agoUpdate auxprogs/update-demangler for Valgrind in GIT.
Ivo Raisr [Sun, 26 Feb 2017 04:02:33 +0000 (05:02 +0100)] 
Update auxprogs/update-demangler for Valgrind in GIT.

7 years agoChange SVN to GIT in various places and simple scripts.
Ivo Raisr [Fri, 16 Jun 2017 14:40:58 +0000 (16:40 +0200)] 
Change SVN to GIT in various places and simple scripts.

7 years agoConvert svn:ignore properties to combined .gitignore.
Ivo Raisr [Mon, 14 Aug 2017 10:26:40 +0000 (12:26 +0200)] 
Convert svn:ignore properties to combined .gitignore.

7 years agoMerge VEX/HEAD into Valgrind/HEAD
Ivo Raisr [Mon, 14 Aug 2017 10:26:12 +0000 (12:26 +0200)] 
Merge VEX/HEAD into Valgrind/HEAD

8 years agoEnsure host stack trace has better chance to work when valgrind is exiting
Philippe Waroquiers [Tue, 8 Aug 2017 21:15:45 +0000 (21:15 +0000)] 
Ensure host stack trace has better chance to work when valgrind is exiting

When investigating bug 383275, the host stacktrace was containing
only one IP. This is because the tid corresponding to the lwpid
is dead, and so no valid thread state was returned.
This then gave a rubbish stacktop of 0, which means unwinding
stops at first frame.

So, try harder to find a valid thread state when reporting the
host stacktrace.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16470

8 years agoFix 383275 - massif valgrind: m_xarray.c:162 (ensureSpaceXA): Assertion '!xa->arr...
Philippe Waroquiers [Tue, 8 Aug 2017 19:52:03 +0000 (19:52 +0000)] 
Fix 383275 - massif valgrind: m_xarray.c:162 (ensureSpaceXA): Assertion '!xa->arr' failed

When a massif xtree snapshot is taken when no allocation was done,
the xtree contains no exe context.
The data structure ips_order_xecu is then szied to 0 using VG_(hintSizeXA).
m_xarray.c then allocates an empty array, while later on, a zero size
is expected to correspond to no allocated array.

Fix the problem in m_xarray.c, by not doing any allocation if the
size hint is 0.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16469

8 years agoRemove empty directory VEX/docs.
Ivo Raisr [Sat, 5 Aug 2017 13:52:46 +0000 (13:52 +0000)] 
Remove empty directory VEX/docs.

SVN->GIT migration recipe gets slightly confused with it.
n-i-bz

git-svn-id: svn://svn.valgrind.org/vex/trunk@3400

8 years agoDocument Solaris kernel interfaces used. Not exhaustive list.
Ivo Raisr [Thu, 3 Aug 2017 20:46:33 +0000 (20:46 +0000)] 
Document Solaris kernel interfaces used. Not exhaustive list.
n-i-bz

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16468

8 years agoFix handling command line option --xml-socket.
Ivo Raisr [Thu, 3 Aug 2017 05:22:01 +0000 (05:22 +0000)] 
Fix handling command line option --xml-socket.
Fixes BZ#382998
Patch by: Orgad Shaneh <orgads@gmail.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16467

8 years agoVarious minor fixes and correction in user manual and monitor command help
Philippe Waroquiers [Tue, 1 Aug 2017 20:21:38 +0000 (20:21 +0000)] 
Various minor fixes and correction in user manual and monitor command help

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16466

8 years agoFix 382515 - valgrind: "Assertion 'di->have_dinfo' failed." on wine's dlls/mscoree...
Philippe Waroquiers [Mon, 31 Jul 2017 20:43:43 +0000 (20:43 +0000)] 
Fix  382515 - valgrind: "Assertion 'di->have_dinfo' failed." on wine's dlls/mscoree/tests/mscoree.c

* produce (more) user messages when valgrind cannot read a pdb file.
* recover properly from an invalid/unsupported pdb file.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16465

8 years agoFix the Solaris build after development trunk has been renamed.
Ivo Raisr [Mon, 31 Jul 2017 15:24:08 +0000 (15:24 +0000)] 
Fix the Solaris build after development trunk has been renamed.

Effectively Solaris 12 is now becoming Solaris 11.4.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16464

8 years agoCheck whether it is ok to use compiler flag '-pie'.
Ivo Raisr [Fri, 28 Jul 2017 20:49:20 +0000 (20:49 +0000)] 
Check whether it is ok to use compiler flag '-pie'.
Some compilers actually do not support -pie and report its usage
as an error. We need to check if it is safe to use it first.
n-i-bz

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16463

8 years agovalgrind core side for Add inner requests in VEX (cfr revision 3399)
Philippe Waroquiers [Thu, 27 Jul 2017 19:11:21 +0000 (19:11 +0000)] 
valgrind core side for Add inner requests in VEX (cfr revision  3399)

When running Valgrind under Valgrind, the VEX memory allocation
(temporary or permanent) was not checked, as there was no
inner request.
This patch changes VEX to mark the temporary and permanent
allocations with redzone, and memory is marked unaddressable
when the VEX temporary pool is cleared.

The changes are:
* add a file libvex_inner.h which mostly takes over what
  was in pub_core_inner.h (which now just includes libvex_inner.h)

* modify main_util.h and main_util.c to mark the temporary
  and permanent pool with memcheck pool requests to indicate
  when a block is allocated or freed.

* Impact is (should be) none, unless Valgrind is configured
  as an inner.

* Outer memcheck/inner regression tests run on gcc20 (amd64).
  Nothing (more worrying than the 3.13 self hosting) detected

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16462

8 years agoAdd inner requests in VEX
Philippe Waroquiers [Thu, 27 Jul 2017 19:10:30 +0000 (19:10 +0000)] 
Add inner requests in VEX

When running Valgrind under Valgrind, the VEX memory allocation
(temporary or permanent) was not checked, as there was no
inner request.
This patch changes VEX to mark the temporary and permanent
allocations with redzone, and memory is marked unaddressable
when the VEX temporary pool is cleared.

The changes are:
* add a file libvex_inner.h which mostly takes over what
  was in pub_core_inner.h (which now just includes libvex_inner.h)

* modify main_util.h and main_util.c to mark the temporary
  and permanent pool with memcheck pool requests to indicate
  when a block is allocated or freed.

* Impact is (should be) none, unless Valgrind is configured
  as an inner.

* Outer memcheck/inner regression tests run on gcc20 (amd64).
  Nothing (more worrying than the 3.13 self hosting) detected

git-svn-id: svn://svn.valgrind.org/vex/trunk@3399

8 years agoNew command line option "--terse" for vg_perf.
Ivo Raisr [Sat, 22 Jul 2017 05:10:05 +0000 (05:10 +0000)] 
New command line option "--terse" for vg_perf.
Fixes BZ#382407.

Produces the following terse output:

-- bigcode1 --
vanilla   :  no: -----  me: -----  ca: -----  he: -----  ca: -----  dr: -----  ma: -----
ra3-005   :  no:  0.0%  me: -4.7%  ca:  0.2%  he: -1.1%  ca: -1.5%  dr: -0.6%  ma:  0.0%
ra3-005-J :  no:  0.0%  me:  0.4%  ca:  0.3%  he: -0.5%  ca: -0.9%  dr:  0.0%  ma:  0.6%
ra3-006   :  no:  0.0%  me:  0.4%  ca:  0.2%  he: -0.0%  ca: -1.2%  dr:  0.0%  ma:  0.0%
ra3-007   :  no:  0.0%  me:  0.7%  ca:  0.5%  he: -0.5%  ca: -0.6%  dr:  0.0%  ma:  1.2%

instead the full output (when the option is not used):
-- bigcode1 --
bigcode1 vanilla:0.09s  no: 1.6s (18.0x, -----)  me: 3.1s (35.0x, -----)  ca:12.7s (140.8x, -----)  he: 2.0s (22.8x, -----)  ca: 3.7s (41.2x, -----)  dr: 2.0s (22.2x, -----)  ma: 1.9s (20.7x, -----)
bigcode1 ra3-005:0.09s  no: 1.6s (17.8x,  1.2%)  me: 3.0s (33.3x,  4.8%)  ca:12.7s (140.7x,  0.1%)  he: 2.0s (22.2x,  2.4%)  ca: 3.6s (40.2x,  2.4%)  dr: 1.9s (21.7x,  2.5%)  ma: 1.9s (20.7x,  0.0%)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16461

8 years agofix misleading indentation
Philippe Waroquiers [Fri, 21 Jul 2017 18:46:35 +0000 (18:46 +0000)] 
fix misleading indentation

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16460

8 years agoFix the configure check whether the compiler supports compressed debug sections.
Ivo Raisr [Sun, 16 Jul 2017 20:12:26 +0000 (20:12 +0000)] 
Fix the configure check whether the compiler supports compressed debug sections.
We need to actually link instead of just compile.
Fixes BZ#382256.

Patch by: Ross Burton <ross@burtonini.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16459

8 years agoBug 381805 arm32 needs ld.so index hardwire for new glibc security fixes
Mark Wielaard [Wed, 5 Jul 2017 09:57:48 +0000 (09:57 +0000)] 
Bug 381805 arm32 needs ld.so index hardwire for new glibc security fixes

glibc added some security hardening adding (optimized) index/strchr
calls in the LD_PRELOAD path:

    commit 6d0ba622891bed9d8394eef1935add53003b12e8
    Author: Florian Weimer <fweimer@redhat.com>
    Date:   Mon Jun 19 22:31:04 2017 +0200

        ld.so: Reject overly long LD_PRELOAD path elements

arm32 doesn't have an ld.so hardwire for index/strchr like other
architectures and so will always complain during early startup:

    ==9495== Conditional jump or move depends on uninitialised value(s)
    ==9495==    at 0x401CF84: index (in /usr/lib/ld-2.25.so)
    ==9495==
    ==9495== Conditional jump or move depends on uninitialised value(s)
    ==9495==    at 0x401CF88: index (in /usr/lib/ld-2.25.so)

index/strchr is doing a word load from a partially-written
stack-allocated buffer, therefore accessing uninitialized data.
This is normal for an optimized string function. The uninitialized
data does not affect the function result.

This can be suppressed by adding a index hardwire for ld.so on arm32
like on other arches. There even was already some commented out code
to do that. Enable that code.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16458

8 years agomemcheck/tests: Use ucontext_t instead of struct ucontext
Mark Wielaard [Thu, 29 Jun 2017 15:26:30 +0000 (15:26 +0000)] 
memcheck/tests: Use ucontext_t instead of struct ucontext

glibc 2.26 does not expose struct ucontext anymore.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16457

8 years agoRevert r16455.
Tom Hughes [Mon, 26 Jun 2017 12:14:29 +0000 (12:14 +0000)] 
Revert r16455.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16456

8 years agoAllow setuid/setgid/setcap binaries to be run if
Tom Hughes [Mon, 26 Jun 2017 12:10:42 +0000 (12:10 +0000)] 
Allow setuid/setgid/setcap binaries to be run if
valgrind is running as root.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16455

8 years agoAfter fork, vgdb activity is polled according to the nr of bbs done :
Philippe Waroquiers [Sun, 25 Jun 2017 20:25:50 +0000 (20:25 +0000)] 
After fork, vgdb activity is polled according to the nr of bbs done :
once the nr of bbs done reaches the next vgdb poll, a check for vgdb
activity is done.
This might lead to the activation of gdbserver after fork.
Such poll is however not expected, unless the children is
to be trace.
This spurious poll in the forked child can cause failures
depending on the nr of bbs done before the fork, and the
nr of bbs done between the fork and the exec.

=> disable vgdb poll in the child in the cleanup after fork
in the child, unless the children have to be traced.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16454

8 years agoFix some tests failure with GDB 8.0
Philippe Waroquiers [Sun, 25 Jun 2017 12:40:53 +0000 (12:40 +0000)] 
Fix some tests failure with GDB 8.0

At the beginning of a Valgrind gdbserver test,
2 messages are produced when launching the command
   target remote | vgdb

A message output by vgdb:
   relaying data between gdb and process <pid>
(this message is read by GDB from the vgdb pipe, and re-output
on stderr)
and a message produced by GDB:
   Remote debugging using | ./vgdb

GDB 8.0 changes the order in which the above messages are output.
This causes 2 tests to fail, as the 'relaying' line appears
then in a part of the output deleted by a filter script.

To avoid this, change the filter scripts to always remove
this 'relaying line', which is not particularly interesting to check.
All the .exp files containining such a 'relaying' line are updated
accordingly.

This has been tested with various gdb versions (7.5, 7.7, 7.12, 8.0)
on amd64 and/or ppc64.

Thanks to Mark Wielaard, which helped to investigate this problem
by bisecting the GDB patches in GDB 8.0 causing this change of
behaviour.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16453

8 years agoAdd VEX fix 'powerpc too chatty even with --sigill-diagnostics=no' to NEWS.
Mark Wielaard [Tue, 20 Jun 2017 17:58:07 +0000 (17:58 +0000)] 
Add VEX fix 'powerpc too chatty even with --sigill-diagnostics=no' to NEWS.

Bug 381274. VEX svn r3398.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16452

8 years agoBug 381274 powerpc too chatty even with --sigill-diagnostics=no.
Mark Wielaard [Tue, 20 Jun 2017 17:55:13 +0000 (17:55 +0000)] 
Bug 381274 powerpc too chatty even with --sigill-diagnostics=no.

Even with valgrind --sigill-diagnostics=no (or -q) guest_ppc_toIR.c
will report various cases why it didn't handle an instruction. e.g.

  disInstr(ppc): found the Power 8 instruction 0x10000508 that can't be
  handled by Valgrind on this host.  This instruction requires a host
  that supports Power 8 instructions.

After which valgrind will generate a SIGILL. But in case the user uses
-q or --sigill-diagnostics=no they aren't interested in that diagnostics.
For example openssl will try some power 8 instructions while initializing
and catch the SIGILL if not supported without issue.

Guard those cases with if (sigill_diag) like the generic decode_failure.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3398

8 years agoepoll_pwait can have a NULL sigmask.
Mark Wielaard [Sat, 17 Jun 2017 13:49:22 +0000 (13:49 +0000)] 
epoll_pwait can have a NULL sigmask.

According to the epoll_pwait(2) man page:

       The  sigmask  argument  may  be  specified  as  NULL,  in  which  case
       epoll_pwait() is equivalent to epoll_wait().

But doing that under valgrind gives:

==13887== Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)
==13887==    at 0x4F2B940: epoll_pwait (epoll_pwait.c:43)
==13887==    by 0x400ADE: main (syscalls-2007.c:89)
==13887==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

This is because the sys_epoll_pwait wrapper has:

   if (ARG4)
      PRE_MEM_READ( "epoll_pwait(sigmask)", ARG5, sizeof(vki_sigset_t) );

Which looks like a typo (ARG4 is timeout and ARG5 is sigmask).

This shows up with newer glibc which translates an epoll_wait call into
an epoll_pwait call with NULL sigmask.

Fix typo and add a testcase.

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

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16451

8 years agoppc64 doesn't compile test_isa_2_06_partx.c without VSX support
Mark Wielaard [Fri, 16 Jun 2017 09:33:35 +0000 (09:33 +0000)] 
ppc64 doesn't compile test_isa_2_06_partx.c without VSX support

The #ifdef HAS_VSX guard is wrongly placed. It makes the standard
include headers not be used. Causing a build failure. Fix by moving
the #ifdef HAS_VSX after the standard includes.

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

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16450

8 years agoResync this with the 3.13.0 final version.
Julian Seward [Fri, 16 Jun 2017 09:13:41 +0000 (09:13 +0000)] 
Resync this with the 3.13.0 final version.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16449

8 years agoAnnounce fix for BZ#381162.
Ivo Raisr [Tue, 13 Jun 2017 18:15:26 +0000 (18:15 +0000)] 
Announce fix for BZ#381162.
Related VEX commit r3392.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16445

8 years agoFix a possible array overrun in VEX register allocator.
Ivo Raisr [Tue, 13 Jun 2017 18:14:28 +0000 (18:14 +0000)] 
Fix a possible array overrun in VEX register allocator.
Fixes BZ#381162.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3392

8 years agoFix a minor doc issue in cachegrind manual example
Philippe Waroquiers [Fri, 9 Jun 2017 19:28:04 +0000 (19:28 +0000)] 
Fix a minor doc issue in cachegrind manual example

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16444

8 years agofix: Bug 380202 - Assertion failure for cache line size (vg_assert(cls == 64)) on...
Julian Seward [Fri, 9 Jun 2017 13:13:48 +0000 (13:13 +0000)] 
fix: Bug 380202 - Assertion failure for cache line size (vg_assert(cls == 64)) on aarch64.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16438

8 years agoFix pub_tool_basics.h build issue with g++ 4.4.7.
Mark Wielaard [Tue, 6 Jun 2017 09:03:03 +0000 (09:03 +0000)] 
Fix pub_tool_basics.h build issue with g++ 4.4.7.

g++ 4.4.7 doesn't accept union field initializers:
In file included from ../../include/pub_tool_vki.h:50,
                 from valgrind_cpp_test.cpp:13:
../../include/vki/vki-linux.h: In function â€˜vki_cmsghdr* __vki_cmsg_nxthdr(void*, __vki_kernel_size_t, vki_cmsghdr*)’:
../../include/vki/vki-linux.h:673: error: expected primary-expression before â€˜.’ token

Assign value after declaration which works for any g++ version.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16437

8 years agoAdd a replacement for __GI_strcspn() required on s390x/Linux.
Ivo Raisr [Mon, 5 Jun 2017 21:09:06 +0000 (21:09 +0000)] 
Add a replacement for __GI_strcspn() required on s390x/Linux.
Fixes BZ#380397.
Patch by: Andreas Arnez <arnez@linux.vnet.ibm.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16436

8 years agoFix 380200 - xtree generated callgrind files refer to files without directory name
Philippe Waroquiers [Fri, 2 Jun 2017 21:15:04 +0000 (21:15 +0000)] 
Fix 380200 - xtree generated callgrind files refer to files without directory name

Patch from  Matthias Schwarzott, slightly modified

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16435

8 years agoUpdate version numbers for 3.13.
Julian Seward [Thu, 1 Jun 2017 15:44:29 +0000 (15:44 +0000)] 
Update version numbers for 3.13.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16431

8 years agoFinalise for 3.13.
Julian Seward [Thu, 1 Jun 2017 15:28:45 +0000 (15:28 +0000)] 
Finalise for 3.13.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16430

8 years agoBack out r16414 (Enable fair scheduling by default on Linux.) following
Julian Seward [Thu, 1 Jun 2017 05:46:54 +0000 (05:46 +0000)] 
Back out r16414 (Enable fair scheduling by default on Linux.) following
further investigations showing large performance losses in some case, and no
obvious way to fix the problem.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16428

8 years agoIgnore sim hint "no-nptl-pthread-stackcache"
Ivo Raisr [Wed, 31 May 2017 13:47:57 +0000 (13:47 +0000)] 
Ignore sim hint "no-nptl-pthread-stackcache"
on Solaris and Mac OS X. Do not produce a warning
message when it is given.
n-i-bz

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16424

8 years agoConnect also 32-bit cet_nops tests.
Ivo Raisr [Wed, 31 May 2017 12:36:26 +0000 (12:36 +0000)] 
Connect also 32-bit cet_nops tests.
Pertains to BZ#379525.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16423

8 years agoConnect cet_nops test cases with other OSes:
Ivo Raisr [Wed, 31 May 2017 11:22:06 +0000 (11:22 +0000)] 
Connect cet_nops test cases with other OSes:
- with fs prefix for Solaris
- with gs prefix for OS X (Darwin)
Pertains to BZ#379525.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16422