]> granicus.if.org Git - strace/log
strace
6 years agotests: skip nsyscalls-d.test on mips o32
Dmitry V. Levin [Sat, 23 Dec 2017 14:12:18 +0000 (14:12 +0000)]
tests: skip nsyscalls-d.test on mips o32

On mips o32, nsyscalls test is implemented using syscall #4000,
so nsyscalls-d cannot work there.

* tests/nsyscalls-d.test: Skip on mips o32.

6 years agoRemove linux/ptp_clock.h
Dmitry V. Levin [Sat, 23 Dec 2017 02:37:33 +0000 (02:37 +0000)]
Remove linux/ptp_clock.h

As linux kernel provides a compatible linux/ptp_clock.h header since
commit v3.8-rc1~139^2~514, there is no need for a local copy.

* linux/ptp_clock.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* configure.ac (AC_CHECK_TYPES): Check for struct ptp_sys_offset
in <linux/ptp_clock.h>.
* ioctl.c (ioctl_decode) <case '='>: Conditionalize
on [HAVE_STRUCT_PTP_SYS_OFFSET].
* ptp.c: Likewise.

6 years agoRemove linux/ubi-user.h
Dmitry V. Levin [Sat, 23 Dec 2017 02:53:54 +0000 (02:53 +0000)]
Remove linux/ubi-user.h

As linux kernel provides a compatible mtd/ubi-user.h header since
commit v3.7-rc1~85^2~17, there is no need for a local copy.

* linux/ubi-user.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* configure.ac (AC_CHECK_MEMBERS): Check
for struct ubi_attach_req.max_beb_per1024 in <mtd/ubi-user.h>.
* ioctl.c (ioctl_decode) <case 'o', case 'O'>: Conditionalize
on HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024.
* ubi.c: Likewise.

6 years agoRemove linux/mtd-abi.h
Dmitry V. Levin [Sat, 23 Dec 2017 02:10:13 +0000 (02:10 +0000)]
Remove linux/mtd-abi.h

As linux kernel provides a compatible mtd/mtd-abi.h header since
commit v3.2-rc1~14^2~33, there is no need for a local copy.

* linux/mtd-abi.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* configure.ac (AC_CHECK_TYPES): Check for struct mtd_write_req
in <mtd/mtd-abi.h>.
* ioctl.c (ioctl_decode) <case 'M'>: Conditionalize
on [HAVE_STRUCT_MTD_WRITE_REQ].
* mtd.c: Likewise.
* tests/ioctl_mtd.c: Likewise.
* tests/ioctl.c (main): Likewise.

6 years agoRemove linux/personality.h
Dmitry V. Levin [Sat, 23 Dec 2017 01:51:29 +0000 (01:51 +0000)]
Remove linux/personality.h

* linux/personality.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* personality.c: Do not include <linux/personality.h>, include
"xlat/personality_flags.h" before "xlat/personality_types.h".
* xlat/personality_flags.in: Provide fallback definitions.
* xlat/personality_types.in: Likewise.

6 years agotravis: switch from clang-3.8 to clang
Dmitry V. Levin [Sat, 23 Dec 2017 01:26:17 +0000 (01:26 +0000)]
travis: switch from clang-3.8 to clang

As travis provides a relatively fresh clang by default nowadays,
it makes sense to use default clang in clang-based test builds.

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

6 years agostrace.1.in: mention perf and ftrace in SEE ALSO
Eugene Syromyatnikov [Thu, 21 Dec 2017 13:11:47 +0000 (14:11 +0100)]
strace.1.in: mention perf and ftrace in SEE ALSO

* strace.1.in (.SH SEE ALSO): Add references to perf-trace(1) and
trace-cmd(1).

6 years agostrace.1.in: clarify -F option behaviour
Eugene Syromyatnikov [Thu, 21 Dec 2017 13:10:49 +0000 (14:10 +0100)]
strace.1.in: clarify -F option behaviour

* strace.1.in <.TP \-F>: Extend deprecation warning.  Describe behaviour
of multiple instances of -F and interoperability of -F and -f.

6 years agotests: consistently use $STRACE_EXE instead of local alternatives
Dmitry V. Levin [Wed, 20 Dec 2017 22:58:42 +0000 (22:58 +0000)]
tests: consistently use $STRACE_EXE instead of local alternatives

* tests/get_regs.test: Replace "${STRACE##* }" with "$STRACE_EXE".
* tests/options-syntax.test: Replace "$strace_exp" with "$STRACE_EXE".
* tests/syntax.sh: Likewise.

6 years agostrace.c: inform the user about -F option obsolescence
Eugene Syromyatnikov [Wed, 20 Dec 2017 15:25:20 +0000 (16:25 +0100)]
strace.c: inform the user about -F option obsolescence

* strace.c (init): Print an error message if the option is used.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agostrace.c: sort option arguments alphabetically
Eugene Syromyatnikov [Wed, 20 Dec 2017 14:45:55 +0000 (15:45 +0100)]
strace.c: sort option arguments alphabetically

Except for the ones that enabled by configure options.

While we are here, let's also change the indentation of while expression
continuation in order to separate it from the following switch clause.

* strace.c (init): Reorder options in getopt() call.

6 years agostrace.c: use _exit() instead of exit() in child's die()
Eugene Syromiatnikov [Fri, 4 Aug 2017 07:38:50 +0000 (09:38 +0200)]
strace.c: use _exit() instead of exit() in child's die()

Let's keep child's death routine as minimalistic as possible for the
cases when vfork() is used instead of fork() on systems that lack MMU.

* strace.c (die) <!(strace_tracer_pid == getpid())>: Call _exit().

6 years agosyscall: replace if (debug_flag) ... with debug_msg macro
Harsha Sharma [Wed, 20 Dec 2017 17:33:01 +0000 (23:03 +0530)]
syscall: replace if (debug_flag) ... with debug_msg macro

* syscall.c (get_scno): Use debug_msg instead of
"if (debug_flag) error_msg".

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
6 years agotests: check (some) debugging output generated during nsyscalls test
Eugene Syromyatnikov [Wed, 20 Dec 2017 19:11:05 +0000 (20:11 +0100)]
tests: check (some) debugging output generated during nsyscalls test

* tests/nsyscalls-d.c: New file.
* tests/.gitignore: Add it.
* tests/nsyscalls-d.test: New test, variant of nsyscalls.test with debug
output check.
* tests/nsyscalls-nd.test: Likewise.
* tests/nsyscalls.c: Add expected debug output.
* tests/Makefile.am (check_PROGRAMS): Add nsyscalls-d.
(DECODER_TESTS): Add nsyscalls-d.test and nsyscalls-nd.test.

6 years agopathtrace.c: use xgrowarray
Eugene Syromiatnikov [Wed, 13 Dec 2017 12:52:59 +0000 (13:52 +0100)]
pathtrace.c: use xgrowarray

* defs.h <struct path_set>: Change type of num_selected field to size_t.
Add size field.
* pathtrace.c (storepath): Rewrite to utilise xgrowarray.

6 years agodyxlat: use xgrowarray
Dmitry V. Levin [Thu, 14 Dec 2017 00:05:04 +0000 (00:05 +0000)]
dyxlat: use xgrowarray

* dyxlat.c (dyxlat_alloc): Use xgrowarray instead of xcalloc.
(dyxlat_add_pair): Use xgrowarray instead of xreallocarray.

6 years agounwind: use xgrowarray
Dmitry V. Levin [Thu, 14 Dec 2017 00:05:04 +0000 (00:05 +0000)]
unwind: use xgrowarray

* unwind.c (get_symbol_name): Use xgrowarray instead of manual
dynamic array management using xreallocarray.

6 years agostrace.c: use xgrowarray
Eugene Syromiatnikov [Tue, 8 Aug 2017 14:37:39 +0000 (16:37 +0200)]
strace.c: use xgrowarray

* strace.c (tcbtabsize): Change type to size_t.
(expand_tcbtab): Rewrite in order to utilise xgrowarray
instead of manual dynamic array management.

6 years agounwind: use xgrowarray
Eugene Syromiatnikov [Tue, 8 Aug 2017 14:37:01 +0000 (16:37 +0200)]
unwind: use xgrowarray

* unwind.c (build_mmap_cache): Use xgrowarray instead of manual dynamic
array management.

6 years agoxmalloc.c: introduce xgrowarray helper function
Eugene Syromiatnikov [Tue, 8 Aug 2017 14:36:40 +0000 (16:36 +0200)]
xmalloc.c: introduce xgrowarray helper function

In order to simplify dynamic array management code.

* xmalloc.h (xgrowarray): New declaration.
* xmalloc.c (xgrowarray): New function.

6 years agotests: check error diagnostics when exec file name is too long
Dmitry V. Levin [Wed, 13 Dec 2017 01:47:33 +0000 (01:47 +0000)]
tests: check error diagnostics when exec file name is too long

* tests/options-syntax.test: Check error diagnostics when
exec file name length equals to PATH_MAX.

6 years agostrace.c: minor style fixes
Eugene Syromiatnikov [Fri, 4 Aug 2017 07:01:47 +0000 (09:01 +0200)]
strace.c: minor style fixes

* strace.c (test_ptrace_seize): Remove excess braces.
(init): Wrap overly long string literal.  Add braces
to the else if branch.

6 years agostrace.c: use *_func_* message printing macros where appropriate
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:55:35 +0000 (08:55 +0200)]
strace.c: use *_func_* message printing macros where appropriate

In order to provide some additional bits of information in weird error
cases or just replace existing usages of __func__/literal function name.

* strace.c (detach): Use perror_func_msg() instead of perror_msg().
(startup_attach, open_dummy_desc, startup_child, test_ptrace_seize): Use
perror_func_msg_and_die() instead of perror_msg_and_die().
(test_ptrace_seize): Use error_func_msg_and_die() instead of
error_msg_and_die().

6 years agounwind.c: more verbose mapping overlapping diagnostic message
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:44:01 +0000 (08:44 +0200)]
unwind.c: more verbose mapping overlapping diagnostic message

* unwind.c (build_mmap_cache): Change error_msg() to debug_msg(), add
information about region names and the respective start and end
addresses.

6 years agounwind.c: non-fatal handling of asprintf error
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:43:16 +0000 (08:43 +0200)]
unwind.c: non-fatal handling of asprintf error

An error returned by asprintf is a poor excuse for dying.

* unwind.c (asprintf_error_str): New string constant.
(sprint_call_or_error): Replace error_msg_and_die() with
perror_func_msg() and usage of asprintf_error_str for a return value.
(queue_print): Free tmp->output line only if it is not
asprintf_error_str.

6 years agounwind.c: eliminate DPRINTF
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:41:49 +0000 (08:41 +0200)]
unwind.c: eliminate DPRINTF

Since DPRINTF is simply a macro that provides debugging information
along with some information about printing routine call site, now standard
debug_func_* macros are deemed to be a suitable replacement.

* unwind.c (DPRINTF): Remove.
(build_mmap_cache, delete_mmap_cache, unwind_cache_invalidate,
unwind_print_stacktrace, unwind_captiure_stacktrace): Replace
DPRINTF(fmt, str, ...) with debug_func_msg(fmt, ...)/

6 years agostrace.c: replace if (debug_flag) ... with suitable debug printing macros
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:11:02 +0000 (08:11 +0200)]
strace.c: replace if (debug_flag) ... with suitable debug printing macros

* strace.c (alloc_tcb, droptcb, detach, attach_tcb, test_ptrace_seize,
init, startup_tcb): Replace if (debug_flag) error_msg(...) occurrences
with debug_error_msg(...).
(attach_tcb): Replace if (debug_flag) perror_msg(...) with
debug_perror_msg(...).
(cleanup, startup_tcb): Replace if (debug_flag) error_msg(...)
occurrences with debug_func_msg() in attempt to provide additional
information.

6 years agoerror_prints.h: add *_func_* printing macros
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:03:34 +0000 (08:03 +0200)]
error_prints.h: add *_func_* printing macros

In order to reduce boilerplate for the cases when __func__ is desired
to be printed.

* error_prints.h (error_func_msg, perror_func_msg, debug_func_msg,
debug_func_perror_msg, error_func_msg_and_die, perror_func_msg_and_die):
New macro definitions.

6 years agoerror_prints.h: add debug print macros
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:03:03 +0000 (08:03 +0200)]
error_prints.h: add debug print macros

* defs.h (debug_flag): Move the declaration...
* error_prints.h (debug_flag): ... here.
(debug_msg, debug_perror_msg): New macro definitions.
Include <stdbool.h> for the debug_flag declaration.

6 years agotests: check decoding of KVM ioctl commands
Masatake YAMATO [Mon, 4 Dec 2017 13:08:17 +0000 (22:08 +0900)]
tests: check decoding of KVM ioctl commands

* tests/ioctl_kvm_run.c: New file.
* tests/ioctl_kvm_run.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add ioctl_kvm_run.test.
* tests/pure_executables.list: Add ioctl_kvm_run.
* tests/.gitignore: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agokvm: decode the argument of KVM_{SET, GET}_SREGS ioctl command
Masatake YAMATO [Mon, 4 Dec 2017 13:08:16 +0000 (22:08 +0900)]
kvm: decode the argument of KVM_{SET, GET}_SREGS ioctl command

* configure.ac (AC_CHECK_TYPES): Add struct kvm_sregs.
* kvm.c [HAVE_STRUCT_KVM_SREGS] (kvm_ioctl_decode_sregs): New function.
(kvm_ioctl) [HAVE_STRUCT_KVM_SREGS] <KVM_SET_SREGS, KVM_GET_SREGS>:
Use it.
* linux/arch_kvm.c (arch_print_kvm_sregs): New function.
* linux/x86_64/arch_kvm.c (PRINT_FIELD_KVM_SREGS_STRUCT): New macro.
(kvm_ioctl_decode_regs_dtable, kvm_ioctl_decode_regs_segment,
arch_print_kvm_sregs): New functions.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agokvm: decode the argument of KVM_{SET, GET}_REGS ioctl command
Masatake YAMATO [Mon, 4 Dec 2017 13:08:15 +0000 (22:08 +0900)]
kvm: decode the argument of KVM_{SET, GET}_REGS ioctl command

* configure.ac (AC_CHECK_TYPES): Add struct kvm_regs.
* linux/arck_kvm.c: New file.
* linux/x86_64/arch_kvm.c: Likewise.
* linux/i386/arch_kvm.c: Likewise.
* linux/x32/arch_kvm.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* kvm.c: Include "arch_kvm.c".
[HAVE_STRUCT_KVM_REGS] (kvm_ioctl_decode_regs): New function.
(kvm_ioctl) [HAVE_STRUCT_KVM_REGS] <KVM_SET_REGS, KVM_GET_REGS>: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agokvm: decode the argument of KVM_SET_USER_MEMORY_REGION ioctl command
Masatake YAMATO [Mon, 4 Dec 2017 13:08:14 +0000 (22:08 +0900)]
kvm: decode the argument of KVM_SET_USER_MEMORY_REGION ioctl command

* configure.ac (AC_CHECK_TYPES): Add struct kvm_userspace_memory_region.
* xlat/kvm_mem_flags.in: New file.
* kvm.c: Include print_fields.h.
[HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION]: Include xlat/kvm_mem_flags.h,
(kvm_ioctl_set_user_memory_region): New function.
(kvm_ioctl) [HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION]
<KVM_SET_USER_MEMORY_REGION>: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agoAdd strace mascot
Eugene Syromyatnikov [Mon, 20 Nov 2017 01:48:09 +0000 (02:48 +0100)]
Add strace mascot

* strace.svg: New file.

Co-Authored-by: Vitaly Chaykovsky <mgspeker@gmail.com>
6 years agotests: robustify attach-p-cmd.test against buggy kernels
Dmitry V. Levin [Sun, 3 Dec 2017 00:25:43 +0000 (00:25 +0000)]
tests: robustify attach-p-cmd.test against buggy kernels

From time to time various kernels, old and new, just go nuts
and fail attach-p-cmd.test with the following diagnostics:

 12345 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
-12345 chdir("attach-p-cmd.test -p") = -1 ENOENT (No such file or directory)
+12345 syscall_4294967295(0xffe60934, 0x1c0, 0xffe60934, 0x1, 0xffe609b4, 0xffe60a58) = -1 (errno 38)
+12345 chdir("attach-p-cmd.test -p") = -1 ENOSYS (Function not implemented)

Let's workaround this kernel madness by rewriting the test
without use of SIGALRM.

* tests/attach-p-cmd.h: New file.
* tests/Makefile.am (EXTRA_DIST): Add attach-p-cmd.h.
* tests/attach-p-cmd-cmd.c: Include "attach-p-cmd.h".
(write_pidfile, wait_for_peer_invocation): New functions.
(main): Use them.
* tests/attach-p-cmd-p.c: Include <time.h> and "attach-p-cmd.h".
(wait_for_peer_invocation, wait_for_peer_termination): New functions.
(main): Use them.  Do not raise SIGALRM, use nanosleep after peer
termination.

6 years agotests: robustify ipc_msgbuf.test against broken libc
Dmitry V. Levin [Sat, 2 Dec 2017 22:01:34 +0000 (22:01 +0000)]
tests: robustify ipc_msgbuf.test against broken libc

glibc between commits glibc-2.25~130 and glibc-2.26~740 had broken
msgctl(IPC_RMID) on hppa: this operation always failed with EINVAL
because of inappropriate use of IPC_64 flag.  Similar issues were
fixed on other niche architectures.  Let's workaround these issues
by skipping the test in case of msgctl(IPC_RMID) failure.

* tests/ipc_msgbuf.c (cleanup): Change return type to int,
return 77 in case of msgctl(IPC_RMID) failure.
(main): Explicitly invoke cleanup() at the end.

6 years agokvm: decode the argument of KVM_CREATE_VCPU ioctl command
Masatake YAMATO [Fri, 1 Dec 2017 19:05:28 +0000 (04:05 +0900)]
kvm: decode the argument of KVM_CREATE_VCPU ioctl command

* kvm.c (kvm_ioctl_create_vcpu): New function.
(kvm_ioctl) <KVM_CREATE_VCPU>: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agokvm: handle KVM_CREATE_VM ioctl command
Masatake YAMATO [Fri, 1 Dec 2017 19:05:27 +0000 (04:05 +0900)]
kvm: handle KVM_CREATE_VM ioctl command

* kvm.c (kvm_ioctl): Handle KVM_CREATE_VM command.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agokvm: handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE, and KVM_GET_API_VERSION ioctl commands
Masatake YAMATO [Fri, 1 Dec 2017 19:05:26 +0000 (04:05 +0900)]
kvm: handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE, and KVM_GET_API_VERSION ioctl commands

* kvm.c (kvm_ioctl): Handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE,
and KVM_GET_API_VERSION commands.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agoioctl: add a stub for decoding kvm related ioctls
Masatake YAMATO [Fri, 1 Dec 2017 19:05:25 +0000 (04:05 +0900)]
ioctl: add a stub for decoding kvm related ioctls

* kvm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Add linux/kvm.h.
* defs.h (kvm_ioctl): New prototype.
* ioctl.c (ioctl_decode) HAVE_LINUX_KVM_H]: Use kvm_ioctl.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agostrace-log-merge: work around corner cases of strace -ttt parsing
Eugene Syromyatnikov [Thu, 30 Nov 2017 01:14:14 +0000 (02:14 +0100)]
strace-log-merge: work around corner cases of strace -ttt parsing

Employing strace -ttt for the logs destined to be fed to
strace-log-merge is ultimately the best solution except for the logs
that pass the following dates:

Thu Jan  1 00:00:09 UTC 1970
Thu Jan  1 00:01:39 UTC 1970
Thu Jan  1 00:16:39 UTC 1970
Thu Jan  1 02:46:39 UTC 1970
Fri Jan  2 03:46:39 UTC 1970
Mon Jan 12 13:46:39 UTC 1970
Sun Apr 26 17:46:39 UTC 1970
Sat Mar  3 09:46:39 UTC 1973
Sun Sep  9 01:46:39 UTC 2001
Sat Nov 20 17:46:39 UTC 2286
Wed Nov 16 09:46:39 UTC 5138
Fri Sep 27 01:46:39 UTC 33658
Sun May 20 17:46:39 UTC 318857
Sat Nov  7 09:46:39 UTC 3170843
Sun Jul  5 01:46:39 UTC 31690708
Sat Jan 25 17:46:39 UTC 316889355

Let's lift this limitation.

* strace-log-merge: Generate numeric-only key for sorting, use sort -n
option.

6 years agodebian: add strace-log-merge to the list of installed files
Eugene Syromyatnikov [Wed, 29 Nov 2017 20:54:23 +0000 (21:54 +0100)]
debian: add strace-log-merge to the list of installed files

* debian/strace.install: Add strace-log-merge.

6 years agoAdd strace-log-merge man page
Eugene Syromyatnikov [Wed, 29 Nov 2017 20:52:02 +0000 (21:52 +0100)]
Add strace-log-merge man page

* strace-log-merge.1.in: New file.
* NEWS: Mention this.
* .gitignore: Add strace-log-merge.1.
* Makefile.am (man_MANS): Likewise.
* configure.ac (AC_CONFIG_FILES): Likewise.
* debian/strace.manpages: Likewise.

6 years agostrace-log-merge: add copyright header
Eugene Syromyatnikov [Wed, 29 Nov 2017 20:38:27 +0000 (21:38 +0100)]
strace-log-merge: add copyright header

6 years agoAdd initial GitLab CI support
Dmitry V. Levin [Wed, 29 Nov 2017 03:52:27 +0000 (03:52 +0000)]
Add initial GitLab CI support

* .gitlab-ci.yml: New file.
* travis-build.sh: Print $CC -print-multi-lib.  Print config.log
in case of configure failure.
* travis-install.sh: Check sudo availability.  Install autoconf,
automake, file, gawk, gcc-multilib, git, gzip, make, and xz-utils
for all targets.
(musl-gcc): Install ca-certificates.

6 years agompers: fix cross-compiling
Dmitry V. Levin [Sat, 25 Nov 2017 01:55:44 +0000 (01:55 +0000)]
mpers: fix cross-compiling

In cross builds, a target version of readelf has to be used
instead of a native one.

* configure.ac (AC_CHECK_TOOL): Add readelf.
* Makefile.am (READELF): New variable.
(mpers-m%.stamp): Pass it to $(srcdir)/mpers.sh.
* m4/mpers.m4 (st_MPERS): Pass READELF environment variable
to $srcdir/mpers_test.sh.
* mpers.sh (READELF): New variable.
Use it instead of readelf.
* maint/ioctls_sym.sh: Likewise.
* NEWS: Mention this fix.

Reported-by: Rolf Eike Beer <eb@emlix.com>
6 years agotests: fix llseek test
Dmitry V. Levin [Wed, 22 Nov 2017 00:38:03 +0000 (00:38 +0000)]
tests: fix llseek test

* tests/llseek.test: Fix typo.

6 years agoINSTALL-git.md: fix typo
Dmitry V. Levin [Wed, 22 Nov 2017 00:25:42 +0000 (00:25 +0000)]
INSTALL-git.md: fix typo

6 years agotests: simplify bpf test a bit
Dmitry V. Levin [Wed, 22 Nov 2017 00:14:52 +0000 (00:14 +0000)]
tests: simplify bpf test a bit

* tests/bpf.c (DEF_BPF_INIT_FIRST): New macro.
(init_BPF_MAP_CREATE_first, init_BPF_MAP_LOOKUP_ELEM_first,
init_BPF_PROG_LOAD_first, init_BPF_OBJ_PIN_first,
init_BPF_PROG_ATTACH_first, init_BPF_PROG_TEST_RUN_first,
init_BPF_PROG_GET_NEXT_ID_first, init_BPF_OBJ_GET_INFO_BY_FD_first):
Use it.

6 years agoImplement decoding of BPF_OBJ_GET_INFO_BY_FD command of bpf syscall
Dmitry V. Levin [Tue, 21 Nov 2017 23:12:04 +0000 (23:12 +0000)]
Implement decoding of BPF_OBJ_GET_INFO_BY_FD command of bpf syscall

* configure.ac (AC_CHECK_MEMBERS): Add union bpf_attr.info.info.
* bpf.c (decode_BPF_OBJ_GET_INFO_BY_FD): New function.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it.
* NEWS: Mention this.
* tests/bpf.c: Add macro guard for BPF_OBJ_GET_INFO_BY_FD decoder test.
[HAVE_UNION_BPF_ATTR_INFO_INFO] (sample_BPF_OBJ_GET_INFO_BY_FD_attr):
New variable.
[HAVE_UNION_BPF_ATTR_INFO_INFO] (init_BPF_OBJ_GET_INFO_BY_FD_first,
print_BPF_OBJ_GET_INFO_BY_FD_first, init_BPF_OBJ_GET_INFO_BY_FD_attr,
print_BPF_OBJ_GET_INFO_BY_FD_attr): New functions.
(main) [HAVE_UNION_BPF_ATTR_INFO_INFO]: Use them.

6 years agoSimplify union bpf_attr field checks
Dmitry V. Levin [Tue, 21 Nov 2017 22:32:31 +0000 (22:32 +0000)]
Simplify union bpf_attr field checks

* configure.ac: Use AC_CHECK_MEMBERS instead of st_CHECK_UNION_BPF_ATTR
for union bpf_attr field checks as the former seems to be enough
for the case.
* m4/st_bpf.m4: Remove.

6 years agoImplement decoding of BPF_*_GET_*_ID commands of bpf syscall
Dmitry V. Levin [Tue, 21 Nov 2017 21:08:19 +0000 (21:08 +0000)]
Implement decoding of BPF_*_GET_*_ID commands of bpf syscall

* configure.ac: Check for union bpf_attr.next_id.
* bpf.c (decode_BPF_PROG_GET_NEXT_ID, decode_BPF_PROG_GET_FD_BY_ID,
* decode_BPF_MAP_GET_FD_BY_ID): New functions.
(decode_BPF_MAP_GET_NEXT_ID): New macro.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use them.
* NEWS: Mention this.
* tests/bpf.c: Add macro guard for BPF_*_GET_*_ID decoder tests.
[HAVE_UNION_BPF_ATTR_NEXT_ID] (init_BPF_PROG_GET_NEXT_ID_first,
print_BPF_PROG_GET_NEXT_ID_first, init_BPF_PROG_GET_NEXT_ID_attr,
print_BPF_PROG_GET_NEXT_ID_attr, print_BPF_PROG_GET_FD_BY_ID_first,
print_BPF_PROG_GET_FD_BY_ID_attr, print_BPF_MAP_GET_NEXT_ID_first,
print_BPF_MAP_GET_NEXT_ID_attr): New functions.
(init_BPF_MAP_GET_NEXT_ID_first, print_BPF_MAP_GET_NEXT_ID_first,
init_BPF_MAP_GET_NEXT_ID_attr, print_BPF_MAP_GET_NEXT_ID_attr,
init_BPF_PROG_GET_FD_BY_ID_first, init_BPF_PROG_GET_FD_BY_ID_attr,
init_BPF_MAP_GET_FD_BY_ID_first, init_BPF_MAP_GET_FD_BY_ID_attr):
New macros.
(main) [HAVE_UNION_BPF_ATTR_NEXT_ID]: Use them.

6 years agoImplement decoding of BPF_PROG_TEST_RUN command of bpf syscall
Dmitry V. Levin [Mon, 20 Nov 2017 00:29:10 +0000 (00:29 +0000)]
Implement decoding of BPF_PROG_TEST_RUN command of bpf syscall

* configure.ac: Check for union bpf_attr.test.duration.
* bpf.c (decode_BPF_PROG_TEST_RUN): New function.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it.
* NEWS: Mention this.
* tests/bpf.c: Include "print_fields.h".
Add macro guard for BPF_PROG_TEST_RUN decoder test.
[HAVE_UNION_BPF_ATTR_TEST_DURATION] (sample_BPF_PROG_TEST_RUN_attr):
New variable.
[HAVE_UNION_BPF_ATTR_TEST_DURATION] (init_BPF_PROG_TEST_RUN_first,
print_BPF_PROG_TEST_RUN_first, init_BPF_PROG_TEST_RUN_attr,
print_BPF_PROG_TEST_RUN_attr): New functions.
(main) [HAVE_UNION_BPF_ATTR_TEST_DURATION]: Use them.

6 years agobpf: update BPF_MAP_CREATE decoding
Dmitry V. Levin [Sun, 19 Nov 2017 23:38:58 +0000 (23:38 +0000)]
bpf: update BPF_MAP_CREATE decoding

Implement decoding of union bpf_attr.numa_node field for BPF_MAP_CREATE
command introduced by linux kernel commit v4.14-rc1~130^2~196^2~1.

* configure.ac: Check for numa_node member of union bpf_attr
instead of inner_map_fd.
(decode_BPF_MAP_CREATE): Add numa_node field to the structure, print it.
* NEWS: Mention this.
* tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test.
(init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected
output.
(init_BPF_MAP_CREATE_attr): Initialize numa_node field, update offset.

6 years agounwind.c: cleanup
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:45:06 +0000 (08:45 +0200)]
unwind.c: cleanup

* unwind.c (rebuild_cache_if_invalid): Simplify return statement.

6 years agounwind.c: fix typo in comment
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:36:22 +0000 (08:36 +0200)]
unwind.c: fix typo in comment

* unwind.c (unwind_cache_invalidate, unwind_print_stacktrace,
unwind_capture_stacktrace): Replace strack with stack.

6 years agoipc_shm: decode hugetlb page size in shmget flags
Dmitry V. Levin [Sat, 18 Nov 2017 01:35:20 +0000 (01:35 +0000)]
ipc_shm: decode hugetlb page size in shmget flags

Decode alternative hugetlb page sizes introduced by kernel commit
v3.8-rc1~175^2~36.

* ipc_shm.c [!SHM_HUGE_SHIFT] (SHM_HUGE_SHIFT): New macro.
[!SHM_HUGE_MASK] (SHM_HUGE_MASK): Likewise.
(SYS_FUNC(shmget)): Print hugetlb page size.
* tests/ipc_shm.c: Check it.

6 years agomemfd_create: decode hugetlb page size
Dmitry V. Levin [Sat, 18 Nov 2017 00:19:31 +0000 (00:19 +0000)]
memfd_create: decode hugetlb page size

Decode alternative hugetlb page sizes introduced by kernel commit
v4.14-rc1~126^2~17.

* configure.ac (AC_CHECK_HEADERS): Add linux/memfd.h.
* memfd_create.c [HAVE_LINUX_MEMFD_H]: Include it.
[!MFD_HUGE_SHIFT] (MFD_HUGE_SHIFT): New macro.
[!MFD_HUGE_MASK] (MFD_HUGE_MASK): Likewise.
(SYS_FUNC(memfd_create)): Print hugetlb page size.
* tests/memfd_create.c: Check it.

6 years agoPrint the first argument of memfd_create syscall as a path
Dmitry V. Levin [Sat, 18 Nov 2017 00:19:31 +0000 (00:19 +0000)]
Print the first argument of memfd_create syscall as a path

The limit imposed by the kernel on the length of memfd_create first
argument is NAME_MAX - strlen("memfd:").

* memfd_create.c (SYS_FUNC(memfd_create)): Print the first argument
using printpathn.
* tests/memfd_create.c: Check it.

6 years agomem: decode hugetlb page size in mmap flags
Dmitry V. Levin [Fri, 17 Nov 2017 18:35:06 +0000 (18:35 +0000)]
mem: decode hugetlb page size in mmap flags

Decode alternative hugetlb page sizes introduced by kernel commit
v3.8-rc1~175^2~36.

* mem.c [!MAP_HUGE_SHIFT] (MAP_HUGE_SHIFT): New macro.
[!MAP_HUGE_MASK] (MAP_HUGE_MASK): Likewise.
(print_mmap_flags): Print hugetlb page size.
* NEWS: Mention it.
* tests/remap_file_pages.c: Check it.

6 years agomem: assume that MAP_TYPE is defined
Dmitry V. Levin [Fri, 17 Nov 2017 17:47:53 +0000 (17:47 +0000)]
mem: assume that MAP_TYPE is defined

Since linux kernel provided a definition of MAP_TYPE in <asm/mman.h>
as long ago as in v2.4.0, it's safe to assume that MAP_TYPE is defined.

* mem.c (print_mmap_flags) [!MAP_TYPE]: Remove.

6 years agomem: move printing of mmap_flags to a separate function
Dmitry V. Levin [Fri, 17 Nov 2017 17:47:53 +0000 (17:47 +0000)]
mem: move printing of mmap_flags to a separate function

* mem.c (print_mmap_flags): New function.
(print_mmap, SYS_FUNC(remap_file_pages)): Use it.

6 years agoProvide fallback definitions for SHM_EXEC constant
Dmitry V. Levin [Fri, 17 Nov 2017 11:26:55 +0000 (11:26 +0000)]
Provide fallback definitions for SHM_EXEC constant

Although SHM_EXEC is available in <linux/shm.h> since kernel commit
v2.6.9-rc2~23^2~93^2~78, the glibc version of <sys/shm.h> did not
provide SHM_EXEC until commit glibc-2.10~238.

* xlat/shm_flags.in (SHM_EXEC): Add fallback definition.
* tests/shmxt.c (SHM_EXEC): Likewise.

6 years agoUpdate SHM_* constants
Dmitry V. Levin [Fri, 17 Nov 2017 00:24:41 +0000 (00:24 +0000)]
Update SHM_* constants

* xlat/shm_flags.in: Add SHM_EXEC introduced by kernel commit
v2.6.9-rc2~23^2~93^2~78.
* xlat/shm_resource_flags.in: Add SHM_NORESERVE introduced by kernel
commit v2.6.15-rc1~622.
* NEWS: Mention this.
* tests/ipc_shm.c (main): Update expected output.
* tests/shmxt.c (main): Update expected output, check SHM_EXEC decoding.

6 years agoRemove fallback definitions for SHM_STAT and SHM_INFO constants
Dmitry V. Levin [Fri, 17 Nov 2017 00:24:41 +0000 (00:24 +0000)]
Remove fallback definitions for SHM_STAT and SHM_INFO constants

These constants are universally available for quite a long time
and are used unconditionally in tests without any complaints.

* xlat/shmctl_flags.in: Remove fallback definitions.

6 years agonet: fix SOL_NETLINK NETLINK_LIST_MEMBERSHIPS decoding
Dmitry V. Levin [Thu, 16 Nov 2017 02:27:40 +0000 (02:27 +0000)]
net: fix SOL_NETLINK NETLINK_LIST_MEMBERSHIPS decoding

NETLINK_LIST_MEMBERSHIPS, unlike all other SOL_NETLINK options, requests
not just a single integer but an array of integers.  The kernel also
supports a zero optlen NETLINK_LIST_MEMBERSHIPS request.

* net.c (print_uint32): New function.
(print_getsockopt): Add ulen argument, rename len argument to rlen,
<SOL_NETLINK> Handle NETLINK_LIST_MEMBERSHIPS using print_array
and print_uint32.
(SYS_FUNC(getsockopt)): Pass ulen to print_getsockopt.
* tests/sockopt-sol_netlink.c (main): Check NETLINK_LIST_MEMBERSHIPS
decoding.

6 years agotests: check [gs]etsockopt SOL_NETLINK decoding
Dmitry V. Levin [Thu, 16 Nov 2017 00:12:46 +0000 (00:12 +0000)]
tests: check [gs]etsockopt SOL_NETLINK decoding

* tests/sockopt-sol_netlink.c: New file.
* tests/gen_tests.in (sockopt-sol_netlink): New entry.
* tests/pure_executables.list: Add sockopt-sol_netlink.
* tests/.gitignore: Likewise.

6 years agonet: fix decoding of optval argument of [gs]etsockopt SOL_NETLINK
Dmitry V. Levin [Thu, 16 Nov 2017 00:12:46 +0000 (00:12 +0000)]
net: fix decoding of optval argument of [gs]etsockopt SOL_NETLINK

Tweak the parser to follow the kernel behaviour.

* net.c (print_getsockopt, print_setsockopt) <SOL_NETLINK>: Fetch and
print returned value as integer iff the length is >= sizeof(int),
otherwise print the address.
* NEWS: Mention this.

6 years agonet: decode optname argument of [gs]etsockopt for SOL_NETLINK level
Dmitry V. Levin [Wed, 15 Nov 2017 16:36:21 +0000 (16:36 +0000)]
net: decode optname argument of [gs]etsockopt for SOL_NETLINK level

* xlat/socknetlinkoptions.in: New file.
* net.c: Include "xlat/socknetlinkoptions.h".
(print_sockopt_fd_level_name) <SOL_NETLINK>: Print name using
socknetlinkoptions.
* NEWS: Metnion this.

6 years agoUpdate MSG_* constants
Dmitry V. Levin [Wed, 15 Nov 2017 16:14:40 +0000 (16:14 +0000)]
Update MSG_* constants

* xlat/msg_flags.in: Add MSG_ZEROCOPY introduced by kernel commit
v4.14-rc1~130^2~376^2~6.
* NEWS: Mention this.

6 years agonetlink: print descriptor attributes using printfd
Dmitry V. Levin [Wed, 15 Nov 2017 15:30:49 +0000 (15:30 +0000)]
netlink: print descriptor attributes using printfd

* nlattr.h (DECL_NLA(fd)): New prototype.
* nlattr.c (decode_nla_fd): New function.
* rtnl_link.c (ifla_xdp_nla_decoders) <IFLA_XDP_FD>: Use it.
(ifinfomsg_nla_decoders) <IFLA_NET_NS_FD>: Likewise.
* rtnl_nsid.c (rtgenmsg_nla_decoders) <NETNSA_FD>: Likewise.
* NEWS: Mention this.

6 years agomaint/update_copyright_years.sh: implement concurrent execution
Eugene Syromyatnikov [Tue, 14 Nov 2017 04:34:37 +0000 (05:34 +0100)]
maint/update_copyright_years.sh: implement concurrent execution

Analogous to the way it is done in xlat/gen.sh.

* maint/update_copyright_years.sh (MAX_JOBS): New variable, initialize
it to double the CPU count.
<while [ -n "${1:-}" ]; do case "$1" in>: Add -j option parsing.
(jobs, pids): New variables.
<git ls-files -- "$@" | grep -vFx "$IGNORED_FILES" | while read f; do>:
Execute process_file in background, count background jobs and wait
if there are too many.

6 years agomaint/update_copyright_years.sh: use -efu shell mode
Eugene Syromyatnikov [Tue, 14 Nov 2017 04:33:25 +0000 (05:33 +0100)]
maint/update_copyright_years.sh: use -efu shell mode

* maint/update_copyright_years.sh: Add -efu to shebang.  Adjust
the script for -efu shell mode.

6 years agoPost-release administrivia
Dmitry V. Levin [Tue, 14 Nov 2017 20:32:24 +0000 (20:32 +0000)]
Post-release administrivia

* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.20-1.
* strace.spec.in: Likewise.

6 years agoPrepare for 4.20 release v4.20
Dmitry V. Levin [Mon, 13 Nov 2017 20:21:22 +0000 (20:21 +0000)]
Prepare for 4.20 release

* NEWS: Update for 4.20 release.

6 years agoCREDITS.in: remove entries listed by maint/gen-contributors-list.sh
Dmitry V. Levin [Mon, 13 Nov 2017 20:21:22 +0000 (20:21 +0000)]
CREDITS.in: remove entries listed by maint/gen-contributors-list.sh

6 years agoMakefile.am: use gen-contributors-list.sh for CREDITS
Eugene Syromyatnikov [Mon, 13 Nov 2017 14:27:56 +0000 (15:27 +0100)]
Makefile.am: use gen-contributors-list.sh for CREDITS

* Makefile.am ($(srcdir)/CREDITS): Employ maint/gen-contributors-list.sh
for the contributor list generation.

6 years agomaint: make gen-contributors-list.sh suitable for generation of CREDITS
Eugene Syromyatnikov [Mon, 13 Nov 2017 14:21:13 +0000 (15:21 +0100)]
maint: make gen-contributors-list.sh suitable for generation of CREDITS

Implement various features in order to make it suitable for the
generation of the CREDITS file:
- add an option for including contributor e-mail;
- add an option to read additional list of contributors from stdin;
- add shorthand for referring to the initial commit of the branch;
- document all of the above in a help message.

* maint/gen-contributors-list.sh (print_help): New function.
(script): Rename to SCRIPT.
(SCRIPT_NORM_EMAILS, MATCH_OUT, OUT_EMAILS, OUT_NO_EMAILS, read_stdin,
include_email): New variables.
Add parsing of options, rewrite input processing.

6 years ago.mailmap: add more entries to avoid duplication in CREDITS
Dmitry V. Levin [Mon, 13 Nov 2017 20:21:22 +0000 (20:21 +0000)]
.mailmap: add more entries to avoid duplication in CREDITS

6 years ago.mailmap: sort entries
Dmitry V. Levin [Mon, 13 Nov 2017 20:21:22 +0000 (20:21 +0000)]
.mailmap: sort entries

6 years ago.mailmap: more deduplication
Eugene Syromyatnikov [Mon, 13 Nov 2017 14:29:04 +0000 (15:29 +0100)]
.mailmap: more deduplication

Of course there are no two persons in the whole world that share
the same name.

6 years agoCREDITS.in: use UTF-8 consistently
Dmitry V. Levin [Mon, 13 Nov 2017 20:21:22 +0000 (20:21 +0000)]
CREDITS.in: use UTF-8 consistently

In particular, do not use " symbols in names.

6 years agoCREDITS.in: add Jiri Slaby as a contributor
Eugene Syromyatnikov [Mon, 13 Nov 2017 16:34:37 +0000 (17:34 +0100)]
CREDITS.in: add Jiri Slaby as a contributor

Unfortunately, he wasn't mentioned in the message of the commit
v4.19-68-g48cb633, so let's fix that omission.

References: https://github.com/strace/strace/pull/16

6 years agos390, s390x: update ioctl entries from linux 4.14
Gleb Fotengauer-Malinovskiy [Mon, 13 Nov 2017 18:36:44 +0000 (21:36 +0300)]
s390, s390x: update ioctl entries from linux 4.14

* linux/s390/ioctls_arch0.h: Update from linux v4.14 using ioctls_gen.sh.
* linux/s390x/ioctls_arch0.h: Likewise.

6 years agos390x: remove some of non-s390 KVM ioctls
Gleb Fotengauer-Malinovskiy [Mon, 13 Nov 2017 18:29:23 +0000 (21:29 +0300)]
s390x: remove some of non-s390 KVM ioctls

* linux/s390x/ioctls_arch0.h: Regenerate.

6 years agomaint: remove KVM_PPC_CONFIGURE_V3_MMU ioctl from non-powerpc arches
Gleb Fotengauer-Malinovskiy [Mon, 13 Nov 2017 18:28:56 +0000 (21:28 +0300)]
maint: remove KVM_PPC_CONFIGURE_V3_MMU ioctl from non-powerpc arches

* maint/ioctls_sym.sh (ppc_list): Update.

6 years agoUpdate copyright headers
Dmitry V. Levin [Sun, 12 Nov 2017 00:11:06 +0000 (00:11 +0000)]
Update copyright headers

Headers updated semi-automatically using
maint/update_copyright_years.sh script.

* m4/mpers.m4: Update copyright years.
* tests/kcmp.c: Likewise.
* tests/membarrier.c: Likewise.

6 years agomaint/update_copyright_years.sh: fix typo in help output
Dmitry V. Levin [Sat, 11 Nov 2017 23:08:09 +0000 (23:08 +0000)]
maint/update_copyright_years.sh: fix typo in help output

* maint/update_copyright_years.sh (print_help): Fix typo, disable
here-document expansion.

6 years agoMove MIN, MAX, and CLAMP to macros.h
Eugene Syromiatnikov [Thu, 9 Nov 2017 16:39:18 +0000 (17:39 +0100)]
Move MIN, MAX, and CLAMP to macros.h

We shouldn't have to include the whole defs.h to get them.

* defs.h (MIN, MAX, CLAMP): Move ...
* macros.h: ... here.

6 years agoUpdate .mailmap
Eugene Syromiatnikov [Fri, 10 Nov 2017 17:35:18 +0000 (18:35 +0100)]
Update .mailmap

* .mailmap (Eugene Syromyatnikov): Add work address.

6 years agodebian: update debhelper compat level to 10, replace -s with -a in some calls
Steve McIntyre [Fri, 16 Dec 2016 10:24:28 +0000 (10:24 +0000)]
debian: update debhelper compat level to 10, replace -s with -a in some calls

6 years agodebian: update Standards-Version to 3.9.8
Steve McIntyre [Fri, 16 Dec 2016 10:23:53 +0000 (10:23 +0000)]
debian: update Standards-Version to 3.9.8

6 years agompers.m4: check for size of long and kernel_long_t
Dmitry V. Levin [Mon, 6 Nov 2017 19:21:58 +0000 (19:21 +0000)]
mpers.m4: check for size of long and kernel_long_t

The primary purpose of this new check is diagnostics.

* m4/mpers.m4 (st_MPERS): Check for size of long and kernel_long_t.

6 years agoxlat/gen.sh: speedup xlat generation
Eugene Syromyatnikov [Sat, 16 Sep 2017 00:30:40 +0000 (02:30 +0200)]
xlat/gen.sh: speedup xlat generation

This commit implements the following changes:
- increases the number of concurrent jobs to twice the CPU count;
- creates a circular buffer, so instead of running multiple jobs
  at once, the generator tries to keep about the same number of jobs
  being run concurrently;
- runs gen_git and gen_make concurrently in order to squeeze in
  one more bit of concurrency.

With my deeply scientific measurements, this approach achieves
up to 15% speedup with dash and about 30-40% with bash as /bin/sh
on a 4-core machine.

* xlat/gen.sh (main): Declare pids local variable, append pid of every
run job to it; increase the limit of jobs to ncpus * 2; when the limit
is reached, wait for the first pid in pids instead of resetting jobs
to zero and waiting for all the run jobs; put gen_git and gen_make
into background.

6 years agohppa: wire up statx syscall
Dmitry V. Levin [Sun, 5 Nov 2017 20:18:44 +0000 (20:18 +0000)]
hppa: wire up statx syscall

* linux/hppa/syscallent.h [349]: Add statx entry.

6 years agotests: check signal mask transparency
Dmitry V. Levin [Sat, 4 Nov 2017 23:43:55 +0000 (23:43 +0000)]
tests: check signal mask transparency

Starting with commit v4.17-5-gf83b49b strace is expected
to forward the signal mask to tracees unchanged.

* tests/check_sigblock.c: New file.
* tests/set_sigblock.c: Likewise.
* tests/sigblock.test: New test.
* tests/.gitignore: Add check_sigblock and set_sigblock.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add sigblock.test.

6 years agotests: check signal disposition transparency
Dmitry V. Levin [Fri, 3 Nov 2017 23:10:38 +0000 (23:10 +0000)]
tests: check signal disposition transparency

Starting with commit v4.17-8-ge97a66f strace is expected
to forward the signal disposition to tracees unchanged.

* tests/check_sigign.c: New file.
* tests/list_sigaction_signum.c: Likewise.
* tests/set_sigign.c: Likewise.
* tests/sigign.test: New test.
* tests/.gitignore: Add check_sigign, list_sigaction_signum,
and set_sigign.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add sigign.test.

6 years agotests: update futex test to accommodate the recent kernel change
Eugene Syromyatnikov [Fri, 3 Nov 2017 02:45:00 +0000 (03:45 +0100)]
tests: update futex test to accommodate the recent kernel change

Kernel commit v4.14-rc1~162^2~8 refactored futex implementation and
introduced checks for invalid shift sizes.  Accommodate this change
by allowing EINVAL in the corresponding futex checks.

* tests/futex.c (CHECK_FUTEX_GENERIC): Reset errno before the syscall.
(main) <wake_ops>: Add err2 field, describe err/err2 fields.
Add EINVAL as a possible errno to the checks that contain invalid
shift values.
Update return value check so it checks that values are strictly
as expected.

Closes: https://github.com/strace/strace/pull/16
6 years agotests: cleanup futex test
Eugene Syromyatnikov [Fri, 3 Nov 2017 02:45:00 +0000 (03:45 +0100)]
tests: cleanup futex test

* tests/futex.c (main) <wake_ops>: Remove unused errstr field
from the structure type definition.

6 years agoseccomp: decode SECCOMP_GET_ACTION_AVAIL operation
Dmitry V. Levin [Thu, 2 Nov 2017 00:21:57 +0000 (00:21 +0000)]
seccomp: decode SECCOMP_GET_ACTION_AVAIL operation

* defs.h (seccomp_ret_action): New xlat prototype.
* seccomp.c (decode_seccomp_set_mode_strict): Remove.
(SYS_FUNC(seccomp)): Decode SECCOMP_GET_ACTION_AVAIL operation.
* NEWS: Mention this.
* tests/seccomp_get_action_avail.c: New file.
* tests/gen_tests.in (seccomp_get_action_avail): New entry.
* tests/pure_executables.list: Add seccomp_get_action_avail.
* tests/.gitignore: Likewise.