]> granicus.if.org Git - strace/log
strace
8 years agotests: use sprintrc in epoll_create1.test
Dmitry V. Levin [Sun, 4 Sep 2016 22:16:46 +0000 (22:16 +0000)]
tests: use sprintrc in epoll_create1.test

* tests/epoll_create1.c (main): Use sprintrc.

8 years agotests: fix printing of min_nr and nr arguments of io_getevents syscall
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:40 +0000 (04:32 +0300)]
tests: fix printing of min_nr and nr arguments of io_getevents syscall

* tests/aio.c (main): Change output format for min_nr and nr arguments
in io_getevents check to %ld, cast these arguments to long.

8 years agotests: use sprintrc for return code output in aio test
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:29 +0000 (04:32 +0300)]
tests: use sprintrc for return code output in aio test

* tests/aio.c (main): Use sprintrc for return code output.

8 years agotests: add more tests for ched_rr_get_interval decoding
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:02 +0000 (04:32 +0300)]
tests: add more tests for ched_rr_get_interval decoding

* tests/sched_rr_get_interval.c (main): Check decoding of invalid
timespec pointer and successful syscall invocation.

8 years agotests: use sprintrc for return code output in sched_rr_get_interval test
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:31:48 +0000 (04:31 +0300)]
tests: use sprintrc for return code output in sched_rr_get_interval test

* tests/sched_rr_get_interval.c (main): Use sprintrc for return code
output.

8 years agotests: add more tests for sched_getscheduler and sched_xetscheduler
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:31:35 +0000 (04:31 +0300)]
tests: add more tests for sched_getscheduler and sched_xetscheduler

* tests/sched_xetscheduler.c (main): Check for decoding of invalid PID
in sched_getscheduler and sched_setscheduler, invalid address
of sched_param structure, and invalid policy value.

8 years agotests: use sprintrc for return code output in sched_xetscheduler test
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:33:16 +0000 (04:33 +0300)]
tests: use sprintrc for return code output in sched_xetscheduler test

* tests/sched_xetscheduler.c (main): Use sprintrc for return code output.

8 years agoaio: use printfd for fd printing
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:16 +0000 (04:32 +0300)]
aio: use printfd for fd printing

struct iocb contains two fields with fd semantics: aio_fildes and
aio_resfd.  It is quite reasonable to use the appropriate function for
printing them (apart from just "%d").

* aio.c (print_common_flags): Add struct tcb pointer to parameter list;
use printfd for printing aio_resfd field.
(print_iocb_header): Add struct tcb pointer to parameter list;
use printfd for printing aio_fildes field.
(print_iocb): Provide tcp argument to print_iocb_header
and print_common_flags.
(SYS_FUNC(io_cancel)): Likewise.

8 years agosh64: wire up new syscalls
Dmitry V. Levin [Sat, 3 Sep 2016 22:05:10 +0000 (22:05 +0000)]
sh64: wire up new syscalls

* linux/sh64/syscallent.h [380..393]: New entries.

8 years agosh: wire up new syscalls
Dmitry V. Levin [Fri, 2 Sep 2016 21:04:49 +0000 (21:04 +0000)]
sh: wire up new syscalls

* linux/sh/syscallent.h [369..382]: New entries.

8 years agoavr32: wire up preadv2 and pwritev2 syscalls
Dmitry V. Levin [Thu, 1 Sep 2016 22:04:08 +0000 (22:04 +0000)]
avr32: wire up preadv2 and pwritev2 syscalls

* linux/avr32/syscallent.h [326]: Add preadv2 entry.
[327]: Add pwritev2 entry.

8 years agotests: check decoding of readahead syscall
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:28:24 +0000 (18:28 +0300)]
tests: check decoding of readahead syscall

* configure.ac (AC_CHECK_FUNCS): Add readahead.
* tests/readahead.c: New file.
* tests/readahead.test: New test.
* tests/.gitignore: Add readahead.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add readahead.test.

8 years agotests: move sprintrc function to libtests
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:28:02 +0000 (18:28 +0300)]
tests: move sprintrc function to libtests

* tests/tests.h (sprintrc): New prototype.
* tests/futex.c (sprintrc): Move to ...
* tests/sprintrc.c: ... new file.
* tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c.

8 years agotests/futex: add support to sprintrc for return codes other than 0 and -1
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:27:18 +0000 (18:27 +0300)]
tests/futex: add support to sprintrc for return codes other than 0 and -1

* tests/futex.c (sprintrc): Print the actual return code provided,
not just "0".  Check snprintf return code.

8 years agotests/futex: increase sprintrc static buffer size
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:25:56 +0000 (18:25 +0300)]
tests/futex: increase sprintrc static buffer size

* tests/futex.c (sprintrc): Increase buffer size from 256 to 4096.

8 years agotests/futex: rename retstr to sprintrc
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:25:35 +0000 (18:25 +0300)]
tests/futex: rename retstr to sprintrc

* tests/futex.c (retstr): Rename to sprintrc.
(main): Convert all retstr calls to sprintrc.

8 years agoreadahead: fix print format for the "count" argument
Eugene Syromyatnikov [Wed, 31 Aug 2016 23:42:48 +0000 (02:42 +0300)]
readahead: fix print format for the "count" argument

According to documentation and kernel's syscalls.h, its type is size_t,
so "%lu" format should be used instead of "%ld".

* readahead.c (SYS_FUNC(readahead)): Fix conversion specifier
for the "count" argument.

8 years agotests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll
Dmitry V. Levin [Wed, 31 Aug 2016 16:31:53 +0000 (16:31 +0000)]
tests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll

Use zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
instead of explicit casts with unpredictable sign extension semantics.

* tests/xstatx.c (print_time, main): Use zero_extend_signed_to_ull
instead of explicit cast.
(print_stat): Use zero_extend_signed_to_ull and
sign_extend_unsigned_to_ll instead of explicit casts.

8 years agotests: add sign_extend_unsigned_to_ll macro
Dmitry V. Levin [Wed, 31 Aug 2016 16:09:24 +0000 (16:09 +0000)]
tests: add sign_extend_unsigned_to_ll macro

* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.

8 years agoRefactor common sa_handler printing code
Eugene Syromiatnikov [Wed, 17 Aug 2016 01:08:49 +0000 (01:08 +0000)]
Refactor common sa_handler printing code

* xlat/sa_handler_values.in: New file.
* signal.c: Include "xlat/sa_handler_values.h".
(get_sa_handler_str, print_sa_handler): New functions.
(SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them.

8 years agoUpdate TCP* constants
Dmitry V. Levin [Wed, 31 Aug 2016 08:49:31 +0000 (08:49 +0000)]
Update TCP* constants

* xlat/socktcpoptions.in: Add TCP_REPAIR_WINDOW introduced by linux
kernel commit v4.8-rc1~140^2~226.

8 years agoUpdate SCTP_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:22:41 +0000 (18:22 +0000)]
Update SCTP_* constants

* xlat/socksctpoptions.in: Add SCTP_PR_SUPPORTED, SCTP_DEFAULT_PRINFO,
and SCTP_PR_ASSOC_STATUS introduced by linux kernel commits
v4.8-rc1~140^2~148^2~5, v4.8-rc1~140^2~148^2~4, and
v4.8-rc1~140^2~148^2~3, respectively.

8 years agoUpdate fs *_MAGIC constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:16:53 +0000 (18:16 +0000)]
Update fs *_MAGIC constants

* xlat/fsmagic.in: Add BALLOON_KVM_MAGIC and ZSMALLOC_MAGIC introduced
by linux kernel commits v4.8-rc1~147^2~82 and v4.8-rc1~147^2~74,
respectively.

8 years agoUpdate KEXEC_ARCH_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:13:38 +0000 (18:13 +0000)]
Update KEXEC_ARCH_* constants

* xlat/kexec_arch_values.in: Add KEXEC_ARCH_AARCH64 introduced by linux
kernel commit v4.8-rc1~16^2~41.

8 years agoUpdate ETH_P_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:11:13 +0000 (18:11 +0000)]
Update ETH_P_* constants

* xlat/ethernet_protocols.in: Add ETH_P_NCSI introduced by linux kernel
commit v4.8-rc1~140^2~65^2~8.

8 years agoUpdate BPF_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:01:50 +0000 (18:01 +0000)]
Update BPF_* constants

* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_CGROUP_ARRAY introduced
by linux kernel commit v4.8-rc1~140^2~212^2~2.
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_XDP introduced
by linux kernel commit v4.8-rc1~140^2~64^2~10.

8 years agoRemove HAVE_SIGACTION checks
Dmitry V. Levin [Tue, 30 Aug 2016 17:44:33 +0000 (17:44 +0000)]
Remove HAVE_SIGACTION checks

The syscall parsers guarded by HAVE_SIGACTION check have to be compiled
regardless of libc sigaction function availability.

* configure.ac (AC_CHECK_FUNCS): Remove sigaction.
* signal.c: Remove HAVE_SIGACTION checks.

8 years agoRemove obsolescent autoconf macro AC_TYPE_SIGNAL
Dmitry V. Levin [Tue, 30 Aug 2016 16:32:29 +0000 (16:32 +0000)]
Remove obsolescent autoconf macro AC_TYPE_SIGNAL

All supported systems are expected to have C89 conforming sematics.

* configure.ac (AC_TYPE_SIGNAL): Remove.

8 years agoRemove obsolescent autoconf macro AC_C_CONST
Dmitry V. Levin [Tue, 30 Aug 2016 16:23:46 +0000 (16:23 +0000)]
Remove obsolescent autoconf macro AC_C_CONST

All supported systems are expected to have the 'const' keyword.

* configure.ac (AC_C_CONST): Remove.

8 years agotests: check decoding of futex syscall
Eugene Syromiatnikov [Tue, 30 Aug 2016 13:30:37 +0000 (16:30 +0300)]
tests: check decoding of futex syscall

* tests/futex.c: New file.
* tests/futex.test: New test.
* tests/.gitignore: Add futex.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add futex.test.

8 years agofutex: do not pretend <linux/futex.h> is included
Eugene Syromyatnikov [Tue, 30 Aug 2016 13:24:37 +0000 (16:24 +0300)]
futex: do not pretend <linux/futex.h> is included

As configure.ac does not check for linux/futex.h, HAVE_LINUX_FUTEX_H is
never defined and therefore the inclusion of <linux/futex.h> guarded by
HAVE_LINUX_FUTEX_H makes no sense.

Moreover, <linux/futex.h> used to have an incorrect definition
of FUTEX_WAIT_BITSET_PRIVATE and FUTEX_WAKE_BITSET_PRIVATE:
since kernel commit v2.6.24-6320-gcd68998 where these definitions
were initially introduced and up to v2.6.31-7082-gf8d1e54 where they
were finally fixed these macros had been incorrectly defined via
FUTEX_WAIT_BITS and FUTEX_WAKE_BITS instead of FUTEX_WAIT_BITSET
and FUTEX_WAKE_BITSET, and these incorrect definitions made their way
into some distributions still in use.

* futex.c [HAVE_LINUX_FUTEX_H]: Remove.

8 years agofutex: avoid printing val when it is not used by the futex command
Eugene Syromyatnikov [Mon, 29 Aug 2016 21:01:45 +0000 (00:01 +0300)]
futex: avoid printing val when it is not used by the futex command

This is analogous to timeout argument omitting in FUTEX_WAKE_BITSET
command.

* futex.c (SYS_FUNC(futex)): Remove common printing of val argument.
Add printing of val argument for all futex commands except
FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI.

8 years agoxlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:59:51 +0000 (23:59 +0300)]
xlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set

* xlat/futexops.in: Add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and
FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME values supported by linux kernel
since commit v4.5-rc1~172^2.

8 years agofutex: fix formatting of unknown command argument
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:59:01 +0000 (23:59 +0300)]
futex: fix formatting of unknown command argument

Use alternate form for printing hexadecimal numbers to avoid confusion.
Use printaddr to print uaddr as the latter is interpreted as a pointer
in all currently supported futex operations.

* futex.c (SYS_FUNC(futex)): Fix formatting of unknown command
argument.

8 years agofutex: add handling of FUTEX_FD command
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:57:38 +0000 (23:57 +0300)]
futex: add handling of FUTEX_FD command

Since obsolete FUTEX_FD command is known and used to have some expected
argument format, print FUTEX_FD using that format.

* futex.c (SYS_FUNC(futex)): Handle FUTEX_FD command.

8 years agofutex: fix formatting of val3 hexadecimal argument
Eugene Syromyatnikov [Mon, 29 Aug 2016 21:00:58 +0000 (00:00 +0300)]
futex: fix formatting of val3 hexadecimal argument

* futex.c (SYS_FUNC(futex)): In FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET,
print hexadecimal val3 argument in alternate form to avoid confusion.

8 years agofutex: fix FUTEX_WAKE_OP compare function mask
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:56:24 +0000 (23:56 +0300)]
futex: fix FUTEX_WAKE_OP compare function mask

According to the initial and current (v4.7) kernel implementations,
in FUTEX_WAKE_OP case the compare function does not have
FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits starting with bit 24.

* futex.c (SYS_FUNC(futex)): Do not print FUTEX_OP_OPARG_SHIFT
for 27th bit of val3 in FUTEX_WAKE_OP case.

8 years agotests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c
Dmitry V. Levin [Tue, 30 Aug 2016 12:43:09 +0000 (12:43 +0000)]
tests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c

* bootstrap: Add -DMPERS_IS_$(MPERS_NAME) to ARCH_MFLAGS.
* tests/xstatx.c [USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC.
[USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC.
[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC.
[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC.

Based on patch by James Clarke <jrtc27@jrtc27.com>.

8 years agoRemove redundant check for PTRACE_LISTEN availability
Dmitry V. Levin [Tue, 30 Aug 2016 09:12:06 +0000 (09:12 +0000)]
Remove redundant check for PTRACE_LISTEN availability

As ptrace.h already ensures that PTRACE_LISTEN is defined,
there is no need to check this fact in other places.

* strace.c (ptrace_restart): Do not check that PTRACE_LISTEN is defined.

8 years agoRemove unused autoconf macro AC_TYPE_GETGROUPS
Dmitry V. Levin [Tue, 30 Aug 2016 00:55:07 +0000 (00:55 +0000)]
Remove unused autoconf macro AC_TYPE_GETGROUPS

strace code does not use GETGROUPS_T.

* configure.ac (AC_TYPE_GETGROUPS): Remove.

8 years agoRemove unused autoconf macro AC_TYPE_MODE_T
Dmitry V. Levin [Tue, 30 Aug 2016 00:53:12 +0000 (00:53 +0000)]
Remove unused autoconf macro AC_TYPE_MODE_T

strace code already redefines mode_t.

* configure.ac (AC_TYPE_MODE_T): Remove.

8 years agoUse PTRACE_SUNDETACH everywhere on SPARC and SPARC64
James Clarke [Mon, 29 Aug 2016 23:50:33 +0000 (00:50 +0100)]
Use PTRACE_SUNDETACH everywhere on SPARC and SPARC64

SPARC has a different PTRACE_DETACH value correctly defined in
sys/ptrace.h, but linux/ptrace.h clobbers it with the standard one.
PTRACE_SUNDETACH is also defined to the correct value by sys/ptrace.h,
so use that instead.

* strace.c (detach) [SPARC]: Move redefinition of PTRACE_DETACH
to PTRACE_SUNDETACH ...
* ptrace.h [SPARC || SPARC64]: ... here.

8 years agoRemove obsolescent autoconf macro AC_HEADER_STDC
Dmitry V. Levin [Mon, 29 Aug 2016 16:18:11 +0000 (16:18 +0000)]
Remove obsolescent autoconf macro AC_HEADER_STDC

All systems supported by strace are expected to have C89 conforming
header files.

* configure.ac (AC_HEADER_STDC): Remove.

8 years agoRemove unneeded autoconf macro AC_HEADER_DIRENT
Dmitry V. Levin [Mon, 29 Aug 2016 16:09:57 +0000 (16:09 +0000)]
Remove unneeded autoconf macro AC_HEADER_DIRENT

strace code already includes <dirent.h> unconditionally.

* configure.ac (AC_HEADER_DIRENT): Remove.

8 years agoRemove unneeded autoconf macro AC_HEADER_STDBOOL
Dmitry V. Levin [Sun, 28 Aug 2016 00:03:14 +0000 (00:03 +0000)]
Remove unneeded autoconf macro AC_HEADER_STDBOOL

strace code assumes C99.

* configure.ac (AC_HEADER_STDBOOL): Remove.
* defs.h: Include <stdbool.h> unconditionally.

8 years agoRemove obsolescent autoconf macro AC_HEADER_STAT
Dmitry V. Levin [Sat, 27 Aug 2016 23:42:29 +0000 (23:42 +0000)]
Remove obsolescent autoconf macro AC_HEADER_STAT

No systems supported by strace are expected to have the bug workarounded
by AC_HEADER_STAT macro.

* configure.ac (AC_HEADER_STAT): Remove.

8 years agoDo not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally
Dmitry V. Levin [Fri, 26 Aug 2016 21:32:53 +0000 (21:32 +0000)]
Do not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally

glibc, starting with commit glibc-2.24-28-gdbab657, has deprecated
inclusion of <sys/sysmacros.h> by <sys/types.h>.  The method used
for deprecation breaks AC_HEADER_MAJOR: this autoconf macro no longer
defines MAJOR_IN_SYSMACROS, which consequently breaks build.

Let's assume that all systems supported by strace provide major, minor,
and makedev macros via <sys/sysmacros.h>.

* configure.ac (AC_HEADER_MAJOR): Remove.
* mknod.c [MAJOR_IN_SYSMACROS, MAJOR_IN_MKDEV]: Remove.
Include <sys/sysmacros.h> unconditionally.
* print_struct_stat.c: Likewise.
* tests/mknod.c: Likewise.
* tests/mknodat.c: Likewise.
* tests/xstatx.c: Likewise.

8 years agobtrfs: mpersify struct btrfs_ioctl_vol_args_v2
Dmitry V. Levin [Thu, 25 Aug 2016 21:24:33 +0000 (21:24 +0000)]
btrfs: mpersify struct btrfs_ioctl_vol_args_v2

This complements commit v4.11-719-gfb0c609.

* btrfs.c (struct_btrfs_ioctl_vol_args_v2): New type.  Mpersify it.
(btrfs_print_qgroup_inherit): Change qgi_addr type to unsigned long.
(btrfs_ioctl): Replace struct btrfs_ioctl_vol_args_v2 with
struct_btrfs_ioctl_vol_args_v2.

8 years agompers.awk: relax union member name absence check
Elvira Khabirova [Mon, 29 Aug 2016 13:22:47 +0000 (13:22 +0000)]
mpers.awk: relax union member name absence check

This fixes mpersing of unions containing nameless members,
e.g. struct btrfs_ioctl_vol_args_v2.

* mpers.awk (what_is): Print names of union_type members as is.

8 years agoRevert "tests/xstatx.c: fix stat syscall tests on mips64"
Dmitry V. Levin [Wed, 24 Aug 2016 00:29:47 +0000 (00:29 +0000)]
Revert "tests/xstatx.c: fix stat syscall tests on mips64"

Previous commit effectively changed types of st_atime, st_ctime, and
st_mtime members of struct stat and struct stat64 to signed integers,
making the mips64 workaround obsolete.

This reverts commit 3fb84bfc79949c145197c61fbf04ce18464e9112.

* tests/xstatx.c (create_sample) [__mips64]: Remove.

8 years agoMpersify parsers of struct stat and struct stat64
Dmitry V. Levin [Wed, 24 Aug 2016 00:29:40 +0000 (00:29 +0000)]
Mpersify parsers of struct stat and struct stat64

On many architectures that support multiple personalities,
struct stat differ between personalities.  While old code could handle
these differences, there are some architectures, e.g. sparc64, that also
have different struct stat64.  Rewrite parsers using mpers functionality
to fix these issues.

* fetch_struct_stat.c: New file.
* fetch_struct_stat64.c: Likewise.
* print_struct_stat.c: Likewise.
* oldstat.c: Likewise.
* stat.c: Likewise.
* stat.h: Likewise.
* stat64.c: Likewise.
* file.c: Remove.
* printstat.h: Likewise.
* linux/aarch64/stat32.h: Likewise.
* linux/powerpc64/stat32.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/sparc64/stat32.h: Likewise.
* linux/tile/stat32.h: Likewise.
* linux/x32/stat32.h: Likewise.
* linux/x86_64/stat32.h: Likewise.
* Makefile.am (strace_SOURCES): Add fetch_struct_stat.c,
fetch_struct_stat64.c, print_struct_stat.c, oldstat.c, stat.c, stat.h,
and stat64.c.  Remove file.c, printstat.h, linux/aarch64/stat32.h,
linux/powerpc64/stat32.h, linux/riscv/stat32.h, linux/sparc64/stat32.h,
linux/tile/stat32.h, linux/x32/stat32.h, and linux/x86_64/stat32.h.
* configure.ac (AC_CHECK_MEMBERS): Add struct stat64.st_mtime_nsec.
* defs.h (struct strace_stat): New declaration.
(print_struct_stat): New prototype.
* linux/dummy.h (sys_fstatat64): Remove.

8 years agompers.m4: check for struct stat64, struct stat, and their members
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:37 +0000 (14:27 +0000)]
mpers.m4: check for struct stat64, struct stat, and their members

* m4/mpers.m4 (st_MPERS_STRUCT_STAT): New macro.
(st_MPERS): Use it.

8 years agompers: add MPERS_IS_* to CFLAGS passed to mpers.sh
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:19 +0000 (14:27 +0000)]
mpers: add MPERS_IS_* to CFLAGS passed to mpers.sh

This allows testing of MPERS_IS_* macros in pre-MPERS_DEFS parts
of source code.

* Makefile.am (mpers-m%.stamp): Add -DMPERS_IS_$(mpers_NAME) to CFLAGS
passed to mpers.sh.
* mpers_test.sh: Likewise.

8 years agoMove redefinition of stat types to asm_stat.h
Dmitry V. Levin [Tue, 23 Aug 2016 23:39:45 +0000 (23:39 +0000)]
Move redefinition of stat types to asm_stat.h

* file.c: Move redefinition of types that might be used
to define struct stat ...
* linux/asm_stat.h: ... here.
* tests/xstatx.c: Remove redefinition of stat types.

8 years agox86_64: provide a replacement of <asm/stat.h> for x32 personality
Dmitry V. Levin [Tue, 23 Aug 2016 14:49:20 +0000 (14:49 +0000)]
x86_64: provide a replacement of <asm/stat.h> for x32 personality

For the reason described in commit v4.10-517-gcfde1e3, a correct
definition of struct stat for x32 personality is necessary to enable
"asm_stat.h" with -mx32 on x86_64.

* linux/x32/asm_stat.h: Rename to ...
* linux/x86_64/asm_stat.h: ... new file.
* Makefile.am (strace_SOURCES): Add it.
* linux/x32/asm_stat.h: New file, include "x86_64/asm_stat.h".

8 years agox32/asm_stat.h: provide definitions for i386 personality
Dmitry V. Levin [Tue, 23 Aug 2016 14:49:20 +0000 (14:49 +0000)]
x32/asm_stat.h: provide definitions for i386 personality

This enables x32/asm_stat.h with -m32.

* linux/x32/asm_stat.h [__x86_64__ && __ILP32__]: Redirect stat.
Include "linux/asm_stat.h".
(struct stat): Define for [__x86_64__ && __ILP32__] only.
(struct __old_kernel_stat): Remove.

8 years agoIntroduce a separate SEN entry for fstatat64 syscall
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:49 +0000 (14:27 +0000)]
Introduce a separate SEN entry for fstatat64 syscall

* linux/dummy.h (sys_fstatat64): Redirect to sys_newfstatat.
* linux/32/syscallent.h: Replace SEN(newfstatat) with SEN(fstatat64).
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_fstatat64.

8 years agoDo not check for struct stat.st_{a,c}time_nsec
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:45 +0000 (14:27 +0000)]
Do not check for struct stat.st_{a,c}time_nsec

Assume that the check for struct stat.st_mtime_nsec is enough.
Likewise, do not check for struct stat.st_{a,c}tim.tv_nsec.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_atime_nsec,
struct stat.st_ctime_nsec, struct stat.st_atim.tv_nsec,
and struct stat.st_ctim.tv_nsec.
* file.c (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Remove.
* printstat.h (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Replace with
HAVE_STRUCT_STAT_ST_MTIME_NSEC.
* tests/xstatx.c: Likewise.

8 years agoAdd sign_extend_unsigned_to_ll macro
Dmitry V. Levin [Tue, 23 Aug 2016 00:24:22 +0000 (00:24 +0000)]
Add sign_extend_unsigned_to_ll macro

* defs.h (sign_extend_unsigned_to_ll): New macro, mirrors
zero_extend_signed_to_ull.

8 years agozero_extend_signed_to_ull: add short int support
Dmitry V. Levin [Tue, 23 Aug 2016 00:24:17 +0000 (00:24 +0000)]
zero_extend_signed_to_ull: add short int support

* defs.h (zero_extend_signed_to_ull): Add short int support.
* tests/tests.h: Likewise.

8 years agoRename widen_to_ull to zero_extend_signed_to_ull
Dmitry V. Levin [Tue, 23 Aug 2016 00:24:10 +0000 (00:24 +0000)]
Rename widen_to_ull to zero_extend_signed_to_ull

* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
All callers changed.
* tests/tests.h: Likewise.

8 years agosparc, sparc64: remove obsolete code
Dmitry V. Levin [Tue, 23 Aug 2016 00:24:03 +0000 (00:24 +0000)]
sparc, sparc64: remove obsolete code

Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64] (SYS_FUNC(xstat), SYS_FUNC(fxstat)): Remove.

8 years agosparc64: fix decoding of struct stat64 related syscalls
Dmitry V. Levin [Mon, 22 Aug 2016 09:34:54 +0000 (09:34 +0000)]
sparc64: fix decoding of struct stat64 related syscalls

For some reason, struct stat and struct stat64 are different on sparc64.
This change fixes decoding of struct stat64 related syscalls for sparc64
personality, sparc32 personality on sparc64 needs more work.

* file.c (printstat64) [SPARC64]: Do not use printstat.
(SYS_FUNC(newfstatat)): Likewise.

8 years agotests: fill old_value argument in timer{,fd}_xettime tests
Eugene Syromyatnikov [Mon, 22 Aug 2016 08:48:39 +0000 (11:48 +0300)]
tests: fill old_value argument in timer{,fd}_xettime tests

This is needed in order to differentiate it from the value returned
by the call.  As a consequence, it enables revealing possible bugs
in syscall parsers, for example, when the value read on syscall
entering and not on syscall exiting, as it was the case with
timerfd_settime parser.

* tests/timer_xettime.c (main): Fill old.its field with value different
from the expected one upon call return.
* tests/timerfd_xettime.c: Likewise.

8 years agoFix old_value argument retrieval in timerfd_settime parser
Eugene Syromyatnikov [Mon, 22 Aug 2016 08:51:16 +0000 (11:51 +0300)]
Fix old_value argument retrieval in timerfd_settime parser

This is done similar to timer_settime syscall parser.

* time.c (SYS_FUNC(timerfd_settime)): Retrieve old_value argument
on exiting and not on entering.  Return 0 instead of RVAL_DECODED
since the call hasn't been decoded in full on entering.

8 years agoAdd RISC-V architecture support
Richard W.M. Jones [Fri, 19 Aug 2016 13:16:41 +0000 (14:16 +0100)]
Add RISC-V architecture support

The original port of strace was done by Palmer Dabbelt
(eecs.berkeley.edu), based on strace 4.9.

* configure.ac: Define RISCV for riscv*.
* clone.c [RISCV]: Define ARG_* macros as for OR1K.
* defs.h [RISCV] (SUPPORTED_PERSONALITIES): Define to 2.
[RISCV] (NEED_UID16_PARSERS): Define to 1.
* linux/riscv/arch_regs.c: New file.
* linux/riscv/errnoent1.h: Likewise.
* linux/riscv/get_error.c: Likewise.
* linux/riscv/get_scno.c: Likewise.
* linux/riscv/get_syscall_args.c: Likewise.
* linux/riscv/ioctls_arch0.h: Likewise.
* linux/riscv/ioctls_arch1.h: Likewise.
* linux/riscv/ioctls_inc0.h: Likewise.
* linux/riscv/ioctls_inc1.h: Likewise.
* linux/riscv/signalent1.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/riscv/syscallent.h: Likewise.
* linux/riscv/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
8 years agoMove SH-specific argument number calculation to getllval
Eugene Syromyatnikov [Sat, 20 Aug 2016 14:02:55 +0000 (17:02 +0300)]
Move SH-specific argument number calculation to getllval

This change prevents scattering of ll-related hacks and simplifies
pread/pwrite syscalls parsers' logic a bit.

* util.c (getllval): Add fixup for arg_no for SuperH when argument
number is equal to 3.
* io.c (PREAD_OFFSET_ARG): Remove.
(SYS_FUNC(pread)): Always use argument number 3 for "count" argument
printing.
(SYS_FUNC(pwrite)): Likewise.

8 years agosparc64: fix sigreturn decoding for sparc personality
Dmitry V. Levin [Sun, 21 Aug 2016 22:02:09 +0000 (22:02 +0000)]
sparc64: fix sigreturn decoding for sparc personality

* linux/sparc/arch_sigreturn.c (arch_sigreturn): Parametrize
member types of struct signal_frame.
* linux/sparc64/arch_sigreturn.c (sparc64_arch_sigreturn,
sparc32_arch_sigreturn): New functions.
(arch_sigreturn): Use them.

8 years agoFix compat decoding of struct sigaction.sa_mask on big endian architectures
Dmitry V. Levin [Sat, 20 Aug 2016 00:08:10 +0000 (00:08 +0000)]
Fix compat decoding of struct sigaction.sa_mask on big endian architectures

* signal.c (decode_new_sigaction) [SUPPORTED_PERSONALITIES > 1 &&
SIZEOF_LONG > 4]: Use LONG_LONG to convert sa_mask from 32-bit
struct sigaction to 64-bit struct sigaction.

8 years agoFix decoding of indirect shmat's return code for non-native personalities
Dmitry V. Levin [Fri, 19 Aug 2016 22:57:27 +0000 (22:57 +0000)]
Fix decoding of indirect shmat's return code for non-native personalities

* ipc_shm.c (SYS_FUNC(shmat)): Fetch current_wordsize bytes of data
to obtain return code of indirect shmat subcall.

8 years agosparc64: fix sparc personality decoding of mmap64's offset argument
Dmitry V. Levin [Thu, 18 Aug 2016 22:33:12 +0000 (22:33 +0000)]
sparc64: fix sparc personality decoding of mmap64's offset argument

* linux/sparc64/syscallent1.h: Remove redirection of sys_mmap_4koff.

8 years agosparc64: fix decoding of the forth argument of semctl syscall
Dmitry V. Levin [Wed, 17 Aug 2016 21:58:37 +0000 (21:58 +0000)]
sparc64: fix decoding of the forth argument of semctl syscall

On sparc64, unlike all other architectures where semctl is an indirect
ipc subcall, the forth argument is passed directly.

* ipc_sem.c (SYS_FUNC(semctl)) [SPARC64]: Print 4th argument without
indirection in case of native personality.

8 years agoAdd sparc64 specific ptrace constants
Dmitry V. Levin [Tue, 16 Aug 2016 09:15:44 +0000 (09:15 +0000)]
Add sparc64 specific ptrace constants

* xlat/ptrace_cmds.in: Add PTRACE_GETREGS64, PTRACE_SETREGS64,
PTRACE_GETFPREGS64, and PTRACE_SETFPREGS64.

8 years agosparc64: fix sign extension bug of syscall args for sparc personality
Dmitry V. Levin [Tue, 16 Aug 2016 09:15:36 +0000 (09:15 +0000)]
sparc64: fix sign extension bug of syscall args for sparc personality

* linux/sparc64/get_syscall_args.c (get_syscall_args): Zero-extend
syscall args from 32 bit for sparc personality.

8 years agosparc64: fix tty ioctl numbers
Dmitry V. Levin [Tue, 16 Aug 2016 09:15:24 +0000 (09:15 +0000)]
sparc64: fix tty ioctl numbers

The structures defined in asm/termbits.h have the same size
on sparc and sparc64.

* linux/sparc64/ioctls_arch0.h (TCGETS, TCGETS2, TCSETS, TCSETS2,
TCSETSF, TCSETSF2, TCSETSW, TCSETSW2): Sync with
linux/sparc/ioctls_arch0.h

8 years agoevdev.c: fix typo in comment
Dmitry V. Levin [Mon, 15 Aug 2016 21:08:16 +0000 (21:08 +0000)]
evdev.c: fix typo in comment

8 years agoDrop support of dummy members of struct stat
Dmitry V. Levin [Mon, 15 Aug 2016 18:33:47 +0000 (18:33 +0000)]
Drop support of dummy members of struct stat

As st_flags, st_fstype, and st_gen members of struct stat are not filled
by the kernel, there is no use supporting them.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_flags,
struct stat.st_fstype, and struct stat.st_gen.
* file.c [STAT32_PERSONALITY, HAVE_STRUCT_STAT64]: Do not undefine
HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
and HAVE_STRUCT_STAT_ST_GEN.
* printstat.h (DO_PRINTSTAT): Do not check for
HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
and HAVE_STRUCT_STAT_ST_GEN.

8 years agoAssume that struct stat contains st_blksize, st_blocks, and st_rdev
Dmitry V. Levin [Mon, 15 Aug 2016 17:33:25 +0000 (17:33 +0000)]
Assume that struct stat contains st_blksize, st_blocks, and st_rdev

Our test suite already assumes that struct stat contains st_blksize,
st_blocks, and st_rdev members, and there haven't been any complaints.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_blksize,
struct stat.st_blocks, and struct stat.st_rdev.
* printstat.h (DO_PRINTSTAT): Do not check for
HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_STRUCT_STAT_ST_BLOCKS,
and HAVE_STRUCT_STAT_ST_RDEV.

8 years agotests: fix pause.test when pause syscall is not available
Dmitry V. Levin [Mon, 15 Aug 2016 15:20:38 +0000 (15:20 +0000)]
tests: fix pause.test when pause syscall is not available

* tests/pause.c (main): Fix expected output when pause syscall
is not available.

8 years agopowerpc64, sparc64: fix redefinitions of ARCH_PC_REG
Dmitry V. Levin [Sun, 14 Aug 2016 00:03:03 +0000 (00:03 +0000)]
powerpc64, sparc64: fix redefinitions of ARCH_PC_REG

This fixes compilation warning that ARCH_PC_REG is redefined.

* linux/powerpc64/arch_regs.c (ARCH_PC_REG): Undefine before
the new definition.
* linux/sparc64/arch_regs.c (ARCH_PC_REG): Likewise.

8 years agos390x, x32: remove redundant definitions of ARCH_PC_REG
Dmitry V. Levin [Sun, 14 Aug 2016 00:02:55 +0000 (00:02 +0000)]
s390x, x32: remove redundant definitions of ARCH_PC_REG

* linux/s390x/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
in just included linux/s390/arch_regs.c.
* linux/x32/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
in just included linux/x86_64/arch_regs.c.

8 years agotests: check for leaks of placeholder descriptors
Dmitry V. Levin [Sat, 13 Aug 2016 22:05:28 +0000 (22:05 +0000)]
tests: check for leaks of placeholder descriptors

* tests/redirect-fds.c: New file.
* tests/redirect-fds.test: New test.
* tests/.gitignore: Add redirect-fds.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add redirect-fds.test.

8 years agotests/init.sh: print exit code of failed commands
Dmitry V. Levin [Sat, 13 Aug 2016 22:05:20 +0000 (22:05 +0000)]
tests/init.sh: print exit code of failed commands

* init.sh (run_prog, run_prog_skip_if_failed): When the program fails,
add its exit code to the diagnostic message.
(run_strace): When strace fails, add its exit code to the diagnostic
message.
(run_strace_merge): When strace-log-merge fails, add its exit code
to the diagnostic message.

8 years agoFix leakage of placeholder descriptors to tracees
Dmitry V. Levin [Sat, 13 Aug 2016 22:04:59 +0000 (22:04 +0000)]
Fix leakage of placeholder descriptors to tracees

As a side effect of commit v4.11-211-g0736d4e, strace used to leak
placeholders for standard descriptors to tracees thus affecting their
behaviour.  Fix this by setting close-on-exec flag on placeholder
descriptors.

* strace.c (open_dummy_desc): Set close-on-exec flag on the descriptor
that is going to be returned to the caller.
(fd_is_placeholder): New array.
(ensure_standard_fds_opened, redirect_standard_fds): New functions.
(startup_child): Use redirect_standard_fds.
(init): Use ensure_standard_fds_opened.

8 years agosparc64: fix decoding of uid and gid-related syscalls
Dmitry V. Levin [Fri, 12 Aug 2016 01:00:04 +0000 (01:00 +0000)]
sparc64: fix decoding of uid and gid-related syscalls

sparc64 has no native 16-bit uid/gid syscalls.

* linux/sparc64/syscallent.h (chown, lchown, setuid, getuid, setgid,
getgid, geteuid, getegid, getgroups, setgroups, fchown, setreuid,
setregid, setfsuid, setfsgid): Change handlers from 16-bit to 32-bit.

8 years agotests: fix *stat64 tests on alpha
Dmitry V. Levin [Thu, 11 Aug 2016 22:31:08 +0000 (22:31 +0000)]
tests: fix *stat64 tests on alpha

On some architectures including alpha, <asm/stat.h> provides a
definition of struct stat that has no st_atime_nsec, st_mtime_nsec, and
st_ctime_nsec fields.  At the same time, struct stat64 always has these
fields.  Fix tests to take this difference into account.

* tests/fstat64.c (STRUCT_STAT_IS_STAT64): New macro, defined to 1.
* tests/lstat64.c (STRUCT_STAT_IS_STAT64): Likewise.
* tests/stat64.c (STRUCT_STAT_IS_STAT64): Likewise.
* tests/xstatx.c [!STRUCT_STAT] (STRUCT_STAT_IS_STAT64): New macro,
defined to 0.
[USE_ASM_STAT && STRUCT_STAT_IS_STAT64]:
(HAVE_STRUCT_STAT_ST_ATIME_NSEC, HAVE_STRUCT_STAT_ST_CTIME_NSEC,
HAVE_STRUCT_STAT_ST_MTIME_NSEC): Redefine to 1.

8 years agotests: skip rt_tgsigqueueinfo.test when the syscall is not available
Dmitry V. Levin [Thu, 11 Aug 2016 17:58:09 +0000 (17:58 +0000)]
tests: skip rt_tgsigqueueinfo.test when the syscall is not available

* tests/rt_tgsigqueueinfo.c (main): Skip the test when the syscall
is not available.

8 years agotests/fcntl.c: fix fcntl test on mips64
James Cowgill [Thu, 11 Aug 2016 16:33:03 +0000 (16:33 +0000)]
tests/fcntl.c: fix fcntl test on mips64

On mips64 the F_GETLK and F_SETLKW64 constants have identical values which
causes the "wrong" constant to be printed by strace.

tests/fcntl.c (test_flock64): Do not test F_SETLKW64 on mips64.

8 years agotests/nsyscalls.test: only trace the "syscall" syscall on mips o32
James Cowgill [Thu, 11 Aug 2016 16:33:02 +0000 (16:33 +0000)]
tests/nsyscalls.test: only trace the "syscall" syscall on mips o32

The "syscall" syscall only exists on o32 and causes strace to error out on
64-bit mips ABIs. Pass MIPS_ABI from the configure script through to
nsyscalls.test so the MIPS ABI can be checked.

* configure.ac (MIPS_ABI): Substitute into output files.
* tests/Makefile.am (MIPS_ABI): Export via AM_TEST_LOG_FLAGS.
* tests/nsyscalls.test: Restrict special mips handling to mips o32.

8 years agotests/xstatx.c: fix stat syscall tests on mips64
James Cowgill [Thu, 11 Aug 2016 16:33:01 +0000 (16:33 +0000)]
tests/xstatx.c: fix stat syscall tests on mips64

For historical reasons the kernel struct stat represents times as unsigned
32-bit integers on mips64. Therefore, while it's possible to give a file a
timestamp before 1970 with futimens, reading the same timestamp through
struct stat will give a positive time (around 2106).
Workaround by using positive timestamps for testing on mips64.

* tests/xstatx.c (create_sample): Use positive timestamps on mips64.

8 years agotests/mlock2.c: fix test failure on mips64
Dmitry V. Levin [Wed, 10 Aug 2016 22:59:28 +0000 (22:59 +0000)]
tests/mlock2.c: fix test failure on mips64

* tests/mlock2.c (main): Pass unsigned long arguments to mlock2 syscall
explicitly, to avoid unwanted sign extension issues.

Based on patch by James Cowgill <james410@cowgill.org.uk>

8 years agoUse <asm/unistd.h> instead of <sys/syscall.h>
Dmitry V. Levin [Tue, 9 Aug 2016 14:38:29 +0000 (14:38 +0000)]
Use <asm/unistd.h> instead of <sys/syscall.h>

There are no users of SYS_* macros provided by <sys/syscall.h>,
and definitions of __NR_* macros could be obtained directly
from <asm/unistd.h>.

* defs.h: Include <asm/unistd.h> instead of <sys/syscall.h>.
* test/seccomp.c: Likewise.
* test/threaded_execve.c: Likewise.
* test/x32_lseek.c: Likewise.
* test/x32_mmap.c: Likewise.
* tests/_newselect.c: Likewise.
* tests/access.c: Likewise.
* tests/acct.c: Likewise.
* tests/aio.c: Likewise.
* tests/alarm.c: Likewise.
* tests/attach-f-p.c: Likewise.
* tests/bpf.c: Likewise.
* tests/brk.c: Likewise.
* tests/chmod.c: Likewise.
* tests/chown.c: Likewise.
* tests/chown32.c: Likewise.
* tests/chroot.c: Likewise.
* tests/clock_adjtime.c: Likewise.
* tests/clock_nanosleep.c: Likewise.
* tests/clock_xettime.c: Likewise.
* tests/copy_file_range.c: Likewise.
* tests/creat.c: Likewise.
* tests/dup2.c: Likewise.
* tests/dup3.c: Likewise.
* tests/epoll_create.c: Likewise.
* tests/epoll_create1.c: Likewise.
* tests/epoll_ctl.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/epoll_wait.c: Likewise.
* tests/eventfd.c: Likewise.
* tests/execveat.c: Likewise.
* tests/faccessat.c: Likewise.
* tests/fchdir.c: Likewise.
* tests/fchmod.c: Likewise.
* tests/fchmodat.c: Likewise.
* tests/fchown.c: Likewise.
* tests/fchown32.c: Likewise.
* tests/fchownat.c: Likewise.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* tests/fdatasync.c: Likewise.
* tests/flock.c: Likewise.
* tests/fstat.c: Likewise.
* tests/fstat64.c: Likewise.
* tests/fstatat64.c: Likewise.
* tests/fstatfs.c: Likewise.
* tests/fstatfs64.c: Likewise.
* tests/fsync.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/ftruncate64.c: Likewise.
* tests/futimesat.c: Likewise.
* tests/get_mempolicy.c: Likewise.
* tests/getcwd.c: Likewise.
* tests/getdents.c: Likewise.
* tests/getdents64.c: Likewise.
* tests/getegid.c: Likewise.
* tests/getegid32.c: Likewise.
* tests/geteuid.c: Likewise.
* tests/geteuid32.c: Likewise.
* tests/getgid.c: Likewise.
* tests/getgid32.c: Likewise.
* tests/getgroups.c: Likewise.
* tests/getgroups32.c: Likewise.
* tests/getpgrp.c: Likewise.
* tests/getrandom.c: Likewise.
* tests/getresgid.c: Likewise.
* tests/getresgid32.c: Likewise.
* tests/getresuid.c: Likewise.
* tests/getresuid32.c: Likewise.
* tests/getrlimit.c: Likewise.
* tests/getrusage.c: Likewise.
* tests/getuid.c: Likewise.
* tests/getuid32.c: Likewise.
* tests/getxxid.c: Likewise.
* tests/ioctl_uffdio.c: Likewise.
* tests/ioperm.c: Likewise.
* tests/iopl.c: Likewise.
* tests/ipc.c: Likewise.
* tests/kill.c: Likewise.
* tests/lchown.c: Likewise.
* tests/lchown32.c: Likewise.
* tests/libmmsg.c: Likewise.
* tests/libsocketcall.c: Likewise.
* tests/link.c: Likewise.
* tests/linkat.c: Likewise.
* tests/llseek.c: Likewise.
* tests/lseek.c: Likewise.
* tests/lstat.c: Likewise.
* tests/lstat64.c: Likewise.
* tests/mbind.c: Likewise.
* tests/membarrier.c: Likewise.
* tests/memfd_create.c: Likewise.
* tests/migrate_pages.c: Likewise.
* tests/mkdir.c: Likewise.
* tests/mkdirat.c: Likewise.
* tests/mknod.c: Likewise.
* tests/mknodat.c: Likewise.
* tests/mlock.c: Likewise.
* tests/mlock2.c: Likewise.
* tests/move_pages.c: Likewise.
* tests/newfstatat.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/old_mmap.c: Likewise.
* tests/oldselect.c: Likewise.
* tests/open.c: Likewise.
* tests/openat.c: Likewise.
* tests/pause.c: Likewise.
* tests/poll.c: Likewise.
* tests/prctl-seccomp-filter-v.c: Likewise.
* tests/prctl-seccomp-strict.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/prlimit64.c: Likewise.
* tests/pselect6.c: Likewise.
* tests/ptrace.c: Likewise.
* tests/readdir.c: Likewise.
* tests/readlink.c: Likewise.
* tests/readlinkat.c: Likewise.
* tests/reboot.c: Likewise.
* tests/remap_file_pages.c: Likewise.
* tests/rename.c: Likewise.
* tests/renameat.c: Likewise.
* tests/renameat2.c: Likewise.
* tests/rmdir.c: Likewise.
* tests/rt_sigpending.c: Likewise.
* tests/rt_sigprocmask.c: Likewise.
* tests/rt_sigsuspend.c: Likewise.
* tests/rt_sigtimedwait.c: Likewise.
* tests/rt_tgsigqueueinfo.c: Likewise.
* tests/sched_get_priority_mxx.c: Likewise.
* tests/sched_rr_get_interval.c: Likewise.
* tests/sched_xetaffinity.c: Likewise.
* tests/sched_xetattr.c: Likewise.
* tests/sched_xetparam.c: Likewise.
* tests/sched_xetscheduler.c: Likewise.
* tests/sched_yield.c: Likewise.
* tests/seccomp-filter-v.c: Likewise.
* tests/seccomp-filter.c: Likewise.
* tests/seccomp-strict.c: Likewise.
* tests/select.c: Likewise.
* tests/sendfile.c: Likewise.
* tests/sendfile64.c: Likewise.
* tests/set_mempolicy.c: Likewise.
* tests/setdomainname.c: Likewise.
* tests/setfsgid.c: Likewise.
* tests/setfsgid32.c: Likewise.
* tests/setfsuid.c: Likewise.
* tests/setfsuid32.c: Likewise.
* tests/setgid.c: Likewise.
* tests/setgid32.c: Likewise.
* tests/setgroups.c: Likewise.
* tests/setgroups32.c: Likewise.
* tests/sethostname.c: Likewise.
* tests/setregid.c: Likewise.
* tests/setregid32.c: Likewise.
* tests/setresgid.c: Likewise.
* tests/setresgid32.c: Likewise.
* tests/setresuid.c: Likewise.
* tests/setresuid32.c: Likewise.
* tests/setreuid.c: Likewise.
* tests/setreuid32.c: Likewise.
* tests/setrlimit.c: Likewise.
* tests/setuid.c: Likewise.
* tests/setuid32.c: Likewise.
* tests/signalfd4.c: Likewise.
* tests/socketcall.c: Likewise.
* tests/splice.c: Likewise.
* tests/stat.c: Likewise.
* tests/stat64.c: Likewise.
* tests/statfs.c: Likewise.
* tests/statfs64.c: Likewise.
* tests/swap.c: Likewise.
* tests/symlink.c: Likewise.
* tests/symlinkat.c: Likewise.
* tests/sync.c: Likewise.
* tests/sync_file_range.c: Likewise.
* tests/sync_file_range2.c: Likewise.
* tests/syslog.c: Likewise.
* tests/tee.c: Likewise.
* tests/time.c: Likewise.
* tests/timer_create.c: Likewise.
* tests/timer_xettime.c: Likewise.
* tests/timerfd_xettime.c: Likewise.
* tests/times-fail.c: Likewise.
* tests/times.c: Likewise.
* tests/truncate.c: Likewise.
* tests/truncate64.c: Likewise.
* tests/ugetrlimit.c: Likewise.
* tests/umount.c: Likewise.
* tests/umount2.c: Likewise.
* tests/uname.c: Likewise.
* tests/unix-pair-send-recv.c: Likewise.
* tests/unlink.c: Likewise.
* tests/unlinkat.c: Likewise.
* tests/userfaultfd.c: Likewise.
* tests/utimes.c: Likewise.
* tests/vhangup.c: Likewise.
* tests/vmsplice.c: Likewise.
* tests/waitid.c: Likewise.
* tests/waitpid.c: Likewise.
* tests/xet_robust_list.c: Likewise.
* tests/xetpgid.c: Likewise.
* tests/xetpriority.c: Likewise.
* tests/xettimeofday.c: Likewise.

8 years agoia64: replace SYS_clone2 with __NR_clone2
Dmitry V. Levin [Tue, 9 Aug 2016 14:35:06 +0000 (14:35 +0000)]
ia64: replace SYS_clone2 with __NR_clone2

Migrate to __NR_* the last user of SYS_* macros provided
by <sys/syscall.h>.

* clone.c [IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Replace
SYS_clone2 with __NR_clone2.

8 years agoMake sure that tcp->s_ent and tcp->s_prev_ent do not point to freed memory
Dmitry V. Levin [Tue, 9 Aug 2016 10:28:22 +0000 (10:28 +0000)]
Make sure that tcp->s_ent and tcp->s_prev_ent do not point to freed memory

This complements commit v4.13-33-g60d7ec8.

* syscall.c (sysent_buf): New structure.
(free_sysent_buf): New function.
(get_scno): Use them.

8 years agofile.c: move definitions of struct stat32 to separate files
Dmitry V. Levin [Tue, 9 Aug 2016 09:50:13 +0000 (09:50 +0000)]
file.c: move definitions of struct stat32 to separate files

* linux/aarch64/stat32.h: New file.
* linux/powerpc64/stat32.h: Likewise.
* linux/sparc64/stat32.h: Likewise.
* linux/tile/stat32.h: Likewise.
* linux/x32/stat32.h: Likewise.
* linux/x86_64/stat32.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* file.c [SUPPORTED_PERSONALITIES > 1]: Remove arch specific definitions
of struct stat32, include "stat32.h" instead.

8 years agosparc, sparc64: remove obsolete code
Dmitry V. Levin [Tue, 9 Aug 2016 09:18:37 +0000 (09:18 +0000)]
sparc, sparc64: remove obsolete code

Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64]: Remove the code related to struct solstat.
(printstat, printoldstat) [SPARC || SPARC64]: Remove.

8 years agosparc64: fix decoding of stat family syscalls
Dmitry V. Levin [Tue, 9 Aug 2016 09:14:11 +0000 (09:14 +0000)]
sparc64: fix decoding of stat family syscalls

This complements commit v4.13-28-gaebfe83.

* file.c [SPARC64]: Change STAT32_PERSONALITY to 1.

8 years agoFix decoding of invalid syscalls mapped to indirect subcalls
Dmitry V. Levin [Tue, 9 Aug 2016 00:07:53 +0000 (00:07 +0000)]
Fix decoding of invalid syscalls mapped to indirect subcalls

When the syscall number returned by arch_get_scno is a mapped indirect
subcall (i.e. mapped subcall of socketcall or ipc syscall), do not
mistakenly treat it as a valid indirect subcall.

* defs.h (SCNO_IS_VALID): Treat scno with TRACE_INDIRECT_SUBCALL flag
as invalid.
* syscall.c (syscall_name): Do no shuffle scno.
(trace_syscall_entering, trace_syscall_exiting): Use
tcp->s_ent->sys_name instead of syscall_name.
(get_scno): In case of invalid syscall, allocate a dynamic struct sysent
containing an appropriate .sys_name.
* tests/nsyscalls.c (main) [SYS_socket_subcall]: Check decoding
of direct syscall number SYS_socket_subcall+1.
(main) [SYS_ipc_subcall]: Check decoding of direct syscall number
SYS_ipc_subcall+1.

8 years agolinux/subcall.h: remove redundant definitions
Dmitry V. Levin [Mon, 8 Aug 2016 23:43:50 +0000 (23:43 +0000)]
linux/subcall.h: remove redundant definitions

* linux/subcall.h: Remove definitions of non-existent socket
and ipc subcalls.

8 years agodefs.h: simplify SUPPORTED_PERSONALITIES definition
Dmitry V. Levin [Mon, 8 Aug 2016 22:00:06 +0000 (22:00 +0000)]
defs.h: simplify SUPPORTED_PERSONALITIES definition

* defs.h: Group definition of SUPPORTED_PERSONALITIES by value.