]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
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.

7 years agoDon't cast an initializer to the struct type in power_insn_available.c.
Mark Wielaard [Thu, 18 Jan 2018 10:28:11 +0000 (11:28 +0100)] 
Don't cast an initializer to the struct type in power_insn_available.c.

In C99 mode casting the initializer to the struct type will cause gcc
to report an error like:
power_insn_available.c:38:1: error: initializer element is not constant

Simply removing the unnecessary cast fixes this (and is also valid C90).

7 years agoMake sure we can compile in C99 mode.
Mark Wielaard [Wed, 17 Jan 2018 12:30:35 +0000 (13:30 +0100)] 
Make sure we can compile in C99 mode.

Use AC_PROG_CC_C99 in configure.ac to make sure the compiler we use is
always in C99 mode. If we detect the compiler doesn't support C99 then
error out.

7 years agoRefix dlclose_leak.c test.
Mark Wielaard [Tue, 16 Jan 2018 10:23:42 +0000 (11:23 +0100)] 
Refix dlclose_leak.c test.

By introducing an extra line to declare int i; we broke the expected
line numbers in the test. Just declare i on the same line as the for loop.

7 years agoFix memcheck/tests/linux/dlclose_leak.c build under -std=gnu90.
Mark Wielaard [Tue, 16 Jan 2018 10:08:59 +0000 (11:08 +0100)] 
Fix memcheck/tests/linux/dlclose_leak.c build under -std=gnu90.

Older gcc (4.8) default to GNU C90. Causing:

dlclose_leak.c:14:5: error: â€˜for’ loop initial declarations are only
                     allowed in C99 mode

Fix by declaring int i before the loop.

7 years agoBug 79362 - Debug info is lost for .so files when they are dlclose'd. Followup fix...
Julian Seward [Mon, 15 Jan 2018 10:25:12 +0000 (11:25 +0100)] 
Bug 79362 - Debug info is lost for .so files when they are dlclose'd.  Followup fix to avoid assertion failure when dlopening an object that has previously been dlclosed.

As reported by Matthias Schwarzott <zzam@gentoo.org>.  Testcase patch from him.  The fix is
for check_CFSI_related_invariants() to avoid checking for overlaps against DebugInfos that are
in 'archived' status, since -- if a previously dlopened-and-then-dlclosed object is later
re-dlopened -- this may cause an overlap between the active and archived DebugInfos, which
is of no consequence.  If the kernel maps the object to the same VMA the second time around
then there will *certainly* be an overlap.

7 years agoAdditional fix for gnu debug alt file resolving.
Mark Wielaard [Sat, 13 Jan 2018 13:33:50 +0000 (14:33 +0100)] 
Additional fix for gnu debug alt file resolving.

Also handle the case where the symlink itself contains a relative path.
Then we need to add the symlink dir before it.

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

7 years agomips: fix build failure introduced with "Bug 79362 - Debug info ..."
Petar Jovanovic [Fri, 12 Jan 2018 17:15:36 +0000 (18:15 +0100)] 
mips: fix build failure introduced with "Bug 79362 - Debug info ..."

Previous commit (cceed053ce876560b9a7512125dd93c7fa059778) broke the build
for MIPS architecture.
Update the code in VG_(get_StackTrace_wrk) to reflect the changes made in
the previous commit.

7 years agoBug 79362 - Debug info is lost for .so files when they are dlclose'd. Majorly rework...
Julian Seward [Thu, 11 Jan 2018 18:40:12 +0000 (19:40 +0100)] 
Bug 79362 - Debug info is lost for .so files when they are dlclose'd.  Majorly reworked by Philippe Waroquiers.

7 years agoBug 385408 - s390x: z13 vector "support" instructions not implemented. Patch from...
Julian Seward [Thu, 11 Jan 2018 17:20:27 +0000 (18:20 +0100)] 
Bug 385408 - s390x: z13 vector "support" instructions not implemented.  Patch from Vadim Barkov (vbrkov@gmail.com).

(from bug 385408 comment 0):
Valgrind currently lacks support for the z/Architecture vector "support"
instructions introduced with z13.  These are documented in the
z/Architecture Principles of Operation, Eleventh Edition (March, 2015),
chapter 21: "Vector Overview and Support Instructions".

7 years agoFix memcheck/tests/vbit-test (the vbit test program) to track changes in bug 387664.
Julian Seward [Wed, 3 Jan 2018 10:55:44 +0000 (11:55 +0100)] 
Fix memcheck/tests/vbit-test (the vbit test program) to track changes in bug 387664.

Bug 387664 changes the default settings for accurate definedness checking
for {Add,Sub}{32,64} and {CmpEQ,CmpNE}{8,16,32,64}.  This fix updates the
vbit tester (memcheck/tests/vbit-test) to test the accurate versions of
these, and thereby fixes a regression caused by
e847cb5429927317023d8410c3c56952aa47fb08 as committed for bug 387664.

7 years agoexpensiveAddSub(): Fix incorrect comment. No functional change.
Julian Seward [Wed, 3 Jan 2018 10:38:14 +0000 (11:38 +0100)] 
expensiveAddSub(): Fix incorrect comment.  No functional change.

7 years agoRemove compiler warning about possibly uninitialized variable.
Ivo Raisr [Wed, 13 Dec 2017 15:59:03 +0000 (16:59 +0100)] 
Remove compiler warning about possibly uninitialized variable.

This happened only with quite an old gcc version.
Anyway, this commit simplifies the situation a bit.

7 years agoFix gnu debug alt file resolving.
Mark Wielaard [Sat, 9 Dec 2017 22:01:29 +0000 (23:01 +0100)] 
Fix gnu debug alt file resolving.

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

The path to the alt file is relative to the actual debug file.
Make sure that we got the real file, not a (build-id) symlink.
Also handle the case where a debug or alt file is an absolute path.

7 years agoFix false positive with s390x cgijnl instruction testing against sign bit.
Julian Seward [Tue, 12 Dec 2017 21:31:54 +0000 (22:31 +0100)] 
Fix false positive with s390x cgijnl instruction testing against sign bit.

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

When the cgij "compare immediate and branch relative" instruction
compares 0 <=signed dep1, that means dep1 >=signed 0, so it is a test
against the most significant bit of dep1. So only that bit needs
to be defined.

7 years agoRemove old Haskell and orig diff files.
Mark Wielaard [Tue, 12 Dec 2017 18:13:08 +0000 (19:13 +0100)] 
Remove old Haskell and orig diff files.

These files haven't been used for the last 20 years.

7 years agoBug 387664 - Memcheck: make expensive-definedness-checks be the default
Julian Seward [Tue, 12 Dec 2017 09:22:51 +0000 (10:22 +0100)] 
Bug 387664 - Memcheck: make expensive-definedness-checks be the default

Memcheck tries to accurately track definedness at the bit level, at least
for scalar integer operations.  For many operations it is good enough to use
approximations which may overstate the undefinedness of the result of an
operation, provided that fully defined inputs still produce a fully defined
output.  For example, the standard analysis for an integer add is

   Add#(x#, y#) = Left(UifU(x#, y#))

which (as explained in the USENIX 05 paper
http://valgrind.org/docs/memcheck2005.pdf) means: for an add, worst-case
carry propagation is assumed.  So all bits to the left of, and including,
the rightmost undefined bit in either operand, are assumed to be undefined.

As compilers have become increasingly aggressive, some of these
approximations are no longer good enough.  For example, LLVM for some years
has used Add operations with partially undefined inputs, when it knows that
the carry propagation will not pollute important parts of the result.
Similarly, both GCC and LLVM will generate integer equality comparisons with
partially undefined inputs in situations where it knows the result of the
comparison will be defined.  In both cases, Memcheck's default strategies
give rise to false uninitialised-value errors, and the problem is getting
worse as time goes by.

Memcheck already has expensive (non-default) instrumentation for integer
adds, subtracts, and equality comparisons.  Currently these are only used if
you specify --expensive-definedness-checks=yes, and in some rare cases to do
with inlined string operations, as determined by analysing the block to be
instrumented, and by default on MacOS.  The performance hit from them can be
quite high, up to 30% lossage.

This patch makes the following changes:

* During instrumentation, there is much finer control over which IROps get
  expensive instrumentation.  The following groups can now be selected
  independently for expensive or cheap instrumentation:

     Iop_Add32
     Iop_Add64
     Iop_Sub32
     Iop_Sub64
     Iop_CmpEQ32 and Iop_CmpNE32
     Iop_CmpEQ64 and Iop_CmpNE64

  This makes it possible to only enable, on a given platform, only the minimal
  necessary set of expensive cases.

* The default set of expensive cases can be set on a per-platform basis.
  This is set up in the first part of MC_(instrument).

* There is a new pre-instrumentation analysis pass.  It identifies Iop_Add32
  and Iop_Add64 uses for which the expensive handling will give the same
  results as the cheap handling.  This includes all adds that are used only
  to create memory addresses.  Given that the expensive handling of adds is,
  well, expensive, and that most adds merely create memory addresses, this
  more than halves the extra costs of expensive Add handling.

* The pre-existing "bogus literal" detection (0x80808080, etc) pass
  has been rolled into the new pre-instrumentation analysis.

* The --expensive-definedness-checks= flag has been changed.  Before, it
  had two settings, "no" and "yes", with "no" being the default.  Now, it
  has three settings:

   no -- always use the cheapest handling

   auto -- use the minimum set of expensive handling needed to get
           reasonable results on this platform, and perform
           pre-instrumentation analysis so as to minimise the costs thereof

   yes -- always use the most expensive handling

  The default setting is now "auto".  The user-visible effect of the new
  default is that there should (hopefully) be a drop in false positive rates
  but (unfortunately) also some drop in performance.

7 years agoFix this test to work properly with accurate CmpEQ/NE definedness tracking
Julian Seward [Thu, 7 Dec 2017 12:31:38 +0000 (13:31 +0100)] 
Fix this test to work properly with accurate CmpEQ/NE definedness tracking

Memcheck reports an error on "if (n == 42)" in this test.  Unless, that is,
accurate CmpEQ/NE definedness tracking is enabled.  If you stare at this
long enough it is possible to see that the test "n == 42" isn't actually
undefined, because |n| is only ever zero or one, and only its least
significant bit is undefined.  So the equality comparison against 42 is
defined because there are corresponding bits in the two operands that are
different and are both defined.

This commit fixes that by comparing with 1, which forces the result to
really depend on the only undefined bit in |n|.

I also added robustification:

* return arbitrary values from gcc_cant_inline_me(), so as to avoid gcc
  simply copying the input to the output or otherwise deleting the
  conditional branch.

* marking gcc_cant_inline_me() as un-inlineable

* Putting compiler barriers in the second conditional in main(), so gcc
  can't simply ignore the result of the call to gcc_cant_inline_me() and
  then delete the call entirely.

7 years agoamd64: add a spec rule for SHRL/SARL then CondS. gcc-8 has been seen to generate...
Julian Seward [Thu, 7 Dec 2017 11:24:57 +0000 (12:24 +0100)] 
amd64: add a spec rule for SHRL/SARL then CondS.  gcc-8 has been seen to generate such things.

7 years agoamd64: Add a new spec rule for SUBL then Cond{B,NB} in the case where the RHS is...
Julian Seward [Tue, 5 Dec 2017 11:35:09 +0000 (12:35 +0100)] 
amd64: Add a new spec rule for SUBL then Cond{B,NB} in the case where the RHS is a constant power of two.

LLVM 5.0 appears to have started generating such constructions in order to
find out whether the top N bits of a value are all zero.  This currently
generates Iop_CmpLE32U on partially uninitialised data, causing false
positives in Memcheck.  It seems simplest and most efficient to remove such
constructions at this point.

7 years agoRearrange sections in mc_translate.c. No functional change.
Julian Seward [Tue, 5 Dec 2017 11:04:17 +0000 (12:04 +0100)] 
Rearrange sections in mc_translate.c.  No functional change.

Rearrange big sections in mc_translate.c, so that the "main" instrumentation
function is at the end of the file rather than in the middle.  The previous
layout never made much sense.  The new layout is, roughly:

* stuff for baseline (level 2, non-origin tracking) instrumentation
* stuff for origin tracking (level 3) instrumentation
* the "final tidying" pass
* the main instrumentation function (and soon, a new pre-instrumentation
  analysis pass)

7 years agoWhen user asks enough verbosity, also give the full version in preamble
Philippe Waroquiers [Tue, 21 Nov 2017 21:17:47 +0000 (22:17 +0100)] 
When user asks enough verbosity, also give the full version in preamble

so that e.g.
   valgrind -v date
produces
   ==7639== Using Valgrind-3.14.0.GIT-c470e0c23c-20171120X and LibVEX; rerun with -h for copyright info
to give the verbose version.

7 years agoarm(32)-linux: add support for the TPIDRURW system register. Fixes #386425.
Julian Seward [Mon, 20 Nov 2017 10:43:55 +0000 (11:43 +0100)] 
arm(32)-linux: add support for the TPIDRURW system register.  Fixes #386425.

7 years agoBypass gcc code generation bug triggered by -finline-functions
Philippe Waroquiers [Thu, 16 Nov 2017 21:53:46 +0000 (22:53 +0100)] 
Bypass gcc code generation bug triggered by -finline-functions

commit 7dd9a7f8b3118c25014b0a77aff899e517c46bcd has added the flag -finline-functions.

This triggers a code generation bug in gcc 6.3.0
(at least with gcc version 6.3.0 20170516 (Debian 6.3.0-18)).
(this bug can be reproduced e.g. on gcc67, which is a debian 9.2 system)

The bad code causes the debug trace to be indented by more than 500 characters,
giving e.g. for the first debug line produced by stage 2:
--12305:1:launcher launching /home/philippe/valgrind/git/smallthing/./.in_place/memcheck-amd64-linux
--12305:1:debuglog                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  DebugLog system started by Stage 2 (main), level 1 logging requested

This commit bypasses the code generation bug, by moving the indent calculation
just before its usage.

Note: on amd64/x86, the code size of memcheck tool increases by about 12%
with -finline-functions.
In terms of perf impact (using perf/vg_perf) this gives mixed results :
   memcheck is usually slightly faster, but some tests are slower (e.g. heap_pdb4)
   callgrind is usually slower, but some tests are faster
   helgrind : some tests are slowed down, some tests are faster (some significantly faster such as sarp and ffbench).

See below 2 runs of comparing trunk (with -finline-functions) with fixes
(which does not have -finline-functions).

-- Running  tests in perf ----------------------------------------------
-- bigcode1 --
bigcode1 trunk_untouched:0.07s  me: 2.2s (32.0x, -----)  he: 1.7s (23.9x, -----)  ca: 9.0s (129.0x, -----)
bigcode1 fixes     :0.07s  me: 2.3s (32.3x, -0.9%)  he: 1.7s (23.9x,  0.0%)  ca: 8.8s (125.4x,  2.8%)
-- bigcode2 --
bigcode2 trunk_untouched:0.07s  me: 5.0s (72.1x, -----)  he: 3.2s (46.0x, -----)  ca:18.6s (266.4x, -----)
bigcode2 fixes     :0.07s  me: 5.1s (73.0x, -1.2%)  he: 3.2s (46.1x, -0.3%)  ca:18.4s (262.9x,  1.3%)
-- bz2 --
bz2      trunk_untouched:0.43s  me: 4.5s (10.4x, -----)  he: 6.7s (15.5x, -----)  ca:10.4s (24.2x, -----)
bz2      fixes     :0.43s  me: 4.5s (10.5x, -0.4%)  he: 6.7s (15.5x,  0.0%)  ca:10.1s (23.4x,  3.4%)
-- fbench --
fbench   trunk_untouched:0.14s  me: 2.7s (19.6x, -----)  he: 1.9s (13.4x, -----)  ca: 4.0s (28.3x, -----)
fbench   fixes     :0.14s  me: 2.8s (19.9x, -1.8%)  he: 2.0s (14.6x, -8.5%)  ca: 3.9s (28.1x,  0.8%)
-- ffbench --
ffbench  trunk_untouched:0.15s  me: 2.6s (17.1x, -----)  he: 3.4s (22.4x, -----)  ca: 1.5s (10.1x, -----)
ffbench  fixes     :0.15s  me: 2.6s (17.3x, -0.8%)  he: 3.1s (20.9x,  6.8%)  ca: 1.5s (10.0x,  1.3%)
-- heap --
heap     trunk_untouched:0.05s  me: 3.6s (72.8x, -----)  he: 5.0s (100.0x, -----)  ca: 4.9s (98.2x, -----)
heap     fixes     :0.05s  me: 3.7s (73.6x, -1.1%)  he: 5.1s (102.4x, -2.4%)  ca: 4.8s (95.6x,  2.6%)
-- heap_pdb4 --
heap_pdb4 trunk_untouched:0.06s  me: 5.9s (97.7x, -----)  he: 5.6s (93.7x, -----)  ca: 5.2s (86.8x, -----)
heap_pdb4 fixes     :0.06s  me: 5.8s (96.0x,  1.7%)  he: 5.7s (95.3x, -1.8%)  ca: 5.3s (87.7x, -1.0%)
-- many-loss-records --
many-loss-records trunk_untouched:0.01s  me: 1.0s (101.0x, -----)  he: 0.8s (85.0x, -----)  ca: 0.8s (78.0x, -----)
many-loss-records fixes     :0.01s  me: 1.0s (100.0x,  1.0%)  he: 0.9s (86.0x, -1.2%)  ca: 0.8s (78.0x,  0.0%)
-- many-xpts --
many-xpts trunk_untouched:0.03s  me: 1.1s (38.3x, -----)  he: 1.4s (46.0x, -----)  ca: 1.9s (62.7x, -----)
many-xpts fixes     :0.03s  me: 1.1s (37.0x,  3.5%)  he: 1.4s (47.0x, -2.2%)  ca: 1.8s (61.3x,  2.1%)
-- memrw --
memrw    trunk_untouched:0.04s  me: 0.9s (21.5x, -----)  he: 2.3s (58.0x, -----)  ca: 1.9s (46.8x, -----)
memrw    fixes     :0.04s  me: 0.9s (22.0x, -2.3%)  he: 2.3s (58.0x,  0.0%)  ca: 1.9s (47.2x, -1.1%)
-- sarp --
sarp     trunk_untouched:0.02s  me: 1.5s (77.0x, -----)  he: 3.4s (168.5x, -----)  ca: 1.3s (63.0x, -----)
sarp     fixes     :0.02s  me: 1.6s (80.0x, -3.9%)  he: 4.0s (200.5x,-19.0%)  ca: 1.3s (65.5x, -4.0%)
-- tinycc --
tinycc   trunk_untouched:0.10s  me: 6.7s (66.7x, -----)  he: 6.6s (65.9x, -----)  ca: 7.2s (72.4x, -----)
tinycc   fixes     :0.10s  me: 6.6s (66.0x,  1.0%)  he: 6.8s (68.0x, -3.2%)  ca: 7.2s (72.1x,  0.4%)
-- Finished tests in perf ----------------------------------------------

== 12 programs, 72 timings =================

-- Running  tests in perf ----------------------------------------------
-- bigcode1 --
bigcode1 trunk_untouched:0.07s  me: 2.2s (32.0x, -----)  he: 1.7s (23.7x, -----)  ca: 9.0s (129.1x, -----)
bigcode1 fixes     :0.07s  me: 2.3s (32.3x, -0.9%)  he: 1.7s (23.9x, -0.6%)  ca: 8.8s (125.3x,  3.0%)
-- bigcode2 --
bigcode2 trunk_untouched:0.07s  me: 5.0s (72.1x, -----)  he: 3.2s (46.0x, -----)  ca:18.7s (266.6x, -----)
bigcode2 fixes     :0.07s  me: 5.1s (72.9x, -1.0%)  he: 3.2s (46.0x,  0.0%)  ca:18.5s (263.7x,  1.1%)
-- bz2 --
bz2      trunk_untouched:0.43s  me: 4.5s (10.5x, -----)  he: 6.7s (15.5x, -----)  ca:10.4s (24.2x, -----)
bz2      fixes     :0.43s  me: 4.5s (10.5x, -0.2%)  he: 6.7s (15.5x, -0.2%)  ca:10.1s (23.4x,  3.3%)
-- fbench --
fbench   trunk_untouched:0.14s  me: 2.8s (19.6x, -----)  he: 1.9s (13.4x, -----)  ca: 4.0s (28.2x, -----)
fbench   fixes     :0.14s  me: 2.8s (19.9x, -1.1%)  he: 2.0s (14.6x, -8.5%)  ca: 3.9s (28.1x,  0.3%)
-- ffbench --
ffbench  trunk_untouched:0.15s  me: 2.6s (17.1x, -----)  he: 3.4s (22.5x, -----)  ca: 1.5s (10.1x, -----)
ffbench  fixes     :0.15s  me: 2.6s (17.3x, -0.8%)  he: 3.1s (20.8x,  7.4%)  ca: 1.5s ( 9.9x,  2.0%)
-- heap --
heap     trunk_untouched:0.05s  me: 3.6s (72.6x, -----)  he: 5.0s (99.4x, -----)  ca: 4.9s (98.4x, -----)
heap     fixes     :0.05s  me: 3.7s (73.6x, -1.4%)  he: 5.1s (102.4x, -3.0%)  ca: 4.8s (95.2x,  3.3%)
-- heap_pdb4 --
heap_pdb4 trunk_untouched:0.06s  me: 5.9s (98.0x, -----)  he: 5.6s (94.0x, -----)  ca: 5.2s (86.8x, -----)
heap_pdb4 fixes     :0.06s  me: 5.8s (96.0x,  2.0%)  he: 5.7s (94.8x, -0.9%)  ca: 5.2s (87.3x, -0.6%)
-- many-loss-records --
many-loss-records trunk_untouched:0.01s  me: 1.0s (101.0x, -----)  he: 0.8s (85.0x, -----)  ca: 0.8s (76.0x, -----)
many-loss-records fixes     :0.01s  me: 1.0s (100.0x,  1.0%)  he: 0.9s (87.0x, -2.4%)  ca: 0.8s (77.0x, -1.3%)
-- many-xpts --
many-xpts trunk_untouched:0.03s  me: 1.2s (38.7x, -----)  he: 1.4s (45.3x, -----)  ca: 1.9s (62.7x, -----)
many-xpts fixes     :0.03s  me: 1.1s (37.0x,  4.3%)  he: 1.4s (47.0x, -3.7%)  ca: 1.8s (61.3x,  2.1%)
-- memrw --
memrw    trunk_untouched:0.04s  me: 0.9s (22.0x, -----)  he: 2.3s (58.2x, -----)  ca: 1.9s (46.5x, -----)
memrw    fixes     :0.04s  me: 0.9s (21.8x,  1.1%)  he: 2.3s (58.2x,  0.0%)  ca: 1.9s (47.2x, -1.6%)
-- sarp --
sarp     trunk_untouched:0.02s  me: 1.5s (76.5x, -----)  he: 3.4s (167.5x, -----)  ca: 1.3s (63.0x, -----)
sarp     fixes     :0.02s  me: 1.6s (79.5x, -3.9%)  he: 4.0s (200.5x,-19.7%)  ca: 1.3s (65.5x, -4.0%)
-- tinycc --
tinycc   trunk_untouched:0.10s  me: 6.6s (66.3x, -----)  he: 6.6s (66.2x, -----)  ca: 7.2s (72.4x, -----)
tinycc   fixes     :0.10s  me: 6.6s (66.1x,  0.3%)  he: 6.8s (68.1x, -2.9%)  ca: 7.2s (72.2x,  0.3%)
-- Finished tests in perf ----------------------------------------------

== 12 programs, 72 timings =================

7 years agoAdd .stderr.exp file for memcheck/tests/linux/capget when running inside Docker conta...
Ivo Raisr [Wed, 15 Nov 2017 22:33:27 +0000 (23:33 +0100)] 
Add .stderr.exp file for memcheck/tests/linux/capget when running inside Docker container.

7 years agoUpdate .gitignore for Solaris.
Ivo Raisr [Tue, 14 Nov 2017 13:11:40 +0000 (13:11 +0000)] 
Update .gitignore for Solaris.

7 years agoUpdate NEWS after fixing BZ#208052.
Ivo Raisr [Tue, 14 Nov 2017 09:51:49 +0000 (10:51 +0100)] 
Update NEWS after fixing BZ#208052.

7 years agoAvoid underflow in strlcpy and strlcat wrappers when count is zero
Tom Hughes [Tue, 14 Nov 2017 09:16:26 +0000 (09:16 +0000)] 
Avoid underflow in strlcpy and strlcat wrappers when count is zero

We can't decrement n because it's unsigned and might be zero which
means it would wrap and we'd wind up reading far too much.

Fixes BZ#208052

7 years agosynchronize access to vgdb_interrupted_tid
Petar Jovanovic [Mon, 13 Nov 2017 12:12:25 +0000 (13:12 +0100)] 
synchronize access to vgdb_interrupted_tid

Delay writing to the global vgdb_interrupted_tid until all the threads are
in interruptible state. This ensures that valgrind_wait() will see correct
value.

This solves occasional failures of gdbserver_tests/hgtls test.

7 years agoImprove efficiency of SP tracking in helgrind (and incidentally in exp-sgheck)
Philippe Waroquiers [Sat, 4 Nov 2017 22:32:19 +0000 (23:32 +0100)] 
Improve efficiency of SP tracking in helgrind (and incidentally in exp-sgheck)

Helgrind (and incidentally exp-sgcheck) does not need both of
tracking new mem stack and die mem stack:
Helgrind only tracks new mem stack. exp-sgcheck only tracks die mem stack.

Currently, m_translate.c vg_SP_update_pass inserts helpers calls
for new and die mem stack, even if the tool only needs new mem stack (helgrind)
or die mem stack (exp-sgcheck).

The optimisation consists in not inserting helpers calls when the tool
does not need to see new (or die) mem stack.
Also, for helgrind, implement specialised new_mem_stack for known SP updates
with small values (like memcheck).

This reduces the size of the generated code for helgrind and exp-sgcheck.
(see below the diffs on perf/memrw). This does not impact the code generation
for tools that tracks both new and die mem stack (such as memcheck).

trunk:
exp-sgcheck: --28481--  transtab: new        2,256 (44,529 -> 581,402; ratio 13.1) [0 scs] avg tce size 257
helgrind:    --28496--  transtab: new        2,299 (46,667 -> 416,575; ratio 8.9) [0 scs] avg tce size 181
memcheck:    --28501--  transtab: new        2,220 (50,038 -> 777,139; ratio 15.5) [0 scs] avg tce size 350

with this patch:
exp-sgcheck: --28516--  transtab: new        2,254 (44,479 -> 567,196; ratio 12.8) [0 scs] avg tce size 251
helgrind:    --28512--  transtab: new        2,297 (46,620 -> 399,799; ratio 8.6) [0 scs] avg tce size 174
memcheck:    --28507--  transtab: new        2,219 (49,991 -> 776,028; ratio 15.5) [0 scs] avg tce size 349

More in details, the changes consist in:

pub_core_tooliface.h:
  * add 2 booleans any_new_mem_stack and any_die_mem_stack to the tdict struct
  * renamed VG_(sanity_check_needs) to VG_(finish_needs_init), as it
    does now more than sanity checks : it derives the 2 above booleans.
m_tooliface.c:
  * change VG_(sanity_check_needs) to VG_(finish_needs_init)
m_main.c:
  * update call to VG_(sanity_check_needs)
hg_main.c:
  * add a few inlines for functions just calling another function
  * define the functions evh__new_mem_stack_[4|8|12|16|32|112|128|144|160]
    (using the macro DCL_evh__new_mem_stack).
  * call the VG_(track_new_mem_stack_[4|8|12|16|32|112|128|144|160])
m_translate.c
  * n_SP_updates_* stats are now maintained separately for the new and die
    fast and known cases.
  * need_to_handle_SP_assignment can now check only the 2 booleans
    any_new_mem_stack and any_die_mem_stack
  * DO_NEW macro: does not insert anymore a helper call if the tool does
    not track 'new' mem_stack.
    In case there is no new tracking, it however still does update the
    SP aliases (and the n_SP_updates_new_fast).
  * similar changes for DO_DIE macro.
  * a bunch of white spaces changes
 Note: it is easier to look at the changes in this file using
   git diff -w
 to ignore the white spaces changes (e.g. due to DO_NEW/DO_DIE indentation
 changes).

regtested on debian/amd64 and on centos/ppc64

7 years agoMove or conditionalise on CHECK_CEM some expensive asserts
Philippe Waroquiers [Sat, 4 Nov 2017 22:31:19 +0000 (23:31 +0100)] 
Move or conditionalise on CHECK_CEM some expensive asserts

* Some RCEC related asserts checking there was no corruption are on hot paths
   => make these checks only when CHECK_CEM is set.
* Move an expensive assert where the event is inserted, as it is useless
  to check this when searching for an already existing event :
  it is enough to ensure that an invalid szB cannot be inserted,
  and so will not be found, and so assert will trigger in the insertion logic.

7 years agos390_irgen_EX_SS: add initialisations so as to remove (false positive) warnings from...
Julian Seward [Tue, 7 Nov 2017 14:01:51 +0000 (15:01 +0100)] 
s390_irgen_EX_SS: add initialisations so as to remove (false positive) warnings from gcc-7.x.

When compiling guest_s390_toIR.c for a 32-bit target (a configuration in which
it will never be used, but never mind), gcc-7.x notices that sizeof(ss.dec) is
larger than sizeof(ss.bytes), so the initialisation of ss.bytes leaves ss.dec.b2
and ss.dec.d2 uninitialised.  This patch causes both variants to be initialised.
When built for a 64 bit target, the existing initialisation of ss.bytes covers
ss.dec completely, so there is no error.

7 years agoAdd -finline-functions to standard build flags, so gcc will consider all functions...
Julian Seward [Tue, 7 Nov 2017 13:18:16 +0000 (14:18 +0100)] 
Add -finline-functions to standard build flags, so gcc will consider all functions as candidates for inlining.

7 years agoOptionally exit on the first error with --exit-on-first-error=<yes|no>.
Ivo Raisr [Sat, 4 Nov 2017 13:29:48 +0000 (14:29 +0100)] 
Optionally exit on the first error with --exit-on-first-error=<yes|no>.

Fixes BZ#385939.
Slightly modified patch by: Fauchet Gauthier <gauthier.fauchet@free.fr>