262 Commits

Author SHA1 Message Date
Mark Wielaard
5fa9a30cea Bug #344318 socketcall should wrap recvmmsg and sendmmsg
Some architectures, e.g. s390, don't have dedicated recvmmsg and sendmmsg
system calls, but use the socketcall multiplexing system call with
SYS_RECVMMSG or SYS_SENDMMSG (just like the accept4 systemcall can also
be called through socketcall). Create separate helpers for recvmmsg and
sendmmsg helpers that can be used by either the direct syscall or the
socket call.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14964
2015-02-25 14:00:14 +00:00
Julian Seward
199646a9cd Correctly handle prctl(VKI_PR_SET_PTRACER, ..) so as to avoid false
positives (eg when running Wine).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14946
2015-02-18 15:46:19 +00:00
Julian Seward
fc8c7cbd98 Add wrapper support for I2C_SMBUS ioctls. Patch from
super.firetwister@gmail.com.  Fixes #342603.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14908
2015-02-05 15:52:46 +00:00
Julian Seward
af929fb880 Write proper wrappers for ioctls ION_IOC_ALLOC, ION_IOC_MAP and
ION_IOC_IMPORT, and add a wrapper for SYNC_IOC_MERGE.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14883
2015-01-23 12:00:25 +00:00
Tom Hughes
6504fa50c3 Handle the memfd_create system call.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14875
2015-01-19 21:52:44 +00:00
Florian Krohm
a9aa079113 Change most remaining use of Addr64 in coregrind and the tools to Addr.
Tracking VEX r3056.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14846
2015-01-04 17:20:45 +00:00
Florian Krohm
87dbf329ed Buffer audit. Resize some.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14825
2014-12-20 16:52:08 +00:00
Tom Hughes
b8308dd756 Add support for the getrandom system call. BZ#340788.
Requires r14705 for updated system call lists.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14709
2014-11-10 09:55:59 +00:00
Julian Seward
59b90d186c PRE(sys_openat): when checking whether ARG1 == VKI_AT_FDCWD, be sure
only to check the lowest 32 bits, since that arg is a file descriptor
-- hence "int" -- and checking all 64 bits fails unexpectedly if ARG1
and VKI_AT_FDCWD are not both zero- or sign- extended.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14689
2014-11-04 17:35:04 +00:00
Philippe Waroquiers
80ae5a2395 fix 338995 shmat with hugepages (SHM_HUGETLB) fails with EINVAL
Bug is not really fixed, instead the SHM_HUGETLB flag is ignored.
Note that it is not straightforward to properly fix this,
as this implies either to learn aspacemgr what huge pages are.
Also, the trick used in the fix for 333051 cannot be used easily,
because the SHM_HUGETLB flag is given in shmget, while the mmap
is done in shmat.

So, the easiest is to just ignore the SHM_HUGETLB flag.

SHM_HUGETLB is supposed to only give a performance impact.
Ignoring it should be benign.
Theoretically, the caller might expect a sucessful shmget(SHM_HUGETLB)+shmat
to give pages aligned on e.g. 1MB.
In this case, bad luck, the program will misbehave under valgrind.
To warn of this, a warning is given (once) when SHM_HUGETLB is seen.

The map_unmap.c test has been restructured somewaht to allow
TEST_SHM_HUGETLB to be tested independently (or not) of the TEST_MAP_HUGETLB.

Note also that by default, testing  MAP_HUGETLB and SHM_HUGETLB
is disabled as usually, huge pages are not enabled.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14683
2014-11-01 22:00:50 +00:00
Florian Krohm
17fe8c0a09 Add support for ioctl(fd, TIOCSIG, signal_number) which used
to issue a false complaint. Fixes BZ #339706
Source patch by David Herrmann (dh.herrmann@gmail.com).
Testcase by myself.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14646
2014-10-21 07:20:20 +00:00
Christian Borntraeger
3b8b96e924 implement KVM_KVMCLOCK_CTRL. Interestingly, the kernel does not check
the parameter. QEMU does pass 0 nevertheless as parameter.

bugzilla:  [Bug 339424] Full support of KVM ioctl


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14569
2014-09-26 18:44:40 +00:00
Christian Borntraeger
0b5642095e provide ioctl handlers for KVM_SET_TSS_ADDR.
part of bugzilla 339424


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14568
2014-09-26 12:25:02 +00:00
Florian Krohm
3b95ad549a Use wrapper functions VG_(malloc) and friends consistently across the
board (instead of e.g. VG_(arena_malloc)(VG_AR_CORE,...). This change
also benefits static analysers. We can tell tools that VG_(malloc) allocates
and VG_(free) deallocates and that they are a pair. But we cannot do that for 
arena_malloc/free.
Also provide a wrapper VG_(realloc_shrink).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14517
2014-09-11 21:19:17 +00:00
Julian Seward
af2f0eb3ab Add support for sys_pivot_root and sys_unshare. Patch from
Steven Stewart-Gallus <sstewartgallus00@mylangara.bc.ca>.
n-i-bz (patch on dev@, 27 Aug 2014)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14494
2014-09-08 11:19:48 +00:00
Julian Seward
50618eb024 Improved argument checking for sys_kcmp. Derived from patch from
Christian Borntraeger.  Followup to r14451.  Pertains to #338106.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14473
2014-09-05 21:11:18 +00:00
Julian Seward
775ae0473b Patch adding support for V4L2/media ioctls. Patch from Hans Verkuil
(hverkuil@xs4all.nl).  Fixes #338023.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14455
2014-09-04 11:08:45 +00:00
Julian Seward
29797aa4c0 Add Xen 4.4 evtchn ioctl wrappers. Patch from Antony Saba
(antony.saba@fireeye.com).  Second of two patches from #337740.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14454
2014-09-04 11:02:24 +00:00
Julian Seward
8f579dba61 Add support for sys_kcmp. Patch from Chris Jones
(cjones.bugs@gmail.com).  Fixes #338106.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14451
2014-09-04 10:17:08 +00:00
Julian Seward
7e3f04874a Improvements for Android:
* All Linux targets: add minimal ioctl support for the ION_IOC family

* Android targets: change proprietary-ioctl support for GPUs from
  being a build-time #define kludge to being controlled by --kernel-variant,
  as it should be.  Update documentation accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14440
2014-09-03 15:19:25 +00:00
Tom Hughes
612c18619d Add support for some more tun/tap ioctls. BZ#315952.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14432
2014-09-02 12:54:29 +00:00
Mark Wielaard
e12b5e5ac2 Fix typo in syswrap ppoll param, equate ppoll and poll for memcheck testcase.
ppoll argument is called ufds like the poll argument.
Newer architectures (aarch64) implement poll by calling ppoll directly.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14370
2014-08-26 22:15:58 +00:00
Carl Love
914f75de32 This commit is for Bugzilla 334384. The Bugzilla contains patch 1 of 3
to add PPC64 LE support.  The other two patches can be found in Bugzillas
334834 and 334836.  The commit does not have a VEX commit associated with it.

POWER PC, add initial Little Endian support

The IBM POWER processor now supports both Big Endian and Little Endian.
This patch renames the #defines with the name ppc64 to ppc64be for the BE
specific code.  This patch adds the Little Endian #define ppc64le to the

Additionally, a few functions are renamed to remove BE from the name if the
function is used by BE and LE. Functions that are BE specific have BE put
in the name.

The goals of this patch is to make sure #defines, function names and
variables consistently use PPC64/ppc64 if it refers to BE and LE,
PPC64BE/ppc64be if it is specific to BE, PPC64LE/ppc64le if it is LE
specific.  The patch does not break the code for PPC64 Big Endian.

The test files memcheck/tests/atomic_incs.c, tests/power_insn_available.c
and tests/power_insn_available.c are also updated to the new #define
definition for PPC64 BE.

Signed-off-by: Carl Love <carll@us.ibm.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14238
2014-08-07 23:17:29 +00:00
Christian Borntraeger
00a31dd3d1 add support for VKI_BLKDISCARDZEROES
this is used in some newer QEMU versions and other tools


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14235
2014-08-05 15:14:52 +00:00
Bart Van Assche
e7777bc867 Linux: Add support for Lustre FID2PATH ioctl (#331829)
This is a modified version of a patch provided by Frank Zago (fzago@cray.com).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14233
2014-08-05 12:01:26 +00:00
Bart Van Assche
f47a931b8c Linux system call wrappers: truncate ioctl request number to 32 bits
As explained in https://bugs.kde.org/show_bug.cgi?id=331829, when passing
an ioctl request number as an int to a function the request number will
be sign-extended to 64 bits on 64-bit systems. Avoid that this causes
Valgrind to fail to recognize an ioctl by truncating the request number
to 32 bits.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14232
2014-08-05 11:35:48 +00:00
Tom Hughes
90f471b945 Move DRM ioctl handlers to the right places. Fixes r13486 breakage.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14151
2014-07-10 14:56:48 +00:00
Tom Hughes
ceb1ad640a Add support for the F_OFD_SETLK, F_OFD_SETLKW, and F_OFD_GETLK fcntl
commands. BZ#337285.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14150
2014-07-10 14:50:06 +00:00
Tom Hughes
82ec0b5d43 Add support for the F_OFD_SETLK, F_OFD_SETLKW, and F_OFD_GETLK fcntl
commands. BZ#337285.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14149
2014-07-10 14:48:00 +00:00
Tom Hughes
94b049ff1d Add support for various SIOCETHTOOL operations. BZ#303536.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14114
2014-06-27 09:59:52 +00:00
Tom Hughes
13c65e031d Add SIOCATMARK ioctl support.
Patch from Austin English via BZ#335441.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14112
2014-06-26 13:14:56 +00:00
Tom Hughes
4ef60ef102 Implement various SNDRV_CTL_xxx ioctls.
Patch from Ivan Sorokin via BZ#334936.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14111
2014-06-26 12:53:23 +00:00
Tom Hughes
e97f8c49d6 Handle the HCIGETDEVLIST ioctl.
Based on patch from Tomasz Nowak via BZ#335034.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14109
2014-06-26 11:44:46 +00:00
Tom Hughes
5f4dbbeb75 Add support for the SG_IO ioctl.
Patch from Daniel Kamil Kozar via BZ#333817.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14107
2014-06-26 11:29:05 +00:00
Tom Hughes
ba3d08c7a7 Handle the CDROM_DISC_STATUS ioctl.
Patch from Daniel Kamil Kozar via BZ#333788.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14106
2014-06-26 11:11:56 +00:00
Tom Hughes
8c9c829f4c Add support for TIOCNOTTY ioctl. BZ#331476.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14104
2014-06-26 11:03:32 +00:00
Mark Wielaard
85d5d54737 BZ#331380 cont. Don't crash if evp->sigev_notify is invalid. Fix scalar test.
We check evp.sigev_notify_thread_id only if evp->sigev_notify has
SIGEV_THREAD_ID set. But before checking we need to make sure accessing
evp->sigev_notify is valid.

Fix memcheck/tests/x86-linux/scalar.stderr.exp output.
We now produce separate warnings for the 3 different fields.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13837
2014-02-24 15:09:21 +00:00
Mark Wielaard
7f675b0c9b BZ#331380 Syscall param timer_create(evp) points to uninitialised byte(s)
Only check struct sigevent actually used by the kernel. If SIGEV_THREAD_ID
is set check sigev_notify_thread_id, otherwise don't.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13835
2014-02-24 10:38:45 +00:00
Christian Borntraeger
4b8f0be86d - Handle KVM_CREATE_IRQCHIP, which does not take any parameter
and returns 0 or -1.
- white space fixes around the KVM ioctls


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13799
2014-02-11 15:15:31 +00:00
Tom Hughes
1cdbef5fd8 Fix typo in poll wrapper
Patch from Ivo Raisr via BZ#330941


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13795
2014-02-09 11:10:08 +00:00
Tom Hughes
6ef2cbe59d Add support for the clock_adjtime system call.
Based on a patch from Stefan Sørensen on BZ#330469.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13785
2014-01-30 22:33:02 +00:00
Julian Seward
3f6d211236 Add support for ARMv8 AArch64 (the 64 bit ARM instruction set).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13770
2014-01-12 12:54:00 +00:00
Dejan Jevtic
423d0643b9 mips32: Adding mips32/Android support to Valgrind.
Necessary changes to Valgrind to support mips32 on Android.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13767
2013-12-27 09:06:55 +00:00
Philippe Waroquiers
81d7bfddde Fix 324227 memcheck false positive leak when a thread calls exit+block
only reachable via other thread live register

The exiting thread will have its registers considered as not reachable
anymore, registers of other threads will be considered reachable.

This is ensured by using a different exit reason for the
exiting thread and for the other threads.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13670
2013-10-21 19:57:08 +00:00
Julian Seward
dbf9b63605 Update copyright dates (20XY-2012 ==> 20XY-2013)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658
2013-10-18 14:27:36 +00:00
Florian Krohm
0ac9cb1d0c Fix memory leak when reallocating a thread name.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13561
2013-09-18 14:00:10 +00:00
Florian Krohm
6d15b5deb4 Include pub_core/tool_clreq.h instead of valgrind.h where apropriate.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13555
2013-09-16 20:56:35 +00:00
Florian Krohm
dbc0ecfa9f Intercept prctl(PR_SET_NAME, name) and store the thread name so it
can be used in error messages. That should be helpful when debugging
multithreaded applications.
Patch by Matthias Schwarzott <zzam@gentoo.org> with some minor
modifications. Fixes BZ 322254.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13553
2013-09-16 17:08:50 +00:00
Florian Krohm
5c4ba95a27 Fix inclusion of header files in coregrind. No pub_tool_*.h should be
included here.
Added pub_core_poolalloc.h and renamed pub_tool_inner.h to pub_core_inner.h.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13548
2013-09-15 10:42:26 +00:00
Julian Seward
f7cd4044d5 Add support for a bunch of DRM Ioctls. Fixes #207815.
(Robert Bragg, bob@o-hand.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13486
2013-08-08 08:09:29 +00:00