208 Commits

Author SHA1 Message Date
Bart Van Assche
c46c27fd34 [PATCH 1/4] xen: distinguish the various fields of the Xen privcmd ioctls in the logging (#321065)
From: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13435
2013-06-30 07:57:35 +00:00
Petar Jovanovic
4ee8c6feea mips: enable several system call wrappers on mips64
Enable wrappers on mips64 for the following calls:

- dup3
- accept4
- epoll_create1
- timerfd_settime
- newfstatat

Also, allow additional flock64 values in sys_fcntl for mips64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13358
2013-04-03 23:43:11 +00:00
Tom Hughes
269fc43ee7 Implement the name_to_handle_at system call for x86 and amd64.
Based on patch from Asmadeus to fix BZ#308930.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13304
2013-03-03 12:57:20 +00:00
Philippe Waroquiers
1b9a118603 Factorise some code from syswrap-amd64/arm/mips32/mips64-linux.c to syswrap-linux.c
Almost mechanical transformation, removes > 1000 SLOC.

Compiled and regtested on amd64/x86/mips32
Compiled and (somewhat) tested on mips64
Compiled on arm



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13302
2013-03-01 23:31:09 +00:00
Christian Borntraeger
293a0cefd6 wire up 2 vhost ioctls. The kernel does not use any parameter
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13298
2013-03-01 13:17:49 +00:00
Christian Borntraeger
85a4737869 initial tun/tap ioctls.
TUNSETIFF/TUNGETIFF/TUNSETOFFLOAD. See 315952.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13297
2013-03-01 12:56:07 +00:00
Petar Jovanovic
5dd4c02e39 mips: adding MIPS64LE support to Valgrind
Necessary changes to Valgrind to support MIPS64LE on Linux.
Minor cleanup/style changes embedded in the patch as well.
The change corresponds to r2687 in VEX.
Patch written by Dejan Jevtic and Petar Jovanovic.

More information about this issue:
https://bugs.kde.org/show_bug.cgi?id=313267


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13292
2013-02-27 23:17:33 +00:00
Bart Van Assche
a367a2d4fe Add support for the Linux ioctl IB_USER_MAD_ENABLE_PKEY
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13287
2013-02-14 17:10:01 +00:00
Tom Hughes
e960453f98 Test file mode correctly in vmsplice wrapper.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13229
2013-01-14 22:14:21 +00:00
Julian Seward
36468d9ae2 For sys-openat the dirfd argument should be ignored when the pathname
is absolute.  Fixes #307103.  (Mark Wielaard, mjw@redhat.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13159
2012-12-06 16:05:18 +00:00
Florian Krohm
c42327c171 One more Char/HChar mixup in conditional code. Reported by Bart.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13127
2012-11-18 22:15:22 +00:00
Florian Krohm
117196ac6d Char/HChar fixups for m_debuginfo and m_gdbserver.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13122
2012-11-15 04:27:04 +00:00
Christian Borntraeger
bf1836a5d9 add BLKPBSZGET ioctl
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13117
2012-11-09 16:01:38 +00:00
Christian Borntraeger
4155f1b382 add s390 specific fix for getregset
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13112
2012-11-08 20:10:10 +00:00
Philippe Waroquiers
88d11f08b4 factorise sys_socketcall
sys_socketcall was duplicated in syswrap-{ppc64|ppc32|arm|mips32|s390x}-linux.c
=>
* Similarly for what was done for sys_ipc, factorise the code in syswrap-linux.c
* re-enabled PRE_MEM_READ for VKI_SYS_SENDMSG and VKI_SYS_RECVMSG 
  (PRE_MEM_READ calls were commented out around 2003, for what
   was supposed a glibc bug.
   The PRE_MEM_READ calls were already re-enabled in s390x)
* s390x also had some more checking to verify the addressibility of
  the args and fail the syscall with EFAULT if not addressable
  => same checks are now done for all platforms.

(tested on x86/amd64/mips32/s390x/ppc32/ppc64, 
 compiled for arm-android-emulator)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13104
2012-11-04 20:40:33 +00:00
Petar Jovanovic
d75506405e Additional refinement in PRE(sys_ipc).
Additional refinement in PRE(sys_ipc) on which arguments to check for the call.
This is still a simplistic check, yet it should resolve additional cases.
One of the resolved cases is memcheck/tests/sem on MIPS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13084
2012-10-26 16:16:43 +00:00
Philippe Waroquiers
85947ee43b fix 123837 semctl system call: 4rth argument is optional, depending on cmd
Depending on the semctl command (arg3), arg4 might or might not be needed.
The PRE(sys_ipc) multiplexed syscall for semctl was always checking
all 4 args.

The fix consists in dereferencing the 4th arg (which in sys_ipc is ARG5)
only if the semctl syscall cmd implies 4 arguments.
This avoids the false positive on linux x86.

Note that PRE(sys_ipc) is still too simplistic as it assumes
that 6 args are always read, which is not the case.
This seems to cause false positive on mips:
  memcheck on none/tests/sem gives:
     Syscall param ipc(fifth) contains uninitialised byte(s)

It would be nice to implement the multiplexed PRE(sys_ipc) by
calling the PRE(sys_xxxx) similar PRE, depending on ARG1 of sys_ipc.
This would then avoid the simplistic PRE(sys_ipc) logic without duplicating
the logic in PRE(sys_semctl) (and all other sys_ipc multiplexed syscalls).
However, I found no easy way to do that.

With the current fix, some logic about semctl is partially duplicated between
the PRE(sys_ipc) (for platforms such as x86 having a multiplexed sys call)
and PRE(sys_semctl) (for platforms such as amd64, having a direct sys call)
to fix the false positive encountered on x86.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13082
2012-10-23 21:38:52 +00:00
Philippe Waroquiers
e344ae06dd Follow-up to sys_ipc restructuration
Rev 13078 removed a PRE call (for SEMCTL) in the POST(sys_ipc).
This commit adds the correct POST call for SEMCTL in POST(sys_ipc).
(note: some tests are missing in this area, as removing PRE
and adding POST did not cause any test result to change).

This is the last patch to restructure the sys_ipc code.

After this patch, should be able to do the real fix
for 23837 (semctl GETVAL false positive)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13079
2012-10-21 21:49:33 +00:00
Philippe Waroquiers
78966742aa Follow-up to sys_ipc restructuration
Now that the PRE/POS(sys_ipc) code is not duplicated anymore,
fix two strange things in this code:

* PRE(sys_ipc) : add missing ; after the call PRE_REG_READ6
  (strange that this was compiling without it ???)

* POST(sys_ipc) : it seems there was a copy/paste of
  the  PRE(sys_ipc) code for VKI_SEMCTL.
  Cannot understand why we would need to call again
  deref_Addr and ML_(generic_PRE_sys_semctl) in the POST(sys_ipc).




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13078
2012-10-21 21:13:39 +00:00
Philippe Waroquiers
b83003a1e0 restructure code for future fixing of 123837 (semctl GETVAL false positive)
Regrouped identical code (except for indentation)
from syswrap-ppc64-linux.c, syswrap-ppc32-linux.c,syswrap-mips32-linux.c
  syswrap-x86-linux.c, syswrap-s390x-linux.c
into
  syswrap-linux.c

(compiled/regtested on x86, amd64, ppc64, mips32, s390x)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13076
2012-10-21 20:21:17 +00:00
Florian Krohm
79b79d6388 First round of Char/HChar fixups for coregrind and memcheck.
Little bit of ripple in tools, too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13074
2012-10-21 19:43:43 +00:00
Tom Hughes
b387dedac0 Allow a null pointer as the second argument to capget.
Patch from Mark Wielaard to fix BZ#307101.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13021
2012-10-04 21:38:27 +00:00
Tom Hughes
f74befe896 Implement a fake /proc/self/auxv file for linux systems.
Patch from Mark Wielaard to fix BZ#253519.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13019
2012-10-04 20:27:38 +00:00
Bart Van Assche
7672eb4cb5 valgrind: Support Xen toolstack process ioctls
From: Ian Campbell <Ian.Campbell@citrix.com>

Under Xen the toolstack is responsible for managing the domains in
the system, e.g. creating, destroying, and otherwise manipulating
them.

To do this it uses a number of ioctls on the /proc/xen/privcmd
device. Most of these (the MMAPBATCH ones) simply set things up such
that a subsequenct mmap call will map the desired guest memory. Since
valgrind has no way of knowing what the memory contains we assume
that it is all initialised (to do otherwise would require valgrind to
be observing the complete state of the system and not just the given
process).

The most interesting ioctl is XEN_IOCTL_PRIVCMD_HYPERCALL which
allows the toolstack to make arbitrary hypercalls. Although the
mechanism here is specific to the OS of the guest running the
toolstack the hypercalls themselves are defined solely by the
hypervisor. Therefore I have split support for this ioctl into a part
in syswrap-linux.c which handles the ioctl itself and passes things
onto a new syswrap-xen.c which handles the specifics of the
hypercalls themselves. Porting this to another OS should just be a
matter of wiring up syswrap-$OS.c to decode the ioctl and call into
syswrap-xen.c. In the future we may want to split this into
syswrap-$ARCH-xen.c but for now this is x86 only.

The hypercall coverage here is pretty small but is enough to get
reasonable(-ish) results out of the xl toolstack when listing,
creating and destroying domains.

One issue is that the hypercalls which are exlusively used by the
toolstacks (as opposed to those used by guest operating systems) are
not considered a stable ABI, since the hypervisor and the lowlevel
tools are considered a matched pair. This covers the sysctl and
domctl hypercalls which are a fairly large chunk of the support
here. I'm not sure how to solve this without invoking a massive
amount of duplication. Right now this targets the Xen unstable
interface (which will shortly be released as Xen 4.2), perhaps I can
get away with deferring this problem until the first change .

On the plus side the vast majority of hypercalls are not of interest
to the toolstack (they are used by guests) so we can get away without
implementing them.

Note: a hypercall only reads as many words from the ioctl arg
struct as there are actual arguments to that hypercall and the
toolstack only initialises the arguments which are used. However
there is no space in the DEFN_PRE_TEMPLATE prototype to allow this to
be communicated from syswrap-xen.c back to syswrap-linux.c. Since a
hypercall can have at most 5 arguments I have hackily stolen ARG8 for
this purpose.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12963
2012-09-09 18:30:17 +00:00
Tom Hughes
1592db60c5 Add support for the tee and vmsplice system calls. BZ#304561.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12861
2012-08-08 08:03:44 +00:00
Julian Seward
4a3633e266 Update copyright dates to include 2012.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843
2012-08-05 15:46:46 +00:00
Philippe Waroquiers
ab7b338320 301265 - add x86 support to Android build
Patch by Dragos Tatulea.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12835
2012-08-05 00:08:25 +00:00
Petar Jovanovic
89c5f88c45 Avoid checking for bitset initialization if futex_wait_bitset is meant to fail.
Glibc deliberately passes random value for the sixth parameter when calling
FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME. This is a regular case of using the
Futex API, so V should not complain that "Syscall param futex(val3) contains
uninitialised byte(s)", if the futex does not have a specified value initially.
For more info, see function pthread_initialize_minimal_internal at:
glibc/nptl/nptl-init.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12773
2012-07-23 00:11:10 +00:00
Julian Seward
620ac73938 Add ioctl wrappers for "Linux user input device". Fixes #296229.
(Chase Douglas, chase.douglas@canonical.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12737
2012-07-13 13:15:10 +00:00
Tom Hughes
dd70fc4248 Add support for the SIOCSHWTSTAMP ioctl, based on a patch
from Arseny Solokha. Fixes BZ#296792.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12730
2012-07-11 14:33:10 +00:00
Tom Hughes
b53fdb8ea7 Add support for the CDROM_GET_CAPABILITY ioctl based on patch
from Nick Black. Fixes BZ#302827.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12726
2012-07-11 12:02:06 +00:00
Philippe Waroquiers
93f019ff73 fix 302709 valgrind for ARM needs extra tls support for android emulator
Allow Valgrind to run on android emulator.
+ added README.android_emulator giving some details about versions used.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12710
2012-07-04 21:59:29 +00:00
Petar Jovanovic
0b52be6035 Including additional header file to syswrap-linux.c to see VG_(get_SP).
Removing a warning of 'implicit declaration of function vgPlain_get_SP' when
compiled for MIPS. Done by including an appropriate header file.
Also, minor style issue correction for  #define PSRAn_BE(n,s,t,a) macro.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12707
2012-07-03 21:02:42 +00:00
Petar Jovanovic
ac1b8d6512 Correcting sys_shmdt wrapper for MIPS Linux.
This patch fixes incorrect handling of sys_shmdt for MIPS. Linux wrappers have
been added for sys_sigprocmask, sys_timerfd_create, sys_timerfd_gettime, and
sys_timerfd_settime on MIPS.
The bug has been reported at https://bugs.kde.org/show_bug.cgi?id=270777 as
sh_mat issue, and it can be reproduced with shmat-sample.c from 
https://bugs.kde.org/show_bug.cgi?id=222545.
The change also fixes sigprocmask from memcheck tests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12658
2012-06-21 17:33:35 +00:00
Julian Seward
3e344c57f6 Merge in a port for mips32-linux, by Petar Jovanovic and Dejan Jevtic,
mips-valgrind@rt-rk.com, Bug 270777.

Valgrind: changes to existing files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12616
2012-06-07 09:13:21 +00:00
Christian Borntraeger
188189536d add some intial kvm ioctls (low hanging fruits). This gets rid of some valgrind
warnings regarding KVM ioctl without a length/direction specifier.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12578
2012-05-23 15:59:40 +00:00
Tom Hughes
bc2f84b39f Add support for the move_pages system call. BZ#282790.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12485
2012-04-03 10:51:27 +00:00
Tom Hughes
1e1da9ff38 Add support for the HCIINQUIRY ioctl.
Patch from Andrew Brampton to fix BZ#283961.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12421
2012-03-07 11:22:42 +00:00
Tom Hughes
137aace5a3 Add support for the I2C_RDWR ioctl.
Patch from arnaud mouiche to fix BZ#286261.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12420
2012-03-07 10:21:33 +00:00
Philippe Waroquiers
74d44d1764 * README_DEVELOPERS : complete/enhance the section about outer/inner
* manual-core.xml : fix a typo
* include/pub_tool_inner.h : new file, defining macros for inner annotation
  include/Makefile.am : reference this new file.
* syswrap-linux.c : when ENABLE_INNER, register the stacks for the outer.
   (otherwise, nothing works properly).
* m_redir.c : avoid inner interpreting the outer vgpreload instructions.
* sema.c : annotate the semaphore with RWLOCK annotations for helgrind
* ticket-lock-linux.c : similar.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12414
2012-03-03 12:01:48 +00:00
Tom Hughes
35cc294c29 Handle prlimit64 the same way we do getrlimit and setrlimit, with
some requests trapped and handled by valgrind.

Patch from Matthias Schwarzott via BZ#294047.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12411
2012-03-01 13:42:18 +00:00
Tom Hughes
3925f2d664 Only mark data which has actually been filled in by recvmsg as defined.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12380
2012-02-10 16:45:01 +00:00
Tom Hughes
b7ec723aa8 Improve messages for mmsg calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12379
2012-02-10 11:54:16 +00:00
Tom Hughes
3e8d8f5087 Correct system call name.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12378
2012-02-10 11:50:36 +00:00
Tom Hughes
0080aa8368 It turns out sendmmsg also updates the msg_len fields.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12377
2012-02-10 11:48:01 +00:00
Tom Hughes
baec53c5f1 Add support for the sendmmsg and recvmmsg system calls. Fixes BZ#277779.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12376
2012-02-10 11:30:09 +00:00
Tom Hughes
dc42e147f5 Add support for some SCSI ioctls. Patch from Jakub Jelinek on BZ#292627.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12375
2012-02-10 10:41:07 +00:00
Tom Hughes
74eb6fb3b4 Add support for process_vm_readv and process_vm_writev system calls.
Patch from Lénaïc Huard to fix BZ#292995.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12374
2012-02-10 09:39:37 +00:00
Tom Hughes
7104ded0a5 Add support for the F_GETOWN_EX and F_SETOWN_EX fcntl calls.
Patch from Jakub Jelinek to fix BZ#292626.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12373
2012-02-09 12:21:47 +00:00
Julian Seward
68cf6ae28d Some fixes for Android:
* initial support for Pandaboard/Linaro
* on Android/ARM, ask for non-executable stacks in the executables
* disable Memcheck's strcasestr intercept; its use of tolower()
  causes the dynamic linker to fail.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12234
2011-10-26 15:10:49 +00:00