Carl Love [Tue, 3 Nov 2015 17:48:04 +0000 (17:48 +0000)]
Add ISA 2.07 vbit test support
The ISA 2.07 support adds new Iops as well as support for some existing
Iops. None of these Iops have been enabled in the vbit tester. This commit
adds the needed support to the files in memcheck/tests/vbit-test.
These changes add support for additional immediate operands and additional
undefined bit checking functions.
There are additional changes to files VEX/priv/ir_inject.c and VEX/pub/libvex.h
that are in VEX commit 3202
Ivo Raisr [Thu, 29 Oct 2015 07:28:58 +0000 (07:28 +0000)]
ELF debug info reader was confused with multiple .rodata sections on Solaris
The ELF debug info reader on Solaris now performs a quick pre-scan of section
headers for .rodata sections. If there are multiple .rodata sections
present then symbols from .symtab are scanned which section they point to.
The "true" .rodata section is thus determined.
Fixes BZ#353802.
All memory dereferences during leak search are checked either with
aspacemgr or using the VA-bits.
So, in theory, no memory fault should occur.
However, the leak search is done so as to resist to e.g.
- desynchronisation between the real pages mapped and the aspacemgr state.
- client pages mprotected against reading
- any other reason why dereferencing a client address would fail.
So, the function lc_scan_memory installs a fault catcher that
is called if a memory fault signal is raised during memory scan.
However, memory dereference is also done in the function heuristic_reachedness.
So, this function must also resist to memory fault.
This patch also installs a fault catcher for the function heuristic_reachedness.
More in details, the following changes are done:
* pub_tool_signal.h and m_signals.c :
VG_(set_fault_catcher) now returns the previously set fault catcher.
This is needed so that heuristic_reachedness/lc_scan_memory can save
and restore the previous fault catcher.
* mc_leakcheck.c:
Addition of leak_search_fault_catcher that contains the common
code for the (currently 2) fault catchers used during leak search.
* Modification of heuristic_reachedness and lc_scan_memory:
Add 2 (small) specific fault catcher that are calling the common
leak_search_fault_catcher.
* The way sigprocmask is handled has been changed:
Before this patch, lc_scan_memory was saving/restoring the procsigmask
for each scanned block (and was restoring it when the fault catcher
was longjmp-ing back to lc_scan_memory in case of SEGV or BUS.
This was causing 2 system calls for each block scanned.
Now, lc_scan_memory and heuristic_reachedness are not saving/restoring
the procmask: the work to reset the sigprocmask is only done
in leak_search_fault_catcher. This is more efficient as no syscall
anymore is done during leak search, except for (normally) unfrequent
SIGSEGV/BUS. It is also simpler as signal handling is now done at
a single place.
It is ok to reset the procmask (in fact, just remove the caught signal
from the process sigmask) as during leak search, no other activity than
the leak search is on-going, and so no other SEGV/BUS can be received
while the handler runs.
This gives moderate speed improvements for applications allocating a lot of
blocks (about 10% improvement when leak searching in 1 million small blocks).
Test case (slightly modified) by Matthias Schwarzott.
m_replacemalloc/vg_replace_malloc.c:1286:1: warning: returning 'const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
ZONE_GET_NAME(VG_Z_LIBC_SONAME, malloc_get_zone_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1283:14: note: expanded from macro 'ZONE_GET_NAME'
return vg_default_zone.zone_name; \
^~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1287:1: warning: returning 'const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
ZONE_GET_NAME(SO_SYN_MALLOC, malloc_get_zone_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1283:14: note: expanded from macro 'ZONE_GET_NAME'
return vg_default_zone.zone_name; \
^~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1286:1: warning: returning 'const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
ZONE_GET_NAME(VG_Z_LIBC_SONAME, malloc_get_zone_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1283:14: note: expanded from macro 'ZONE_GET_NAME'
return vg_default_zone.zone_name; \
^~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1287:1: warning: returning 'const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
ZONE_GET_NAME(SO_SYN_MALLOC, malloc_get_zone_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
m_replacemalloc/vg_replace_malloc.c:1283:14: note: expanded from macro 'ZONE_GET_NAME'
return vg_default_zone.zone_name; \
^~~~~~~~~~~~~~~~~~~~~~~~~
Florian Krohm [Mon, 12 Oct 2015 20:35:56 +0000 (20:35 +0000)]
On a zEC12 or z13, a glibc with lock elision enabled infers from HWCAP
that the prerequisites for lock elision are met. Then it may use TBEGIN
and other transactional-execution instructions which are not implemented
by Valgrind. Likewise, the upcoming glibc 2.23 will exploit vector
instructions if they are advertised by HWCAP; and those are currently
not implemented by Valgrind either. In general, the increased use of
ifunc may lead to more such cases in the future.
This patch suppresses the advertising of those hardware features via
HWCAP which are either not known to Valgrind or currently unsupported.
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com).
Fixes BZ #353680.
Make sure no executable stack gets created.
Explanation by Matthias Schwarzott:
The linker will request an executable stack as soon as at least one
object file, that is linked in, wants an executable stack.
And the absence of the
.section .note.GNU-stack."",@progbits
is enough to tell the linker that an executable stack is needed.
So even an empty asm-file must at least contain this statement to not
force executable stacks on the whole executable.
* Define a helper macro MARK_STACK_NO_EXEC that disables the
executable stack.
* Instantiate this macro unconditionally at the end of each asm file.
Ivo Raisr [Tue, 29 Sep 2015 18:57:56 +0000 (18:57 +0000)]
Move more complicated tests out of memcheck/tests/solaris/scalar_ioctl
to memcheck/tests/solaris/ioctl.
While at it, remove a fixed size buffer as reported by Florian Krohm.
n-i-bz
Followup to r14908 (BZ #342603).
Comparing the command byte with VKI_I2C_SMBUS_QUICK is like comparing
apples to carrots, it makes no sense. The command byte is unused for
quick transactions anyway so checking its value is pointless.
Patch by Jean Delvare <jdelvare@suse.de>.
Followup to r14908 (BZ #342603).
The first byte of the data array holds the length, so the actual data
length is the value of that byte plus one.
Patch by Jean Delvare <jdelvare@suse.de>.
Carl Love [Wed, 16 Sep 2015 23:33:40 +0000 (23:33 +0000)]
Add Power PC ISA check to the vbit-test
The support for the Valgrind Iops is dependent on the Power processor
support for various instructions. The instructions supported by a
given Power processor is based on the version of the ISA. The patch
add a check to the vbit-test to ensure it does not try to test an Iop
that generates an instruction on the host that is not supported.
Pick up 'egrep' and 'strings' from $PATH instead of using
hardwired absolute path names. People can always arrange $PATH
such that these tools are found.
Fixes BZ #294065. Patch by Austin English <austinenglish@gmail.com>
Strange segments in /proc/self/maps have been observed in the field.
Namely those with a file name and an inode number but without major
and minor device numbers. See for instance https://bugs.kde.org/124528#c11
This patch also recognises segments with a file name as FileV segments
(which is what valgrind used to do prior to r5818).
Avoid warnings about deprecated unescaped curly brackets in regular
expressions. Happens with perl 5.22 and newer.
Patch by Matthias Schwarzott <zzam@gentoo.org>
Mark Wielaard [Sat, 5 Sep 2015 20:45:04 +0000 (20:45 +0000)]
Correct expected output of tc18 and tc20 helgrind tests.
The addition if the safe wrapper in r15620 introduced an extra
output frame in the backtrace of helgrind/tests/tc18_semabuse and
helgrind/tests/tc20_verifywrap.
Changes related to new IROp Iop_RoundF128toInt. See VEX r3183.
s390: Add testcase for fixbr.
Patch by Andreas Arnez <arnez@linux.vnet.ibm.com>.
Part of fixing BZ #350290.
To test extended BFP opcodes we need sizeof(long double) == 16.
Certain old versions of GCC don't have that as default. So we must
give -mlong-double-128 on the command line.
Pertains to BZ #352183.
Mark Wielaard [Fri, 4 Sep 2015 09:41:42 +0000 (09:41 +0000)]
Add safe sem_post handler and glibc-2.21 expected output for helgrind tests.
This fixes the tc18 and tc20 testcases.
On some bad semaphores glibc now might just abort, we catch the SIGABRT
and turn it into a EINVAL. The program will see this, but the helgrind
wrapper won't. Which works for tc18 since there is an alternate exp file
with that result (silent bad sem_post). We add a similar alternative exp
file for tc21.
- The default value for --leak-check-heuristics has been changed from
"none" to "all". This helps to reduce the number of possibly
lost blocks, in particular for C++ applications.
Enhance block_list memcheck gdbserver monitor command
Due to the (still to be done) default activation of --leak-check-heuristics=all,
improve the block_list monitor command for easier display of blocks
found reachable via heuristics.
Ivo Raisr [Mon, 31 Aug 2015 21:31:09 +0000 (21:31 +0000)]
Add support for ldsoexec on Solaris.
Solaris runtime linker allows to run dynamically linked programs indirectly, as:
ld.so.1 <dynamic_executable>
This is now possible under Valgrind as well.
Florian Krohm [Mon, 31 Aug 2015 21:18:18 +0000 (21:18 +0000)]
Ensure the testcase compiles with clang.
clang up to and including 3.6.2 does not recognise the fxsave64
and fxrstor64 mnemonics. It does recognise rex64/fxsave etc..
Related to BZ #339636.
Julian Seward [Mon, 31 Aug 2015 14:37:25 +0000 (14:37 +0000)]
Change the default setting for --dsymutil from =no to =yes, since
in practice it needs to be permanently enabled on OS X. No change
on other platforms.