1209 Commits

Author SHA1 Message Date
Mark Wielaard
fbbb696c5d Mask AT_HWCAPS on arm64 to those instructions VEX implements.
This patch makes sure that the process running under valgrind only sees
the AES, PMULL, SHA1, SHA2, CRC32, FP, and ASIMD features in auxv AT_HWCAPS.

https://bugs.kde.org/show_bug.cgi?id=381556
2018-06-21 08:17:11 +02:00
Petar Jovanovic
9a6cf7a41c mips64: add N32 ABI support
Adding MIPS N32 ABI support.

BZ issue - #345763.

Contributed and maintained by mulitple people over the years:
  Crestez Dan Leonard, Maran Pakkirisamy, Dimitrije Nikolic,
  Aleksandar Rikalo, Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Petar Jovanovic
ac58a6b857 mips64: use RegWord where appplicable
Use RegWord type in mips64.

Part of the changes required for MIPS N32 ABI support.
BZ issue - #345763.

Contributed by:
  Dimitrije Nikolic, Aleksandar Rikalo and Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Petar Jovanovic
06546d831d mips64: define _VKI_NSIG_BPW based on the size of long
Define _VKI_NSIG_BPW in a similar way to how _NSIG_BPW is defined in kernel.

This will be important for N32 ABI changes. (BZ #345763)
2018-06-14 17:38:20 +00:00
Rhys Kidd
92d6a53886 Fix missing kevent_qos syscall (macOS 10.11). bz#383723
Based upon patch from Alexandru Croitor.
2018-06-03 12:53:18 -04:00
Philippe Waroquiers
54145019b0 n-i-bz Fix possible stack trashing by semctl syscall wrapping
The modified test none/tests/sem crashes with a SEGV when valgrind is compiled
with lto on various amd64 platforms (debian/gcc 6.3, RHEL7/gcc 6.4,
Ubuntu/gcc 7.2)

The problem is that the vki_semid_ds buf is not what is expected by the kernel:
the kernel expects a bigger structure vki_semid64_ds (at least on
these platforms).
Getting the sem_nsems seems to work by chance, as sem_nsems is at
the same offset in both vki_semid_ds and vki_semid64_ds.
However, e.g. the ctime was not set properly after syscall return,
and 2 words after sem_nsems were set to 0 by the kernel, causing
the SEGV, as a spilled register became 0.

Fix consists in using the 64 bit version for __NR_semctl.
Tested on debian/amd64 and s390x.
2018-04-01 14:31:40 +02:00
Tom Hughes
12d162aabc Update linux system call numbers. 2018-03-21 12:28:31 +00:00
Bart Van Assche
a05d86e562 Linux: Add support for the zoned block device ioctls
Shingled magnetic recording drives support a command set called ZBC
(Zoned Block Commands). Two new ioctls have been added to the Linux
kernel to support such drives, namely VKI_BLKREPORTZONE and
VKI_BLKRESETZONE. Add support to Valgrind for these ioctls.
2018-03-12 10:46:15 -07:00
Bart Van Assche
ccd1e177ee Linux: Add support for the BLKFLSBUF ioctl 2018-03-12 10:46:01 -07:00
Rhys Kidd
dcb83cf846 macos: Fix unhandled syscall: mach:43 (mach_generate_activity_id). bz#385279
Based upon a patch provided by Louis Brunner <louis.brunner.fr@gmail.com> and
tested by:
  FX           <fxcoudert@gcc.gnu.org>
  Chris Wilson <chris+kde@qwirx.com>
2018-02-11 19:56:58 -05:00
Ivo Raisr
bd077baa71 Add a simple progress-reporting facility.
Fixes BZ#384633.
Patch by: Julian Seward <jseward@acm.org>
2018-01-20 19:56:02 +00:00
Julian Seward
cceed053ce Bug 79362 - Debug info is lost for .so files when they are dlclose'd. Majorly reworked by Philippe Waroquiers. 2018-01-11 19:40:12 +01:00
Philippe Waroquiers
619fb35df7 Fix 376257 - helgrind history full speed up using a cached stack
This patch implements the flag --delta-stacktrace=yes/no.
Yes indicates to calculate the full history stack traces by
changing just the last frame if no call/return instruction was
executed.
This can speed up helgrind by up to 25%.

This flags is currently set to yes only on linux x86 and amd64, as some
platform dependent validation of the used heuristics is needed before
setting the default to yes on a platform. See function check_cached_rcec_ok
in libhb_core.c for more details about how to validate/check the behaviour
on a new platform.
2017-11-02 21:33:35 +01:00
Rhys Kidd
1ce04c35c2 Preliminary support for Darwin 17.x (macOS 10.13) 2017-10-01 19:45:10 -04:00
Rhys Kidd
ed6ad13bc8 Fix missing workq_ops operations (macOS)
Related to discussion in bz#383723. Patch based upon one provided by
Andy Maloney.
2017-10-01 19:05:48 -04:00
Petar Jovanovic
c96148a2a1 mips: fix VKI_SIOCATMARK, VKI_SIOCSPGRP and VKI_SIOCGPGRP macros
Set correct values from Linux kernel.
See ./arch/mips/include/uapi/asm/sockios.h

This issue is covered by newly introduced memcheck test mips32/bad_sioc.
2017-09-27 16:04:31 +02:00
Rhys Kidd
55fe390c7a Fix missing pselect syscall (OS X 10.11). bz#379748
Based upon patch from Louis Brunner.
2017-09-03 12:55:52 -04:00
Ivo Raisr
ba17add79a Fix out-of-tree build on Solaris.
Simply #include config.h with no path at all.
Path by: Rob Boehne <robb@datalogics.com>
2017-08-17 22:38:18 +02:00
Mark Wielaard
33fa406cb1 Fix pub_tool_basics.h build issue with g++ 4.4.7.
g++ 4.4.7 doesn't accept union field initializers:
In file included from ../../include/pub_tool_vki.h:50,
                 from valgrind_cpp_test.cpp:13:
../../include/vki/vki-linux.h: In function ‘vki_cmsghdr* __vki_cmsg_nxthdr(void*, __vki_kernel_size_t, vki_cmsghdr*)’:
../../include/vki/vki-linux.h:673: error: expected primary-expression before ‘.’ token

Assign value after declaration which works for any g++ version.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16437
2017-06-06 09:03:03 +00:00
Julian Seward
fdd319ac66 Update version numbers for 3.13.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16431
2017-06-01 15:44:29 +00:00
Petar Jovanovic
81ba51146e mips: implement set/long_jmp instead of builtins
- VG_MINIMAL_SETJMP and VG_MINIMAL_LONGJMP for VGP_mips64_linux are defined.
- Implementation of VG_MINIMAL_SETJMP and VG_MINIMAL_LONGJMP for mips32 is
  improved by rescuing FP registers.

This should unbreak mips64/clang build.

Patch by Aleksandar Rikalo.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16378
2017-05-15 14:56:22 +00:00
Ivo Raisr
754487de4f Add Linux specific ioctl wrapper for CDROMREADMODE1
Fixes BZ#360429
Original patch by: Vasantha Ganesh K <vasanthaganesh.k@tuta.io>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16358
2017-05-10 23:14:31 +00:00
Ivo Raisr
d73f2c748a Implement additional Xen hypercalls
Fixes BZ#373086
Patch by: Mihai DONȚU <mihai.dontu@gmail.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16355
2017-05-10 18:04:17 +00:00
Ivo Raisr
4770c34059 Update Xen 4.6 domctl wrappers
Fixes BZ#377891
Patch by: Antony Saba <awsaba@gmail.com>



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16354
2017-05-10 17:37:35 +00:00
Ivo Raisr
246bb0e25f Remove TileGX/Linux port.
Fixes BZ#379504.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16340
2017-05-08 17:21:59 +00:00
Ivo Raisr
d8f648486e Fix some spelling mistakes.
Fixes BZ#374719
Patch by: klemens <ka7@la-evento.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16336
2017-05-05 22:13:20 +00:00
Ivo Raisr
38edd50c0e Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16333
2017-05-04 15:09:39 +00:00
Rhys Kidd
8226909643 macos: Fix unhandled syscall: mach:70 (host_create_mach_voucher_trap). bz#379390
Based upon a patch from Louis Brunner.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16326
2017-04-30 21:52:33 +00:00
Rhys Kidd
bc4ee3af41 macos: Block out a few more macOS / Darwin syscalls. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16324
2017-04-30 01:59:33 +00:00
Rhys Kidd
254ca9753a macos: Add a no-op wrapper for a new-in-10.10 syscall: fstatat64
Patch from Louis Brunner.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16323
2017-04-30 00:34:59 +00:00
Rhys Kidd
fd128453ff macos: Add a no-op wrapper for a new-in-10.10 syscall: faccessat
Patch from Louis Brunner.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16322
2017-04-30 00:28:10 +00:00
Rhys Kidd
2cc6181ab4 macos: Add a no-op wrapper for a new-in-10.10 syscall: csrctl
Patch from Louis Brunner.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16321
2017-04-30 00:09:56 +00:00
Ivo Raisr
c356e1c01f Syscall wrapper for prctl(PR_SET_NAME) must not check more than 16 bytes.
Fixes BZ#379039.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16314
2017-04-26 19:27:14 +00:00
Petar Jovanovic
f8f1e9cb43 Add musl libc configure/compile
- add musl libc detection (prevents configure error)
- adjust preload and symbol names (based on the OpenWrt patch, see [1])

[1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/
200-musl_fix.patch?rev=46302

Patch by Peter Seiderer <ps.report@gmx.net>

It fixes Bug 359202.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16296
2017-04-06 12:39:15 +00:00
Julian Seward
d52a222f8b Bug 358697 - valgrind.h: Some code remains even when defining NVALGRIND.
Patch from Matthias Schwarzott (zzam@gentoo.org).  The patch removes
a volatile memory read which was only there to stop compilers warning
about |format| being unused.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16290
2017-03-30 12:14:23 +00:00
Ivo Raisr
76e451c60d fcntl syscall wrapper was missing flock structure check on Linux.
Fixes BZ#377930.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16287
2017-03-27 05:06:32 +00:00
Philippe Waroquiers
a6a72c71be Fix 376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
to be wrongly marked as addressable

Patch from Daniel Glöckner, slightly modified.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16274
2017-03-15 19:35:29 +00:00
Petar Jovanovic
30717ab5a2 Add support for syscall ptrace(traceme)
It fixes Bug 377376.

Patch by Aleksandra Karadzic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16273
2017-03-15 15:23:27 +00:00
Ivo Raisr
f1a6076bcf Introduce macro ASSUME_ALIGNED and use it in vki-linux.h.
Reduces the number of compiler warnings on MIPS platforms.
Partial fix for BZ#370028.
Patch by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16256
2017-02-26 21:37:04 +00:00
Carl Love
41308849ef Patch submitted by Will Schmidt for PPC64.
On ppc64*, the TOC ptr should not be considered a scratch
register, and should not be in the clobber list.
This is called out in newer GCC (i.e. gcc7) and triggers an error.

Thusly, remove R2 from the clobber list.

Signed-Off-By: Will Schmidt <will_schmidt@vnet.ibm.com>

Tested and committed by: Carl Love <cel@us.ibm.com>

Bugzilla is 376729.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16254
2017-02-20 19:04:13 +00:00
Ivo Raisr
39dcf62ccd Fix sr_EQ() comparison on Solaris syscall failure
On rare occasions, garbage is found in sr1._val2
while sr2._val2 contains 0.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16252
2017-02-20 08:07:21 +00:00
Ivo Raisr
804686fc2c Solaris: Add syscall wrapper for fast trap getlgrp(6)
Fixes BZ#376518.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16227
2017-02-16 18:29:46 +00:00
Ivo Raisr
fc10a2f3de Solaris: include <sys/lgrp_user_impl.h> only on newer Solaris.
Follow up to SVN r16224 and r16225, BZ#376455. 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16226
2017-02-15 15:22:05 +00:00
Ivo Raisr
72a8b52a60 Solaris: Add additional subcodes for lgrpsys(180) syscall
Fixes BZ#376455.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16225
2017-02-14 12:38:06 +00:00
Ivo Raisr
0f667376e6 Solaris: Add syscall wrapper for lgrpsys(180)
Fixes BZ#376455.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16224
2017-02-14 10:35:20 +00:00
Philippe Waroquiers
489cfd5156 Fix 342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM that clones to a different stack
Fix 373192 Calling posix_spawn in glibc 2.24 completely broken

Functionally, this patch just does the following 2 changes to the
fork clone handling:
* It does not mask anymore CLONE_VFORK :
  The only effect of this flag is to suspend the parent, waiting for
  the child to either exit or execve.
  If some applications depends on this synchronisation, better keep it,
  as it will not harm to suspend the parent valgrind waiting for the
  child valgrind to exit or execve.
* In case the guest calls the clone syscall providing a non zero client stack,
  set the child guest SP after the syscall, before executing guest instructions.
  Not setting the guest stack ptr was the source of the problem reported
  in the bugs.

This also adds a test case  none/tests/linux/clonev.
Before this patch, test gives a SEGV, which is fixed by the patch.

The patch is however a lot bigger : this fix was touching some (mostly
identical/duplicated) code in all the linux platforms.
So, the clone/fork code has been factorised as much as possible.
This removes about 1700 lines of code.

This has been tested on:
* amd64
* x86
* ppc64 be and le
* ppc32
* arm64

This has been compiled on but *not really tested* on:
* mips64 (not too clear how to properly build and run valgrind on gcc22)

It has *not* been compiled and *not* tested on:
* arm
* mips32
* tilegx
* darwin   (normally, no impact)
* solaris  (normally, no impact)

The changes are relatively mechanical, so it is not impossible that
it will compile and work out of the box on these platforms.
Otherwise, questions welcome.

A few points of interest:
* Some platforms did have a typedef void vki_modify_ldt_t,
  and some platforms had no definition for this type at all.
  To make it easier to factorise, for such platforms, the following has
  been used:
     typedef char vki_modify_ldt_t;
    When the sizeof vki_modify_ldt_t is > 1, then the arg syscall is checked.
  This is somewhat a hack, but was simplifying the factorisation.

* for mips32/mips64 and tilegx, there is a strange unconditional assignment
  of 0 to a register (guest_r2 on mips, guest_r0 on tilegx).
  Unclear what this is, in particular because this is assigned whatever
  the result of the syscall (success or not).
  



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16186
2016-12-11 21:39:23 +00:00
Rhys Kidd
db0a061667 Add placeholders for all new OS X 10.11 syscalls. Related to bz#348909.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16185
2016-12-11 08:07:21 +00:00
Rhys Kidd
766afc937e Add placeholders for all new macOS 10.12 syscalls. Related to bz#365327.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16184
2016-12-11 07:17:43 +00:00
Bart Van Assche
14362fe2e2 include/valgrind.h: Fix spelling in a source code comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16156
2016-11-26 02:42:11 +00:00
Julian Seward
cad347059e Bug 348616 - Wine/valgrind: Warning: noted but unhandled ioctl 0x5390
with no size/direction hints. (DVD_READ_STRUCT)

Patch from Austin English (austinenglish@gmail.com).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16153
2016-11-23 13:26:23 +00:00