Petar Jovanovic [Fri, 4 Nov 2016 18:21:22 +0000 (18:21 +0000)]
mips: Add redir for index function in ld.so.1
Redirect index function in ld.so.1.
Optimize the existing strlen function implementations.
This removes warnings coming from optimized index and strlen functions
in ld.so.1.
Some small optimisation+some code reformatting
* Use stack arrays instead of malloc/free
* ensure msghdr_foreachfield does one single call to foreach_func
for consecutive fields
* some small code reformatting or factorisation
perf/vg_perf --outer-args: either replace the predefined outer args, or append to it.
Currently, vg_perf predefines a set of standard outer tool args according to the tool.
These predefined args can be replaced by another set using "--outer-args=xxx yyy zzzz".
But often, we want to add (or override) only a few args.
So, modify vg_perf so that if the first letter of --outer-args is a + character, then
the provided args are appended to the predefined args
Mark Wielaard [Fri, 21 Oct 2016 00:02:10 +0000 (00:02 +0000)]
Add libc_test to workaround pth_cond_destroy_busy test hangs.
This is a workaround for bug #371396. It adds a new test program
that can be used skip tests given a specific libc implementation
and optionally a specific minimum version. Currently only glibc
is recognized. This is used for the drd and helgrind tests
pth_cond_destroy_busy to be skipped on glibc 2.24.90+.
Julian Seward [Tue, 18 Oct 2016 17:16:11 +0000 (17:16 +0000)]
Add to Memcheck a flag --ignore-range-below-sp=<offset>-<offset>, for
ignoring accesses on the stack below SP. Serves as a more modern
replacement for --workaround-gcc296-bugs, which is now deprecated.
Fixes #360571.
Carl Love [Tue, 18 Oct 2016 15:56:55 +0000 (15:56 +0000)]
Fix PPC BE in 32-bit mode.
The 64-bit compares are not supported in 32-bit mode. Change the 64-bit
compares to 32-bit compares when doing byte compares. Add routine for
doing V128 GT compare using 32-bit compares.
The clean caller support was missing for 32-bit mode
Update the expected output file jm_vec_isa_2_07.stdout.exp
Further fixes following fix of leak in 16033
Rerunning valgrind under valgrind shows that interp_name and interp_args
memory was freed twice.
=> reworked the way interp_name and interp_args are freed:
* free them in VG_(ii_create_image) (linux/darwin/solaris)
* everywhere else, when overriden, first free the current value
* everywhere where interp_name or interp_args are freed, set them to NULL
With this, re-selfhosting valgrind shows no leak and no corruption
for interp_name and interp_args.
Clarify name and description/manual for meta mempool
* rename macro VALGRIND_CREATE_META_MEMPOOL
to VALGRIND_CREATE_MEMPOOL_EXT
* abort execution if a pool is marked as auto_free but is not a meta pool
+ removed test leak-autofreepool-3.vgtest, which now aborts.
* reword/clarify valgrind.h explanations for meta pool
* similarly reword/clarify the manual
fix 369468 Remove quadratic metapool alg. using VG_(HT_remove_at_Iter)(VgHashTable *table)
Based on a patch from Ruurd Beerstra
but reworked VG_(HT_remove_at_Iter) so that
the function is implemented without touching the rest of m_hashtable.c
to ensure no performance impact on other hash table usages.
Testing with
for f in 1 2 3 4 5 6 7 8 9; do echo $f; time ./vg-in-place -q ./memcheck/tests/leak-autofreepool 2 $(expr $f \* 100000); done|&grep user
With the patch :
user 0m0.524s
user 0m0.660s
user 0m0.784s
user 0m0.916s
user 0m1.064s
user 0m1.192s
user 0m1.316s
user 0m1.496s
user 0m1.632s
Without the patch, the same gives:
user 0m4.464s
user 0m16.776s
user 0m24.472s
user 1m5.544s
user 1m21.168s
user 1m40.500s
user 1m54.884s
user 4m58.308s
user 5m34.060s
Petar Jovanovic [Wed, 12 Oct 2016 15:13:27 +0000 (15:13 +0000)]
mips: allow Valgrind to be compiled for soft-float
Force "hardfloat" mode for inline assembly that uses FPU instructions,
but pop original mode at the end of the assembly. Unhandled FPU
instructions will be handled by the signal handler (env_unsup_insn).
Skip MIPS specific tests for FPU if the code gets compiled for soft-
float.
This should allow Valgrind to be compiled as a soft-float binary, but
that executable should be used for soft-float systems only.
Related VEX change - r3261.
Related issue - BZ#351282.
Carl Love [Tue, 11 Oct 2016 17:01:42 +0000 (17:01 +0000)]
Fix for missing ISA changes in HW cap stuff needs updating patch
A couple things got missed in the previous HW cap stuff needs updating patch
that cause the vbit tester to fail. The fixes are based on the patch
submitted by Mark Weilaard.
Carl Love [Mon, 10 Oct 2016 18:09:01 +0000 (18:09 +0000)]
Power configure fixes.
This patch makes the following updates:
- Update the configure scripts to fix a configure/build issue seen on Power 7
- Update the ISA 3.0 hwcaps string.
- Update the ISA 3.0 ifdef value to be consistent with the hwcaps string
The patch was submitted by Will Schmidt. Patch reviewed and tested by Carl Love
on Power 7, Power 8 LE and BE, ISA 3.0 simulator for LE and BE.
Carl Love [Fri, 7 Oct 2016 23:08:02 +0000 (23:08 +0000)]
ISA 3.0 BE testsuite fixes
In testing issues with the new ISA 3.0 instructions in BE mode, it was
found that we needed some more unique values in the operands to catch
various errors. The issue is a sigle 32-bit value was replicated four
times for a V128 operand. The result is testing loads and stores where
the word or half word order was swizzled couln't be detected because
they were the same. By making the 32-bit chunks unique we were able
to catch additional errors.
The VEX instruction fixes was committed in VEX commit 3260.
Petar Jovanovic [Wed, 5 Oct 2016 14:16:25 +0000 (14:16 +0000)]
mips: replace use of (d)addi with (d)addiu
Replace use of daddi/addi with daddiu/addiu.
This is more R6-friendly and we actually want to use the instructions
that do not cause integer overflow exception.
Julian Seward [Wed, 5 Oct 2016 04:32:44 +0000 (04:32 +0000)]
DHAT currently has "max-bytes-live", "max-blocks-live", and
"tot-bytes-allocd" orderings. This adds "tot-blocks-allocd", which
completes the 2x2 matrix and is useful too. n-i-bz.
From n.nethercote@gmail.com.
Replace --wait-for-gdb=yes memory loop by a call to VG_(poll) (5000 milliseconds)
Depending on the cpu speed, this loop was way too fast or too slow.
=> replace by a syscall that will always give the same waiting time.
A few notes:
A VG_(poll) is available on all supported OS
B no signals are supposed to interrupt the syscall, as at that place, nothing works yet.
C gdb can attach to a process blocked in a syscall.
If ever B or C would not be true on some setups, then we could instead do a loop
of e.g. 50 * VG_(poll) (100 milli-seconds)
Mark Wielaard [Sat, 1 Oct 2016 11:54:50 +0000 (11:54 +0000)]
Fix crash in sys_modify_ldt wrapper on bad ptr. Bug #369383.
Make sure ptr is safe_to_deref if not NULL.
Also fixup some corner case error return codes.
We have to do that ourselves since we never actually call into the kernel.
Found by LTP testcases/kernel/syscalls/modify_ldt/modify_ldt01.
Mark Wielaard [Sat, 1 Oct 2016 11:54:49 +0000 (11:54 +0000)]
Fix crash in linux [rt_]sigaction wrapper with bad old/new sigaction handler.
Since we try to modify the old/new sigaction handler before passing it
to the kernel we must make sure that (if they aren't NULL) it is safe
to use. If not we should bail out early with EFAULT.
Bug #369362
Found by LTP testcases/kernel/syscalls/rt_sigaction/rt_sigaction02.
Mark Wielaard [Sat, 1 Oct 2016 11:54:47 +0000 (11:54 +0000)]
Fix crash when old/new sigprocmask isn't safe to dereference. Bug #369360.
Since we want to use the set and oldset for bookkeeping we also want
to make sure they are addressable otherwise, like the kernel, we EFAULT.
Also use EINVAL instead of EMFILE as failure when sigset size is wrong.
Found by LTP testcases/kernel/syscalls/rt_sigprocmask/rt_sigprocmask02.
Mark Wielaard [Sat, 1 Oct 2016 11:54:38 +0000 (11:54 +0000)]
Don't require the current working directory to exist. Bug #369209.
At startup valgrind fetches the current working directory and stashes
it away to be used later (in debug messages, read config files or create
log files). But if the current working directory didn't exist (or there
was some other error getting its path) then valgrind would go in an
endless loop. This was caused by assuming that any error meant a larger
buffer needed to be created to store the cwd path (ERANGE). However
there could be other reasons calling getcwd failed.
Fix this by only looping and resizing the buffer when the error is
ERANGE. Any other error just means we cannot fetch and store the current
working directory. Fix all callers to check get_startup_wd() returns
NULL. Only abort startup if a relative path needs to be used for
user supplied relative log files. Debug messages will just show
"<NO CWD>". And skip reading any config files from the startup_wd
if it doesn't exist.
Also add a new testcase that tests executing valgrind in a deep,
inaccessible and/or non-existing directory (none/tests/nocwd.vgtest).
Mark Wielaard [Sat, 1 Oct 2016 10:12:31 +0000 (10:12 +0000)]
Use AM_LDFLAGS instead of LDFLAGS in exp-bbv/tests Makefiles.
That makes it possible to add to LDFLAGS instead of overriding
when doing make. Useful if you want to have different LD_FLAGS
added for the main and check makes.
Add an optional 2nd arg to leak-autofreepool to test performance
e.g. using the beloz
for f in 1 2 3 4 5 6 7 8 9; do echo $f; time ./vg-in-place -q ./memcheck/tests/leak-autofreepool 2 $(expr $f \* 100000); done
This shows that freeing a mempool with significant nr of elements
has a bad effect on performance
Note that no effort has been spent to avoid leaks in this
optional perf test. This is just to analyse the time taken to
free the pool.
The above loop shows that a medium size pool (e.g. < 1000000 elts)
can already take significant time, probably due to the quadratic
algorithm to clear the pool.
Note that the increase can vary a lot, probably depending on the
way the blocks are spread in the hash table: when lucky, the quadratic
algorithm probably somewhat becomes more linear if the elements
are 'properly' ordered in the hash table by deletion order.
Ivo Raisr [Sat, 24 Sep 2016 21:15:44 +0000 (21:15 +0000)]
Added meta mempool support into memcheck for describing a custom allocator which:
- Auto-frees all chunks assuming that destroying a pool destroys all
objects in the pool
- Uses itself to allocate other memory blocks
Unit tests included.
Fixes BZ#367995
Patch by: Ruurd Beerstra <ruurd.beerstra@infor.com>
Ivo Raisr [Fri, 23 Sep 2016 17:23:47 +0000 (17:23 +0000)]
Fix expected error output of drd/tests/bar_bad* on Solaris.
On Solaris, we still do get error reports about destroying
a barrier which was never initialized even after SVN r15962.
We also get an error report about destroying barrier bar3
which is still waited upon by a thread.
n-i-bz
Carl Love [Thu, 22 Sep 2016 15:37:57 +0000 (15:37 +0000)]
Powerpc big endian, fix the expected output file for
none/tests/ppc64/jm_int_isa_2_07.stdout.exp
By convention the file jm_int_isa_2_07.stdout.exp is the big endian reuslts.
If the little endian results differ, the file has -LE appended to it.
This patch replaces the little endian results that are currenttly in
none/tests/ppc64/jm_int_isa_2_07.stdout.exp with the correct the big
endian results.
Mark Wielaard [Mon, 19 Sep 2016 14:16:35 +0000 (14:16 +0000)]
Workaround bar_bad testcase hanging with newer glibc in helgrind/drd tests.
This is a workaround for bug #358213 helgrind/drd pthread_barrier tests
hangs with new glibc pthread barrier implementation. This makes sure that
the tests don't hang anymore. It does this by creating new threads that
sleep and kill the other threads after some time. But this introduces
some non-determinism that might cause the tests to occassionally fail
(both against old and new glibc implementations).