Carl Love [Thu, 21 Apr 2016 18:21:26 +0000 (18:21 +0000)]
PPC64, Valgrind with GDB does not display 64-bit and 128-bit registers
correctly
1) Fix Endianess issue that was missed in the BE to LE port. GDB was
not displaying the contents of the 64-bit and 128-bit registers
correctly due to an Endianess issue.
2) Fix displaying the shadow registers for the 64-bit and 128-bit
registers.
Ivo Raisr [Mon, 18 Apr 2016 10:28:53 +0000 (10:28 +0000)]
Clean up properly Valgrind coredump after tests
none/tests/solaris/reserve_sysstat_addr and reserve_sysstat_zone_addr.
The coredump is expected there as the test cases trigger unsupported
functionality.
n-i-bz
Ivo Raisr [Sun, 17 Apr 2016 19:28:04 +0000 (19:28 +0000)]
Fix compiler warnings on Solaris 12 about assigning a function pointer
of an incompatible type to signal handler.
Untyped function pointer sa_handler() is no longer available
so we leverage sa_sigaction(int, siginfo_t *, void *) instead.
n-i-bz
Ivo Raisr [Sun, 17 Apr 2016 15:57:11 +0000 (15:57 +0000)]
Fix build on newer illumos distributions which streamlined inclusion of sys/regset.h.
This means that sys/regset.h needs to be included explicitly now.
n-i-bz
Ivo Raisr [Fri, 8 Apr 2016 20:38:30 +0000 (20:38 +0000)]
Kludge for multiple .rodata sections on Solaris introduced by BZ#353802
is no longer needed. The situation with multiple ".rodata" sections existed
only between dozens of builds of Solaris 12.
Fixes BZ#360749
Ivo Raisr [Mon, 4 Apr 2016 02:25:40 +0000 (02:25 +0000)]
Fix expected output of massif/tests/{new-cpp,overloaded-new}
for libstdc++ from gcc5.
Even with fix for bug 345307 we still see allocations for
the emergency pool in libstdc++ which skew the expected results.
Mark Wielaard [Sun, 3 Apr 2016 20:33:11 +0000 (20:33 +0000)]
Bug 361354 ppc64[le]: wire up separate socketcalls system calls
Newer glibc will use separate socket related syscalls instead of using
the multiplexing socketcall systemcall. On Fedora rawhide this causes
several tests to fail.
Mark Wielaard [Sun, 3 Apr 2016 15:24:20 +0000 (15:24 +0000)]
Update gdbserver_tests filter for newer GDB version.
- Newer gdb say Thread .... hit Breakpoint, we expect just Breakpoint.
- We expect "Program received" instead of "Thread .... received"
- Ordering of ' Thread .... (tid .' might differ between gdb version,
so remove all such lines except the "current" one (starts with '*').
Both tests define a execute_native_thread_routine function that we
took from libstdc++. Unfortunately because of a bug this function
is not local in some versions of libstdc++ and so our similar named
function will clash when trying to link.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70476#c2
Simply rename our version to work around this.
Since we don't build this part of the test code for gcc >= 6, this
issue only happens if the buggy libstdc++ thread code is used together
with gcc 5. This is the case with for example devtoolset-4-gcc-5.
Ivo Raisr [Wed, 30 Mar 2016 17:53:03 +0000 (17:53 +0000)]
Run __gnu_cxx::__freeres() cleanup function available
from libstdc++ when available, similar to existing __libc_freeres().
New option --run-cxx-freeres=<yes|no> can be used to change whether
this cleanup function is called or not.
Note that __gnu_cxx::__freeres() is currently available
only in gcc 6. It is not yet decided what to do about
libstdc++ from gcc 5.
Tracked under https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69945
for libstdc++.
The following file was modified:
none/tests/ppc64/Makefile.am
Note, the NEWS file was not updated as the ISA 3.0 support is not complete yet. This is the
first of five sets of commits needed to add all of the ISA 3.0 support.
Carl Love [Tue, 29 Mar 2016 21:28:43 +0000 (21:28 +0000)]
Power PC Add support for ISA 3.0, part 1
The Floating-point condition code bits FPCC is bits[15:12] of the FPSCR.
The instructions fcmpu, fcmpo, dcmpu, dcmpq, dtstdc, dtstdcq, xscmpodq
and xscmpudq set the FPCC bits in addition to the BE field of the CC
register. This support is needed by the ISA 3.0 instructions to be added.
Julian Seward [Fri, 25 Mar 2016 14:27:20 +0000 (14:27 +0000)]
MC_(helperc_MAKE_STACK_UNINIT): make the #if 0'd bits of code actually
compile. This is clearly pointless but is done for a cleanliness
point of view. No functional change.
Julian Seward [Mon, 21 Mar 2016 20:04:05 +0000 (20:04 +0000)]
VG_(discard_translations):
* fix off-by-one error that forced use of the slow case unnecessarily
* change ECLASS_SHIFT from 11 to 13 so that ranges up to 8KB can fall
within an equivalence class, and increase ECLASS_WIDTH by 1 so as to
double the number of hash buckets (effectively).
These measures noticably improve the performance of modern Firefoxes,
since they do a lot of 4KB and 8KB discards as a result of mprotect
trickery used to implement W^X protection on JIT code pages.
Petar Jovanovic [Mon, 21 Mar 2016 14:05:23 +0000 (14:05 +0000)]
[mips] update stderr exp file for tc19_shadowmem
A few changes have had impact on expected output of tc19_shadowmem recently.
These are:
- r14175 (added extra "Block was alloc'd by thread #x" output)
- r13983 (removed "pthread_create_WRK (hg_intercepts.c:" output)
- r13965 (a few empty lines removed)
However, expected stderr file for mips32 has not been updated accordingly.
Update it now. This fixes helgrind/tests/tc19_shadowmem failure on mips32.
Mark Wielaard [Tue, 15 Mar 2016 13:56:19 +0000 (13:56 +0000)]
Bug #360519 none/tests/arm64/memory.vgtest might fail with newer gcc
The LDR (literal, int reg) testcase takes a code label and compares the
instructions around the label with known instructions in the code stream.
There were only fixed insns on either side of the checking instruction
which isn't enough given that offsets of +/-8 are used, instructions are
only 4 wide and the values loaded are 64bit. Newer gcc versions would
generate different code around the label and cause the tests to fail.
Add enough nops around the actual instruction to really give known
expected constant values to check against.
Mark Wielaard [Wed, 9 Mar 2016 16:18:37 +0000 (16:18 +0000)]
Bug 359503 - Add missing syscalls for aarch64 (arm64)
Enable more arm64 syscalls. ioprio_set, ioprio_get, preadv, pwritev,
vmsplice, splice, tee, waitid, clock_nanosleep and perf_event_open.
Reported and patch (mostly) by Marcin Juszkiewicz.
Mark Wielaard [Wed, 9 Mar 2016 16:18:36 +0000 (16:18 +0000)]
Add arm64 scalar test. Enable tested syscalls.
The new memcheck/tests/arm64-linux/scalar test is based on the
memcheck/tests/x86-linux/scalar test and contains all syscalls
that are also available on arm64. To make comparison of exp results
easier the order of the tested syscalls is the same as on x86.
This enables a couple extra arm64 syscalls. Part of the fix for
bug #359503 - Add missing syscalls for aarch64 (arm64).
Mark Wielaard [Wed, 9 Mar 2016 16:18:34 +0000 (16:18 +0000)]
Use correct syscall numbers on arm64. Fix rename, dup2 and getpgrp.
We were using some wrong syscall numbers in vki-scnums-arm64-linux.h
arm64 doesn't implement a couple of old deprecated system calls like
rename, dup2, getpgrp and fork. Adjust m_libcfile.c rename and dup2
functions to use renameat (also on tilegx) and dup3 (with fcntl fallback
for bad oldfd). And in m_libcproc.c implement getpgrp as getpgid(0).
Also don't compile the fork syswrap on arm64 (it only supports clone).
In practice this only affected callgrind which was unable to rename
dump files in some cases and ELF core dumps might have contained some
bogus prstatus fields.
Related to bug #359503 - Add missing syscalls for aarch64 (arm64)
Reported by Marcin Juszkiewicz who also posted a nice overview
of system calls on different linux architectures:
https://marcin.juszkiewicz.com.pl/2016/03/05/from-a-diary-of-aarch64-porter-system-calls/
Mark Wielaard [Sun, 28 Feb 2016 10:37:55 +0000 (10:37 +0000)]
Fix memcheck/tests/memalign_test expected output.
r15815 "Allow 8k and 32k page sizes" added an extra line in memalign_test.c.
This changed the line numbers in the output compared to the .exp file.
Just put everything on one (long) line to match expectations again.
Petar Jovanovic [Sat, 27 Feb 2016 00:38:38 +0000 (00:38 +0000)]
mips: acquire exact page size using sysconf for unit_libcbase
Set exact value of VKI_PAGE_SIZE by calling sysconf(_SC_PAGESIZE).
This should set a correct value to this variable on MIPS systems with
different page sizes.
Carl Love [Fri, 26 Feb 2016 17:38:47 +0000 (17:38 +0000)]
Power PPC test case test_isa_2_07 steps out of array bounds.
The test none/tests/ppc64/test_isa_2_07.c steps beyond the data array in a
number of places. The issue is the array is declared to be of size N. The for
loop is: for (i=0; i<N; i=i+2). In the body of the loop the array elements
A[i] and A[i+1] are accessed. On the last iteration i=N-1 and the second array
access becomes A[N-1+1] which accesses one element past the declared array
size.
This commit fixes the array bounds by making the for loop read:
Petar Jovanovic [Fri, 26 Feb 2016 15:30:53 +0000 (15:30 +0000)]
mips: determine page size at runtime
Instead of passing an option to the configure script, use runtime detection
of the page size. Remove the "--with-pagesize" parameter from the configure
script.
Also accept 8k and 32k as valid page sizes.
Mark Wielaard [Wed, 24 Feb 2016 11:12:01 +0000 (11:12 +0000)]
Bug 359733 amd64 implement ld.so strchr/index override like x86
The suppression and redirection for ld.so strchr/index isn't needed for
x86. When testing a newer glibc or calling the ld.so through an alternative
path neither the suppression (doesn't match path/name) nor the redirection
(triggers too late) works. Since there is already an hardwire override for
strlen in amd64 ld.so anyway it makes sense to also hardware index (it is
always called when ld.so loads the preload images).
This was also explained in the easy hacks Fosdem session.
See https://bugs.kde.org/show_bug.cgi?id=359733 for a pointer.
Petar Jovanovic [Tue, 23 Feb 2016 17:39:04 +0000 (17:39 +0000)]
mips32: minor modification to MoveIns test
While no issues have been reported with this test example, it was
misusing early-clobber constraints and missing some real constraints
on the other side. Fixing it now.
Mark Wielaard [Tue, 23 Feb 2016 15:19:49 +0000 (15:19 +0000)]
Bug 359703 s390: wire up separate socketcalls system calls
The linux 4.3 s390 kernel has separate system calls that were originally
hidden behind the socketcall multiplexer system call. Newer glibc versions
will use these direct system calls instead of socketcall when available.
Causing several regtest failures.
This fix simply wires up the split out system calls directly to the
existing syswrap handlers for s390.
Ivo Raisr [Thu, 18 Feb 2016 17:15:45 +0000 (17:15 +0000)]
Fix some compiler errors about accessing static variables
from non-static inline functions reported by gcc 5.3:
warning: "locf" is static but declared in inline function "fun_f" which is not static
While at it, silence also compiler warning about uninitialized
variable "result" when calling fun_a().
Carl Love [Thu, 18 Feb 2016 16:31:55 +0000 (16:31 +0000)]
Power PPC 128bit modulo and carry instruction fix
VEX commit 3209 fixed: an issue with caculating the carry to the next 32-bit
chunk for the Power PPC 128-bit add and subract instructions: vaddcuq, vadduqm,
vsubcuq, vsubuqm, vaddecuq, vaddeuqm, vsubecuq, vsubeuqm
The corresponding test case didn't catch the issue. The valgrind commit
15790 adds data values to the test that verify the issue is fixed.
Mark Wielaard [Thu, 18 Feb 2016 11:14:47 +0000 (11:14 +0000)]
Bug 359201 followup. futex skips argument 5 if op is FUTEX_WAIT_BITSET.
The original fix in svn r15793 read argument 6 separately by using PRA6
unconditionally. This is wrong. We need to first check whether a
track_pre_reg_read callback is registered (only memcheck does).
The PRE_REG_READX macro already had this check. Just add the same
before calling PRA6. Thanks to Tom Hughes for noticing. Without this
helgrind/tests/cond_timedwait_test and drd/tests/pth_inconsistent_cond_wait
regtests would fail.
Ivo Raisr [Wed, 17 Feb 2016 18:11:32 +0000 (18:11 +0000)]
Solaris syscall: commands A_GETSTAT and A_SETSTAT
for auditon(2) subcode of the auditsys() syscall
were removed in Solaris 12.
However they stay for Solaris 11 and illumos.
n-i-bz
Carl Love [Tue, 16 Feb 2016 21:23:52 +0000 (21:23 +0000)]
Power PPC 128bit modulo and carry instruction fix
VEX commit 3209 fixed: an issue with caculating the carry to the next 32-bit
chunk for the Power PPC 128-bit add and subract instructions: vaddcuq, vadduqm,
vsubcuq, vsubuqm, vaddecuq, vaddeuqm, vsubecuq, vsubeuqm
The corresponding test case didn't catch the issue. This commit adds data
values to the test that verify the issue is fixed.
Ivo Raisr [Fri, 12 Feb 2016 13:43:59 +0000 (13:43 +0000)]
New gcc versions (4.9, 5.3) provided by Solaris enable
largefile support by default. This gets in the way what
Valgrind core expects (vki, various m_libc modules).
Therefore disable largefile support if it is enabled.
Anyway, support for 32-bit applications is going away in Solaris 12.
Ivo Raisr [Sun, 7 Feb 2016 23:59:41 +0000 (23:59 +0000)]
Exclude 'threading model' information from Solaris coredump tests
Solaris 12 transitioned to public libproc and mdb now prints
'raw lwps' instead of 'native threads' for the threading model.
This information is irrelevant for coredump generation and analysis;
therefore leave it out.
n-i-bz
Mark Wielaard [Thu, 4 Feb 2016 22:38:06 +0000 (22:38 +0000)]
Explicitly test command -v host output before trying host command.
We have to explicitly test command -v host worked otherwise on systems
that do not have 'host' installed will return error code 127 and stop
testing. This is because vg_regtest uses '/bin/sh -c' to execute the
prereq command. Found by Petar Jovanovic.
Petar Jovanovic [Fri, 29 Jan 2016 17:47:43 +0000 (17:47 +0000)]
mips64: use getdents() if getdents64() is not available
The MIPS64 getdents64() system call is only present in 3.10+ kernels.
If the getdents64() system call is not available fall back to using
getdents() and modify the result to be compatible with getdents64().
This matters only when --track-fds=yes is set.
This change fixes none/tests/fdleak* failures on MIPS64 platforms with
kernel versions older than 3.10.
Fix misplaced closing parenthesis in various VG_(....) calls
At many places, we have:
VG_(fun(a,b,c))
instead of
VG_(fun)(a,b,c)
So, fix these cases, found using:
grep -n -i -e 'VG_([a-z][a-z0-9_]*[^a-z0-9_)]' *.c */*.c */*/*.c
Ivo Raisr [Tue, 26 Jan 2016 10:34:16 +0000 (10:34 +0000)]
Fix expected output of test memcheck/tests/leak_cpp_interior on Solaris 12.
C++ allocator from Solaris Studio allocates for std::string
57 bytes instead of former 40 bytes on 64-bit, and 45 bytes instead of 28 on 32-bit.
Confirmed with truss and --trace-alloc=yes.
n-i-bz
Change tests using --fullpath-after so as to work with ccache caching compiler
ccache sometimes causes the source file absolute name to be another
full path (not $PWD).
This means that the badfree3 and varinfo5 tests can fail due to
the full path after not being match on $PWD.
So, rather ask full path after a part of the path that is stable
even when ccache decides to reuse a already compiled object from
another directory.
Mark Wielaard [Fri, 22 Jan 2016 13:49:22 +0000 (13:49 +0000)]
Squash glibc warning about _BSD_SOURCE being deprecated tests.
glibc 2.20 deprecated _BSD_SOURCE and _SVID_SOURCE and now requires
_DEFAULT_SOURCE to be defined instead. Add _DEFAULT_SOURCE define to
prevent warnings like:
In file included from /usr/include/stdio.h:27:0,
from stack_switch.c:5:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
^
See https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes
Mark Wielaard [Thu, 21 Jan 2016 11:37:43 +0000 (11:37 +0000)]
Bug #357833 Setting RLIMIT_DATA to zero breaks with linux 4.5+
We used to set the process datasize rlimit to zero to prevent
any internal use of brk() from having any effect. But later
linux kernels redefine RLIMIT_DATA as the size of any data
areas, including some dynamic mmap memory allocations.
See bug #357833 for the commit that went into linux 4.5
changing the definition of RLIMIT_DATA. So don't mess with
RLIMIT_DATA anymore. Just remember it for use in the syscall
wrappers.
This also cleans up some hacks around the execv and spawn wrappers.