]> granicus.if.org Git - strace/log
strace
7 years agoFix the length argument passed from print_iovec to decode_netlink
Dmitry V. Levin [Mon, 17 Apr 2017 04:37:11 +0000 (04:37 +0000)]
Fix the length argument passed from print_iovec to decode_netlink

* io.c (print_iovec): Pass the actual length to decode_netlink
instead of the original length.
* NEWS: Mention this fix.

7 years agonuma: fix printing of error values in move_pages status array
Dmitry V. Levin [Mon, 17 Apr 2017 04:36:54 +0000 (04:36 +0000)]
numa: fix printing of error values in move_pages status array

* numa.c (print_status): Do not lose a minus sign when printing
a symbolic error code.
* tests/move_pages.c (print_status_array): Update expected output.

7 years agotests: generate pure_executables part of check_PROGRAMS automatically
Dmitry V. Levin [Mon, 17 Apr 2017 00:53:19 +0000 (00:53 +0000)]
tests: generate pure_executables part of check_PROGRAMS automatically

* tests/gen_pure_executables.sh: New file.
* bootstrap: Invoke it.
* tests/Makefile.am: Include pure_executables.am.
(check_PROGRAMS): Add $(PURE_EXECUTABLES).  Remove everything listed
in pure_executables.list.
(EXTRA_DIST): Add gen_pure_executables.sh.
* tests/.gitignore: Add pure_executables.am.

7 years agotests: make EXTRA_DIST sorted
Dmitry V. Levin [Mon, 17 Apr 2017 00:50:19 +0000 (00:50 +0000)]
tests: make EXTRA_DIST sorted

* tests/Makefile.am (EXTRA_DIST): Sort.

7 years agotests: check decoding of alpha specific osf_utimes syscall
Dmitry V. Levin [Mon, 17 Apr 2017 00:29:58 +0000 (00:29 +0000)]
tests: check decoding of alpha specific osf_utimes syscall

* tests/osf_utimes.c: New file.
* tests/gen_tests.in (osf_utimes): New entry.
* tests/Makefile.am (check_PROGRAMS): Add osf_utimes.
* tests/pure_executables.list: Likewise.
* tests/.gitignore: Likewise.

7 years agotests: parametrize utimes.c
Dmitry V. Levin [Mon, 17 Apr 2017 00:17:00 +0000 (00:17 +0000)]
tests: parametrize utimes.c

* tests/xutimes.c: New file, based on utimes.c.
* tests/utimes.c [__NR_utimes] (TEST_SYSCALL_NR, TEST_SYSCALL_STR,
TEST_STRUCT): New macros.
[__NR_utimes]: Replace all the rest with include "xutimes.c".
* tests/Makefile.am (EXTRA_DIST): Add xutimes.c.

7 years agoalpha: fix tracing flags of osf_select and osf_utimes syscalls
Dmitry V. Levin [Sun, 16 Apr 2017 23:37:13 +0000 (23:37 +0000)]
alpha: fix tracing flags of osf_select and osf_utimes syscalls

* linux/alpha/syscallent.h (osf_select): Add TD flag.
(osf_utimes): Add TF flag.
* NEWS: Mention alpha specific fixes.

7 years agoalpha: rename print_timeval32_pair to print_timeval32_utimes
Dmitry V. Levin [Sun, 16 Apr 2017 23:27:08 +0000 (23:27 +0000)]
alpha: rename print_timeval32_pair to print_timeval32_utimes

This follows the rename of print_timeval_item to print_timeval_utimes.

* defs.h [ALPHA] (print_timeval32_pair): Rename
to print_timeval32_utimes.
* print_timeval.c [ALPHA] (print_timeval32_pair): Likewise.
* utimes.c [ALPHA] (SYS_FUNC(osf_utimes)): Replace print_timeval32_pair
with print_timeval32_utimes.

7 years agotests: do more rigorous testing of utimes syscall parser
Dmitry V. Levin [Sun, 16 Apr 2017 18:47:29 +0000 (18:47 +0000)]
tests: do more rigorous testing of utimes syscall parser

* tests/utimes.c (errstr): New variable.
(print_ts, k_utimes): New functions.
(main): Use them to do more rigorous testing of utimes syscall parser.
* tests/gen_tests.in (utimes): Update -a option.

7 years agotests: do more rigorous testing of futimesat syscall parser
Dmitry V. Levin [Sun, 16 Apr 2017 18:47:29 +0000 (18:47 +0000)]
tests: do more rigorous testing of futimesat syscall parser

* tests/futimesat.c (errstr): New variable.
(print_ts, k_futimesat): New functions.
(main): Use them to do more rigorous testing of futimesat syscall parser.

7 years agoFix printing of inaccessible times argument of utimes and futimesat syscalls
Dmitry V. Levin [Sun, 16 Apr 2017 18:13:27 +0000 (18:13 +0000)]
Fix printing of inaccessible times argument of utimes and futimesat syscalls

When the whole pair of struct timeval structures cannot be fetched from
tracee's memory, print the address.  This behavior follows the kernel's
that uses copy_from_user for the whole pair, too.

* print_timeval.c (print_timeval_item): Remove.
(print_timeval_pair): Rename to print_timeval_utimes, all callers
updated.  Fetch the whole timeval_t array with a single
umove_or_printaddr call.
* tests/futimesat.c (main): Update expected output.
* tests/utimes.c (main): Likewise.

7 years agotests: rewrite utimensat.test without relying on libc utimensat wrapper
Dmitry V. Levin [Sun, 16 Apr 2017 17:28:00 +0000 (17:28 +0000)]
tests: rewrite utimensat.test without relying on libc utimensat wrapper

The new test also does more rigorous testing.

* tests/utimensat.c: Stop including <assert.h> and <errno.h>, include
<unistd.h> and <asm/unistd.h>, check __NR_utimensat instead
of HAVE_UTIMENSAT.
(errstr): New variable.
(k_utimensat): New function, a thin wrapper around
syscall(__NR_utimensat).
(main): Use them instead of utimensat.
* tests/gen_tests.in (utimensat): New entry.
* tests/utimensat.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove it.

7 years agotests: use fixed timestamps in utime related tests
Dmitry V. Levin [Sun, 16 Apr 2017 17:28:00 +0000 (17:28 +0000)]
tests: use fixed timestamps in utime related tests

* tests/clock.test: Remove futimesat, utime, utimensat, and utimes tests
from the list of exceptions.
* tests/utime.c (main): Do not use time(), use fixed timestamp instead.
* tests/futimesat.c (main): Do not use gettimeofday(), use fixed
timestamps instead.
* tests/utimensat.c (main): Likewise.
* tests/utimes.c (main): Likewise.

7 years agoxtensa: wire up new syscalls
Dmitry V. Levin [Sat, 15 Apr 2017 13:28:23 +0000 (13:28 +0000)]
xtensa: wire up new syscalls

* linux/xtensa/syscallent.h [348..350]: New pkey_* entries.

Reported-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>
7 years agoUpdate statx parser and syscall entries lists to the upstream
Victor Krapivensky [Sat, 15 Apr 2017 08:43:12 +0000 (11:43 +0300)]
Update statx parser and syscall entries lists to the upstream

* linux/32/syscallent.h [291]: Add statx entry.
* linux/64/syscallent.h [291]: Likewise.
* linux/arm/syscallent.h [397]: Likewise.
* linux/m68k/syscallent.h [379]: Likewise.
* linux/mips/syscallent-n32.h [6330]: Likewise.
* linux/mips/syscallent-n64.h [5326]: Likewise.
* linux/mips/syscallent-o32.h [4366]: Likewise.
* linux/powerpc/syscallent.h [383]: Likewise.
* linux/s390/syscallent.h [379]: Likewise.
* linux/s390x/syscallent.h [379]: Likewise.
* linux/xtensa/syscallent.h [351]: Likewise.
* statx.h (struct_statx): Update.
* statx.c (SYS_FUNC(statx)): Print struct_statx.stx_attributes_mask.
* tests/xstatx.c (print_stat, main): Update to test decoding
of struct_statx.stx_attributes_mask.

7 years agotests: add more regex match checks
Dmitry V. Levin [Fri, 14 Apr 2017 17:47:21 +0000 (17:47 +0000)]
tests: add more regex match checks

* tests/qual_syscall.test: Add regex match checks.

7 years agotests: make mq_sendrecv* test executables reenterable
Dmitry V. Levin [Fri, 14 Apr 2017 16:43:18 +0000 (16:43 +0000)]
tests: make mq_sendrecv* test executables reenterable

* tests/mq_sendrecv.c (MQ_NAME): Remove.
(mq_name): New static variable.
(cleanup): Use it instead of MQ_NAME.
(main): Initialize it dynamically using the pid of process.  Use it
instead of MQ_NAME.

7 years agotests: make mq test executable reenterable
Dmitry V. Levin [Fri, 14 Apr 2017 16:25:05 +0000 (16:25 +0000)]
tests: make mq test executable reenterable

* tests/mq.c (NAME): Remove.
(main): Replace the fixed message queue name with a dynamically
made name containing the pid of process.
* tests/gen_tests.in (mq): Update -a option.

7 years agotests: make net-yy-netlink test executable reenterable
Dmitry V. Levin [Fri, 14 Apr 2017 15:55:21 +0000 (15:55 +0000)]
tests: make net-yy-netlink test executable reenterable

* tests/net-yy-netlink.c (main): Use getpid() instead of a fixed
magic number.

7 years agotests: tabulate shmxt.test
Dmitry V. Levin [Fri, 14 Apr 2017 15:35:21 +0000 (15:35 +0000)]
tests: tabulate shmxt.test

* tests/gen_tests.in (shmxt): New entry.
* tests/shmxt.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove shmxt.test.

7 years agoRevert "Implement -e trace=%sched option"
Dmitry V. Levin [Fri, 14 Apr 2017 15:06:42 +0000 (15:06 +0000)]
Revert "Implement -e trace=%sched option"

-e trace=%sched became redundant as -e trace=/sched does the same.

This reverts commit 811638e9c1805438a63c14f9704b8b00ac922623.

* syscall.c (TSC): Remove.
* sysent.h (TRACE_SCHED): Remove.
* qualify.c (lookup_class): Remove %sched.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TSC flag from sched* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/sched.test: Replace trace=%sched with trace=/sched.
* tests/ksysent.c (TSC): Remove.
* tests/nsyscalls.c: Likewise.

7 years agoRevert "Implement -e trace=%clock option"
Dmitry V. Levin [Fri, 14 Apr 2017 15:06:42 +0000 (15:06 +0000)]
Revert "Implement -e trace=%clock option"

-e trace=%clock became redundant as -e trace=/clock does the same.

This reverts commit 0a13d2391c413e3847b71ec0c1d38f56e353b1b5.

* syscall.c (TCL): Remove.
* sysent.h (TRACE_CLOCK): Remove.
* qualify.c (lookup_class): Remove %clock.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TCL flag from clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: Replace trace=%clock with trace=/clock.
* tests/ksysent.c (TCL): Remove.
* tests/nsyscalls.c: Likewise.

7 years agotests: robustify regex.test
Dmitry V. Levin [Fri, 14 Apr 2017 14:53:35 +0000 (14:53 +0000)]
tests: robustify regex.test

* tests/regex.test: Use trace_statfs.test as a template instead
of clock.test and sched.test, not because of more interesting
regular expressions but to fix build on platforms where
clock.test and sched.test are not reenterable.

7 years agoImplement -e trace=/regex option
JingPiao Chen [Fri, 14 Apr 2017 04:27:08 +0000 (12:27 +0800)]
Implement -e trace=/regex option

* qualify.c: Include <regex.h>.
(qualify_syscall_regex): New function.
(qualify_syscall): Use it.
* strace.1: Document -e trace=/regex option.
* NEWS: Mention -e trace=/regex option.
* tests/regex.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/options-syntax.test: Add checks for invaild regexp
and for regexp that doesn't match a syscall.

7 years agotests: fix ioctl_nsfs.test on hppa
Dmitry V. Levin [Fri, 14 Apr 2017 01:21:19 +0000 (01:21 +0000)]
tests: fix ioctl_nsfs.test on hppa

* tests/ioctl_nsfs.c (test_user_namespace): Specify an address
in the middle of a mapped page as child_stack address argument
of the clone call.
[IA64] (clone): Update.

7 years agotests: fix ioctl_nsfs.test on ia64
Dmitry V. Levin [Fri, 14 Apr 2017 00:52:37 +0000 (00:52 +0000)]
tests: fix ioctl_nsfs.test on ia64

glibc on ia64 provides no clone() function, but there is a __clone2
function instead.  It is documented but no prototype is provided by
glibc.

* tests/ioctl_nsfs.c [IA64] (__clone2): New prototype.
[IA64] (clone): New macro wrapper around __clone2.

7 years agotests: check decoding of the remaining V4L2_BUF_TYPE_* types
Edgar Kaziahmedov [Thu, 13 Apr 2017 23:39:04 +0000 (02:39 +0300)]
tests: check decoding of the remaining V4L2_BUF_TYPE_* types

* tests/ioctl_v4l2.c (init_v4l2_format, print_ioctl_v4l2): New functions
to avoid code duplication in VIDIOC_S_FMT and VIDIOC_TRY_FMT tests.
(main) <VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT>: Use them.  Add
checks for remaining V4L2_BUF_TYPE_* types.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
7 years agov4l2: Implement decoding of the remaining V4L2_BUF_TYPE_* types
Edgar Kaziahmedov [Thu, 13 Apr 2017 23:39:03 +0000 (02:39 +0300)]
v4l2: Implement decoding of the remaining V4L2_BUF_TYPE_* types

* v4l2.c: Include "xlat/v4l2_vbi_flags.h" and "xlat/v4l2_sliced_flags.h".
(struct_v4l2_clip): New typedef.  Mpersify it.
(print_v4l2_clip): New function.
(print_v4l2_format_fmt): Use it.  Add struct tcb argument.  Implement
decoding of the remaining V4L2_BUF_TYPE_* types.
* xlat/v4l2_vbi_flags.in: Add V4L2_VBI_UNSYNC and V4L2_VBI_INTERLACED
introduced by linux kernel commit v2.5.46~39^2~23^2~4.
Add V4L2_VBI_ITU_525_F1_START, V4L2_VBI_ITU_525_F2_START,
V4L2_VBI_ITU_625_F1_START, and V4L2_VBI_ITU_625_F2_START introduced by
linux kernel commit v3.17-rc1~112^2~217.
* xlat/v4l2_sliced_flags.in: Add V4L2_SLICED_TELETEXT_B, V4L2_SLICED_VPS,
V4L2_SLICED_CAPTION_525, V4L2_SLICED_WSS_625, V4L2_SLICED_VBI_525, and
V4L2_SLICED_VBI_625 introduced by linux kernel commit v2.6.14-rc2~64.
* configure.ac (AC_CHECK_DECLS): Add V4L2_BUF_TYPE_SDR_CAPTURE and
V4L2_BUF_TYPE_SDR_OUTPUT.
(AC_CHECK_MEMBERS): Add struct v4l2_window.global_alpha and
struct v4l2_sdr_format.buffersize.
* NEWS: Mention this change.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
7 years agotravis: use mainline kernel uapi headers for coverage
Dmitry V. Levin [Thu, 13 Apr 2017 18:24:09 +0000 (18:24 +0000)]
travis: use mainline kernel uapi headers for coverage

* .travis.yml (matrix) <CHECK=coverage>: Add KHEADERS=torvalds/linux.
* travis-build.sh: Handle $KHEADERS.
* travis-install.sh: Likewise.

7 years agotravis: switch from clang-3.6 to clang-3.8
Dmitry V. Levin [Thu, 13 Apr 2017 18:24:09 +0000 (18:24 +0000)]
travis: switch from clang-3.6 to clang-3.8

* .travis.yml (matrix): Change clang-3.6 to clang-3.8.

7 years agoImplement decoding of NS_* ioctl commands
Nikolay Marchuk [Thu, 13 Apr 2017 15:10:11 +0000 (22:10 +0700)]
Implement decoding of NS_* ioctl commands

* configure.ac (AC_CHECK_HEADERS): Add linux/nsfs.h.
* defs.h (DECL_IOCTL(nsfs)): New prototype.
(setns_types): Make global.
* ioctl.c (ioctl_decode): Call nsfs_ioctl for 0xb7 code.
* nsfs.c: New file.
* nsfs.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/ioctl_nsfs.c: New file.
* tests/ioctl_nsfs.test: Likewise.
* tests/.gitignore: Add ioctl_nsfs.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_nsfs.test.
* NEWS: Mention this change.

7 years agotravis: copy coverage test suite log to the travis log
Dmitry V. Levin [Thu, 13 Apr 2017 04:43:46 +0000 (04:43 +0000)]
travis: copy coverage test suite log to the travis log

* travis-build.sh (coverage): Print tests*/test-suite.log
and tests*/ksysent.log.

7 years agotravis: add gcc-6
Dmitry V. Levin [Wed, 12 Apr 2017 03:06:32 +0000 (03:06 +0000)]
travis: add gcc-6

* .travis.yml (matrix): Add gcc-6 entries.
* travis-build.sh: Handle gcc*.
* travis-install.sh: Handle gcc-*.

7 years agotests: robustify gen_tests.sh against in-tree builds
Dmitry V. Levin [Tue, 11 Apr 2017 06:55:51 +0000 (06:55 +0000)]
tests: robustify gen_tests.sh against in-tree builds

* tests/gen_tests.sh: Use abs_srcdir instead of srcdir to construct
a path to gen_tests.sh in implicit make rules.

7 years agotrace_syscall_exiting: do not call get_regs for filtered syscalls
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
trace_syscall_exiting: do not call get_regs for filtered syscalls

This saves up to 25% of ptrace syscalls in case of trace filtering.

* syscall.c (trace_syscall_exiting): Do not call gettimeofday
and get_regs for filtered syscalls.
* NEWS: Mention this change.
* tests/get_regs.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.

7 years agoDelay get_regs invocation
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
Delay get_regs invocation

strace used to call get_regs on every stop of a tracee, including cases
when the result is going to be discarded.  Prepare to change this lavish
practice by delaying get_regs invocation until its result is actually
needed.

* defs.h (get_regs): Remove.
* strace.c (trace): Do not call get_regs.
* syscall.c (get_regs): Add static qualifier.
(trace_syscall_exiting, print_pc, get_scno): Call get_regs.

7 years agostartup_tcb: move get_scno invocation to a more convenient place
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
startup_tcb: move get_scno invocation to a more convenient place

* strace.c (trace): Move get_scno invocation ...
(startup_tcb): ... here.  This is a no-op change that slightly improves
readability.

7 years agoget_regs: guard against subsequent invocations
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
get_regs: guard against subsequent invocations

At this moment there is only one call to get_regs,
but there is going to be more of them, so a guard is needed.

This change also adds a clear_regs call before get_regs,
which essentially reverts commit v4.9-288-ge9bfff6.

* strace.c (trace): Call clear_regs before get_regs.
* syscall.c (get_regs): Skip if get_regs_error != -1.

7 years agosyscall: move definitions of automatic variables closer to their use
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
syscall: move definitions of automatic variables closer to their use

* syscall.c (trace_syscall_entering, trace_syscall_exiting): Move
definitions of automatic variables closer to their first use.  This
change slightly improves readability.

7 years agotests: check decoding of gettid syscall
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
tests: check decoding of gettid syscall

* tests/gettid.c: New file.
* tests/.gitignore: Add gettid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (gettid): New entry.

7 years agotests: fix build on alpha
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
tests: fix build on alpha

* tests/getpid.c: Skip if __NR_getpid is not defined.
* tests/getppid.c: Skip if __NR_getppid is not defined.

Fixes: fd1041f6 ("tests: add tests for getpid and getppid syscalls")
7 years agoFix build with old linux/netlink.h
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
Fix build with old linux/netlink.h

* socketutils.c: Provide a fallback definition of NETLINK_SOCK_DIAG.

Fixes: 5c256356 ("Do not include xlat/netlink_protocols.h twice")
7 years agoDo not include xlat/netlink_protocols.h twice
Dmitry V. Levin [Mon, 10 Apr 2017 00:20:34 +0000 (00:20 +0000)]
Do not include xlat/netlink_protocols.h twice

Make netlink_protocols a global xlat array defined in net.c file.

* defs.h (netlink_protocols): New prototype.
* socketutils.c: Stop including "xlat/netlink_protocols.h".

7 years agoDo not include xlat/clocknames.h twice
Dmitry V. Levin [Mon, 10 Apr 2017 00:20:34 +0000 (00:20 +0000)]
Do not include xlat/clocknames.h twice

Make clocknames a global xlat array defined in time.c file.

* defs.h (clocknames): New prototype.
* perf.c: Stop including "xlat/clocknames.h".

7 years agoRemove unused xlat/openmodessol.in
Dmitry V. Levin [Sun, 9 Apr 2017 23:18:20 +0000 (23:18 +0000)]
Remove unused xlat/openmodessol.in

* xlat/openmodessol.in: Remove file unused since commit
v4.10-45-gdf4dd8b.

7 years agoRemove unused xlat/aclipc.in
Dmitry V. Levin [Sat, 8 Apr 2017 00:16:52 +0000 (00:16 +0000)]
Remove unused xlat/aclipc.in

* xlat/aclipc.in: Remove file unused since commit v4.9-46-g681452b.

7 years agotests: remove statfs.expected
Dmitry V. Levin [Fri, 7 Apr 2017 00:03:31 +0000 (00:03 +0000)]
tests: remove statfs.expected

statfs.expected is unused since commit v4.11-515-g67c2f67.

* tests/statfs.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.

7 years agotests: add tests for getpid and getppid syscalls
Sandhya Bankar [Sun, 2 Apr 2017 21:22:35 +0000 (02:52 +0530)]
tests: add tests for getpid and getppid syscalls

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
[ldv: rewritten everything]

* tests/getpid.c: New file.
* tests/getppid.c: Likewise.
* tests/.gitignore: Add getpid and getppid.
* tests/pure_executables.list: Likewise.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (getpid, getppid): New entries.

7 years agoUpdate V4L2_* constants
Edgar Kaziahmedov [Thu, 6 Apr 2017 01:35:00 +0000 (04:35 +0300)]
Update V4L2_* constants

* xlat/v4l2_buf_flags.in: Add V4L2_BUF_FLAG_PREPARED,
V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, and V4L2_BUF_FLAG_NO_CACHE_CLEAN
introduced by linux kernel commit v3.2-rc1~63^2~55.
Add V4L2_BUF_FLAG_TIMESTAMP_MASK, V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,
and V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC introduced by linux kernel commit
v3.9-rc1~93^2~536.
Add V4L2_BUF_FLAG_TIMESTAMP_COPY introduced by linux kernel commit
v3.10-rc1~136^2~560.
Add V4L2_BUF_FLAG_TSTAMP_SRC_MASK, V4L2_BUF_FLAG_TSTAMP_SRC_EOF,
and V4L2_BUF_FLAG_TSTAMP_SRC_SOE introduced by linux kernel commit
v3.15-rc1~85^2~186.
Add V4L2_BUF_FLAG_LAST introduced by linux kernel commit
v4.2-rc1~107^2~389.
* xlat/v4l2_buf_types.in: Add V4L2_BUF_TYPE_SDR_CAPTURE
and V4L2_BUF_TYPE_SDR_OUTPUT introduced by linux kernel commits
v3.15-rc1~85^2~213 and v4.4-rc1~118^2~14, respectively.
* xlat/xlat/v4l2_colorspaces.in: Add V4L2_COLORSPACE_ADOBERGB
and V4L2_COLORSPACE_BT2020 introduced by linux kernel commit
v3.19-rc1~29^2~72.
Add V4L2_COLORSPACE_RAW and V4L2_COLORSPACE_DCI_P3 introduced by linux
kernel commits v4.2-rc1~107^2~182 and v4.4-rc1~118^2~120, respectively.
* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_SDR_CAPTURE,
V4L2_CAP_EXT_PIX_FORMAT, and V4L2_CAP_SDR_OUTPUT introduced by linux
kernel commits v3.15-rc1~85^2~210, v3.17-rc1~112^2~327,
and v4.4-rc1~118^2~14, respectively.
* xlat/v4l2_memories.in: Add V4L2_MEMORY_OVERLAY introduced
in linux 2.5.46.  Add V4L2_MEMORY_DMABUF introduced by linux kernel
commit v3.8-rc1~115^2^2~52.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
7 years agoImplement -e trace=%statfs option
Abhishek Tiwari [Wed, 29 Mar 2017 09:03:34 +0000 (14:33 +0530)]
Implement -e trace=%statfs option

linux/*/syscallent*.h part is modified automatically by:

sed -i 's/TF\(,[[:space:]]*SEN.*[_"]statv\?fs\)/TF|TSF\1/' \
linux/*/syscallent*.h

[ldv: rewritten trace_statfs.test using sched.test as a template]

* sysent.h (TRACE_STATFS): New macro.
* syscall.c: Alias TSF to TRACE_STATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS for "%statfs".
* strace.1 (.SS Filtering): Add information about %statfs syscall class.
* NEWS: Mention this change.
* linux/64/syscallent.h (statfs): Add TSF flag.
* linux/aarch64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/32/syscallent.h (statfs64): Likewise.
* linux/arm/syscallent.h (statfs, statfs64): Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/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.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs): Likewise.
* tests/trace_statfs.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoImplement -e trace=%clock option
Rishi Bhatt [Mon, 27 Mar 2017 22:01:24 +0000 (03:31 +0530)]
Implement -e trace=%clock option

linux/*/syscallent.h part is modified automatically by
sed -i 's/0\(,[[:space:]]*SEN(clock_\)/TCL\1/' linux/*/syscallent*.h

[ldv: rewritten clock.test using sched.test as a template]

* sysent.h (TRACE_CLOCK): New macro.
* syscall.c: Alias TCL to TRACE_CLOCK around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_CLOCK for "%clock".
* strace.1 (.SS Filtering): Add information about %clock syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h: Add TCL flag for clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TCL): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agotests: tabulate xattr.test
Dmitry V. Levin [Thu, 6 Apr 2017 22:22:50 +0000 (22:22 +0000)]
tests: tabulate xattr.test

* tests/gen_tests.in (xattr): New entry.
* tests/xattr.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove xattr.test.

7 years agotests: generalize scripts that check non-abbreviated decoding of ioctls
Dmitry V. Levin [Wed, 5 Apr 2017 00:44:30 +0000 (00:44 +0000)]
tests: generalize scripts that check non-abbreviated decoding of ioctls

* tests/ioctl-v.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
(DECODER_TESTS): Remove ioctl_evdev-v.test, ioctl_loop-v.test,
and ioctl_rtc-v.test.
* tests/gen_tests.in (ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v):
New entries.
* tests/ioctl_evdev-v.test: Remove.
* tests/ioctl_loop-v.test: Ditto.
* tests/ioctl_rtc-v.test: Ditto.

7 years agotests: tabulate stereotypical test scripts
Dmitry V. Levin [Wed, 5 Apr 2017 00:37:54 +0000 (00:37 +0000)]
tests: tabulate stereotypical test scripts

Convert test scripts that follow simple testing patterns to a table.
Generate all these scripts from gen_tests.in file using gen_tests.sh
script at bootstrap time.

The largest set of test scripts has been converted using
the following command:

grep -l ^run_strace_match_diff *.test |while read f; do
n="${f%.test}"
grep '^[^#]' "$f" |
grep -Evq '^(\. "\${srcdir=\.}/init\.sh"|run_strace_match_diff)' ||
sed -n 's/^run_strace_match_diff\(.*\)/'$n'\1/p' "$f"
done

The second largest set of test scripts has been converted using
the following command:

grep -l srcdir= *.test |while read f; do
n="${f%.test}"
grep '^[^#]' "$f" |
grep -Fvq srcdir= ||
sed -n 's/^. "\${srcdir=.}\/\([^"]\+\)".*/'$n'\t+\1/p' "$f"
done

* tests/gen_tests.in: New file.
* tests/gen_tests.sh: New file.
* bootstrap: Invoke it.
* tests/.gitignore: Add *.gen.test and gen_tests.am.
* tests/_newselect.test: Remove.
* tests/accept.test: Ditto.
* tests/accept4.test: Ditto.
* tests/access.test: Ditto.
* tests/acct.test: Ditto.
* tests/add_key.test: Ditto.
* tests/adjtimex.test: Ditto.
* tests/aio.test: Ditto.
* tests/alarm.test: Ditto.
* tests/bpf.test: Ditto.
* tests/btrfs.test: Ditto.
* tests/chmod.test: Ditto.
* tests/chown.test: Ditto.
* tests/chown32.test: Ditto.
* tests/chroot.test: Ditto.
* tests/clock_adjtime.test: Ditto.
* tests/clock_nanosleep.test: Ditto.
* tests/clock_xettime.test: Ditto.
* tests/copy_file_range.test: Ditto.
* tests/creat.test: Ditto.
* tests/delete_module.test: Ditto.
* tests/dup.test: Ditto.
* tests/dup2.test: Ditto.
* tests/dup3.test: Ditto.
* tests/epoll_create.test: Ditto.
* tests/epoll_create1.test: Ditto.
* tests/epoll_ctl.test: Ditto.
* tests/epoll_pwait.test: Ditto.
* tests/epoll_wait.test: Ditto.
* tests/erestartsys.test: Ditto.
* tests/execveat-v.test: Ditto.
* tests/execveat.test: Ditto.
* tests/faccessat.test: Ditto.
* tests/fadvise64_64.test: Ditto.
* tests/fallocate.test: Ditto.
* tests/fanotify_init.test: Ditto.
* tests/fanotify_mark.test: Ditto.
* tests/fchdir.test: Ditto.
* tests/fchmod.test: Ditto.
* tests/fchmodat.test: Ditto.
* tests/fchown.test: Ditto.
* tests/fchown32.test: Ditto.
* tests/fchownat.test: Ditto.
* tests/fcntl.test: Ditto.
* tests/fcntl64.test: Ditto.
* tests/fdatasync.test: Ditto.
* tests/file_handle.test: Ditto.
* tests/file_ioctl.test: Ditto.
* tests/finit_module.test: Ditto.
* tests/flock.test: Ditto.
* tests/fork-f.test: Ditto.
* tests/fstat64.test: Ditto.
* tests/fstatat64.test: Ditto.
* tests/fstatfs.test: Ditto.
* tests/fstatfs64.test: Ditto.
* tests/fsync.test: Ditto.
* tests/ftruncate.test: Ditto.
* tests/ftruncate64.test: Ditto.
* tests/futimesat.test: Ditto.
* tests/get_mempolicy.test: Ditto.
* tests/getcpu.test: Ditto.
* tests/getcwd.test: Ditto.
* tests/getdents.test: Ditto.
* tests/getdents64.test: Ditto.
* tests/getegid.test: Ditto.
* tests/getegid32.test: Ditto.
* tests/geteuid.test: Ditto.
* tests/geteuid32.test: Ditto.
* tests/getgid.test: Ditto.
* tests/getgid32.test: Ditto.
* tests/getgroups.test: Ditto.
* tests/getgroups32.test: Ditto.
* tests/getpeername.test: Ditto.
* tests/getpgrp.test: Ditto.
* tests/getrandom.test: Ditto.
* tests/getresgid.test: Ditto.
* tests/getresgid32.test: Ditto.
* tests/getresuid.test: Ditto.
* tests/getresuid32.test: Ditto.
* tests/getrlimit.test: Ditto.
* tests/getrusage.test: Ditto.
* tests/getsid.test: Ditto.
* tests/getsockname.test: Ditto.
* tests/getuid32.test: Ditto.
* tests/getxxid.test: Ditto.
* tests/inet-cmsg.test: Ditto.
* tests/init_module.test: Ditto.
* tests/inotify.test: Ditto.
* tests/inotify_init1.test: Ditto.
* tests/int_0x80.test: Ditto.
* tests/ioctl_block.test: Ditto.
* tests/ioctl_evdev.test: Ditto.
* tests/ioctl_loop.test: Ditto.
* tests/ioctl_mtd.test: Ditto.
* tests/ioctl_rtc.test: Ditto.
* tests/ioctl_scsi.test: Ditto.
* tests/ioctl_sg_io_v3.test: Ditto.
* tests/ioctl_sg_io_v4.test: Ditto.
* tests/ioctl_uffdio.test: Ditto.
* tests/ioctl_v4l2.test: Ditto.
* tests/ioperm.test: Ditto.
* tests/iopl.test: Ditto.
* tests/ioprio.test: Ditto.
* tests/ip_mreq.test: Ditto.
* tests/ipc.test: Ditto.
* tests/ipc_msg.test: Ditto.
* tests/ipc_sem.test: Ditto.
* tests/ipc_shm.test: Ditto.
* tests/kcmp.test: Ditto.
* tests/kexec_file_load.test: Ditto.
* tests/kexec_load.test: Ditto.
* tests/keyctl.test: Ditto.
* tests/kill.test: Ditto.
* tests/lchown.test: Ditto.
* tests/lchown32.test: Ditto.
* tests/link.test: Ditto.
* tests/linkat.test: Ditto.
* tests/lookup_dcookie.test: Ditto.
* tests/lstat.test: Ditto.
* tests/lstat64.test: Ditto.
* tests/mbind.test: Ditto.
* tests/membarrier.test: Ditto.
* tests/memfd_create.test: Ditto.
* tests/migrate_pages.test: Ditto.
* tests/mincore.test: Ditto.
* tests/mkdir.test: Ditto.
* tests/mkdirat.test: Ditto.
* tests/mknod.test: Ditto.
* tests/mknodat.test: Ditto.
* tests/mlock.test: Ditto.
* tests/mlock2.test: Ditto.
* tests/mlockall.test: Ditto.
* tests/mmap64.test: Ditto.
* tests/mmsg-silent.test: Ditto.
* tests/mmsg.test: Ditto.
* tests/mmsg_name-v.test: Ditto.
* tests/mmsg_name.test: Ditto.
* tests/mount.test: Ditto.
* tests/move_pages.test: Ditto.
* tests/mq.test: Ditto.
* tests/mq_sendrecv-read.test: Ditto.
* tests/mq_sendrecv-write.test: Ditto.
* tests/mq_sendrecv.test: Ditto.
* tests/msg_control-v.test: Ditto.
* tests/msg_control.test: Ditto.
* tests/msg_name.test: Ditto.
* tests/munlockall.test: Ditto.
* tests/nanosleep.test: Ditto.
* tests/net-icmp_filter.test: Ditto.
* tests/net-sockaddr.test: Ditto.
* tests/newfstatat.test: Ditto.
* tests/old_mmap.test: Ditto.
* tests/oldfstat.test: Ditto.
* tests/oldlstat.test: Ditto.
* tests/oldstat.test: Ditto.
* tests/open.test: Ditto.
* tests/openat.test: Ditto.
* tests/pause.test: Ditto.
* tests/perf_event_open.test: Ditto.
* tests/perf_event_open_nonverbose.test: Ditto.
* tests/perf_event_open_unabbrev.test: Ditto.
* tests/pipe2.test: Ditto.
* tests/pkey_alloc.test: Ditto.
* tests/pkey_free.test: Ditto.
* tests/pkey_mprotect.test: Ditto.
* tests/ppoll-v.test: Ditto.
* tests/ppoll.test: Ditto.
* tests/preadv-pwritev.test: Ditto.
* tests/preadv.test: Ditto.
* tests/preadv2-pwritev2.test: Ditto.
* tests/printstr.test: Ditto.
* tests/prlimit64.test: Ditto.
* tests/process_vm_readv.test: Ditto.
* tests/process_vm_writev.test: Ditto.
* tests/pselect6.test: Ditto.
* tests/ptrace.test: Ditto.
* tests/pwritev.test: Ditto.
* tests/quotactl-v.test: Ditto.
* tests/quotactl-xfs-v.test: Ditto.
* tests/quotactl-xfs.test: Ditto.
* tests/quotactl.test: Ditto.
* tests/readahead.test: Ditto.
* tests/readdir.test: Ditto.
* tests/readlink.test: Ditto.
* tests/readlinkat.test: Ditto.
* tests/reboot.test: Ditto.
* tests/recvfrom.test: Ditto.
* tests/recvmmsg-timeout.test: Ditto.
* tests/recvmsg.test: Ditto.
* tests/remap_file_pages.test: Ditto.
* tests/rename.test: Ditto.
* tests/renameat.test: Ditto.
* tests/renameat2.test: Ditto.
* tests/request_key.test: Ditto.
* tests/rmdir.test: Ditto.
* tests/rt_sigpending.test: Ditto.
* tests/rt_sigprocmask.test: Ditto.
* tests/rt_sigqueueinfo.test: Ditto.
* tests/rt_sigreturn.test: Ditto.
* tests/rt_sigsuspend.test: Ditto.
* tests/rt_sigtimedwait.test: Ditto.
* tests/rt_tgsigqueueinfo.test: Ditto.
* tests/sched_get_priority_mxx.test: Ditto.
* tests/sched_rr_get_interval.test: Ditto.
* tests/sched_xetaffinity.test: Ditto.
* tests/sched_xetattr.test: Ditto.
* tests/sched_xetparam.test: Ditto.
* tests/sched_xetscheduler.test: Ditto.
* tests/sched_yield.test: Ditto.
* tests/seccomp-filter-v.test: Ditto.
* tests/seccomp-filter.test: Ditto.
* tests/select.test: Ditto.
* tests/semop.test: Ditto.
* tests/sendfile.test: Ditto.
* tests/sendfile64.test: Ditto.
* tests/set_mempolicy.test: Ditto.
* tests/setdomainname.test: Ditto.
* tests/setfsgid.test: Ditto.
* tests/setfsgid32.test: Ditto.
* tests/setfsuid.test: Ditto.
* tests/setfsuid32.test: Ditto.
* tests/setgid.test: Ditto.
* tests/setgid32.test: Ditto.
* tests/setgroups.test: Ditto.
* tests/setgroups32.test: Ditto.
* tests/sethostname.test: Ditto.
* tests/setns.test: Ditto.
* tests/setregid.test: Ditto.
* tests/setregid32.test: Ditto.
* tests/setresgid.test: Ditto.
* tests/setresgid32.test: Ditto.
* tests/setresuid.test: Ditto.
* tests/setresuid32.test: Ditto.
* tests/setreuid.test: Ditto.
* tests/setreuid32.test: Ditto.
* tests/setrlimit.test: Ditto.
* tests/setuid.test: Ditto.
* tests/setuid32.test: Ditto.
* tests/shutdown.test: Ditto.
* tests/siginfo.test: Ditto.
* tests/signal_receive.test: Ditto.
* tests/signalfd4.test: Ditto.
* tests/sigreturn.test: Ditto.
* tests/socketcall.test: Ditto.
* tests/splice.test: Ditto.
* tests/stat.test: Ditto.
* tests/stat64.test: Ditto.
* tests/statfs64.test: Ditto.
* tests/statx.sh: Ditto.
* tests/statx.test: Ditto.
* tests/swap.test: Ditto.
* tests/symlink.test: Ditto.
* tests/symlinkat.test: Ditto.
* tests/sync.test: Ditto.
* tests/sync_file_range.test: Ditto.
* tests/sync_file_range2.test: Ditto.
* tests/sysinfo.test: Ditto.
* tests/syslog.test: Ditto.
* tests/tee.test: Ditto.
* tests/time.test: Ditto.
* tests/timer_create.test: Ditto.
* tests/timer_xettime.test: Ditto.
* tests/timerfd_xettime.test: Ditto.
* tests/times-fail.test: Ditto.
* tests/times.test: Ditto.
* tests/truncate.test: Ditto.
* tests/truncate64.test: Ditto.
* tests/ugetrlimit.test: Ditto.
* tests/umask.test: Ditto.
* tests/umoven-illptr.test: Ditto.
* tests/umovestr-illptr.test: Ditto.
* tests/umovestr3.test: Ditto.
* tests/unlink.test: Ditto.
* tests/unlinkat.test: Ditto.
* tests/unshare.test: Ditto.
* tests/userfaultfd.test: Ditto.
* tests/ustat.test: Ditto.
* tests/utime.test: Ditto.
* tests/utimes.test: Ditto.
* tests/vfork-f.test: Ditto.
* tests/vhangup.test: Ditto.
* tests/vmsplice.test: Ditto.
* tests/wait4-v.test: Ditto.
* tests/wait4.test: Ditto.
* tests/waitid-v.test: Ditto.
* tests/waitid.test: Ditto.
* tests/waitpid.test: Ditto.
* tests/xattr-strings.test: Ditto.
* tests/xet_robust_list.test: Ditto.
* tests/xetitimer.test: Ditto.
* tests/xetpgid.test: Ditto.
* tests/xetpriority.test: Ditto.
* tests/xettimeofday.test: Ditto.
* tests/Makefile.am (DECODER_TESTS, MISC_TESTS): Remove them.
Include gen_tests.am.
(TESTS): Add $(GEN_TESTS).
(XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Rename int_0x80.test
to int_0x80.gen.test.
(EXTRA_DIST): Add gen_tests.in and gen_tests.sh, remove statx.sh.
(clean-local-check): Remove $(GEN_TESTS:.gen.test=.dir).

7 years agotests: handle test scripts with .gen.test suffix
Dmitry V. Levin [Tue, 4 Apr 2017 18:03:45 +0000 (18:03 +0000)]
tests: handle test scripts with .gen.test suffix

* tests/init.sh: If script name ends with .gen.test,
set NAME variable with .gen.test suffix stripped.

7 years agompers.awk: add support for multidimensional arrays
Eugene Syromyatnikov [Tue, 4 Apr 2017 03:08:20 +0000 (05:08 +0200)]
mpers.awk: add support for multidimensional arrays

* mpers.awk (update_upper_bound): New function, which maintains new "count"
property for storing total element count and updates "upper_bound"
property which now contains string with array dimensions.
(/^DW_AT_upper_bound/, /^DW_AT_count/): Use it.
(what_is) <case "array_type">: Use "count" property in order to calculate
returned_size, do not embody returned string in square brackets.
* mpers_test.sh: Add checks for multidimensional arrays.

7 years agompers.awk: prepare for adding support of multidimensional arrays
Dmitry V. Levin [Tue, 4 Apr 2017 01:39:56 +0000 (01:39 +0000)]
mpers.awk: prepare for adding support of multidimensional arrays

* mpers.awk (what_is) <case "structure_type", case "union_type">:
Move formatting of array upper_bound ...
<case "array_type">: ... here.

7 years agotests: cleanup temporary files removals
Dmitry V. Levin [Mon, 3 Apr 2017 16:24:28 +0000 (16:24 +0000)]
tests: cleanup temporary files removals

As every test now runs in its own subdirectory, there is no need
to remove leftover files manually by each test.

* tests/init.sh (run_strace_match_diff): Do not remove $EXP.
* tests/brk.test: Likewise.
* tests/options-syntax.test: Likewise.
* tests/qual_inject-retval.test (check_injection): Likewise.
* tests/qual_signal.test (test_one_sig): Likewise.
* tests/sched.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/threads-execve.test: Likewise.
* tests/attach-f-p.test: Use $EXP instead of $OUT, do not remove it.
* tests/personality.test: Likewise.
* tests/poll.test: Likewise.
* tests/fstat.test: Likewise.
* tests/ipc.sh: Likewise.
* tests/restart_syscall.test: Likewise.
* tests/utimensat.test: Likewise.
* tests/attach-p-cmd.test: Likewise.  Do not remove
attach-p-cmd.test-lock.
* tests/detach-running.test: Do not remove $LOG.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/redirect.test: Do not remove $OUT.
* tests/strace-S.test: Likewise.
* tests/getdents.test: Do not remove $LOG.dir.
* tests/getdents64.test: Likewise.
* tests/readdir.test: Likewise.
* tests/btrfs-v.test: Do not remove $EXP and $OUT.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/execve-v.test: Likewise.
* tests/execve.test: Likewise.
* tests/fadvise64.test: Likewise.
* tests/getuid.test: Likewise.
* tests/ioctl.test: Likewise.
* tests/ioctl_dm-v.test: Likewise.
* tests/ioctl_dm.test: Likewise.
* tests/ioctl_evdev-v.test: Likewise.
* tests/ioctl_loop-nv.test: Likewise.
* tests/ioctl_loop-v.test: Likewise.
* tests/ioctl_loop.test: Likewise.
* tests/ioctl_rtc-v.test: Likewise.
* tests/ioctl_sock_gifconf.test: Likewise.
* tests/llseek.test: Likewise.
* tests/lseek.test: Likewise.
* tests/mmap.test: Likewise.
* tests/net-y-unix.test: Likewise.
* tests/net-yy-inet.test: Likewise.
* tests/net-yy-netlink.test: Likewise.
* tests/net-yy-unix.test: Likewise.
* tests/opipe.test: Likewise.
* tests/prctl-arg2-intptr.test: Likewise.
* tests/prctl-dumpable.test: Likewise.
* tests/prctl-name.test: Likewise.
* tests/prctl-no-args.test: Likewise.
* tests/prctl-pdeathsig.test: Likewise.
* tests/prctl-seccomp-filter-v.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/prctl-securebits.test: Likewise.
* tests/prctl-tid_address.test: Likewise.
* tests/prctl-tsc.test: Likewise.
* tests/umovestr2.test: Likewise.
* tests/uname.test: Likewise.
* tests/pread64-pwrite64.test: Do nore remove pread64-pwrite64-tmpfile.
* tests/read-write.test: Do nore remove read-write-tmpfile.
* tests/qual_fault.test (check_fault_injection): Do not remove $EXP,
$outexp, and $outgot.
* tests/redirect-fds.test (check_fd): Reorder removal of work files.
* tests/pc.test: Use $EXP instead of $EXPECTED, do not remove it.
* tests/strace-t.test: Likewise.
* tests/scm_rights-fd.test: Likewise.  Use dir instead of $LOG.dir,
do not remove it.
* tests/strace-ff.test: Do not remove $OUT and $LOG.* files.

7 years agotests: enhance sched.test negative check
Dmitry V. Levin [Mon, 3 Apr 2017 01:06:11 +0000 (01:06 +0000)]
tests: enhance sched.test negative check

* tests/sched.test: Test that trace=%sched doesn't match
anything besides sched_* syscalls by checking it against all test
executables without side effects listed in pure_executables.list
except sched_* and times.

7 years agotests: add a list of executables without side effects
Dmitry V. Levin [Mon, 3 Apr 2017 01:06:11 +0000 (01:06 +0000)]
tests: add a list of executables without side effects

These are executables that could be used by several different tests
simultaneously.

* tests/pure_executables.list: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.

7 years agotests: use fixed socket address in net-yy-unix.test
Dmitry V. Levin [Mon, 3 Apr 2017 00:56:54 +0000 (00:56 +0000)]
tests: use fixed socket address in net-yy-unix.test

This allows net-yy-unix invocation without arguments.

* tests/net-yy-unix.c (TEST_SOCKET): New macro.
(void): Use it instead of av[1].
* tests/net-yy-unix.test: Do not specify arguments for the test
executable.

7 years agotests: use fixed socket address in net-y-unix.test
Dmitry V. Levin [Mon, 3 Apr 2017 00:56:54 +0000 (00:56 +0000)]
tests: use fixed socket address in net-y-unix.test

This allows net-y-unix invocation without arguments.

* tests/net-y-unix.c (TEST_SOCKET): New macro.
(void): Use it instead of av[1].
* tests/net-y-unix.test: Do not specify arguments for the test
executable.

7 years agotests: run every test except ksysent.test in its own subdirectory
Dmitry V. Levin [Sun, 2 Apr 2017 01:03:24 +0000 (01:03 +0000)]
tests: run every test except ksysent.test in its own subdirectory

Many test executables create temporary files in the current work
directory for the duration of their execution.
This level of test isolation allows more test executables to be invoked
several times simultaneously.

* tests/.gitignore: Add *.dir, remove *.log.*, *.tmp, *.tmp-*,
and *.tmp.* patterns.
* tests/Makefile.am (clean-local, clean-local-check): New rules.
(.PHONY): Add clean-local-check.
(CLEANFILES): Remove all but ksysent.h.
* tests/init.sh: Strip test-specific prefix from LOG, OUT, and EXP
variables.  When invoked from a test, create a new test-specific
directory, chdir into it, and add more ../ prefix to STRACE variable.
(run_prog): Replace "./" with "../".
* tests/attach-f-p.test: Replace "./" with "../".
* tests/attach-p-cmd.test: Likewise.
* tests/bexecve.test: Likewise.
* tests/btrfs-v.test: Likewise.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/count.test: Likewise.
* tests/detach-running.test: Likewise.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/mmap.test: Likewise.
* tests/net-y-unix.test: Likewise.
* tests/net-yy-inet.test: Likewise.
* tests/net-yy-netlink.test: Likewise.
* tests/net-yy-unix.test: Likewise.
* tests/net.test: Likewise.
* tests/opipe.test: Likewise.
* tests/poll.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/qual_fault-exit_group.test: Likewise.
* tests/qual_fault.test: Likewise.
* tests/qual_inject-error-signal.test: Likewise.
* tests/qual_inject-retval.test: Likewise.
* tests/qual_inject-signal.test: Likewise.
* tests/qual_signal.test: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/readv.test: Likewise.
* tests/redirect-fds.test: Likewise.
* tests/sched.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-C.test: Likewise.
* tests/strace-E.expected: Likewise.
* tests/strace-E.test: Likewise.
* tests/strace-S.test: Likewise.
* tests/strace-T.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-ff.test: Likewise.
* tests/strace-k.test: Likewise.
* tests/strace-r.expected: Likewise.
* tests/strace-r.test: Likewise.
* tests/strace-t.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/sun_path.test: Likewise.
* tests/uname.test: Likewise.
* tests/unix-pair-send-recv.test: Likewise.
* tests/unix-pair-sendto-recvfrom.test: Likewise.

7 years agotests: make test executables invocable outside current work directory
Dmitry V. Levin [Sat, 1 Apr 2017 23:11:28 +0000 (23:11 +0000)]
tests: make test executables invocable outside current work directory

Most of test executables were ready for the upcoming change,
this change prepares all the rest.

* tests/getdents.c (main): Use fixed name for the sample directory.
* tests/getdents64.c (main): Likewise.
* tests/readdir.c (main): Likewise.
* tests/mknod.c (sample): Change to a pointer.
(main): Use av[0] as a sample.
* tests/symlink.c (main): Use av[0] as a linkpath.
* tests/umode_t.c (sample): Change to a pointer.
(test_syscall): Fix expected output.
(main): Use av[0] as a sample.

7 years agotests: cleanup access.test
Dmitry V. Levin [Fri, 31 Mar 2017 23:25:32 +0000 (23:25 +0000)]
tests: cleanup access.test

* tests/access.test: Use run_strace_match_diff.
* tests/access.c (main): Update expected output.

7 years agotests: cleanup oldfstat.test
Dmitry V. Levin [Thu, 30 Mar 2017 23:29:24 +0000 (23:29 +0000)]
tests: cleanup oldfstat.test

* tests/oldfstat.test: Use fstat.test.

7 years agoaarch64: workaround gcc+kernel bug
Dmitry V. Levin [Wed, 29 Mar 2017 17:55:35 +0000 (17:55 +0000)]
aarch64: workaround gcc+kernel bug

Due to a subtle gcc bug that leads to miscompiled aarch64 kernels,
the 3rd argument of sched_getattr syscall is not quite 32-bit
on aarch64 as on other architectures.  For more details see
https://sourceforge.net/p/strace/mailman/message/35721703/

* defs.h (print_abnormal_hi): New prototype.
* util.c (print_abnormal_hi): New function.
* sched.c (SYS_FUNC(sched_getattr)) [AARCH64]: Use it.
* tests/sched_xetattr.c (main) [__arm64__ || __aarch64__]: Test it.

7 years agoalpha, mips: fix missing flags in stat related compatibility syscalls
Abhishek Tiwari [Tue, 28 Mar 2017 03:50:07 +0000 (09:20 +0530)]
alpha, mips: fix missing flags in stat related compatibility syscalls

Following commands do the fix:

Add TF flag, fixed by:
git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
   's/0\(,[[:space:]]*SEN(.*_l\?stat[^i]\)/TF\1/'

Add TD flag, fixed by:
git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
  's/0\(,[[:space:]]*SEN(.*_fstat\)/TD\1/'

* linux/alpha/syscallent.h: Add TF and TD flags to stat related
compat syscall entries.
* linux/mips/syscallent-compat.h: Likewise.

7 years agoalpha: fix the number of arguments in alpha specific syscalls
Dmitry V. Levin [Fri, 24 Mar 2017 15:09:59 +0000 (15:09 +0000)]
alpha: fix the number of arguments in alpha specific syscalls

* linux/alpha/syscallent.h (getxgid, osf_stat, osf_lstat, osf_fstat,
osf_sysinfo, sethae): Set nargs according to arch/alpha/kernel/osf_sys.c
from linux v4.10.

7 years agoalpha: update comments about not implemented syscalls
Dmitry V. Levin [Fri, 24 Mar 2017 15:09:59 +0000 (15:09 +0000)]
alpha: update comments about not implemented syscalls

* linux/alpha/syscallent.h: Sync "not implemented" comments
with arch/alpha/kernel/systbls.S from linux v4.10.

7 years agoUpdate BPF_MAP_TYPE_* constants
Quentin Monnet [Thu, 23 Mar 2017 12:18:55 +0000 (13:18 +0100)]
Update BPF_MAP_TYPE_* constants

* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_ARRAY_OF_MAPS
and BPF_MAP_TYPE_HASH_OF_MAPS constants.

7 years agoUpdate ioctl entries from linux v4.11-rc3
Gleb Fotengauer-Malinovskiy [Thu, 23 Mar 2017 16:24:00 +0000 (19:24 +0300)]
Update ioctl entries from linux v4.11-rc3

* linux/32/ioctls_inc_align16.h: Update from linux v4.11-rc3 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.

7 years agomaint: update for linux 4.11
Gleb Fotengauer-Malinovskiy [Thu, 23 Mar 2017 13:26:47 +0000 (16:26 +0300)]
maint: update for linux 4.11

* maint/ioctls_sym.sh (ppc_list): Add KVM_PPC_GET_RMMU_INFO
and KVM_PPC_CONFIGURE_V3_MMU.

7 years agotest: rename README to README.md
Dmitry V. Levin [Sun, 19 Mar 2017 13:34:16 +0000 (13:34 +0000)]
test: rename README to README.md

* test/README: Rename to README.md, turn ../tests reference into an URL.

7 years agotest: update README
Dmitry V. Levin [Sun, 19 Mar 2017 13:34:16 +0000 (13:34 +0000)]
test: update README

* test/README: Tell the reader what this directory is actually for.

7 years agotest: rewrite skodic.c demo
Dmitry V. Levin [Sat, 18 Mar 2017 22:14:16 +0000 (22:14 +0000)]
test: rewrite skodic.c demo

* test/skodic.c: Rewrite this demo to simplify its use.

7 years agoImplement decoding of statx syscall
Victor Krapivensky [Sat, 18 Mar 2017 15:19:07 +0000 (18:19 +0300)]
Implement decoding of statx syscall

* linux/i386/syscallent.h [383]: Add statx entry.
* linux/x32/syscallent.h [332]: Likewise.
* linux/x86_64/syscallent.h [332]: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_statx.
* statx.c: New file.
* statx.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/.gitignore: Add statx.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add statx.test.
* tests/statx.c: New file.
* tests/statx.test: Likewise.
* tests/xstatx.c: Modify to support statx.
* xlat/at_statx_sync_types.in: New file.
* xlat/statx_attrs.in: Likewise.
* xlat/statx_masks.in: Likewise.
* NEWS: Mention this change.

7 years agotests: check for out of bounds fetch in parsers of stat family syscalls
Dmitry V. Levin [Fri, 17 Mar 2017 20:15:20 +0000 (20:15 +0000)]
tests: check for out of bounds fetch in parsers of stat family syscalls

* tests/xstatx.c (main): Create STRUCT_STAT object using
TAIL_ALLOC_OBJECT_CONST_PTR.

7 years agotests: check unexpected syscall errors returned by stat family syscalls
Dmitry V. Levin [Fri, 17 Mar 2017 20:15:20 +0000 (20:15 +0000)]
tests: check unexpected syscall errors returned by stat family syscalls

* tests/xstatx.c (main) [!OLD_STAT]: Do not skip the test
in case of EOVERFLOW.
Treat errors other than ENOSYS and EOVERFLOW as fatal.

7 years agotests: move try_run_prog to init.sh
Eugene Syromyatnikov [Fri, 17 Mar 2017 20:04:03 +0000 (21:04 +0100)]
tests: move try_run_prog to init.sh

Looks like try_run_prog may be of general use by other syscall class
tests.

* tests/sched.test (try_run_prog): Move it...
* tests/init: ... here.

7 years agotests/sched.test: rc should be a local variable in try_run_prog
Eugene Syromyatnikov [Fri, 17 Mar 2017 19:49:59 +0000 (20:49 +0100)]
tests/sched.test: rc should be a local variable in try_run_prog

* tests/sched.test (try_run_prog): Add local rc.

7 years agotests: check decoding of int 0x80 on x86_64, x32, and x86
Dmitry V. Levin [Thu, 16 Mar 2017 20:38:48 +0000 (20:38 +0000)]
tests: check decoding of int 0x80 on x86_64, x32, and x86

* tests/int_0x80.c: New file.
* tests/int_0x80.test: New test.
* tests/.gitignore: Add int_0x80.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS, XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Add int_0x80.test.
(XFAIL_TESTS): Add $(XFAIL_TESTS_$(ARCH)).
(CLEANFILES): Add $(TESTS:=.tmp.out) and $(TESTS:=.tmp.exp).

7 years agostrace-graph: handle pid looping
Damien Profeta [Thu, 16 Mar 2017 09:01:55 +0000 (10:01 +0100)]
strace-graph: handle pid looping

* strace-graph: On long running process or heavily forking one (like
compilation), it can happen that a parent get 2 different children with
the same pid.  By tracking the currently runnig pid and adding the start
timestamp to the pid, the graph can now handle that case.

Closes: https://github.com/strace/strace/pull/7
7 years agotests: use TAIL_ALLOC_OBJECT_CONST_PTR
Dmitry V. Levin [Thu, 16 Mar 2017 13:46:36 +0000 (13:46 +0000)]
tests: use TAIL_ALLOC_OBJECT_CONST_PTR

Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \
tests/*.c

7 years agotests: use TAIL_ALLOC_OBJECT_VAR_PTR
Dmitry V. Levin [Thu, 16 Mar 2017 13:46:36 +0000 (13:46 +0000)]
tests: use TAIL_ALLOC_OBJECT_VAR_PTR

Automatically convert tests to use TAIL_ALLOC_OBJECT_VAR_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*([^ =]+) = tail_alloc\(sizeof\((\2|\*\5)\)\);/\1TAIL_ALLOC_OBJECT_VAR_PTR(\2, \5);/' \
tests/{move_pages,net-sockaddr,sendfile}.c

7 years agotests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h
Dmitry V. Levin [Thu, 16 Mar 2017 13:46:36 +0000 (13:46 +0000)]
tests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h

Introduce a new macros for the most widespread use of tail_alloc.

* tests/tests.h (TAIL_ALLOC_OBJECT_CONST_PTR,
TAIL_ALLOC_OBJECT_VAR_PTR): New macros.

7 years agoDecode RUSAGE_THREAD
Victor Krapivensky [Thu, 16 Mar 2017 07:35:40 +0000 (10:35 +0300)]
Decode RUSAGE_THREAD

* xlat/usagewho.in: Add values for existing entities, add
RUSAGE_THREAD.
* tests/getrusage.c: Test decoding of RUSAGE_THREAD.

7 years agotests/sched.test: use heredoc in order to avoid spawning of subprocess
Eugene Syromyatnikov [Mon, 13 Mar 2017 16:52:41 +0000 (17:52 +0100)]
tests/sched.test: use heredoc in order to avoid spawning of subprocess

Pipelined commands executed in subprocesses (some shells have special
provision for last command in the pipeline, but it is not guaranteed
and not POSIX), so exit codes of these subprocesses can be lost.
In order to avoid creating subprocesses, input for read commands
is better to supply via heredoc and not pipe.

* tests/sched.test: Move test cases to heredoc.

7 years agotests: do not skip sched.test if one of its subtests skips
Dmitry V. Levin [Wed, 15 Mar 2017 01:05:45 +0000 (01:05 +0000)]
tests: do not skip sched.test if one of its subtests skips

* tests/sched.test (try_run_prog): New function.
Use it instead of run_prog.

7 years agotests: do not check decoding of setitimer syscall outside xetitimer.test
Dmitry V. Levin [Wed, 15 Mar 2017 00:00:29 +0000 (00:00 +0000)]
tests: do not check decoding of setitimer syscall outside xetitimer.test

xetitimer.test already implements a comprehensive test of setitimer
syscall parser, no need to duplicate its parts in other tests.

* tests/clock_nanosleep.c (main): Remove setitimer expected output.
* tests/nanosleep.c (main): Likewise.
* tests/clock_nanosleep.test: Remove setitimer from the trace set.
* tests/nanosleep.test: Likewise.

7 years agotests: check decoding of getitimer and setitimer corner cases
Dmitry V. Levin [Tue, 14 Mar 2017 22:35:13 +0000 (22:35 +0000)]
tests: check decoding of getitimer and setitimer corner cases

* tests/sched_xetattr.c: Include <unistd.h> and <asm/unistd.h>.
(main): Check that pointer and integer arguments of getitimer
and setitimer syscalls are decoded properly.
* tests/xetitimer.test: Add -a option.

7 years agotests: rewrite sigreturn syscall decoding check from match_grep to match_diff
Dmitry V. Levin [Mon, 13 Mar 2017 11:37:36 +0000 (11:37 +0000)]
tests: rewrite sigreturn syscall decoding check from match_grep to match_diff

Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/sigreturn.c: Rewrite.
* tests/sigreturn.test: Likewise.

7 years agoia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls
Dmitry V. Levin [Mon, 13 Mar 2017 01:58:39 +0000 (01:58 +0000)]
ia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls

As there is no sigreturn syscall on ia64, mips n32, mips n64, x32,
and x86_64, no longer used parsers could be safely removed.

* linux/ia64/arch_sigreturn.c: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Remove [!LINUX_MIPSO32].
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Remove.

7 years agoMove sigreturn parser to libstrace
Dmitry V. Levin [Mon, 13 Mar 2017 01:58:33 +0000 (01:58 +0000)]
Move sigreturn parser to libstrace

All architectures have rt_sigreturn, but only old ones also have
sigreturn.  Since not all architectures need a parser of sigreturn
syscall, remove the warning and move the parser to libstrace.

* Makefile.am (strace_SOURCES): Move sigreturn.c ...
(libstrace_a_SOURCES): ... here.
* linux/arch_sigreturn.c: Remove warning.

7 years agotests: check decoding of rt_sigreturn syscall
Dmitry V. Levin [Sun, 12 Mar 2017 16:11:38 +0000 (16:11 +0000)]
tests: check decoding of rt_sigreturn syscall

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

7 years agoImplement proper decoding of rt_sigreturn syscall
Dmitry V. Levin [Sun, 12 Mar 2017 22:01:09 +0000 (22:01 +0000)]
Implement proper decoding of rt_sigreturn syscall

* rt_sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_rt_sigreturn): Remove.
* linux/64/syscallent.h (rt_sigreturn): Change sys_func to rt_sigreturn.
* linux/hppa/syscallent.h (rt_sigreturn): Likewise.
* linux/ia64/syscallent.h (rt_sigreturn): Likewise.
* linux/s390/syscallent.h (rt_sigreturn): Likewise.
* linux/s390x/syscallent.h (rt_sigreturn): Likewise.
* linux/x86_64/syscallent.h (rt_sigreturn): Likewise.
* linux/x32/syscallent.h (rt_sigreturn, 64:rt_sigreturn): Likewise.
* NEWS: Mention this change.

7 years agoIntroduce get_rt_sigframe_addr function
Dmitry V. Levin [Sat, 11 Mar 2017 21:49:06 +0000 (21:49 +0000)]
Introduce get_rt_sigframe_addr function

Add get_rt_sigframe_addr function for all supported architectures.
It is going to be used in a parser of rt_sigreturn syscall.

* defs.h (get_rt_sigframe_addr): New function prototype.
* rt_sigframe.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/arch_rt_sigframe.c: New file.
* linux/alpha/arch_rt_sigframe.c: Likewise.
* linux/arc/arch_rt_sigframe.c: Likewise.
* linux/arm/arch_rt_sigframe.c: Likewise.
* linux/avr32/arch_rt_sigframe.c: Likewise.
* linux/bfin/arch_rt_sigframe.c: Likewise.
* linux/crisv10/arch_rt_sigframe.c: Likewise.
* linux/crisv32/arch_rt_sigframe.c: Likewise.
* linux/hppa/arch_rt_sigframe.c: Likewise.
* linux/i386/arch_rt_sigframe.c: Likewise.
* linux/ia64/arch_rt_sigframe.c: Likewise.
* linux/m68k/arch_rt_sigframe.c: Likewise.
* linux/metag/arch_rt_sigframe.c: Likewise.
* linux/microblaze/arch_rt_sigframe.c: Likewise.
* linux/mips/arch_rt_sigframe.c: Likewise.
* linux/nios2/arch_rt_sigframe.c: Likewise.
* linux/or1k/arch_rt_sigframe.c: Likewise.
* linux/powerpc/arch_rt_sigframe.c: Likewise.
* linux/powerpc64/arch_rt_sigframe.c: Likewise.
* linux/riscv/arch_rt_sigframe.c: Likewise.
* linux/s390/arch_rt_sigframe.c: Likewise.
* linux/s390x/arch_rt_sigframe.c: Likewise.
* linux/sh/arch_rt_sigframe.c: Likewise.
* linux/sh64/arch_rt_sigframe.c: Likewise.
* linux/sparc/arch_rt_sigframe.c: Likewise.
* linux/sparc64/arch_rt_sigframe.c: Likewise.
* linux/tile/arch_rt_sigframe.c: Likewise.
* linux/x32/arch_rt_sigframe.c: Likewise.
* linux/x86_64/arch_rt_sigframe.c: Likewise.
* linux/xtensa/arch_rt_sigframe.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

7 years agoIntroduce struct_rt_sigframe type
Dmitry V. Levin [Sat, 11 Mar 2017 21:26:22 +0000 (21:26 +0000)]
Introduce struct_rt_sigframe type

Add rt_sigframe.h files with definitions of struct_rt_sigframe type
for all supported architectures.
These definitions are going to be used in a parser of rt_sigreturn
syscall.

* linux/rt_sigframe.h: New file.
* linux/bfin/rt_sigframe.h: Likewise.
* linux/crisv10/rt_sigframe.h: Likewise.
* linux/crisv32/rt_sigframe.h: Likewise.
* linux/hppa/rt_sigframe.h: Likewise.
* linux/i386/rt_sigframe.h: Likewise.
* linux/ia64/rt_sigframe.h: Likewise.
* linux/m68k/rt_sigframe.h: Likewise.
* linux/mips/rt_sigframe.h: Likewise.
* linux/powerpc64/rt_sigframe.h: Likewise.
* linux/s390/rt_sigframe.h: Likewise.
* linux/s390x/rt_sigframe.h: Likewise.
* linux/sh64/rt_sigframe.h: Likewise.
* linux/sparc/rt_sigframe.h: Likewise.
* linux/sparc64/rt_sigframe.h: Likewise.
* linux/tile/rt_sigframe.h: Likewise.
* linux/x32/rt_sigframe.h: Likewise.
* linux/x86_64/rt_sigframe.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

7 years agounwind.c: fix a possible buffer overflow
Victor Krapivensky [Sat, 11 Mar 2017 11:27:33 +0000 (14:27 +0300)]
unwind.c: fix a possible buffer overflow

Linux does not prevent a user from creating a lot of nested directories
with length of the absolute path of the deepest one exceeding PATH_MAX,
then chdir'ing into it, creating a file there and mmap'ing it. Since the
length of the prefix preceding the pathname in /proc/[pid]/maps is not
necessary 80 (it's 73 on my machine), an overflow is possible.

* unwind.c (build_mmap_cache): Fix a possible buffer overflow.

7 years agoutil.c: remove a wrong comment
Victor Krapivensky [Fri, 10 Mar 2017 17:48:35 +0000 (20:48 +0300)]
util.c: remove a wrong comment

4924dbd6d750665cf383b20ab4fd67e48219ab91 modified the return type, but
not the comment.