Commit Graph

750 Commits

Author SHA1 Message Date
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
Philippe Waroquiers
eb2b193943 Fix dangling ref in m_errormgr.c + report all uninit fields in a syscall param
Some syscall verification code is allocating memory to generate 
the string used to build an error, e.g. syswrap-generic.c verifying fields of
e.g socket addresses (pre_mem_read_sockaddr) or sendmsg/recvmsg args 
(msghdr_foreachfield)

The allocated pointer was copied in the error created by VG_(maybe_record_error).

This was wrong for 2 reasons:
1. If the error is a new error, it is stored in a list of errors,
   but the string memory was freed by pre_mem_read_sockaddr, msghdr_foreachfield, ...
   This causes a dangling reference. Was at least visible when giving -v, which
   re-prints all errors at the end of execution.
   Probably this could have some consequences during run while generating new errors,
   and comparing for equality with a recorded error having a dangling reference.
2. the same allocated string is re-used for each piece/field of the verified struct.
   The code in mc_errors.c that checks that 2 errors are identical was then wrongly
   considereing that 2 successive errors for 2 different fields for the same syscall
   arg are identical, just because the error string happened to be produced at
   the same address.
(it is believed that initially, the error string was assumed to be a static
string, which is not the case anymore, causing the above 2 problems).

Changes:
* The fix consists in duplicating in m_errormgr.c the given error string when
  the error is recorded. In other words, the error string is now duplicated similarly
  to the (optional) extra component of the error.

* memcheck/tests/linux/rfcomm.c test modified as now an error is reported
  for each uninit field.

* socketaddr unknown family is also better reported (using sa_data field name,
  rather than an empty field name.

* minor reformatting in m_errormgr.c, to be below 80 characters.

Some notes:
1. the string is only duplicated if the error is recorded
   (ie. printed or the first time an error matches a suppression).
   The string is not duplicated for duplicated errors or following errors
   matching the first (suppressed) error.
   The string is also not duplicated for 'unique errors' (that are printed
   and then not recorded).
2. duplicating the string for each recorded error is not deemed to
   use a lot of memory:
     * error strings are usually NULL or short (often 10 bytes or so).
     * we expect no program has a huge number of errors
   If ever this string duplicate would be significant, having a DedupPoolAlloc
   in m_errormgr.c for these strings would reduce this memory (as we expect to
   have very few different strings, even with millions of errors).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14214
2014-07-30 22:20:29 +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
Julian Seward
6a142998c6 Accuracy improvements to syscall wrappers for OSX 10.8 and 10.9.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14140
2014-07-08 08:04:25 +00:00
Bart Van Assche
980d6c2a8c Make moans about unknown ioctls more informative (#336772)
This is a slightly modified version of a patch from Ivo Raisr <ivosh@ivosh.net>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14116
2014-06-28 07:18:33 +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
49ed137491 Wire up recvmmsg on arm. BZ#334585.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14113
2014-06-26 13:34:53 +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
Julian Seward
8c7929901d * Move the new 10.9 syscalls into their own section.
* Add a POST_MEM_WRITE for kernelrpc_mach_vm_map_trap
* fix a compiler complaint caused by lack of a cast



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14085
2014-06-23 16:02:04 +00:00
Julian Seward
a4d26867db Wrap long lines in kernelrpc_mach_* PRE/POST handlers. No functional
change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14084
2014-06-23 13:09:38 +00:00
Julian Seward
33053e3468 kernelrpc_mach_vm_allocate_trap writes the resulting address to *ARG2
on successful return.  We need to mark this as defined.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14071
2014-06-21 09:36:19 +00:00
Florian Krohm
8db939e065 Fix a few Char / HChar mixups.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14069
2014-06-20 21:47:41 +00:00
Julian Seward
d0744f50ee Fix a missing-prototype warning on OS X 10.7.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14068
2014-06-20 15:30:18 +00:00
Julian Seward
7e9c5b87dd Fix a -Wshadow warning from some oldish version of XCode.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14063
2014-06-20 14:07:38 +00:00
Julian Seward
7d0984bf06 Mac OS X 10.9 improvements. Bug 326724 comment 27 patch name
"0005-darwin-try-to-improve-support-for-mach_msg-on-extern.patch"
(Frederic Germain, frederic.germain@gmail.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14062
2014-06-20 13:38:04 +00:00
Julian Seward
cbcf967174 Mac OS X 10.9 improvements. Bug 326724 comment 27 patch name
"0004-wqthread_hijack-fix-magic_delta-on-darwin-10.9.patch"
(Frederic Germain, frederic.germain@gmail.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14061
2014-06-20 13:29:31 +00:00
Julian Seward
9fb50b29dd Mac OS X 10.9 improvements. Bug 326724 comment 27 patch name
"0003-darwin-remove-warnings-in-logs-related-to-Char-HChar.patch"
(Frederic Germain, frederic.germain@gmail.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14060
2014-06-20 13:22:57 +00:00
Julian Seward
d651963d52 Mac OS X 10.9 improvements. Bug 326724 comment 27 patch name
"0002-thread_state_from_vex-adding-support-for-x86_THREAD_.patch"
(Frederic Germain, frederic.germain@gmail.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14059
2014-06-20 13:13:57 +00:00
Julian Seward
c3d19bad2e Un-break the build on OS X 10.8 following r14057
(0001-adding-support-for-loads-of-new-syscall-in-darwin-10.patch)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14058
2014-06-20 13:08:51 +00:00
Julian Seward
6fee23f051 Mac OS X 10.9 improvements. Bug 326724 comment 27 patch name
"0001-adding-support-for-loads-of-new-syscall-in-darwin-10.patch"
(Frederic Germain, frederic.germain@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14057
2014-06-20 12:35:00 +00:00
Julian Seward
53c26e192f Un-break the build on OS X 10.8 following
14055 ("initial build support for Mac OS X 10.9")


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14056
2014-06-20 12:09:10 +00:00
Julian Seward
91350dc8a5 Add initial build support for Mac OS X 10.9 (Mavericks). Bug 326724
comment 12.  (Diego Giagio, diego@giagio.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14055
2014-06-20 11:48:38 +00:00
Julian Seward
32cf31c0d8 Enable sys_fchmodat.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13997
2014-06-04 23:22:29 +00:00
Julian Seward
e5d979564f arm64-linux: enable sys_sched_setaffinity, sys_linkat.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13974
2014-05-16 15:02:09 +00:00
Julian Seward
8b72a31ca9 Enable: sys_add_key, sys_keyctl, apparently needed by glibc-2.19.90 on
arm64-linux.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13972
2014-05-15 16:47:56 +00:00
Mark Wielaard
85011418d1 Use safe_to_deref in coregrind syswrap-generic.c (msghdr_foreachfield).
Call ML_(safe_to_deref) before using msghdr msg_name, msg_iov or msg_control.
Fixes bug #334705.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13963
2014-05-14 11:35:54 +00:00
Bart Van Assche
31ea126303 syswrap: XEN_DOMCTL_resumedomain
No input or output parameters
    
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13928
2014-05-01 08:05:49 +00:00
Bart Van Assche
8e96f7cb2e syswrap: XEN_HVMOP_set_mem_type
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13927
2014-05-01 08:05:24 +00:00
Bart Van Assche
ab0b9aeee2 syswrap: XEN_HVMOP_set_pci_link_route
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13926
2014-05-01 08:05:06 +00:00
Bart Van Assche
a73358e813 syswrap: XEN_HVMOP_set_isa_irq_level
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13925
2014-05-01 08:04:42 +00:00
Bart Van Assche
79d4a4bc9e syswrap: XEN_DOMCTL_cacheflush
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13924
2014-05-01 08:04:18 +00:00
Bart Van Assche
bbb123c729 syswrap: XEN_DOMCTL_settimeoffset
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13923
2014-05-01 08:03:13 +00:00
Bart Van Assche
3c3aed19ee Fix P{RE,OST}_XEN_HVMOP_{READ,WRITE}
_type should be a type, not a string
    
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13922
2014-05-01 08:02:39 +00:00
Julian Seward
2320d23f1f Enable sys_sendmmsg() on arm32.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13908
2014-04-24 23:45:18 +00:00
Julian Seward
20f47d4181 Enable syscalls:
sys_readv sys_signalfd4 sys_utimensat sys_timerfd_create
sys_timerfd_settime sys_timerfd_gettime sys_capget sys_syslog
sys_sched_yield sys_sigaltstack sys_rt_sigqueueinfo
sys_mq_timedsend sys_mq_timedreceive sys_mq_notify
sys_mq_getsetattr sys_mremap



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13892
2014-04-07 14:47:23 +00:00
Mark Wielaard
2a54eefde2 Enable sys_getpriority and sys_setpriority for ppc64.
Bug 331830 - ppc64: WARNING: unhandled syscall: 96/97
(Miroslav Franc, mfranc@redhat.com)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13861
2014-03-10 14:45:32 +00:00
Julian Seward
da3d709fb7 Enable syscalls: sys_inotify_init1 sys_inotify_add_watch
sys_inotify_rm_watch sys_fallocate sys_quotactl sys_pwrite64
sys_sysinfo sys_shmctl wrap_sys_shmat sys_shmdt



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13857
2014-03-08 20:34:45 +00:00
Julian Seward
a6f3590485 Enable the following syscalls: sys_eventfd2 sys_symlinkat sys_renameat
sys_fstatfs sys_fsync sys_clock_getres sys_sched_getaffinity
sys_shmget sys_fadvise64


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13855
2014-03-07 22:48:50 +00:00
Julian Seward
12f983e5dc Enable sys_epoll_create1, sys_epoll_ctl, sys_epoll_pwait, sys_prctl.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13849
2014-03-02 12:49:52 +00:00
Julian Seward
1ffe03c510 Enable the following syscalls, which are needed to make regtests
in none/ work:
sys_ftruncate
sys_setitimer
sys_rt_sigsuspend
sys_rt_sigtimedwait
sys_mq_open
sys_mq_unlink
sys_semget
sys_semctl
sys_semtimedop
sys_semop
sys_listen
sys_accept
sys_process_vm_readv
sys_process_vm_writev



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13845
2014-03-01 11:24:42 +00:00
Christian Borntraeger
1a0d760a10 wire up some more system calls on s390
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13842
2014-02-27 13:46:02 +00:00