Commit Graph

5617 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
9dcd3ab1f6 Fix some spelling errors found by Lintian. Patch from Alessandro Ghedini <ghedo@debian.org>. 2020-01-23 10:53:36 +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
Julian Seward
3542be5bdc Bug 385386 - Assertion failed "szB >= CACHE_ENTRY_SIZE" on m_debuginfo/image.c:517.
Patch from Reimar Doeffinger (kde@reimardoeffinger.de).
2020-01-22 10:32:31 +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
Julian Seward
0c4d8bd04a Add statistics printing for the new trace construction algorithm. 2020-01-02 06:42:21 +01:00
Julian Seward
56e04256a7 Rationalise --vex-guest* flags in the new IRSB construction framework
* removes --vex-guest-chase-cond=no|yes.  This was never used in practice.

* rename --vex-guest-chase-thresh=<0..99> to --vex-guest-chase=no|yes.  In
  otherwords, downgrade it from a numeric flag to a boolean one, that can
  simply disable all chasing if required.  (Some tools, notably Callgrind,
  force-disable block chasing, so this functionality at least needs to be
  retained).
2020-01-02 06:42:21 +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
Nikola Milutinovic
b70d208e97 sigprocmask should ignore HOW argument when SET is NULL.
Specific use case bug found in SysRes VG_(do_sys_sigprocmask).

Fix for case when ,,set,, parameter is NULL.
In this case ,,how,, parameter should be ignored because we are
only requesting from kernel to put current signal mask into ,,oldset,,.
But instead we determine the action based on ,,how,, parameter and
therefore make the system call fail when it should pass.
Taken from linux man pages (sigprocmask).

The same is specified for POSIX.

https://bugs.kde.org/show_bug.cgi?id=414565
2019-12-22 15:51:36 +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
7c2e222b11 mips: enable sloppyXcheck for mips32 and mips64
Newer mips kernels (post 4.7.0) assign execute permissions to loadable
program segments which originally did not have them as per the
information provided in the elf file itself.

Include mips32/mips64 in the list of architectures for which the address
space manager should allow the kernel to report execute permissions in
sync_check_mapping_callback.

Patch by Stefan Maksimovic.
2019-11-27 12:22:46 +00:00
Petar Jovanovic
da6f04b924 mips: add ld-linux-mipsn8.so.1 as a valid soname
NaN2008 dynamic linker is named ld-linux-mipsn8.so.1.

Update include/pub_tool_redir.h by adding ld-linux-mipsn8.so.1 to the list
of sonames with an accompanying check in coregrind/m_redir.c.

Patch by Stefan Maksimovic.
2019-11-27 12:06:10 +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
Petar Jovanovic
4456279023 mips64: upgrade parts of valgrind's fast cache for the n32 abi
Update the list of architectures to differentiate between the n32 and n64 abi
for mips64 when defining the fast cache macros in
coregrind/pub_core_transtab_asm.h.

Also amend the VG_(disp_cp_xindir) function in
coregrind/m_dispatch/dispatch-mips64-linux.S to use word-sized loads in case
of the n32 abi since the FastCacheSet structure members are now 4 bytes in
size for mips64 n32.

Patch by Stefan Maksimovic.
2019-11-14 12:33:36 +00:00
Philippe Waroquiers
914d91769a Repair --px-file-backed broken due to dynamic option change.
The commit 3a803036f7 (Allow the user to change a set of command line options
during execution) removed by mistake the code handling the option
--px-file-backed.

Add it back, and modify a trivialleak.vgtest to use the 'VEX registers'
options setting (and their synonym) to do a minimal verification that
the options and synonyms are accepted.
The options are specifying the default values, they should not influence
the result of the test.

Bug (and its origin) reported by Julian.
2019-11-12 06:12:36 +01:00
James Hilliard
5d687db287 configure.ac: automatically detect xcode path
This should fix build errors due to /usr/include not existing.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2019-10-29 09:48:16 +11:00
Philippe Waroquiers
78054a6c07 Remove some trailing whitespaces ... 2019-10-19 17:49:50 +02:00
Philippe Waroquiers
83a535e431 Enhance callgrind option --collect-system.
- The command option --collect-systime has been enhanced to specify
    the unit used to record the elapsed time spent during system calls.
    The command option now accepts the values no|yes|msec|usec|nsec,
    where yes is a synonym of msec.  When giving the value nsec, the
    system cpu time of system calls is also recorded.

Note that the nsec option is not supported on Darwin.
2019-10-12 18:12:04 +02:00
Petar Jovanovic
0ad8d78dca mips64: fix do_syscall_WRK for N32
Load correctly pointer to V1_A3_val on N32.

Patch by Stefan Maksimovic.
2019-09-26 15:18:34 +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
Philippe Waroquiers
3a803036f7 Allow the user to change a set of command line options during execution.
This patch changes the option parsing framework to allow a set of
core or tool (currently only memcheck) options to be changed dynamically.

Here is a summary of the new functionality (extracted from NEWS):
* It is now possible to dynamically change the value of many command
  line options while your program (or its children) are running under
  Valgrind.
  To have the list of dynamically changeable options, run
     valgrind --help-dyn-options
  You can change the options from the shell by using vgdb to launch
  the monitor command "v.clo <clo option>...".
  The same monitor command can be used from a gdb connected
  to the valgrind gdbserver.
  Your program can also change the dynamically changeable options using
  the client request VALGRIND_CLO_CHANGE(option).

Here is a brief description of the code changes.
* the command line options parsing macros are now checking a 'parsing' mode
  to decide if the given option must be handled or not.
  (more about the parsing mode below).

* the 'main' command option parsing code has been split in a function
  'process_option' that can be called now by:
     - early_process_cmd_line_options
        (looping over args, calling process_option in mode "Early")
     - main_process_cmd_line_options
        (looping over args, calling process_option in mode "Processing")
     - the new function VG_(process_dynamic_option) called from
       gdbserver or from VALGRIND_CLO_CHANGE (calling
        process_option in mode "Dynamic" or "Help")

* So, now, during startup, process_option is called twice for each arg:
   - once during Early phase
   - once during normal Processing
  Then process_option can then be called again during execution.

So, the parsing mode is defined so that the option parsing code
behaves differently (e.g. allows or not to handle the option)
depending on the mode.

// Command line option parsing happens in the following modes:
//   cloE : Early processing, used by coregrind m_main.c to parse the
//      command line  options that must be handled early on.
//   cloP : Processing,  used by coregrind and tools during startup, when
//      doing command line options Processing.
//   clodD : Dynamic, used to dynamically change options after startup.
//      A subset of the command line options can be changed dynamically
//      after startup.
//   cloH : Help, special mode to produce the list of dynamically changeable
//      options for --help-dyn-options.
typedef
   enum {
      cloE = 1,
      cloP = 2,
      cloD = 4,
      cloH = 8
   } Clo_Mode;

The option parsing macros in pub_tool_options.h have now all a new variant
*_CLOM with the mode(s) in which the given option is accepted.
The old variant is kept and calls the new variant with mode cloP.
The function VG_(check_clom) in the macro compares the current mode
with the modes allowed for the option, and returns True if qq_arg
should be further processed.

For example:

// String argument, eg. --foo=yes or --foo=no
   (VG_(check_clom)                                                     \
    (qq_mode, qq_arg, qq_option,                                        \
     VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) &&      \
    ({const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ];         \
      if      VG_STREQ(val, "yes") (qq_var) = True;                     \
      else if VG_STREQ(val, "no")  (qq_var) = False;                    \
      else VG_(fmsg_bad_option)(qq_arg, "Invalid boolean value '%s'"    \
                                " (should be 'yes' or 'no')\n", val);   \
      True; }))

   VG_BOOL_CLOM(cloP, qq_arg, qq_option, qq_var)

To make an option dynamically excutable, it is typically enough to replace
    VG_BOOL_CLO(...)
by
    VG_BOOL_CLOM(cloPD, ...)

For example:
-   else if VG_BOOL_CLO(arg, "--show-possibly-lost", tmp_show) {
+   else if VG_BOOL_CLOM(cloPD, arg, "--show-possibly-lost", tmp_show) {

cloPD means the option value is set/changed during the main command
Processing (P) and Dynamically during execution (D).

Note that the 'body/further processing' of a command is only executed when
the option is recognised and the current parsing mode is ok for this option.
2019-08-31 14:41:10 +02:00
Mark Wielaard
d2658f71c3 arm64 fixup for statx support on older kernels
Turns out (older) arm64 linux kernels don't have statx, but also not
stat64 and no stat syscalls.  It uses fstatat instead. The new statx
patch also added a check for stat.  So That needs a special case for
arm64.

Follow up for bug #400593.
2019-08-23 22:17:57 +02: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
c6a6cf929f Use statx rather than other stat system calls
*STAT* system calls other than statx are becoming deprecated.
Coregrind should use statx as the first candidate in order to achieve
"stat" functionality.

There are also systems that do not even support older "stats".

This fixes KDE #400593.

Patch by Aleksandar Rikalo.
2019-08-16 15:59:29 +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