Petar Jovanovic [Fri, 3 Feb 2017 01:19:55 +0000 (01:19 +0000)]
fix leak-segv-jmp test for platforms with 64K pagesize
Increase the size of allocated array, so mprotect call does not end up
protecting non-allocated areas. This enables the test to work on
platforms with pagesize=64K.
Issue discovered on MIPS XLP machine with 64K pagesize.
Petar Jovanovic [Fri, 3 Feb 2017 00:34:52 +0000 (00:34 +0000)]
add suppression for helgrind/tests/tc22_exit_w_lock
Function pthread_create indirectly calls function memcpy. Helgrind
considers that memcpy is not thread safe function. For error reported
from pthread_create there is the suppression helgrind---_dl_allocate_tls
in the file glibc-2.34567-NPTL-helgrind.supp.
Since glibc version 2.23, memcpy is implemented by __mempcpy_inline.
This causes that call to memcpy from pthread_create is no longer
recognized by the suppression.
In test helgrind/tests/tc22_exit_w_lock, pthread_create is called twice,
and second call reports error, which causes failing of the test.
This patch adds suppression for glibc 2.23 and greater.
Petar Jovanovic [Fri, 27 Jan 2017 18:20:50 +0000 (18:20 +0000)]
Adding new filter to memcheck/tests/filter_stderr
This should fix issue with sendmsg test and glibc 2.22.
Glibc 2.22 introduced sysdeps/unix/sysv/linux/sendmsg.c that has
__libc_sendmsg function implementation (in comparison to earlier
implementation in syscall-template.S).
So, test suite needs to filter out this case, otherwise we get test
diffs such as:
Syscall param sendmsg(msg) points to uninitialised byte(s)
- at 0x........: sendmsg (in /...libc...)
+ at 0x........: sendmsg (sendmsg.c:28)
which are false positives.
This fixes memcheck/tests/sendmsg (stderr) on platforms with 2.22+ glibc.
Petar Jovanovic [Fri, 27 Jan 2017 17:55:13 +0000 (17:55 +0000)]
mips: fix target_get_drv() function
Return correct Dtv location. Top of MIPS tcbhead structure is located
0x7000 bytes before the value of ULR. Dtv is the first of two pointers
in the tcbhead structure.
This fixes gdbserver_tests/hgtls on some MIPS platforms.
Allow memcheck to output the leak results as a callgrind xtree file.
* New command line options --xtree-leak=no|yes and --xtree-leak-file=<file>
to produce the end of execution leak report in a xtree callgrind format
file.
* New option 'xtleak' in the memcheck leak_check monitor command, to
produce the leak report in an xtree file.
* File name template arguments (such as --log-file, --xtree-memory-file, ...)
have a new %n format letter that is replaced by a sequence number.
Petar Jovanovic [Fri, 13 Jan 2017 16:29:15 +0000 (16:29 +0000)]
mips64: update exp file for test_math
Leave the old exp file that covers cases in which __addtf3 and __subtf3
did not take into account rounding modes. New exp file is the same file
that already exists in mips32 folder, so we just create a symbolic link
to it.
Ivo Raisr [Thu, 12 Jan 2017 11:28:20 +0000 (11:28 +0000)]
Fix a bug when --log-file output isn't split when a program forks.
Patch loosely based on idea by Timur Iskhodzhanov <timurrrr@google.com>.
Fixes BZ#162848
KCachegrind currently uses a quick format detection before
actually loading a file, and checks for a line starting with
"events:" in the first 2kB for that. This obviously is fragile,
as shown by an internal bug report by Philippe: before the
"events" line, Callgrind puts a "cmd:" line with the command
line. If this is very long, the detection fails and the file
does not get loaded at all.
While KCachegrind would not need to have this quick format
check at all, it is useful if multiple input format filters
get supported at some point, to automatically select the
correct filter.
Further, for the "file" command, for file managers and
desktop environments, having an unique way to detect a
file format is important.
It is not too late to fix this issue for the callgrind format.
Petar Jovanovic [Wed, 21 Dec 2016 17:45:28 +0000 (17:45 +0000)]
mips: fix "cast-equal" warnings in coredump-elf.c
Remove the following warnings from the build:
m_coredump/coredump-elf.c:521:31: warning: cast discards 'const'
qualifier from pointer target type [-Wcast-qual]
Fix 342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM that clones to a different stack
Fix 373192 Calling posix_spawn in glibc 2.24 completely broken
Functionally, this patch just does the following 2 changes to the
fork clone handling:
* It does not mask anymore CLONE_VFORK :
The only effect of this flag is to suspend the parent, waiting for
the child to either exit or execve.
If some applications depends on this synchronisation, better keep it,
as it will not harm to suspend the parent valgrind waiting for the
child valgrind to exit or execve.
* In case the guest calls the clone syscall providing a non zero client stack,
set the child guest SP after the syscall, before executing guest instructions.
Not setting the guest stack ptr was the source of the problem reported
in the bugs.
This also adds a test case none/tests/linux/clonev.
Before this patch, test gives a SEGV, which is fixed by the patch.
The patch is however a lot bigger : this fix was touching some (mostly
identical/duplicated) code in all the linux platforms.
So, the clone/fork code has been factorised as much as possible.
This removes about 1700 lines of code.
This has been tested on:
* amd64
* x86
* ppc64 be and le
* ppc32
* arm64
This has been compiled on but *not really tested* on:
* mips64 (not too clear how to properly build and run valgrind on gcc22)
It has *not* been compiled and *not* tested on:
* arm
* mips32
* tilegx
* darwin (normally, no impact)
* solaris (normally, no impact)
The changes are relatively mechanical, so it is not impossible that
it will compile and work out of the box on these platforms.
Otherwise, questions welcome.
A few points of interest:
* Some platforms did have a typedef void vki_modify_ldt_t,
and some platforms had no definition for this type at all.
To make it easier to factorise, for such platforms, the following has
been used:
typedef char vki_modify_ldt_t;
When the sizeof vki_modify_ldt_t is > 1, then the arg syscall is checked.
This is somewhat a hack, but was simplifying the factorisation.
* for mips32/mips64 and tilegx, there is a strange unconditional assignment
of 0 to a register (guest_r2 on mips, guest_r0 on tilegx).
Unclear what this is, in particular because this is assigned whatever
the result of the syscall (success or not).
Mark Wielaard [Tue, 6 Dec 2016 09:50:47 +0000 (09:50 +0000)]
Adjust line number in mcblocklistsearch.stderrB.exp.
valgrind svn r16173 "Add CLEAR_CALLER_SAVED_REGS in leak-tree test"
added one extra line to memcheck/tests/leak-tree.c which is used in
gdbserver_tests/mcblocklistsearch.vgtest. Adjust the line numbers in
the exp file to match.
Petar Jovanovic [Mon, 5 Dec 2016 16:29:24 +0000 (16:29 +0000)]
Add CLEAR_CALLER_SAVED_REGS in leak-tree test
Motivation for this change is similar to what has already been done in other
leak-* tests. That is, call CLEAR_CALLER_SAVED_REGS (currently used only on
PPC and MIPS arches) to clear temporary registers that might be holding
pointers lost in a previously called function.
This fixes memcheck/tests/leak-tree failure on some MIPS platforms.
Petar Jovanovic [Mon, 5 Dec 2016 16:03:21 +0000 (16:03 +0000)]
mips: implement CLEAR_CALLER_SAVED_REGS for memcheck tests
Implement CLEAR_CALLER_SAVED_REGS macro that is used for some memcheck
tests. This is done in order to clear temporary registers that still
might be holding pointers to lost memory regions.
Similar change has been made for PPC.
Petar Jovanovic [Thu, 1 Dec 2016 16:01:45 +0000 (16:01 +0000)]
mips: fix call_on_new_stack_0_1 code
MIPS32 implementation missed to set up a correct (zero) return address.
This led to incorrect execution of get_StackTrace_wrk as it was not
able to unwind stack correctly.
This change fixes memcheck/tests/leak-autofreepool-5.
MIPS64 implementation missed clearing all integer registers before
entering the function.
Petar Jovanovic [Tue, 29 Nov 2016 14:57:51 +0000 (14:57 +0000)]
mips64: fix fadvise64 syscall wrappers
Use platform specific pre-wrapper for fadvise64 system call and respect
size of parameters, instead of using generic wrapper written for 32bit
architectures.
Petar Jovanovic [Tue, 29 Nov 2016 14:27:25 +0000 (14:27 +0000)]
mips32: fix fadvise64 system call
For fadvise64 system call, 7th 32-bit argument slot (third on the stack)
will also be used due to MIPS O32 calling convention in passing 64-bit
values.
sys_fadvise64(int fd, loff_t offset, loff_t len, int advice);
Petar Jovanovic [Wed, 23 Nov 2016 17:38:29 +0000 (17:38 +0000)]
make bar_bad tests more deterministic
Canceling the thread slp2 before the case 5 makes behaviour of this test
more deterministic.
Also, as Philippe W. pointed out, adding --fair-sched=try seems to avoid
variable and sometimes very long run time for these tests.
Ivo Raisr [Sun, 20 Nov 2016 15:06:08 +0000 (15:06 +0000)]
Fix test none/tests/pth_2sig on Solaris.
When signal SIGINT was used, it got propagated to the parent shell
and therefore the regression test suite was terminated.
With SIGTERM only the parent exits, as is supposed.
Verified that this changed test case still reproduces the original problem
on Linux and Solaris, when r16140 is temporarily undone.
Follow up to r16140 and r16143 and BZ#372600.