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.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15995
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.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15994
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.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15992
Also stop checking when max length of bytes have been reached.
Bug #369359
Found by LTP testcases/kernel/syscalls/recvmsg/recvmsg01.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15991
Don't do any more checks if it isn't safe to inspect the address family.
Likewise, don't check sun_path if the string address isn't safe.
Found by LTP testcases/kernel/syscalls/bind/bind01.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15990
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).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15989
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.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15988
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.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15986
- 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>
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15984
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
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15979
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.
Bugzilla 369169
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15977
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).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15962
When doing inferior function calls from gdb (in mcmain_pic) there might
be extra heap usage from gdb that we aren't interested in tracking.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15960
Update xml filter to suppress pthread_create_WRK frame. Update the filter_xml
filter to suppress the frame containing the pthread_create_WRK function. This
allows the tc06_two_races_xml test to complete reliably on power.
This change also adds the ability to suppress the printf that generates a
"pthread_create_WRK...pthread_create" entry to replace the suppressed frame.
This is conceptually a follow-up from r13983, which suppresses the
pthread_create_WRK entry from non-xml outputs.
Patch submitted by Will Schmidt <will_schmidt@vnet.ibm.com>
Bugzilla 368416
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15956
The reported backtrace on ppc64 platform reports "generic_start_main.isra.0"
in the backtrace, where other platforms typically see "main". Adjust the
vgtest file to handle this variation. This is similar to existing changes
as seen in deep-D.post.exp
FORGOT to add the file massif/tests/mmapunmap.post.exp-ppc64 before doing
commit 15950.
Bugzilla 368461
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15955
An earlier change introduced a think-o in the altivec capability
check, allowing a false positive if the compiler supported altivec
but the hardware did not.
Resolves bug #368412 - False positive result for altivec capability check
Patch by Will Schmidt <will_schmidt@vnet.ibm.com>
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15952
Update the libiberty demangler using the auxprogs/update-demangler
script. There were various extensions and bug fixes since our last
import. Add new D language demangler file d-demangle.c and update
the vg_libciface.h header with some new constructs used (strtol,
xmalloc_failed, xmemdup, XDELETEVEC, XDUPVEC).
Resolves bug #359181 - Buffer Overflow during Demangling.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15951
The reported backtrace on ppc64 platform reports "generic_start_main.isra.0"
in the backtrace, where other platforms typically see "main". Adjust the
vgtest file to handle this variation. This is similar to existing changes
as seen in deep-D.post.exp
Bugzilla 368461
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15950
Nr of callers in a suppression entry had a smaller limit than the max
for --num-callers.
This means it was not possible to precisely suppress an error with a big
stack trace.
Also, --gen-suppressions was not providing the full stack trace of
the error in the generated suppressions.
Now, a suppression entry can have the same nr of callers as a backtrace.
Generated suppressions are generated with up to --num-callers callers.
This change has neglectible impact :
* memory: stack array of 500*2 words is declared, instead of 24*2 words
This array is declared on the interim stack (startup stack), which is
largely big enough.
* cpu : neglectible more cpu needed to read suppression entries
(to initialise the bigger stack array when reading a supp entry),
Apart of the above, no impact on performance (unless of course bigger
supp entries are really used).
Note that this does not impact the behaviour for existing suppression files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15945
for both ARM and Thumb encodings to be tested.
Modify the existing v8 crypto tests so that both ARM and Thumb encodings
are tested.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15943