Commit Graph

1187 Commits

Author SHA1 Message Date
Mark Wielaard
2d040ce2c7 arm: Hook up preadv2 and pwritev2 syscalls.
They work the same as on other linux architectures.
2020-01-25 15:10:26 +01:00
Julian Seward
dad7f1d717 Enable sys_adjtimex() on arm-linux. Fixes #412408. 2020-01-22 11:03:54 +01:00
Julian Seward
c88133141a Bug 407376 - Update Xen support to 4.12 (4.13, actually) and add more coverage.
Patch from Tamas K Lengyel (tamas@tklengyel.com).
2020-01-22 10:55:33 +01:00
Julian Seward
685247b67a Bug 416464 - Handle ioctl PR_CAPBSET_READ/DROP.
Patch from Stefan Bruens (stefan.bruens@rwth-aachen.de).
2020-01-22 10:45:40 +01:00
Alexandra Hajkova
7d4071fe85 arm64: hook up finit_module and bpf syscalls
This fixes "WARNING: unhandled arm64-linux syscall" in
delete_module01 and bpf_prog01 tests in the LTP test suite.
2020-01-18 01:44:33 +01:00
Alexandra Hájková
58fc707804 syswrap-linux.c: fix clock_adjtime handling
Not checking whether valgrind can dereference timex pointer
casues VALGRIND INTERNAL ERROR while handling clock_adjtime.
2020-01-15 16:01:12 +01:00
Aleksandar Rikalo
d7b2a29718 mips: Fix return from syscall mechanism for nanoMIPS
- Restore guest sigmask in VG_(sigframe_destroy)
- Use "syscall[32]" asm idiom instead of "syscall" with immediate parameter
  in VG_(nanomips_linux_SUBST_FOR_rt_sigreturn)
- Call ML_(fixup_guest_state_to_restart_syscall) from PRE(sys_rt_sigreturn)
- Tiny code refactor of sigframe-nanomips-linux.c

This fixes none/tests/thread-exits.
2020-01-14 17:24:29 +00:00
Petar Jovanovic
8557d21928 mips: Add membarrier syscall for nanoMIPS
This fixes none/tests/linux/membarrier.
2020-01-14 12:43:13 +00:00
Petar Jovanovic
1d3a772034 mips: Fix clone syscall for nanoMIPS
- Reset syscall return register (a0) in clone_new_thread()
- Use "syscall[32]" asm idiom instead of "syscall" with immediate parameter
  in ML_ (call_on_new_stack_0_1)()
- Optimize stack usage in ML_ (call_on_new_stack_0_1)()
- Code refactor of ML_ (call_on_new_stack_0_1)()

It partially fixes all tests which use clone system call, e.g. none/tests/pth_atfork1.

Patch by Aleksandar Rikalo.
2020-01-14 09:31:48 +00:00
Julian Seward
2a7d3ae768 sys_statx: don't complain if both |filename| and |buf| are NULL.
So as to work around the Rust library's dubious use of statx.
2020-01-02 14:27:24 +01:00
Petar Jovanovic
24c1f4ada3 mips: Add nanoMIPS support to Valgrind 3/4
Necessary changes to support nanoMIPS on Linux.

Part 3/4 - Coregrind and tools changes

Patch by Aleksandar Rikalo, Dimitrije Nikolic, Tamara Vlahovic,
Nikola Milutinovic and Aleksandra Karadzic.

Related KDE issue: #400872.
2019-12-31 09:44:42 +00:00
Julian Seward
57296eee72 Bug 413119 - ioctl wrapper for DRM_IOCTL_I915_GEM_MMAP.
Patches from Simon Richter <Simon.Richter@hogyros.de>.
2019-12-30 11:23:32 +01:00
Julian Seward
11b7891a8a Bug 410556 - add support for BLKIO{MIN,OPT} and BLKALIGNOFF ioctls.
Patch from Nick Black <dankamongmen@gmail.com>.
2019-12-30 11:13:13 +01:00
Julian Seward
bba186064e Bug 409206 - Support for Linux PPS and PTP ioctls.
Patches from Miroslav Lichvar <mlichvar@redhat.com>.
2019-12-30 11:03:19 +01:00
Julian Seward
b6444b9faa syswrap-linux.c: fix the wrapper for ioctl(SIOCETHTOOL), case ETHTOOL_GSET. n-i-bz.
For the case ETHTOOL_GSET, don't insist that the whole structure is defined.
That appears to cause false positives.  All other cases remain unchanged.
2019-12-27 16:20:32 +01:00
Petar Jovanovic
b150644902 mips64: use generic Linux wrapper for sys_unshare
No need for mips64-specific Linux wrappers for sys_unshare.
2019-11-27 13:32:57 +00:00
Petar Jovanovic
64a63a07c9 mips32: hook up adjtimex syscall
Hook up adjtimex syscall for mips32.

This fixes adjtimex01 failure in the LTP test suite.
2019-11-26 13:25:19 +00:00
Petar Jovanovic
762e60391f mips32: hook up getcpu syscall
Hook up getcpu syscall for mips32.

This fixes getcpu01 failure in the LTP test suite.
2019-11-26 13:19:45 +00:00
Petar Jovanovic
f5a6ad6e78 mips32: hook up waitid syscall
Hook up waitid syscall for mips32.

This fixes waitid01 failure in the LTP test suite.
2019-11-26 13:10:47 +00:00
Philippe Waroquiers
53cceb2ac2 Have VG_(is_in_syscall) return False if no syscall was done yet.
As when no syscall was done yet, the syscallInfo pointer is still null,
we return False if this is null, rather than SEGV due to null ptr.

This can at least happen when reporting the scheduler status before
the first syscall was done.
2019-09-10 22:47:58 +02:00
Petar Jovanovic
04cc9cf07e mips: Add nanoMIPS support to Valgrind 2/4
Necessary changes to support nanoMIPS on Linux.

Part 2/4 - Coregrind changes

Patch by Aleksandar Rikalo, Dimitrije Nikolic, Tamara Vlahovic and
Aleksandra Karadzic.

Related KDE issue: #400872.
2019-09-03 12:10:23 +00:00
Petar Jovanovic
cb366f2680 mips32: hook up vmsplice syscall
Hook up vmsplice syscall for mips32.

This fixes vmsplice01 failure in the LTP test suite.
2019-08-21 12:47:11 +00:00
Petar Jovanovic
23a950be4b mips32: hook up vhangup syscall
Hook up vhangup syscall for mips32.

This fixes vhangup01 in the LTP test suite.
2019-08-20 13:30:45 +00:00
Petar Jovanovic
b086d63a73 mips32: hook up utimes syscall
Hook up utimes syscall for mips32.

This fixes utimes01 in the LTP test suite.
2019-08-20 13:17:02 +00:00
Petar Jovanovic
fd640dacde mips32: hook up unshare syscall
Hook up unshare syscall for mips32.

This fixes unshare02 in the LTP test suite.
2019-08-20 12:41:59 +00:00
Petar Jovanovic
8055312c42 mips32: hook up truncate64 syscall
Hook up truncate64 syscall for mips32.

This helps truncate02_64 and several other tests pass without warnings in
the LTP test suite.
2019-08-20 12:29:57 +00:00
Petar Jovanovic
4571112b50 mips32: hook up getitimer syscall
Hook up getitimer syscall for mips32.

This fixes getitimer01 and several other tests in the LTP test suite.
2019-08-19 17:37:17 +00:00
Petar Jovanovic
7cac90f6ba mips32: hook up sethostname syscall
Hook up sethostname syscall for mips32.

This fixes sethostname01 and several other tests in the LTP test suite.
2019-08-19 17:23:58 +00:00
Petar Jovanovic
803bf32f4c mips32: hook up sched_rr_get_interval syscall
Hook up sched_rr_get_interval syscall for mips32.

This fixes sched_rr_get_interval01 and several other tests in the LTP test
suite.
2019-08-14 15:43:10 +00:00
Petar Jovanovic
a03ca6eef8 mips32: hook up sched_setparam syscall
Hook up sched_setparam syscall for mips32.

This fixes sched_setparam01 and several other tests in the LTP test suite.
2019-08-14 15:36:07 +00:00
Petar Jovanovic
04614dae3b mips: hook up tee syscall correctly
Hook up sys_tee for mips32 and mips64 correctly.
For mips64, it is just a simplification to use generic linux implementation.

This fixes tee01 test in the LTP test suite for mips32.
2019-08-14 15:27:25 +00:00
Petar Jovanovic
f605da3ef5 mips32: add sync_file_range syscall support
Hook up sync_file_range for mips32.

Along with the change for passing 7th argument in syscalls, this will fix
sync_file_range01 failure within LTP test suite.

Patch by Nikola Milutinovic.
2019-08-13 14:30:30 +00:00
Petar Jovanovic
9d1b64dd4d mips: pass 7th argument in syscalls
Only arg1 to arg6 have been passed down to kernel for syscalls.
This patch ensures that arg7 is also passed down for syscalls.
In addition to this, ensure that we have 16-byte aligned stack during
mips64 syscall.

Along with the change for sync_file_range, this will fix sync_file_range01
failure within LTP test suite.

Patch by Nikola Milutinovic.
2019-08-13 12:20:38 +00:00
Petar Jovanovic
d830990cd9 mips: hook up splice syscall correctly
Hook up splice syscall for mips32 and mips64 correctly.
This fixes splice01 and several other tests in the LTP test suite.
2019-08-13 12:20:38 +00:00
Petar Jovanovic
60b477684c mips32: hook up lsetxattr syscall
Hook up lsetxattr syscall for mips32.
This fixes llistxattr01 and several other tests in the LTP test suite.
2019-08-13 12:20:38 +00:00
Petar Jovanovic
36e793843e mips32: hook up fsetxattr syscall
Hook up fsetxattr syscall for mips32.
This fixes fgetxattr03 and several other tests in the LTP test suite.
2019-08-02 16:56:25 +00:00
Petar Jovanovic
4f81a5fcbf mips32: enable support for setxattr
Enable support for setxattr syscall for mips32.
2019-07-23 13:24:16 +00:00
Petar Jovanovic
bd2a81f202 mips: hook up preadv, preadv2, pwritev and pwritev2 correctly
Use the correct generic linux sys wrapper.

Follow-up for

  commit b0861063a8
  Author: Alexandra Hajkova <ahajkova@redhat.com>
  Date:   Tue Jun 4 13:47:14 2019 +0200

    Add support for preadv2 and pwritev2 syscalls

This should fix
memcheck/tests/linux/sys-preadv2_pwritev2 (stderr)
memcheck/tests/linux/sys-preadv_pwritev  (stderr)

on mips32/mips64.
2019-07-22 19:56:33 +02:00
Julian Seward
4443b782c4 Bug 350228 - Unhandled ioctl 0x6458 (i965/mesa). Patch from austinenglish@gmail.com. 2019-07-11 17:46:47 +02:00
Philippe Waroquiers
63a9f07931 Fix 409141 and 409367: valgrind hangs or loops when a process sends a signal to itself.
The loop scenario:
  The main thread sends a signal 15 to another thread, and then calls the exit syscall.
  The exit syscall done by thread 1 marks all threads as needing
  to die using exitreason VgSrc_ExitProcess.
  The main thread then gets all other threads out of their blocking syscall
  to let them die, and then "busy polls" for all other threads to disappear.
  However, when the second thread is out of its syscall, it gets the signal 15,
  which is a fatal signal.  This second thread then changes the exit reason
  of all threads to VgSrc_FatalSig, and itself starts to busy poll for all
  other threads to disappear.
  This then loops forever.

  The fix for this consists in not handling the fatal signal in the
  second thread when the process is already busy dying.  Effectively,
  the exit syscall should be processed "atomically": either the process
  is running, or it is dead once the syscall is done.
  Under valgrind, when threads are marked as being ' VgSrc_ExitProcess',
  the guest process should be considered as dead.  Valgrind has still to do
  the cleanup, the endof run report, etc  but otherwise should not let
  any more user code to run.  So, signal should not be handled anymore
  once the 'exit syscall' has marked all threads as VgSrc_ExitProcess.

The hang scenario:
  The main thread sends a signal 9 (KILL) to itself.
  When running natively, this directly kills the process,
  without giving any opportunity to run some user code.
  Valgrind intercepts the kill syscall, and detects that this is
  a fatal signal.  The main thread was then dying, but was
  not getting the other threads out of their syscall (to let them die).

  The fix for this is to have the 'handling' of the signal 9 sent to a
  thread of the process to directly make the process die, by getting
  all threads out of syscall.
  Note that the previous code was trying to have this action done by
  the thread to which the signal 9 was sent.  This was too tricky to
  keep (causing other race conditions between the main thread sending
  the signal 9 e.g. exiting and the other thread supposed to die).
  As it is not particularly critical to have the signal 9 'handled'
  by a specific thread, the thread that is sending the signal 9 is
  the one doing the work to cleanup and terminate the process.
2019-07-09 19:47:44 +02:00
Mark Wielaard
514f899388 Hook up preadv2 and pwritev2 correctly for arm64.
Use the correct generic linux sys wrapper.

Followup for https://bugs.kde.org/408414
2019-07-03 10:27:34 +02:00
Alexandra Hájková
b0861063a8 Add support for preadv2 and pwritev2 syscalls
Support for amd64, x86 - 64 and 32 bit, arm64, ppc64, ppc64le,
s390x, mips64. This should work identically on all
arches, tested on x86 32bit and 64bit one, but enabled on all.

Refactor the code to be reusable between old/new syscalls. Resolve TODO
items in the code. Add the testcase for the preadv2/pwritev2 and also
add the (similar) testcase for the older preadv/pwritev syscalls.

Trying to test handling an uninitialized flag argument for the v2 syscalls
does not work because the flag always comes out as defined zero.
Turns out glibc does this deliberately on 64bit architectures because
the kernel does actually have a low_offset and high_offset argument, but
ignores the high_offset/assumes it is zero.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=601cc11d054ae4b5e9b5babec3d8e4667a2cb9b5

https://bugs.kde.org/408414
2019-07-03 00:19:16 +02:00
Bart Van Assche
97fa86915e Add support for the Linux io_uring system calls
Man pages and test code are available in the following git repository:

http://git.kernel.dk/cgit/liburing/
2019-07-01 19:27:23 -07:00
Mark Wielaard
e00335bd38 linux x86 and amd64 memory protection key syscalls.
This implements minimal support for the pkey_alloc, pkey_free and
pkey_mprotect syscalls. pkey_alloc will simply indicate that pkeys
are not supported. pkey_free always fails. pkey_mprotect works just
like mprotect if the special pkey -1 is provided.

https://bugs.kde.org/show_bug.cgi?id=408091
2019-06-06 18:18:47 +02:00
Mark Wielaard
9616e9bc9a Hook up membarrier syscall for arm-linux. 2019-05-31 15:11:35 +02:00
Mark Wielaard
461cc5c003 Cleanup GPL header address notices by using http://www.gnu.org/licenses/
Sync VEX/LICENSE.GPL with top-level COPYING file. We used 3 different
addresses for writing to the FSF to receive a copy of the GPL. Replace
all different variants with an URL <http://www.gnu.org/licenses/>.

The following files might still have some slightly different (L)GPL
copyright notice because they were derived from other programs:

- files under coregrind/m_demangle which come from libiberty:
  cplus-dem.c, d-demangle.c, demangle.h, rust-demangle.c,
  safe-ctype.c and safe-ctype.h
- coregrind/m_demangle/dyn-string.[hc] derived from GCC.
- coregrind/m_demangle/ansidecl.h derived from glibc.
- VEX files for FMA detived from glibc:
  host_generic_maddf.h and host_generic_maddf.c
- files under coregrin/m_debuginfo derived from LZO:
  lzoconf.h, lzodefs.h, minilzo-inl.c and minilzo.h
- files under coregrind/m_gdbserver detived from GDB:
  gdb/signals.h, inferiors.c, regcache.c, regcache.h,
  regdef.h, remote-utils.c, server.c, server.h, signals.c,
  target.c, target.h and utils.c

Plus the following test files:

- none/tests/ppc32/testVMX.c derived from testVMX.
- ppc tests derived from QEMU: jm-insns.c, ppc64_helpers.h
  and test_isa_3_0.c
- tests derived from bzip2 (with embedded GPL text in code):
  hackedbz2.c, origin5-bz2.c, varinfo6.c
- tests detived from glibc: str_tester.c, pth_atfork1.c
- test detived from GCC libgomp: tc17_sembar.c
- performance tests derived from bzip2 or tinycc (with embedded GPL
  text in code): bz2.c, test_input_for_tinycc.c and tinycc.c
2019-05-26 20:07:51 +02:00
Petar Jovanovic
bf33835707 mips: hook linux copy_file_range syscall
Allow copy_file_range syscalls on MIPS32 and MIPS64.
Update .gitignore.

Related Bugzilla issue - KDE #407218.
2019-05-10 16:35:02 +00:00
Mark Wielaard
bd27ad3ff3 Hook linux copy_file_range syscall on arm. 2019-05-05 16:01:41 +02:00
Alexandra Hajkova
5f00db054a Add support for the copy_file_range syscall
Support amd64, x86, arm64, ppc64, ppc32 and s390x architectures.
Also add sys-copy_file_range test case.
2019-05-05 15:27:13 +02:00
Petar Jovanovic
37f09ed248 mips32: pass correct syscall value to kernel in case of __NR_syscall
The syscall number has to be put in register v0 before call into the kernel.
This was omitted when system call is __NR_syscall (and when the syscall
argument is the system call number of interest).

Patch by Nikola Milutinovic.
2019-04-03 17:40:08 +00:00