]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
6 years agos390x: More fixes for z13 support
Andreas Arnez [Thu, 26 Jul 2018 14:35:24 +0000 (16:35 +0200)] 
s390x: More fixes for z13 support

This patch addresses the following:

* Fix the implementation of LOCGHI.  Previously Valgrind performed 32-bit
  sign extension instead of 64-bit sign extension on the immediate value.

* Advertise VXRS in HWCAP.  If no VXRS are advertised, but the program
  uses vector registers, this could cause problems with a glibc built with
  "-march=z13".

6 years agoAdd support for Iop_{Sar,Shr}8 on ppc. --expensive-definedness-checks=yes needs...
Julian Seward [Tue, 20 Nov 2018 11:09:03 +0000 (12:09 +0100)] 
Add support for Iop_{Sar,Shr}8 on ppc.  --expensive-definedness-checks=yes needs them.

6 years agoVEX/priv/ir_opt.c
Julian Seward [Tue, 20 Nov 2018 10:46:55 +0000 (11:46 +0100)] 
VEX/priv/ir_opt.c

fold_Expr: transform PopCount64(And64(Add64(x,-1),Not64(x))) into CtzNat64(x).

This is part of the fix for bug 386945.

6 years agoppc front end: use new IROps added in 42719898.
Julian Seward [Tue, 20 Nov 2018 10:36:53 +0000 (11:36 +0100)] 
ppc front end: use new IROps added in 42719898.

This pertains to bug 386945.

VEX/priv/guest_ppc_toIR.c:

gen_POPCOUNT: use Iop_PopCount{32,64} where possible.

gen_vpopcntd_mode32: use Iop_PopCount32.

for cntlz{w,d}, use Iop_CtzNat{32,64}.

gen_byterev32: use Iop_Reverse8sIn32_x1 instead of lengthy sequence.

verbose_Clz32: remove (was unused anyway).

6 years agoAdd Memcheck support for IROps added in 42719898.
Julian Seward [Tue, 20 Nov 2018 10:28:42 +0000 (11:28 +0100)] 
Add Memcheck support for IROps added in 42719898.

memcheck/mc_translate.c:

Add mkRight{32,64} as right-travelling analogues to mkLeft{32,64}.

doCmpORD: for the cases of a signed comparison against zero, compute
definedness of the 3 result bits (lt,gt,eq) separately, and, for the lt and eq
bits, do it exactly accurately.

expensiveCountTrailingZeroes: no functional change.  Re-analyse/verify and add
comments.

expensiveCountLeadingZeroes: add.  Very similar to
expensiveCountTrailingZeroes.

Add some comments to mark unary ops which are self-shadowing.

Route Iop_Ctz{,Nat}{32,64} through expensiveCountTrailingZeroes.
Route Iop_Clz{,Nat}{32,64} through expensiveCountLeadingZeroes.

Add instrumentation for Iop_PopCount{32,64} and Iop_Reverse8sIn32_x1.

memcheck/tests/vbit-test/irops.c

Add dummy new entries for all new IROps, just enough to make it compile and
run.

6 years agoAdd ppc host-side isel and instruction support for IROps added in previous commit.
Julian Seward [Tue, 20 Nov 2018 10:07:37 +0000 (11:07 +0100)] 
Add ppc host-side isel and instruction support for IROps added in previous commit.

VEX/priv/host_ppc_defs.c, VEX/priv/host_ppc_defs.h:

Dont emit cnttz{w,d}.  We may need them on a target which doesn't support
them.  Instead we can generate a fairly reasonable alternative sequence with
cntlz{w,d} instead.

Add support for emitting popcnt{w,d}.

VEX/priv/host_ppc_isel.c

Add support for: Iop_ClzNat32 Iop_ClzNat64

Redo support for: Iop_Ctz{32,64} and their Nat equivalents, so as to not use
cnttz{w,d}, as mentioned above.

Add support for: Iop_PopCount64 Iop_PopCount32 Iop_Reverse8sIn32_x1

6 years agoAdd some new IROps to support improved Memcheck analysis of strlen etc.
Julian Seward [Tue, 20 Nov 2018 09:52:33 +0000 (10:52 +0100)] 
Add some new IROps to support improved Memcheck analysis of strlen etc.

This is part of the fix for bug 386945.  It adds the following IROps, plus
their supporting type- and printing- fragments:

Iop_Reverse8sIn32_x1: 32-bit byteswap.  A fancy name, but it is consistent
with naming for the other swapping IROps that already exist.

Iop_PopCount64, Iop_PopCount32: population count

Iop_ClzNat64, Iop_ClzNat32, Iop_CtzNat64, Iop_CtzNat32: counting leading and
trailing zeroes, with "natural" (Nat) semantics for a zero input, meaning, in
the case of zero input, return the number of bits in the word.  These
functionally overlap with the existing Iop_Clz64, Iop_Clz32, Iop_Ctz64,
Iop_Ctz32.  The existing operations are undefined in case of a zero input.
Adding these new variants avoids the complexity of having to change the
declared semantics of the existing operations.  Instead they are deprecated
but still available for use.

6 years agoget_otrack_shadow_offset_wrk for ppc32 and ppc64: add missing cases for XER_OV32...
Julian Seward [Tue, 20 Nov 2018 09:18:29 +0000 (10:18 +0100)] 
get_otrack_shadow_offset_wrk for ppc32 and ppc64: add missing cases for XER_OV32, XER_CA32 and C_FPCC.

The missing cases were discovered whilst testing fixes for bug 386945, but are
otherwise unrelated to that bug.

6 years agoFix Cachegrind's --help message.
Nicholas Nethercote [Fri, 16 Nov 2018 05:48:13 +0000 (16:48 +1100)] 
Fix Cachegrind's --help message.

6 years agoBug 397187 s390x: Add vector register support for vgdb
Andreas Arnez [Thu, 18 Oct 2018 15:51:57 +0000 (17:51 +0200)] 
Bug 397187 s390x: Add vector register support for vgdb

On s390x machines with a vector facility, Valgrind's gdbserver didn't
represent the vector registers.  This is fixed.

6 years agoBug 400491 s390x: Sign-extend immediate operand of LOCHI and friends
Andreas Arnez [Tue, 30 Oct 2018 16:06:38 +0000 (17:06 +0100)] 
Bug 400491 s390x: Sign-extend immediate operand of LOCHI and friends

The VEX implementation of each of the z/Architecture instructions LOCHI,
LOCHHI, and LOCGHI treats the immediate 16-bit operand as an unsigned
integer instead of a signed integer.  This is fixed.

6 years agoBug 400490 s390x: Fix register allocation for VRs vs FPRs
Andreas Arnez [Thu, 25 Oct 2018 11:47:12 +0000 (13:47 +0200)] 
Bug 400490 s390x: Fix register allocation for VRs vs FPRs

On s390x, if vector registers are available, they are fed to the register
allocator as if they were separate from the floating-point registers.  But
in fact the FPRs are embedded in the VRs.  So for instance, if both f3 and
v3 are allocated and used at the same time, corruption will result.

This is fixed by offering only the non-overlapping VRs, v16 to v31, to the
register allocator instead.

6 years agoMake white space style more consistent, no functional impact.
Philippe Waroquiers [Tue, 6 Nov 2018 20:40:43 +0000 (21:40 +0100)] 
Make white space style more consistent, no functional impact.

But this time, rather consistently use *no* space between function name and
function arg list.

6 years agoMake white space style more consistent, no functional impact.
Philippe Waroquiers [Sun, 4 Nov 2018 10:48:00 +0000 (11:48 +0100)] 
Make white space style more consistent, no functional impact.

Consistently use a space between function name and function arg list.

6 years agoFix dependencies between libcoregrind*.a and *m_main.o/*m_libcsetjmp.o
Philippe Waroquiers [Sun, 28 Oct 2018 17:35:11 +0000 (18:35 +0100)] 
Fix dependencies between libcoregrind*.a and *m_main.o/*m_libcsetjmp.o

The primary and secondary coregrind libraries must be updated
when m_main.c or m_libcsetjmp.c are changed.

A dependency was missing between libcoregrind*.a and libnolto_coregrind*.a,
and so tools were not relinked when m_main.c or m_libcsetjmp.c were
changed.

6 years agoFix 399301 - Use inlined frames in Massif XTree output.
Philippe Waroquiers [Sat, 27 Oct 2018 18:28:59 +0000 (20:28 +0200)] 
Fix 399301 - Use inlined frames in Massif XTree output.

Author: Nicholas Nethercote <nnethercote@mozilla.com>

Use inlined frames in Massif XTree output.

    This makes Massif's output much easier to follow.

    The commit also removes a -1 used on all Massif stack frame addresses.
    There was a big comment questioning the presence of that -1, and with it
    gone the addresses now match those produced by DHAT.

6 years agoUpdate configure.ac to next version 3.15.GIT ...
Philippe Waroquiers [Sat, 20 Oct 2018 14:54:19 +0000 (16:54 +0200)] 
Update configure.ac to next version 3.15.GIT ...

As pointed out by Rhys, we need a .GIT postfix waiting
for the release ...

6 years agoUpdate configure.ac to next version 3.15 ...
Philippe Waroquiers [Sat, 20 Oct 2018 09:44:00 +0000 (11:44 +0200)] 
Update configure.ac to next version 3.15 ...

6 years agoPrepare for the next 3.15 release
Philippe Waroquiers [Sat, 20 Oct 2018 09:37:26 +0000 (11:37 +0200)] 
Prepare for the next 3.15 release

* Create the 3.15 section in the NEWS file
  (the idea is that this section is maintained during the development,
   i.e. document user visible changes and/or the fixed bugs, as part of
   the commit).

* start the fixed bug list with 399322  Improve callgrind_annotate output

* update vg-entities.xml for 3.15 next release.

6 years agoImplement VG_(apply_ExeContext)().
Nicholas Nethercote [Fri, 19 Oct 2018 05:27:07 +0000 (16:27 +1100)] 
Implement VG_(apply_ExeContext)().

It's been declared for a long time, but was lacking a definition.

6 years agoImprove callgrind_annotate output.
Nicholas Nethercote [Wed, 3 Oct 2018 00:00:10 +0000 (10:00 +1000)] 
Improve callgrind_annotate output.

This commit makes two changes:

- it adds commas to call counts (e.g. `65658x` becomes `65,658x`);

- it sorts callers/callees in the tree by the --sort order.

An example, old output:
```
72,142,945  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x (65658x)
68,977,760  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x
       340  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:free (3x)
     4,564  >   /build/glibc-OTsEL5/glibc-2.27/nptl/pthread_mutex_unlock.c:pthread_mutex_unlock (163x)
 1,282,381  >   /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/strcmp.S:strcmp (12893x)
    13,310  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:calloc (4x)
       223  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_higher_prime_number (3x)
 1,741,689  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_name_match_p (16842x)
     5,705  >   /build/glibc-OTsEL5/glibc-2.27/nptl/../nptl/pthread_mutex_lock.c:pthread_mutex_lock (163x)

    51,454  < /build/glibc-OTsEL5/glibc-2.27/elf/../elf/dl-runtime.c:_dl_fixup (33x)
     2,456  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-sym.c:_dl_sym (2x)
100,313,502  < /build/glibc-OTsEL5/glibc-2.27/elf/../sysdeps/x86_64/dl-machine.h:_dl_relocate_object (39094x)
28,224,467  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x
72,142,945  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x (65658x)

[...]

  567        setLastUser(LastPMUses, P->getResolver()->getPMDataManager().getAsPass());
   18  => /home/njn/moz/rust0/src/llvm/include/llvm/IR/LegacyPassManagers.h:non-virtual thunk to llvm::FPPassManager::getAsPass() (9x)
1,971  => /home/njn/moz/rust0/src/llvm/lib/IR/LegacyPassManager.cpp:llvm::PMTopLevelManager::setLastUser(llvm::ArrayRef<llvm::Pass*>, llvm::Pass*)'2 (63x)
  108  => ???:non-virtual thunk to (anonymous namespace)::MPPassManager::getAsPass() (54x)
```

New output:
```
72,142,945  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x (65,658x)
68,977,760  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x
 1,741,689  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_name_match_p (16,842x)
 1,282,381  >   /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/strcmp.S:strcmp (12,893x)
    13,310  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:calloc (4x)
     5,705  >   /build/glibc-OTsEL5/glibc-2.27/nptl/../nptl/pthread_mutex_lock.c:pthread_mutex_lock (163x)
     4,564  >   /build/glibc-OTsEL5/glibc-2.27/nptl/pthread_mutex_unlock.c:pthread_mutex_unlock (163x)
       340  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:free (3x)
       223  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_higher_prime_number (3x)

100,313,502  < /build/glibc-OTsEL5/glibc-2.27/elf/../sysdeps/x86_64/dl-machine.h:_dl_relocate_object (39,094x)
    51,454  < /build/glibc-OTsEL5/glibc-2.27/elf/../elf/dl-runtime.c:_dl_fixup (33x)
     2,456  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-sym.c:_dl_sym (2x)
28,224,467  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x
72,142,945  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x (65,658x)

[...]

  567        setLastUser(LastPMUses, P->getResolver()->getPMDataManager().getAsPass());
1,971  => /home/njn/moz/rust0/src/llvm/lib/IR/LegacyPassManager.cpp:llvm::PMTopLevelManager::setLastUser(llvm::ArrayRef<llvm::Pass*>, llvm::Pass*)'2 (63x)
  108  => ???:non-virtual thunk to (anonymous namespace)::MPPassManager::getAsPass() (54x)
   18  => /home/njn/moz/rust0/src/llvm/include/llvm/IR/LegacyPassManagers.h:non-virtual thunk to llvm::FPPassManager::getAsPass() (9x)
```

6 years agoBug 399444 s390x: Drop unnecessary check in s390_irgen_VSLDB
Andreas Arnez [Tue, 9 Oct 2018 09:22:27 +0000 (11:22 +0200)] 
Bug 399444 s390x: Drop unnecessary check in s390_irgen_VSLDB

In s390_irgen_VSLDB there was special handling for the case that the
immediate operand i4 has the value 16, which would mean that the result v1
were a full copy of the third operand v3.  However, this is impossible
because i4 can only assume values from 0 to 15; thus the special handling
can be removed.

6 years ago--> 3.14.0 final VALGRIND_3_14_BRANCH VALGRIND_3_14_0
Julian Seward [Tue, 9 Oct 2018 11:52:05 +0000 (13:52 +0200)] 
--> 3.14.0 final

6 years agoFix macOS 10.13 building from tarball
Rhys Kidd [Mon, 8 Oct 2018 01:26:35 +0000 (21:26 -0400)] 
Fix macOS 10.13 building from tarball

Fixes: 1ce04c3 ("Preliminary support for Darwin 17.x (macOS 10.13)")
6 years ago--> 3.14.0.RC2
Julian Seward [Wed, 3 Oct 2018 13:37:06 +0000 (15:37 +0200)] 
--> 3.14.0.RC2

6 years agosigframe construction for x86-linux: ensure that ESP is correctly aligned before...
Julian Seward [Wed, 3 Oct 2018 13:29:42 +0000 (15:29 +0200)] 
sigframe construction for x86-linux: ensure that ESP is correctly aligned before entering the handler.  n-i-bz.

Without this, a signal handler compiled by Clang 6, which uses movdqa to load/store
relative to ESP, segfaults because the resulting address isn't 16-aligned.

6 years agox86 front end: handle UD2 as an officially recognised, unimplemented instruction...
Julian Seward [Wed, 3 Oct 2018 13:26:48 +0000 (15:26 +0200)] 
x86 front end: handle UD2 as an officially recognised, unimplemented instruction, like the amd64 front end does.  n-i-bz.

This doesn't change anything downstream -- a SIGILL is still raised -- but
there's a bit less debug printing now.

6 years ago--> 3.14.0.RC1
Julian Seward [Sun, 30 Sep 2018 08:21:27 +0000 (10:21 +0200)] 
--> 3.14.0.RC1

6 years agoMemcheck on amd64; fix false positive associated with spec cases {Z,NZ} after {LOGICB...
Julian Seward [Sun, 30 Sep 2018 07:29:43 +0000 (09:29 +0200)] 
Memcheck on amd64; fix false positive associated with spec cases {Z,NZ} after {LOGICB,LOGICW}.  n-i-bz.

For the spec cases {Z,NZ} after {LOGICB,LOGICW}, which are simply comparisons
of the result against zero, use Cmp{EQ,NE}32 rather than their 64-bit
counterparts.  This is because Memcheck on amd64 instruments the 32 bit
versions exactly, at the default --expensive-definedness-checks=auto setting.
The alternative would have been to make Memcheck also do exact instrumentation
of the 64 bit versions, but that would also burden all other 64 bit eq/ne
comparisons with that cost for no purpose.  So this is a cheaper solution.

6 years agoFix s390x_dirtyhelper_vec_op signature for non-s390x case.
Mark Wielaard [Thu, 27 Sep 2018 03:09:42 +0000 (05:09 +0200)] 
Fix s390x_dirtyhelper_vec_op signature for non-s390x case.

The definition of s390x_dirtyhelper_vec_op in guest_s390_helpers.c
didn't match the one from guest_s390_defs.h for the non-s390x case.
Causing a compiler warning/error.

6 years agos390x: Vector integer and string insn support -- tests
Andreas Arnez [Mon, 24 Sep 2018 17:08:01 +0000 (19:08 +0200)] 
s390x: Vector integer and string insn support -- tests

This adds test cases and some internal stuff to the z/Architecture vector
integer and string instruction support.

Contributed by Vadim Barkov <vbrkov@gmail.com>.

6 years agos390x: Vector integer and string instruction support
Andreas Arnez [Mon, 24 Sep 2018 16:56:07 +0000 (18:56 +0200)] 
s390x: Vector integer and string instruction support

This adds z/Architecture vector integer and string instruction support.

The main author of this patch is Vadim Barkov <vbrkov@gmail.com>.  Some
fixes were provided by Andreas Arnez <arnez@linux.ibm.com>.

6 years agoFix 398028 Assertion `cfsi_fits` failing in simple C program
Philippe Waroquiers [Wed, 26 Sep 2018 16:04:43 +0000 (18:04 +0200)] 
Fix 398028  Assertion `cfsi_fits` failing in simple C program

At least with libopenblas, we can have several rx mappings
with some holes between mappings.
Change the invariant (2) checking so that such holes are ok,
as long as no cfsi refers to such an hole.

6 years agoUpdate bug status for s390x conditional trap insn support
Andreas Arnez [Mon, 24 Sep 2018 16:03:47 +0000 (18:03 +0200)] 
Update bug status for s390x conditional trap insn support

This updates the bug status for git commit 20976f432, "s390x: Implement
conditional trap instructions".

6 years agos390x: Implement conditional trap instructions
Andreas Arnez [Wed, 25 Jul 2018 12:23:02 +0000 (14:23 +0200)] 
s390x: Implement conditional trap instructions

This implements various z/Architecture instructions that conditionally
yield a data exception ("trap").  The condition is either based on a
comparison being true ("compare and trap") or on a loaded value being
zero ("load and trap").  These instructions haven't been widely used in
the past, but may now be emitted by newer compilers.  Note that the
resulting signal for a data exception is SIGFPE, not SIGTRAP.  Thus this
patch also adds a new jump kind Ijk_SigFPE.

6 years agoHook up statx syscall for s390x-linux
Mark Wielaard [Sat, 22 Sep 2018 09:08:12 +0000 (11:08 +0200)] 
Hook up statx syscall for s390x-linux

Fixes memcheck/tests/linux/sys-statx.vgtest on s390x-linux.

6 years agoHook up linux membarrier syscall for s390x-linux
Mark Wielaard [Sat, 22 Sep 2018 09:02:08 +0000 (11:02 +0200)] 
Hook up linux membarrier syscall for s390x-linux

Fixes none/tests/linux/membarrier on s390x-linux.

6 years agoFix arm64-linux/scalar clone test argument check order.
Mark Wielaard [Wed, 19 Sep 2018 19:23:06 +0000 (21:23 +0200)] 
Fix arm64-linux/scalar clone test argument check order.

When the clone syscall was refactored to work across all linux arches
the arguments were checked in a different order. Fix the arm64-linux
scalar.stderr.exp to match the same order for the (invalid) clone
arguments.

This makes memcheck/tests/arm64-linux/scalar.vgtest pass again.

6 years agoRun power_ISA2_0[57] tests with -q
Mark Wielaard [Tue, 18 Sep 2018 20:55:45 +0000 (22:55 +0200)] 
Run power_ISA2_0[57] tests with -q

memcheck/tests/ppc64/power_ISA2_0[57] could spuriously fail when
some internal glibc function would allocate and free some memory.
To get the expected output run the tests with -q and clear stderr.exp.

6 years agoHook up linux membarrier syscall for x86-linux
Mark Wielaard [Tue, 18 Sep 2018 19:55:45 +0000 (21:55 +0200)] 
Hook up linux membarrier syscall for x86-linux

Fixes none/tests/linux/membarrier on x86-linux.

6 years agoHook up linux membarrier syscall for ppc64[le]
Mark Wielaard [Tue, 18 Sep 2018 16:21:21 +0000 (18:21 +0200)] 
Hook up linux membarrier syscall for ppc64[le]

Fixes none/tests/linux/membarrier on ppc64[le] platforms.

6 years agoUpdate.
Julian Seward [Tue, 18 Sep 2018 07:58:11 +0000 (09:58 +0200)] 
Update.

6 years agoBug 395991 - wine's unit tests enter a signal delivery loop under valgrind on armv7l...
Julian Seward [Tue, 18 Sep 2018 07:53:38 +0000 (09:53 +0200)] 
Bug 395991 - wine's unit tests enter a signal delivery loop under valgrind on armv7l when SIGSEGV is used.

On signal handler return, restore r0 .. r15 inclusive from the sigcontext that we
gave to the handler, so that any changes the handler has made to those values
will take effect on return.

6 years agoA bit of whitespace and guard changes relating to VGABI_N32. No functional change...
Julian Seward [Tue, 18 Sep 2018 07:24:01 +0000 (09:24 +0200)] 
A bit of whitespace and guard changes relating to VGABI_N32.  No functional change.  n-i-bz.

* coregrind/m_redir.c: whitespace changes only

* memcheck/mc_main.c:
  - change 6 guards of the form "defined (VGABI_N32)" to
    "defined(VGA_mips64) && defined(VGABI_N32)"
  - Fix up poor indentation

6 years agoDo not mention VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE to bypass shared memory...
Philippe Waroquiers [Sat, 15 Sep 2018 16:00:57 +0000 (18:00 +0200)] 
Do not mention VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE to bypass shared memory definedness false positive

as when the error is reported (e.g. conditional jump), it is not
known anymore that this originates from which memory range.

6 years agoUpdate filter_gdb to make nlvgdbsigqueue work with gdb 8.2
Philippe Waroquiers [Sat, 15 Sep 2018 09:26:52 +0000 (11:26 +0200)] 
Update filter_gdb to make nlvgdbsigqueue work with gdb 8.2

gdb 8.2 now produces a message 'remote target killed',
so have filter_gdb delete it.

Tested on debian/amd64 with gdb 7.12/8.0/8.1/8.2

6 years agoUpdate filter_gdb to make nlcontrolc work with gdb 8.2
Philippe Waroquiers [Sat, 15 Sep 2018 09:06:07 +0000 (11:06 +0200)] 
Update filter_gdb to make nlcontrolc work with gdb 8.2

gdb 8.2 has changed the layout of the thread list headers.

Tested on debian/amd64 with gdb 7.12/8.0/8.1/8.2

6 years agoUpdate test to make it work with gdb 8.2
Philippe Waroquiers [Sat, 15 Sep 2018 08:58:07 +0000 (10:58 +0200)] 
Update test to make it work with gdb 8.2

Tested on debian/amd64 with gdb 7.12/8.0/8.1/8.2

6 years agoAdd noinst_HEADERS = vector.h to none/tests/s390x/Makefile.am.
Mark Wielaard [Fri, 14 Sep 2018 22:00:13 +0000 (00:00 +0200)] 
Add noinst_HEADERS = vector.h to none/tests/s390x/Makefile.am.

The vector.h file should end up in the dist tar.

6 years agoUpdate vg-entities.xml and valgrind.h for next version number.
Mark Wielaard [Fri, 14 Sep 2018 21:12:45 +0000 (23:12 +0200)] 
Update vg-entities.xml and valgrind.h for next version number.

6 years agoInclude suppsrc_lineno.supp and suppsrc_sanlineno.supp in EXTRA_DIST.
Mark Wielaard [Fri, 14 Sep 2018 20:55:17 +0000 (22:55 +0200)] 
Include suppsrc_lineno.supp and suppsrc_sanlineno.supp in EXTRA_DIST.

These are test file that are needed in the dist tar.

6 years agoUpdate somewhat more for 3.14 final.
Julian Seward [Fri, 14 Sep 2018 11:48:54 +0000 (13:48 +0200)] 
Update somewhat more for 3.14 final.

6 years agoBug 397089 - (TESTCASES FOR) Incorrect decoding of three-register vmovss/vmovsd opcod...
Julian Seward [Fri, 14 Sep 2018 11:23:19 +0000 (13:23 +0200)] 
Bug 397089 - (TESTCASES FOR) Incorrect decoding of three-register vmovss/vmovsd opcode 11h.

Adds test cases, that check both the 10h and 11h decodings.  For some reason
the expected output diff is huge.  I don't know why.  It is the same as what
the hardware produces, though.

6 years agoBug 397089 - Incorrect decoding of three-register vmovss/vmovsd opcode 11h.
Julian Seward [Fri, 14 Sep 2018 11:19:34 +0000 (13:19 +0200)] 
Bug 397089 - Incorrect decoding of three-register vmovss/vmovsd opcode 11h.

This fixes the incorrect 11h decoding of three-register vmovss/vmovsd.
Patch from Tomas Trnka (tomastrnka@gmx.com).

6 years agoImprove doc to describe limitations discussed in 398445 (false positive on shared...
Philippe Waroquiers [Thu, 13 Sep 2018 19:13:51 +0000 (21:13 +0200)] 
Improve doc to describe limitations discussed in 398445 (false positive on shared memory)

6 years agoMention --keep-debuginfo=yes in the FAQ for unloaded shared objects.
Philippe Waroquiers [Thu, 13 Sep 2018 19:12:56 +0000 (21:12 +0200)] 
Mention --keep-debuginfo=yes in the FAQ for unloaded shared objects.

6 years agoUpdate NEWS with bug fix for KDE #373069
Petar Jovanovic [Mon, 10 Sep 2018 10:12:57 +0000 (10:12 +0000)] 
Update NEWS with bug fix for KDE #373069

KDE #373069 memcheck/tests/leak_cpp_interior fails with GCC 5.1+
was (partially) fixed in r16217.

6 years agoUpdate NEWS with bug fix for KDE #396906
Petar Jovanovic [Tue, 4 Sep 2018 21:23:03 +0000 (21:23 +0000)] 
Update NEWS with bug fix for KDE #396906

Fixed in the previous commit.

6 years agomips32: fix broken inline asm in helgrind/tests/tc08_hbl2.c
Petar Jovanovic [Tue, 4 Sep 2018 21:20:39 +0000 (21:20 +0000)] 
mips32: fix broken inline asm in helgrind/tests/tc08_hbl2.c

Remove the duplicated L1xyzzy1main, and use local symbol to replace.

This fixes KDE #396906.

Patch by Hongxu Jia <hongxu.jia@windriver.com>

6 years agoComplete first-pass triage of all reported bugs.
Julian Seward [Tue, 4 Sep 2018 08:07:58 +0000 (10:07 +0200)] 
Complete first-pass triage of all reported bugs.

6 years agoAlmost catch up with first-pass triaging of bugs.
Julian Seward [Mon, 3 Sep 2018 10:02:19 +0000 (12:02 +0200)] 
Almost catch up with first-pass triaging of bugs.

6 years agoBug 398066 s390x: cgijl dep1, 0 reports false uninitialised values warning.
Mark Wielaard [Mon, 3 Sep 2018 10:56:53 +0000 (12:56 +0200)] 
Bug 398066 s390x: cgijl dep1, 0 reports false uninitialised values warning.

This is similar to bug #387712 (about cgijnl), but a newer gcc uses cgijl
now. So use a similar fix when cc_dep2 is zero, only check whether the
most significant bit of cc_dep1 is set to 1.

6 years agoBug 397354 utimensat should ignore tv_sec if tv_nsec is UTIME_NOW/OMIT.
Mark Wielaard [Mon, 3 Sep 2018 09:54:38 +0000 (11:54 +0200)] 
Bug 397354 utimensat should ignore tv_sec if tv_nsec is UTIME_NOW/OMIT.

When code uses utimensat with UTIME_NOW or UTIME_OMIT valgrind memcheck
would generate a warning. But as the utimensat manpage says:

  If the tv_nsec field of one of the timespec structures has the  special
  value  UTIME_NOW,  then  the corresponding file timestamp is set to the
  current time.  If the tv_nsec field of one of the  timespec  structures
  has the special value UTIME_OMIT, then the corresponding file timestamp
  is left unchanged.  In both of these cases, the  value  of  the  corre‐
  sponding tv_sec field is ignored.

So ignore the timespec tv_sec when tv_nsec is set to UTIME_NOW or
UTIME_OMIT.

6 years agoFix Bug 397424 - glibc 2.27 and gdb_server tests
Philippe Waroquiers [Sun, 2 Sep 2018 12:19:57 +0000 (14:19 +0200)] 
Fix Bug 397424 - glibc 2.27 and gdb_server tests

commit a214595daed7830a091dcd0f52c5b8073bfd04dd already handled some
of the new differences created by glib 2.27.

This commit should filter the new way gdb shows a select syscall
with glibc 2.27

6 years agoFix 393146 failing assert "is_DebugInfo_active(di)"
Philippe Waroquiers [Sat, 1 Sep 2018 21:36:42 +0000 (23:36 +0200)] 
Fix 393146 failing assert "is_DebugInfo_active(di)"

Some applications are mapping an object ro, and then unmaps it directly.
In such a case, we have a di that contains obsolete fsm.maps (not matching
OS mappings). The di for this unmapped object is not active,
and has no dinfo (have_dinfo == False).
(more generally, fsm.maps can contain a whole bunch of obsolete mappings).

Later on, some other libs can be mapped with a mapping overlapping
this obsolete mapping.

A di that never had its debug info loaded can really be discarded,
even if CG_(clo_keep_debuginfo).
In such a case, it is normal to have to discard a not active di.

(it might be better to keep fsm.maps in sync with the real OS
mapping, but that is a much bigger change/fix).

The FSM debug tracing was static, it is now dynamic according
to debug loglevel >= 3.

The below is an extract of the trace showing what happens.

SYSCALL[4384,1](257) sys_openat ( 4294967196, 0x4244398(/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so), 524288 ) --> [async] ...
SYSCALL[4384,1](257) ... [async] --> Success(0x3)
SYSCALL[4384,1](72) sys_fcntl[ARG3=='arg'] ( 3, 2, 1 )[sync] --> Success(0x0)
SYSCALL[4384,1](5) sys_newfstat ( 3, 0x1ffefff8b0 )[sync] --> Success(0x0)
SYSCALL[4384,1](5) sys_newfstat ( 3, 0x1ffefff9c0 )[sync] --> Success(0x0)
SYSCALL[4384,1](9) sys_mmap ( 0x0, 10520, 1, 1, 3, 0 )--4384-- di_notify_mmap-0:
--4384-- di_notify_mmap-1: 0x4027000-0x4029fff r--
--4384-- di_notify_mmap-2: /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so
--4384-- di_notify_mmap-3: is_rx_map 0, is_rw_map 0, is_ro_map 1
--4384-- di_notify_mmap-4: noting details in DebugInfo* at 0x10024CEA10
--4384-- di_notify_mmap-6: no dinfo loaded /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so (no rx or no rw mapping)
 --> [pre-success] Success(0x4027000)
SYSCALL[4384,1](3) sys_close ( 3 )[sync] --> Success(0x0)
SYSCALL[4384,1](11) sys_munmap ( 0x4027000, 10520 )[sync] --> Success(0x0)
  ^^^^ the above munmap has not cleaned up or removed anything in DebugInfo* at 0x10024CEA10

Later on, /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so is mapped
overlapping the memory where libqeglfs.so was mapped ro.

Now, this cleans up the (useless) di that never had have_dinfo true, e.g.

------ start ELF OBJECT -------------------------------------------------------
------ name = /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
...
--4384-- Discarding syms at 0x0-0x0 in /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so (have_dinfo 0)
(the 0x0-0x0 in the trace is because there was never any text mapping for libqeglfs.so).

6 years agoChange filter_memcheck_monitor as glibc 2.27 seems to keep some more memory
Philippe Waroquiers [Sat, 1 Sep 2018 16:51:21 +0000 (18:51 +0200)] 
Change filter_memcheck_monitor as glibc 2.27 seems to keep some more memory

There is no real need to verify how much memory is still in use at
exit, so filter this in filter_memcheck_monitor.

Analysis by Dimitrije Nikolic

6 years agomips: Fix asm in m_debuglog.c
Petar Jovanovic [Fri, 24 Aug 2018 13:59:14 +0000 (15:59 +0200)] 
mips: Fix asm in m_debuglog.c

Add missing clobbers in local_sys_write_stderr() and local_sys_getpid()
functions.

Patch by Aleksandar Rikalo.

6 years agomips: fix unhandled mips64-linux syscall: 5326
Petar Jovanovic [Thu, 23 Aug 2018 15:20:06 +0000 (17:20 +0200)] 
mips: fix unhandled mips64-linux syscall: 5326

This fixes memcheck/tests/linux/sys-statx on MIPS64.

6 years agomips: skip MSA tests for the secondary target
Petar Jovanovic [Thu, 23 Aug 2018 13:14:18 +0000 (13:14 +0000)] 
mips: skip MSA tests for the secondary target

No need for MSA tests for the secondary target. This change removes
build warnings present with the secondary target.

6 years agomacos: Fix missing syscall ulock_wait (OS X 10.12). bz#379754
Rhys Kidd [Mon, 12 Feb 2018 01:42:17 +0000 (20:42 -0500)] 
macos: Fix missing syscall ulock_wait (OS X 10.12). bz#379754

Based upon patch available at:
https://bugs.kde.org/attachment.cgi?id=105482

6 years agomacos: Fix valgrind OS-X build: config.h not found (out-of-tree macOS builds). bz...
Rhys Kidd [Sun, 19 Aug 2018 18:22:13 +0000 (14:22 -0400)] 
macos: Fix valgrind OS-X build: config.h not found (out-of-tree macOS builds). bz#396475

Patch from Rob Boehne.

6 years agoarm64 front end: add early-writeback handling for w (32 bit int) and q (128 bit)...
Julian Seward [Sun, 19 Aug 2018 07:18:20 +0000 (09:18 +0200)] 
arm64 front end: add early-writeback handling for w (32 bit int) and q (128 bit) stores.

Clang 6.0.1 creates instructions of the form str wX, [sp,#-N] and str qX,
[sp,#-N], and the lack of early writeback causes many false positive errors
from Memcheck, plus it potentially breaks the segfault-based main-thread stack
extension mechanism.  This commit adds support for them, using the same scheme
with which existing cases are handled.

6 years agosupp_pattEQinp: initialise a variable that gcc 7.3.1 + LTO thinks might be used unini...
Julian Seward [Sun, 19 Aug 2018 07:13:30 +0000 (09:13 +0200)] 
supp_pattEQinp: initialise a variable that gcc 7.3.1 + LTO thinks might be used uninitialised.

6 years agoFix 388174 - valgrind with Wine quits with "Assertion 'cfsi_fits' failed"
Julian Seward [Fri, 17 Aug 2018 07:31:37 +0000 (09:31 +0200)] 
Fix 388174 - valgrind with Wine quits with "Assertion 'cfsi_fits' failed"

In check_CFSI_related_invariants, this commit improves the check for invariant
(2), which, as noted in an existing comment, "might need to be improved".
Instead of assuming that the CFSI range fits entirely into one "rx" mapping,
check that it is covered by the union of all the "rx" mappings we have.  This
is the correct check.  The previous check was observed to have failed as below
for at least some Clang generated objects (possibly in conjunction with lld as
the linker.)

valgrind: m_debuginfo/debuginfo.c:717 (check_CFSI_related_invariants): Assertion 'cfsi_fits' failed.

6 years agoAdd changes to ensure that a DebugInfo that has been archived cannot be archived...
Julian Seward [Fri, 17 Aug 2018 07:09:21 +0000 (09:09 +0200)] 
Add changes to ensure that a DebugInfo that has been archived cannot be archived again.

* discard_or_archive_marked_DebugInfos: clear the mark bit for a Debuginfo
  that will be archived

* discard_DebugInfos_which_overlap_with: when selecting DebugInfos to be
  discarded or archived, fix a mistake in which some mark bits wouldn't be
  changed at all, meaning their "old" value was used to influence the current
  operation.

These may (or may not) fix #393146; at the very least, they are somehow
related.

6 years agoOn x86: enable by default, expensive-when-needed instrumentation of Add32.
Julian Seward [Fri, 17 Aug 2018 06:40:40 +0000 (08:40 +0200)] 
On x86: enable by default, expensive-when-needed instrumentation of Add32.

This reduces Memcheck's false-positive level a lot on clang -O2 generated
code.

6 years agox86 front end: add spec rules for S/NS after SUBL(x, 0)
Julian Seward [Fri, 17 Aug 2018 06:37:06 +0000 (08:37 +0200)] 
x86 front end: add spec rules for S/NS after SUBL(x, 0)

This reduces Memcheck's false-positive level on clang -O2 generated code.

6 years agoImprove bpf wrapper to check arguments more carefully
Tom Hughes [Tue, 14 Aug 2018 19:46:22 +0000 (20:46 +0100)] 
Improve bpf wrapper to check arguments more carefully

6 years agoAdd file descriptor tracking in wrappers for bpf system call
Quentin Monnet [Sat, 14 Apr 2018 22:56:37 +0000 (23:56 +0100)] 
Add file descriptor tracking in wrappers for bpf system call

Support for the bpf system call was added in a previous commit, but
did not include tracking for file descriptors handled by the call.

Add checks and tracking for file descriptors. Check in PRE() wrapper
that all file descriptors (pointing to object such as eBPF programs or
maps, cgroups, or raw tracepoints) used by the system call are valid,
then add tracking in POST() wrapper for newly produced file descriptors.

As the file descriptors are not always processed in the same way by the
bpf call, add to the header file some additional definitions from bpf.h
that are necessary to sort out under what conditions descriptors should
be checked in the PRE() helper.

6 years agoAdd support for bpf system call
Quentin Monnet [Wed, 4 Apr 2018 23:40:49 +0000 (00:40 +0100)] 
Add support for bpf system call

Fixes: 388786 - Support bpf syscall in amd64 Linux
Add support for bpf() Linux-specific system call on amd64 platform. The
bpf() syscall is used to handle eBPF objects (programs and maps), and
can be used for a number of operations. It takes three arguments:

- "cmd" is an integer encoding a subcommand to run. Available subcommand
  include loading a new program, creating a map or updating its entries,
  retrieving information about an eBPF object, and may others.
- "attr" is a pointer to an object of type union bpf_attr. This object
  converts to a struct related to selected subcommand, and embeds the
  various parameters used with this subcommand. Some of those parameters
  are read by the kernel (example for an eBPF map lookup: the key of the
  entry to lookup), others are written into (the value retrieved from
  the map lookup).
- "attr_size" is the size of the object pointed by "attr".

Since the action performed by the kernel, and the way "attr" attributes
are processed depends on the subcommand in use, the PRE() and POST()
wrappers need to make the distinction as well. For each subcommand, mark
the attributes that are read or written.

For some map operations, the only way to infer the size of the memory
areas used for read or write operations seems to involve reading
from /proc/<pid>/fdinfo/<fd> in order to retrieve the size of keys
and values for this map.

The definitions of union bpf_attr and of other eBPF-related elements
required for adequately performing the checks were added to the Linux
header file.

Processing related to file descriptors is added in a follow-up patch.

6 years agoMove pre_check for ASCII string out of PRE(sys_prctl)
Quentin Monnet [Sat, 14 Apr 2018 22:23:11 +0000 (23:23 +0100)] 
Move pre_check for ASCII string out of PRE(sys_prctl)

The sys_prctl wrapper with PR_SET_NAME option reads an ASCII string passed
as its second argument. This string is supposed to be shorter than a given
limit. As the actual length of the string is unknown, the PRE() wrapper
performs a number of checks on it, including, in worst case, trying to
dereference it byte by byte.

To avoid re-implementing all this logic for other wrappers that could
need it, get the string processing out of the wrapper and move it to a
static function. Note that passing tid as an argument to the function is
required for macros PRE_MEM_RASCIIZ and PRE_MEM_READ to work properly.

6 years agoVG_(di_notify_mmap): once we've read debuginfo for an object, ignore all further...
Julian Seward [Tue, 14 Aug 2018 08:13:46 +0000 (10:13 +0200)] 
VG_(di_notify_mmap): once we've read debuginfo for an object, ignore all further mappings.  n-i-bz.

Once we've read debuginfo for an object, ignore all further mappings.  If we
don't do that, applications that mmap in their own objects to inspect them for
whatever reason, will cause "irrelevant" mappings to be recorded in the
object's fsm.maps table.  This can lead to serious problems later on.

This has become necessary because 64aa729bfae71561505a40c12755bd6b55bb3061 of
Thu Jul 12 2018 (the fix for bug 395682) started recording readonly segments
in the fsm.maps table, where before they were ignored.

6 years agoMake sys-statx.c test compile with glibc >= 2.28
Philippe Waroquiers [Sun, 12 Aug 2018 11:27:38 +0000 (13:27 +0200)] 
Make sys-statx.c test compile with glibc >= 2.28

Newer glibc >= 2.28 provides a wrapper (and struct definitions) for statx.
So, only include linux/stat.h on older glibc.

This fixes a build failure on (at least) fedora 29 with glibc 2.28

6 years agoAnnounce in NEWS the fix for unhandled amd64-linux syscall: 332 (statx)
Philippe Waroquiers [Sat, 11 Aug 2018 14:00:43 +0000 (16:00 +0200)] 
Announce in NEWS the fix for unhandled amd64-linux syscall: 332 (statx)

Fix was pushed as 8bc2b6fd26070f9f4d3f067910eb3e3b5e662fd7

6 years agoFix 392118 - unhandled amd64-linux syscall: 332 (statx)
Philippe Waroquiers [Sat, 11 Aug 2018 13:56:56 +0000 (15:56 +0200)] 
Fix 392118 - unhandled amd64-linux syscall: 332 (statx)

Code patch provided by Mattias Andrée

Added a regression test to (somewhat) test stat and statx.

Tested on amd64 only.

6 years agoFix warning that VG_(free(basename)) might discard const qualifier
Philippe Waroquiers [Fri, 10 Aug 2018 04:35:02 +0000 (06:35 +0200)] 
Fix warning that VG_(free(basename)) might discard const qualifier

So, unconditionally allocate some memory in a non const variable.

6 years agomips64: change memcheck/tests/mips64/filter_stderr
Petar Jovanovic [Thu, 9 Aug 2018 10:40:46 +0000 (12:40 +0200)] 
mips64: change memcheck/tests/mips64/filter_stderr

This change removes backtrace line (posix_fadvise64.c) that is not always in
output of the failing test (fadvise64).
It fixes memcheck/tests/mips64/fadvise64 on MIPS64 platforms with glibc 2.27
or newer.

Patch by Dimitrije Nikolic.

7 years agomips: add membarrier system call support
Petar Jovanovic [Tue, 7 Aug 2018 12:09:43 +0000 (14:09 +0200)] 
mips: add membarrier system call support

Fixes none/tests/linux/membarrier on MIPS platforms.

7 years agoBug 397012 - glibc ld.so uses arch_prctl on i386.
Mark Wielaard [Tue, 31 Jul 2018 13:32:43 +0000 (15:32 +0200)] 
Bug 397012 - glibc ld.so uses arch_prctl on i386.

arch_prctl used to be amd64 only. But since linux 4.12 it is also
implemented for i386. And since glibc 2.28 ld.so will use it to see
if the cpu/kernel provides CET support.

To prevent seeing:

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

on every program run under valgrind just make it explicitly
not implemented (ENOSYS). This is fine for the glibc usage.
It just indicates there is no CET support.

7 years agoUpdate.
Julian Seward [Mon, 6 Aug 2018 09:05:31 +0000 (11:05 +0200)] 
Update.

7 years agoFix a few leaks in VG_(make_core_dump)
Philippe Waroquiers [Wed, 1 Aug 2018 19:49:07 +0000 (21:49 +0200)] 
Fix a few leaks in VG_(make_core_dump)

Probably not very critical, as very surely the process will die
shortly after, but better still clean the memory, as the code
was already doing some effort to free memory (e.g. VG_(free)(seg_starts);).

Note that when testing on debian 9/amd64, the resulting core dump
was not very usable (e.g. was not really showing what the guest threads
are doing). So, there must be a bug in the core dumping logic.

7 years agoFix segmentation violation caused by stack misalignment when vgdb use ptrace to force...
Philippe Waroquiers [Wed, 1 Aug 2018 17:37:13 +0000 (19:37 +0200)] 
Fix segmentation violation caused by stack misalignment when vgdb use ptrace to force activate gdbserver

On amd64, on a big application, a vgdb call that wakes up the application
using ptrace fails unfrequently (we speak about one failure every few thousands vgdb calls).
The failure started to appear when valgrind was compiled with gcc 7.3 instead of gcc 6.4

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

The fix consists in respecting the ABI.

Without the patch, segmentation violation due to an sse instruction
being executed with an address on the stack not aligned on 16 bytes,
happening something like every 5000 vgdb execution.
With the patch, 250_000 executions without problems.

7 years agoRemove the useless (Addr) cast when calculating the highest stack byte addr
Philippe Waroquiers [Mon, 30 Jul 2018 22:08:38 +0000 (00:08 +0200)] 
Remove the useless (Addr) cast when calculating the highest stack byte addr

Cast not needed, as stack_low_addr is an Addr.

7 years agoFix wrong stack range output by commit 7daa08611 (more info in scheduler state)
Philippe Waroquiers [Mon, 30 Jul 2018 20:28:48 +0000 (22:28 +0200)] 
Fix wrong stack range output by commit 7daa08611 (more info in scheduler state)

The stack base starts at the beginning of the protection page/zone,
so we need to add VG_STACK_GUARD_SZB to get the real lowest usable
byte.
As the VgStack is an opaque type, add a function in aspacemgr to
return the Addr of the first lowest usable byte.

7 years agoBug 396887 - arch_prctl should return EINVAL on unknown option.
Mark Wielaard [Mon, 30 Jul 2018 10:20:16 +0000 (12:20 +0200)] 
Bug 396887 - arch_prctl should return EINVAL on unknown option.

Currently arch_prctl calls VG_(core_panic) when it sees an unknown
arch_prctl option which kills the process. glibc uses arch_prctl with
an (as yet) unknown option to see if the kernel supports CET. This
breaks any application running under valgrind on x86_64 with:

valgrind: the 'impossible' happened:
   Unsupported arch_prctl option

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

We already handle all known options. It would be better to do as the
kernel does and just return failure with EINVAL instead.

7 years agoFix uninitialised epoch when recording execontext.
Philippe Waroquiers [Sun, 29 Jul 2018 19:21:07 +0000 (21:21 +0200)] 
Fix uninitialised epoch when recording execontext.

A fresh execontext must have a DiEpoch_INVALID()
but the epoch was left uninitialised.

This was detected by self-hosting valgrind.

7 years agoEven more triaging.
Julian Seward [Sat, 28 Jul 2018 22:06:02 +0000 (00:06 +0200)] 
Even more triaging.

7 years agoGive some more information in the scheduler information thread status
Philippe Waroquiers [Fri, 27 Jul 2018 22:36:35 +0000 (00:36 +0200)] 
Give some more information in the scheduler information thread status

* In case a thread is executing a syscall, give the syscall no being
  executed.
* Show the address range of the valgrind stack, similarly to the client
  stack

7 years agoUpdate bug status.
Julian Seward [Fri, 27 Jul 2018 15:22:43 +0000 (17:22 +0200)] 
Update bug status.

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