]> granicus.if.org Git - strace/log
strace
6 years agodebian: sync with 4.21-1 package
Dmitry V. Levin [Sun, 25 Feb 2018 00:31:14 +0000 (00:31 +0000)]
debian: sync with 4.21-1 package

Versioned dependency on debhelper is not updated for backwards
compatibility.

* debian/changelog.in: Fix ancient changelog entries.
* debian/control (Build-Depends): Add dependency on libbluetooth-dev.
(Standards-Version): Update to 4.1.3.
(Vcs-Git, Vcs-Browser): Move from alioth to salsa.d.o.
(strace, strace-udeb) <Architecture>: Change to linux-any.
(strace64, strace-udeb) <Priority>: Change to optional.
* debian/rules: Use /usr/share/dpkg/architecture.mk instead of manually
setting build variables.
(configure): New target.
(build/Makefile, build-udeb/Makefile, build64/Makefile): Depend on it.
(binary-arch): Use build64/strace.1 for strace64 subpackage.
* debian/strace.manpages: Add build/ prefix.
* debian/strace64.manpages: Add build64/ prefix.

6 years agom4/mpers.m4: fix mpers name in comments added to config.h
Eugene Syromyatnikov [Fri, 23 Feb 2018 22:26:49 +0000 (23:26 +0100)]
m4/mpers.m4: fix mpers name in comments added to config.h

* m4/mpers.m4 (st_MPERS_STRUCT_STAT): Use mpers_name instead of
MPERS_NAME in comments generated by AC_DEFINE.

Fixes: v4.14~169 ("mpers.m4: check for struct stat64, struct stat, and their members")
6 years agompers.awk: use stdint.h instead of inttypes.h
Dmitry V. Levin [Sat, 24 Feb 2018 20:42:03 +0000 (20:42 +0000)]
mpers.awk: use stdint.h instead of inttypes.h

As <inttypes.h> is included in files generated by mpers.awk to obtain
definitions of uintNN_t types provided by <stdint.h>, replace the former
header with the latter.

* mpers.awk: Use <stdint.h> instead of <inttypes.h>.
* mpers_test.sh: Update expected output.

6 years agoWipe out references to defunct sourceforge
Dmitry V. Levin [Fri, 23 Feb 2018 23:18:56 +0000 (23:18 +0000)]
Wipe out references to defunct sourceforge

The old location of strace-devel mailing list is defunct, it used to
lose email messages and sometimes did not deliver any mails for days.

The mailing list has been moved to strace-devel@lists.strace.io.

* CREDITS.in: Update the mailing list address.
(Zhang Le): Update email address.
* README: Update the mailing list address.
* README.md: Likewise.
* configure.ac (AC_INIT): Likewise.
* strace.1.in (.SH REPORTING BUGS): Likewise.
* strace-log-merge.1.in (.SH REPORTING BUGS): Likewise.
* sched.c (SYS_FUNC(sched_getattr)): Update the mailing list reference.
* tests/scno_tampering.sh: Likewise.
* qemu_multiarch_testing/README: Update git repository address.
* NEWS: Mention the change of the mailing list address.

Closes: https://github.com/strace/strace/issues/38
6 years agom68k: fix build
Dmitry V. Levin [Wed, 21 Feb 2018 23:03:27 +0000 (23:03 +0000)]
m68k: fix build

When <sys/reg.h> is included after <linux/ptrace.h>, the build fails
on m68k with the following diagnostics:

  In file included from /usr/include/linux/ptrace.h:101:0,
                   from ptrace.h:51,
                   from sigreturn.c:2:
  /usr/include/m68k-linux-gnu/sys/reg.h:26:3: error: expected identifier
  before numeric constant
     PT_D1 = 0,
     ^

Apparently, the only architecture where strace needs definitions
provided by <sys/reg.h> is x86_64, other three (m68k, tile, and x86)
are fine with definitions already provided by <linux/ptrace.h>.

Fix the issue by getting rid of <sys/reg.h> and defining necessary
macros in linux/x86_64/arch_regs.h file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/reg.h.
* regs.h: Do not include <sys/reg.h>.
* linux/x86_64/arch_regs.h (R15, R14, R13, R12, RBP, RBX, R11, R10,
R9, R8, RAX, RCX, RDX, RSI, RDI, ORIG_RAX, RIP, CS, EFLAGS, RSP, SS,
FS_BASE, GS_BASE, DS, ES, FS, GS): New macros.
* NEWS: Mention this fix.

Fixes: v4.21~21 ("Include <sys/ptrace.h> early")
6 years agoDemote sourceforge.net
Dmitry V. Levin [Thu, 15 Feb 2018 11:07:03 +0000 (11:07 +0000)]
Demote sourceforge.net

https://sourceforge.net/p/strace/code/ is defunct: it doesn't accept
new commits for too long.
Likewise, https://sourceforge.net/projects/strace/files/ doesn't accept
new files for too long.

* README.md: Remove sourceforge.net URL.
* debian/copyright: Replace the sourceforge.net based strace project URL
with a github based one.
* strace.spec.in (Source): Likewise.

6 years agoUpdate copyright headers
Dmitry V. Levin [Thu, 15 Feb 2018 11:07:03 +0000 (11:07 +0000)]
Update copyright headers

* COPYING: Update copyright year number range.
* debian/copyright: Sync with COPYING.

6 years agoPost-release administrivia
Dmitry V. Levin [Wed, 14 Feb 2018 03:00:00 +0000 (03:00 +0000)]
Post-release administrivia

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

6 years agoPrepare for 4.21 release v4.21
Dmitry V. Levin [Tue, 13 Feb 2018 23:00:00 +0000 (23:00 +0000)]
Prepare for 4.21 release

* NEWS: Update for 4.21 release.

6 years agotests/s390_sthyi.c: skip the test if s390_sthyi returns an error
Eugene Syromyatnikov [Tue, 13 Feb 2018 22:57:27 +0000 (23:57 +0100)]
tests/s390_sthyi.c: skip the test if s390_sthyi returns an error

tests/s390_sthyi.c (main): replace error_msg_and_fail with
error_msg_and_skip if rc is non-zero.

6 years agoUpdate copyright headers
Dmitry V. Levin [Tue, 13 Feb 2018 22:00:00 +0000 (22:00 +0000)]
Update copyright headers

Headers updated automatically using maint/update_copyright_years.sh
script.

6 years agoRemove old and unused maintenance scripts
Eugene Syromyatnikov [Tue, 13 Feb 2018 21:00:46 +0000 (22:00 +0100)]
Remove old and unused maintenance scripts

Firewell, last witnesses of bygone era.

* linux/sparc/gen.pl: Remove.
* linux/x86_64/gentab.pl: Likewise.
* xlate.el: Likewise.
* Makefile.am (EXTRA_DIST): Remove them.

Suggested-by: Elvira Khabirova <lineprinter@altlinux.org>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoConsistently use MAX_ERRNO_VALUE
Dmitry V. Levin [Tue, 13 Feb 2018 05:05:13 +0000 (05:05 +0000)]
Consistently use MAX_ERRNO_VALUE

* filter_qualify.c (parse_inject_token): Replace 4095
with MAX_ERRNO_VALUE.
* negated_errno.h (is_negated_errno): Likewise.  Remove redundant
comment.

6 years agoExport SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests
Dmitry V. Levin [Tue, 13 Feb 2018 04:17:08 +0000 (04:17 +0000)]
Export SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests

* configure.ac (AC_SUBST): Add SIZEOF_LONG and SIZEOF_KERNEL_LONG_T.
* tests/Makefile.am (SIZEOF_LONG, SIZEOF_KERNEL_LONG_T): New variables.
(AM_TEST_LOG_FLAGS): Pass them.
* bootstrap: Substitute them.

6 years agotests: avoid ioctl_kvm_run test failure when built with gcc -O0
Eugene Syromyatnikov [Tue, 13 Feb 2018 01:38:54 +0000 (02:38 +0100)]
tests: avoid ioctl_kvm_run test failure when built with gcc -O0

When built with -O0, gcc (rightfully) generates function prologue, which
results in writing %rbp to the stack, causing premature KVM_EXIT_MMIO.
It could be possible to avoid such problems by "naked" attribute but,
unfortunately, the latter is not available on x86 with older GCC.
A trick suggested in [1] is used instead: assembly is moved
to the global scope.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50242#c3

* tests/ioctl_kvm_run.c (code): Remove function.
Add globally scoped __asm__ with the function code and its size.
(code, code_size): New extern symbols declarations.
(run_kvm): Remove code_size definition and initialization.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests/ioctl_kvm_run.c: add KVM_EXIT_MMIO diagnostics
Eugene Syromyatnikov [Tue, 13 Feb 2018 01:37:19 +0000 (02:37 +0100)]
tests/ioctl_kvm_run.c: add KVM_EXIT_MMIO diagnostics

As it has proven itself useful.

* tests/ioctl_kvm_run.c (run_kvm) <case KVM_EXIT_MMIO:>: Fail
on unexpected KVM_EXIT_MMIO, providing relevant diagnostics.

6 years agotests: add compatibility layer for accept call
Eugene Syromyatnikov [Tue, 13 Feb 2018 01:03:16 +0000 (02:03 +0100)]
tests: add compatibility layer for accept call

Recent glibc (since version 2.26) uses accept4 syscall for implementing
accept call on sparc.  Unfortunately, it's impossible to simply fall
back on raw syscall as it had not been wired up until linux commit
v4.4-rc8~4^2~1.

* tests/accept_compat.h: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/net-y-unix.c: Include accept_compat.h, use do_accept()
instead of accept() calls.
* tests/net-yy-inet.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/net.expected: Allow accept4.

6 years agodebian: build strace-udeb separately
Dmitry V. Levin [Mon, 12 Feb 2018 18:28:16 +0000 (18:28 +0000)]
debian: build strace-udeb separately

* debian/rules (extra_build_targets): Add build-udeb-stamp.
(build-udeb/Makefile): New rule.
(clean): Remove build-udeb.
* debian/strace-udeb.install: Update.

Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826223
6 years agoEnable symbol demangling in deb- and rpm-driven builds
Dmitry V. Levin [Mon, 12 Feb 2018 18:28:16 +0000 (18:28 +0000)]
Enable symbol demangling in deb- and rpm-driven builds

* debian/control (Build-Depends) [amd64]: Add libiberty-dev.
* strace.spec.in (buildrequires_libunwind_devel): Add binutils-devel.

6 years agodebian: re-enable -k option on x86_64
Dmitry V. Levin [Mon, 12 Feb 2018 18:28:16 +0000 (18:28 +0000)]
debian: re-enable -k option on x86_64

This partially reverts commit v4.13~177.

* debian/control (Build-Depends) [amd64]: Add libunwind-dev.

6 years agoAdd "strace -V" output to build log
Dmitry V. Levin [Mon, 12 Feb 2018 18:28:16 +0000 (18:28 +0000)]
Add "strace -V" output to build log

* strace.spec.in (%check): Print "strace -V" output before
running the test suite.
* debian/rules (%-stamp): Likewise.

6 years agoxlat: update NT_* constants
Eugene Syromyatnikov [Mon, 12 Feb 2018 19:16:08 +0000 (20:16 +0100)]
xlat: update NT_* constants

* xlat/nt_descriptor_types.in (NT_PPC_PKEY): New constant introduced
by linux kernel commit v4.16-rc1~93^2~72.

6 years agoUpdate the list of PKEY_* constants
Eugene Syromyatnikov [Mon, 12 Feb 2018 18:01:10 +0000 (19:01 +0100)]
Update the list of PKEY_* constants

* xlat/pkey_access.in (PKEY_DISABLE_EXECUTE): New constant introduced
by linux kernel commit v4.16-rc1~93^2~85.
* tests/pkey_alloc.c: Update expected output.
* NEWS: Mention it.

6 years agopowerpc, powerpc64: wire up pkey_* syscalls
Eugene Syromyatnikov [Mon, 12 Feb 2018 17:58:28 +0000 (18:58 +0100)]
powerpc, powerpc64: wire up pkey_* syscalls

* linux/powerpc/syscallent.h [384..386]: Add pkey_alloc,
pkey_free, and pkey_mprotect syscalls introduced by linux kernel
commits v4.16-rc1~93^2~70 and v4.16-rc1~93^2~69, respectively.
* linux/powerpc64/syscallent.h: Likewise.
* NEWS: Mention it.

6 years agoUpdate NEWS
Eugene Syromyatnikov [Mon, 12 Feb 2018 00:25:26 +0000 (01:25 +0100)]
Update NEWS

6 years agolinux/ia64: remove IA-32 mode support
Eugene Syromyatnikov [Sun, 11 Feb 2018 21:50:38 +0000 (22:50 +0100)]
linux/ia64: remove IA-32 mode support

There is no compat support in strace and there are no systems
within reach that would allow to test it.

* linux/ia64/arch_regs.c (IA64_PSR_IS, ia64_ia32mode): Remove.
* linux/ia64/get_error.c (get_error): Remove ia64_ia32mode branch.
* linux/ia64/get_scno.c (arch_get_scno): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/ia64/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/ia64/set_scno.c (arch_set_scno): Likewise.

6 years agosyscall.c: parse return code second time after injecting
Eugene Syromyatnikov [Thu, 8 Feb 2018 10:42:19 +0000 (11:42 +0100)]
syscall.c: parse return code second time after injecting

In order to have the same view as tracee has, with regards to
"never fail" syscalls.

* syscall.c (tamper_with_syscall_exiting): Call get_error after the
return value tampering to re-initialise u_rval and u_error fields
of struct tcb.

6 years agosparc: mark as an architecture that has a dedicated error register
Eugene Syromyatnikov [Sun, 11 Feb 2018 23:39:09 +0000 (00:39 +0100)]
sparc: mark as an architecture that has a dedicated error register

* linux/sparc/arch_defs_.h (HAVE_ARCH_DEDICATED_ERR_REG): New macro,
define to 1.

6 years agostrace.1.in: ffix
Eugene Syromyatnikov [Sun, 11 Feb 2018 04:22:38 +0000 (05:22 +0100)]
strace.1.in: ffix

6 years agoInclude <sys/ptrace.h> early
Dmitry V. Levin [Sun, 11 Feb 2018 00:26:09 +0000 (00:26 +0000)]
Include <sys/ptrace.h> early

Include "ptrace.h" before any header that can include <signal.h>
because on some architectures the latter may include <asm/sigcontext.h>
which in turn may include <asm/ptrace.h> with potentially devastating
effect on <sys/ptrace.h>.

* process.c: Include "ptrace.h" before "regs.h".
* rt_sigframe.c: Likewise.
* sigreturn.c: Include "ptrace.h" before "nsig.h".
* syscall.c: Likewise.
* wait.c: Include "ptrace.h" before <sys/wait.h>.
* strace.c: Include "ptrace.h" before <signal.h>.
* tests/ptrace.c: Likewise.
* tests/test_ucopy.c: Include <sys/ptrace.h> before <signal.h>.

6 years agoInclude <limits.h> instead of <sys/param.h>
Dmitry V. Levin [Sun, 11 Feb 2018 00:26:09 +0000 (00:26 +0000)]
Include <limits.h> instead of <sys/param.h>

Do not include <sys/param.h> unnecessarily as it includes <signal.h>.

* pathtrace.c: Include <limits.h> instead of <sys/param.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
* tests/getcwd.c: Likewise.
* tests/group_req.c: Likewise.
* tests/inode_of_sockfd.c: Likewise.
* tests/ip_mreq.c: Likewise.
* tests/printpath-umovestr.c: Likewise.
* tests/qual_fault.c: Likewise.
* tests/test_printpath.c: Likewise.
* tests/umovestr3.c: Likewise.
* tests/net-y-unix.c: Do not include <sys/param.h>.
* tests/net-yy-unix.c: Likewise.

6 years agobasic_filters.c: introduce scno_by_name
Eugene Syromyatnikov [Thu, 1 Feb 2018 12:49:54 +0000 (13:49 +0100)]
basic_filters.c: introduce scno_by_name

As it will be used elsewhere.

* basic_filters.c (scno_by_name): New function.
(qualify_syscall_name): Use it.
* defs.h (scno_by_name): New declaration.

6 years agoxstring.h: rephrase xappendstr description a bit
Eugene Syromyatnikov [Sat, 10 Feb 2018 13:43:16 +0000 (14:43 +0100)]
xstring.h: rephrase xappendstr description a bit

6 years agoxlat.c: return NULL in sprintflags if there are no flags
Eugene Syromyatnikov [Wed, 7 Feb 2018 01:13:57 +0000 (02:13 +0100)]
xlat.c: return NULL in sprintflags if there are no flags

Otherwise the auxstr is rather ugly at times.

* xlat.c (sprintflags): Return NULL if no flags were printed.

6 years agoChange type of injected rval to kernel_long_t
Eugene Syromyatnikov [Thu, 1 Feb 2018 11:34:05 +0000 (12:34 +0100)]
Change type of injected rval to kernel_long_t

* defs.h (struct inject_data): Change type of rval field to
kernel_ulong_t.
* filter_qualify.c (parse_inject_token): Use string_to_kulong instead of
string_to_uint for rval parsing.  Warn if retval is clipped in compat
personality.

6 years agoMark architectures that indicate syscall error in a dedicated register
Eugene Syromyatnikov [Sat, 10 Feb 2018 00:43:54 +0000 (01:43 +0100)]
Mark architectures that indicate syscall error in a dedicated register

* linux/alpha/arch_defs_.h (HAVE_ARCH_DEDICATED_ERR_REG): New macro,
define to 1.
* linux/ia64/arch_defs_.h: Likewise.
* linux/mips/arch_defs_.h: Likewise.
* linux/powerpc/arch_defs_.h: Likewise.
* linux/powerpc64/arch_defs_.h: Likewise.
* linux/sparc64/arch_defs_.h: Likewise.
* linux/arch_defs_.h [!HAVE_ARCH_DEDICATED_ERR_REG]
(HAVE_ARCH_DEDICATED_ERR_REG): New macro, define to 0.
* linux/nios2/arch_defs_.h: New file.
* Makefile.am (EXTRA_DIST): Add it.

6 years agoMake string_to_uint_ex more universal
Eugene Syromyatnikov [Thu, 1 Feb 2018 11:31:21 +0000 (12:31 +0100)]
Make string_to_uint_ex more universal

And add support for reading of various types.

* string_to_uint.c (string_to_uint_ex): Change to work with long long.
(string_to_uint): Move it...
* string_to_uint.h (string_to_uint): ...here.
(string_to_uint_upto): Accept long long as max_val, return long long.
(string_to_ulong, string_to_kulong, string_to_ulonglong): New functions,
for completeness.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoAdd pure syscall flag
Eugene Syromyatnikov [Wed, 7 Feb 2018 17:46:54 +0000 (18:46 +0100)]
Add pure syscall flag

* basic_filters.c (lookup_class) <syscall_class>: Add "%pure" for
TRACE_PURE.
* sysent.h (TRACE_PURE): New syscall flag.
* sysent_shorthand_defs.h (PU): New shorthand macro.
* linux/32/syscallent.h ([172], [173], [174], [175], [176], [177],
[178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid,
getegid, gettid syscalls.
* linux/64/syscallent.h ([172], [173], [174], [175], [176], [177],
[178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid,
getegid, gettid syscalls.
* linux/aarch64/syscallent.h ([1060]): Add PU flag to getpgrp syscalls.
* linux/alpha/syscallent.h ([20], [24], [47], [63], [64], [89],
[378]): Add PU flag to getxpid, getxuid, getxgid, getpgrp, getpagesize,
getdtablesize, gettid syscalls.
* linux/arc/syscallent.h ([246]): Add PU flag to arc_gettls syscalls.
* linux/arm/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224], [ARM_FIRST_SHUFFLED_SYSCALL+1+6]):
Add PU flag to getpid, getuid, getgid, geteuid, getegid, getppid,
getpgrp, getuid32, getgid32, geteuid32, getegid32, gettid, get_tls
syscalls.
* linux/avr32/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[176]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/bfin/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/hppa/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[206]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/i386/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/ia64/syscallent.h ([1041], [1042], [1046], [1047], [1062],
[1063], [1105], [1171]): Add PU flag to getpid, getppid, getuid,
geteuid, getgid, getegid, gettid, getpagesize syscalls.
* linux/m68k/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [166], [199], [200], [201], [202], [221], [333]): Add PU flag
to getpid, getuid, getgid, geteuid, getegid, getppid, getpgrp,
getpagesize, getuid32, getgid32, geteuid32, getegid32, gettid,
get_thread_area syscalls.
* linux/metag/syscallent.h ([248]): Add PU flag to metag_get_tls
syscalls.
* linux/microblaze/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [199], [200], [201], [202], [224]): Add PU flag to getpid,
getuid, getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/powerpc64/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/powerpc/syscallent.h ([20], [24], [47], [49], [50], [64],
[65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/s390/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [236]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/s390x/syscallent.h ([20], [64], [65], [199], [200], [201],
[202], [236]): Add PU flag to getpid, getppid, getpgrp, getuid,
getgid, geteuid, getegid, gettid syscalls.
* linux/sh64/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [252]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/sh/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
geteuid32, getegid32, gettid syscalls.
* linux/sparc64/syscallent.h ([20], [24], [47], [49], [50], [64], [81],
[143], [197], [340]): Add PU flag to getpid, getuid, getgid, geteuid,
getegid, getpagesize, getpgrp, gettid, getppid, kern_features syscalls.
* linux/sparc/syscallent.h ([20], [24], [44], [47], [49], [50], [53],
[64], [69], [70], [81], [143], [197], [340]): Add PU flag to getpid,
getuid, getuid32, getgid, geteuid, getegid, getgid32, getpagesize,
geteuid32, getegid32, getpgrp, gettid, getppid, kern_features syscalls.
* linux/x32/syscallent.h ([39], [102], [104], [107], [108], [110],
[111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/x86_64/syscallent.h ([39], [102], [104], [107], [108], [110],
[111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
getppid, getpgrp, gettid syscalls.
* linux/xtensa/syscallent.h ([120], [127], [137], [139], [140], [141],
[150], [151]): Add PU flag to getpid, gettid, getuid, getgid, geteuid,
getegid, getppid, getpgrp syscalls.
* strace.1.in (.SS Filtering): Document it.
* NEWS: Mention it.

6 years agosyscall.c: warn if tampering failed
Eugene Syromyatnikov [Wed, 7 Feb 2018 01:16:50 +0000 (02:16 +0100)]
syscall.c: warn if tampering failed

6 years agosyscall.c: set errno if syscall is tampered
Eugene Syromyatnikov [Wed, 7 Feb 2018 01:17:18 +0000 (02:17 +0100)]
syscall.c: set errno if syscall is tampered

6 years agotests/nsyscall-d.test: swap exp and log in diff calls
Eugene Syromyatnikov [Fri, 9 Feb 2018 20:48:16 +0000 (21:48 +0100)]
tests/nsyscall-d.test: swap exp and log in diff calls

In line with the rest of the tests.

* tests/nsyscalls-d.test: swap arguments of match_diff calls.

6 years agolinux/arm/get_scno.c: use debug_msg
Eugene Syromyatnikov [Fri, 9 Feb 2018 20:47:16 +0000 (21:47 +0100)]
linux/arm/get_scno.c: use debug_msg

* linux/arm/get_scno.c (arch_get_scno): replace if (debug_flag) {
error_msg() } with debug_msg() call.

6 years agoDo not shuffle scno inside syscall_name
Eugene Syromyatnikov [Thu, 1 Feb 2018 11:50:31 +0000 (12:50 +0100)]
Do not shuffle scno inside syscall_name

This makes interface a bit irregular otherwise.

* defs.h (syscall_name): Clarify description.
* syscall.c (syscall_name): Do not call shuffle_scno.
* printsiginfo.c (print_si_info) <case SIGSYS>: Use shuffle_scno.

6 years agoHandle very special __ARM_NR_-prefixed syscalls
Eugene Syromyatnikov [Wed, 31 Jan 2018 19:28:56 +0000 (20:28 +0100)]
Handle very special __ARM_NR_-prefixed syscalls

* linux/aarch64/nr_prefix.c: New file.
* linux/arm/nr_prefix.c: Likewise.
* linux/nr_prefix.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* printsiginfo.c: Include nr_prefix.c
(print_si_info): Use nr_prefix.

6 years agoMake shuffle_scno globally available
Eugene Syromyatnikov [Thu, 1 Feb 2018 11:48:44 +0000 (12:48 +0100)]
Make shuffle_scno globally available

* syscall.c (shuffle_scno): Move the declaration...
* defs.h (shuffle_scno): ...here. Remove static qualifier.
* linux/aarch64/shuffle_scno.c (shuffle_scno): Remove static qualifier.
* linux/arm/shuffle_scno.c: Likewise.
* linux/shuffle_scno.c: Likewise.
* linux/x32/shuffle_scno.c: Likewise.
* linux/x86_64/shuffle_scno.c: Likewise.

6 years agosyscall.c: use shuffle_scno in syscall_name
Eugene Syromyatnikov [Wed, 31 Jan 2018 19:12:14 +0000 (20:12 +0100)]
syscall.c: use shuffle_scno in syscall_name

syscall_name() is used only in printsiginfo.c:print_si_info currently,
and is supplied with raw syscall number (that's why it has this ugly
__X32_SYSCALL_BIT hack). But since it handled only __X32_SYSCALL_BIT and
not shuffle_scno(), it was broken on ARM.  Let's replace it with shuffle_scno
call, as it handles both the case of shuffled ARM syscalls and the
__X32_SYSCALL_BIT.

* syscall.c (syscall_name): Call shuffle_scno instead of custom
__X32_SYSCALL_BIT handling.

6 years agoUse shuffle_scno for x32 syscall numbers
Eugene Syromyatnikov [Wed, 31 Jan 2018 19:08:29 +0000 (20:08 +0100)]
Use shuffle_scno for x32 syscall numbers

This changes behaviour of printing of unknown syscall.

* linux/x32/shuffle_scno.c: New file.
* linux/x86_64/shuffle_scno.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* linux/x86_64/get_scno.c (arch_get_scno): Do not clear
__X32_SYSCALL_BIT.
* tests/nsyscalls.c: Update expected output.

6 years agoMove shuffle_scno() invocation to get_scno
Eugene Syromyatnikov [Wed, 31 Jan 2018 19:06:31 +0000 (20:06 +0100)]
Move shuffle_scno() invocation to get_scno

* linux/aarch64/get_scno.c (arch_get_scno): Remove shuffle_scno call.
* linux/arm/get_scno.c (arch_get_scno): Remove shuffle_scno calls.
* syscall.c (get_scno): Call shuffle_scno after arch_get_scno.

6 years agoMove shuffle_scno to arch-specific file
Eugene Syromyatnikov [Wed, 31 Jan 2018 18:59:48 +0000 (19:59 +0100)]
Move shuffle_scno to arch-specific file

While we are here, let's fix AArch64 by limiting scno shuffling
to compat personality only.

* syscall.c: Include shuffle_scno.c.
(shuffle_scno): Move it to a...
* linux/arm/shuffle_scno.c: New file.
* linux/aarch64/shuffle_scno.c: New file, define arm's shuffle_scno
as arm_shuffle_scno and call it only for personality 1.
* linux/shuffle_scno.c: New file, fallback trivial shuffle_scno
definition.
* Makefile.am (EXTRA_DIST): Add them.

6 years agoPrint unknown syscall number in hexadecimal
Eugene Syromyatnikov [Tue, 6 Feb 2018 02:30:41 +0000 (03:30 +0100)]
Print unknown syscall number in hexadecimal

* syscall.c (struct sysent_buf): Update buf field size.
(get_scno): Print unknown syscall number in hexadecimal form.
* tests/nsyscalls.c: Update expected output.
* strace.1.in: Document it.
* NEWS: Mention it.

6 years agotests/accept.c: call accept syscall directly, if available
Eugene Syromyatnikov [Thu, 8 Feb 2018 10:58:30 +0000 (11:58 +0100)]
tests/accept.c: call accept syscall directly, if available

* tests/accept.c [__NR_accept && !TEST_SYSCALL_NAME]: Define a wrapper that
calls accept directly.
* tests/sockname.c [TEST_SYSCALL_STR]: Do not define TEST_SYSCALL_STR.

6 years agoprintsiginfo.c: add a comment about personality detection for SIGSYS
Eugene Syromyatnikov [Thu, 1 Feb 2018 10:46:57 +0000 (11:46 +0100)]
printsiginfo.c: add a comment about personality detection for SIGSYS

Looks like it is not necessary, after all.

6 years agolinux/x86_64/set_error.c: update eax for compat personality
Eugene Syromyatnikov [Thu, 8 Feb 2018 10:40:01 +0000 (11:40 +0100)]
linux/x86_64/set_error.c: update eax for compat personality

Since this is where get_error gets the return value from in the compat case.

linux/x86_64/set_error.c (set_error, set_success): Update i386_regs.eax
if tracee is in compat personality.

6 years agoMark various arch-specific syscalls with SYSCALL_NEVER_FAILS
Eugene Syromyatnikov [Wed, 7 Feb 2018 01:07:43 +0000 (02:07 +0100)]
Mark various arch-specific syscalls with SYSCALL_NEVER_FAILS

* linux/alpha/syscallent.h (getpagesize, getdtablesize): Add NF flag.
* linux/arc/syscallent.h (arc_gettls): Likewise.
* linux/arm/syscallent.h (get_tls): Likewise.
* linux/ia64/syscallent.h (getpagesize): Likewise.
* linux/m68k/syscallent.h (getpagesize, get_thread_area): Likewise.
* linux/sparc/syscallent.h (getpagesize): Likewise.
* linux/sparc64/syscallent.h (getpagesize): Likewise.

6 years agoAdd SYSCALL_NEVER_FAILS flag to getpgrp
Eugene Syromyatnikov [Wed, 7 Feb 2018 00:58:51 +0000 (01:58 +0100)]
Add SYSCALL_NEVER_FAILS flag to getpgrp

As glibc, at least, treats it this way.

* linux/aarch64/syscallent.h (getpgrp): Add NF flag.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/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.

6 years agolinux/x86_64/get_error.c: do not sign-extend if no error happened
Eugene Syromyatnikov [Wed, 7 Feb 2018 01:19:06 +0000 (02:19 +0100)]
linux/x86_64/get_error.c: do not sign-extend if no error happened

6 years agotests/membarrier.c: fix expected output on nohz_full systems
Eugene Syromyatnikov [Thu, 8 Feb 2018 10:09:01 +0000 (11:09 +0100)]
tests/membarrier.c: fix expected output on nohz_full systems

If nohz_full is enabled, MEMBARRIER_CMD_GLOBAL is not available.

* tests/membarrier.c: check availability of MEMBARRIER_CMD_GLOBAL
separately.

6 years agoUpdate MEMBARRIER_CMD_* constants
Eugene Syromyatnikov [Thu, 8 Feb 2018 10:01:52 +0000 (11:01 +0100)]
Update MEMBARRIER_CMD_* constants

* xlat/membarrier_cmds.in: Add new constants, rename
MEMBARRIER_CMD_SHARED to MEMBARRIER_CMD_GLOBAL.
* NEWS: Mention this.
* tests/membarrier.c (main): Update expected output.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoperf.c: print group_fd argument of perf_event_open syscall as fd
Eugene Syromyatnikov [Wed, 7 Feb 2018 13:45:02 +0000 (14:45 +0100)]
perf.c: print group_fd argument of perf_event_open syscall as fd

* perf.c (SYS_FUNC(perf_event_open)): Print 4th argument using printfd.

6 years agosyscall.c: print higher bits of syscall return value on x32 personality
Eugene Syromyatnikov [Tue, 6 Feb 2018 23:58:30 +0000 (00:58 +0100)]
syscall.c: print higher bits of syscall return value on x32 personality

* syscall.c (syscall_exiting_trace): Check for current_klongsize instead
of current_wordsize to determine the size of tcp->u_rval.

6 years agostrace.1.in: history update
Eugene Syromyatnikov [Tue, 6 Feb 2018 01:21:28 +0000 (02:21 +0100)]
strace.1.in: history update

strace.1.in (.SH HISTORY): Some amendments based on
https://github.com/strace/strace-talks/blob/master/2012-ossdevconf-obninsk-strace_from_upstream_PoV/ossdevconf_2012-slides-strace_from_upstream_PoV.tex

6 years agostrace.1.in: minor changes
Eugene Syromyatnikov [Tue, 6 Feb 2018 01:12:59 +0000 (02:12 +0100)]
strace.1.in: minor changes

* strace.1.in (.SH DESCRIPTION): s/a passion/passion/,
s/Here the/Here, the/, s/Where traditional/Where the traditional/,
s/output has proven/output is proven/, s/In all cases/In most cases,/ΒΈ
embolden st_mode, lstat, SIGCHLD, and SIGTTOU mentions,
s/In some cases /In some cases, /
(.SS Output format) <-o>: de-italicize dot in "filename.pid", convert
the sentence's voice to passive, some other rephrasing.  Mention
incompatibility of output piping with -ff mode.
(.SS Output options) <-t>: s/time of day/wall clock time/.
(.SS Statistics) <-c>: Remove "on Linux" mention, -F option mention.

6 years agoREADME.md: add information about git repository location
Eugene Syromyatnikov [Mon, 5 Feb 2018 17:45:55 +0000 (18:45 +0100)]
README.md: add information about git repository location

* README.md: Mention URLs for SourceForge, GitHub, and GitLab
repositories.

6 years agotests: rewrite net-accept-connect.c without strncpy
Dmitry V. Levin [Wed, 7 Feb 2018 12:32:57 +0000 (12:32 +0000)]
tests: rewrite net-accept-connect.c without strncpy

gcc8 -Wall -Werror rejects our method of struct sockaddr_un.sun_path
initialization because the field lacks __nonstring__ attribute.

As we calculate the length of the string being copied anyway,
workaround this gcc+glibc bug by changing the code to use this
pre-calculated length and get rid of strncpy completely.

* tests/net-accept-connect.c (main): Use memcpy to initialize sun_path.

6 years agoUse kernel's fcntl.h header instead of libc's for open_mode_flags
Dmitry V. Levin [Fri, 2 Feb 2018 19:39:23 +0000 (19:39 +0000)]
Use kernel's fcntl.h header instead of libc's for open_mode_flags

As definitions of O_* macros provided by various libc implementations
are usually less reliable than those provided by kernel headers, switch
to use kernel's fcntl.h header.

* open.c: Include <asm/fcntl.h> instead of <fcntl.h>.  Remove
O_LARGEFILE fallback definitions assuming that the kernel headers
provide them.
* xlat/open_mode_flags.in: Add __O_SYNC after O_SYNC.  Add O_TMPFILE
and __O_TMPFILE before O_DIRECTORY.  Remove "O_TMPFILE & ~O_DIRECTORY".
* tests/open.c: Include <asm/fcntl.h> instead of <fcntl.h>.  Remove
workarounds for libc O_TMPFILE implementations.
* tests/openat.c: Include <asm/fcntl.h> instead of <fcntl.h>.
(test_mode_flag): New function.
(main): Use it to check decoding of all access modes and file flags.
* tests/gen_tests.in (openat): Add -a option.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: update TCP_* constants
Dmitry V. Levin [Sun, 4 Feb 2018 00:22:01 +0000 (00:22 +0000)]
xlat: update TCP_* constants

* xlat/socktcpoptions.in: Add TCP_FASTOPEN_KEY and
TCP_FASTOPEN_NO_COOKIE introduced by linux kernel commits
v4.15-rc1~84^2~387 and v4.15-rc1~84^2~339, respectively.
* NEWS: Mention this.

6 years agoxlat: update IPV6_* constants
Dmitry V. Levin [Sat, 3 Feb 2018 00:19:17 +0000 (00:19 +0000)]
xlat: update IPV6_* constants

* xlat/sockipv6options.in: Add IPV6_FREEBIND introduced by linux kernel
commit v4.15-rc1~84^2~601.
* NEWS: Mention this.

6 years agoxlat: update MAP_* constants
Dmitry V. Levin [Fri, 2 Feb 2018 00:21:16 +0000 (00:21 +0000)]
xlat: update MAP_* constants

* xlat/mmap_flags.in: Add MAP_SHARED_VALIDATE and MAP_SYNC introduced
by linux kernel commits v4.15-rc1~71^2^2~23 and v4.15-rc1~71^2^2~12,
respectively.
* NEWS: Mention this.

6 years agotests: avoid triggering -Wstringop-truncation in ioctl_dm.c
Eugene Syromyatnikov [Tue, 6 Feb 2018 01:26:35 +0000 (02:26 +0100)]
tests: avoid triggering -Wstringop-truncation in ioctl_dm.c

* tests/ioctl_dm.c: Replace strncpy calls with memcpy as the character
arrays being copied are not C strings.

6 years agoMakefile.am: minor EXTRA_DIST formatting changes
Eugene Syromyatnikov [Wed, 31 Jan 2018 18:19:48 +0000 (19:19 +0100)]
Makefile.am: minor EXTRA_DIST formatting changes

6 years agoMove large file-related wrappers to a separate header
Eugene Syromyatnikov [Tue, 30 Jan 2018 09:09:54 +0000 (10:09 +0100)]
Move large file-related wrappers to a separate header

* strace.c [_LARGEFILE64_SOURCE]: Move the definitions under it to a...
* largefile_wrappers.h: ... new file.
* Makefile.am (strace_SOURCES): Add it.

6 years agostrace.1: fix wording about setuid installation
Dmitry V. Levin [Mon, 29 Jan 2018 17:49:24 +0000 (17:49 +0000)]
strace.1: fix wording about setuid installation

* strace.1.in (SETUID INSTALLATION): Fix wording.

Closes: https://github.com/strace/strace/issues/24
6 years agoAdd KVM_PPC_GET_CPU_CHAR ioctl definition from linux v4.15
Gleb Fotengauer-Malinovskiy [Mon, 29 Jan 2018 12:35:10 +0000 (15:35 +0300)]
Add KVM_PPC_GET_CPU_CHAR ioctl definition from linux v4.15

* linux/powerpc/ioctls_arch0.h: Update from linux v4.15
using ioctls_gen.sh.

6 years agoUpdate NEWS
Eugene Syromyatnikov [Wed, 17 Jan 2018 23:42:42 +0000 (00:42 +0100)]
Update NEWS

6 years agotests: check s390_pci_mmio_read and s390_pci_mmio_write decoders
Eugene Syromyatnikov [Sun, 14 Jan 2018 09:42:11 +0000 (10:42 +0100)]
tests: check s390_pci_mmio_read and s390_pci_mmio_write decoders

* tests/s390_pci_mmio_read_write.c: New file.
* tests/.gitignore: Add s390_pci_mmio_read_write.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (s390_pci_mmio_read_write): New test.

6 years agoIntroduce s390_pci_mmio_read, s390_pci_mmio_write system call decoders
Eugene Syromyatnikov [Sun, 14 Jan 2018 09:40:21 +0000 (10:40 +0100)]
Introduce s390_pci_mmio_read, s390_pci_mmio_write system call decoders

* linux/s390/syscallent.h ([352]): Change decoder to s390_pci_mmio_write.
([353]): Change decoder to s390_pci_mmio_read.
* linux/s390x/syscallent.h: Likewise.
* s390.c (SYS_FUNC(s390_pci_mmio_write), SYS_FUNC(s390_pci_mmio_read)):
New function.

6 years agotests: check s390_runtime_instr system call decoder
Eugene Syromyatnikov [Sun, 14 Jan 2018 08:39:05 +0000 (09:39 +0100)]
tests: check s390_runtime_instr system call decoder

* tests/s390_runtime_instr.c: New file.
* tests/.gitignore: Add s390_runtime_instr.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (s390_runtime_instr): New test.

6 years agoIntroduce s390_runtime_instr system call decoder
Eugene Syromyatnikov [Sun, 14 Jan 2018 08:37:43 +0000 (09:37 +0100)]
Introduce s390_runtime_instr system call decoder

* linux/s390/syscallent.h ([342]): Change decoder to s390_runtime_instr.
* linux/s390x/syscallent.h: Likewise.
* s390.c (SYS_FUNC(s390_runtime_instr)): New function.
* xlat/s390_runtime_instr_commands.in: New file.

6 years agotests: check s390_guarded_storage system call decoder
Eugene Syromyatnikov [Fri, 12 Jan 2018 17:31:34 +0000 (18:31 +0100)]
tests: check s390_guarded_storage system call decoder

* configure.ac (AC_CHECK_HEADERS): Add asm/guarded_storage.h.
* tests/s390_guarded_storage-v.c: New file.
* tests/s390_guarded_storage.c: Likewise.
* tests/.gitignore: Add s390_guarded_storage, s390_guarded_storage-v.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (s390_guarded_storage, s390_guarded_storage-v):
New tests.

6 years agoIntroduce s390_guarded_storage system call decoder
Eugene Syromyatnikov [Fri, 12 Jan 2018 16:25:38 +0000 (17:25 +0100)]
Introduce s390_guarded_storage system call decoder

* linux/s390/syscallent.h ([378]): Change decoder to s390_guarded_storage.
* linux/s390x/syscallent.h: Likewise.
* s390.c (struct guard_storage_control_block,
struct guard_storage_event_parameter_list): New structure type
definition.
(guard_storage_print_gsepl, guard_storage_print_gscb,
SYS_FUNC(s390_guarded_storage)): New function.
(DIV_ROUND_UP): New macro.
* xlat/s390_guarded_storage_commands.in: New file.

6 years agotests: check s390_sthyi system call decoder
Eugene Syromyatnikov [Thu, 18 Jan 2018 05:22:40 +0000 (06:22 +0100)]
tests: check s390_sthyi system call decoder

* configure.ac (AC_CHECK_FUNCS): Add iconv_open.
(AC_CHECK_HEADERS): Add iconv.h.
* tests/s390_sthyi-v.c: New file.
* tests/s390_sthyi.c: Likewise.
* tests/.gitignore: Add s390_sthyi, s390_sthyi-v.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (s390_sthyi, s390_sthyi): New tests.

6 years agoIntroduce s390_sthyi system call decoder
Eugene Syromyatnikov [Thu, 18 Jan 2018 05:21:45 +0000 (06:21 +0100)]
Introduce s390_sthyi system call decoder

* s390.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/s390/syscallent.h ([380]): Change decoder to s390_sthyi.
* linux/s390x/syscallent.h: Likewise.
* xlat/s390_sthyi_function_codes.in: New file.

6 years agoprint_fields.h: add macro to print hexadecimal array field
Eugene Syromyatnikov [Thu, 11 Jan 2018 21:47:11 +0000 (22:47 +0100)]
print_fields.h: add macro to print hexadecimal array field

* print_fields.h (PRINT_FIELD_HEX_ARRAY): New macro, prints target
array with QUOTE_FORCE_HEX.

6 years agoAdd print_quoted_string flag to generate comment
Eugene Syromyatnikov [Thu, 11 Jan 2018 21:46:23 +0000 (22:46 +0100)]
Add print_quoted_string flag to generate comment

Because there are never enough print_quoted_string flags.

* defs.h (QUOTE_EMIT_COMMENT): New quoting flag macro constant.
* util.c (string_quote): Emit " /* " in the beginning and " */" in the
end if QUOTE_EMIT_COMMENT is passed.
(print_quoted_string): Increase alloc_size by 7 if QUOTE_EMIT_COMMENT is
passed.

6 years agotests: make ioctl.test more flexible, use it for the rest of ioctl tests
Eugene Syromyatnikov [Thu, 25 Jan 2018 09:54:56 +0000 (10:54 +0100)]
tests: make ioctl.test more flexible, use it for the rest of ioctl tests

As the remaining non-generated ioctl tests differ from ioctl.test only
in strace options, and since gen_tests.sh can pass arguments to sourced
tests, replace the remaining non-generated ioctl tests with invocations
of ioctl.test with appropriate parameters.

* tests/ioctl.test: Pass script arguments to the strace invocation.
* tests/gen_tests.in (ioctl_dm): New entry, invoke ioctl.test with -s9.
(ioctl_dm-v): New entry, invoke ioctl.test with -v -s9.
(ioctl_kvm_run): New entry, invoke ioctl.test with -a36 -y.
(ioctl_loop-nv): New entry, invoke ioctl.test with -a22 -e verbose=none.
(ioctl_nsfs): New entry, invoke ioctl.test with -esignal=none.
(ioctl_sock_gifconf): New entry, invoke ioctl.test with -a28 -s1.
(ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v): Invoke ioctl.test
with -v option instead of ioctl-v.sh.
* tests/ioctl_dm-v.test: Remove.
* tests/ioctl_dm.test: Likewise.
* tests/ioctl_kvm_run.test: Likewise.
* tests/ioctl_loop-nv.test: Likewise.
* tests/ioctl_nsfs.test: Likewise.
* tests/ioctl_sock_gifconf.test: Likewise.
* tests/ioctl-v.sh: Likewise.
* tests/Makefile.am (DECODER_TESTS, EXTRA_DIST): Remove them.

6 years agotests/gen_tests.sh: enable passing arguments to sourced tests
Eugene Syromyatnikov [Thu, 25 Jan 2018 09:33:55 +0000 (10:33 +0100)]
tests/gen_tests.sh: enable passing arguments to sourced tests

* tests/gen_tests.sh: Read first argument separately, put it in $arg0,
and the rest of the arguments in $args.
(case "$arg0" in) <+*)>: Set command line to $args and source $arg0.

6 years agoxlat/gen.sh: add some rudimentary support for comments
Eugene Syromyatnikov [Wed, 13 Sep 2017 19:44:44 +0000 (21:44 +0200)]
xlat/gen.sh: add some rudimentary support for comments

* xlat/gen.sh: Trim parts of the string abbreviated in "/*" and "*/"

6 years agoconfigure.ac: sort architectures in lexicographical order
Eugene Syromyatnikov [Wed, 24 Jan 2018 13:29:55 +0000 (14:29 +0100)]
configure.ac: sort architectures in lexicographical order

* configure.ac (case "$host_cpu"): sort architectures in alphabetical
order.

6 years agoDrop non-functional CRIS architecture support
Dmitry V. Levin [Thu, 25 Jan 2018 01:55:08 +0000 (01:55 +0000)]
Drop non-functional CRIS architecture support

From the very first commit when CRIS architecture support was introduced
and up to this comment that ends the agony of this non-functional code,
this support was incomplete and could never be compiled.

* Makefile.am (EXTRA_DIST): Remove linux/crisv*.
* clone.c: Remove CRISV* checks.
* configure.ac ($host_cpu == cris*): Remove.
* linux/crisv10: Remove.
* linux/crisv32: Likewise.

Fixes: v4.5.18-77-gea0e6e8 ("CRIS support by Hinko Kocevar ...")
6 years agoUpdate futex test in accordance with kernel's v4.15-rc7-202-gfbe0e83
Eugene Syromyatnikov [Wed, 24 Jan 2018 14:55:50 +0000 (09:55 -0500)]
Update futex test in accordance with kernel's v4.15-rc7-202-gfbe0e83

* futex.c (VALP, VALP_PR, VAL2P, VAL2P_PR): New macro definitions.
(main): Allow EINVAL on *REQUEUE* checks with VAL/VAL2 with higher bit
being set, check that the existing behaviour preserved with VALP/VAL2P
where higher bit is unset.

6 years agotests/futex.c: improve error diagnostics
Eugene Syromyatnikov [Wed, 24 Jan 2018 14:54:32 +0000 (09:54 -0500)]
tests/futex.c: improve error diagnostics

* tests/futex.c (futex_error): Add func and line arguments, print them.
(CHECK_FUTEX_GENERIC): Pass __func__ and __LINE__ to futex_error.

6 years agoAdd syscall entry for ARM-specific get_tls syscall
Eugene Syromyatnikov [Tue, 23 Jan 2018 08:40:12 +0000 (09:40 +0100)]
Add syscall entry for ARM-specific get_tls syscall

* linux/arm/syscallent.h ([ARM_FIRST_SHUFFLED_SYSCALL+1+6]): New entry.
(ARM_LAST_SPECIAL_SYSCALL): Update to 6.
* NEWS: Mention it.

6 years agoFix syscall descriptions for ARM-specific system calls
Eugene Syromyatnikov [Tue, 23 Jan 2018 08:37:19 +0000 (09:37 +0100)]
Fix syscall descriptions for ARM-specific system calls

Based on an analysis of arm_syscall in arch/arm/kernel/traps.c.

* linux/arm/syscallent.h ([ARM_FIRST_SHUFFLED_SYSCALL+1+2]): Update
argument number, add TM flag.
([ARM_FIRST_SHUFFLED_SYSCALL+1+1], [ARM_FIRST_SHUFFLED_SYSCALL+1+3],
[ARM_FIRST_SHUFFLED_SYSCALL+1+4], [ARM_FIRST_SHUFFLED_SYSCALL+1+5]):
Update argument number.

6 years agotests: check riscv_flush_icache syscall decoder
Eugene Syromyatnikov [Mon, 22 Jan 2018 12:07:13 +0000 (13:07 +0100)]
tests: check riscv_flush_icache syscall decoder

* tests/riscv_flush_icache.c: New file.
* tests/.gitignore: Add riscv_flush_icache.
* tests/gen_tests.in: Likewise.
* tests/pure_executables.list: Likewise.

6 years agoImplement decoding of riscv_flush_icache syscall
Eugene Syromyatnikov [Mon, 22 Jan 2018 09:23:07 +0000 (10:23 +0100)]
Implement decoding of riscv_flush_icache syscall

* linux/riscv/syscallent.h ([259]): Add riscv_flush_icache entry.
* riscv.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/riscv_flush_icache_flags.in: New file.
* NEWS: Mention it.

6 years agoWorkaround stray PTRACE_EVENT_EXEC
Eugene Syromyatnikov [Mon, 22 Jan 2018 02:53:43 +0000 (03:53 +0100)]
Workaround stray PTRACE_EVENT_EXEC

We (apparently) had a long-standing test failure inside strace-ff.test
with the symptom that it misses exit_group call.  As it turned out, it
was PTRACE_EVENT_EXEC followed by execve syscall exiting stop.  That
behaviour indeed screwed all the syscall state tracking for the tracee.
Let's try to patch it up by calling trace_syscall when we receive
PTRACE_EVENT_EXEC outside syscall.

* defs.h (TCB_RECOVERING): New tcb flag.
* strace.c (dispatch_event) <case TE_STOP_BEFORE_EXECVE>: Invoke
trace_syscall with TCB_RECOVERING flag being set for the current_tcp
if the tracee is not on exiting syscall.
* syscall.c (get_scno): Set QUAL_RAW if we are recovering.
(tamper_with_syscall_entering): Do not perform actual tampering during
recovery as it's already too late.
* NEWS: Mention it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: robustify set_ptracer_any
Dmitry V. Levin [Wed, 24 Jan 2018 01:56:15 +0000 (01:56 +0000)]
tests: robustify set_ptracer_any

* tests/set_ptracer_any.c (main) [HAVE_PRCTL]: Provide fallback
definitions for PR_SET_PTRACER and PR_SET_PTRACER_ANY constants,
set all unused prctl arguments to 0.

6 years agoia64: do not bail out in get_syscall_args if umove fails with EPERM
Dmitry V. Levin [Wed, 24 Jan 2018 01:56:15 +0000 (01:56 +0000)]
ia64: do not bail out in get_syscall_args if umove fails with EPERM

If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3,
both PTRACE_PEEKDATA and process_vm_readv become unavailable when the
process dumpable flag is cleared, on ia64 this results to all syscall
arguments being unavailable.

Recognize this situation and do not treat it as get_syscall_args error
because the latter leaves the tracee in a ptrace stop.

This condition used to be triggered by prctl-dumpable test that caused
strace to hang indefinitely.

* linux/ia64/get_syscall_args.c (get_syscall_args): Do not bail out
if umove fails.
* tests/prctl-dumpable.c [__ia64__]: Skip the test.

6 years agostrace.c: reset printing_tcp on print_event_exit
Eugene Syromyatnikov [Mon, 22 Jan 2018 00:55:05 +0000 (01:55 +0100)]
strace.c: reset printing_tcp on print_event_exit

print_event_exit should have printing_tcp setup analogous to printleader and
syscall_exit_trace before printing its part, otherwise it spuriously resets
curcol in line_ended for the stale printing_tcp if followfork == 2.

* strace.c (print_event_exit): Set printing_tcp to tcp before printing
exiting event line and calling line_ended.

6 years agotests: check path tracing of old select syscall
Dmitry V. Levin [Tue, 23 Jan 2018 01:06:09 +0000 (01:06 +0000)]
tests: check path tracing of old select syscall

* tests/xselect.c [xselect] (xselect): Turn into prototype.
* tests/oldselect-P.c: New file.
* tests/oldselect-efault-P.c: Likewise.
* tests/oldselect-efault.c: Likewise.
* tests/oldselect.c: Use xselect.c
* tests/pure_executables.list: Add oldselect-efault.
* tests/gen_tests.in (oldselect, oldselect-P, oldselect-efault,
oldselect-efault-P): New entries.
* tests/oldselect.expected: Remove.
* tests/oldselect.test: Remove.
* tests/Makefile.am (check_PROGRAMS): Add oldselect-P
and oldselect-efault-P.
(DECODER_TESTS): Remove oldselect.test.
(EXTRA_DIST): Remove oldselect.expected.
* tests/.gitignore: Add oldselect-P, oldselect-efault,
and oldselect-efault-P.