Compare commits

...

253 Commits

Author SHA1 Message Date
51630c2002 Prepare for 4.21 release
* NEWS: Update for 4.21 release.
2018-02-13 23:00:00 +00:00
9748b92038 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.
2018-02-13 22:57:27 +00:00
daaf8ab7fe Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-02-13 22:00:00 +00:00
3e97bf63fc 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>
2018-02-13 21:36:08 +00:00
ae8c1d5cc7 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.
2018-02-13 05:05:13 +00:00
4b36fd69f7 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.
2018-02-13 04:17:08 +00:00
101621d4c7 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>
2018-02-13 03:12:29 +00:00
9730e10317 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.
2018-02-13 03:12:29 +00:00
46c6c7d776 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.
2018-02-13 03:12:29 +00:00
66c1739d86 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
2018-02-12 19:54:18 +00:00
2cf88b2646 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.
2018-02-12 19:54:18 +00:00
3c77491654 debian: re-enable -k option on x86_64
This partially reverts commit v4.13~177.

* debian/control (Build-Depends) [amd64]: Add libunwind-dev.
2018-02-12 19:54:18 +00:00
7d7667629d Add "strace -V" output to build log
* strace.spec.in (%check): Print "strace -V" output before
running the test suite.
* debian/rules (%-stamp): Likewise.
2018-02-12 19:54:18 +00:00
adf272d7ce 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.
2018-02-12 19:54:18 +00:00
31e1025264 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.
2018-02-12 18:28:16 +00:00
850bb4124f 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.
2018-02-12 18:28:16 +00:00
2a368bd36f Update NEWS 2018-02-12 18:08:07 +00:00
e26e9dacda 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.
2018-02-12 11:42:04 +00:00
08794465cb 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.
2018-02-12 11:42:04 +00:00
c32a2ad625 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.
2018-02-11 23:55:43 +00:00
1b7b17645c strace.1.in: ffix 2018-02-11 23:55:43 +00:00
5a6dff3fe8 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>.
2018-02-11 00:26:09 +00:00
f2bb704a92 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.
2018-02-11 00:26:09 +00:00
971df259c6 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.
2018-02-10 13:52:42 +00:00
04b836f024 xstring.h: rephrase xappendstr description a bit 2018-02-10 13:52:42 +00:00
0863915a0a 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.
2018-02-10 13:52:42 +00:00
b21d81db04 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.
2018-02-10 02:15:35 +00:00
b06199a8b9 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.
2018-02-10 02:15:35 +00:00
83454d741f 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>
2018-02-10 02:15:35 +00:00
eb45473d7f 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.
2018-02-10 01:33:49 +00:00
a59e41e121 syscall.c: warn if tampering failed 2018-02-10 01:33:49 +00:00
34c644b485 syscall.c: set errno if syscall is tampered 2018-02-10 01:33:48 +00:00
bbc29521f7 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.
2018-02-10 00:01:01 +00:00
c7b168165f 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.
2018-02-10 00:01:01 +00:00
61f156c08e 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.
2018-02-10 00:01:01 +00:00
7b6e926641 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.
2018-02-10 00:01:01 +00:00
f729ab68dd 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.
2018-02-10 00:01:01 +00:00
c3e8a9ebb4 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.
2018-02-10 00:01:01 +00:00
0f60aba412 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.
2018-02-09 22:11:50 +00:00
128413b850 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.
2018-02-09 22:11:50 +00:00
c2c35ae227 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.
2018-02-09 22:11:50 +00:00
dbaa7a5b06 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.
2018-02-09 22:11:50 +00:00
a9512e5779 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.
2018-02-09 20:11:53 +00:00
9fcaf3bd88 printsiginfo.c: add a comment about personality detection for SIGSYS
Looks like it is not necessary, after all.
2018-02-09 20:11:53 +00:00
eb9db58362 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.
2018-02-09 15:40:50 +00:00
1a5c89d4ed 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.
2018-02-09 04:41:55 +00:00
8048b48881 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.
2018-02-09 04:41:55 +00:00
8e4b24701a linux/x86_64/get_error.c: do not sign-extend if no error happened 2018-02-09 01:16:13 +00:00
c2bacdd427 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.
2018-02-09 01:16:13 +00:00
e87c073ecc 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>
2018-02-09 01:16:13 +00:00
67b7c125ba 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.
2018-02-07 22:03:48 +00:00
b0a26b9403 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.
2018-02-07 22:03:48 +00:00
54038a6898 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
2018-02-07 22:03:48 +00:00
1dd94856d3 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.
2018-02-07 22:03:48 +00:00
cf7924dc5e README.md: add information about git repository location
* README.md: Mention URLs for SourceForge, GitHub, and GitLab
repositories.
2018-02-07 22:02:53 +00:00
85bd0dcea1 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.
2018-02-07 12:32:57 +00:00
11d1c182ba 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>
2018-02-06 23:46:18 +00:00
0ec9716124 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.
2018-02-06 08:45:32 +00:00
6c76cbe645 xlat: update IPV6_* constants
* xlat/sockipv6options.in: Add IPV6_FREEBIND introduced by linux kernel
commit v4.15-rc1~84^2~601.
* NEWS: Mention this.
2018-02-06 08:45:32 +00:00
444a93d0f0 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.
2018-02-06 08:45:32 +00:00
71124c49ee 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.
2018-02-06 08:45:32 +00:00
1f77138867 Makefile.am: minor EXTRA_DIST formatting changes 2018-02-06 02:56:14 +01:00
eae4643b0f 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.
2018-02-06 02:56:14 +01:00
69ae3ae39c strace.1: fix wording about setuid installation
* strace.1.in (SETUID INSTALLATION): Fix wording.

Closes: https://github.com/strace/strace/issues/24
2018-01-29 22:47:48 +00:00
b62b2dca1d 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.
2018-01-29 13:17:45 +00:00
a7457d88e2 Update NEWS 2018-01-29 14:12:50 +01:00
e470a92d38 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.
2018-01-29 14:12:50 +01:00
f7649ed985 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.
2018-01-29 14:10:10 +01:00
9d35c59421 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.
2018-01-29 14:10:10 +01:00
a0094a0ebd 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.
2018-01-29 14:10:10 +01:00
52970d343b 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.
2018-01-29 14:10:10 +01:00
180a913d84 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.
2018-01-29 14:10:10 +01:00
9437d47366 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.
2018-01-29 14:10:10 +01:00
876e77a785 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.
2018-01-29 14:10:10 +01:00
4ba4e62a51 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.
2018-01-29 14:10:10 +01:00
501611115f 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.
2018-01-29 14:10:10 +01:00
baec073f01 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.
2018-01-25 07:18:38 +00:00
f55ad2bbfc 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.
2018-01-25 07:18:38 +00:00
96ac341ae7 xlat/gen.sh: add some rudimentary support for comments
* xlat/gen.sh: Trim parts of the string abbreviated in "/*" and "*/"
2018-01-25 07:18:38 +00:00
865d93c2ec configure.ac: sort architectures in lexicographical order
* configure.ac (case "$host_cpu"): sort architectures in alphabetical
order.
2018-01-25 07:18:38 +00:00
832e2ac13e 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 ...")
2018-01-25 01:55:08 +00:00
79d10dfc20 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.
2018-01-25 01:55:08 +00:00
5e39002c23 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.
2018-01-25 01:55:08 +00:00
fdcfe80983 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.
2018-01-25 01:55:08 +00:00
8b1ce9ef45 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.
2018-01-25 01:55:08 +00:00
13f0c7a955 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.
2018-01-25 01:55:08 +00:00
5b5e9a7620 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.
2018-01-25 01:55:08 +00:00
1b849e23bf 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>
2018-01-25 01:55:08 +00:00
ceceb4dffb 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.
2018-01-24 01:56:15 +00:00
c7e8fc0e63 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.
2018-01-24 01:56:15 +00:00
5fcdae5359 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.
2018-01-24 01:56:15 +00:00
5ac1e8e11b 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.
2018-01-23 23:17:02 +00:00
959e82d13d tests: check path tracing of select/_newselect syscalls
* tests/xselect.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add test calls that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/_newselect-P.c: New file.
* tests/select-P.c: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add _newselect-P and select-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (_newselect-P, select-P): New entries.
2018-01-23 23:17:02 +00:00
8c5c14c196 tests: extend the check of select/_newselect syscalls decoding
* tests/xselect.c: Rewrite for better coverage.
2018-01-23 23:17:02 +00:00
c2265040b8 tests: redirect stdin to /dev/null
Ensure that stdin descriptor is not available for output
by reopening it to input from /dev/null.

* tests/run.sh: Redirect test's stdin to /dev/null.
2018-01-23 23:17:02 +00:00
030fae537f tests: add file:line to perror_msg_and_fail/error_msg_and_fail output
* tests/tests.h [!perror_msg_and_fail] (perror_msg_and_fail): New macro
wrapper around the homonymous function.
[!error_msg_and_fail] (error_msg_and_fail): Likewise.
* tests/error_msg.c (perror_msg_and_fail, error_msg_and_fail): New
macros defined to themselves.
2018-01-23 23:17:02 +00:00
7494f63faa Rework decoding and pathtrace of old select syscall
* linux/arch_defs_.h [!HAVE_ARCH_OLD_SELECT] (HAVE_ARCH_OLD_SELECT): New
macro.
* linux/aarch64/arch_defs_.h (HAVE_ARCH_OLD_SELECT): Likewise.
* linux/arm/arch_defs_.h: Likewise.
* linux/bfin/arch_defs_.h: Likewise.
* linux/i386/arch_defs_.h: Likewise.
* linux/m68k/arch_defs_.h: Likewise.
* linux/microblaze/arch_defs_.h: Likewise.
* linux/powerpc64/arch_defs_.h: Likewise.
* linux/sh/arch_defs_.h: Likewise.
* linux/x32/arch_defs_.h: Likewise.
* linux/x86_64/arch_defs_.h: Likewise.
* linux/powerpc/arch_defs_.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* desc.c (SYS_FUNC(oldselect)): Rewrite using
fetch_indirect_syscall_args, move under [HAVE_ARCH_OLD_SELECT].
* pathtrace.c (match_xselect_args): New function.
(pathtrace_match_set): Use it.
2018-01-23 23:17:02 +00:00
f03d67cfd9 Transform fetch_old_mmap_args into fetch_indirect_syscall_args
As there are more than one old style syscall that take their arguments
via array, generalize fetch_old_mmap_args into a function that could
fetch variable number of arguments.

* mem.c (fetch_old_mmap_args): Transform into ...
* fetch_indirect_syscall_args.c: ... fetch_indirect_syscall_args
in this new file.
* Makefile.am (libstrace_a_SOURCES): Add it.
* defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Remove.
(fetch_indirect_syscall_args): New prototype.
* pathtrace.c (pathtrace_match_set) [HAVE_ARCH_OLD_MMAP]: Use
fetch_indirect_syscall_args instead of fetch_old_mmap_args.
2018-01-23 23:17:02 +00:00
c179cc5184 signal.c: remove excess semicolon after the end of the function
* signal.c (rt_sigtimedwait): Remove semicolon after the function body.
2018-01-23 23:17:02 +00:00
0327446ae5 Use char * for pointer arithmetics
* netlink_inet_diag.c (decode_inet_diag_req_compat,
decode_inet_diag_req_v2, decode_inet_diag_msg): Cast to char *
instead of void *.
* netlink_netlink_diag.c (decode_netlink_diag_req,
decode_netlink_diag_msg): Likewise.
* netlink_packet_diag.c (decode_packet_diag_req,
decode_packet_diag_msg): Likewise.
* netlink_unix_diag.c (decode_unix_diag_req, decode_unix_diag_msg):
Likewise.
* rtnl_addr.c (decode_ifaddrmsg): Likewise.
* rtnl_addrlabel.c (decode_ifaddrlblmsg): Likewise.
* rtnl_dcb.c (decode_dcbmsg): Likewise.
* rtnl_link.c (decode_ifinfomsg): Likewise.
* rtnl_mdb.c (decode_br_port_msg): Likewise.
* rtnl_neigh.c (decode_ndmsg): Likewise.
* rtnl_route.c (decode_rtmsg): Likewise.
* rtnl_rule.c (decode_fib_rule_hdr): Likewise.
* rtnl_tc.c (decode_tcmsg): Likewise.
2018-01-23 23:17:02 +00:00
2b97629df1 netlink_inet_diag.c: remove unnecessary return
decode_inet_diag_req, as well as the functions it calls, returns void.

* netlink_inet_diag.c (decode_inet_diag_req): Do not return anything.
2018-01-23 23:17:02 +00:00
af955678b9 Move decoder of getpagesize syscall to libstrace
As only five architectures have getpagesize syscall, moving the decoder
to libstrace allows to get rid of getpagesize related ifdefs and check
build of getpagesize decoder on other architectures.

* mem.c (SYS_FUNC(getpagesize)): Move ...
* getpagesize.c: ... to this new file.
* Makefile.am (libstrace_a_SOURCES): Add it.
2018-01-21 20:19:53 +00:00
1b75ffef40 mpers: implement gawk 3 support
Some old systems that still make some sense to be supported have only
gawk 3, so let's support them for now.

In order to achieve that, multiple changes have been implemented:
 - Multidimensional arrays are replaced with single-dimensional ones.
   In most places it's a "][" -> ", " replacement, as awk allows some
   kind of emulation of multidimensional arrays that way, but in several
   occasions (specifically for storing name and special fields) we have
   to iterate over them later, so we store that information in
   additional arrays in order to get the keys.
 - "switch" statements are replaced with sets of "if ... else if ...
   else" statements.  This change is trivial, except we've added
   a temporary variable in what_is order to store expression value, for
   readability purposes.
 - No support for array iteration ordering.  This one is most ugly of
   them all.  Luckily, not that ugly, we've just had to process index a
   bit in order to make it lexicographically sortable and add two
   temporary arrays containing sorted indices in order to sort over them
   instead of those two arrays that we've added in order to work around
   lack of multidimensional array support.

* mpers.awk (compare_indices): Remove unused function.
(array_get, update_upper_bound, /^DW_AT_data_member_location/,
/^DW_AT_byte_size/, /^DW_AT_encoding/): Replace multidimensional array
access with comma-concatenated index.
(norm_idx): New function.
(array_seq): Replace multidimensional array access with
comma-concatenated index.  Use comma-concatenated pair of (array_idx,
"seq") in order to check presence of the item in an array.
(what_is): Add enc and i local variables.  Store the value of
array[what_idx, "encoding"] in it.  Replace "switch" statements with
sets of "if ... else if ... else" statements.  Replace multidimensional
array access with comma-concatenated index. Use for (... ; ...; ...)
iteration over aparents_keys instead of iteration over array.
(/^<[[:xdigit:]]+>/): Store idx as norm_idx(matches[2]).  Replace
multidimensional array access with comma-concatenated index.  Store an
additional flag in array_names array.
(/^DW_AT_name/): Replace multidimensional array access with
comma-concatenated index.  Add a flag to array_names for that idx.
(/^DW_AT_type/): Do not capture "0x" as a part of a group, normalise
the captured group.  Replace multidimensional array access with
comma-concatenated index.
(/^Abbrev Number:[^(]+\(DW_TAG_/): Replace multidimensional array access
with comma-concatenated index.  Store additional flags in
array_special and array_parents arrays.
(END): Remove PROCINFO["sorted_in"] setup.  Sort array_parents.  Replace
multidimensional array access with comma-concatenated index.  Iterate
over array_special to go over all the items that have "special" field.
Iterate over array_names to go over all items that have "name" field.
* NEWS: Mention it.
2018-01-21 01:46:04 +00:00
6f36919172 dm: add support for event_nr in DM_LIST_DEVICES result
Commit v4.13-rc1~137^2~13 (and a follow-up fix v4.14-rc4~20^2~3
that changed alignment) introduced an additional hidden field
in the structure returned by DM_LIST_DEVICES ioctl command
that contains event_nr information.

Unfortunately, we can't test it for now, but looks like it kinda works:

  # ./strace -v -eioctl -y dmsetup ls
  ioctl(3</dev/mapper/control>, DM_VERSION, {version=4.0.0,
  data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.37.0,
  data_size=16384, flags=DM_EXISTS_FLAG}) = 0
  ioctl(3</dev/mapper/control>, DM_LIST_DEVICES, {version=4.0.0,
  data_size=16384, data_start=312, flags=DM_EXISTS_FLAG} =>
  {version=4.37.0, data_size=408, data_start=312, flags=DM_EXISTS_FLAG,
  {dev=makedev(253, 1), name="fedoratesting--30-swap", event_nr=0},
  {dev=makedev(253, 0), name="fedoratesting--30-root"}}) = 0
  fedoratesting--30-swap	(253:1)
  fedoratesting--30-root	(253:0)

* dm.c (dm_decode_dm_name_list): Obtain the amount of bytes copied
during printing device name, print event number if there's a suitable
gap present and the DM version is high enough.
* NEWS: Mention it.
2018-01-21 01:46:04 +00:00
ac8241cd4f Move definition of personality macros to arch_defs_.h
* supported_personalities.h: Remove.
* defs.h: Do not include it.
* linux/arch_defs_.h [!DEFAULT_PERSONALITY] (DEFAULT_PERSONALITY): New
macro.
[!SUPPORTED_PERSONALITIES] (SUPPORTED_PERSONALITIES): Likewise.
* linux/aarch64/arch_defs_.h (SUPPORTED_PERSONALITIES): New macro.
* linux/riscv/arch_defs_.h: Likewise.
* linux/s390x/arch_defs_.h: Likewise.
* linux/sparc64/arch_defs_.h: Likewise.
* linux/x32/arch_defs_.h: Likewise.
* linux/x86_64/arch_defs_.h: Likewise.
* linux/powerpc64/arch_defs_.h: New file.
* linux/tile/arch_defs_.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
(strace_SOURCES): Remove supported_personalities.h.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-21 01:46:04 +00:00
bf23036873 Introduce HAVE_ARCH_SA_RESTORER
In order to simplify HAVE_SA_RESTORER logic a bit.

* linux/ia64/arch_defs_.h (HAVE_ARCH_SA_RESTORER): New macro.
* linux/m68k/arch_defs_.h: Likewise.
* linux/sparc/arch_defs_.h: Likewise.
* linux/sparc64/arch_defs_.h: Likewise.
* linux/hppa/arch_defs_.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* signal.c [HAVE_ARCH_SA_RESTORER]: Define HAVE_SA_RESTORER to it.
[!HAVE_ARCH_SA_RESTORER && SA_RESTORER]: Define HAVE_SA_RESTORER to 1.
[!HAVE_ARCH_SA_RESTORER && !SA_RESTORER]: Define HAVE_SA_RESTORER to 0.
2018-01-21 01:46:04 +00:00
2880a927a6 Replace NEED_UID16_PARSERS with HAVE_ARCH_UID16_SYSCALLS
* linux/arch_defs_.h [!HAVE_ARCH_UID16_SYSCALLS]
(HAVE_ARCH_UID16_SYSCALLS): New macro.
* linux/aarch64/arch_defs_.h (HAVE_ARCH_UID16_SYSCALLS): New macro.
* linux/arm/arch_defs_.h: Likewise.
* linux/i386/arch_defs_.h: Likewise.
* linux/ia64/arch_defs_.h: Likewise.
* linux/m68k/arch_defs_.h: Likewise.
* linux/s390/arch_defs_.h: Likewise.
* linux/s390x/arch_defs_.h: Likewise.
* linux/sh/arch_defs_.h: Likewise.
* linux/sparc/arch_defs_.h: Likewise.
* linux/sparc64/arch_defs_.h: Likewise.
* linux/syscall.h: Likewise.
* linux/x32/arch_defs_.h: Likewise.
* linux/x86_64/arch_defs_.h: Likewise.
* linux/bfin/arch_defs_.h: New file.
* linux/microblaze/arch_defs_.h: Likewise.
* linux/riscv/arch_defs_.h: Likewise.
* linux/sh64/arch_defs_.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h (NEED_UID16_PARSERS): Remove.
* linux/syscall.h: Check for HAVE_ARCH_UID16_SYSCALLS instead of
NEED_UID16_PARSERS.
* uid.c: Likewise.
2018-01-21 01:46:04 +00:00
a9b7fb4f73 Replace HAVE_GETRVAL2 with HAVE_ARCH_GETRVAL2
* linux/arch_defs_.h [!HAVE_ARCH_GETRVAL2] (HAVE_ARCH_GETRVAL2): New
macro.
* linux/alpha/arch_defs_.h: New file.
* linux/ia64/arch_defs_.h: Likewise.
* linux/mips/arch_defs_.h: Likewise.
* linux/sh/arch_defs_.h: Likewise.
* linux/sparc/arch_defs_.h: Likewise.
* linux/sparc64/arch_defs_.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h (HAVE_GETRVAL2): Remove.
(getrval2): Check for HAVE_ARCH_GETRVAL2 instead of arch checks.
* net.c (SYS_FUNC(pipe)): Check for HAVE_ARCH_GETRVAL2 instead of
HAVE_GETRVAL2.
* syscall.c: Likewise.
2018-01-21 01:46:04 +00:00
11540211f5 Use #if idiom instead of #ifdef for HAVE_ARCH_* macros.
* linux/arch_defs_.h [!HAVE_ARCH_OLD_MMAP] (HAVE_ARCH_OLD_MMAP): New
macro.
[!HAVE_ARCH_OLD_MMAP_PGOFF] (HAVE_ARCH_OLD_MMAP_PGOFF): Likewise.
* defs.h: Use #if instead of #ifdef to check HAVE_ARCH_OLD_MMAP.
* mem.c: Use #if instead of #ifdef to check HAVE_ARCH_OLD_MMAP
and HAVE_ARCH_OLD_MMAP_PGOFF
* pathtrace.c: Likewise.
2018-01-21 01:46:04 +00:00
8baf8f4a37 Rename arch-specific arch_defs.h files to arch_defs_.h
Introduce a new arch_defs.h header that includes the corresponding
arch-specific arch_defs_.h file followed by generic arch_defs_.h file.

* linux/arch_defs.h: Rename to linux/arch_defs_.h.
* linux/aarch64/arch_defs.h: Rename to linux/aarch64/arch_defs_.h.
* linux/arm/arch_defs.h: Rename to linux/arm/arch_defs_.h.
* linux/i386/arch_defs.h: Rename to linux/i386/arch_defs_.h.
* linux/m68k/arch_defs.h: Rename to linux/m68k/arch_defs_.h.
* linux/s390/arch_defs.h: Rename to linux/s390/arch_defs_.h.
* linux/s390x/arch_defs.h: Rename to linux/s390x/arch_defs_.h.
* linux/x32/arch_defs.h: Rename to linux/x32/arch_defs_.h.
* linux/x86_64/arch_defs.h: Rename to linux/x86_64/arch_defs_.h.
* arch_defs.h: New file.
* Makefile.am (strace_SOURCES): Add it.
(EXTRA_DIST): Rename linux/*/arch_defs.h to linux/*/arch_defs_.h.
2018-01-21 01:46:04 +00:00
3c5aaa643b Fix ANY_WORDSIZE_LESS_THAN_KERNEL_LONG definition
* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): Rewrite without undefined
behaviour.

Fixes: f916793 ("Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro")
2018-01-19 23:02:17 +00:00
b96c599af8 util: return string size in printstr
As umovestr now returns something useful, let's propagate it further.

* defs.h (printstr_ex, printpathn, printpath): Change return type from
void to int.
(printstrn, printstr): Change return type from void to int, return
printstr_ex result.
* util.c (printpathn): Return -1 on NULL addr, nul_seen (exit code of
umovestr) on success.
(printpath): Return printpathn result.
(printstr_ex): Return -1 on NULL addr, umoven/umovestr result otherwise.
2018-01-19 22:45:34 +00:00
7ead136575 ucopy: return string size in umovestr
We return the size that includes \0 in order to preserve existing
behaviour (return 0 when \0 haven't been seen, return positive number
when it has been seen).

* ucopy.c (umovestr_peekdata, umovestr): Return string length
including \0 instead of 1 when \0 is found.
2018-01-19 22:45:34 +00:00
03766d6640 mpers.awk: avoid redefinition of mpers_ptr_t
Older versions of gcc like those found in RHEL6 fail with the following
diagnostics:

  In file included from block.c:32:
  ./mpers-m32/struct_blk_user_trace_setup.h:2: error: redefinition of typedef ‘mpers_ptr_t’
  mpers_type.h:44: note: previous declaration of ‘mpers_ptr_t’ was here

* mpers.awk (END): Add #ifndef guard to mpers_ptr_t typedef.
* mpers_test.sh: Update expected output.
2018-01-19 17:50:09 +00:00
b2fe2a60ac Add support for --enable-mpers=m32|mx32
* configure.ac (AC_ARG_ENABLE([mpers])): Allow m32 and mx32 values
for --enable-mpers option.
* m4/mpers.m4 (st_MPERS): Check for personality support if personality
name is provided as an option.  Fail if the requested personality
support is not available.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-19 17:50:09 +00:00
b3d691efe4 tests: improve setugid error diagnostics a bit
* tests/setugid.c (main): Print unexpected code returned by syscall.
2018-01-19 17:50:09 +00:00
457ad95b7f v4l2: do not mpersify struct v4l2_create unless it is used by other code
This fixes build with mpers support on older systems that lack
definition of struct v4l2_create.

* v4l2.c: Wrap references to struct v4l2_create with
[VIDIOC_CREATE_BUFS].
2018-01-19 17:50:09 +00:00
e05a4be54b btrfs: use uint32_t instead of __u32
* btrfs.c (btrfs_ioctl) [!HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE]:
Replace __u32 with uint32_t.  Remove useless cast.
2018-01-18 17:44:56 +00:00
488110f800 strace.1.in: clarify mpers flags in strace -V output
The previous description was a bit dated.

* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Remove "no-m32" and
"no-mx32", describe the situation when some of mpers flags are not
present in strace -V output.
2018-01-19 01:04:37 +00:00
d9f6166f0c Add compat support for s390x
By very popular demand.

While we are here, let's refactor the condition for old_mmap_pgoff into
an arch-specific one, as it is used more than in one place.

* NEWS: Mention this.
* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Likewise.
* configure.ac (case "$host_cpu" in) <s390x>: Set arch_m32 to s390, set
cc_flags_m32 to -m31.
(st_MPERS([m32])): Add s390x.
* defs.h [S390X]: Define NEED_UID16_PARSERS.
* linux/s390/arch_sigreturn.c [!S390_FRAME_PTR] (S390_FRAME_PTR): New
macro, define to s390_frame_ptr.
[!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE): New macro, define to
__SIGNAL_FRAMESIZE.
[!PTR_TYPE] (PTR_TYPE): New macro, define to unsigned long.
(arch_sigreturn): Use S390_FRAME_PTR, SIGNAL_FRAMESIZE, and PTR_TYPE
instead of s390_frame_ptr, __SIGNAL_FRAMESIZE, and pointer-sized type,
respectively.
* linux/s390/get_error.c [!ARCH_REGSET] (ARCH_REGSET): New macro, define
* to s390_regset.
(get_error): Use it instead of s390_regset.
* linux/s390/get_scno.c (arch_get_scno): Likewise.
* linux/s390/get_syscall_args.c (get_syscall_args): Likewise.
* linux/s390/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/s390x/arch_regs.c (psw_compat_t, s390_compat_regs,
s390x_regs_union, s390_frame_ptr, s390x_frame_ptr, s390x_io): New
variables.
(s390_regset, s390x_regset, ARCH_REGS_FOR_GETREGSET,
ARCH_IOVEC_FOR_GETREGSET, ARCH_PC_REG, ARCH_PERSONALITY_0_IOV_SIZE,
ARCH_PERSONALITY_1_IOV_SIZE): New macros.
* linux/s390x/arch_regs.h (s390_frame_ptr, s390x_frame_ptr): New
prototypes.
* linux/s390x/arch_rt_sigframe.c: Conditionalize on tcp->currpers.
* linux/s390x/arch_sigreturn.c: Likewise.
* linux/s390x/get_error.c: Likewise.
* linux/s390x/get_scno.c: Likewise.
* linux/s390x/get_syscall_args.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/s390x/errnoent1.h: New file.
* linux/s390x/ioctls_arch1.h: Likewise.
* linux/s390x/ioctls_inc1.h: Likewise.
* linux/s390x/signalent1.h: Likewise.
* linux/s390x/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add new files added to linux/s390x.
* supported_personalities.h [S390X] (SUPPORTED_PERSONALITIES): Define
to 2.
* tests/strace-V.test: Add s390 to the list of architectures that have
m32 personality.
* linux/s390/arch_defs.h (HAVE_ARCH_OLD_MMAP_PGOFF): New macro.
* linux/s390x/arch_defs.h: Likewise.
* mem.c: Replace #ifdef S390 with #ifdef HAVE_ARCH_OLD_MMAP_PGOFF.
* pathtrace.c: Likewise.
2018-01-19 02:04:37 +01:00
6850ddbc42 Update NEWS 2018-01-18 02:17:12 +01:00
119b6a1a1d tests: check path tracing of ppoll syscall
* tests/ppoll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add a test call that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/ppoll-P.c: New file.
* tests/pure_executables.list: Add ppoll-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (ppoll-P): New entry.
2018-01-17 21:31:07 +00:00
96dbdc342d tests: check path tracing of poll syscall
* tests/poll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add tests calls that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/poll-P.c: New file.
* tests/pure_executables.list: Add poll-P.
* tests/.gitignore: Likewise.
* tests/poll-P.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add poll-P.test.
2018-01-17 21:31:07 +00:00
89b39224fd tests: enable old_mmap-P.test on s390x
As s390x is the only 64-bit architecture that has old_mmap,
the test needs some adjustments there.

* tests/old_mmap.c: Update condition.
(main): Change int types to long, extend numerals to 64 bit, change
printing format qualifiers to corresponding long types.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-17 04:34:49 +00:00
afd9e5e801 tests: check path tracing of old mmap syscall
* tests/old_mmap.c [!TEST_FD]: Define TEST_FD.
(main) <args1_c>: Replace 5th argument with TEST_FD.
(main): Wrap the output for the calls that do not use TEST_FD
with #ifndef PATH_TRACING.
* tests/old_mmap-P.c: New file.
* tests/pure_executables.list: Add old_mmap-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in: Add old_mmap-P test.
2018-01-17 04:34:49 +00:00
d3890c53c8 Fix pathtrace for old_mmap/old_mmap_pgoff
As these system calls have only one argument that points to the
location in memory containing actual arguments, current path tracing
implementation is incorrect.  In order to fix this, let's use recently
introduced fetch_old_mmap_args in order to get actual arguments suitable
for path matching.

* pathtrace.c [HAVE_ARCH_OLD_MMAP] <case SEN_old_mmap,
case SEN_old_mmap_pgoff>: Retrieve actual old_mmap arguments with
fetch_old_mmap_args, pass the value from the retrieved args if it's
available.
2018-01-17 04:34:49 +00:00
4c34c65d97 Test non-verbose old_mmap output
* tests/old_mmap-v-none.c: New file.  Include old_mmap.c.
* tests/pure_executables.list: Add old_mmap-v-none.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (old_mmap-v-none): New entry.
2018-01-17 04:34:49 +00:00
187c8dd975 mem.c: use runtime check in fetch_old_mmap_args
This makes code a bit cleaner and makes it compatible with the upcoming
s390x compat support.

* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Replace
ANY_WORDSIZE_LESS_THAN_KERNEL_LONG check with current_wordsize == 4
check.
2018-01-17 04:34:49 +00:00
52314cc9a4 mem.c: introduce fetch_old_mmap_args
Move common old_mmap/old_mmap_pgoff argument fetching code into a
separate function.

As it is, it also fixes the case of non-verbose printing of old_mmap
arguments (see the new test in the next commit).  Also, it is a
preparation for the fix of path tracing for these syscalls.

* defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New prototype.
* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New function.
[HAVE_ARCH_OLD_MMAP] (old_mmap, old_mmap_pgoff): Use it.

Fixes: 3db07f11 "Fix old_mmap output when mmap arguments are unfetchable"
Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-17 04:34:49 +00:00
408ce203da Introduce arch-specific define HAVE_ARCH_OLD_MMAP
* linux/arch_defs.h: New file.
* linux/aarch64/arch_defs.h: New file.  Define HAVE_ARCH_OLD_MMAP.
* linux/arm/arch_defs.h: Likewise.
* linux/i386/arch_defs.h: Likewise.
* linux/m68k/arch_defs.h: Likewise.
* linux/s390/arch_defs.h: Likewise.
* linux/s390x/arch_defs.h: Likewise.
* linux/x32/arch_defs.h: Likewise.
* linux/x86_64/arch_defs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Include "arch_defs.h"
* mem.c: Replace condition for SYS_FUNC(old_mmap) with #ifdef
HAVE_ARCH_OLD_MMAP.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-17 04:34:49 +00:00
16046f7773 tests: improve descriptor set syntax testing
* tests/filtering_fd-syntax.test: New file.
* tests/options-syntax.test: Move descriptor set syntax testing
to filtering_fd-syntax.test.
* tests/Makefile.am (MISC_TESTS): Add filtering_fd-syntax.test.

Co-authored-by: Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
2018-01-17 03:22:07 +00:00
0918b3145c strace.c: print correct out file name in error messages in case of -ff
* strace.c (outf_perror): New function.
(tvprintf, tprints, flush_tcp_output): Use it.
2018-01-16 22:54:38 +00:00
4af6378100 aarch64: use ARCH_SET_PERSONALITY_FROM_IOV_SIZE
* linux/aarch64/arch_regs.c (ARCH_PERSONALITY_0_IOV_SIZE,
ARCH_PERSONALITY_1_IOV_SIZE): New macros.
* linux/aarch64/get_scno.c (arch_get_scno): Do not call
update_personality as it is handled by the generic get_regs code now.
2018-01-16 22:54:38 +00:00
64fd0ce626 syscall.c: add ability to set personality based on GETREGSET iov size
Some architectures (aarch64, s390x) use only PTRACE_GETREGSET interface
and use its size to detect current personality. Let's generalise this
approach and also avoid subtle errors when we get register but forget to
update personality, at least for those architectures.

Note that in order to employ this behaviour, architecture has to use
PTRACE_GETREGSET exclusively (no HAVE_GETREGS_OLD) and should declare
appropriate ARCH_PERSONALITY_*_IOV_SIZE macros.

* syscall.c (get_regs) [ptrace_getregset_or_getregs &&
!HAVE_GETREGS_OLD]: Call update_personality based on the value returned
in the iov_len field by PTRACE_GETREGSET.  Warn once if the returned
iov_len is unknown.
2018-01-16 22:54:38 +00:00
a4886a7f99 syscall.c: add sanity check for the target personality number
We can never be cautious enough.

* defs.h (set_personality): Change argument type to unsigned int.
* syscall.c (set_personality): Change argument type to unsigned int,
check whether requested personality is sane, die otherwise.
2018-01-16 22:54:38 +00:00
1fd3b7e30a syscall.c: move current_personality check to set_personality
As all the personality-dependent entries are initially in sync, we can
move the check whether we are setting the same personality as we
currently are inside set_personality out of update_personality.

* syscall.c (current_wordsize, current_klongsize): Initialise to 0'th
personality value in order to make the statement about "all the
personality-dependent entries are initially in sync" true.
(set_personality): Check whether requested personality differs from
current_personality.
(update_personality): Call set_personality unconditionally.
2018-01-16 22:54:38 +00:00
7d9a21fcba syscall.c: always update tcp->currpers in update_personality
Sometimes (for example, switching from a process with one personality
to a process that previously had different personality but returning
from execve to that same personality into) it is possible that
current_personality is not changed, but tcp->currpers is different.
So, let's not return from update_personality and always update
tcp->currpers if it differs from the target personality.

* syscall.c (update_personality): Do not exit early if personality ==
current_personality.
2018-01-16 22:54:38 +00:00
396961b1b4 Update current_personality on tcb switch
* strace.c (set_current_tcp): New function.
(printleader, droptcb, print_event_exit, next_event, dispatch_event):
Call set_current_tcp instead of setting current_tcp manually.
2018-01-16 22:54:38 +00:00
558ece68c8 Add support for specifying compiler options for mpers builds
Because some architectures are very, very special.

* configure.ac (cc_flags_m32, cc_flags_mx32): New variables. AC_SUBST
them.
* m4/mpers.m4 (MPERS_CFLAGS): Use instead of CFLAG, pushdef as
$cc_flags_$1.
Use mpers_name instead of CFLAG in AC_CACHE_CHECK messages.
Pass MPERS_CFLAGS as the second argument to mpers_test.sh
* mpers.sh: Add CC_ARCH_FLAGS as the second argument (PARSER_FILE
is moved to the third one). Do not expect leading dash in ARCH_FLAG
anymore.
* mpers_test.sh (mpers_cc_flags): New variable, initialise to the second
command line argument.
Pass $mpers_name without leading dash to mpers.sh.
Pass $mpers_cc_flags as the second argument to mpers.sh ($sample is
the third argument now).
* Makefile.am (mpers-m%.stamp:): Pass $(mpers_CC_FLAGS) as the second
argument to mpers.sh ($$f is now the third argument).
($(mpers_m32_targets)): Define target variable mpers_CC_FLAGS with the
value of @cc_flags_m32@
($(mpers_mx32_targets)): Define target variable mpers_CC_FLAGS with the
value of @cc_flags_mx32@
* tests/Makefile.am (MERS_CC_FLAGS): New variable.
* bootstrap: Append @cc_flags_$1@ to MPERS_CC_FLAGS. Append
$(MPERS_CC_FLAGS) to ARCH_MFLAGS.
2018-01-16 23:02:35 +01:00
114c7d3e80 tests: improve syscall set syntax testing
* tests/filtering_syscall-syntax.test: New file.
* tests/options-syntax.test: Move syscall set syntax testing
to filtering_syscall-syntax.test.
* tests/qual_fault-syntax.test: Likewise.
* tests/qual_inject-syntax.test: Likewise.
* tests/Makefile.am (MISC_TESTS): Add filtering_syscall-syntax.test.

Co-authored-by: Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
2018-01-16 04:34:25 +00:00
69bd90eb80 Enhance error diagnostics about invalid syscalls in fault injection syntax
Validate syscall set before the whole fault injection syntax.

* filter_qualify.c (parse_inject_expression): Add const qualifier to
return type.  Return an empty string when no syscall set is specified.
(qualify_inject_common): Add const qualifier to "name".  Move
qualify_syscall_tokens invocation right after parse_inject_expression.
* tests/qual_fault-syntax.test: Update expected output.
* tests/qual_inject-syntax.test: Likewise.
2018-01-16 04:34:25 +00:00
e6d3c79d60 basic_filters: use loop initial declarations
* basic_filters.c (qualify_syscall_number, qualify_syscall_regex,
lookup_class, qualify_syscall_class, qualify_syscall_tokens,
qualify_tokens): Use "for" loop initial declarations.
2018-01-16 01:09:14 +00:00
f31ef8f967 filter_qualify: use loop initial declarations
* filter_qualify.c (sigstr_to_uint, find_errno_by_name,
parse_inject_expression, qualify_inject_common, qualify): Use "for" loop
initial declarations.
2018-01-16 01:09:14 +00:00
376cf85efe configure: try to set the C compiler mode to accept ISO Standard C
* configure.ac: Use AC_PROG_CC_STDC.
* NEWS: Mention this.
2018-01-16 01:09:14 +00:00
4ab21ae0b8 pathtrace: update the list of unrelated syscalls
* pathtrace.c (pathtrace_match_set) <SEN_accept4, SEN_accept,
SEN_signalfd4, SEN_signalfd>: Skip matching.
2018-01-15 23:33:18 +00:00
3782831620 basic_filters: move legacy tracing class names to the end of table
* basic_filters.c (lookup_class) <syscall_class>: Move names that do not
start with % to the end of table.
2018-01-15 22:58:48 +00:00
8672a7189d Enhance decoding of mq_* syscalls
* mq.c (SYS_FUNC(mq_open)): Add RVAL_FD to return value.
(SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive), SYS_FUNC(mq_notify),
SYS_FUNC(mq_getsetattr)): Print the first argument using printfd.
* NEWS: Mention this change.
* pathtrace.c (pathtrace_match_set) <SEN_mq_getsetattr, SEN_mq_notify,
SEN_mq_open, SEN_mq_timedreceive, SEN_mq_timedsend>: Skip matching.
* linux/32/syscallent.h (mq_getsetattr, mq_notify, mq_open,
mq_timedreceive, mq_timedsend): Add TD flag.
* 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.
2018-01-15 22:47:38 +00:00
24d48dde06 Enhance error diagnostics about invalid syscalls in fault injection syntax
* basic_filters.c (qualify_syscall_tokens): Remove "name" argument,
assume its value is "system call".
* filter.h (qualify_syscall_tokens): Remove "name" argument.
All callers updated.
* tests/qual_fault-syntax.test: Update expected output.
2018-01-15 18:16:31 +00:00
7ef06058e2 basic_filters: handle "all" in a more readable way
* basic_filters.c (qualify_syscall_tokens, qualify_tokens): Remove
handle_inversion label, handle "all" by invoking invert_number_set_array
directly.
2018-01-15 16:23:54 +00:00
5f2597ef21 filter: remove redundant braces around single line expressions
* basic_filters.c (qualify_syscall_class, qualify_syscall_name):
Rearrange the inner loop body.
(qualify_syscall_number, lookup_class, qualify_syscall_tokens,
qualify_tokens): Remove redundant braces around single line expressions.
* filter_qualify.c (qualify_inject_common): Likewise.
2018-01-15 16:23:54 +00:00
79a08404d8 filter_qualify: move memory allocation from parse_inject_expression
* filter_qualify.c (parse_inject_expression): Replace "s" and "buf"
arguments with "str" argument, use it instead of "s" and "*buf".
(qualify_inject_common): Rename "buf" to "copy", initialize it to a copy
of "str", pass "copy" to parse_inject_expression instead of "str" and
"buf".
2018-01-15 16:23:54 +00:00
4e5033c8d2 xlat: update NT_* constants
Update NT_* descriptor types with the values borrowed from
kernel's include/uapi/linux/elf.h and glibc's elf.h.

* xlat/nt_descriptor_types.in (NT_PRSTATUS, NT_FPREGSET, NT_PRPSINFO,
NT_PRXREG, NT_TASKSTRUCT, NT_PLATFORM, NT_AUXV, NT_GWINDOWS, NT_ASRS,
NT_PSTATUS, NT_PSINFO, NT_PRCRED, NT_UTSNAME, NT_LWPSTATUS,
NT_LWPSINFO, NT_PRFPXREG, NT_PRXFPREG, NT_PPC_VMX, NT_PPC_SPE,
NT_PPC_VSX, NT_386_TLS, NT_386_IOPERM, NT_X86_XSTATE): Add fallback
definitions.
(NT_SIGINFO, NT_FILE, NT_PPC_*, NT_S390_*, NT_ARM_*, NT_METAG_*,
NT_ARC_V2): New constants.
* NEWS: Mention this.
2018-01-14 23:08:10 +00:00
752e6b4792 configure: use AC_MSG_ERROR and AC_MSG_FAILURE consistently
* configure.ac [$arch = mips]: Use AC_MSG_FAILURE instead of
AC_MSG_ERROR when _MIPS_SIM cannot be determined.  Use AC_MSG_ERROR
instead of AC_MSG_FAILURE when syscallent stubs cannot be generated.
2018-01-13 13:46:45 +00:00
3eb199a29d configure: add --disable-mpers and --enable-mpers=check options
On architectures supporting multiple personalities, multiple
personalities support in strace is required for proper decoding of
structures used by tracees with personalities that differ from the
personality of strace.

New configure options control whether multiple personalities support
in strace is mandatory, optional, or disabled.

The default is changed from what is now equivalent of
--enable-mpers=check (automatically detect whether required mpers
support could be enabled) to --enable-mpers (terminate the build
if required mpers support could not be enabled).

* configure.ac (AC_ARG_ENABLE([mpers])): New option.
* m4/mpers.m4 (st_MPERS): Use enable_mpers.  Terminate the build
if mpers could not be enabled and enable_mpers==yes.
* strace.spec.in: Specify --enable-mpers=check to %configure.
* debian/rules (build/Makefile, build64/Makefile): Specify
--enable-mpers=check to configure.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
Suggested-by: DJ Delorie <dj@redhat.com>
2018-01-11 23:09:56 +00:00
649dd83545 Update ioctl entries from linux v4.15-rc7
* linux/32/ioctls_inc_align16.h: Update from linux v4.15-rc7 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.
* NEWS: Mention this.
2018-01-11 19:24:15 +00:00
88fa069e35 Issue a warning when strace lacks tracee personality support
* defs.h (HAVE_PERSONALITY_1_MPERS, HAVE_PERSONALITY_2_MPERS): New
macros.
* syscall.c (update_personality): Add need_mpers_warning array
initialized with mpers support data.  Use it for printing the mpers
unavailability warning once per personality.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-01-11 15:54:33 +00:00
671f2ffcdc tests: add more checks of reboot syscall decoding
In particular, check for the recent fixes in reboot syscall decoder.

* tests/gen_tests.in (reboot): Provide -s 256 option.
* tests/reboot.c (STR32, STR128): New macros.
(main): Add more checks.
2018-01-11 15:54:33 +00:00
ce98c7b297 tests: use sprintrc in reboot.test
* test/reboot.c (main): Use sprintrc instead of old-style manual
printing of return code.
2018-01-11 15:54:33 +00:00
395c90f71c reboot.c: limit printing of the fourth argument to 255 bytes
The size of kernel buffer is 256 bytes and the last byte is always zero.

* reboot.c (SYS_FUNC(reboot)): Replace printstr call with printstr_ex
with size of 255 and style flag QUOTE_0_TERMINATED.
2018-01-11 15:54:33 +00:00
92eb77e8c3 reboot.c: use printxval instead of printflags
Numeric arguments of reboot syscall are not flags but magic values.

* reboot.c (SYS_FUNC(reboot)): Replace printflags with printxval.
2018-01-11 15:54:33 +00:00
843369ebe1 Search for <libiberty/demangle.h> in addition to <demangle.h>
This is the location where this header is installed on Debian-based
systems.

* configure.ac: Check for libiberty/demangle.h in addition to
demangle.h.
* unwind.c [USE_DEMANGLE]: Include either <demangle.h> or
<libiberty_demangle.h> based on the presence of HAVE_DEMANGLE_H and
HAVE_LIBIBERTY_DEMANGLE_H macros.
2018-01-11 15:54:33 +00:00
459b13e1b8 strace.1: fix typo
* strace.1.in (.SH NOTES): Replace prlimit with prlimit64.
2018-01-11 15:54:33 +00:00
b172dbf27a Document multiple personalities support
* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): New section.
2018-01-11 15:54:33 +00:00
7dbc3780a6 Add indication of mpers support to strace -V output
* strace.c (print_version): Append information about m32 and mx32
decoding support.
* tests/strace-V.test: Update expected output.
2018-01-11 15:54:33 +00:00
5c3d4b631d Provide strace's native arch to the test framework
* configure.ac (arch_native): New variable, set to arch.
* tests/Makefile.am (NATIVE_ARCH): New variable, set to @arch_native@.
(AM_TEST_LOG_FLAGS): Pass NATIVE_ARCH as STRACE_NATIVE_ARCH environment
variable.
2018-01-11 15:54:33 +00:00
8cea0b917a Add indication of optional demangle feature strace -V output
* strace.c (print_version) [USE_DEMANGLE]: Append " stack-demangle"
to the features string.
* tests/strace-V.test: Update expected output.
2018-01-11 15:54:33 +00:00
54402590c3 configure.ac: check for mpers support on RISC-V
* confgure.ac (st_MPERS([m32])): Add riscv.
2018-01-11 15:54:33 +00:00
0b803f8edd Use xappendstr instead of xsnprintf where suitable
Replace occurrences of

    outptr += xsnprintf(outptr, sizeof(outstr) - (outptr - outstr), ...)

with much more sleek

    outptr = xappendstr(outstr, outptr, ...)

* desc.c (decode_select): Replace xsnprintf with xappendstr.
* open.c (sprint_open_modes): Likewise.
* poll.c (decode_poll_exiting): Likewise.
* signal.c (sprintsigmask_n): Likewise.
* xlat.c (sprintflags): Likewise.
2018-01-11 15:54:33 +00:00
fdec47f63f xstring.h: add xappendstr
Introduce a macro for handling common case of partial writes
to a character array.

* xstring.h (get_pos_diff_): New function.
(xappendstr): New macro.
2018-01-11 15:54:33 +00:00
3b871d948f Update perf-related flags
- PERF_SAMPLE_BRANCH_TYPE_SAVE, added in v4.14-rc1~173^2~33^2~6
 - PERF_SAMPLE_PHYS_ADDR, added in v4.14-rc1~173^2~2

* xlat/perf_branch_sample_type.in (PERF_SAMPLE_BRANCH_TYPE_SAVE): New
flag.
* xlat/perf_event_sample_format.in (PERF_SAMPLE_PHYS_ADDR): Likewise.
* tests/perf_event_open.c: Update expected output.
2018-01-11 15:54:33 +00:00
7527de8263 perf.c: add support for struct perf_event_attr.namespaces
This field was introduced by linux kernel commit v4.12-rc1~152^2~42^2~10.

* configure.ac (AC_CHECK_MEMBERS): Add  perf_event_attr.namespaces.
* perf_event_struct.h (struct perf_event_attr): Add namespaces field.
* perf.c (print_perf_event_attr): Print namespaces field.
Update comment for __reserved_1 field.
* tests/perf_event_open.c (struct pea_flags): Add namespaces field.
(print_event_attr): Update expected output.
2018-01-11 15:54:33 +00:00
fd334b39b0 tests: check decoding of [gs]et_thread_area syscalls on x86
* tests/xet_thread_area_x86.c: New file.
* tests/xet_thread_area_x86.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/.gitignore: Add xet_thread_area_x86.
* tests/pure_executables.list: Likewise.
2018-01-11 15:54:33 +00:00
692d8a6e54 tests: check decoding of modify_ldt with for 4-byte-available user_desc
Since there is possibility now that strace read only entry_number field
of the user_desc struct, let's check that it doesn't do it with
modify_ldt syscall.

* tests/modify_ldt.c (main): Add 4-byte-sized tail_alloc'ed variable.
Try to provide it as an argument to modify_ldt.
2018-01-10 01:57:53 +00:00
0c7e458044 Allow separate printing of struct user_desc.entry_number
Kernel reads only entry_number field in the beginning of the
get_thread_area syscall handler.  Let's replicate this behaviour.

* defs.h (enum user_desc_print_filter): New enumeration.
(print_user_desc): Add an argument for signalling which part of the
structure should be printed.
* clone.c (print_tls_arg): Update print_user_desc call.
* ldt.c (print_user_desc): Add filter argument.  Print entry_number on
entering and the rest on exiting. Store entering value of the
entry_number field in order to print the updated value in the impossible
case of changed entry_number value.
(SYS_FUNC(modify_ldt), SYS_FUNC(set_thread_area)): Update
print_user_desc call.
(SYS_FUNC(get_thread_area)): Call print_user_desc with
USER_DESC_ENTERING format argument on entering and with
USER_DESC_EXITING on exiting.
2018-01-10 01:57:53 +00:00
1e23e9aab8 tests: move struct user_desc printing function into a separate file
As part of preparation for the introduction of [gs]et_thread_area test.

* tests/modify_ldt.c (print_user_desc): Move it ...
* tests/print_user_desc.c: ... to new file.
* tests/Makefile.am (EXTRA_DIST): Add print_user_desc.c.
2018-01-10 01:57:53 +00:00
ede97886b8 tests: check decoding of modify_ldt syscall
* tests/modify_ldt.c: New file.
* tests/gen_tests.in: Add modify_ldt test.
* tests/pure_executables.list: Add modify_ldt.
* tests/.gitignore: Likewise.
2018-01-08 00:40:22 +00:00
8830aa8fca ldt.c: manually set modify_ldt's error code
* ldt.c (modify_ldt): Move parsing under entering(tcp). Check whether
return code is erroneous and set tcp->u_error appropriately along with
RVAL_PRINT_ERR_VAL flag.
2018-01-08 00:40:22 +00:00
03cb7092d3 syscall.c: add support for printing return value and error code
Some weird syscalls (like modify_ldt) return value that doesn't indicate
an error (less than -4096), but it is, in fact, erroneous (because they
decide to clip the return value to 32-bit, for example).

Add a flag to print decoded error code along with syscall return value.

* defs.h (RVAL_PRINT_ERR_VAL): New rval flag.
* syscall.c (syscall_exiting_trace): Handle it.
2018-01-08 00:40:22 +00:00
b65f452393 ldt.c: print the first argument of modify_ldt as int
* ldt.c (SYS_FUNC(modify_ldt)): Print the first argument as %d.
2018-01-08 00:40:22 +00:00
916cb4ec13 ldt.c: print lm field for 64-bit tracees
* configure.ac (AC_CHECK_MEMBERS): Add struct user_desc.lm.
* ldt.c (print_user_desc) [HAVE_STRUCT_USER_DESC_LM]: Print lm field
for non-compat tracees (it is ignored for compat ones).
2018-01-08 00:40:22 +00:00
3d51a91276 ldt.c: make struct user_desc output more structured
Also, while we are here, let's fix print qualifiers (which should be %u
and not %d).

* ldt.c (print_user_desc): Use PRINT_FIELD_* macros for printing
structure.
(SYS_FUNC(set_thread_area)): Change field key-value separator from ":"
to "=", change print format qualifier from %d to %u.
2018-01-08 00:40:22 +00:00
03a7b946e2 print_fields.h: add PRINT_FIELD_U_CAST
Add a macro for printing fields explicitly casted to specific type.
This is useful for bit fields, as otherwise the magic of *_extend_to_*
macros breaks.

* print_field.h (PRINT_FIELD_U_CAST): New macro.
2018-01-08 00:40:22 +00:00
45532079c6 print_fields.h: rename PRINT_FIELD_UID to PRINT_FIELD_ID
As uid is not the only thing that has a special treatment of the -1
value (and, as a result, needs special care), let's rename
PRINT_FIELD_UID to PRINT_FIELD_ID and make PRINT_FIELD_UID its alias.

* print_fields.h (PRINT_FIELD_ID): Rename from PRINT_FIELD_UID.
(PRINT_FIELD_UID): Define to PRINT_FIELD_ID.
2018-01-08 00:40:22 +00:00
a35f7f1fa1 Fix build on systems without linux/genetlink.h
* socketutils.c [!HAVE_LINUX_GENETLINK_H] (genl_families_xlat): Add
tcp argument.

Fixes: v4.20-134-gc46fefc ("Add tcp arguments to netlink calls")
2018-01-07 23:23:01 +00:00
b9e8a352d5 count.c: whitespace 2018-01-07 16:46:32 +00:00
48b96efc22 count.c: cleanup types and sizeof usage
* count.c (call_summary_pers): Change the type of sorted_count
to "unsigned int *".  Replace sizeof(int) with  sizeof(sorted_count[0]).
Change the type of idx to unsigned int.
2018-01-07 16:46:32 +00:00
e7362ec6dc count.c: collect definitions of format strings in one place
In an attempt to make it more readable.

* count.c (call_summary_pers): Put all format strings in static
constants. Use them.
2018-01-07 16:46:32 +00:00
c46fefcad3 Add tcp arguments to netlink calls
Since they call tracee-specific socket/sendmsg/recvmsg, we'd like to
pass tcp there.

* defs.h (genl_families_xlat): Add tcp argument.
* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_generic,
decode_nlmsg_type_netfilter, typedef nlmsg_types_decoder_t): Likewise.
(decode_nlmsg_type): Add tcp argument. Pass tcp to decoder call.
(print_nlmsghdr): Pass tcp to the decode_nlmsg_type call.
* socketutils.c (send_query, receive_responses): Add tcp argument.
(inet_send_query, unix_send_query, netlink_send_query, ): Add tcp argument.
Pass tcp to the send_query call.
(unix_get): Add tcp argument. Pass tcp to the unix_send_query and
receive_responses calls.
(inet_get): Add tcp argument. Pass tcp to the inet_send_query and
receive_responses calls.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Add tcp argument. Pass
tcp to the inet_get call.
(netlink_get): Add tcp argument. Pass tcp to the netlink_send_query and
receive_responses calls.
(protocols): Add tcp argument to the get field.
(get_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
the protocols[].get calls.
(print_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
the get_sockaddr_by_inode_uncached call.
(get_sockaddr_by_inode): Pass tcp to the get_sockaddr_by_inode_uncached
call.
(print_sockaddr_by_inode): Pass tcp to the
print_sockaddr_by_inode_uncached call.
(genl_send_dump_families): Add tcp argument. Pass tcp to the send_query
call.
(genl_families_xlat): Add tcp argument. Pass tcp to the
genl_send_dump_families and receive_responses calls.
2018-01-07 16:46:32 +00:00
562abec971 Add tcp argument to clear_regs
* defs.h (clear_regs): Add argument struct tcb *tcp.
* syscall.c (clear_regs): Likewise.
* strace.c (next_event): Pass tcp to clear_regs() call.
2018-01-07 16:46:32 +00:00
bf2e6250bb Pass tcp argument to get_optmem_max/read_int_from_file
In preparation to passing tcp to all tracee-related syscalls.

* defs.h (read_int_from_file): Add "struct tcb *" as the first argument.
* util.c (read_int_from_file): Likewise.
* msghdr.c (get_optmem_max): Add "struct tcb *tcp" as the first
argument, pass it to read_int_from_file call.
(decode_msg_control): Pass tcp to get_optmem_max.
2018-01-07 16:46:32 +00:00
cc057e03ae Include paths.h if it is available
Use the OS definition of _PATH_BSHELL macro if it is available.

* configure.ac (AC_CHECK_HEADERS): Add paths.h.
* strace.c [HAVE_PATHS_H]: Include paths.h.
2018-01-07 16:46:32 +00:00
6b3f423640 strace.c: avoid duplication of a format string in attach_tcb
* strace.c (attach_tcb): Add task_path variable with the output format.
Use it for the procdir declaration and xsprintf format string argument.
2018-01-07 16:46:32 +00:00
fef5bc0ef2 Move syscall_tampered to defs.h
* syscall.c (syscall_tampered): Move ...
* defs.h: ... here.
2018-01-07 03:11:21 +00:00
2e351de149 strace.c: rename set_sigaction to set_sighandler
Since set_sigaction() actually specifies sa_handler and not sa_sigaction,
rename set_sigaction() to set_sighandler() for future definition of
set_sigaction() function as specifying sa_sigaction.

* strace.c (set_sigaction): Rename to set_sighandler.
All callers updated.
2018-01-07 03:11:21 +00:00
600b3834b0 .gitignore: ignore "gnu" directory created by st_MPERS m4 macro 2018-01-07 03:11:21 +00:00
803a19a2c3 Update .mailmap
* .mailmap (Elvira Khabirova): Add @altlinux.org.
2018-01-07 03:11:21 +00:00
7d9ff6d201 .mailmap: add canonical name for Chen Jingpiao
* .mailmap: Add canonical name for Chen Jingpiao.
2018-01-07 03:11:21 +00:00
306fbc65c2 personality.c: use sprintxval
* personality.c (SYS_FUNC(personality)): Use sprintxval instead of local
implementation.
2018-01-07 00:05:42 +00:00
a907f4a126 xlat.c: add sprintxval for printing xval to string
* defs.h (sprintxval): New declaration.
(sprintxval): New function.
2018-01-07 00:05:42 +00:00
d9175ac5ce desc.c: use xsnprintf instead of sprintf
* desc.c: Include "xstring.h".
(decode_select): Replace sprintf with xsnprintf.
2018-01-07 00:05:42 +00:00
6e67a2b71e xlat.c: use xsnprintf instead of sprintf
* xlat.c: Include "xstring.h".
(sprintflags): Replace sprintf with xsnprintf.
2018-01-07 00:05:42 +00:00
b75f886706 open.c: use xsnprintf instead of sprintf
* open.c: Include "xstring.h".
(sprint_open_modes): Replace sprintf with xsnprintf.
2018-01-07 00:05:42 +00:00
abe89bf315 poll.c: use xs*printf instead of sprintf
* poll.c: Include "xstring.h".
(decode_poll_exiting): Replace sprintf with xsnprintf and xsprintf.
2018-01-07 00:05:42 +00:00
eb662b2aee signal.c: use xs*printf instead of sprintf
* signal.c: Include "xstring.h".
(signame): Replace sprintf with xsprintf.
(sprintsigmask_n): Replace sprintf with xsnprintf.
2018-01-07 00:05:42 +00:00
a877397a79 print_timeval.c: use xsprintf instead of snprintf
* print_timeval.c: Include "xstring.h".
(sprint_timeval, sprint_timeval32): Replace snprintf with xsprintf.
2018-01-07 00:05:42 +00:00
56dd203511 print_timespec.c: use xsprintf instead of snprintf
* print_timespec.c: Include "xstring.h".
(sprint_timespec): Replace snprintf with xsprintf.
2018-01-07 00:05:42 +00:00
4ba39820f1 mmsghdr.c: use xsprintf instead of snprintf
* mmsghdr.c: Include "xstring.h".
(SYS_FUNC(recvmmsg)): Replace snprintf with xsprintf.
2018-01-07 00:05:42 +00:00
87f755658b socketutils.c: use xsprintf instead of snprintf
* socketutils.c: Include "xstring.h".
(unix_parse_response): Replace snprintf with xsprintf.
2018-01-07 00:05:42 +00:00
1d6274afb4 alpha.c: use xsprintf instead of snprintf
* alpha.c: Include "xstring.h".
(decode_getxxid): Replace snprintf with xsprintf.
2018-01-07 00:05:42 +00:00
edf6792d2a v4l2.c: use xsprintf instead of sprintf
* v4l2.c: Include "xstring.h".
(print_v4l2_create_buffers): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
ed22f8e219 util.c: use x*sprintf instead of s*printf
* util.c: Include "xstring.h".
(sprinttime_ex): Replace snprintf with xsnprintf.
(getfdproto): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
d6081c128c unwind.c: use xsprintf instead of sprintf
* unwind.c: Include "xstring.h".
(build_mmap_cache): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
2f1b943bb3 syscall.c: use xsprintf instead of sprintf
* syscall.c: Include "xstring.h".
(get_scno): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
1de7d6dcfd resource.c: use xsprintf instead of sprintf
* resource.c: Include "xstring.h".
(sprint_rlim64, sprint_rlim32): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
ffeaaa44c0 pathtrace.c: use xsprintf instead of sprintf
* pathtrace.c: Include "xstring.h".
(getfdpath): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
e0d0dec788 ldt.c: replace sprintf with xsprintf
* ldt.c: Include "xstring.h".
(SYS_FUNC(set_thread_area)): Replace sprintf with xsprintf.
2018-01-07 00:05:42 +00:00
026b76444e strace.c: use xsprintf instead of sprintf
* strace.c: Include "xstring.h".
(strerror, newoutf, attach_tcb, print_debug_info): Replace sprintf
with xsprintf.
2018-01-05 12:26:47 +00:00
5f1eafe8e4 ioprio.c: use xsprintf instead of sprintf
* ioprio.c: Include "xstring.h".
(sprint_ioprio): Replace sprintf with xsprintf.
2018-01-05 12:26:47 +00:00
0b92a3c933 Introduce hardened xsprintf/xsnprintf macros
Let's try to future/fool-proof code a bit by introducing variants
of sprintf/snprintf that die if an overflow (or an error) occurs.
They are deemed to be the default choice for printing to some local
string buffer where no sensible error handling is implemented.

* xstring.h: New file.
* Makefile.am (strace_SOURCES): Add it.
2018-01-05 12:26:47 +00:00
94264b790e count.c: use %9.u conversion specification
Instead of printing to a temporary string.  This also fixes a subtle bug
when the output for a billion errors and more is cut and shown
incorrectly.

* count.c (struct call_counts): Change type of calls and errors fields
to unsigned int since they are used and printed as unsigned anyway.
(call_summary_pers): Remove error_str.  Print cc->errors
and error_cum using %9.u conversion specification.
2018-01-05 12:26:47 +00:00
488a6b3192 count.c: use personality_names in call_summary report caption
Otherwise the title is quite misleading for x32 personality.

* count.c (call_summary): Use personality_names.
2018-01-05 12:26:47 +00:00
de6d88d305 Move personality names to a global variable
This is a part of "Prepare for adding support for Lua scripting"
commit.

* defs.h (personality_names): New external constant declaration.
* syscall.c: (personality_names): New global variable.
(update_personality): Use personality_names for reporting personality
name.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-01-05 12:26:47 +00:00
f5dc264d9d strace.spec.in: include Bluetooth headers for AF_BLUETOOTH sockets decoding
* strace.spec.in (BuildRequires): Add pkgconfig(bluez).
2018-01-04 10:52:07 +00:00
9cbb505f9f Lift artificial limit on output file names in -ff mode
Starting with commit v4.5.19~88 strace imposed an artificial limit
on output file names in -ff mode, leading to the following absurd
behaviour:

$ strace -ff -o"$(perl -e 'print "/" x 510')/$PWD/log" /bin/true
strace: Can't fopen '////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////.12345': Permission denied

* strace.c (newoutf): Raise buffer size to PATH_MAX.
(init) <followfork >= 2>: Check output file name prefix length.
* tests/options-syntax.test: Check it.
2018-01-04 10:52:07 +00:00
2216f14499 configure.ac: fix typo
* configure.ac: Replace CPPFALGS with CPPFLAGS.

Fixes: v4.20-85-gf9c8e8a ("unwind: demangle symbol names")
2018-01-04 00:23:04 +00:00
20ac169d7b Change the first argument of upeek from pid to tcp
All users were changed automatically by:

	for i in `git grep -l 'upeek(tcp->pid'`; do \
		sed -i 's/upeek(tcp->pid/upeek(tcp/g' "$i"; \
	done

* upeek.c (upeek): Change the first argument from pid_t pid to struct
tcb *tcp. Use tcp->pid instead of pid in the function's body.
* defs.h (upeek): Update declaration.
* linux/alpha/arch_getrval2.c: Pass tcp instead of tcp->pid to the
upeek calls.
* linux/alpha/arch_rt_sigframe.c: Likewise.
* linux/alpha/arch_sigreturn.c: Likewise.
* linux/alpha/get_scno.c: Likewise.
* linux/alpha/get_syscall_args.c: Likewise.
* linux/alpha/get_syscall_result.c: Likewise.
* linux/bfin/arch_rt_sigframe.c: Likewise.
* linux/bfin/get_scno.c: Likewise.
* linux/bfin/get_syscall_args.c: Likewise.
* linux/bfin/get_syscall_result.c: Likewise.
* linux/crisv10/arch_rt_sigframe.c: Likewise.
* linux/crisv10/get_scno.c: Likewise.
* linux/crisv10/get_syscall_args.c: Likewise.
* linux/crisv10/get_syscall_result.c: Likewise.
* linux/hppa/arch_rt_sigframe.c: Likewise.
* linux/hppa/get_scno.c: Likewise.
* linux/hppa/get_syscall_args.c: Likewise.
* linux/hppa/get_syscall_result.c: Likewise.
* linux/microblaze/arch_rt_sigframe.c: Likewise.
* linux/microblaze/arch_sigreturn.c: Likewise.
* linux/microblaze/get_scno.c: Likewise.
* linux/microblaze/get_syscall_args.c: Likewise.
* linux/microblaze/get_syscall_result.c: Likewise.
* linux/powerpc/getregs_old.c: Likewise.
* linux/sh/arch_getrval2.c: Likewise.
* linux/sh/arch_rt_sigframe.c: Likewise.
* linux/sh/get_scno.c: Likewise.
* linux/sh/get_syscall_args.c: Likewise.
* linux/sh/get_syscall_result.c: Likewise.
* linux/sh64/get_scno.c: Likewise.
* linux/sh64/get_syscall_args.c: Likewise.
* linux/sh64/get_syscall_result.c: Likewise.
* linux/xtensa/arch_rt_sigframe.c: Likewise.
* linux/xtensa/get_scno.c: Likewise.
* linux/xtensa/get_syscall_args.c: Likewise.
* linux/xtensa/get_syscall_result.c: Likewise.
* syscall.c: Likewise.
2018-01-04 00:37:27 +01:00
26d340fe9c Change argument of getregs_old from pid to tcp
* linux/powerpc/getregs_old.c (getregs_old): Change the first argument
from pid_t pid to struct tcb *tcp. Replace all instances of pid with
tcp->pid.
* linux/x86_64/getregs_old.c (getregs_old): Likewise.
* linux/x86_64/getregs_old.h (getregs_old): Update declaration.
* syscall.c (get_regs) [HAVE_GETREGS_OLD]: Pass tcp to the getregs_old
call instead of tcp->pid.
2018-01-04 00:17:24 +01:00
08e2fd253a Change the first argument of upoke from pid to tcp
Users were updated automatically by:

	for i in `git grep -l 'upoke(tcp->pid'`; do \
		sed -i 's/upoke(tcp->pid/upoke(tcp/g' "$i"; \
	done

* upoke.c (upoke): Change the first argument from pid_t pid to struct
tcb *tcp. Use tcp->pid instead of pid in the function's body.
* defs.h (upoke): Update declaration.
* linux/alpha/set_error.c (arch_set_error, arch_set_success): Provide
tcp in the first argument of the upoke call instead of tcp->pid.
* linux/alpha/set_scno.c (arch_set_scno): Likewise.
* linux/bfin/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/bfin/set_scno.c (arch_set_scno): Likewise.
* linux/crisv10/set_error.c (arch_set_error, arch_set_success):
Likewise.
* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
* linux/hppa/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/hppa/set_scno.c (arch_set_scno): Likewise.
* linux/i386/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/i386/set_scno.c (arch_set_scno): Likewise.
* linux/microblaze/set_error.c (arch_set_error, arch_set_success):
Likewise.
* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
* linux/powerpc/set_error.c (arch_set_error, arch_set_success):
Likewise.
* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
* linux/sh/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/sh/set_scno.c (arch_set_scno): Likewise.
* linux/sh64/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/sh64/set_scno.c (arch_set_scno): Likewise.
* linux/x86_64/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
* linux/xtensa/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
2018-01-04 00:16:21 +01:00
0b786d6641 Move enum trace_event into a separate header
As it will have users outside strace.c in the future.

* trace_event.h (enum trace_event): Move it from...
* strace.c (enum trace_event): ...here.
(#include "trace_event.h"): New header, for enum trace_event.
* Makefile.am (strace_SOURCES): Add trace_event.h.
2018-01-04 00:16:21 +01:00
576e2db4d0 Call get_scno during startup_tcb only for forcibly attached processes
Otherwise it makes little sense on most arches to try to get syscall
number.

* defs.h (TCB_GRABBED): New tcb flag.
* strace.c (attach_tcb): Set TCB_GRABBED for the tcb.
(startup_tcb): Call get_scno() only if process is grabbed and its
registers may contain syscall number information.

Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Closes: https://github.com/strace/strace/issues/22
2018-01-03 23:56:48 +01:00
45fa947494 strace.c: sort getopt switch branches alphabetically
There's no reason to have them out of order. This also (almost) matches
their order in the getopt call argument, introduced in
v4.20-64-g61c03be.

* strace.c (init): Sort branches in the getopt switch routine.
2018-01-01 17:34:57 +01:00
910364a5dc strace.c: check for (non)zero argc instead of argv[0]
Since we can never be sure that we have NULL behind the last entry of
the argv array.

* strace.c (init): Check for non-zero argc before/instead of argv[0].
2018-01-01 17:25:53 +01:00
bc3b5adccf strace.1: advertise strace-log-merge
In order to raise awareness about strace-log-merge, mention it in
SEE ALSO section and -ff option description.

* strace.1.in (.SS Filtering) <.TP .B \-ff>: Mention strace-log-merge.
(.SH "SEE ALSO"): Likewise.
2018-01-01 17:25:39 +01:00
8e959c4db9 unwind: demangle function arguments
* unwind.c (print_stack_frame): Specify demangling style.
* tests/strace-k.test (result): Update regexp.
* tests/strace-k-demangle.test (expected): Update expected output.
2017-12-29 17:59:29 +00:00
51a8225407 tests: check strace -k symbol names demangling
* tests/strace-k-demangle.test: New test.
* tests/stack-fcall-mangled.c: New file.
* tests/stack-fcall-mangled-0.c: Likewise.
* tests/stack-fcall-mangled-1.c: Likewise.
* tests/stack-fcall-mangled-2.c: Likewise.
* tests/stack-fcall-mangled-3.c: Likewise.
* tests/stack-fcall.h [MANGLE] (f0, f1, f2, f3): New macros.
* tests/.gitignore: Add stack-fcall-mangled.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(stack_fcall_mangled_SOURCES): New variable.
(EXTRA_DIST): Add strace-k-demangle.test.
[USE_LIBUNWIND && USE_DEMANGLE] (LIBUNWIND_TESTS): Likewise.
2017-12-29 15:20:21 +00:00
23af76cc12 tests: parametrize strace-k.test
Prepare for the check of strace -k symbol names demangling.

* tests/strace-k.test: Parametrize $test_prog and $expected.
* tests/stack-fcall.h: New file.
* tests/stack-fcall.c: Include "stack-fcall.h"
* tests/stack-fcall-0.c: Likewise.
* tests/stack-fcall-1.c: Likewise.
* tests/stack-fcall-2.c: Likewise.
* tests/stack-fcall-3.c: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add stack-fcall.h.
2017-12-29 15:20:21 +00:00
f9c8e8a5b6 unwind: demangle symbol names
Implement demangling of C++ symbol names in stack trace
using cplus_demangle function from GNU libiberty library.

This is an example demangled stack trace output:

fstat(5, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
 > /usr/lib64/libc-2.25.so(__fxstat64+0x12) [0xffd62]
 > /usr/lib64/libc-2.25.so(_IO_file_doallocate+0x5f) [0x717ff]
 > /usr/lib64/libc-2.25.so(_IO_doallocbuf+0x79) [0x81699]
 > /usr/lib64/libc-2.25.so(_IO_file_overflow+0x198) [0x807b8]
 > /usr/lib64/libc-2.25.so(_IO_file_xsputn+0xbd) [0x7ed5d]
 > /usr/lib64/libc-2.25.so(fwrite_unlocked+0x60) [0x7d800]
 > /usr/lib64/libleveldb.so.1.18(leveldb::EnvWrapper::StartThread+0x3b6) [0x48656]
 > /usr/lib64/libleveldb.so.1.18(leveldb::log::Writer::EmitPhysicalRecord+0x89) [0x28bc9]
 > /usr/lib64/libleveldb.so.1.18(leveldb::log::Writer::AddRecord+0x9e) [0x28d9e]
 > /usr/lib64/libleveldb.so.1.18(leveldb::DBImpl::Write+0x208) [0x1ce18]
 > /usr/lib64/libleveldb.so.1.18(leveldb::DB::Put+0x59) [0x192b9]
 > /usr/lib64/libleveldb.so.1.18(leveldb::DBImpl::Put+0x1d) [0x1931d]
 > /home/yamato/var/leveldb/doc/a.out(main+0x120) [0x1107]
 > /usr/lib64/libc-2.25.so(__libc_start_main+0xea) [0x2088a]
 > /home/yamato/var/leveldb/doc/a.out(_start+0x2a) [0xf3a]

* Makefile.am [USE_DEMANGLE] (strace_CPPFLAGS, strace_LDFLAGS,
libiberty_LDADD): Append libiberty_CPPFLAGS, strace_LDFLAGS, and
libiberty_LIBS, respectively.
* configure.ac: Add --with-libiberty option.  Check cplus_demangle
support in libiberty.
* unwind.c [USE_DEMANGLE]: Include <demangle.h>.
(print_stack_frame) [USE_DEMANGLE]: Use cplus_demangle.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2017-12-26 21:36:49 +00:00
b4f98f3d1f Define macros for renaming xmalloc and xcalloc
I'm planning to link strace with libiberty for mangling C++
symbol names in stack trace enabled with -k option.

Both names, xmalloc and xcalloc, are already defined and used
in libiberty, and they conflict with functions in strace.
Rename xmalloc and xcalloc functions defined in strace
to strace_xmalloc and strace_xcalloc, respectively,
to avoid this conflict.

* xmalloc.h (xcalloc, xmalloc): New macros.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2017-12-26 21:36:49 +00:00
9aa434bc6e syscall: move a sparc specific include to an arch specific file
* syscall.c [SPARC64]: Do not include <asm/psrcompat.h>.
[SPARC]: Do not include <asm/psr.h>.
* linux/sparc/get_error.c: Include <asm/psr.h>.
2017-12-24 18:49:26 +00:00
1e889f684d syscall: move all ia64 specific includes to an arch specific file
* syscall.c [IA64]: Remove.
* linux/ia64/get_syscall_args.c: Include <asm/rse.h>.
2017-12-24 18:49:26 +00:00
c82165113b syscall: simplify get_syscall_result
* syscall.c [ptrace_getregset_or_getregs] (get_syscall_result_regs):
Define to get_regs.
(get_syscall_result): Use get_syscall_result_regs unconditionally.
2017-12-24 16:07:18 +00:00
28182b505c syscall: change get_regs argument type
This opens the way for future changes related to get_regs.

* syscall.c (get_regs): Change argument type from "pid_t"
to "struct tcb *", all callers changed.
2017-12-24 16:07:18 +00:00
f05ea48c0a syscall: move get_regs call from syscall_exiting_decode to get_syscall_result
This make the code less confusing and opens the way for future changes
related to get_regs.

* syscall.c (syscall_exiting_decode): Move get_regs invocation ...
(get_syscall_result) [ptrace_getregset_or_getregs]: ... here.
2017-12-24 16:07:18 +00:00
1f0803c366 syscall: rework subcall decoding on mips o32
Move syscall subcall handling to the same switch statement that
handles ipc and socket subcalls.

* linux/mips/syscallent-o32.h [LINUX_MIPSO32] (SYS_syscall_subcall):
Define.
* syscall.c (decode_mips_subcall): Rename to decode_syscall_subcall,
conditionalize on SYS_syscall_subcall instead of LINUX_MIPSO32.
(syscall_entering_decode) [LINUX_MIPSO32]: Remove.
(syscall_entering_decode) [SYS_syscall_subcall]: Handle SEN_syscall
using decode_syscall_subcall.
2017-12-24 15:07:10 +00:00
660f100099 syscall: tweak shuffle_scno ifdefery
* syscall.c (shuffle_scno): Check for ARM_FIRST_SHUFFLED_SYSCALL
instead of ARM || AARCH64.  This does not result to any code change
but looks more comprehensible.
2017-12-24 15:07:10 +00:00
2a09a8cd8a syscall: change get_regs to return an error code
* syscall.c (get_regs_error) [!ptrace_getregset_or_getregs]: Do not
define.
(clear_regs) [!ptrace_getregset_or_getregs]: Do not set get_regs_error.
(get_regs) [ptrace_getregset_or_getregs]: Return get_regs_error, all
callers changed to test get_regs return code instead of get_regs_error
static variable, which is now internally used by get_regs() and
clear_regs() only.
(USE_GET_SYSCALL_RESULT_REGS): Do not define.
Use "#ifndef ptrace_getregset_or_getregs"
instead of "#ifdef USE_GET_SYSCALL_RESULT_REGS".
2017-12-24 12:40:00 +00:00
5453c146dc tests: enhance run.sh usage error diagnostics
* tests/run.sh: Execute timeout command only when invoked with
an argument, otherwise print an error message.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
2017-12-24 12:40:00 +00:00
67c934bf57 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.
2017-12-23 14:12:18 +00:00
2c8036a972 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.
2017-12-23 02:53:54 +00:00
e10a6d0d57 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.
2017-12-23 02:53:54 +00:00
a8e20500ca 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.
2017-12-23 02:10:13 +00:00
7396fbce27 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.
2017-12-23 01:51:29 +00:00
c91f4b400c 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.
2017-12-23 01:26:17 +00:00
392 changed files with 7907 additions and 3926 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@
/config.sub
/configure
/depcomp
/gnu
/install-sh
/ioctl_iocdef.[ih]
/ioctl_redefs[12].h

View File

@ -1,6 +1,7 @@
# Map git author names and email addresses to canonical/preferred form.
<ak@linux.intel.com> <ak@suse.de>
<chenjingpiao@gmail.com> <chenjingpiao@foxmail.com>
Chen Jingpiao <chenjingpiao@gmail.com>
Chen Jingpiao <chenjingpiao@gmail.com> <chenjingpiao@foxmail.com>
<damir@altlinux.org> <damir@altlinux.ru>
<dgilbert@redhat.com> <dave@treblig.org>
<edgar.iglesias@gmail.com> <edgar@axis.com>
@ -19,6 +20,7 @@
<will@williammanley.net> <william.manley@youview.com>
Carmelo Amoroso <carmelo.amoroso@st.com>
Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com> <edos@linux.com>
Elvira Khabirova <lineprinter@altlinux.org> <lineprinter0@gmail.com>
Eugene Syromyatnikov <evgsyr@gmail.com>
Eugene Syromyatnikov <evgsyr@gmail.com> <esyr@redhat.com>
Frederik Schüler <fs@debian.org>

View File

@ -27,13 +27,13 @@ matrix:
- compiler: gcc
env:
- TARGET=x86
- compiler: clang-3.8
- compiler: clang
env:
- TARGET=x86_64
- compiler: musl-gcc
env:
- TARGET=x86_64
- compiler: clang-3.8
- compiler: clang
env:
- TARGET=x86
- compiler: musl-gcc

View File

@ -4,7 +4,7 @@
# Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
# Copyright (c) 2002-2017 The strace developers.
# Copyright (c) 2002-2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -70,8 +70,10 @@ noinst_LIBRARIES = libstrace.a
libstrace_a_CPPFLAGS = $(strace_CPPFLAGS)
libstrace_a_CFLAGS = $(strace_CFLAGS)
libstrace_a_SOURCES = \
fetch_indirect_syscall_args.c \
fstatfs.c \
fstatfs64.c \
getpagesize.c \
ipc.c \
sigreturn.c \
socketcall.c \
@ -88,6 +90,7 @@ strace_SOURCES = \
affinity.c \
aio.c \
alpha.c \
arch_defs.h \
basic_filters.c \
bind.c \
bjm.c \
@ -166,7 +169,8 @@ strace_SOURCES = \
kexec.c \
keyctl.c \
keyctl_kdf_params.h \
kvm.c \
kvm.c \
largefile_wrappers.h \
ldt.c \
link.c \
linux/asm_stat.h \
@ -251,6 +255,7 @@ strace_SOURCES = \
regs.h \
renameat.c \
resource.c \
riscv.c \
rt_sigframe.c \
rt_sigreturn.c \
rtc.c \
@ -267,6 +272,7 @@ strace_SOURCES = \
rtnl_rule.c \
rtnl_tc.c \
rtnl_tc_action.c \
s390.c \
sched.c \
sched_attr.h \
scsi.c \
@ -293,7 +299,6 @@ strace_SOURCES = \
strace.c \
string_to_uint.h \
string_to_uint.c \
supported_personalities.h \
swapon.c \
syscall.c \
sysctl.c \
@ -306,6 +311,7 @@ strace_SOURCES = \
term.c \
time.c \
times.c \
trace_event.h \
truncate.c \
ubi.c \
ucopy.c \
@ -326,6 +332,7 @@ strace_SOURCES = \
xlat.h \
xmalloc.c \
xmalloc.h \
xstring.h \
# end of strace_SOURCES
if USE_LIBUNWIND
@ -333,6 +340,11 @@ strace_SOURCES += unwind.c
strace_CPPFLAGS += $(libunwind_CPPFLAGS)
strace_LDFLAGS += $(libunwind_LDFLAGS)
strace_LDADD += $(libunwind_LIBS)
if USE_DEMANGLE
strace_CPPFLAGS += $(libiberty_CPPFLAGS)
strace_LDFLAGS += $(libiberty_LDFLAGS)
strace_LDADD += $(libiberty_LIBS)
endif
endif
@CODE_COVERAGE_RULES@
@ -379,23 +391,27 @@ EXTRA_DIST = \
linux/32/syscallent.h \
linux/64/ioctls_inc.h \
linux/64/syscallent.h \
linux/aarch64/arch_defs_.h \
linux/aarch64/arch_regs.c \
linux/aarch64/arch_regs.h \
linux/aarch64/arch_rt_sigframe.c\
linux/aarch64/arch_rt_sigframe.c \
linux/aarch64/arch_sigreturn.c \
linux/aarch64/errnoent1.h \
linux/aarch64/get_error.c \
linux/aarch64/get_scno.c \
linux/aarch64/get_syscall_args.c\
linux/aarch64/get_syscall_args.c \
linux/aarch64/ioctls_arch0.h \
linux/aarch64/ioctls_arch1.h \
linux/aarch64/ioctls_inc0.h \
linux/aarch64/ioctls_inc1.h \
linux/aarch64/nr_prefix.c \
linux/aarch64/set_error.c \
linux/aarch64/set_scno.c \
linux/aarch64/shuffle_scno.c \
linux/aarch64/signalent1.h \
linux/aarch64/syscallent.h \
linux/aarch64/syscallent1.h \
linux/alpha/arch_defs_.h \
linux/alpha/arch_getrval2.c \
linux/alpha/arch_regs.c \
linux/alpha/arch_regs.h \
@ -405,7 +421,7 @@ EXTRA_DIST = \
linux/alpha/get_error.c \
linux/alpha/get_scno.c \
linux/alpha/get_syscall_args.c \
linux/alpha/get_syscall_result.c\
linux/alpha/get_syscall_result.c \
linux/alpha/ioctls_arch0.h \
linux/alpha/ioctls_inc0.h \
linux/alpha/set_error.c \
@ -424,9 +440,11 @@ EXTRA_DIST = \
linux/arc/set_error.c \
linux/arc/set_scno.c \
linux/arc/syscallent.h \
linux/arch_defs_.h \
linux/arch_kvm.c \
linux/arch_regs.h \
linux/arch_sigreturn.c \
linux/arm/arch_defs_.h \
linux/arm/arch_regs.c \
linux/arm/arch_regs.h \
linux/arm/arch_rt_sigframe.c \
@ -436,8 +454,10 @@ EXTRA_DIST = \
linux/arm/get_syscall_args.c \
linux/arm/ioctls_arch0.h \
linux/arm/ioctls_inc0.h \
linux/arm/nr_prefix.c \
linux/arm/set_error.c \
linux/arm/set_scno.c \
linux/arm/shuffle_scno.c \
linux/arm/syscallent.h \
linux/arm/userent.h \
linux/avr32/arch_regs.c \
@ -452,6 +472,7 @@ EXTRA_DIST = \
linux/avr32/set_scno.c \
linux/avr32/syscallent.h \
linux/avr32/userent.h \
linux/bfin/arch_defs_.h \
linux/bfin/arch_regs.c \
linux/bfin/arch_rt_sigframe.c \
linux/bfin/get_error.c \
@ -465,33 +486,10 @@ EXTRA_DIST = \
linux/bfin/set_scno.c \
linux/bfin/syscallent.h \
linux/bfin/userent.h \
linux/crisv10/arch_regs.c \
linux/crisv10/arch_rt_sigframe.c\
linux/crisv10/arch_sigreturn.c \
linux/crisv10/get_error.c \
linux/crisv10/get_scno.c \
linux/crisv10/get_syscall_args.c \
linux/crisv10/get_syscall_result.c \
linux/crisv10/rt_sigframe.h \
linux/crisv10/set_error.c \
linux/crisv10/set_scno.c \
linux/crisv10/syscallent.h \
linux/crisv10/userent.h \
linux/crisv32/arch_regs.c \
linux/crisv32/arch_rt_sigframe.c\
linux/crisv32/arch_sigreturn.c \
linux/crisv32/get_error.c \
linux/crisv32/get_scno.c \
linux/crisv32/get_syscall_args.c \
linux/crisv32/get_syscall_result.c \
linux/crisv32/rt_sigframe.h \
linux/crisv32/set_error.c \
linux/crisv32/set_scno.c \
linux/crisv32/syscallent.h \
linux/crisv32/userent.h \
linux/dummy.h \
linux/errnoent.h \
linux/getregs_old.h \
linux/hppa/arch_defs_.h \
linux/hppa/arch_regs.c \
linux/hppa/arch_regs.h \
linux/hppa/arch_rt_sigframe.c \
@ -508,6 +506,7 @@ EXTRA_DIST = \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
linux/i386/arch_kvm.c \
linux/i386/arch_defs_.h \
linux/i386/arch_regs.c \
linux/i386/arch_regs.h \
linux/i386/arch_rt_sigframe.c \
@ -523,6 +522,7 @@ EXTRA_DIST = \
linux/i386/syscallent.h \
linux/i386/userent.h \
linux/i386/userent0.h \
linux/ia64/arch_defs_.h \
linux/ia64/arch_getrval2.c \
linux/ia64/arch_regs.c \
linux/ia64/arch_regs.h \
@ -538,6 +538,7 @@ EXTRA_DIST = \
linux/ia64/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
linux/m68k/arch_defs_.h \
linux/m68k/arch_regs.c \
linux/m68k/arch_regs.h \
linux/m68k/arch_rt_sigframe.c \
@ -563,8 +564,9 @@ EXTRA_DIST = \
linux/metag/set_error.c \
linux/metag/set_scno.c \
linux/metag/syscallent.h \
linux/microblaze/arch_defs_.h \
linux/microblaze/arch_regs.c \
linux/microblaze/arch_rt_sigframe.c\
linux/microblaze/arch_rt_sigframe.c \
linux/microblaze/arch_sigreturn.c \
linux/microblaze/get_error.c \
linux/microblaze/get_scno.c \
@ -576,6 +578,7 @@ EXTRA_DIST = \
linux/microblaze/set_scno.c \
linux/microblaze/syscallent.h \
linux/microblaze/userent.h \
linux/mips/arch_defs_.h \
linux/mips/arch_getrval2.c \
linux/mips/arch_regs.c \
linux/mips/arch_regs.h \
@ -598,8 +601,8 @@ EXTRA_DIST = \
linux/mips/syscallent-o32.h \
linux/mips/syscallent.h \
linux/mips/userent.h \
linux/mtd-abi.h \
linux/netlink_diag.h \
linux/nios2/arch_defs_.h \
linux/nios2/arch_regs.c \
linux/nios2/arch_regs.h \
linux/nios2/arch_rt_sigframe.c \
@ -611,6 +614,7 @@ EXTRA_DIST = \
linux/nios2/set_error.c \
linux/nios2/set_scno.c \
linux/nios2/syscallent.h \
linux/nr_prefix.c \
linux/or1k/arch_regs.c \
linux/or1k/arch_regs.h \
linux/or1k/arch_rt_sigframe.c \
@ -624,10 +628,10 @@ EXTRA_DIST = \
linux/or1k/syscallent.h \
linux/or1k/userent.h \
linux/packet_diag.h \
linux/personality.h \
linux/powerpc/arch_defs_.h \
linux/powerpc/arch_regs.c \
linux/powerpc/arch_regs.h \
linux/powerpc/arch_rt_sigframe.c\
linux/powerpc/arch_rt_sigframe.c \
linux/powerpc/arch_sigreturn.c \
linux/powerpc/errnoent.h \
linux/powerpc/get_error.c \
@ -641,9 +645,10 @@ EXTRA_DIST = \
linux/powerpc/set_scno.c \
linux/powerpc/syscallent.h \
linux/powerpc/userent.h \
linux/powerpc64/arch_defs_.h \
linux/powerpc64/arch_regs.c \
linux/powerpc64/arch_regs.h \
linux/powerpc64/arch_rt_sigframe.c\
linux/powerpc64/arch_rt_sigframe.c \
linux/powerpc64/arch_sigreturn.c \
linux/powerpc64/errnoent.h \
linux/powerpc64/errnoent1.h \
@ -663,7 +668,7 @@ EXTRA_DIST = \
linux/powerpc64/syscallent.h \
linux/powerpc64/syscallent1.h \
linux/powerpc64/userent.h \
linux/ptp_clock.h \
linux/riscv/arch_defs_.h \
linux/riscv/arch_regs.c \
linux/riscv/arch_regs.h \
linux/riscv/arch_rt_sigframe.c \
@ -681,6 +686,7 @@ EXTRA_DIST = \
linux/riscv/syscallent.h \
linux/riscv/syscallent1.h \
linux/rt_sigframe.h \
linux/s390/arch_defs_.h \
linux/s390/arch_regs.c \
linux/s390/arch_regs.h \
linux/s390/arch_rt_sigframe.c \
@ -697,20 +703,27 @@ EXTRA_DIST = \
linux/s390/userent.h \
linux/s390/userent0.h \
linux/s390/userent1.h \
linux/s390x/arch_defs_.h \
linux/s390x/arch_regs.c \
linux/s390x/arch_regs.h \
linux/s390x/arch_rt_sigframe.c \
linux/s390x/arch_sigreturn.c \
linux/s390x/errnoent1.h \
linux/s390x/get_error.c \
linux/s390x/get_scno.c \
linux/s390x/get_syscall_args.c \
linux/s390x/ioctls_arch0.h \
linux/s390x/ioctls_arch1.h \
linux/s390x/ioctls_inc0.h \
linux/s390x/ioctls_inc1.h \
linux/s390x/rt_sigframe.h \
linux/s390x/set_error.c \
linux/s390x/set_scno.c \
linux/s390x/signalent1.h \
linux/s390x/syscallent.h \
linux/s390x/syscallent1.h \
linux/s390x/userent.h \
linux/sh/arch_defs_.h \
linux/sh/arch_getrval2.c \
linux/sh/arch_regs.c \
linux/sh/arch_rt_sigframe.c \
@ -725,6 +738,7 @@ EXTRA_DIST = \
linux/sh/syscallent.h \
linux/sh/userent.h \
linux/sh/userent0.h \
linux/sh64/arch_defs_.h \
linux/sh64/arch_regs.c \
linux/sh64/arch_regs.h \
linux/sh64/arch_rt_sigframe.c \
@ -739,16 +753,17 @@ EXTRA_DIST = \
linux/sh64/set_scno.c \
linux/sh64/syscallent.h \
linux/sh64/userent.h \
linux/shuffle_scno.c \
linux/signalent.h \
linux/smc_diag.h \
linux/sock_diag.h \
linux/sparc/arch_defs_.h \
linux/sparc/arch_getrval2.c \
linux/sparc/arch_regs.c \
linux/sparc/arch_regs.h \
linux/sparc/arch_rt_sigframe.c \
linux/sparc/arch_sigreturn.c \
linux/sparc/errnoent.h \
linux/sparc/gen.pl \
linux/sparc/get_error.c \
linux/sparc/get_scno.c \
linux/sparc/get_syscall_args.c \
@ -760,16 +775,17 @@ EXTRA_DIST = \
linux/sparc/signalent.h \
linux/sparc/syscallent.h \
linux/sparc/userent.h \
linux/sparc64/arch_defs_.h \
linux/sparc64/arch_getrval2.c \
linux/sparc64/arch_regs.c \
linux/sparc64/arch_regs.h \
linux/sparc64/arch_rt_sigframe.c\
linux/sparc64/arch_rt_sigframe.c \
linux/sparc64/arch_sigreturn.c \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
linux/sparc64/get_error.c \
linux/sparc64/get_scno.c \
linux/sparc64/get_syscall_args.c\
linux/sparc64/get_syscall_args.c \
linux/sparc64/ioctls_arch0.h \
linux/sparc64/ioctls_arch1.h \
linux/sparc64/ioctls_inc0.h \
@ -784,6 +800,7 @@ EXTRA_DIST = \
linux/sparc64/userent.h \
linux/subcall.h \
linux/syscall.h \
linux/tile/arch_defs_.h \
linux/tile/arch_regs.c \
linux/tile/arch_regs.h \
linux/tile/arch_rt_sigframe.c \
@ -803,10 +820,10 @@ EXTRA_DIST = \
linux/tile/syscallent.h \
linux/tile/syscallent1.h \
linux/tile/userent.h \
linux/ubi-user.h \
linux/unix_diag.h \
linux/userent.h \
linux/userent0.h \
linux/x32/arch_defs_.h \
linux/x32/arch_kvm.c \
linux/x32/arch_regs.c \
linux/x32/arch_regs.h \
@ -823,10 +840,12 @@ EXTRA_DIST = \
linux/x32/rt_sigframe.h \
linux/x32/set_error.c \
linux/x32/set_scno.c \
linux/x32/shuffle_scno.c \
linux/x32/signalent1.h \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
linux/x86_64/arch_defs_.h \
linux/x86_64/arch_kvm.c \
linux/x86_64/arch_regs.c \
linux/x86_64/arch_regs.h \
@ -834,7 +853,6 @@ EXTRA_DIST = \
linux/x86_64/arch_sigreturn.c \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
linux/x86_64/gentab.pl \
linux/x86_64/get_error.c \
linux/x86_64/get_scno.c \
linux/x86_64/get_syscall_args.c \
@ -849,6 +867,7 @@ EXTRA_DIST = \
linux/x86_64/rt_sigframe.h \
linux/x86_64/set_error.c \
linux/x86_64/set_scno.c \
linux/x86_64/shuffle_scno.c \
linux/x86_64/signalent1.h \
linux/x86_64/signalent2.h \
linux/x86_64/syscallent.h \
@ -878,7 +897,7 @@ EXTRA_DIST = \
$(XLAT_INPUT_FILES) \
$(XLAT_HEADER_FILES) \
xlat/gen.sh \
xlate.el
# end of EXTRA_DIST
.PHONY: check-valgrind-local
check-valgrind-local:
@ -999,7 +1018,7 @@ mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \
CPP="$(CPP)" \
CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \
$(srcdir)/mpers.sh -$(mpers_NAME) $$f || exit; \
$(srcdir)/mpers.sh $(mpers_NAME) $(mpers_CC_FLAGS) $$f || exit; \
done
> $@
@ -1070,6 +1089,7 @@ BUILT_SOURCES += $(mpers_m32_targets)
CLEANFILES += $(mpers_m32_targets)
$(mpers_m32_targets): mpers_NAME = m32
$(mpers_m32_targets): mpers_CC_FLAGS = @cc_flags_m32@
endif # HAVE_M32_MPERS
@ -1086,6 +1106,7 @@ BUILT_SOURCES += $(mpers_mx32_targets)
CLEANFILES += $(mpers_mx32_targets)
$(mpers_mx32_targets): mpers_NAME = mx32
$(mpers_mx32_targets): mpers_CC_FLAGS = @cc_flags_mx32@
endif # HAVE_MX32_MPERS

59
NEWS
View File

@ -1,20 +1,75 @@
Noteworthy changes in release ?.?? (????-??-??)
Noteworthy changes in release 4.21 (2018-02-13)
===============================================
* Changes in behaviour
* Warning is now issued when -F option is used.
* Warning is now issued when a tracee with unsupported personality
is attached.
* Unknown syscall numbers are now printed in hexadecimal form.
* Improvements
* Implemented decoding of netlink descriptor attributes as file descriptors.
* Implemented decoding of hugetlb page size selection flags.
* Implemented decoding of BPF_PROG_TEST_RUN, BPF_PROG_GET_NEXT_ID,
BPF_MAP_GET_NEXT_ID, BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID,
and BPF_OBJ_GET_INFO_BY_FD commands of bpf syscall.
* Enhanced decoding of get_thread_area, memfd_create, modify_ldt,
perf_event_open, reboot, s390_guarded_storage, s390_pcio_mmio_read,
s390_pci_mmio_write, s390_runtime_instr, s390_sthyi, set_thread_area,
and shmget syscalls.
* Implemented decoding of KVM_* and DM_LIST_DEVICES ioctl commands.
* Implemented decoding of riscv_flush_icache syscall.
* Enhanced decoding of getsockopt and setsockopt syscalls for SOL_NETLINK
level.
* Enhanced decoding of BPF_MAP_CREATE command of bpf syscall.
* Updated lists of MSG_* and SHM_* constants.
* Print values returned by mq_open syscall and first arguments
of mq_getsetattr, mq_notify, mq_timedreceive, and mq_timedsend syscalls
as file descriptors.
* Added decoding of get_tls syscall on arm.
* Added -e trace=%pure option for tracing system calls with no arguments that
never fail.
* Updated lists of IPV6_*, MAP_*, MEMBARRIER_CMD_*, MSG_*, NT_*, PKEY_*,
SHM_*, and TCP_* constants.
* Added manual page for the strace-log-merge command.
* Updated lists of ioctl commands from Linux 4.15.
* Implemented biarch support for s390x.
* Implemented an optional support for symbol demangling in strace -k output
(activated by --with-libiberty configure option).
* Information about availability of demangling and reliable personality
decoding (on architectures with multiple personalities) is now available
in strace -V output.
* Added decoding of pkey_alloc, pkey_free, and pkey_mprotect syscalls on
powerpc and powerpc64.
* Enhanced manual page.
* Bug fixes
* Fixed multi-personality support in cross builds.
* Added mq_getsetattr, mq_notify, mq_open, mq_timedreceive, and mq_timedsend
syscalls to %desc tracing set.
* Fixed path tracing support for mmap syscalls with indirect arguments and
for old select syscall.
* Fixed decoding of arm-specific (__ARM_NR_*) syscalls.
* Fixed open mode flags decoding.
* Fixed corner cases in handling of strace -ff -ttt logs by strace-log-merge.
* Error counts that exceed one billion are now printed correctly in call
summary output.
* Fixed call summary header for x32 personality.
* Changes of tracee personalities are reported more reliably.
* Fixed the case when strace attaches to a tracee being inside exec and its
first syscall stop is syscall-exit-stop instead of syscall-enter-stop,
which messed up all the syscall state tracking.
* Fixed printing of higher 32 bits of the return value for x32 personality.
* Portability
* A C compiler that supports "for" loop initial declarations is now required.
* Inability to configure multiple personality support on architectures where
multiple personalities are supported leads to configuration failure during
build now. Use --enable-mpers=check to revert to the old behaviour.
* Build-time requirement for the mpers support has been lowered from gawk 4
to gawk 3.
* Removed incomplete and non-functional support for the CRIS architecture.
* Removed incomplete and unused support for IA-32 mode on the IA-64
architecture.
Noteworthy changes in release 4.20 (2017-11-13)
===============================================

View File

@ -11,4 +11,6 @@ Please read the file [INSTALL-git](INSTALL-git.md) for installation instructions
The user discussion and development of strace take place on [the strace mailing list](https://lists.sourceforge.net/lists/listinfo/strace-devel) -- everyone is welcome to post bug reports, feature requests, comments and patches to strace-devel@lists.sourceforge.net. The mailing list archives are available at https://sourceforge.net/p/strace/mailman/strace-devel/ and other archival sites.
The GIT repository of strace is available at [SourceForge](https://sourceforge.net/p/strace/code/ci/master/tree/), [GitHub](https://github.com/strace/strace/), and [GitLab](https://gitlab.com/strace/strace/).
[![Build Status](https://travis-ci.org/strace/strace.svg?branch=master)](https://travis-ci.org/strace/strace) [![Code Coverage](https://codecov.io/github/strace/strace/coverage.svg?branch=master)](https://codecov.io/github/strace/strace?branch=master)

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -29,6 +30,8 @@
#ifdef ALPHA
# include "xstring.h"
static int
decode_getxxid(struct tcb *tcp, const char *what)
{
@ -40,7 +43,7 @@ decode_getxxid(struct tcb *tcp, const char *what)
return 0;
static const char const fmt[] = "%s %ld";
static char outstr[sizeof(fmt) + 3 * sizeof(rval)];
snprintf(outstr, sizeof(outstr), fmt, what, rval);
xsprintf(outstr, fmt, what, rval);
tcp->auxstr = outstr;
return RVAL_STR;
}

8
arch_defs.h Normal file
View File

@ -0,0 +1,8 @@
/* Aarch-specific definitions. */
#ifndef STRACE_ARCH_DEFS_H
#define STRACE_ARCH_DEFS_H
#include "arch_defs_.h"
#include "linux/arch_defs_.h"
#endif /* !STRACE_ARCH_DEFS_H */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -38,13 +38,11 @@ qualify_syscall_number(const char *s, struct number_set *set)
if (n < 0)
return false;
unsigned int p;
bool done = false;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
if ((unsigned) n >= nsyscall_vec[p]) {
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
if ((unsigned) n >= nsyscall_vec[p])
continue;
}
add_number_to_set_array(n, set, p);
done = true;
}
@ -71,12 +69,10 @@ qualify_syscall_regex(const char *s, struct number_set *set)
if ((rc = regcomp(&preg, s, REG_EXTENDED | REG_NOSUB)) != 0)
regerror_msg_and_die(rc, &preg, "regcomp", s);
unsigned int p;
bool found = false;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name)
continue;
rc = regexec(&preg, sysent_vec[p][i].sys_name,
@ -101,13 +97,6 @@ lookup_class(const char *s)
const char *name;
unsigned int value;
} syscall_class[] = {
{ "desc", TRACE_DESC },
{ "file", TRACE_FILE },
{ "memory", TRACE_MEMORY },
{ "process", TRACE_PROCESS },
{ "signal", TRACE_SIGNAL },
{ "ipc", TRACE_IPC },
{ "network", TRACE_NETWORK },
{ "%desc", TRACE_DESC },
{ "%file", TRACE_FILE },
{ "%memory", TRACE_MEMORY },
@ -122,13 +111,20 @@ lookup_class(const char *s)
{ "%statfs", TRACE_STATFS },
{ "%fstatfs", TRACE_FSTATFS },
{ "%%statfs", TRACE_STATFS_LIKE },
{ "%pure", TRACE_PURE },
/* legacy class names */
{ "desc", TRACE_DESC },
{ "file", TRACE_FILE },
{ "memory", TRACE_MEMORY },
{ "process", TRACE_PROCESS },
{ "signal", TRACE_SIGNAL },
{ "ipc", TRACE_IPC },
{ "network", TRACE_NETWORK },
};
unsigned int i;
for (i = 0; i < ARRAY_SIZE(syscall_class); ++i) {
if (strcmp(s, syscall_class[i].name) == 0) {
for (unsigned int i = 0; i < ARRAY_SIZE(syscall_class); ++i) {
if (strcmp(s, syscall_class[i].name) == 0)
return syscall_class[i].value;
}
}
return 0;
@ -141,37 +137,42 @@ qualify_syscall_class(const char *s, struct number_set *set)
if (!n)
return false;
unsigned int p;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name
|| (sysent_vec[p][i].sys_flags & n) != n) {
continue;
}
add_number_to_set_array(i, set, p);
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
if (sysent_vec[p][i].sys_name &&
(sysent_vec[p][i].sys_flags & n) == n)
add_number_to_set_array(i, set, p);
}
}
return true;
}
kernel_long_t
scno_by_name(const char *s, unsigned int p, kernel_long_t start)
{
if (p >= SUPPORTED_PERSONALITIES)
return -1;
for (kernel_ulong_t i = start; i < nsyscall_vec[p]; ++i) {
if (sysent_vec[p][i].sys_name &&
strcmp(s, sysent_vec[p][i].sys_name) == 0)
return i;
}
return -1;
}
static bool
qualify_syscall_name(const char *s, struct number_set *set)
{
unsigned int p;
bool found = false;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name
|| strcmp(s, sysent_vec[p][i].sys_name)) {
continue;
}
add_number_to_set_array(i, set, p);
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
for (kernel_long_t scno = 0;
(scno = scno_by_name(s, p, scno)) >= 0;
++scno) {
add_number_to_set_array(scno, set, p);
found = true;
}
}
@ -202,8 +203,7 @@ qualify_syscall(const char *token, struct number_set *set)
* according to STR specification.
*/
void
qualify_syscall_tokens(const char *const str, struct number_set *const set,
const char *const name)
qualify_syscall_tokens(const char *const str, struct number_set *const set)
{
/* Clear all sets. */
clear_number_set_array(set, SUPPORTED_PERSONALITIES);
@ -213,7 +213,6 @@ qualify_syscall_tokens(const char *const str, struct number_set *const set,
* of the remaining specification.
*/
const char *s = str;
handle_inversion:
while (*s == '!') {
invert_number_set_array(set, SUPPORTED_PERSONALITIES);
++s;
@ -227,8 +226,9 @@ handle_inversion:
*/
return;
} else if (strcmp(s, "all") == 0) {
s = "!none";
goto handle_inversion;
/* "all" == "!none" */
invert_number_set_array(set, SUPPORTED_PERSONALITIES);
return;
}
/*
@ -240,22 +240,19 @@ handle_inversion:
*/
char *copy = xstrdup(s);
char *saveptr = NULL;
const char *token;
bool done = false;
for (token = strtok_r(copy, ",", &saveptr); token;
token = strtok_r(NULL, ",", &saveptr)) {
for (const char *token = strtok_r(copy, ",", &saveptr);
token; token = strtok_r(NULL, ",", &saveptr)) {
done = qualify_syscall(token, set);
if (!done) {
error_msg_and_die("invalid %s '%s'", name, token);
}
if (!done)
error_msg_and_die("invalid system call '%s'", token);
}
free(copy);
if (!done) {
error_msg_and_die("invalid %s '%s'", name, str);
}
if (!done)
error_msg_and_die("invalid system call '%s'", str);
}
/*
@ -273,7 +270,6 @@ qualify_tokens(const char *const str, struct number_set *const set,
* of the remaining specification.
*/
const char *s = str;
handle_inversion:
while (*s == '!') {
invert_number_set_array(set, 1);
++s;
@ -287,8 +283,9 @@ handle_inversion:
*/
return;
} else if (strcmp(s, "all") == 0) {
s = "!none";
goto handle_inversion;
/* "all" == "!none" */
invert_number_set_array(set, 1);
return;
}
/*
@ -300,22 +297,19 @@ handle_inversion:
*/
char *copy = xstrdup(s);
char *saveptr = NULL;
const char *token;
int number = -1;
for (token = strtok_r(copy, ",", &saveptr); token;
token = strtok_r(NULL, ",", &saveptr)) {
for (const char *token = strtok_r(copy, ",", &saveptr);
token; token = strtok_r(NULL, ",", &saveptr)) {
number = func(token);
if (number < 0) {
if (number < 0)
error_msg_and_die("invalid %s '%s'", name, token);
}
add_number_to_set(number, set);
}
free(copy);
if (number < 0) {
if (number < 0)
error_msg_and_die("invalid %s '%s'", name, str);
}
}

View File

@ -10,9 +10,12 @@ for m in m32 mx32; do
rm -rf $tests
mkdir $tests
s='[[:space:]]*'
[ "$m" = m32 ] && k="s/^\\(SIZEOF_KERNEL_LONG_T$s=\\).*/\\1 4/;" || k=
sed "s/@arch@/@arch_$m@/;
s/^\\(SIZEOF_LONG$s=\\).*/\\1 4/; $k
s/^MPERS_NAME$s=.*/& $m/;
s/^ARCH_MFLAGS$s=.*/& -DMPERS_IS_\$(MPERS_NAME) -$m/" \
s/^MPERS_CC_FLAGS$s=.*/& @cc_flags_$m@/;
s/^ARCH_MFLAGS$s=.*/& -DMPERS_IS_\$(MPERS_NAME) \$(MPERS_CC_FLAGS)/" \
tests/Makefile.am > $tests/Makefile.am
for f in tests/*; do
case "${f##*/}" in

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2016-2017 The strace developers.
* Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -787,7 +787,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
char uuid[UUID_STRING_SIZE+1];
uint32_t nodesize, sectorsize, clone_alignment;
#ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
__u32 *reserved32;
uint32_t *reserved32;
#endif
if (entering(tcp))
@ -802,7 +802,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
sectorsize = args.sectorsize,
clone_alignment = args.clone_alignment;
#else
reserved32 = (__u32 *) (void *) args.reserved;
reserved32 = (void *) args.reserved;
nodesize = reserved32[0];
sectorsize = reserved32[1];
clone_alignment = reserved32[2];

View File

@ -4,7 +4,7 @@
* Copyright (c) 2008 Jan Kratochvil <jan.kratochvil@redhat.com>
* Copyright (c) 2009-2013 Denys Vlasenko <dvlasenk@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -49,7 +49,7 @@
# define ARG_PTID (tcp->scno == __NR_clone2 ? 3 : 2)
# define ARG_CTID (tcp->scno == __NR_clone2 ? 4 : 3)
# define ARG_TLS (tcp->scno == __NR_clone2 ? 5 : 4)
#elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
#elif defined S390 || defined S390X
# define ARG_STACK 0
# define ARG_FLAGS 1
# define ARG_PTID 2
@ -84,7 +84,7 @@ print_tls_arg(struct tcb *const tcp, const kernel_ulong_t addr)
if (current_personality == 1)
# endif
{
print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
print_user_desc(tcp, tcp->u_arg[ARG_TLS], USER_DESC_BOTH);
}
# if SUPPORTED_PERSONALITIES > 1
else

View File

@ -5,7 +5,7 @@
# Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
# Copyright (c) 2002-2017 The strace developers.
# Copyright (c) 2002-2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -52,6 +52,7 @@ DEB_CHANGELOGTIME="$(LC_TIME=C date -R)"
AC_SUBST(DEB_CHANGELOGTIME)
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CPP
st_WARN_CFLAGS
AX_PROG_CC_FOR_BUILD
@ -70,11 +71,38 @@ AC_SUBST([MANPAGE_DATE], [manpage_date])
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
cc_flags_m32=-m32
cc_flags_mx32=-mx32
case "$host_cpu" in
aarch64*)
arch=aarch64
arch_m32=arm
AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
;;
alpha*)
arch=alpha
AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
;;
arc*)
arch=arc
AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
;;
arm*)
arch=arm
AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
;;
avr32*)
arch=avr32
AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
;;
bfin)
arch=bfin
AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
;;
hppa*|parisc*)
arch=hppa
AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
;;
i[[3456]]86|pentium)
arch=i386
AC_DEFINE([I386], 1, [Define for the i386 architecture.])
@ -87,26 +115,25 @@ m68k)
arch=m68k
AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
;;
sparc64*)
arch=sparc64
arch_m32=sparc
AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
;;
sparc*)
arch=sparc
AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
;;
metag*)
arch=metag
AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
;;
microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
mips*)
arch=mips
AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
;;
alpha*)
arch=alpha
AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
nios2*)
arch=nios2
AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
;;
or1k*)
arch=or1k
AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
;;
powerpc*)
AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
@ -119,22 +146,9 @@ powerpc*)
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
;;
arm*)
arch=arm
AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
;;
aarch64*)
arch=aarch64
arch_m32=arm
AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
;;
avr32*)
arch=avr32
AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
;;
arc*)
arch=arc
AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
riscv*)
arch=riscv
AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
;;
s390)
arch=s390
@ -142,12 +156,10 @@ s390)
;;
s390x)
arch=s390x
arch_m32=s390
cc_flags_m32=-m31
AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
;;
hppa*|parisc*)
arch=hppa
AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
;;
sh64*)
arch=sh64
AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
@ -156,6 +168,19 @@ sh*)
arch=sh
AC_DEFINE([SH], 1, [Define for the SH architecture.])
;;
sparc64*)
arch=sparc64
arch_m32=sparc
AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
;;
sparc*)
arch=sparc
AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
;;
tile*)
arch=tile
AC_DEFINE([TILE], 1, [Define for the Tile architecture])
;;
x86?64*)
arch_m32=i386
AC_TRY_COMPILE(
@ -169,42 +194,10 @@ x86?64*)
AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
fi
;;
cris|crisv10)
arch=crisv10
AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
;;
crisv32)
arch=crisv32
AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
;;
tile*)
arch=tile
AC_DEFINE([TILE], 1, [Define for the Tile architecture])
;;
microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
nios2*)
arch=nios2
AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
;;
or1k*)
arch=or1k
AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
;;
xtensa*)
arch=xtensa
AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
;;
riscv*)
arch=riscv
AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
;;
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
@ -212,6 +205,8 @@ riscv*)
esac
AC_MSG_RESULT($arch)
arch_native=$arch
test -n "$arch_m32" ||
arch_m32=$arch
test -n "$arch_mx32" ||
@ -219,12 +214,15 @@ test -n "$arch_mx32" ||
AC_SUBST(arch)
AC_SUBST(arch_m32)
AC_SUBST(arch_mx32)
AC_SUBST(cc_flags_m32)
AC_SUBST(cc_flags_mx32)
AC_SUBST(arch_native)
MIPS_ABI=
if test "$arch" = mips; then
AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], ,
[AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
[AC_MSG_FAILURE([_MIPS_SIM cannot be determined])])])
# requires GCC >= 3.4
AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
@ -277,6 +275,7 @@ AC_CHECK_FUNCS(m4_normalize([
fstatat
ftruncate
futimens
iconv_open
if_indextoname
open64
prctl
@ -304,7 +303,10 @@ AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
[#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
AC_CHECK_TYPES([struct user_desc],
[AC_CHECK_MEMBERS([struct user_desc.lm],,,
[#include <asm/ldt.h>])],,
[#include <asm/ldt.h>])
AC_CHECK_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,,
[#include <sys/types.h>
@ -364,6 +366,7 @@ AC_CHECK_MEMBERS(m4_normalize([
struct perf_event_attr.use_clockid,
struct perf_event_attr.context_switch,
struct perf_event_attr.write_backward,
struct perf_event_attr.namespaces,
struct perf_event_attr.bp_type,
struct perf_event_attr.config1,
struct perf_event_attr.config2,
@ -377,9 +380,11 @@ AC_CHECK_MEMBERS(m4_normalize([
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/guarded_storage.h
asm/sysmips.h
bluetooth/bluetooth.h
elf.h
iconv.h
inttypes.h
linux/bsg.h
linux/cryptouser.h
@ -422,6 +427,7 @@ AC_CHECK_HEADERS(m4_normalize([
mqueue.h
netinet/sctp.h
netipx/ipx.h
paths.h
scsi/sg.h
stropts.h
sys/conf.h
@ -541,6 +547,14 @@ AC_CHECK_TYPES([struct statfs64], [
AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>])
AC_CHECK_TYPES([struct mtd_write_req],,, [#include <mtd/mtd-abi.h>])
AC_CHECK_MEMBERS([struct ubi_attach_req.max_beb_per1024],,, [#include <mtd/ubi-user.h>])
AC_CHECK_TYPES(m4_normalize([
struct ptp_sys_offset
]),,, [#include <linux/ptp_clock.h>])
AC_CHECK_TYPES(m4_normalize([
struct kvm_regs,
struct kvm_sregs,
@ -741,11 +755,16 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
fi)
AC_CHECK_SIZEOF([long])
SIZEOF_LONG="$ac_cv_sizeof_long"
AC_SUBST(SIZEOF_LONG)
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
AC_CHECK_SIZEOF([kernel_long_t],,[#include "$srcdir/kernel_types.h"])
SIZEOF_KERNEL_LONG_T="$ac_cv_sizeof_kernel_long_t"
AC_SUBST(SIZEOF_KERNEL_LONG_T)
AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
@ -883,16 +902,84 @@ fi
AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
AC_MSG_RESULT([$use_libunwind])
dnl demangling symbols in the stack trace
libiberty_CPPFLAGS=
libiberty_LDFLAGS=
libiberty_LIBS=
AC_ARG_WITH([libiberty],
[AS_HELP_STRING([--with-libiberty],
[use libiberty to demangle symbols in stack trace])],
[case "${withval}" in
yes|no|check) ;;
*) with_libiberty=yes
libiberty_CPPFLAGS="-I${withval}/include"
libiberty_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libiberty=check]
)
use_libiberty=no
AS_IF([test "x$use_libunwind" = xyes && test "x$with_libiberty" != xno],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS"
AC_CHECK_HEADERS([demangle.h libiberty/demangle.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libiberty_LDFLAGS"
AC_CHECK_LIB([iberty],[cplus_demangle],
[libiberty_LIBS="-liberty"
use_libiberty=yes
],
[if test "x$with_libiberty" != xcheck; then
AC_MSG_FAILURE([failed to find cplus_demangle in libiberty])
fi
]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libiberty" != xcheck; then
AC_MSG_FAILURE([failed to find demangle.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
dnl enable libiberty
AC_MSG_CHECKING([whether to enable demangling symbols in stack trace])
if test "x$use_libiberty" = xyes; then
AC_DEFINE([USE_DEMANGLE], 1, [Do demangling symbols in stack trace])
AC_SUBST(libiberty_LIBS)
AC_SUBST(libiberty_LDFLAGS)
AC_SUBST(libiberty_CPPFLAGS)
fi
AM_CONDITIONAL([USE_DEMANGLE], [test "x$use_libiberty" = xyes])
AC_MSG_RESULT([$use_libiberty])
if test "$arch" = mips && test "$no_create" != yes; then
mkdir -p linux/mips
if $srcdir/linux/mips/genstub.sh linux/mips; then
AC_MSG_RESULT([Generated MIPS syscallent stubs])
else
AC_MSG_FAILURE([Failed to generate syscallent stubs])
AC_MSG_ERROR([Failed to generate syscallent stubs])
fi
fi
st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
AC_ARG_ENABLE([mpers],
[AS_HELP_STRING([--enable-mpers=yes|no|check|m32|mx32],
[whether to enable multiple personalities support required
for proper decoding of structures used by tracees with
personalities that differ from the personality of strace,
default is yes.])],
[case "$enableval" in
yes|no|check|m32|mx32) enable_mpers="$enableval" ;;
*) AC_MSG_ERROR([bad value $enableval for enable-mpers option.
Valid options are: yes, no, check, m32, mx32.])
;;
esac],
[enable_mpers=yes])
st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AX_VALGRIND_DFLT([sgcheck], [off])

49
count.c
View File

@ -8,7 +8,7 @@
* <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com>
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2006-2017 The strace developers.
* Copyright (c) 2006-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -40,7 +40,7 @@
struct call_counts {
/* time may be total latency or system time */
struct timeval time;
int calls, errors;
unsigned int calls, errors;
};
static struct call_counts *countv[SUPPORTED_PERSONALITIES];
@ -154,22 +154,24 @@ void set_overhead(int n)
static void
call_summary_pers(FILE *outf)
{
static const char dashes[] = "----------------";
static const char header[] = "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n";
static const char data[] = "%6.2f %11.6f %11lu %9u %9.u %s\n";
static const char summary[] = "%6.6s %11.6f %11.11s %9u %9.u %s\n";
unsigned int i;
int call_cum, error_cum;
unsigned int call_cum, error_cum;
struct timeval tv_cum, dtv;
double float_tv_cum;
double percent;
const char *dashes = "----------------";
char error_str[sizeof(int)*3];
int *sorted_count;
unsigned int *sorted_count;
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
fprintf(outf, header,
"% time", "seconds", "usecs/call",
"calls", "errors", "syscall");
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes);
sorted_count = xcalloc(sizeof(int), nsyscalls);
sorted_count = xcalloc(sizeof(sorted_count[0]), nsyscalls);
call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0;
if (overhead.tv_sec == -1) {
tv_mul(&overhead, &shortest, 8);
@ -188,39 +190,32 @@ call_summary_pers(FILE *outf)
float_tv_cum = tv_float(&tv_cum);
if (counts) {
if (sortfun)
qsort((void *) sorted_count, nsyscalls, sizeof(int), sortfun);
qsort((void *) sorted_count, nsyscalls,
sizeof(sorted_count[0]), sortfun);
for (i = 0; i < nsyscalls; i++) {
double float_syscall_time;
int idx = sorted_count[i];
unsigned int idx = sorted_count[i];
struct call_counts *cc = &counts[idx];
if (cc->calls == 0)
continue;
tv_div(&dtv, &cc->time, cc->calls);
error_str[0] = '\0';
if (cc->errors)
sprintf(error_str, "%u", cc->errors);
float_syscall_time = tv_float(&cc->time);
percent = (100.0 * float_syscall_time);
if (percent != 0.0)
percent /= float_tv_cum;
/* else: float_tv_cum can be 0.0 too and we get 0/0 = NAN */
fprintf(outf, "%6.2f %11.6f %11lu %9u %9.9s %s\n",
fprintf(outf, data,
percent, float_syscall_time,
(long) (1000000 * dtv.tv_sec + dtv.tv_usec),
cc->calls,
error_str, sysent[idx].sys_name);
cc->calls, cc->errors, sysent[idx].sys_name);
}
}
free(sorted_count);
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
error_str[0] = '\0';
if (error_cum)
sprintf(error_str, "%u", error_cum);
fprintf(outf, "%6.6s %11.6f %11.11s %9u %9.9s %s\n",
fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes);
fprintf(outf, summary,
"100.00", float_tv_cum, "",
call_cum, error_str, "total");
call_cum, error_cum, "total");
}
void
@ -236,8 +231,8 @@ call_summary(FILE *outf)
set_personality(i);
if (i)
fprintf(outf,
"System call usage summary for %d bit mode:\n",
current_wordsize * 8);
"System call usage summary for %s mode:\n",
personality_names[i]);
call_summary_pers(outf);
}

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: strace
Maintainer: Steve McIntyre <93sam@debian.org>
Section: utils
Priority: optional
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc sparc64 x32], debhelper (>= 7.0.0), gawk
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc sparc64 x32], debhelper (>= 7.0.0), gawk, libunwind-dev [amd64], libiberty-dev [amd64]
Standards-Version: 3.9.8
Homepage: https://strace.io
Vcs-Git: https://anonscm.debian.org/git/collab-maint/strace.git

14
debian/rules vendored
View File

@ -23,6 +23,8 @@ DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
extra_build_targets += build-udeb-stamp
arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
@ -47,22 +49,28 @@ build-indep: build-stamp $(extra_build_targets)
%-stamp: %/Makefile
$(MAKE) -C $*
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
$*/strace -V
$(MAKE) -C $* check VERBOSE=1
endif
touch $@
build/Makefile:
mkdir -p $(@D)
cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr $(CONFIG_OPTS)
build-udeb/Makefile:
mkdir -p $(@D)
cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \
--without-libunwind --without-libiberty $(CONFIG_OPTS)
build64/Makefile:
mkdir -p $(@D)
cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
cd $(@D); CC="$(CC64)" sh ../configure --enable-mpers=check --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
clean:
dh_testdir
dh_testroot
rm -rf build build64 strace64.1 debian/strace64.substvars
rm -rf build build-udeb build64 strace64.1 debian/strace64.substvars
dh_clean
binary: binary-indep binary-arch

View File

@ -1 +1 @@
build/strace usr/bin
build-udeb/strace usr/bin

122
defs.h
View File

@ -2,7 +2,7 @@
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 2001-2017 The strace developers.
* Copyright (c) 2001-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -53,13 +53,13 @@
#include <time.h>
#include <sys/time.h>
#include "arch_defs.h"
#include "error_prints.h"
#include "gcc_compat.h"
#include "kernel_types.h"
#include "macros.h"
#include "mpers_type.h"
#include "string_to_uint.h"
#include "supported_personalities.h"
#include "sysent.h"
#include "xmalloc.h"
@ -149,10 +149,12 @@ extern char *stpcpy(char *dst, const char *src);
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
# define HAVE_PERSONALITY_1_MPERS 1
#else
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
# define PERSONALITY1_INCLUDE_FUNCS "empty.h"
# define HAVE_PERSONALITY_1_MPERS 0
#endif
#if SUPPORTED_PERSONALITIES > 2 && defined HAVE_MX32_MPERS
@ -160,10 +162,12 @@ extern char *stpcpy(char *dst, const char *src);
# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h"
# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h"
# define MPERS_mx32_IOCTL_MACROS "ioctl_redefs2.h"
# define HAVE_PERSONALITY_2_MPERS 1
#else
# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
# define PERSONALITY2_INCLUDE_FUNCS "empty.h"
# define HAVE_PERSONALITY_2_MPERS 0
#endif
typedef struct ioctlent {
@ -177,7 +181,7 @@ typedef struct ioctlent {
struct inject_data {
uint16_t flags;
uint16_t signo;
int rval;
kernel_long_t rval;
};
struct inject_opts {
@ -244,6 +248,10 @@ struct tcb {
#define TCB_TAMPERED 0x40 /* A syscall has been tampered with */
#define TCB_HIDE_LOG 0x80 /* We should hide everything (until execve) */
#define TCB_SKIP_DETACH_ON_FIRST_EXEC 0x100 /* -b execve should skip detach on first execve */
#define TCB_GRABBED 0x200 /* We grab the process and can catch it
* in the middle of a syscall */
#define TCB_RECOVERING 0x400 /* We try to recover after detecting incorrect
* syscall entering/exiting state */
/* qualifier flags */
#define QUAL_TRACE 0x001 /* this system call should be traced */
@ -264,6 +272,8 @@ struct tcb {
#define inject(tcp) ((tcp)->qual_flg & QUAL_INJECT)
#define filtered(tcp) ((tcp)->flags & TCB_FILTERED)
#define hide_log(tcp) ((tcp)->flags & TCB_HIDE_LOG)
#define syscall_tampered(tcp) ((tcp)->flags & TCB_TAMPERED)
#define recovering(tcp) ((tcp)->flags & TCB_RECOVERING)
#include "xlat.h"
@ -309,6 +319,10 @@ extern const struct xlat whence_codes[];
#define RVAL_DECODED 0100 /* syscall decoding finished */
#define RVAL_IOCTL_DECODED 0200 /* ioctl sub-parser successfully decoded
the argument */
#define RVAL_PRINT_ERR_VAL 0400 /* Print decoded error code along with
syscall return value. Needed for modify_ldt
that for some reason decides to return
an error with higher bits set to 0. */
#define IOCTL_NUMBER_UNKNOWN 0
#define IOCTL_NUMBER_HANDLED 1
@ -316,22 +330,6 @@ extern const struct xlat whence_codes[];
#define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL)
#if defined(ARM) || defined(AARCH64) \
|| defined(I386) || defined(X32) || defined(X86_64) \
|| defined(IA64) \
|| defined(BFIN) \
|| defined(M68K) \
|| defined(MICROBLAZE) \
|| defined(RISCV) \
|| defined(S390) \
|| defined(SH) || defined(SH64) \
|| defined(SPARC) || defined(SPARC64) \
/**/
# define NEED_UID16_PARSERS 1
#else
# define NEED_UID16_PARSERS 0
#endif
enum sock_proto {
SOCK_PROTO_UNKNOWN,
SOCK_PROTO_UNIX,
@ -380,7 +378,7 @@ extern unsigned os_release;
#undef KERNEL_VERSION
#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
extern int read_int_from_file(const char *, int *);
extern int read_int_from_file(struct tcb *, const char *, int *);
extern void set_sortby(const char *);
extern void set_overhead(int);
@ -397,18 +395,37 @@ extern void syscall_exiting_finish(struct tcb *);
extern void count_syscall(struct tcb *, const struct timeval *);
extern void call_summary(FILE *);
extern void clear_regs(void);
extern void clear_regs(struct tcb *tcp);
extern int get_scno(struct tcb *);
extern kernel_ulong_t get_rt_sigframe_addr(struct tcb *);
/**
* Convert syscall number to syscall name.
* Convert a (shuffled) syscall number to the corresponding syscall name.
*
* @param scno Syscall number.
* @return String literal corresponding to the syscall number in case latter
* is valid; NULL otherwise.
*/
extern const char *syscall_name(kernel_ulong_t scno);
/**
* Convert a syscall name to the corresponding (shuffled) syscall number.
*
* @param s Syscall name.
* @param p Personality.
* @param start From which position in syscall entry table resume the search.
* @return Shuffled syscall number (ready to use against sysent_vec)
* if syscall name is found; -1 otherwise.
*/
extern kernel_long_t scno_by_name(const char *s, unsigned p,
kernel_long_t start);
/**
* Shuffle syscall numbers so that we don't have huge gaps in syscall table.
* The shuffling should be an involution: shuffle_scno(shuffle_scno(n)) == n.
*
* @param scno Raw or shuffled syscall number.
* @return Shuffled or raw syscall number, respectively.
*/
extern kernel_ulong_t shuffle_scno(kernel_ulong_t scno);
extern const char *err_name(unsigned long err);
extern bool is_erestart(struct tcb *);
@ -448,8 +465,8 @@ umoven_or_printaddr_ignore_syserror(struct tcb *, kernel_ulong_t addr,
extern int
umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr);
extern int upeek(int pid, unsigned long, kernel_ulong_t *);
extern int upoke(int pid, unsigned long, kernel_ulong_t);
extern int upeek(struct tcb *tcp, unsigned long, kernel_ulong_t *);
extern int upoke(struct tcb *tcp, unsigned long, kernel_ulong_t);
extern bool
print_array(struct tcb *,
@ -467,12 +484,8 @@ print_array(struct tcb *,
void *opaque_data),
void *opaque_data);
#if defined ALPHA || defined IA64 || defined MIPS \
|| defined SH || defined SPARC || defined SPARC64
# define HAVE_GETRVAL2
#if HAVE_ARCH_GETRVAL2
extern long getrval2(struct tcb *);
#else
# undef HAVE_GETRVAL2
#endif
extern const char *signame(const int);
@ -495,7 +508,7 @@ void dyxlat_free(struct dyxlat *);
const struct xlat *dyxlat_get(const struct dyxlat *);
void dyxlat_add_pair(struct dyxlat *, uint64_t val, const char *str, size_t len);
const struct xlat *genl_families_xlat(void);
const struct xlat *genl_families_xlat(struct tcb *tcp);
extern unsigned long get_pagesize(void);
extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits);
@ -518,6 +531,7 @@ str_strip_prefix_len(const char *str, const char *prefix, size_t prefix_len)
#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02
#define QUOTE_OMIT_TRAILING_0 0x08
#define QUOTE_FORCE_HEX 0x10
#define QUOTE_EMIT_COMMENT 0x20
extern int string_quote(const char *, char *, unsigned int, unsigned int);
extern int print_quoted_string(const char *, unsigned int, unsigned int);
@ -544,6 +558,8 @@ extern int printxval_searchn(const struct xlat *xlat, size_t xlat_size,
uint64_t val, const char *dflt);
#define printxval_search(xlat__, val__, dflt__) \
printxval_searchn(xlat__, ARRAY_SIZE(xlat__), val__, dflt__)
extern int sprintxval(char *buf, size_t size, const struct xlat *,
unsigned int val, const char *dflt);
extern int printargs(struct tcb *);
extern int printargs_u(struct tcb *);
extern int printargs_d(struct tcb *);
@ -561,6 +577,9 @@ extern void print_numeric_long_umask(unsigned long);
extern void print_dev_t(unsigned long long dev);
extern void print_abnormal_hi(kernel_ulong_t);
extern kernel_ulong_t *
fetch_indirect_syscall_args(struct tcb *, kernel_ulong_t addr, unsigned int n_args);
extern void
dumpiov_in_msghdr(struct tcb *, kernel_ulong_t addr, kernel_ulong_t data_size);
@ -573,14 +592,14 @@ dumpiov_upto(struct tcb *, int len, kernel_ulong_t addr, kernel_ulong_t data_siz
extern void
dumpstr(struct tcb *, kernel_ulong_t addr, int len);
extern void
extern int
printstr_ex(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len,
unsigned int user_style);
extern void
extern int
printpathn(struct tcb *, kernel_ulong_t addr, unsigned int n);
extern void
extern int
printpath(struct tcb *, kernel_ulong_t addr);
#define TIMESPEC_TEXT_BUFSIZE \
@ -702,16 +721,16 @@ extern void unwind_print_stacktrace(struct tcb *);
extern void unwind_capture_stacktrace(struct tcb *);
#endif
static inline void
static inline int
printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len)
{
printstr_ex(tcp, addr, len, 0);
return printstr_ex(tcp, addr, len, 0);
}
static inline void
static inline int
printstr(struct tcb *tcp, kernel_ulong_t addr)
{
printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED);
return printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED);
}
static inline int
@ -759,7 +778,21 @@ extern void print_itimerval32(struct tcb *, kernel_ulong_t addr);
#endif
#ifdef HAVE_STRUCT_USER_DESC
extern void print_user_desc(struct tcb *, kernel_ulong_t addr);
/**
* Filter what to print from the point of view of the get_thread_area syscall.
* Kernel copies only entry_number field at first and then tries to write the
* whole structure.
*/
enum user_desc_print_filter {
/* Print the "entering" part of struct user_desc - entry_number. */
USER_DESC_ENTERING = 1,
/* Print the "exiting" part of the structure. */
USER_DESC_EXITING = 2,
USER_DESC_BOTH = USER_DESC_ENTERING | USER_DESC_EXITING,
};
extern void print_user_desc(struct tcb *, kernel_ulong_t addr,
enum user_desc_print_filter filter);
#endif
/* Strace log generation machinery.
@ -789,7 +822,7 @@ extern void tprintf_comment(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2
extern void tprints_comment(const char *str);
#if SUPPORTED_PERSONALITIES > 1
extern void set_personality(int personality);
extern void set_personality(unsigned int personality);
extern unsigned current_personality;
#else
# define set_personality(personality) ((void)0)
@ -812,9 +845,12 @@ extern unsigned current_klongsize;
# endif
#endif
#define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG \
(SIZEOF_KERNEL_LONG_T > 4 \
&& (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize)))
#if SIZEOF_KERNEL_LONG_T > 4 \
&& (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize))
# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 1
#else
# define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG 0
#endif
#define DECL_PRINTNUM(name) \
extern bool \
@ -943,6 +979,8 @@ extern const char *const errnoent0[];
extern const char *const signalent0[];
extern const struct_ioctlent ioctlent0[];
extern const char *const personality_names[];
#if SUPPORTED_PERSONALITIES > 1
extern const struct_sysent *sysent;
extern const char *const *errnoent;

40
desc.c
View File

@ -3,7 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* Copyright (c) 1999-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,6 +30,7 @@
*/
#include "defs.h"
#include "xstring.h"
SYS_FUNC(close)
{
@ -157,7 +158,9 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
/* +2 chars needed at the end: ']',NUL */
if (outptr < end_outstr - (sizeof(", except [") + sizeof(int)*3 + 2)) {
if (first) {
outptr += sprintf(outptr, "%s%s [%u",
outptr = xappendstr(outstr,
outptr,
"%s%s [%u",
sep,
i == 0 ? "in" : i == 1 ? "out" : "except",
j
@ -165,7 +168,9 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
first = 0;
sep = ", ";
} else {
outptr += sprintf(outptr, " %u", j);
outptr = xappendstr(outstr,
outptr,
" %u", j);
}
}
if (--ready_fds == 0)
@ -179,7 +184,8 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
if (args[4]) {
const char *str = sprint_tv_ts(tcp, args[4]);
if (outptr + sizeof("left ") + strlen(sep) + strlen(str) < end_outstr) {
outptr += sprintf(outptr, "%sleft %s", sep, str);
outptr = xappendstr(outstr, outptr,
"%sleft %s", sep, str);
}
}
*outptr = '\0';
@ -190,29 +196,21 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
return 0;
}
#if HAVE_ARCH_OLD_SELECT
SYS_FUNC(oldselect)
{
kernel_ulong_t select_args[5];
unsigned int oldselect_args[5];
kernel_ulong_t *args =
fetch_indirect_syscall_args(tcp, tcp->u_arg[0], 5);
if (sizeof(*select_args) == sizeof(*oldselect_args)) {
if (umove_or_printaddr(tcp, tcp->u_arg[0], &select_args)) {
return 0;
}
if (args) {
return decode_select(tcp, args, print_timeval, sprint_timeval);
} else {
unsigned int i;
if (umove_or_printaddr(tcp, tcp->u_arg[0], &oldselect_args)) {
return 0;
}
for (i = 0; i < 5; ++i) {
select_args[i] = oldselect_args[i];
}
if (entering(tcp))
printaddr(tcp->u_arg[0]);
return RVAL_DECODED;
}
return decode_select(tcp, select_args, print_timeval, sprint_timeval);
}
#endif /* HAVE_ARCH_OLD_SELECT */
#ifdef ALPHA
SYS_FUNC(osf_select)

33
dm.c
View File

@ -258,6 +258,7 @@ dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr,
uint32_t offset = ioc->data_start;
uint32_t offset_end = 0;
uint32_t count;
int rc;
if (ioc->data_start == ioc->data_size)
return;
@ -288,8 +289,36 @@ dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr,
PRINT_FIELD_DEV("{", s, dev);
tprints(", name=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
rc = printstr_ex(tcp, addr + offset_end,
ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
/*
* In Linux v4.13-rc1~137^2~13 it has been decided to cram in
* one more undocumented field after the device name, as if the
* format decoding was not twisted enough already. So, we have
* to check "next" now, and if it _looks like_ that there is
* a space for one additional integer, let's print it. As if the
* perversity with "name string going further than pointer to
* the next one" wasn't enough. Moreover, the calculation was
* broken for m32 on 64-bit kernels until v4.14-rc4~20^2~3, and
* we have no ability to detect kernel bit-ness (on x86, at
* least), so refrain from printing it for the DM versions below
* 4.37 (the original version was also aligned differently than
* now even on 64 bit).
*/
if ((rc > 0) && ioc->version[1] >= 37) {
kernel_ulong_t event_addr =
(addr + offset_end + rc + 7) & ~7;
uint32_t event_nr;
if ((event_addr + sizeof(event_nr)) <=
(addr + offset + s.next) &&
!umove(tcp, event_addr, &event_nr))
tprintf(", event_nr=%" PRIu32, event_nr);
}
tprints("}");
if (!s.next)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,17 +25,31 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRACE_RT_SIGFRAME_H
#define STRACE_RT_SIGFRAME_H
#include "defs.h"
#include <signal.h>
/*
* Fetch indirect syscall arguments that are provided as an array.
* Return a pointer to a static array of kernel_ulong_t elements,
* or NULL in case of fetch failure.
*/
kernel_ulong_t *
fetch_indirect_syscall_args(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int n_args)
{
static kernel_ulong_t u_arg[MAX_ARGS];
typedef struct {
siginfo_t *pinfo;
void *puc;
siginfo_t info;
ucontext_t uc;
/* more data follows */
} struct_rt_sigframe;
if (current_wordsize == sizeof(*u_arg)) {
if (umoven(tcp, addr, sizeof(*u_arg) * n_args, u_arg))
return NULL;
} else {
uint32_t narrow_arg[ARRAY_SIZE(u_arg)];
#endif /* !STRACE_RT_SIGFRAME_H */
if (umoven(tcp, addr, sizeof(*narrow_arg) * n_args, narrow_arg))
return NULL;
for (unsigned int i = 0; i < n_args; ++i)
u_arg[i] = narrow_arg[i];
}
return u_arg;
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
* Copyright (c) 2017 The strace developers.
* Copyright (c) 2017-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -34,7 +34,6 @@ typedef int (*string_to_uint_func)(const char *);
void qualify_tokens(const char *str, struct number_set *set,
string_to_uint_func func, const char *name);
void qualify_syscall_tokens(const char *str, struct number_set *set,
const char *name);
void qualify_syscall_tokens(const char *str, struct number_set *set);
#endif /* !STRACE_FILTER_H */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -44,15 +44,13 @@ static struct number_set *verbose_set;
static int
sigstr_to_uint(const char *s)
{
int i;
if (*s >= '0' && *s <= '9')
return string_to_uint_upto(s, 255);
if (strncasecmp(s, "SIG", 3) == 0)
s += 3;
for (i = 0; i <= 255; ++i) {
for (int i = 0; i <= 255; ++i) {
const char *name = signame(i);
if (strncasecmp(name, "SIG", 3) != 0)
@ -72,9 +70,7 @@ sigstr_to_uint(const char *s)
static int
find_errno_by_name(const char *name)
{
unsigned int i;
for (i = 1; i < nerrnos; ++i) {
for (unsigned int i = 1; i < nerrnos; ++i) {
if (errnoent[i] && (strcasecmp(name, errnoent[i]) == 0))
return i;
}
@ -87,7 +83,7 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
const bool fault_tokens_only)
{
const char *val;
int intval;
kernel_long_t intval;
if ((val = STR_STRIP_PREFIX(token, "when=")) != token) {
/*
@ -133,9 +129,23 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
&& (val = STR_STRIP_PREFIX(token, "retval=")) != token) {
if (fopts->data.flags & INJECT_F_RETVAL)
return false;
intval = string_to_uint(val);
intval = string_to_kulong(val);
if (intval < 0)
return false;
#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG && !HAVE_ARCH_DEDICATED_ERR_REG
if ((int) intval != intval)
error_msg("Injected return value %" PRI_kld " will be"
" clipped to %d in compat personality",
intval, (int) intval);
if ((int) intval < 0 && (int) intval >= -MAX_ERRNO_VALUE)
error_msg("Inadvertent injection of error %d is"
" possible in compat personality for"
" retval=%" PRI_kld,
-(int) intval, intval);
#endif
fopts->data.rval = intval;
fopts->data.flags |= INJECT_F_RETVAL;
} else if (!fault_tokens_only
@ -154,30 +164,24 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
return true;
}
static char *
parse_inject_expression(const char *const s, char **buf,
static const char *
parse_inject_expression(char *const str,
struct inject_opts *const fopts,
const bool fault_tokens_only)
{
char *saveptr = NULL;
char *name = NULL;
char *token;
if (str[0] == '\0' || str[0] == ':')
return "";
*buf = xstrdup(s);
for (token = strtok_r(*buf, ":", &saveptr); token;
token = strtok_r(NULL, ":", &saveptr)) {
if (!name)
name = token;
else if (!parse_inject_token(token, fopts, fault_tokens_only))
goto parse_error;
char *saveptr = NULL;
const char *name = strtok_r(str, ":", &saveptr);
char *token;
while ((token = strtok_r(NULL, ":", &saveptr))) {
if (!parse_inject_token(token, fopts, fault_tokens_only))
return NULL;
}
if (name)
return name;
parse_error:
free(*buf);
return *buf = NULL;
return name;
}
static void
@ -209,7 +213,7 @@ qualify_trace(const char *const str)
{
if (!trace_set)
trace_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, trace_set, "system call");
qualify_syscall_tokens(str, trace_set);
}
static void
@ -217,7 +221,7 @@ qualify_abbrev(const char *const str)
{
if (!abbrev_set)
abbrev_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, abbrev_set, "system call");
qualify_syscall_tokens(str, abbrev_set);
}
static void
@ -225,7 +229,7 @@ qualify_verbose(const char *const str)
{
if (!verbose_set)
verbose_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, verbose_set, "system call");
qualify_syscall_tokens(str, verbose_set);
}
static void
@ -233,7 +237,7 @@ qualify_raw(const char *const str)
{
if (!raw_set)
raw_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, raw_set, "system call");
qualify_syscall_tokens(str, raw_set);
}
static void
@ -245,11 +249,17 @@ qualify_inject_common(const char *const str,
.first = 1,
.step = 1
};
char *buf = NULL;
char *name = parse_inject_expression(str, &buf, &opts, fault_tokens_only);
if (!name) {
char *copy = xstrdup(str);
const char *name =
parse_inject_expression(copy, &opts, fault_tokens_only);
if (!name)
error_msg_and_die("invalid %s '%s'", description, str);
}
struct number_set *tmp_set =
alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(name, tmp_set);
free(copy);
/* If neither of retval, error, or signal is specified, then ... */
if (!opts.data.flags) {
@ -263,18 +273,11 @@ qualify_inject_common(const char *const str,
}
}
struct number_set *tmp_set =
alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(name, tmp_set, description);
free(buf);
/*
* Initialize inject_vec accourding to tmp_set.
* Initialize inject_vec according to tmp_set.
* Merge tmp_set into inject_set.
*/
unsigned int p;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
if (number_set_array_is_empty(tmp_set, p))
continue;
@ -284,11 +287,10 @@ qualify_inject_common(const char *const str,
}
if (!inject_vec[p]) {
inject_vec[p] = xcalloc(nsyscall_vec[p],
sizeof(*inject_vec[p]));
sizeof(*inject_vec[p]));
}
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
if (is_number_in_set_array(i, tmp_set, p)) {
add_number_to_set_array(i, inject_set, p);
inject_vec[p][i] = opts;
@ -340,9 +342,8 @@ void
qualify(const char *str)
{
const struct qual_options *opt = qual_options;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(qual_options); ++i) {
for (unsigned int i = 0; i < ARRAY_SIZE(qual_options); ++i) {
const char *name = qual_options[i].name;
const size_t len = strlen(name);
const char *val = str_strip_prefix_len(str, name, len);

6
getpagesize.c Normal file
View File

@ -0,0 +1,6 @@
#include "defs.h"
SYS_FUNC(getpagesize)
{
return RVAL_DECODED | RVAL_HEX;
}

View File

@ -287,15 +287,21 @@ ioctl_decode(struct tcb *tcp)
return scsi_ioctl(tcp, code, arg);
case 'L':
return loop_ioctl(tcp, code, arg);
#ifdef HAVE_STRUCT_MTD_WRITE_REQ
case 'M':
return mtd_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024
case 'o':
case 'O':
return ubi_ioctl(tcp, code, arg);
#endif
case 'V':
return v4l2_ioctl(tcp, code, arg);
#ifdef HAVE_STRUCT_PTP_SYS_OFFSET
case '=':
return ptp_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_INPUT_H
case 'E':
return evdev_ioctl(tcp, code, arg);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,6 +27,7 @@
*/
#include "defs.h"
#include "xstring.h"
enum {
IOPRIO_WHO_PROCESS = 1,
@ -62,10 +63,10 @@ sprint_ioprio(unsigned int ioprio)
data = IOPRIO_PRIO_DATA(ioprio);
str = xlookup(ioprio_class, class);
if (str)
sprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data);
xsprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data);
else
sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)",
class, "IOPRIO_CLASS_???", data);
xsprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)",
class, "IOPRIO_CLASS_???", data);
return outstr;
}

View File

@ -1,5 +1,8 @@
/*
* Copyright (c) 2001-2017 The strace developers.
* Wrappers for handling discrepancies in LF64-themed syscalls availability and
* necessity between verious architectures and kernel veriosns.
*
* Copyright (c) 2012-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,26 +28,31 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRACE_SUPPORTED_PERSONALITIES_H
#define STRACE_SUPPORTED_PERSONALITIES_H
#ifndef STRACE_LARGEFILE_WRAPPERS_H
#define STRACE_LARGEFILE_WRAPPERS_H
#if defined X86_64
# define SUPPORTED_PERSONALITIES 3
#elif defined AARCH64 \
|| defined POWERPC64 \
|| defined RISCV \
|| defined SPARC64 \
|| defined TILE \
|| defined X32
# define SUPPORTED_PERSONALITIES 2
#include "defs.h"
#ifdef _LARGEFILE64_SOURCE
# ifdef HAVE_FOPEN64
# define fopen_for_output fopen64
# else
# define fopen_for_output fopen
# endif
# define struct_stat struct stat64
# define stat_file stat64
# define struct_dirent struct dirent64
# define read_dir readdir64
# define struct_rlimit struct rlimit64
# define set_rlimit setrlimit64
#else
# define SUPPORTED_PERSONALITIES 1
# define fopen_for_output fopen
# define struct_stat struct stat
# define stat_file stat
# define struct_dirent struct dirent
# define read_dir readdir
# define struct_rlimit struct rlimit
# define set_rlimit setrlimit
#endif
#if defined TILE && defined __tilepro__
# define DEFAULT_PERSONALITY 1
#else
# define DEFAULT_PERSONALITY 0
#endif
#endif /* !STRACE_SUPPORTED_PERSONALITIES_H */
#endif /* STRACE_LARGEFILE_WRAPPERS_H */

146
ldt.c
View File

@ -6,7 +6,7 @@
* Copyright (c) 2002-2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2010 Andreas Schwab <schwab@linux-m68k.org>
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -38,50 +38,130 @@
# include <asm/ldt.h>
# include "print_fields.h"
# include "xstring.h"
void
print_user_desc(struct tcb *const tcp, const kernel_ulong_t addr)
print_user_desc(struct tcb *const tcp, const kernel_ulong_t addr,
enum user_desc_print_filter filter)
{
struct user_desc desc;
unsigned *entry_number = get_tcb_priv_data(tcp);
if (umove_or_printaddr(tcp, addr, &desc))
return;
switch (filter) {
case USER_DESC_ENTERING:
if (umove_or_printaddr(tcp, addr, &desc.entry_number))
return;
tprintf("{entry_number:%d, "
"base_addr:%#08x, "
"limit:%d, "
"seg_32bit:%d, "
"contents:%d, "
"read_exec_only:%d, "
"limit_in_pages:%d, "
"seg_not_present:%d, "
"useable:%d}",
desc.entry_number,
desc.base_addr,
desc.limit,
desc.seg_32bit,
desc.contents,
desc.read_exec_only,
desc.limit_in_pages,
desc.seg_not_present,
desc.useable);
break;
case USER_DESC_EXITING:
if (!addr || !verbose(tcp))
return;
if (syserror(tcp) || umove(tcp, addr, &desc)) {
if (entry_number)
tprints(", ...}");
return;
}
break;
case USER_DESC_BOTH:
if (umove_or_printaddr(tcp, addr, &desc))
return;
break;
}
if (filter & USER_DESC_ENTERING) {
PRINT_FIELD_ID("{", desc, entry_number);
/*
* If we don't print the whole structure now, let's save it for
* later.
*/
if (filter == USER_DESC_ENTERING) {
entry_number = xmalloc(sizeof(*entry_number));
*entry_number = desc.entry_number;
set_tcb_priv_data(tcp, entry_number, free);
}
}
if (filter & USER_DESC_EXITING) {
/*
* It should be the same in case of get_thread_area, but we can
* never be sure...
*/
if (filter == USER_DESC_EXITING) {
if (entry_number) {
if (*entry_number != desc.entry_number) {
if ((int) desc.entry_number == -1)
tprints(" => -1");
else
tprintf(" => %u",
desc.entry_number);
}
} else {
/*
* This is really strange. If we are here, it
* means that we failed on entering but somehow
* succeeded on exiting.
*/
PRINT_FIELD_ID(" => {", desc, entry_number);
}
}
PRINT_FIELD_0X(", ", desc, base_addr);
PRINT_FIELD_0X(", ", desc, limit);
PRINT_FIELD_U_CAST(", ", desc, seg_32bit, unsigned int);
PRINT_FIELD_U_CAST(", ", desc, contents, unsigned int);
PRINT_FIELD_U_CAST(", ", desc, read_exec_only, unsigned int);
PRINT_FIELD_U_CAST(", ", desc, limit_in_pages, unsigned int);
PRINT_FIELD_U_CAST(", ", desc, seg_not_present, unsigned int);
PRINT_FIELD_U_CAST(", ", desc, useable, unsigned int);
# ifdef HAVE_STRUCT_USER_DESC_LM
/* lm is totally ignored for 32-bit processes */
if (current_klongsize == 8)
PRINT_FIELD_U_CAST(", ", desc, lm, unsigned int);
# endif /* HAVE_STRUCT_USER_DESC_LM */
tprints("}");
}
}
SYS_FUNC(modify_ldt)
{
tprintf("%" PRI_kld ", ", tcp->u_arg[0]);
if (tcp->u_arg[2] != sizeof(struct user_desc))
printaddr(tcp->u_arg[1]);
else
print_user_desc(tcp, tcp->u_arg[1]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
if (entering(tcp)) {
tprintf("%d, ", (int) tcp->u_arg[0]);
if (tcp->u_arg[2] != sizeof(struct user_desc))
printaddr(tcp->u_arg[1]);
else
print_user_desc(tcp, tcp->u_arg[1], USER_DESC_BOTH);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
return 0;
}
/*
* For some reason ("tht ABI for sys_modify_ldt() expects
* 'int'"), modify_ldt clips higher bits on x86_64.
*/
if (syserror(tcp) || (kernel_ulong_t) tcp->u_rval < 0xfffff000)
return 0;
tcp->u_error = -(unsigned int) tcp->u_rval;
return RVAL_PRINT_ERR_VAL;
}
SYS_FUNC(set_thread_area)
{
if (entering(tcp)) {
print_user_desc(tcp, tcp->u_arg[0]);
print_user_desc(tcp, tcp->u_arg[0], USER_DESC_BOTH);
} else {
struct user_desc desc;
@ -91,7 +171,7 @@ SYS_FUNC(set_thread_area)
} else {
static char outstr[32];
sprintf(outstr, "entry_number:%d", desc.entry_number);
xsprintf(outstr, "entry_number=%u", desc.entry_number);
tcp->auxstr = outstr;
return RVAL_STR;
}
@ -101,8 +181,8 @@ SYS_FUNC(set_thread_area)
SYS_FUNC(get_thread_area)
{
if (exiting(tcp))
print_user_desc(tcp, tcp->u_arg[0]);
print_user_desc(tcp, tcp->u_arg[0],
entering(tcp) ? USER_DESC_ENTERING : USER_DESC_EXITING);
return 0;
}

View File

@ -85,6 +85,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x11c },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 },
@ -93,6 +94,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
@ -111,6 +113,8 @@
{ "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 },
{ "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 },
{ "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 },
@ -138,6 +142,7 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 },
{ "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 },
@ -154,10 +159,13 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x1c },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x14 },
{ "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 },
@ -195,10 +203,12 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4a },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 },
@ -302,9 +312,11 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x1c },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 },
@ -408,6 +420,7 @@
{ "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
@ -606,6 +619,7 @@
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 },
@ -2400,6 +2414,7 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },

View File

@ -85,6 +85,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x11c },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 },
@ -93,6 +94,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
@ -111,6 +113,8 @@
{ "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 },
{ "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 },
{ "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 },
@ -138,6 +142,7 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 },
{ "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 },
@ -154,10 +159,13 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x1c },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x14 },
{ "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 },
@ -195,10 +203,12 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 },
@ -302,9 +312,11 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x1c },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 },
@ -408,6 +420,7 @@
{ "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
@ -606,6 +619,7 @@
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 },
@ -2400,6 +2414,7 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },

View File

@ -85,6 +85,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x120 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 },
@ -93,6 +94,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
@ -111,6 +113,8 @@
{ "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x28 },
{ "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 },
{ "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 },
@ -138,6 +142,7 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 },
{ "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 },
@ -154,10 +159,13 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 },
@ -195,10 +203,12 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 },
@ -304,7 +314,9 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 },
@ -408,6 +420,7 @@
{ "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
@ -606,6 +619,7 @@
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 },
@ -2400,6 +2414,7 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },

View File

@ -177,20 +177,20 @@
[169] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[170] = { 2, 0, SEN(settimeofday), "settimeofday" },
[171] = { 1, 0, SEN(adjtimex), "adjtimex" },
[172] = { 0, NF, SEN(getpid), "getpid" },
[173] = { 0, NF, SEN(getppid), "getppid" },
[174] = { 0, NF, SEN(getuid), "getuid" },
[175] = { 0, NF, SEN(geteuid), "geteuid" },
[176] = { 0, NF, SEN(getgid), "getgid" },
[177] = { 0, NF, SEN(getegid), "getegid" },
[178] = { 0, NF, SEN(gettid), "gettid" },
[172] = { 0, PU|NF, SEN(getpid), "getpid" },
[173] = { 0, PU|NF, SEN(getppid), "getppid" },
[174] = { 0, PU|NF, SEN(getuid), "getuid" },
[175] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[176] = { 0, PU|NF, SEN(getgid), "getgid" },
[177] = { 0, PU|NF, SEN(getegid), "getegid" },
[178] = { 0, PU|NF, SEN(gettid), "gettid" },
[179] = { 1, 0, SEN(sysinfo), "sysinfo" },
[180] = { 4, 0, SEN(mq_open), "mq_open" },
[180] = { 4, TD, SEN(mq_open), "mq_open" },
[181] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[182] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[183] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[184] = { 2, 0, SEN(mq_notify), "mq_notify" },
[185] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[182] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[183] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[184] = { 2, TD, SEN(mq_notify), "mq_notify" },
[185] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[186] = { 2, TI, SEN(msgget), "msgget" },
[187] = { 3, TI, SEN(msgctl), "msgctl" },
[188] = { 5, TI, SEN(msgrcv), "msgrcv" },

View File

@ -85,6 +85,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x6454, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x120 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 },
@ -93,6 +94,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_SCHED", _IOC_WRITE, 0x6455, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
@ -111,6 +113,8 @@
{ "drm/drm.h", "DRM_IOCTL_AUTH_MAGIC", _IOC_WRITE, 0x6411, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_BLOCK", _IOC_READ|_IOC_WRITE, 0x6412, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_CONTROL", _IOC_WRITE, 0x6414, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_GET_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643b, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_CRTC_QUEUE_SEQUENCE", _IOC_READ|_IOC_WRITE, 0x643c, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_DMA", _IOC_READ|_IOC_WRITE, 0x6429, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_DROP_MASTER", _IOC_NONE, 0x641f, 0x00 },
{ "drm/drm.h", "DRM_IOCTL_FINISH", _IOC_WRITE, 0x642c, 0x08 },
@ -138,6 +142,7 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CREATE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c6, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c },
{ "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 },
{ "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 },
@ -154,10 +159,13 @@
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64ac, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64aa, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GETRESOURCES", _IOC_READ|_IOC_WRITE, 0x64a0, 0x40 },
{ "drm/drm.h", "DRM_IOCTL_MODE_GET_LEASE", _IOC_READ|_IOC_WRITE, 0x64c8, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_LIST_LESSEES", _IOC_READ|_IOC_WRITE, 0x64c7, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_MAP_DUMB", _IOC_READ|_IOC_WRITE, 0x64b3, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_GETPROPERTIES", _IOC_READ|_IOC_WRITE, 0x64b9, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_MODE_OBJ_SETPROPERTY", _IOC_READ|_IOC_WRITE, 0x64ba, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_PAGE_FLIP", _IOC_READ|_IOC_WRITE, 0x64b0, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_MODE_REVOKE_LEASE", _IOC_READ|_IOC_WRITE, 0x64c9, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_RMFB", _IOC_READ|_IOC_WRITE, 0x64af, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETCRTC", _IOC_READ|_IOC_WRITE, 0x64a2, 0x68 },
{ "drm/drm.h", "DRM_IOCTL_MODE_SETGAMMA", _IOC_READ|_IOC_WRITE, 0x64a5, 0x20 },
@ -195,10 +203,12 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_DOM", _IOC_READ|_IOC_WRITE, 0x644a, 0x48 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_PM_QUERY_SIG", _IOC_READ|_IOC_WRITE, 0x644b, 0x4c },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 },
{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 },
@ -304,7 +314,9 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE", _IOC_WRITE, 0x644b, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_SUBMITQUEUE_NEW", _IOC_READ|_IOC_WRITE, 0x644a, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", _IOC_WRITE, 0x6482, 0x08 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6484, 0x28 },
@ -408,6 +420,7 @@
{ "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
@ -606,6 +619,7 @@
{ "linux/btrfs.h", "BTRFS_IOC_INO_LOOKUP", _IOC_READ|_IOC_WRITE, 0x9412, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_INO_PATHS", _IOC_READ|_IOC_WRITE, 0x9423, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO", _IOC_READ|_IOC_WRITE, 0x9424, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_LOGICAL_INO_V2", _IOC_READ|_IOC_WRITE, 0x943b, 0x38 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_ASSIGN", _IOC_WRITE, 0x9429, 0x18 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_CREATE", _IOC_WRITE, 0x942a, 0x10 },
{ "linux/btrfs.h", "BTRFS_IOC_QGROUP_LIMIT", _IOC_READ, 0x942b, 0x30 },
@ -2400,6 +2414,7 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "linux/wmi.h", "DELL_WMI_SMBIOS_CMD", _IOC_READ|_IOC_WRITE, 0x5700, 0x34 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },

View File

@ -170,20 +170,20 @@
[169] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[170] = { 2, 0, SEN(settimeofday), "settimeofday" },
[171] = { 1, 0, SEN(adjtimex), "adjtimex" },
[172] = { 0, NF, SEN(getpid), "getpid" },
[173] = { 0, NF, SEN(getppid), "getppid" },
[174] = { 0, NF, SEN(getuid), "getuid" },
[175] = { 0, NF, SEN(geteuid), "geteuid" },
[176] = { 0, NF, SEN(getgid), "getgid" },
[177] = { 0, NF, SEN(getegid), "getegid" },
[178] = { 0, NF, SEN(gettid), "gettid" },
[172] = { 0, PU|NF, SEN(getpid), "getpid" },
[173] = { 0, PU|NF, SEN(getppid), "getppid" },
[174] = { 0, PU|NF, SEN(getuid), "getuid" },
[175] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[176] = { 0, PU|NF, SEN(getgid), "getgid" },
[177] = { 0, PU|NF, SEN(getegid), "getegid" },
[178] = { 0, PU|NF, SEN(gettid), "gettid" },
[179] = { 1, 0, SEN(sysinfo), "sysinfo" },
[180] = { 4, 0, SEN(mq_open), "mq_open" },
[180] = { 4, TD, SEN(mq_open), "mq_open" },
[181] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[182] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[183] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[184] = { 2, 0, SEN(mq_notify), "mq_notify" },
[185] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[182] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[183] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[184] = { 2, TD, SEN(mq_notify), "mq_notify" },
[185] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[186] = { 2, TI, SEN(msgget), "msgget" },
[187] = { 3, TI, SEN(msgctl), "msgctl" },
[188] = { 5, TI, SEN(msgrcv), "msgrcv" },

View File

@ -0,0 +1,4 @@
#define HAVE_ARCH_OLD_MMAP 1
#define HAVE_ARCH_OLD_SELECT 1
#define HAVE_ARCH_UID16_SYSCALLS 1
#define SUPPORTED_PERSONALITIES 2

View File

@ -36,3 +36,6 @@ static struct iovec aarch64_io = {
#define ARCH_REGS_FOR_GETREGSET arm_regs_union
#define ARCH_IOVEC_FOR_GETREGSET aarch64_io
#define ARCH_PC_REG ((aarch64_io.iov_len == sizeof(arm_regs)) ? arm_regs.ARM_pc : aarch64_regs.pc)
#define ARCH_PERSONALITY_0_IOV_SIZE sizeof(aarch64_regs)
#define ARCH_PERSONALITY_1_IOV_SIZE sizeof(arm_regs)

View File

@ -8,14 +8,11 @@ arch_get_scno(struct tcb *tcp)
case sizeof(aarch64_regs):
/* We are in 64-bit mode */
scno = aarch64_regs.regs[8];
update_personality(tcp, 0);
break;
case sizeof(arm_regs):
/* We are in 32-bit mode */
/* Note: we don't support OABI, unlike 32-bit ARM build */
scno = arm_regs.ARM_r7;
scno = shuffle_scno(scno);
update_personality(tcp, 1);
break;
}

View File

@ -0,0 +1 @@
#include "../arm/nr_prefix.c"

View File

@ -0,0 +1,12 @@
#define shuffle_scno arm_shuffle_scno
#include "../arm/shuffle_scno.c"
#undef shuffle_scno
kernel_ulong_t
shuffle_scno(kernel_ulong_t scno)
{
if (current_personality == 1)
return arm_shuffle_scno(scno);
return scno;
}

View File

@ -49,7 +49,7 @@
[1057] = { 3, TD, SEN(lseek), "lseek" },
[1058] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[1059] = { 1, 0, SEN(alarm), "alarm" },
[1060] = { 0, 0, SEN(getpgrp), "getpgrp" },
[1060] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[1061] = { 0, TS, SEN(pause), "pause" },
[1062] = { 1, 0, SEN(time), "time" },
[1063] = { 2, TF, SEN(utime), "utime" },

2
linux/alpha/arch_defs_.h Normal file
View File

@ -0,0 +1,2 @@
#define HAVE_ARCH_GETRVAL2 1
#define HAVE_ARCH_DEDICATED_ERR_REG 1

View File

@ -2,7 +2,7 @@ long
getrval2(struct tcb *tcp)
{
unsigned long r20;
if (upeek(tcp->pid, 20, &r20) < 0)
if (upeek(tcp, 20, &r20) < 0)
return -1;
return r20;
}

View File

@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR
{
unsigned long addr;
return upeek(tcp->pid, REG_FP, &addr) ? 0 : addr;
return upeek(tcp, REG_FP, &addr) ? 0 : addr;
}

View File

@ -3,7 +3,7 @@ arch_sigreturn(struct tcb *tcp)
{
unsigned long addr;
if (upeek(tcp->pid, REG_FP, &addr) < 0)
if (upeek(tcp, REG_FP, &addr) < 0)
return;
addr += offsetof(struct sigcontext, sc_mask);

View File

@ -4,9 +4,9 @@ arch_get_scno(struct tcb *tcp)
{
kernel_ulong_t scno = 0;
if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0)
if (upeek(tcp, REG_A3, &alpha_a3) < 0)
return -1;
if (upeek(tcp->pid, REG_R0, &scno) < 0)
if (upeek(tcp, REG_R0, &scno) < 0)
return -1;
/*

View File

@ -5,7 +5,7 @@ get_syscall_args(struct tcb *tcp)
unsigned int i;
for (i = 0; i < tcp->s_ent->nargs; ++i)
if (upeek(tcp->pid, REG_A0+i, &tcp->u_arg[i]) < 0)
if (upeek(tcp, REG_A0+i, &tcp->u_arg[i]) < 0)
return -1;
return 1;
}

View File

@ -1,6 +1,6 @@
static int
get_syscall_result_regs(struct tcb *tcp)
{
return (upeek(tcp->pid, REG_A3, &alpha_a3) < 0 ||
upeek(tcp->pid, REG_R0, &alpha_r0) < 0) ? -1 : 0;
return (upeek(tcp, REG_A3, &alpha_a3) < 0 ||
upeek(tcp, REG_R0, &alpha_r0) < 0) ? -1 : 0;
}

View File

@ -2,12 +2,12 @@ static int
arch_set_error(struct tcb *tcp)
{
alpha_r0 = tcp->u_error;
return upoke(tcp->pid, REG_R0, alpha_r0);
return upoke(tcp, REG_R0, alpha_r0);
}
static int
arch_set_success(struct tcb *tcp)
{
return upoke(tcp->pid, REG_A3, (alpha_a3 = 0))
|| upoke(tcp->pid, REG_R0, (alpha_r0 = tcp->u_rval));
return upoke(tcp, REG_A3, (alpha_a3 = 0))
|| upoke(tcp, REG_R0, (alpha_r0 = tcp->u_rval));
}

View File

@ -1,5 +1,5 @@
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
return upoke(tcp->pid, REG_R0, scno);
return upoke(tcp, REG_R0, scno);
}

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1995-2017 The strace developers.
* Copyright (c) 1995-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,11 +47,11 @@
[ 17] = { 1, TM|SI, SEN(brk), "brk" },
[ 18] = { 5, TSFA, SEN(printargs), "osf_getfsstat" }, /* not implemented */
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, NF, SEN(getxpid), "getxpid" },
[ 20] = { 0, PU|NF, SEN(getxpid), "getxpid" },
[ 21] = { 4, 0, SEN(printargs), "osf_mount" },
[ 22] = { 2, TF, SEN(umount2), "umount" },
[ 23] = { 1, 0, SEN(setuid), "setuid" },
[ 24] = { 0, NF, SEN(getxuid), "getxuid" },
[ 24] = { 0, PU|NF, SEN(getxuid), "getxuid" },
[ 25] = { 5, 0, SEN(printargs), "exec_with_loader" }, /* not implemented */
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 5, 0, SEN(printargs), "osf_nrecvmsg" }, /* not implemented */
@ -74,7 +74,7 @@
[ 44] = { 5, 0, SEN(printargs), "osf_profil" }, /* not implemented */
[ 45] = { 3, TD|TF, SEN(open), "open" },
[ 46] = { 5, 0, SEN(printargs), "osf_old_sigaction" }, /* not implemented */
[ 47] = { 0, NF, SEN(getxgid), "getxgid" },
[ 47] = { 0, PU|NF, SEN(getxgid), "getxgid" },
[ 48] = { 2, TS, SEN(osf_sigprocmask), "osf_sigprocmask" },
[ 49] = { 5, 0, SEN(printargs), "osf_getlogin" }, /* not implemented */
[ 50] = { 5, 0, SEN(printargs), "osf_setlogin" }, /* not implemented */
@ -90,8 +90,8 @@
[ 60] = { 1, NF, SEN(umask), "umask" },
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 5, TD|TFST|TSTA, SEN(printargs), "osf_old_fstat" }, /* not implemented */
[ 63] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, 0, SEN(getpagesize), "getpagesize" },
[ 63] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, PU|NF, SEN(getpagesize), "getpagesize" },
[ 65] = { 5, TM, SEN(printargs), "osf_mremap" }, /* not implemented */
[ 66] = { 0, TP, SEN(vfork), "vfork" },
[ 67] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
@ -116,7 +116,7 @@
[ 86] = { 2, 0, SEN(osf_getitimer), "osf_getitimer" },
[ 87] = { 2, 0, SEN(gethostname), "gethostname" },
[ 88] = { 2, 0, SEN(sethostname), "sethostname" },
[ 89] = { 0, 0, SEN(getdtablesize), "getdtablesize" },
[ 89] = { 0, PU|NF, SEN(getdtablesize), "getdtablesize" },
[ 90] = { 2, TD, SEN(dup2), "dup2" },
[ 91] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[ 92] = { 3, TD, SEN(fcntl), "fcntl" },
@ -342,7 +342,7 @@
[375] = { 3, TM, SEN(mincore), "mincore" },
[376] = { 3, 0, SEN(printargs), "pciconfig_iobase" },
[377] = { 3, TD, SEN(getdents64), "getdents64" },
[378] = { 0, NF, SEN(gettid), "gettid" },
[378] = { 0, PU|NF, SEN(gettid), "gettid" },
[379] = { 3, TD, SEN(readahead), "readahead" },
[380] = { },
[381] = { 2, TS, SEN(kill), "tkill" },
@ -395,12 +395,12 @@
[429] = { 6, TM, SEN(mbind), "mbind" }, /* not implemented */
[430] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" }, /* not implemented */
[431] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" }, /* not implemented */
[432] = { 4, 0, SEN(mq_open), "mq_open" },
[432] = { 4, TD, SEN(mq_open), "mq_open" },
[433] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[434] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[435] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[436] = { 2, 0, SEN(mq_notify), "mq_notify" },
[437] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[434] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[435] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[436] = { 2, TD, SEN(mq_notify), "mq_notify" },
[437] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[438] = { 5, TP, SEN(waitid), "waitid" },
[439] = { 5, 0, SEN(add_key), "add_key" },
[440] = { 4, 0, SEN(request_key), "request_key" },

View File

@ -3,6 +3,6 @@
/* [244 ... 259] are arch specific */
[244] = { 3, 0, SEN(printargs), "cacheflush" },
[245] = { 1, 0, SEN(printargs), "arc_settls" },
[246] = { 0, 0, SEN(printargs), "arc_gettls" },
[246] = { 0, PU|NF, SEN(printargs), "arc_gettls" },
[247] = { 3, 0, SEN(sysfs), "sysfs" },
[248] = { 3, 0, SEN(printargs), "arc_usr_cmpxchg"},

33
linux/arch_defs_.h Normal file
View File

@ -0,0 +1,33 @@
/* Fallback file for arch-specific definitions. */
#ifndef HAVE_ARCH_GETRVAL2
# define HAVE_ARCH_GETRVAL2 0
#endif
#ifndef HAVE_ARCH_OLD_MMAP
# define HAVE_ARCH_OLD_MMAP 0
#endif
#ifndef HAVE_ARCH_OLD_MMAP_PGOFF
# define HAVE_ARCH_OLD_MMAP_PGOFF 0
#endif
#ifndef HAVE_ARCH_OLD_SELECT
# define HAVE_ARCH_OLD_SELECT 0
#endif
#ifndef HAVE_ARCH_UID16_SYSCALLS
# define HAVE_ARCH_UID16_SYSCALLS 0
#endif
#ifndef DEFAULT_PERSONALITY
# define DEFAULT_PERSONALITY 0
#endif
#ifndef SUPPORTED_PERSONALITIES
# define SUPPORTED_PERSONALITIES 1
#endif
#ifndef HAVE_ARCH_DEDICATED_ERR_REG
# define HAVE_ARCH_DEDICATED_ERR_REG 0
#endif

3
linux/arm/arch_defs_.h Normal file
View File

@ -0,0 +1,3 @@
#define HAVE_ARCH_OLD_MMAP 1
#define HAVE_ARCH_OLD_SELECT 1
#define HAVE_ARCH_UID16_SYSCALLS 1

View File

@ -2,7 +2,7 @@
* Copyright (c) 2003 Russell King <rmk@arm.linux.org.uk>
* Copyright (c) 2011-2013 Denys Vlasenko <vda.linux@googlemail.com>
* Copyright (c) 2011-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* Copyright (c) 2015-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,18 +67,13 @@ scno_in_r7:
#endif
scno = shuffle_scno(scno);
/*
* Do some sanity checks to figure out
* whether it's really a syscall entry.
*/
if (arm_regs.ARM_ip && !scno_in_range(scno)) {
if (debug_flag)
error_msg("pid %d stray syscall exit:"
" ARM_ip = %ld, scno = %ld",
tcp->pid, arm_regs.ARM_ip,
shuffle_scno(scno));
debug_msg("pid %d stray syscall exit: ARM_ip = %ld, scno = %ld",
tcp->pid, arm_regs.ARM_ip, scno);
return 0;
}

12
linux/arm/nr_prefix.c Normal file
View File

@ -0,0 +1,12 @@
static inline const char *
nr_prefix(kernel_ulong_t scno)
{
/*
* For now, the set of syscalls that are shuffled is equivalent to the
* set of syscalls that have __ARM_NR_ prefix.
*/
if (shuffle_scno(scno) != scno)
return "__ARM_NR_";
else
return "__NR_";
}

28
linux/arm/shuffle_scno.c Normal file
View File

@ -0,0 +1,28 @@
kernel_ulong_t
shuffle_scno(kernel_ulong_t scno)
{
if (scno < ARM_FIRST_SHUFFLED_SYSCALL)
return scno;
/* __ARM_NR_cmpxchg? Swap with LAST_ORDINARY+1 */
if (scno == ARM_FIRST_SHUFFLED_SYSCALL)
return 0x000ffff0;
if (scno == 0x000ffff0)
return ARM_FIRST_SHUFFLED_SYSCALL;
#define ARM_SECOND_SHUFFLED_SYSCALL (ARM_FIRST_SHUFFLED_SYSCALL + 1)
/*
* Is it ARM specific syscall?
* Swap [0x000f0000, 0x000f0000 + LAST_SPECIAL] range
* with [SECOND_SHUFFLED, SECOND_SHUFFLED + LAST_SPECIAL] range.
*/
if (scno >= 0x000f0000 &&
scno <= 0x000f0000 + ARM_LAST_SPECIAL_SYSCALL) {
return scno - 0x000f0000 + ARM_SECOND_SHUFFLED_SYSCALL;
}
if (scno <= ARM_SECOND_SHUFFLED_SYSCALL + ARM_LAST_SPECIAL_SYSCALL) {
return scno + 0x000f0000 - ARM_SECOND_SHUFFLED_SYSCALL;
}
return scno;
}

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1995-2017 The strace developers.
* Copyright (c) 1995-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,11 +47,11 @@
[ 17] = { 0, TM, SEN(break), "break" },
[ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" },
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, NF, SEN(getpid), "getpid" },
[ 20] = { 0, PU|NF, SEN(getpid), "getpid" },
[ 21] = { 5, TF, SEN(mount), "mount" },
[ 22] = { 1, TF, SEN(umount), "umount" },
[ 23] = { 1, 0, SEN(setuid16), "setuid" },
[ 24] = { 0, NF, SEN(getuid16), "getuid" },
[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" },
[ 25] = { 1, 0, SEN(stime), "stime" },
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 1, 0, SEN(alarm), "alarm" },
@ -74,10 +74,10 @@
[ 44] = { 0, 0, SEN(prof), "prof" },
[ 45] = { 1, TM|SI, SEN(brk), "brk" },
[ 46] = { 1, 0, SEN(setgid16), "setgid" },
[ 47] = { 0, NF, SEN(getgid16), "getgid" },
[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" },
[ 48] = { 2, TS, SEN(signal), "signal" },
[ 49] = { 0, NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, NF, SEN(getegid16), "getegid" },
[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" },
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 2, TF, SEN(umount2), "umount2" },
[ 53] = { 0, 0, SEN(lock), "lock" },
@ -91,8 +91,8 @@
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 2, TSFA, SEN(ustat), "ustat" },
[ 63] = { 2, TD, SEN(dup2), "dup2" },
[ 64] = { 0, NF, SEN(getppid), "getppid" },
[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, PU|NF, SEN(getppid), "getppid" },
[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[ 66] = { 0, 0, SEN(setsid), "setsid" },
[ 67] = { 3, TS, SEN(sigaction), "sigaction" },
[ 68] = { 0, TS, SEN(sgetmask), "sgetmask" },
@ -226,10 +226,10 @@
[196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" },
[197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" },
[198] = { 3, TF, SEN(chown), "lchown32" },
[199] = { 0, NF, SEN(getuid), "getuid32" },
[200] = { 0, NF, SEN(getgid), "getgid32" },
[201] = { 0, NF, SEN(geteuid), "geteuid32" },
[202] = { 0, NF, SEN(geteuid), "getegid32" },
[199] = { 0, PU|NF, SEN(getuid), "getuid32" },
[200] = { 0, PU|NF, SEN(getgid), "getgid32" },
[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" },
[202] = { 0, PU|NF, SEN(geteuid), "getegid32" },
[203] = { 2, 0, SEN(setreuid), "setreuid32" },
[204] = { 2, 0, SEN(setregid), "setregid32" },
[205] = { 2, 0, SEN(getgroups), "getgroups32" },
@ -250,7 +250,7 @@
[220] = { 3, TM, SEN(madvise), "madvise" },
[221] = { 3, TD, SEN(fcntl64), "fcntl64" },
[222 ... 223] = { },
[224] = { 0, NF, SEN(gettid), "gettid" },
[224] = { 0, PU|NF, SEN(gettid), "gettid" },
[225] = { 5, TD, SEN(readahead), "readahead" },
[226] = { 5, TF, SEN(setxattr), "setxattr" },
[227] = { 5, TF, SEN(setxattr), "lsetxattr" },
@ -299,12 +299,12 @@
[271] = { 3, 0, SEN(printargs), "pciconfig_iobase" },
[272] = { 5, 0, SEN(printargs), "pciconfig_read" },
[273] = { 5, 0, SEN(printargs), "pciconfig_write" },
[274] = { 4, 0, SEN(mq_open), "mq_open" },
[274] = { 4, TD, SEN(mq_open), "mq_open" },
[275] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[276] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[277] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[278] = { 2, 0, SEN(mq_notify), "mq_notify" },
[279] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[276] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[277] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[278] = { 2, TD, SEN(mq_notify), "mq_notify" },
[279] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[280] = { 5, TP, SEN(waitid), "waitid" },
[281] = { 3, TN, SEN(socket), "socket" },
[282] = { 3, TN, SEN(bind), "bind" },
@ -444,9 +444,10 @@
* Remapped by shuffle_scno() to be directly after __ARM_NR_cmpxchg.
*/
[ARM_FIRST_SHUFFLED_SYSCALL+1+0] = { },
[ARM_FIRST_SHUFFLED_SYSCALL+1+1] = { 5, 0, SEN(printargs), "breakpoint" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+2] = { 5, 0, SEN(printargs), "cacheflush" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+3] = { 5, 0, SEN(printargs), "usr26" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+4] = { 5, 0, SEN(printargs), "usr32" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+5] = { 5, 0, SEN(printargs), "set_tls" },
#define ARM_LAST_SPECIAL_SYSCALL 5
[ARM_FIRST_SHUFFLED_SYSCALL+1+1] = { 0, 0, SEN(printargs), "breakpoint" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+2] = { 3, TM, SEN(printargs), "cacheflush" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+3] = { 0, 0, SEN(printargs), "usr26" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+4] = { 0, 0, SEN(printargs), "usr32" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+5] = { 1, 0, SEN(printargs), "set_tls" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+6] = { 0, PU|NF, SEN(printargs), "get_tls" },
#define ARM_LAST_SPECIAL_SYSCALL 6

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2004-2009 Atmel Corporation
* Copyright (c) 2009-2017 The strace developers.
* Copyright (c) 2009-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -46,11 +46,11 @@
[ 17] = { 3, TF, SEN(chown), "lchown" },
[ 18] = { 3, TD, SEN(lseek), "lseek" },
[ 19] = { 5, TD, SEN(llseek), "_llseek" },
[ 20] = { 0, NF, SEN(getpid), "getpid" },
[ 20] = { 0, PU|NF, SEN(getpid), "getpid" },
[ 21] = { 5, TF, SEN(mount), "mount" },
[ 22] = { 1, TF, SEN(umount2), "umount2" },
[ 23] = { 1, 0, SEN(setuid), "setuid" },
[ 24] = { 0, NF, SEN(getuid), "getuid" },
[ 24] = { 0, PU|NF, SEN(getuid), "getuid" },
[ 25] = { 1, 0, SEN(stime), "stime" },
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 1, 0, SEN(alarm), "alarm" },
@ -73,10 +73,10 @@
[ 44] = { 5, TP, SEN(clone), "clone" },
[ 45] = { 1, TM|SI, SEN(brk), "brk" },
[ 46] = { 1, 0, SEN(setgid), "setgid" },
[ 47] = { 0, NF, SEN(getgid), "getgid" },
[ 47] = { 0, PU|NF, SEN(getgid), "getgid" },
[ 48] = { 2, TF, SEN(getcwd), "getcwd" },
[ 49] = { 0, NF, SEN(geteuid), "geteuid" },
[ 50] = { 0, NF, SEN(getegid), "getegid" },
[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[ 50] = { 0, PU|NF, SEN(getegid), "getegid" },
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 1, NF, SEN(setfsuid), "setfsuid" },
[ 53] = { 1, NF, SEN(setfsgid), "setfsgid" },
@ -90,8 +90,8 @@
[ 61] = { 2, 0, SEN(setregid), "setregid" },
[ 62] = { 2, TSFA, SEN(ustat), "ustat" },
[ 63] = { 2, TD, SEN(dup2), "dup2" },
[ 64] = { 0, NF, SEN(getppid), "getppid" },
[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, PU|NF, SEN(getppid), "getppid" },
[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[ 66] = { 0, 0, SEN(setsid), "setsid" },
[ 67] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" },
[ 68] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
@ -202,7 +202,7 @@
[173] = { 3, TM, SEN(madvise), "madvise" },
[174] = { 3, TD, SEN(getdents64), "getdents64" },
[175] = { 3, TD, SEN(fcntl64), "fcntl64" },
[176] = { 0, NF, SEN(gettid), "gettid" },
[176] = { 0, PU|NF, SEN(gettid), "gettid" },
[177] = { 4, TD, SEN(readahead), "readahead" },
[178] = { 5, TF, SEN(setxattr), "setxattr" },
[179] = { 5, TF, SEN(setxattr), "lsetxattr" },
@ -253,12 +253,12 @@
[224] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" },
[225] = { 3, 0, SEN(printargs), "cacheflush" },
[226] = { 5, 0, SEN(vserver), "vserver" },
[227] = { 4, 0, SEN(mq_open), "mq_open" },
[227] = { 4, TD, SEN(mq_open), "mq_open" },
[228] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[229] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[230] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[231] = { 2, 0, SEN(mq_notify), "mq_notify" },
[232] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[229] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[230] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[231] = { 2, TD, SEN(mq_notify), "mq_notify" },
[232] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[233] = { 4, 0, SEN(kexec_load), "kexec_load" },
[234] = { 5, TP, SEN(waitid), "waitid" },
[235] = { 5, 0, SEN(add_key), "add_key" },

2
linux/bfin/arch_defs_.h Normal file
View File

@ -0,0 +1,2 @@
#define HAVE_ARCH_OLD_SELECT 1
#define HAVE_ARCH_UID16_SYSCALLS 1

View File

@ -29,5 +29,5 @@ FUNC_GET_RT_SIGFRAME_ADDR
{
unsigned long addr;
return upeek(tcp->pid, PT_USP, &addr) ? 0 : addr;
return upeek(tcp, PT_USP, &addr) ? 0 : addr;
}

View File

@ -2,5 +2,5 @@
static int
arch_get_scno(struct tcb *tcp)
{
return upeek(tcp->pid, PT_ORIG_P0, &tcp->scno) < 0 ? -1 : 1;
return upeek(tcp, PT_ORIG_P0, &tcp->scno) < 0 ? -1 : 1;
}

View File

@ -8,7 +8,7 @@ get_syscall_args(struct tcb *tcp)
unsigned int i;
for (i = 0; i < tcp->s_ent->nargs; ++i)
if (upeek(tcp->pid, argreg[i], &tcp->u_arg[i]) < 0)
if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0)
return -1;
return 1;
}

View File

@ -1,5 +1,5 @@
static int
get_syscall_result_regs(struct tcb *tcp)
{
return upeek(tcp->pid, PT_R0, &bfin_r0) < 0 ? -1 : 0;
return upeek(tcp, PT_R0, &bfin_r0) < 0 ? -1 : 0;
}

View File

@ -2,12 +2,12 @@ static int
arch_set_error(struct tcb *tcp)
{
bfin_r0 = -tcp->u_error;
return upoke(tcp->pid, PT_R0, bfin_r0);
return upoke(tcp, PT_R0, bfin_r0);
}
static int
arch_set_success(struct tcb *tcp)
{
bfin_r0 = tcp->u_rval;
return upoke(tcp->pid, PT_R0, bfin_r0);
return upoke(tcp, PT_R0, bfin_r0);
}

View File

@ -1,5 +1,5 @@
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
return upoke(tcp->pid, PT_ORIG_P0, scno);
return upoke(tcp, PT_ORIG_P0, scno);
}

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1995-2017 The strace developers.
* Copyright (c) 1995-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,11 +47,11 @@
[ 17] = { 0, TM, SEN(break), "break" },
[ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" },
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, NF, SEN(getpid), "getpid" },
[ 20] = { 0, PU|NF, SEN(getpid), "getpid" },
[ 21] = { 5, TF, SEN(mount), "mount" },
[ 22] = { 1, TF, SEN(umount), "umount" },
[ 23] = { 1, 0, SEN(setuid16), "setuid" },
[ 24] = { 0, NF, SEN(getuid16), "getuid" },
[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" },
[ 25] = { 1, 0, SEN(stime), "stime" },
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 1, 0, SEN(alarm), "alarm" },
@ -74,10 +74,10 @@
[ 44] = { 0, 0, SEN(prof), "prof" },
[ 45] = { 1, TM|SI, SEN(brk), "brk" },
[ 46] = { 1, 0, SEN(setgid16), "setgid" },
[ 47] = { 0, NF, SEN(getgid16), "getgid" },
[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" },
[ 48] = { 2, TS, SEN(signal), "signal" },
[ 49] = { 0, NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, NF, SEN(getegid16), "getegid" },
[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" },
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 2, TF, SEN(umount2), "umount2" },
[ 53] = { 0, 0, SEN(lock), "lock" },
@ -91,8 +91,8 @@
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 2, TSFA, SEN(ustat), "ustat" },
[ 63] = { 2, TD, SEN(dup2), "dup2" },
[ 64] = { 0, NF, SEN(getppid), "getppid" },
[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, PU|NF, SEN(getppid), "getppid" },
[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[ 66] = { 0, 0, SEN(setsid), "setsid" },
[ 67] = { 3, TS, SEN(sigaction), "sigaction" },
[ 68] = { 0, TS, SEN(sgetmask), "sgetmask" },
@ -226,10 +226,10 @@
[196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" },
[197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" },
[198] = { 3, TF, SEN(chown), "chown32" },
[199] = { 0, NF, SEN(getuid), "getuid32" },
[200] = { 0, NF, SEN(getgid), "getgid32" },
[201] = { 0, NF, SEN(geteuid), "geteuid32" },
[202] = { 0, NF, SEN(geteuid), "getegid32" },
[199] = { 0, PU|NF, SEN(getuid), "getuid32" },
[200] = { 0, PU|NF, SEN(getgid), "getgid32" },
[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" },
[202] = { 0, PU|NF, SEN(geteuid), "getegid32" },
[203] = { 2, 0, SEN(setreuid), "setreuid32" },
[204] = { 2, 0, SEN(setregid), "setregid32" },
[205] = { 2, 0, SEN(getgroups), "getgroups32" },
@ -250,7 +250,7 @@
[220] = { 3, TD, SEN(getdents64), "getdents64" },
[221] = { 3, TD, SEN(fcntl64), "fcntl64" },
[222 ... 223] = { },
[224] = { 0, NF, SEN(gettid), "gettid" },
[224] = { 0, PU|NF, SEN(gettid), "gettid" },
[225] = { 4, TD, SEN(readahead), "readahead" },
[226] = { 5, TF, SEN(setxattr), "setxattr" },
[227] = { 5, TF, SEN(setxattr), "lsetxattr" },
@ -304,12 +304,12 @@
[275] = { 6, TM, SEN(mbind), "mbind" },
[276] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[277] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[278] = { 4, 0, SEN(mq_open), "mq_open" },
[278] = { 4, TD, SEN(mq_open), "mq_open" },
[279] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[280] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[281] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[282] = { 2, 0, SEN(mq_notify), "mq_notify" },
[283] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[280] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[281] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[282] = { 2, TD, SEN(mq_notify), "mq_notify" },
[283] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[284] = { 4, 0, SEN(kexec_load), "kexec_load" },
[285] = { 5, TP, SEN(waitid), "waitid" },
[286] = { 5, 0, SEN(add_key), "add_key" },

View File

@ -1,2 +0,0 @@
static unsigned long cris_r10;
#define ARCH_PC_PEEK_ADDR (4 * PT_IRP)

View File

@ -1,16 +0,0 @@
static void
arch_sigreturn(struct tcb *tcp)
{
unsigned long regs[PT_MAX + 1];
if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, regs) < 0) {
perror_msg("sigreturn: PTRACE_GETREGS");
return;
}
const unsigned long addr =
regs[PT_USP] + offsetof(struct sigcontext, oldmask);
tprints("{mask=");
print_sigset_addr(tcp, addr);
tprints("}");
}

View File

@ -1,12 +0,0 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{
if (check_errno && is_negated_errno(cris_r10)) {
tcp->u_rval = -1;
tcp->u_error = -cris_r10;
} else {
tcp->u_rval = cris_r10;
}
}

View File

@ -1,6 +0,0 @@
/* Return codes: 1 - ok, 0 - ignore, other - error. */
static int
arch_get_scno(struct tcb *tcp)
{
return upeek(tcp->pid, 4 * PT_R9, &tcp->scno) < 0 ? -1 : 1;
}

View File

@ -1,15 +0,0 @@
/* Return -1 on error or 1 on success (never 0!). */
static int
get_syscall_args(struct tcb *tcp)
{
static const int crisregs[MAX_ARGS] = {
4*PT_ORIG_R10, 4*PT_R11, 4*PT_R12,
4*PT_R13 , 4*PT_MOF, 4*PT_SRP
};
unsigned int i;
for (i = 0; i < tcp->s_ent->nargs; ++i)
if (upeek(tcp->pid, crisregs[i], &tcp->u_arg[i]) < 0)
return -1;
return 1;
}

View File

@ -1,5 +0,0 @@
static int
get_syscall_result_regs(struct tcb *tcp)
{
return upeek(tcp->pid, 4 * PT_R10, &cris_r10) < 0 ? -1 : 0;
}

View File

@ -1,13 +0,0 @@
static int
arch_set_error(struct tcb *tcp)
{
cris_r10 = -tcp->u_error;
return upoke(tcp->pid, 4 * PT_R10, cris_r10);
}
static int
arch_set_success(struct tcb *tcp)
{
cris_r10 = tcp->u_rval;
return upoke(tcp->pid, 4 * PT_R10, cris_r10);
}

View File

@ -1,5 +0,0 @@
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
return upoke(tcp->pid, 4 * PT_R9, scno);
}

View File

@ -1,358 +0,0 @@
[ 0] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[ 1] = { 1, TP|SE, SEN(exit), "exit" },
[ 2] = { 0, TP, SEN(fork), "fork" },
[ 3] = { 3, TD, SEN(read), "read" },
[ 4] = { 3, TD, SEN(write), "write" },
[ 5] = { 3, TD|TF, SEN(open), "open" },
[ 6] = { 1, TD, SEN(close), "close" },
[ 7] = { 3, TP, SEN(waitpid), "waitpid" },
[ 8] = { 2, TD|TF, SEN(creat), "creat" },
[ 9] = { 2, TF, SEN(link), "link" },
[ 10] = { 1, TF, SEN(unlink), "unlink" },
[ 11] = { 3, TF|TP|SE|SI, SEN(execve), "execve" },
[ 12] = { 1, TF, SEN(chdir), "chdir" },
[ 13] = { 1, 0, SEN(time), "time" },
[ 14] = { 3, TF, SEN(mknod), "mknod" },
[ 15] = { 2, TF, SEN(chmod), "chmod" },
[ 16] = { 3, TF, SEN(chown16), "lchown" },
[ 17] = { 0, TM, SEN(break), "break" },
[ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" },
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, NF, SEN(getpid), "getpid" },
[ 21] = { 5, TF, SEN(mount), "mount" },
[ 22] = { 1, TF, SEN(umount), "umount" },
[ 23] = { 1, 0, SEN(setuid16), "setuid" },
[ 24] = { 0, NF, SEN(getuid16), "getuid" },
[ 25] = { 1, 0, SEN(stime), "stime" },
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 1, 0, SEN(alarm), "alarm" },
[ 28] = { 2, TD|TFST|TSTA, SEN(oldfstat), "oldfstat" },
[ 29] = { 0, TS, SEN(pause), "pause" },
[ 30] = { 2, TF, SEN(utime), "utime" },
[ 31] = { 2, 0, SEN(stty), "stty" },
[ 32] = { 2, 0, SEN(gtty), "gtty" },
[ 33] = { 2, TF, SEN(access), "access" },
[ 34] = { 1, 0, SEN(nice), "nice" },
[ 35] = { 0, 0, SEN(ftime), "ftime" },
[ 36] = { 0, 0, SEN(sync), "sync" },
[ 37] = { 2, TS, SEN(kill), "kill" },
[ 38] = { 2, TF, SEN(rename), "rename" },
[ 39] = { 2, TF, SEN(mkdir), "mkdir" },
[ 40] = { 1, TF, SEN(rmdir), "rmdir" },
[ 41] = { 1, TD, SEN(dup), "dup" },
[ 42] = { 1, TD, SEN(pipe), "pipe" },
[ 43] = { 1, 0, SEN(times), "times" },
[ 44] = { 0, 0, SEN(prof), "prof" },
[ 45] = { 1, TM|SI, SEN(brk), "brk" },
[ 46] = { 1, 0, SEN(setgid16), "setgid" },
[ 47] = { 0, NF, SEN(getgid16), "getgid" },
[ 48] = { 2, TS, SEN(signal), "signal" },
[ 49] = { 0, NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, NF, SEN(getegid16), "getegid" },
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 2, TF, SEN(umount2), "umount2" },
[ 53] = { 0, 0, SEN(lock), "lock" },
[ 54] = { 3, TD, SEN(ioctl), "ioctl" },
[ 55] = { 3, TD, SEN(fcntl), "fcntl" },
[ 56] = { 0, 0, SEN(mpx), "mpx" },
[ 57] = { 2, 0, SEN(setpgid), "setpgid" },
[ 58] = { 2, 0, SEN(ulimit), "ulimit" },
[ 59] = { 1, 0, SEN(oldolduname), "oldolduname" },
[ 60] = { 1, NF, SEN(umask), "umask" },
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 2, TSFA, SEN(ustat), "ustat" },
[ 63] = { 2, TD, SEN(dup2), "dup2" },
[ 64] = { 0, NF, SEN(getppid), "getppid" },
[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 66] = { 0, 0, SEN(setsid), "setsid" },
[ 67] = { 3, TS, SEN(sigaction), "sigaction" },
[ 68] = { 0, TS, SEN(sgetmask), "sgetmask" },
[ 69] = { 1, TS, SEN(ssetmask), "ssetmask" },
[ 70] = { 2, 0, SEN(setreuid16), "setreuid" },
[ 71] = { 2, 0, SEN(setregid16), "setregid" },
[ 72] = { 1, TS, SEN(sigsuspend), "sigsuspend" },
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },
[ 80] = { 2, 0, SEN(getgroups16), "getgroups" },
[ 81] = { 2, 0, SEN(setgroups16), "setgroups" },
[ 82] = { 1, TD, SEN(oldselect), "select" },
[ 83] = { 2, TF, SEN(symlink), "symlink" },
[ 84] = { 2, TF|TLST|TSTA, SEN(oldlstat), "oldlstat" },
[ 85] = { 3, TF, SEN(readlink), "readlink" },
[ 86] = { 1, TF, SEN(uselib), "uselib" },
[ 87] = { 2, TF, SEN(swapon), "swapon" },
[ 88] = { 4, 0, SEN(reboot), "reboot" },
[ 89] = { 3, TD, SEN(readdir), "readdir" },
[ 90] = { 1, TD|TM|SI, SEN(old_mmap), "mmap" },
[ 91] = { 2, TM|SI, SEN(munmap), "munmap" },
[ 92] = { 2, TF, SEN(truncate), "truncate" },
[ 93] = { 2, TD, SEN(ftruncate), "ftruncate" },
[ 94] = { 2, TD, SEN(fchmod), "fchmod" },
[ 95] = { 3, TD, SEN(fchown16), "fchown" },
[ 96] = { 2, 0, SEN(getpriority), "getpriority" },
[ 97] = { 3, 0, SEN(setpriority), "setpriority" },
[ 98] = { 4, 0, SEN(profil), "profil" },
[ 99] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" },
[100] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" },
[101] = { 3, 0, SEN(ioperm), "ioperm" },
[102] = { 2, TD, SEN(socketcall), "socketcall" },
[103] = { 3, 0, SEN(syslog), "syslog" },
[104] = { 3, 0, SEN(setitimer), "setitimer" },
[105] = { 2, 0, SEN(getitimer), "getitimer" },
[106] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
[107] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" },
[108] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[109] = { 1, 0, SEN(olduname), "olduname" },
[110] = { 1, 0, SEN(iopl), "iopl" },
[111] = { 0, 0, SEN(vhangup), "vhangup" },
[112] = { 0, 0, SEN(idle), "idle" },
[113] = { 5, 0, SEN(vm86), "vm86" },
[114] = { 4, TP, SEN(wait4), "wait4" },
[115] = { 1, TF, SEN(swapoff), "swapoff" },
[116] = { 1, 0, SEN(sysinfo), "sysinfo" },
[117] = { 6, TI, SEN(ipc), "ipc" },
[118] = { 1, TD, SEN(fsync), "fsync" },
[119] = { 0, TS, SEN(sigreturn), "sigreturn" },
[120] = { 5, TP, SEN(clone), "clone" },
[121] = { 2, 0, SEN(setdomainname), "setdomainname" },
[122] = { 1, 0, SEN(uname), "uname" },
[123] = { 3, 0, SEN(modify_ldt), "modify_ldt" },
[124] = { 1, 0, SEN(adjtimex), "adjtimex" },
[125] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[126] = { 3, TS, SEN(sigprocmask), "sigprocmask" },
[127] = { 2, 0, SEN(create_module), "create_module" },
[128] = { 3, 0, SEN(init_module), "init_module" },
[129] = { 2, 0, SEN(delete_module), "delete_module" },
[130] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" },
[131] = { 4, TF, SEN(quotactl), "quotactl" },
[132] = { 1, 0, SEN(getpgid), "getpgid" },
[133] = { 1, TD, SEN(fchdir), "fchdir" },
[134] = { 2, 0, SEN(bdflush), "bdflush" },
[135] = { 3, 0, SEN(sysfs), "sysfs" },
[136] = { 1, NF, SEN(personality), "personality" },
[137] = { 5, 0, SEN(afs_syscall), "afs_syscall" },
[138] = { 1, NF, SEN(setfsuid16), "setfsuid" },
[139] = { 1, NF, SEN(setfsgid16), "setfsgid" },
[140] = { 5, TD, SEN(llseek), "_llseek" },
[141] = { 3, TD, SEN(getdents), "getdents" },
[142] = { 5, TD, SEN(select), "_newselect" },
[143] = { 2, TD, SEN(flock), "flock" },
[144] = { 3, TM, SEN(msync), "msync" },
[145] = { 3, TD, SEN(readv), "readv" },
[146] = { 3, TD, SEN(writev), "writev" },
[147] = { 1, 0, SEN(getsid), "getsid" },
[148] = { 1, TD, SEN(fdatasync), "fdatasync" },
[149] = { 1, 0, SEN(sysctl), "_sysctl" },
[150] = { 2, TM, SEN(mlock), "mlock" },
[151] = { 2, TM, SEN(munlock), "munlock" },
[152] = { 1, TM, SEN(mlockall), "mlockall" },
[153] = { 0, TM, SEN(munlockall), "munlockall" },
[154] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
[155] = { 2, 0, SEN(sched_getparam), "sched_getparam" },
[156] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" },
[157] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" },
[158] = { 0, 0, SEN(sched_yield), "sched_yield" },
[159] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"},
[160] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"},
[161] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[162] = { 2, 0, SEN(nanosleep), "nanosleep" },
[163] = { 5, TM|SI, SEN(mremap), "mremap" },
[164] = { 3, 0, SEN(setresuid16), "setresuid" },
[165] = { 3, 0, SEN(getresuid16), "getresuid" },
[167] = { 5, 0, SEN(query_module), "query_module" },
[168] = { 3, TD, SEN(poll), "poll" },
[169] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[170] = { 3, 0, SEN(setresgid16), "setresgid" },
[171] = { 3, 0, SEN(getresgid16), "getresgid" },
[172] = { 5, 0, SEN(prctl), "prctl" },
[173] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
[174] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" },
[175] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[176] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" },
[177] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" },
[178] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" },
[179] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[180] = { 5, TD, SEN(pread), "pread64" },
[181] = { 5, TD, SEN(pwrite), "pwrite64" },
[182] = { 3, TF, SEN(chown16), "chown" },
[183] = { 2, TF, SEN(getcwd), "getcwd" },
[184] = { 2, 0, SEN(capget), "capget" },
[185] = { 2, 0, SEN(capset), "capset" },
[186] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[187] = { 4, TD|TN, SEN(sendfile), "sendfile" },
[188] = { 5, TN, SEN(getpmsg), "getpmsg" },
[189] = { 5, TN, SEN(putpmsg), "putpmsg" },
[190] = { 0, TP, SEN(vfork), "vfork" },
[191] = { 2, 0, SEN(getrlimit), "ugetrlimit" },
[192] = { 6, TD|TM|SI, SEN(mmap_pgoff), "mmap2" },
[193] = { 3, TF, SEN(truncate64), "truncate64" },
[194] = { 3, TD, SEN(ftruncate64), "ftruncate64" },
[195] = { 2, TF|TST|TSTA, SEN(stat64), "stat64" },
[196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" },
[197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" },
[198] = { 3, TF, SEN(chown), "lchown32" },
[199] = { 0, NF, SEN(getuid), "getuid32" },
[200] = { 0, NF, SEN(getgid), "getgid32" },
[201] = { 0, NF, SEN(geteuid), "geteuid32" },
[202] = { 0, NF, SEN(getegid), "getegid32" },
[203] = { 2, 0, SEN(setreuid), "setreuid32" },
[204] = { 2, 0, SEN(setregid), "setregid32" },
[205] = { 2, 0, SEN(getgroups), "getgroups32" },
[206] = { 2, 0, SEN(setgroups), "setgroups32" },
[207] = { 3, TD, SEN(fchown), "fchown32" },
[208] = { 3, 0, SEN(setresuid), "setresuid32" },
[209] = { 3, 0, SEN(getresuid), "getresuid32" },
[210] = { 3, 0, SEN(setresgid), "setresgid32" },
[211] = { 3, 0, SEN(getresgid), "getresgid32" },
[212] = { 3, TF, SEN(chown), "chown32" },
[213] = { 1, 0, SEN(setuid), "setuid32" },
[214] = { 1, 0, SEN(setgid), "setgid32" },
[215] = { 1, NF, SEN(setfsuid), "setfsuid32" },
[216] = { 1, NF, SEN(setfsgid), "setfsgid32" },
[217] = { 2, TF, SEN(pivotroot), "pivot_root" },
[218] = { 3, TM, SEN(mincore), "mincore" },
[219] = { 3, TM, SEN(madvise), "madvise" },
[220] = { 3, TD, SEN(getdents64), "getdents64" },
[221] = { 3, TD, SEN(fcntl64), "fcntl64" },
[224] = { 0, NF, SEN(gettid), "gettid" },
[225] = { 4, TD, SEN(readahead), "readahead" },
[226] = { 5, TF, SEN(setxattr), "setxattr" },
[227] = { 5, TF, SEN(setxattr), "lsetxattr" },
[228] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
[229] = { 4, TF, SEN(getxattr), "getxattr" },
[230] = { 4, TF, SEN(getxattr), "lgetxattr" },
[231] = { 4, TD, SEN(fgetxattr), "fgetxattr" },
[232] = { 3, TF, SEN(listxattr), "listxattr" },
[233] = { 3, TF, SEN(listxattr), "llistxattr" },
[234] = { 3, TD, SEN(flistxattr), "flistxattr" },
[235] = { 2, TF, SEN(removexattr), "removexattr" },
[236] = { 2, TF, SEN(removexattr), "lremovexattr" },
[237] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
[238] = { 2, TS, SEN(kill), "tkill" },
[239] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
[240] = { 6, 0, SEN(futex), "futex" },
[241] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[242] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[243] = { 1, 0, SEN(set_thread_area), "set_thread_area" },
[244] = { 1, 0, SEN(get_thread_area), "get_thread_area" },
[245] = { 2, TM, SEN(io_setup), "io_setup" },
[246] = { 1, TM, SEN(io_destroy), "io_destroy" },
[247] = { 5, 0, SEN(io_getevents), "io_getevents" },
[248] = { 3, 0, SEN(io_submit), "io_submit" },
[249] = { 3, 0, SEN(io_cancel), "io_cancel" },
[250] = { 5, TD, SEN(fadvise64), "fadvise64" },
[252] = { 1, TP|SE, SEN(exit), "exit_group" },
[253] = { 4, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[254] = { 1, TD, SEN(epoll_create), "epoll_create" },
[255] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[256] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[257] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[258] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[259] = { 3, 0, SEN(timer_create), "timer_create" },
[260] = { 4, 0, SEN(timer_settime), "timer_settime" },
[261] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[262] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
[263] = { 1, 0, SEN(timer_delete), "timer_delete" },
[264] = { 2, 0, SEN(clock_settime), "clock_settime" },
[265] = { 2, 0, SEN(clock_gettime), "clock_gettime" },
[266] = { 2, 0, SEN(clock_getres), "clock_getres" },
[267] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" },
[268] = { 3, TF|TSF|TSFA, SEN(statfs64), "statfs64" },
[269] = { 3, TD|TFSF|TSFA, SEN(fstatfs64), "fstatfs64" },
[270] = { 3, TS, SEN(tgkill), "tgkill" },
[271] = { 2, TF, SEN(utimes), "utimes" },
[272] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" },
[273] = { 5, 0, SEN(vserver), "vserver" },
[274] = { 6, TM, SEN(mbind), "mbind" },
[275] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[276] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[277] = { 4, 0, SEN(mq_open), "mq_open" },
[278] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[279] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[280] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[281] = { 2, 0, SEN(mq_notify), "mq_notify" },
[282] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[283] = { 4, 0, SEN(kexec_load), "kexec_load" },
[284] = { 5, TP, SEN(waitid), "waitid" },
[286] = { 5, 0, SEN(add_key), "add_key" },
[287] = { 4, 0, SEN(request_key), "request_key" },
[288] = { 5, 0, SEN(keyctl), "keyctl" },
[289] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[290] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[291] = { 0, TD, SEN(inotify_init), "inotify_init" },
[292] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[293] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[295] = { 4, TD|TF, SEN(openat), "openat" },
[296] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },
[297] = { 4, TD|TF, SEN(mknodat), "mknodat" },
[298] = { 5, TD|TF, SEN(fchownat), "fchownat" },
[299] = { 3, TD|TF, SEN(futimesat), "futimesat" },
[300] = { 4, TD|TF|TFST|TSTA,SEN(fstatat64), "fstatat64" },
[301] = { 3, TD|TF, SEN(unlinkat), "unlinkat" },
[302] = { 4, TD|TF, SEN(renameat), "renameat" },
[303] = { 5, TD|TF, SEN(linkat), "linkat" },
[304] = { 3, TD|TF, SEN(symlinkat), "symlinkat" },
[305] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[306] = { 3, TD|TF, SEN(fchmodat), "fchmodat" },
[307] = { 3, TD|TF, SEN(faccessat), "faccessat" },
[308] = { 6, TD, SEN(pselect6), "pselect6" },
[309] = { 5, TD, SEN(ppoll), "ppoll" },
[310] = { 1, TP, SEN(unshare), "unshare" },
[311] = { 2, 0, SEN(set_robust_list), "set_robust_list" },
[312] = { 3, 0, SEN(get_robust_list), "get_robust_list" },
[313] = { 6, TD, SEN(splice), "splice" },
[314] = { 6, TD, SEN(sync_file_range), "sync_file_range" },
[315] = { 4, TD, SEN(tee), "tee" },
[316] = { 4, TD, SEN(vmsplice), "vmsplice" },
[317] = { 6, TM, SEN(move_pages), "move_pages" },
[318] = { 3, 0, SEN(getcpu), "getcpu" },
[319] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[320] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[321] = { 3, TD|TS, SEN(signalfd), "signalfd" },
[322] = { 2, TD, SEN(timerfd_create), "timerfd_create" },
[323] = { 1, TD, SEN(eventfd), "eventfd" },
[324] = { 6, TD, SEN(fallocate), "fallocate" },
[325] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" },
[326] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" },
[327] = { 4, TD|TS, SEN(signalfd4), "signalfd4" },
[328] = { 2, TD, SEN(eventfd2), "eventfd2" },
[329] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[330] = { 3, TD, SEN(dup3), "dup3" },
[331] = { 2, TD, SEN(pipe2), "pipe2" },
[332] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[333] = { 5, TD, SEN(preadv), "preadv" },
[334] = { 5, TD, SEN(pwritev), "pwritev" },
[335] = { 2, TD, SEN(setns), "setns" },
[336] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" },
[337] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[338] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" },
[339] = { 5, TD, SEN(perf_event_open), "perf_event_open" },
[340] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
[341] = { 4, TN, SEN(accept4), "accept4" },
[342] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[343] = { 6, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[344] = { 4, 0, SEN(prlimit64), "prlimit64" },
[345] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[346] = { 1, TD, SEN(syncfs), "syncfs" },
[347] = { 4, TN, SEN(sendmmsg), "sendmmsg" },
[348] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" },
[349] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" },
[350] = { 5, 0, SEN(kcmp), "kcmp" },
[351] = { 3, TD, SEN(finit_module), "finit_module" },
[352] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[353] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[354] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[355] = { 3, 0, SEN(seccomp), "seccomp" },
[356] = { 3, 0, SEN(getrandom), "getrandom" },
[357] = { 2, TD, SEN(memfd_create), "memfd_create" },
[358] = { 3, TD, SEN(bpf), "bpf" },
[359] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -1,26 +0,0 @@
XLAT(4*PT_FRAMETYPE),
XLAT(4*PT_ORIG_R10),
XLAT(4*PT_R13),
XLAT(4*PT_R12),
XLAT(4*PT_R11),
XLAT(4*PT_R10),
XLAT(4*PT_R9),
XLAT(4*PT_R8),
XLAT(4*PT_R7),
XLAT(4*PT_R6),
XLAT(4*PT_R5),
XLAT(4*PT_R4),
XLAT(4*PT_R3),
XLAT(4*PT_R2),
XLAT(4*PT_R1),
XLAT(4*PT_R0),
XLAT(4*PT_MOF),
XLAT(4*PT_DCCR),
XLAT(4*PT_SRP),
XLAT(4*PT_IRP),
XLAT(4*PT_CSRINSTR),
XLAT(4*PT_CSRADDR),
XLAT(4*PT_CSRDATA),
XLAT(4*PT_USP),
/* Other fields in "struct user" */
#include "../userent0.h"

View File

@ -1,2 +0,0 @@
#include "crisv10/arch_regs.c"
#define ARCH_PC_PEEK_ADDR (4 * PT_ERP)

View File

@ -1 +0,0 @@
#include "crisv10/arch_rt_sigframe.c"

View File

@ -1 +0,0 @@
#include "crisv10/arch_sigreturn.c"

View File

@ -1 +0,0 @@
#include "crisv10/get_error.c"

View File

@ -1 +0,0 @@
#include "crisv10/get_scno.c"

View File

@ -1 +0,0 @@
#include "crisv10/get_syscall_args.c"

View File

@ -1 +0,0 @@
#include "crisv10/get_syscall_result.c"

View File

@ -1 +0,0 @@
#include "crisv10/rt_sigframe.h"

View File

@ -1 +0,0 @@
#include "crisv10/set_error.c"

View File

@ -1 +0,0 @@
#include "crisv10/set_scno.c"

View File

@ -1 +0,0 @@
#include "crisv10/syscallent.h"

View File

@ -1,43 +0,0 @@
XLAT(4*PT_ORIG_R10),
XLAT(4*PT_R0),
XLAT(4*PT_R1),
XLAT(4*PT_R2),
XLAT(4*PT_R3),
XLAT(4*PT_R4),
XLAT(4*PT_R5),
XLAT(4*PT_R6),
XLAT(4*PT_R7),
XLAT(4*PT_R8),
XLAT(4*PT_R9),
XLAT(4*PT_R10),
XLAT(4*PT_R11),
XLAT(4*PT_R12),
XLAT(4*PT_R13),
XLAT(4*PT_ACR),
XLAT(4*PT_SRS),
XLAT(4*PT_MOF),
XLAT(4*PT_SPC),
XLAT(4*PT_CCS),
XLAT(4*PT_SRP),
XLAT(4*PT_ERP),
XLAT(4*PT_EXS),
XLAT(4*PT_EDA),
XLAT(4*PT_USP),
XLAT(4*PT_PPC),
XLAT(4*PT_BP_CTRL),
XLAT(4*PT_BP+4),
XLAT(4*PT_BP+8),
XLAT(4*PT_BP+12),
XLAT(4*PT_BP+16),
XLAT(4*PT_BP+20),
XLAT(4*PT_BP+24),
XLAT(4*PT_BP+28),
XLAT(4*PT_BP+32),
XLAT(4*PT_BP+36),
XLAT(4*PT_BP+40),
XLAT(4*PT_BP+44),
XLAT(4*PT_BP+48),
XLAT(4*PT_BP+52),
XLAT(4*PT_BP+56),
/* Other fields in "struct user" */
#include "../userent0.h"

1
linux/hppa/arch_defs_.h Normal file
View File

@ -0,0 +1 @@
#define HAVE_ARCH_SA_RESTORER 0

View File

@ -36,6 +36,6 @@ FUNC_GET_RT_SIGFRAME_ADDR
{
unsigned long addr;
return upeek(tcp->pid, 4 * 30, &addr)
return upeek(tcp, 4 * 30, &addr)
? 0 : (addr & ~1UL) - RT_SIGFRAME_SIZE;
}

View File

@ -2,5 +2,5 @@
static int
arch_get_scno(struct tcb *tcp)
{
return upeek(tcp->pid, PT_GR20, &tcp->scno) < 0 ? -1 : 1;
return upeek(tcp, PT_GR20, &tcp->scno) < 0 ? -1 : 1;
}

View File

@ -5,7 +5,7 @@ get_syscall_args(struct tcb *tcp)
unsigned int i;
for (i = 0; i < tcp->s_ent->nargs; ++i)
if (upeek(tcp->pid, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
if (upeek(tcp, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
return -1;
return 1;
}

View File

@ -1,5 +1,5 @@
static int
get_syscall_result_regs(struct tcb *tcp)
{
return upeek(tcp->pid, PT_GR28, &hppa_r28) < 0 ? -1 : 0;
return upeek(tcp, PT_GR28, &hppa_r28) < 0 ? -1 : 0;
}

View File

@ -2,12 +2,12 @@ static int
arch_set_error(struct tcb *tcp)
{
hppa_r28 = -tcp->u_error;
return upoke(tcp->pid, PT_GR28, hppa_r28);
return upoke(tcp, PT_GR28, hppa_r28);
}
static int
arch_set_success(struct tcb *tcp)
{
hppa_r28 = tcp->u_rval;
return upoke(tcp->pid, PT_GR28, hppa_r28);
return upoke(tcp, PT_GR28, hppa_r28);
}

View File

@ -1,5 +1,5 @@
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
return upoke(tcp->pid, PT_GR20, scno);
return upoke(tcp, PT_GR20, scno);
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2001 Hewlett-Packard, Matthew Wilcox
* Copyright (c) 2001-2017 The strace developers.
* Copyright (c) 2001-2018 The strace developers.
*/
[ 0] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
@ -23,11 +23,11 @@
[ 17] = { 3, TN, SEN(socket), "socket" },
[ 18] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, NF, SEN(getpid), "getpid" },
[ 20] = { 0, PU|NF, SEN(getpid), "getpid" },
[ 21] = { 5, TF, SEN(mount), "mount" },
[ 22] = { 3, TN, SEN(bind), "bind" },
[ 23] = { 1, 0, SEN(setuid), "setuid" },
[ 24] = { 0, NF, SEN(getuid), "getuid" },
[ 24] = { 0, PU|NF, SEN(getuid), "getuid" },
[ 25] = { 1, 0, SEN(stime), "stime" },
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 1, 0, SEN(alarm), "alarm" },
@ -50,10 +50,10 @@
[ 44] = { 3, TN, SEN(getsockname), "getsockname" },
[ 45] = { 1, TM|SI, SEN(brk), "brk" },
[ 46] = { 1, 0, SEN(setgid), "setgid" },
[ 47] = { 0, NF, SEN(getgid), "getgid" },
[ 47] = { 0, PU|NF, SEN(getgid), "getgid" },
[ 48] = { 2, TS, SEN(signal), "signal" },
[ 49] = { 0, NF, SEN(geteuid), "geteuid" },
[ 50] = { 0, NF, SEN(getegid), "getegid" },
[ 49] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[ 50] = { 0, PU|NF, SEN(getegid), "getegid" },
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 2, TF, SEN(umount2), "umount2" },
[ 53] = { 3, TN, SEN(getpeername), "getpeername" },
@ -67,8 +67,8 @@
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 2, TSFA, SEN(ustat), "ustat" },
[ 63] = { 2, TD, SEN(dup2), "dup2" },
[ 64] = { 0, NF, SEN(getppid), "getppid" },
[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, PU|NF, SEN(getppid), "getppid" },
[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[ 66] = { 0, 0, SEN(setsid), "setsid" },
[ 67] = { 2, TF, SEN(pivotroot), "pivot_root" },
[ 68] = { 0, TS, SEN(sgetmask), "sgetmask" },
@ -209,7 +209,7 @@
[203] = { 5, 0, SEN(printargs), "attrctl" },
[204] = { 5, 0, SEN(printargs), "acl_get" },
[205] = { 5, 0, SEN(printargs), "acl_set" },
[206] = { 0, NF, SEN(gettid), "gettid" },
[206] = { 0, PU|NF, SEN(gettid), "gettid" },
[207] = { 4, TD, SEN(readahead), "readahead" },
[208] = { 2, TS, SEN(kill), "tkill" },
[209] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
@ -232,12 +232,12 @@
[226] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[227] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[228] = { 4, TI, SEN(semtimedop), "semtimedop" },
[229] = { 4, 0, SEN(mq_open), "mq_open" },
[229] = { 4, TD, SEN(mq_open), "mq_open" },
[230] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[231] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[232] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[233] = { 2, 0, SEN(mq_notify), "mq_notify" },
[234] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[231] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[232] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[233] = { 2, TD, SEN(mq_notify), "mq_notify" },
[234] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[235] = { 5, TP, SEN(waitid), "waitid" },
[236] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" },
[237] = { 1, 0, SEN(set_tid_address), "set_tid_address" },

3
linux/i386/arch_defs_.h Normal file
View File

@ -0,0 +1,3 @@
#define HAVE_ARCH_OLD_MMAP 1
#define HAVE_ARCH_OLD_SELECT 1
#define HAVE_ARCH_UID16_SYSCALLS 1

View File

@ -3,7 +3,7 @@ arch_set_error(struct tcb *tcp)
{
i386_regs.eax = -tcp->u_error;
#ifdef HAVE_GETREGS_OLD
return upoke(tcp->pid, 4 * EAX, i386_regs.eax);
return upoke(tcp, 4 * EAX, i386_regs.eax);
#else
return set_regs(tcp->pid);
#endif
@ -14,7 +14,7 @@ arch_set_success(struct tcb *tcp)
{
i386_regs.eax = tcp->u_rval;
#ifdef HAVE_GETREGS_OLD
return upoke(tcp->pid, 4 * EAX, i386_regs.eax);
return upoke(tcp, 4 * EAX, i386_regs.eax);
#else
return set_regs(tcp->pid);
#endif

View File

@ -2,7 +2,7 @@ static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
#ifdef HAVE_GETREGS_OLD
return upoke(tcp->pid, 4 * ORIG_EAX, scno);
return upoke(tcp, 4 * ORIG_EAX, scno);
#else
i386_regs.orig_eax = scno;
return set_regs(tcp->pid);

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1995-2017 The strace developers.
* Copyright (c) 1995-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,11 +47,11 @@
[ 17] = { 0, TM, SEN(break), "break" },
[ 18] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" },
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, NF, SEN(getpid), "getpid" },
[ 20] = { 0, PU|NF, SEN(getpid), "getpid" },
[ 21] = { 5, TF, SEN(mount), "mount" },
[ 22] = { 1, TF, SEN(umount), "umount" },
[ 23] = { 1, 0, SEN(setuid16), "setuid" },
[ 24] = { 0, NF, SEN(getuid16), "getuid" },
[ 24] = { 0, PU|NF, SEN(getuid16), "getuid" },
[ 25] = { 1, 0, SEN(stime), "stime" },
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 1, 0, SEN(alarm), "alarm" },
@ -74,10 +74,10 @@
[ 44] = { 0, 0, SEN(prof), "prof" },
[ 45] = { 1, TM|SI, SEN(brk), "brk" },
[ 46] = { 1, 0, SEN(setgid16), "setgid" },
[ 47] = { 0, NF, SEN(getgid16), "getgid" },
[ 47] = { 0, PU|NF, SEN(getgid16), "getgid" },
[ 48] = { 2, TS, SEN(signal), "signal" },
[ 49] = { 0, NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, NF, SEN(getegid16), "getegid" },
[ 49] = { 0, PU|NF, SEN(geteuid16), "geteuid" },
[ 50] = { 0, PU|NF, SEN(getegid16), "getegid" },
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 2, TF, SEN(umount2), "umount2" },
[ 53] = { 0, 0, SEN(lock), "lock" },
@ -91,8 +91,8 @@
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 2, TSFA, SEN(ustat), "ustat" },
[ 63] = { 2, TD, SEN(dup2), "dup2" },
[ 64] = { 0, NF, SEN(getppid), "getppid" },
[ 65] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, PU|NF, SEN(getppid), "getppid" },
[ 65] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[ 66] = { 0, 0, SEN(setsid), "setsid" },
[ 67] = { 3, TS, SEN(sigaction), "sigaction" },
[ 68] = { 0, TS, SEN(sgetmask), "sgetmask" },
@ -226,10 +226,10 @@
[196] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat64" },
[197] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" },
[198] = { 3, TF, SEN(chown), "lchown32" },
[199] = { 0, NF, SEN(getuid), "getuid32" },
[200] = { 0, NF, SEN(getgid), "getgid32" },
[201] = { 0, NF, SEN(geteuid), "geteuid32" },
[202] = { 0, NF, SEN(getegid), "getegid32" },
[199] = { 0, PU|NF, SEN(getuid), "getuid32" },
[200] = { 0, PU|NF, SEN(getgid), "getgid32" },
[201] = { 0, PU|NF, SEN(geteuid), "geteuid32" },
[202] = { 0, PU|NF, SEN(getegid), "getegid32" },
[203] = { 2, 0, SEN(setreuid), "setreuid32" },
[204] = { 2, 0, SEN(setregid), "setregid32" },
[205] = { 2, 0, SEN(getgroups), "getgroups32" },
@ -250,7 +250,7 @@
[220] = { 3, TD, SEN(getdents64), "getdents64" },
[221] = { 3, TD, SEN(fcntl64), "fcntl64" },
[222 ... 223] = { },
[224] = { 0, NF, SEN(gettid), "gettid" },
[224] = { 0, PU|NF, SEN(gettid), "gettid" },
[225] = { 4, TD, SEN(readahead), "readahead" },
[226] = { 5, TF, SEN(setxattr), "setxattr" },
[227] = { 5, TF, SEN(setxattr), "lsetxattr" },
@ -303,12 +303,12 @@
[274] = { 6, TM, SEN(mbind), "mbind" },
[275] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[276] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[277] = { 4, 0, SEN(mq_open), "mq_open" },
[277] = { 4, TD, SEN(mq_open), "mq_open" },
[278] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[279] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[280] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[281] = { 2, 0, SEN(mq_notify), "mq_notify" },
[282] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[279] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[280] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[281] = { 2, TD, SEN(mq_notify), "mq_notify" },
[282] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[283] = { 4, 0, SEN(kexec_load), "kexec_load" },
[284] = { 5, TP, SEN(waitid), "waitid" },
[285] = { }, /* sys_setaltroot */

Some files were not shown because too many files have changed in this diff Show More