Change the method used in hg_intercepts.c to hide from the user, the
race between mythread_wrapper and the wrapper for pthread_create. The
previous scheme could lead to false race reports in obscure cases.
Julian Seward [Sun, 14 Mar 2010 15:09:27 +0000 (15:09 +0000)]
Improve performance of the fallback path when a translation is not
found in the fast-cache.
* reduce max loading of the per-sector TT hash tables from 80% to 65%.
This reduces the number of required probes by a factor of 3.
* when searching for a translation, don't visit the sectors in a fixed
order. Instead, use an MTF array in which the most popular sectors
(in terms of most likely to hold the translation we're looking for)
are visited first. This reduces the number of required probes by
another factor of 2.
These improvements have no effect on small programs, but improve
scalability on big apps. For an application comprising 300k
translations, runtime on Memcheck is reduced by 3% and on None by
about 20%. The average number of probes per fast-cache miss is
reduced from around 22 to less than 5.
Julian Seward [Thu, 11 Mar 2010 13:43:18 +0000 (13:43 +0000)]
If a race error is detected, check to see whether the raced-on address
is inside a heap block, and if so, print the allocation point of the
heap block. It's stupid not to do this considering that the
implementation already keeps track of all mallocs and frees.
Julian Seward [Mon, 8 Mar 2010 14:45:26 +0000 (14:45 +0000)]
Fix the definedness handling of the last argument of sys_socketpair.
The last argument is really a pointer to an array of two ints and so
we need to say it is an int* and not an int [2]. This just happens to
work on amd64-linux because sizeof(int [2]) == 8 == sizeof(int*). On
arm-linux it duly craps out w/ an assertion because sizeof(int [2]) !=
sizeof(UWord).
Bart Van Assche [Sun, 7 Mar 2010 10:54:21 +0000 (10:54 +0000)]
Changes:
- Generalized the behavior of happens-before / happens-after annotations such
that not only 1:1 but also n:m patterns are supported.
- Dropped support for invoking happens-before / happens-after annotations on
POSIX condition variables (pthread_cond_t).
- Report the details about the offending synchronization object in generic
errors.
- Converted a few tl_assert() statements into error messages.
Bart Van Assche [Sun, 7 Mar 2010 10:42:15 +0000 (10:42 +0000)]
Made the behavior of the annotate_smart_pointer test program configurable
through command-line arguments, and made sure that the annotations present
in the source code are recognized by all Valgrind-based data race detection
tools.
Bart Van Assche [Sat, 6 Mar 2010 10:54:36 +0000 (10:54 +0000)]
Changes:
- Annotated the smart pointer implementation.
- Explained the purpose of the test via source code comments.
- Removed class Semaphore.
- Made it possible to specify the number of threads to be created via the
command line.
Tom Hughes [Fri, 5 Mar 2010 10:11:41 +0000 (10:11 +0000)]
On amd64 all IPC calls behave as if the IPC_64 flag is set in the
command, so pretend that it is set when calling the generic wrapper
functions in pre and post handlers. Fixes #229509.
Julian Seward [Wed, 3 Mar 2010 22:57:47 +0000 (22:57 +0000)]
Make the version number available in the valgrind.h headers, so
clients can do version-specific client requests. This is something we
should have done long ago. Still needs a way to regtest this, to
check that the embedded version matches what's stated in configure.in.
Tom Hughes [Tue, 23 Feb 2010 10:02:55 +0000 (10:02 +0000)]
Add support for the getcpu system call on x86, ppc32 and ppc64. There
is no support for amd64 because there is no getcpu system call on that
platform - it is always done as a vsyscall in user space.
Based on patch from Aleksander Salwa. Closes #223758.
Julian Seward [Mon, 22 Feb 2010 11:03:10 +0000 (11:03 +0000)]
When creating a child thread, initially set its os_state.threadgroup
to have the same value as the parent. This avoids exit races leading
to hangs and strange behaviour in heavily multithreaded apps, in the
situation where threads are rapidly being created, and at the same
time an existing thread does sys_exit_group so as to terminate the
entire process. Thanks to Konstantin S for chasing this down to a
small test case. Fixes #226116.
Tom Hughes [Fri, 19 Feb 2010 16:50:45 +0000 (16:50 +0000)]
Add parentheses round the "zzarg" macro argument when using it as it
may expand to an expression which may mean we wind up doing the cast
before evaluating the expression... Closes #227570.
Tom Hughes [Tue, 16 Feb 2010 15:05:55 +0000 (15:05 +0000)]
Neither FUTEX_WAKE or FUTEX_WAKE_BITSET actually dereference the
futex at all (they just use the address) so we shouldn't insist on
it's contents being define. Fixes #224723.
Julian Seward [Fri, 12 Feb 2010 12:12:39 +0000 (12:12 +0000)]
Try to find the PDB file for a given PE file by the totally kludgey
method of doing "strings file.dll | egrep '\.pdb|\.PDB'".
Distantly derived from a patch by leiz@ucla.edu. Fixes #222902,
although I still would prefer to do this the proper way, by parsing
the PE file properly.
Julian Seward [Sat, 30 Jan 2010 13:40:27 +0000 (13:40 +0000)]
The client request VG_USERREQ__LOAD_PDB_DEBUGINFO that we get from
Wine as a notification to read PDB/PE debug info, contains a parameter
'reloc' whose purpose is unknown, and which is unused. Rename it
accordingly, to 'unknown_purpose__reloc'. (a non-functional change)
Julian Seward [Fri, 29 Jan 2010 22:37:02 +0000 (22:37 +0000)]
PE/PDB handling: allow the PDB (the debuginfo file) to be up to 1
minute older than the PE (the .exe/.dll it describes) even though this
doesn't seem particularly safe. Partially fixes #190675.
(patch from Dan Kegel)
Julian Seward [Thu, 28 Jan 2010 15:23:54 +0000 (15:23 +0000)]
Followup fix to r11006. Don't pass va_list by value through client
requests, since there's no guarantee it is the same size as a machine
word.
This renames the private client request VG_USERREQ__INTERNAL_PRINTF to
VG_USERREQ__INTERNAL_PRINTF_VALIST_BY_REF and changes the
argument-passing accordingly.
The public client requests VG_USERREQ__PRINTF and
VG_USERREQ__PRINTF_BACKTRACE are now deprecated, and handled only in
the case where sizeof(UWord) == sizeof(va_list). In all other cases V
will now print a detailed error message and abort. This breaks binary
compatibility of apps compiled using VALGRIND_PRINTF and
VALGRIND_PRINTF_BACKTRACE, but that's not easy to avoid.
VG_USERREQ__PRINTF and VG_USERREQ__PRINTF_BACKTRACE are now replaced
by VG_USERREQ__PRINTF_VALIST_BY_REF and
VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF. The end-user macros
VALGRIND_PRINTF and VALGRIND_PRINTF_BACKTRACE have been adjusted to
use these new requests instead.
Overall result is that source level compatibility of code using
VALGRIND_PRINTF{,_BACKTRACE} is retained, but binary level
compatibility may be broken, necessitating a rebuild of code using
these macros.
Julian Seward [Wed, 27 Jan 2010 10:28:00 +0000 (10:28 +0000)]
Fix handling of mprotect so as to be more consistent with the handling
of mmap. Fixes #205541 and its dup #210268. The fix is simple enough
but the analysis is a bit complex, as detailed in comments.
Julian Seward [Fri, 15 Jan 2010 10:57:57 +0000 (10:57 +0000)]
Add command line flag --vex-guest-chase-cond=no|yes [no] to control
whether front ends should speculatively chase through conditional
branches. Disabled by default.
Julian Seward [Mon, 11 Jan 2010 13:02:19 +0000 (13:02 +0000)]
Apparently the dynamic linker on ARM-Linux has soname "ld-linux.so.3"
rather than "ld-linux.so.2". No, don't ask me why. Anyway, on
Helgrind, don't instrument code in ld-linux.so.3. This makes Helgrind
pretty much usable on ARM-Linux.
Julian Seward [Wed, 6 Jan 2010 11:08:18 +0000 (11:08 +0000)]
arm-linux: remove wrappers for __NR_ipc, __NR_mmap, __NR_sigsuspend
and __NR_sigaction, which all did I_die_here and therefore can never
have been used. I think they were here as a result of this file being
derived from the x86-linux version, and that arm-linux uses more
modern equivalents (mmap2, rt_sig*, and the broken-out versions of
ipc).