157 Commits

Author SHA1 Message Date
Julian Seward
57b66d4b7d Add support for hardware-specific ioctl wrappers on Android,
starting with those required for the graphics hardware on 
Nexus S.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12060
2011-09-27 11:40:24 +00:00
Julian Seward
cea6601bf2 Android: add wrappers for ashmem and binder ioctls. From the AOSP
port of Valgrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12059
2011-09-27 10:26:52 +00:00
Julian Seward
99602cf81a run_a_thread_NORETURN: add trashed-register annotations for the magic
bits of assembly which finally cause the thread to exit.  How this
ever worked before, on any platform, beats me.  The lack was causing
some Android builds to segfault at thread exit.  Only the s390 version
was correct.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12049
2011-09-26 17:50:46 +00:00
Julian Seward
7bb130f5f3 Add a new simulation hint, --sim-hints=fuse-compatible, which causes
a bunch of file-related syscalls to be handled on the might-block
syscall path rather than the fast syscall path.  This fixes deadlocks
when running some FUSE-specific filesystem codes.  Fixes #278057.
(Mike Shal, marfey@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11993
2011-08-18 15:08:20 +00:00
Tom Hughes
d3a38c3b6a Add support for FBIOPUT_VSCREENINFO and FBIOPAN_DISPLAY ioctls.
Patch from Pauli Nieminen <ext-pauli.nieminen@nokia.com> on #263648.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11980
2011-08-15 08:47:29 +00:00
Tom Hughes
a570998478 Correct the calculation of the size of the node mask given to
the mbind, set_mempolicy and get_mempolicy system calls.

Patch from Brice Goglin <brice.goglin@ens-lyon.org> on #280083.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11977
2011-08-15 07:52:26 +00:00
Tom Hughes
4a7707d8be Add support for the FIOQSIZE ioctl. Fixes #270320.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11963
2011-08-10 14:25:06 +00:00
Tom Hughes
4c121370d4 Support the F_GETPIPE_SZ and F_SETPIPE_SZ fcntl calls. Fixes #278349.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11960
2011-08-10 10:11:14 +00:00
Julian Seward
42ada29286 Add a new client request and pair of macros,
VALGRIND_{DISABLE,ENABLE}_ERROR_REPORTING, which allow a thread to
temporarily disable reporting of errors it makes.  This is useful for
making Memcheck behave sanely in the presence of some MPI
implementations.  Also mark up libmpiwrap.c accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11910
2011-07-24 16:02:33 +00:00
Julian Seward
2420f2b5ce Handle sigaction, sigsuspend, sigprocmask on arm-linux; comment-only
changes for x86-linux and ppc32-linux.  Derived from patch in bug
266035 comment 10 (Jeff Brown, jeffbrown@google.com).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11871
2011-07-11 18:23:09 +00:00
Julian Seward
5ce93a8654 Remove identical copies of convert_sigset_to_rt, PRE(sys_sigaction)
and POST(sys_sigaction) in syswrap-x86-linux.c and
syswrap-ppc32-linux.c, and replace them with a single version in
syswrap-linux.c instead.  Derived from patch in bug 266035 comment 10
(Jeff Brown, jeffbrown@google.com).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11870
2011-07-11 17:48:24 +00:00
Tom Hughes
cfc24ee4ea Move the break out of the braces so that we don't fall through
into the next case when no argument was given to the ioctl.

Spotted by IBM's BEAM checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11860
2011-07-06 14:11:56 +00:00
Tom Hughes
1017470b36 Fix some warnings I introduced in r11804.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11807
2011-06-08 09:57:54 +00:00
Tom Hughes
42bc84e869 Add support for prlimit64 on x86 and amd64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11806
2011-06-08 09:55:54 +00:00
Tom Hughes
912fe51553 It seems that the perf_counter_open system call was renamed to
perf_event_open some time after we added it, so correct the name
wherever it appears to match the current kernel source.

Also fixup the PRE handler to do the check correctly, using the
size field of the structure to work out how much data there is.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11804
2011-06-08 09:10:40 +00:00
Bart Van Assche
fbdd04d5a9 syswrap/Linux: trace ioctl() calls only once / do not report two-argument
ioctl() calls as an error. Patch provided by Mark Hills. Closes #272730.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11717
2011-04-28 18:36:49 +00:00
Bart Van Assche
d077061870 Linux/syswrap: add support for USBDEVFS_RESET (patch contributed by Brad Hards <bradh@frogmouth.net>).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11702
2011-04-18 10:37:56 +00:00
Julian Seward
b3827d6c33 Create new module m_libcsetjmp, which wraps up uses of
__builtin_setjmp and __builtin_longjmp so that they can be selectively
replaced, on a platform by platform basis.  Does not change any
functionality.  Related to #259977.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11687
2011-04-11 16:17:51 +00:00
Julian Seward
6107fd666c Add a port to IBM z/Architecture (s390x) running Linux -- Valgrind
side components. (Florian Krohm <britzel@acm.org> and Christian
Borntraeger <borntraeger@de.ibm.com>).  Fixes #243404.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11604
2011-03-07 16:05:35 +00:00
Julian Seward
669d87bcc1 Support sys_readahead on Linux.
(Sean Bartell, wingedtachikoma@gmail.com)  Fixes #247894.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11394
2010-10-04 20:03:27 +00:00
Tom Hughes
3d13995189 Add support for F_DUPFD_CLOEXEC. Fixes #238696.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11316
2010-09-02 08:23:35 +00:00
Tom Hughes
72abd5958d The argument to FIBMAP is an int, not an unsigned long. Fixes #248822.
Patch from Christian Borntraeger <borntraeger@de.ibm.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11289
2010-08-25 09:13:44 +00:00
Bart Van Assche
9db21fdc0d Fix for bug #242814 (Linux): made sure that Valgrind tools do not crash when the first argument of the mount() system call is NULL.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11191
2010-06-29 06:16:52 +00:00
Tom Hughes
725752d4ea Fixed bogus check of RES in the ioctl PRE handler introduced
in r11124 while fixing #235642.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11171
2010-06-10 15:01:02 +00:00
Tom Hughes
f26002da90 Fix amd64 and ppc64 to correctly mark mq_timedreceive as LINXY so that
the post handler is run to mark the retrieved message as correct.

Also change the post handler to only mark the number of bytes actually
returned as defined, rather than the whole buffer.

Fixes #238679.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11133
2010-05-24 13:40:10 +00:00
Tom Hughes
ef5b3e48b6 Add support for some EVIO ioctls. These are a bit abnormal because
the length part of the ioctl is not fixed so they are essentially
families of ioctls.

Based on patch from Peter Korsgaard. Fixes #235642.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11124
2010-05-07 15:32:04 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Tom Hughes
0e95308259 Add a wrapper for the splice system call and wire it up on
x86 and amd64 systems. Closes #205788.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11055
2010-02-23 10:49:48 +00:00
Tom Hughes
2a70cf0b01 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11054
2010-02-23 10:02:55 +00:00
Julian Seward
e6c318c531 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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11053
2010-02-22 11:03:10 +00:00
Tom Hughes
3985923259 Fix up a few issues with OSS ioctls. Fixes #227325.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11050
2010-02-18 15:54:45 +00:00
Tom Hughes
e548bda0ec 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.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11048
2010-02-16 15:05:55 +00:00
Julian Seward
e9de458500 Merge from branches/ARM, all parts of the ARM-Linux port except for
the changes to do with reading and using ELF and DWARF3 info.
This breaks all targets except amd64-linux and x86-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10982
2010-01-01 11:59:33 +00:00
Tom Hughes
5309bc27a0 Handle adjtimex being called in adjtime mode correctly. Closes #219538.
Validate the constant field with ADJ_TAI is used in an adjtimex call.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10969
2009-12-21 11:29:54 +00:00
Tom Hughes
798cd12a34 It seems whoever wrote the preadv and pwritev system calls in the
kernel decided it would be fun to make them always take the low word
of the offset argument before the high word regardless of the
endianism of the system... Consistency - they've heard of it...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10962
2009-12-02 16:19:12 +00:00
Tom Hughes
8d4c124ebb Add support for fallocate system call on 32 bit (x86/ppc32) linux
systems based on patch from Dodji Seketeli. Part fix for #215973.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10953
2009-11-25 11:51:05 +00:00
Tom Hughes
27f8eb0f4a Clean up support for sync_file_range system call and add second version used
by ppc platforms based on patch from Dodji Seketeli. Part fix for #215973.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10952
2009-11-25 11:29:14 +00:00
Tom Hughes
41f4259ea8 Rename LOHI64 to MERGE64 and make it work correctly on big endian
platforms. Also add MERGE64_FIRST and MERGE64_SECOND macros to help
produce the right argument names in error messages on big/little
endian platforms.

Based on patch from Dodji Seketeli. Part fix for #215973.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10951
2009-11-25 11:24:00 +00:00
Tom Hughes
e46ec05df6 Re-enable old support for adjtimex system call based on patch
from Dodji Seketeli. Part fix for #215973.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10948
2009-11-24 16:38:21 +00:00
Tom Hughes
40fa55a53b Add support for rt_tgsigqueueinfo system call based on patch
from Dodji Seketeli. Part fix for #215973.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10947
2009-11-24 16:08:40 +00:00
Tom Hughes
0d0f835353 Add support for sched_rr_get_interval system call based on patch
from Dodji Seketeli. Part fix for #215973.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10946
2009-11-24 16:03:19 +00:00
Tom Hughes
128df057cb Handle the dup3 system call. Closes #215448.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10945
2009-11-23 08:19:20 +00:00
Tom Hughes
cc253fdd8f Handle some extra aio opcodes in io_submit and io_getevents.
Based on patch from Gabor Gomas. Fixes #209807.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10918
2009-10-28 16:03:29 +00:00
Bart Van Assche
9fc54e2deb Fixed bug #212064.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10917
2009-10-28 10:15:06 +00:00
Tom Hughes
33d5189e1a Add support for preadv and pwritev. Fixes #212149.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10914
2009-10-28 10:04:11 +00:00
Tom Hughes
387cb44cc1 Add support for the inotify_init1 system call, based on patches
from Dodji Seketeli and Jakub Jelinek. Fixes #202315.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10909
2009-10-27 14:17:27 +00:00
Tom Hughes
141ec942a1 Add support for the perf_counter_open system call. Fixes #211498.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10907
2009-10-27 09:19:26 +00:00
Tom Hughes
bba592e3fc Improve futex system call support. Patch from BZ#201757 which I have
attempted to cross check against current kernel code. Reading the
futex system call code mostly just made my head hurt however...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10656
2009-07-29 11:09:01 +00:00
Julian Seward
e7dde85a24 Merge coregrind/ changes from branches/MESSAGING_TIDYUP r10464.
This commit tidies up and rationalises what could be called the
"messaging" system -- that part of V to do with presenting output to
the user.  In particular it brings significant improvements to XML
output.

Changes are:

* XML and normal text output now have separate file descriptors,
  which solves longstanding problems for XML consumers caused by
  the XML output getting polluted by unexpected non-XML output.

* This also means that we no longer have to hardwire all manner
  of output settings (verbosity, etc) when XML is requested.

* The XML output format has been revised, cleaned up, and made
  more suitable for use by error detecting tools in general
  (various Memcheck-specific features have been removed).  XML
  output is enabled for Ptrcheck and Helgrind, and Memcheck is
  updated to the new format.

* One side effect is that the behaviour of VG_(message) has been
  made to be consistent with printf: it no longer automatically
  adds a newline at the end of the output.  This means multiple
  calls to it can be used to build up a single line message; or a
  single call can write a multi-line message.  The ==pid==
  preamble is automatically inserted at each newline.

* VG_(message)(Vg_UserMsg, ..args..) now has the abbreviated form
  VG_(UMSG)(..args..); ditto VG_(DMSG) for Vg_DebugMsg and
  VG_(EMSG) for Vg_DebugExtraMsg.  A couple of other useful
  printf derivatives have been added to pub_tool_libcprint.h,
  most particularly VG_(vcbprintf).

* There's a small change in the core-tool interface to do with
  error handling: VG_(needs_tool_errors) has a new method
  void (*before_pp_Error)(Error* err)  which, if non-NULL, is
  called just before  void (*pp_Error)(Error* err).  This is to
  give tools the chance to look at errors before any part of them
  is printed, so they can print any XML preamble they like.

* coregrind/m_errormgr.c has been overhauled and cleaned up, and
  is a bit simpler and more commented.  In particular pp_Error
  and VG_(maybe_record_error) are significantly changed.

The diff is huge, but mostly very boring.  Most of the changes
are of the form

-   VG_(message)(Vg_UserMsg, "this is a message %d", n);
+   VG_(message)(Vg_UserMsg, "this is a message %d\n", n);

Unfortunately as a result of this, it touches a large number
of source files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10465
2009-07-15 14:48:32 +00:00
Tom Hughes
d9a6e3b3f7 Validate the file descriptor argument to fallocate.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10463
2009-07-15 07:47:49 +00:00