Compare commits

...

651 Commits

Author SHA1 Message Date
fa82fca19b powerpc, x86_64: drop support of very old kernels
Assume that powerpc/powerpc64 kernel supports PTRACE_GETREGS
and x86_64 kernel supports PTRACE_GETREGSET.
This effectively drops support of powerpc/powerpc64 kernel
versions < 2.6.23 and x86_64 kernel versions < 2.6.34.

* linux/getregs_old.h: Remove.
* linux/powerpc/getregs_old.c: Likewise.
* linux/powerpc/getregs_old.h: Likewise.
* linux/powerpc64/getregs_old.c: Likewise.
* linux/powerpc64/getregs_old.h: Likewise.
* linux/x86_64/getregs_old.c: Likewise.
* linux/x86_64/getregs_old.h: Likewise.
* Makefile.am (EXTRA_DIST): Remove them.
* linux/i386/set_error.c (arch_set_error, arch_set_success)
[HAVE_GETREGS_OLD]: Remove.
* linux/powerpc/set_error.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
Include "i386/set_error.c" unconditionally.
* linux/i386/set_scno.c (arch_set_scno) [HAVE_GETREGS_OLD]: Remove.
* linux/powerpc/set_scno.c: Likewise.
* linux/x86_64/set_scno.c: Likewise.
Include "i386/set_scno.c" unconditionally.
* syscall.c: Do not include "getregs_old.h".
[HAVE_GETREGS_OLD]: Do not include "getregs_old.c".
[ARCH_REGS_FOR_GETREGSET] (ptrace_setregset): Define unconditionally.
[ARCH_REGS_FOR_GETREGS] (ptrace_setregs): Define unconditionally.
(get_regs) [HAVE_GETREGS_OLD]: Remove.
* NEWS (Portability): Document this.
2017-03-29 22:29:28 +00:00
a8d2417e97 aarch64: workaround gcc+kernel bug
Due to a subtle gcc bug that leads to miscompiled aarch64 kernels,
the 3rd argument of sched_getattr syscall is not quite 32-bit
on aarch64 as on other architectures.  For more details see
https://sourceforge.net/p/strace/mailman/message/35721703/

* defs.h (print_abnormal_hi): New prototype.
* util.c (print_abnormal_hi): New function.
* sched.c (SYS_FUNC(sched_getattr)) [AARCH64]: Use it.
* tests/sched_xetattr.c (main) [__arm64__ || __aarch64__]: Test it.
2017-03-29 18:27:14 +00:00
5b7681cf05 alpha, mips: fix missing flags in stat related compatibility syscalls
Following commands do the fix:

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

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

* linux/alpha/syscallent.h: Add TF and TD flags to stat related
compat syscall entries.
* linux/mips/syscallent-compat.h: Likewise.
2017-03-29 00:35:54 +00:00
f3088e1253 alpha: fix the number of arguments in alpha specific syscalls
* linux/alpha/syscallent.h (getxgid, osf_stat, osf_lstat, osf_fstat,
osf_sysinfo, sethae): Set nargs according to arch/alpha/kernel/osf_sys.c
from linux v4.10.
2017-03-24 15:09:59 +00:00
f6389aa5ea alpha: update comments about not implemented syscalls
* linux/alpha/syscallent.h: Sync "not implemented" comments
with arch/alpha/kernel/systbls.S from linux v4.10.
2017-03-24 15:09:59 +00:00
90ddd42859 Update BPF_MAP_TYPE_* constants
* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_ARRAY_OF_MAPS
and BPF_MAP_TYPE_HASH_OF_MAPS constants.
2017-03-23 17:46:15 +00:00
a4441dfa8c Update ioctl entries from linux v4.11-rc3
* linux/32/ioctls_inc_align16.h: Update from linux v4.11-rc3 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.
2017-03-23 16:42:32 +00:00
4aa409b9e3 maint: update for linux 4.11
* maint/ioctls_sym.sh (ppc_list): Add KVM_PPC_GET_RMMU_INFO
and KVM_PPC_CONFIGURE_V3_MMU.
2017-03-23 16:42:32 +00:00
722c73af9a test: rename README to README.md
* test/README: Rename to README.md, turn ../tests reference into an URL.
2017-03-19 13:34:16 +00:00
f9390b96f4 test: update README
* test/README: Tell the reader what this directory is actually for.
2017-03-19 13:34:16 +00:00
ec5480453b test: rewrite skodic.c demo
* test/skodic.c: Rewrite this demo to simplify its use.
2017-03-19 13:34:16 +00:00
5e925d6d9c Implement decoding of statx syscall
* linux/i386/syscallent.h [383]: Add statx entry.
* linux/x32/syscallent.h [332]: Likewise.
* linux/x86_64/syscallent.h [332]: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_statx.
* statx.c: New file.
* statx.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/.gitignore: Add statx.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add statx.test.
* tests/statx.c: New file.
* tests/statx.test: Likewise.
* tests/xstatx.c: Modify to support statx.
* xlat/at_statx_sync_types.in: New file.
* xlat/statx_attrs.in: Likewise.
* xlat/statx_masks.in: Likewise.
* NEWS: Mention this change.
2017-03-18 22:14:16 +00:00
12781b7466 tests: check for out of bounds fetch in parsers of stat family syscalls
* tests/xstatx.c (main): Create STRUCT_STAT object using
TAIL_ALLOC_OBJECT_CONST_PTR.
2017-03-17 20:15:20 +00:00
f0da50397e tests: check unexpected syscall errors returned by stat family syscalls
* tests/xstatx.c (main) [!OLD_STAT]: Do not skip the test
in case of EOVERFLOW.
Treat errors other than ENOSYS and EOVERFLOW as fatal.
2017-03-17 20:15:20 +00:00
c465b2ee0e tests: move try_run_prog to init.sh
Looks like try_run_prog may be of general use by other syscall class
tests.

* tests/sched.test (try_run_prog): Move it...
* tests/init: ... here.
2017-03-17 21:06:06 +01:00
45cca0e9b5 tests/sched.test: rc should be a local variable in try_run_prog
* tests/sched.test (try_run_prog): Add local rc.
2017-03-17 21:06:06 +01:00
a8a29266d8 tests: check decoding of int 0x80 on x86_64, x32, and x86
* tests/int_0x80.c: New file.
* tests/int_0x80.test: New test.
* tests/.gitignore: Add int_0x80.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS, XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Add int_0x80.test.
(XFAIL_TESTS): Add $(XFAIL_TESTS_$(ARCH)).
(CLEANFILES): Add $(TESTS:=.tmp.out) and $(TESTS:=.tmp.exp).
2017-03-16 20:38:48 +00:00
49f099f9c0 strace-graph: handle pid looping
* strace-graph: On long running process or heavily forking one (like
compilation), it can happen that a parent get 2 different children with
the same pid.  By tracking the currently runnig pid and adding the start
timestamp to the pid, the graph can now handle that case.

Closes: https://github.com/strace/strace/pull/7
2017-03-16 14:45:18 +00:00
eabace12c4 tests: use TAIL_ALLOC_OBJECT_CONST_PTR
Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \
tests/*.c
2017-03-16 13:46:36 +00:00
c36875b170 tests: use TAIL_ALLOC_OBJECT_VAR_PTR
Automatically convert tests to use TAIL_ALLOC_OBJECT_VAR_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*([^ =]+) = tail_alloc\(sizeof\((\2|\*\5)\)\);/\1TAIL_ALLOC_OBJECT_VAR_PTR(\2, \5);/' \
tests/{move_pages,net-sockaddr,sendfile}.c
2017-03-16 13:46:36 +00:00
72b7cfb3bf tests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h
Introduce a new macros for the most widespread use of tail_alloc.

* tests/tests.h (TAIL_ALLOC_OBJECT_CONST_PTR,
TAIL_ALLOC_OBJECT_VAR_PTR): New macros.
2017-03-16 13:46:36 +00:00
9407d10e12 Decode RUSAGE_THREAD
* xlat/usagewho.in: Add values for existing entities, add
RUSAGE_THREAD.
* tests/getrusage.c: Test decoding of RUSAGE_THREAD.
2017-03-16 12:39:12 +00:00
b24254d34c tests/sched.test: use heredoc in order to avoid spawning of subprocess
Pipelined commands executed in subprocesses (some shells have special
provision for last command in the pipeline, but it is not guaranteed
and not POSIX), so exit codes of these subprocesses can be lost.
In order to avoid creating subprocesses, input for read commands
is better to supply via heredoc and not pipe.

* tests/sched.test: Move test cases to heredoc.
2017-03-15 01:10:51 +00:00
30c16384ef tests: do not skip sched.test if one of its subtests skips
* tests/sched.test (try_run_prog): New function.
Use it instead of run_prog.
2017-03-15 01:05:45 +00:00
245d6d20ce tests: do not check decoding of setitimer syscall outside xetitimer.test
xetitimer.test already implements a comprehensive test of setitimer
syscall parser, no need to duplicate its parts in other tests.

* tests/clock_nanosleep.c (main): Remove setitimer expected output.
* tests/nanosleep.c (main): Likewise.
* tests/clock_nanosleep.test: Remove setitimer from the trace set.
* tests/nanosleep.test: Likewise.
2017-03-15 00:00:29 +00:00
1e92920f81 tests: check decoding of getitimer and setitimer corner cases
* tests/sched_xetattr.c: Include <unistd.h> and <asm/unistd.h>.
(main): Check that pointer and integer arguments of getitimer
and setitimer syscalls are decoded properly.
* tests/xetitimer.test: Add -a option.
2017-03-14 22:35:13 +00:00
645eb6405b tests: rewrite sigreturn syscall decoding check from match_grep to match_diff
Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/sigreturn.c: Rewrite.
* tests/sigreturn.test: Likewise.
2017-03-13 15:22:51 +00:00
8e1ebd868f ia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls
As there is no sigreturn syscall on ia64, mips n32, mips n64, x32,
and x86_64, no longer used parsers could be safely removed.

* linux/ia64/arch_sigreturn.c: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Remove [!LINUX_MIPSO32].
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Remove.
2017-03-13 15:22:51 +00:00
a3d941a863 Move sigreturn parser to libstrace
All architectures have rt_sigreturn, but only old ones also have
sigreturn.  Since not all architectures need a parser of sigreturn
syscall, remove the warning and move the parser to libstrace.

* Makefile.am (strace_SOURCES): Move sigreturn.c ...
(libstrace_a_SOURCES): ... here.
* linux/arch_sigreturn.c: Remove warning.
2017-03-13 15:22:50 +00:00
5c6951e73e tests: check decoding of rt_sigreturn syscall
* tests/rt_sigreturn.c: New file.
* tests/rt_sigreturn.test: New test.
* tests/.gitignore: Add rt_sigreturn.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add rt_sigreturn.test.
2017-03-13 15:22:50 +00:00
31601155c4 Implement proper decoding of rt_sigreturn syscall
* rt_sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_rt_sigreturn): Remove.
* linux/64/syscallent.h (rt_sigreturn): Change sys_func to rt_sigreturn.
* linux/hppa/syscallent.h (rt_sigreturn): Likewise.
* linux/ia64/syscallent.h (rt_sigreturn): Likewise.
* linux/s390/syscallent.h (rt_sigreturn): Likewise.
* linux/s390x/syscallent.h (rt_sigreturn): Likewise.
* linux/x86_64/syscallent.h (rt_sigreturn): Likewise.
* linux/x32/syscallent.h (rt_sigreturn, 64:rt_sigreturn): Likewise.
* NEWS: Mention this change.
2017-03-13 15:22:50 +00:00
c57cf9acf5 Introduce get_rt_sigframe_addr function
Add get_rt_sigframe_addr function for all supported architectures.
It is going to be used in a parser of rt_sigreturn syscall.

* defs.h (get_rt_sigframe_addr): New function prototype.
* rt_sigframe.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/arch_rt_sigframe.c: New file.
* linux/alpha/arch_rt_sigframe.c: Likewise.
* linux/arc/arch_rt_sigframe.c: Likewise.
* linux/arm/arch_rt_sigframe.c: Likewise.
* linux/avr32/arch_rt_sigframe.c: Likewise.
* linux/bfin/arch_rt_sigframe.c: Likewise.
* linux/crisv10/arch_rt_sigframe.c: Likewise.
* linux/crisv32/arch_rt_sigframe.c: Likewise.
* linux/hppa/arch_rt_sigframe.c: Likewise.
* linux/i386/arch_rt_sigframe.c: Likewise.
* linux/ia64/arch_rt_sigframe.c: Likewise.
* linux/m68k/arch_rt_sigframe.c: Likewise.
* linux/metag/arch_rt_sigframe.c: Likewise.
* linux/microblaze/arch_rt_sigframe.c: Likewise.
* linux/mips/arch_rt_sigframe.c: Likewise.
* linux/nios2/arch_rt_sigframe.c: Likewise.
* linux/or1k/arch_rt_sigframe.c: Likewise.
* linux/powerpc/arch_rt_sigframe.c: Likewise.
* linux/powerpc64/arch_rt_sigframe.c: Likewise.
* linux/riscv/arch_rt_sigframe.c: Likewise.
* linux/s390/arch_rt_sigframe.c: Likewise.
* linux/s390x/arch_rt_sigframe.c: Likewise.
* linux/sh/arch_rt_sigframe.c: Likewise.
* linux/sh64/arch_rt_sigframe.c: Likewise.
* linux/sparc/arch_rt_sigframe.c: Likewise.
* linux/sparc64/arch_rt_sigframe.c: Likewise.
* linux/tile/arch_rt_sigframe.c: Likewise.
* linux/x32/arch_rt_sigframe.c: Likewise.
* linux/x86_64/arch_rt_sigframe.c: Likewise.
* linux/xtensa/arch_rt_sigframe.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2017-03-13 15:22:50 +00:00
23f2891d4c Introduce struct_rt_sigframe type
Add rt_sigframe.h files with definitions of struct_rt_sigframe type
for all supported architectures.
These definitions are going to be used in a parser of rt_sigreturn
syscall.

* linux/rt_sigframe.h: New file.
* linux/bfin/rt_sigframe.h: Likewise.
* linux/crisv10/rt_sigframe.h: Likewise.
* linux/crisv32/rt_sigframe.h: Likewise.
* linux/hppa/rt_sigframe.h: Likewise.
* linux/i386/rt_sigframe.h: Likewise.
* linux/ia64/rt_sigframe.h: Likewise.
* linux/m68k/rt_sigframe.h: Likewise.
* linux/mips/rt_sigframe.h: Likewise.
* linux/powerpc64/rt_sigframe.h: Likewise.
* linux/s390/rt_sigframe.h: Likewise.
* linux/s390x/rt_sigframe.h: Likewise.
* linux/sh64/rt_sigframe.h: Likewise.
* linux/sparc/rt_sigframe.h: Likewise.
* linux/sparc64/rt_sigframe.h: Likewise.
* linux/tile/rt_sigframe.h: Likewise.
* linux/x32/rt_sigframe.h: Likewise.
* linux/x86_64/rt_sigframe.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2017-03-13 15:22:50 +00:00
9d1250b39c unwind.c: fix a possible buffer overflow
Linux does not prevent a user from creating a lot of nested directories
with length of the absolute path of the deepest one exceeding PATH_MAX,
then chdir'ing into it, creating a file there and mmap'ing it. Since the
length of the prefix preceding the pathname in /proc/[pid]/maps is not
necessary 80 (it's 73 on my machine), an overflow is possible.

* unwind.c (build_mmap_cache): Fix a possible buffer overflow.
2017-03-13 15:19:22 +00:00
c9731a0dbe util.c: remove a wrong comment
4924dbd6d7 modified the return type, but
not the comment.
2017-03-13 15:19:22 +00:00
8ffa3fd109 riscv: export riscv_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/riscv/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/riscv/arch_regs.c (riscv_sp_ptr): New variable.
2017-03-10 20:06:58 +00:00
6d32a2ee93 or1k: export or1k_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/or1k/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/or1k/arch_regs.c (or1k_sp_ptr): New variable.
2017-03-10 19:52:11 +00:00
6117728aac nios2: export nios2_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/nios2/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/nios2/arch_regs.c (nios2_sp_ptr): New variable.
2017-03-10 19:45:06 +00:00
5610aacaad metag: export metag_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/metag/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/metag/arch_regs.c (metag_sp_ptr): New variable.
2017-03-10 19:26:54 +00:00
3403f14ece avr32: export avr32_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/avr32/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/avr32/arch_regs.c (avr32_sp_ptr): New variable.
2017-03-10 18:40:05 +00:00
134042a514 arc: export arc_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/arc/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/arc/arch_regs.c (arc_sp_ptr): New variable.
2017-03-10 18:34:46 +00:00
43b7c24994 Introduce print_sigset_addr function
As the definition of NSIG_BYTES is based on NSIG defined in <signal.h>,
NSIG_BYTES cannot be used in files that use kernel sigset_t.

Add another wrapper around print_sigset_addr_len_limit function that
takes one argument less than print_sigset_addr_len wrapper.  This new
wrapper is going to be used in cases when the length argument is equal
to NSIG_BYTES.

* defs.h (print_sigset_addr): New function prototype.
* signal.c (print_sigset_addr): New function.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Replace
print_sigset_addr_len with print_sigset_addr.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
2017-03-09 22:51:46 +00:00
a58fc3c950 README.md: rework guidelines about sending bug reports 2017-03-08 13:43:47 +00:00
efa36ac950 Update information on how to build strace from git repository
* INSTALL-git.md: Describe how to build strace from git repository.
* README.md: Add reference to INSTALL-git.md.
* README-hacking: Likewise.
2017-03-08 09:10:03 +00:00
db316ec7fb README.md: fix references to in-tree files
* README.md: Change references to COPYING and NEWS files from absolute
to relative.
2017-03-05 19:08:28 +00:00
8d50c350e5 INSTALL: regenerate from install.texi
Regenerate INSTALL from install.texi using the following command:
makeinfo --plaintext install.texi > INSTALL

* INSTALL: Regenerate from install.texi.
2017-03-05 16:29:41 +00:00
cdc18792b4 install.texi: remove irrelevant sections
Remove "Multiple Architectures" and "Particular Systems" sections using
the following filter script:

awk '/^@node (Multiple Architectures|Particular Systems)/{skip=1;next}
/^@node/{skip=0} {if(!skip)print}'

* install.texi (Multiple Architectures, Particular Systems): Remove.
2017-03-05 16:29:41 +00:00
65afd28152 install.texi: import from GNU Autoconf
install.texi from GNU Autoconf is the ultimate source of INSTALL file.
This edition of install.texi has been downloaded from
https://git.savannah.gnu.org/cgit/autoconf.git/plain/doc/install.texi?id=63f3c78cdb0ccc85751543e387ef2a7252d5f0a2

* install.texi: Import from GNU Autoconf.
2017-03-05 16:29:41 +00:00
811638e9c1 Implement -e trace=%sched option for tracing sched_* syscalls
Based on the patch by Md Haris Iqbal
(https://sourceforge.net/p/strace/mailman/message/35111320/)

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

    git grep -Fl 'SEN(sched_' linux/ | xargs sed -i \
        's/0\(,[[:space:]]*SEN(sched_\)/TSC\1/'

* sysent.h (TRACE_SCHED): New definition.
* syscall.c: Alias TSC to TRACE_SCHED around syscallent.h inclusion.
* linux/32/syscallent.h: Add TSC flag for sched_* sycalls.
* 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.
* qualify.c (lookup_class): Add TRACE_SCHED for "%sched".
* tests/ksysent.c: Define TSC to 0.
* tests/nsyscalls.c: Likewise.
* tests/sched.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add sched.test.
* strace.1 (.SS Filtering): Add information about %sched syscall class.
* NEWS: Mention this change.

Co-authored-by: Md Haris Iqbal <haris.phnx@gmail.com>
2017-03-05 01:11:13 +01:00
6477079361 Add "%" prefix for syscall classes in qualify
(as suggested in
https://www.mail-archive.com/strace-devel@lists.sourceforge.net/msg05147.html )

In order to move them to a different namespace than syscall names. This is
already a problem in case of ipc class which shadows ipc syscall.

Old behaviour is retained in order to preserve backwards compatibility.

* qualify.c (lookup_class) <syscall_class>: Add %-prefixed class definitions.
* strace.1 (.SS Filtering): Add information regarding %-prefixed class
syntax, declare legacy class syntax deprecated.
* tests/net.test: Update to use %-prefixed syscall class name.
* tests/netlink_protocol.test: Likewise.
* tests/qual_fault-exit_group.test: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/sigreturn.test: Likewise.
* tests/uio.test: Likewise.
* NEWS: Mention this change.
2017-03-05 00:32:18 +01:00
73a21f1a3f tests: simplify print_time_t
* tests/print_time.c (print_time_t): Treat localtime errors as fatal.
2017-02-28 01:21:15 +00:00
2bba131575 Update homepage URL
* README: Change homepage URL to https://strace.io
* debian/control: Likewise.
* strace.spec.in: Likewise.
2017-02-27 23:11:07 +00:00
bc41bcbb0b tests: transform print_time_t into print_time_t_nsec
* tests/print_time.c (print_time_t): Rename to print_time_t_nsec,
take second argument and print it.
* tests/tests.h (print_time_t): Rename to print_time_t_nsec,
add second argument.
* tests/utime.c (main): Use print_time_t_nsec instead of print_time_t.
* tests/xstatx.c (print_stat): Likewise.  Pass nanoseconds
to print_time_t_nsec instead of printing them.
2017-02-26 23:23:31 +00:00
0698ab728f tests: use print_time_t in utime.test
* tests/utime.c (print_tm): Remove.
(main): Use print_time_t instead of print_tm.
2017-02-26 22:57:37 +00:00
af10e6e751 tests: move print_time function to libtests
Rename print_time function to print_time_t and move it to libtests.

* tests/print_time.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (print_time_t): New prototype.
* tests/print_time.c (print_time): Remove.
(print_stat): Replace print_time with print_time_t.
2017-02-26 20:35:37 +00:00
b8a045fbf0 tests: macroize printing of atime, mtime, and ctime fields in xstatx.c
Introduce a macro for printing similar time related fields.

* print_struct_stat.c (PRINT_ST_TIME): New macro.
(print_stat): Use it.
2017-02-26 19:14:34 +00:00
889012d4b5 print_struct_stat.c: macroize printing of atime, mtime, and ctime fields
Introduce a macro for printing similar time related fields.

* print_struct_stat.c (PRINT_ST_TIME): New macro.
(print_struct_stat): Use it.
2017-02-26 19:14:34 +00:00
f7b9a6ac63 x32: fix decoding of flags argument of preadv2 and pwritev2 syscalls
x32 is the only linux architecture where preadv2 and pwritev2 syscalls
take 5 arguments instead of 6.

* io.c (PREADV2_PWRITEV2_FLAGS_ARG_NO): New macro.
(SYS_FUNC(preadv2), SYS_FUNC(pwritev2)): Use it.
* linux/x32/syscallent.h (preadv2, pwritev2): Change nargs to 5.
* NEWS: Mention this fix.
* tests/preadv2-pwritev2.c (main): Fix invocation of preadv2
and pwritev2 syscalls on x32.
2017-02-25 15:55:31 +00:00
7519e54937 tests: rewrite ppoll syscall decoding check from match_grep to match_diff
Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/ppoll-v.c: New file.
* tests/ppoll-v.test: New test.
* tests/ppoll.c: Rewrite.
* tests/ppoll.test: Likewise.
* tests/ppoll.expected: Remove.
* tests/ppoll-v.expected: Remove.
* tests/.gitignore: Add ppoll-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ppoll-v.test.
(EXTRA_DIST): Remove ppoll.expected and ppoll-v.expected.
2017-02-21 22:39:45 +00:00
667b764c41 tests: move get_sigset_size function to libtests
* tests/get_sigset_size.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (get_sigset_size): New prototype.
* tests/ptrace.c: Do not check for __NR_rt_sigprocmask.
(main): Use get_sigset_size.
* tests/signalfd4.c: Do not check for __NR_rt_sigprocmask.
(get_sigset_size): Remove.
2017-02-20 00:10:35 +00:00
556652be53 sched: enhance decoding of sched_setattr syscall
Implement read/write semantics of struct sched_attr.size argument
of sched_setattr syscall.  Do not print members of struct sched_attr
besides sched_attr.size when the specified structure size is less than
the minimal size allowed by the kernel.

* sched.c (print_sched_attr): Fetch struct sched_attr.size and use it
as the structure size.  Print struct sched_attr.size only when the
structure size is less than SCHED_ATTR_MIN_SIZE.
(SYS_FUNC(sched_setattr)): Call print_sched_attr with zero size
argument.  Print struct sched_attr.size returned by the kernel
on exiting syscall in case of E2BIG. Print the last syscall argument
on exiting syscall.
(SYS_FUNC(sched_getattr)): Do not call print_sched_attr with zero size
argument.
* NEWS: Mention it.
* tests/sched_xetattr.c (main): Check it.
2017-02-19 00:31:40 +00:00
f31755fda2 tests: check decoding of sched_[gs]etattr corner cases
* tests/sched_xetattr.c (main): Check that integer arguments
of sched_getattr and sched_setattr syscalls are decoded properly
by adding a few cases with filled higher 32 bits.
Check that pointer argument is decoded properly
on F8ILL_KULONG_SUPPORTED architectures.
2017-02-18 09:58:52 +00:00
3e80074350 Move definition of struct sched_attr to a separate header file
Avoid multiple defintions of struct sched_attr by creating a separate
header file with its definition and using it in other places.

* sched_attr.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* sched.c: Include it.
(print_sched_attr): Use it.
* tests/sched_xetattr.c: Include it.
(main): Use it.
2017-02-18 09:58:52 +00:00
6e9ad7be61 tests: rewrite sched_xetattr.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/adjtimex.c: Include "xlat.h" and "xlat/schedulers.h",
(sys_sched_getattr, sys_sched_setattr): New functions.
(main): Use them.  Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.
2017-02-18 09:58:52 +00:00
55d126a8d7 Use tprints instead of tprintf in a few more places
* bpf.c (bpf_obj_manage, bpf_prog_attach_detach): Replace tprintf
with tprints for printing strings without format specifiers.
* dm.c (dm_decode_dm_target_spec): Likewise.
* mq.c (SYS_FUNC(mq_timedreceive)): Likewise.
* perf.c (print_perf_event_attr): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
2017-02-17 23:19:58 +00:00
5b2e59a413 bpf: update BPF_PROG_ATTACH decoding
Implement decoding of BPF_F_ALLOW_OVERRIDE flag of BPF_PROG_ATTACH
command introduced by linux kernel commit v4.10-rc7-174-g7f67763.

* configure.ac: Check for union bpf_attr.attach_flags
instead of union bpf_attr.attach_type.
* xlat/bpf_attach_flags.in: New file.
* bpf.c: Include "xlat/bpf_attach_flags.h".
(bpf_prog_attach_detach): Rename print_attach_bpf_fd argument
to print_attach.  Add attach_flags field to the structure,
print it in case of BPF_PROG_ATTACH.
* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_ATTACH_FLAGS
instead of HAVE_UNION_BPF_ATTR_ATTACH_TYPE.
(prog_cgroup): Initialize attach_flags field.
(main): Update expected output.
2017-02-17 00:05:00 +00:00
f19251a808 tests: rewrite adjtimex.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/adjtimex.c: Include "xlat.h", "xlat/adjtimex_state.h",
and "xlat/adjtimex_status.h".
(main): Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.
2017-02-16 21:02:44 +00:00
18b582ec11 tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK
* tests/init_delete_module.h (bogus_zero): Remove.
* tests/delete_module.c (main): Replace bogus_zero and
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/finit_module.c (main): Replace bogus_zero
with F8ILL_KULONG_MASK.
* tests/init_module.c (main): Likewise.
* tests/pipe2.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Replace
(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
* tests/fanotify_init.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/fanotify_mark.c (main): Likewise.
* tests/file_handle.c (main): Likewise.
* tests/kexec_load.c (main): Likewise.
* tests/setfsugid.c (main): Likewise.
* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
with F8ILL_KULONG_MASK.
* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
2017-02-16 16:36:14 +00:00
1d5e810ce8 tests: fill higher bits of integer arguments of fcntl* syscalls
Check that integer arguments of fcntl and fcntl64 syscalls are decoded
properly by casting them to kernel_ulong_t and filling higher bits.

* tests/struct_flock.c (invoke_test_syscall): Cast "fd" and "cmd"
syscall arguments to kernel_ulong_t, fill their higher 32 bits.
2017-02-16 12:51:00 +00:00
ec75764697 tests: use sprintrc in tests of fcntl and fcntl64 syscalls
* tests/struct_flock.c (EINVAL_STR): Remove.
(test_flock_einval, test_flock): Use sprintrc instead of EINVAL_STR.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval, test_flock64): Likewise.
2017-02-16 12:51:00 +00:00
f954c48f4b Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.16-1.
* strace.spec.in: Likewise.
2017-02-15 22:59:59 +00:00
b13da8675c Prepare for 4.16 release
* NEWS: Update for 4.16 release.
2017-02-14 10:11:12 +00:00
2e2cd52e24 .mailmap: add addresses of JingPiao Chen
* .mailmap: Add both addresses of JingPiao Chen here to avoid
duplications in CREDITS file.
2017-02-13 21:08:41 +00:00
9ff5dbe36d tests: skip scno tampering tests on compat mips abi
* tests/scno_tampering.sh: In case of mips abi, skip the test
unless it is the native abi.
2017-02-13 17:30:00 +00:00
2063341fef Fix -Werror=duplicate-decl-specifier compilation issues
capability.c:82:28: error: duplicate "const" declaration specifier
capability.c:110:33: error: duplicate "const" declaration specifier
rt_tgsigqueueinfo.c:42:61: error: duplicate "const" declaration specifier
utime.c:66:23: error: duplicate "const" declaration specifier
waitid.c:147:20: error: duplicate "const" declaration specifier

* capability.c (cap_user_header_t, cap_user_data_t): Remove.
(get_cap_header): Change return type
to "const struct user_cap_header_struct *".
(print_cap_header, print_cap_data): Change the type of last argument
to "const struct user_cap_header_struct * const".
(SYS_FUNC(capget)): Change type of "h" variable
to "const struct user_cap_header_struct *".
(SYS_FUNC(capset)): Change type of "h" variable
to "const struct user_cap_header_struct * const".
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Change the type of last
argument to "const void *const".
* tests/utime.c (main): Change the type of "tail_u" variable
to "const struct utimbuf *const".
* tests/waitid.c (do_waitid): Change the type of 3rd argument
to "const siginfo_t *const".
2017-02-12 19:14:15 +00:00
c10dd66fb7 tests: rewrite pipe syscall decoding check from match_grep to match_diff
* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
instead of [!HAVE_PIPE2].
(main): Do not call pipe2.
* tests/pipe.test: Skip the test if libc pipe wrapper does not use
pipe syscall, rewrite from match_grep to match_diff.
* tests/pipe.expected: Update expected output.
2017-02-12 14:12:41 +00:00
3c5dbffe61 tests: rewrite pipe2 syscall decoding check from match_grep to match_diff
Unlike pipe.test that is based on match_grep, the new test
is based on match_diff and does more rigorous testing.

* tests/pipe2.c: New file.
* tests/pipe2.test: New test.
* tests/.gitignore: Add pipe2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pipe2.test.
2017-02-11 13:40:42 +00:00
649fe41781 tests: rewrite mq.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/mq.c: Include <stdio.h>.
(NAME): New macro.
(main): Use it.  Print expected output.
* tests/mq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
* tests/mq.test: Use run_strace_match_diff.
2017-02-10 00:14:45 +00:00
2ee98e5030 Simplify struct inject_opts.rval semantics
Drop use of INJECT_OPTS_RVAL_DISABLE special inject_opts.rval value,
INJECT_OPTS_RVAL_DEFAULT is enough.

* defs.h (INJECT_OPTS_RVAL_DISABLE): Remove.
* qualify.c (qualify_inject_common): Do not replace
INJECT_OPTS_RVAL_DEFAULT with INJECT_OPTS_RVAL_DISABLE
in inject_opts.rval.
* syscall.c (tamper_with_syscall_entering): Check
for INJECT_OPTS_RVAL_DEFAULT instead of INJECT_OPTS_RVAL_DISABLE.
2017-02-09 22:26:14 +00:00
98313939b3 tests: check signal injection along with fault injection
* tests/qual_inject-error-signal.c: New file.
* tests/qual_inject-error-signal.expected: Likewise.
* tests/qual_inject-error-signal.test: New test.
* tests/.gitignore: Add qual_inject-error-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-error-signal.test.
(EXTRA_DIST): Add qual_inject-error-signal.expected.
2017-02-09 22:26:14 +00:00
8b1f878809 tests: simplify qual_inject-signal.test
* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.
2017-02-09 22:26:14 +00:00
1124db4483 Make symbolic errno values match case-insensitive
Follow the example of case-insensitive symbolic signal values in signal
and inject expressions and make symbolic errno values in inject
expressions case-insensitive.

* qualify.c (find_errno_by_name): Use strcasecmp instead of strcmp
to match symbolic errno values.
* tests/qual_fault.c (main): Likewise.
* tests/qual_fault.test: Test case-insensitive symbolic errno match.
2017-02-09 14:38:08 +00:00
e2040dede4 tests: check case-insensitive symbolic signal match
* tests/qual_signal.test: Test case-insensitive symbolic signal match.
2017-02-09 14:38:08 +00:00
45365df082 Update NEWS 2017-02-09 13:48:04 +00:00
8663bfb907 Update NEWS 2017-02-08 17:22:02 +00:00
959dc8b32b strace.spec.in: fix dist version checks
* strace.spec.in: Fix libunwind availability check.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-02-08 16:36:57 +00:00
e0fc01c0ef tests: update ipc_sem.test for new glibc
Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
address to semctl like other libcs.

* tests/ipc_sem.c (main) [__GLIBC__]: Remove.
2017-02-08 15:54:35 +00:00
75c3844167 tests: fix typo in bpf.test
* tests/bpf.c (main): Add missing semicolon.

Fixes: ad427721 ("tests: rewrite bpf.test from match_grep to match_diff")
2017-02-08 15:12:40 +00:00
34878f17b9 tests: check signal injection
* tests/qual_inject-signal.c: New file.
* tests/qual_inject-signal.expected: Likewise.
* tests/qual_inject-signal.test: New test.
* tests/.gitignore: Add qual_inject-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-signal.test.
(EXTRA_DIST): Add qual_inject-signal.expected.
2017-02-08 13:51:33 +00:00
be73ca4bae Implement -e inject= option
Introduce -e inject= as a general injection option,
limit -e fault= option to syscall fault injection.

Change default return code of syscall fault injection to ENOSYS.

* qualify.c (parse_inject_token): Add fault_tokens_only argument,
do not accept retval= and signal= tokens when fault_tokens_only
is set to true.
(parse_inject_expression): Add fault_tokens_only argument,
forward it to parse_inject_token.
(qualify_inject_common): New function.
(qualify_fault): Use it.
(qualify_inject): New function.
(qual_options): New entry.
* strace.1: Describe -e inject= option.
* NEWS: Mention -e inject= option.
* tests/qual_fault-syntax.test: Test that -e fault= option does not
support retval=, signal=, and multiple error= tokens.
* tests/qual_fault.c (DEFAULT_ERRNO): Set to ENOSYS unconditionally.
* tests/qual_inject-retval.test: Replace -e fault= option
with -e inject= option.
* tests/qual_inject-syntax.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2017-02-08 09:28:38 +00:00
d1dfcc533e tests: prepare for introduction of -e inject= option
Rename files related to fault injection to avoid further confusion.

* tests/fault_injection-exit_group.expected: Rename
to tests/qual_fault-exit_group.expected.
* tests/fault_injection-exit_group.test: Rename
to tests/qual_fault-exit_group.test.
* tests/fault_syntax.test: Rename to tests/qual_fault-syntax.test.
* tests/fault_injection.c: Rename to tests/qual_fault.c.
* tests/fault_injection.test: Rename to tests/qual_fault.test.
* tests/fault_injection-retval.c: Rename to tests/qual_inject-retval.c.
* tests/fault_injection-retval.test: Rename
to tests/qual_inject-retval.test.
* tests/fault_injection.sh: Rename to tests/scno_tampering.sh.
* tests/.gitignore: Update.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Update.
2017-02-08 09:28:30 +00:00
d5152aae15 Prepare for introduction of -e inject= option
As -e fault= injection syntax has been extended to configure various
kinds of injections besides fault injection, the original option name
bacame too narrow.

This change renames internal constants, types, and functions from
"fault" to more generic inject/tamper ones.

* defs.h (fault_opts): Rename to inject_opts.
(FAULT_OPTS_RVAL_DEFAULT): Rename to INJECT_OPTS_RVAL_DEFAULT.
(FAULT_OPTS_RVAL_DISABLE): Rename to INJECT_OPTS_RVAL_DISABLE.
(struct tcb): Rename fault_vec field to inject_vec.
(TCB_FAULT_INJ): Rename to TCB_TAMPERED.
(QUAL_FAULT): Rename to QUAL_INJECT.
(fault_vec): Rename to inject_vec.
All users changed.
* qualify.c (fault_set): Rename to inject_set.
(parse_fault_token): Rename to parse_inject_token.
(parse_fault_expression): Rename to parse_inject_expression.
All callers changed.
* syscall.c (fault_vec): Rename to inject_vec.
(tcb_fault_opts): Rename to tcb_inject_opts.
(inject_syscall_fault_entering): Rename to tamper_with_syscall_entering.
(update_syscall_fault_exiting): Rename to tamper_with_syscall_exiting.
(syscall_fault_injected): Rename to syscall_tampered.
All callers changed.
2017-02-08 09:28:07 +00:00
779a28e117 tests: make Makefile.am lists sorted in C locale
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Make sorted in C locale.
2017-02-07 17:56:32 +00:00
86477a6228 tests: use ARG_STR in msg_control.test
Drop local VAL_STR macro in favour of ARG_STR macro from tests/tests.h.

* tests/msg_control.c (VAL_STR): Remove.
(test_sol_socket, test_sol_ip): Replace VAL_STR with ARG_STR.
2017-02-07 15:25:41 +00:00
cb93e85828 powerpc, powerpc64: wire up new syscalls
* linux/powerpc/syscallent.h [382]: Add kexec_file_load entry.
* linux/powerpc64/syscallent.h [382]: Likewise.
2017-02-07 14:58:30 +00:00
55be4cb0ed microblaze: wire up new syscalls
* linux/microblaze/syscallent.h [392..397]: New entries.
2017-02-07 14:58:30 +00:00
d4499fa508 avr32: wire up new syscalls
* linux/avr32/syscallent.h [328..330]: New entries.
2017-02-07 14:58:30 +00:00
d901c7c922 Update IPV6_* constants
* xlat/sockipv6options.in: Add IPV6_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~1.
2017-02-06 22:13:20 +00:00
3115a96587 Update IP_* constants
* xlat/sockipoptions.in: Add IP_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~2.
2017-02-06 22:13:20 +00:00
5a2a54591d or1k: fix build
This fixes a typo in the arch_set_success for the or1k architecture.

* linux/or1k/set_error.c (arch_setsuccess): Rename to arch_set_success.

Fixes: 41d647c ("Implement success injection")
Closes: https://github.com/strace/strace/pull/6
2017-02-06 17:20:00 +00:00
cdee133cfb Update ioctl entries from linux 4.10
* linux/32/ioctls_inc_align16.h: Update from linux v4.10 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.
2017-02-04 15:57:01 +00:00
ef3fc7ebb7 maint: update for linux 4.10
* maint/ioctls_sym.sh: Update workaround for linux/if_pppox.h file.
2017-02-04 15:57:01 +00:00
f7a65e0c7d maint: add workaround for m68k
* maint/ioctls_sym.sh: Skip asm/amigayle.h.
2017-02-04 15:57:01 +00:00
bf4e76e4e7 tests: check decoding of bpf corner cases
* tests/bpf.c (bogus_bpf): New function.
(BOGUS_BPF): New macro.
(main): Use them.
* tests/bpf.test: Add -a option.
2017-01-31 19:38:45 +00:00
ad4277214e tests: rewrite bpf.test from match_grep to match_diff
* tests/bpf.c (errstr): New variable.
(sys_bpf): New function.
(map_create, map_any, prog_load, obj_manage, prog_cgroup): Use it.
(main): Update expected output.
* tests/bpf.test: Use run_strace_match_diff.
2017-01-29 23:12:07 +00:00
3c356c40e4 bpf: move common code to a separate function
* bpf.c (bpf_prog_attach_detach): New function.
(bpf_prog_attach, bpf_prog_detach): Use it.
2017-01-29 23:54:54 +00:00
0a8dd6a68c Update bpf syscall decoding
Implement decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
and BPF_PROG_DETACH commands.

* bpf.c: Include "xlat/bpf_attach_type.h".
(bpf_obj_manage, bpf_prog_attach, bpf_prog_detach): New functions.
(SYS_FUNC(bpf)): Use them.
* configure.ac: Check for union bpf_attr.bpf_fd and union
bpf_attr.attach_type.
* xlat/bpf_attach_type.in: New file.
* xlat/bpf_commands.in: Update list of BPF_* command constants.
* xlat/bpf_map_types.in: Update list of BPF_MAP_TYPE_* constants.
* xlat/bpf_prog_types.in: Update list of BPF_PROG_TYPE_* constants.
* tests/bpf.c [HAVE_UNION_BPF_ATTR_BPF_FD] (obj_manage): New function.
[HAVE_UNION_BPF_ATTR_ATTACH_TYPE] (prog_cgroup): Likewise.
(main): Use them.
2017-01-29 21:54:43 +00:00
fe871501ff tests: check success injection
* tests/fault_injection-retval.c: New file.
* tests/fault_injection-retval.test: New test.
* tests/.gitignore: Add fault_injection-retval.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add fault_injection-retval.test.
2017-01-28 09:55:20 +00:00
41d647ce67 Implement success injection
This extends fault injection syntax with :retval= option.
When :retval=VALUE is specified, the syscall number is replaced by -1
and a bogus success VALUE is returned to the callee.

* defs.h (fault_opts): Remove err field, add rval field.
(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
New macros.
* qualify.c (parse_fault_token): Handle retval= token.
(qualify_fault): Update fault_opts initialization after the move
from struct fault_opts.err to struct fault_opts.rval.
* syscall.c (arch_set_success): New prototype.
(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
(update_syscall_fault_exiting): Implement retval injection.
* strace.1: Update the section on fault injection.
* NEWS: Mention retval= option.
* linux/aarch64/set_error.c (arch_set_success): New function.
* linux/alpha/set_error.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/xtensa/set_error.c: Likewise.

Closes: https://github.com/strace/strace/issues/3
2017-01-28 09:47:00 +00:00
a0795c594a mips: rewrite configure check without sgidefs.h
Use builtin macros provided by gcc >= 3.4 instead of sgidefs.h macros.

* configure.ac <mips>: Do not include <asm/sgidefs.h>, use _ABIO32
instead of _MIPS_SIM_ABI32, _ABIN32 instead of _MIPS_SIM_NABI32,
and _ABI64 instead of _MIPS_SIM_ABI64.
2017-01-26 23:57:17 +00:00
3fac547ab0 .gitignore: add missing files that should be ignored
* .gitignore: Add /ioctl_iocdef.[ih].

Fixes: 5679fad ("ioctlsort: get ioctl definitions from host, not build")
2017-01-20 18:30:11 +00:00
0a9cd4bf2e mips: use <asm/sgidefs.h>
Build fix for MIPS with musl libc.

The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
but not by musl. Regardless of the libc, the kernel headers provide
<asm/sgidefs.h> which provides the same definitions, so use that
instead.

* configure.ac: Replace <sgidefs.h> with <asm/sgidefs.h>.

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-01-20 18:30:11 +00:00
8b7be09c7b Implement decoding of ustat syscall
* configure.ac (AC_CHECK_HEADERS): Add ustat.h.
* ustat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h: Remove sys_ustat.
* tests/ustat.c: New file.
* tests/ustat.test: New test.
* tests/.gitignore: Add ustat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ustat.test.
2017-01-20 18:30:11 +00:00
76be950a1d Makefile.am: allow indented DEF_MPERS_TYPE includes
* Makefile.am (m%_type_defs.h): Change sed regular expression to allow
arbitrary number of whitespace characters between "#" symbol
and "include" directive.
2017-01-20 18:30:11 +00:00
9152bd86b5 strace.1: fix formatting
* strace.1: Remove misplaced .TP macros.
2017-01-20 18:30:11 +00:00
ca2bf7c9e9 tests: drop non-USE_ASM_STAT case support
With the switch of fstatat family tests to USE_ASM_STAT variant,
there are no non-USE_ASM_STAT users left.  Remove support of unused
non-USE_ASM_STAT case.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_mtim.tv_nsec.
* tests/fstatat.c (USE_ASM_STAT): Remove.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.
* tests/xstatx.c: Assume USE_ASM_STAT.
[!USE_ASM_STAT]: Remove.
2017-01-13 20:07:09 +00:00
e72b9262eb tests: call newfstatat and fstatat64 syscalls directly
Do not use glibc wrappers to call newfstatat and fstatat64.
These wrappers have various problems, e.g. they segfault on sparc64
and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
conversion of timestamps on mips64.

* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
directly.
(USE_ASM_STAT): Define.
* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.

Based on patch by James Cowgill <james410@cowgill.org.uk>.
2017-01-13 19:54:57 +00:00
3fb78d7305 tests: remove redundant SAMPLE_SIZE definitions
Remove all definitions of SAMPLE_SIZE that are identical to the fallback
definition in tests/xstatx.c.

* tests/fstat64.c (SAMPLE_SIZE): Remove.
* tests/lstat64.c (SAMPLE_SIZE): Remove.
* tests/stat64.c (SAMPLE_SIZE): Remove.
2017-01-13 19:39:18 +00:00
41e15ecd44 tests: change SAMPLE_SIZE type to libc_off_t
As ftruncate libc function and our create_sample function that calls
ftruncate both take size argument of type libc_off_t, change the type
of SAMPLE_SIZE constant to libc_off_t.

* tests/fstat.c (SAMPLE_SIZE): Cast to libc_off_t.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/oldfstat.c (SAMPLE_SIZE): Likewise.
* tests/oldlstat.c (SAMPLE_SIZE): Likewise.
* tests/oldstat.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/xstatx.c (SAMPLE_SIZE): Likewise.
2017-01-13 19:31:30 +00:00
5679fad7a0 ioctlsort: get ioctl definitions from host, not build
When cross-compiling, ioctlsort must obtain _IOC_* values from the
host, build's values may be incompatible.

* ioctl_iocdef.c: New file.
* Makefile.am (EXTRA_DIST): Add it.
(ioctl_iocdef.i, ioctl_iocdef.h): New rules.
(ioctlsort%.o): Depend on ioctl_iocdef.h.
(CLEANFILES): Add ioctl_iocdef.h and ioctl_iocdef.i.
* ioctlsort.c: Include "ioctl_iocdef.h" instead of <linux/ioctl.h>.

Signed-off-by: Alexey Neyman <stilor@att.net>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-01-13 03:17:37 +00:00
e64a2e8db5 tests: treat struct stat mismatch as an error
If the test detects struct stat mismatch, this is likely an error
in definitions of a stat structure that might affect strace as well.
Fail the test instead of skipping it to attract more attention.

* tests/xstatx.c (main): Return 1 instead of 77
in case of struct stat mismatch.
2017-01-13 01:14:51 +00:00
d57f262ce5 tests: rewrite diagnostics about struct stat mismatch
* tests/xstatx.c (LOG_STAT_OFFSETOF_SIZEOF): New macro.
(main): Use it to print struct stat mismatch details.
2017-01-12 23:03:20 +00:00
ada8aeb715 tests: fix typo in tests/xstatx.c
* tests/xstatx.c [!IS_FSTAT]: Define IS_FSTAT instead of IS_STAT.
2017-01-12 23:03:20 +00:00
e4863d412d tests: fix typo in mlock.c
* tests/mlock.c [!(__NR_mlock && __NR_munlock)]: Fix spelling
of SKIP_MAIN_UNDEFINED.
2017-01-12 22:46:28 +00:00
373220061a strace: move description of -k option to the appropriate place
Follow the example of strace.1 and put the description of -k option
into the  output format group.

* strace.c (usage): Move description of -k option to the output
format group.
2017-01-12 22:46:28 +00:00
791e45ec4f Remove redundant commas at the end of structure initializers
Automatically remove redundant commas using the following
sed expression:

git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'

* linux/32/syscallent.h: Remove redundant commas at the end of structure
initializers.
* 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/microblaze/userent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/kexec_file_load.c: Likewise.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-11 23:48:41 +00:00
7c3e4edd3b tests: check decoding of scsi ioctl commands
* tests/ioctl_scsi.c: New file.
* tests/ioctl_scsi.test: New test.
* tests/.gitignore: Add ioctl_scsi.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_scsi.test.
2017-01-10 00:05:17 +00:00
4912e5b208 scsi: implement decoding of all SG_* ioctl commands
* print_sg_req_info.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/sg_scsi_reset.in: New file.
* scsi.c: Include "xlat/sg_scsi_reset.h".
(scsi_ioctl): Implement decoding of all SG_* ioctl commands.
2017-01-10 00:05:17 +00:00
6919e370f9 scsi: prepare for decoding of other SG_* ioctl commands
* scsi.c (scsi_ioctl): Introduce a switch statement.
2017-01-10 00:05:17 +00:00
6b39e463b6 tests: check decoding of ioctl SG_IO v3 commands
* tests/ioctl_sg_io_v3.c: New file.
* tests/ioctl_sg_io_v3.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v3.test.
2017-01-10 00:05:17 +00:00
3dd797830d tests: check decoding of ioctl SG_IO v4 commands
* tests/ioctl_sg_io_v4.c: New file.
* tests/ioctl_sg_io_v4.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v4.test.
2017-01-10 00:05:17 +00:00
ee7912c0ca scsi: add fallback definitions for SG_* ioctl command constants
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.

* xlat/scsi_sg_commands.in: New file.
* scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing
a fallback definition of SG_IO.
2017-01-10 00:05:17 +00:00
eac07b2bd6 xlat: provide fallback definitions for BSG_FLAG_* constants
BSG_FLAG_* constants were introduced later than the header file where
they are defined.

* xlat/bsg_flags.in: Add default values for constants.
2017-01-10 00:05:17 +00:00
36f594a305 xlat: provide fallback definitions for SG_FLAG_* constants
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.

* xlat/sg_io_flags.in: Add default values for constants.
2017-01-10 00:05:17 +00:00
ced31982a4 sg_io_v4: print din_resid and dout_resid fields as signed integers
* sg_io_v4.c (decode_response): Print din_resid and dout_resid fields
using %d format.
2017-01-10 00:05:17 +00:00
215b7bb38d sg_io: cleanup printing of sg_io buffers
Turn print_sg_io_buffer into a universal sg_io buffer printer.

* sg_io_v3.c (print_sg_io_buffer): Add iovec_count argument.
Call tprint_iov_upto when iovec_count is non-zero.
(decode_request, decode_response): Do not call tprint_iov_upto directly,
use print_sg_io_buffer instead.
* sg_io_v4.c: Likewise.
2017-01-10 00:05:17 +00:00
84ecd63651 sg_io: decode structures on exiting syscall in case of syserror
The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78,
translates its "struct request.errors" to ioctl errors after
filling in all the output members of the SG_IO header structure.

As there is no easy way to tell SCSI layer errors from other syscall
errors, decode the structure on exiting syscall in case of syserror,
too.

* scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use
get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io
unconditionally.
* sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
* sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
2017-01-10 00:05:17 +00:00
f18b0ae42c sg_io: reorder printing of fields to follow structure order
* sg_io_v4.c (decode_request): Print timeout, flags, and usr_ptr fields
after dout_xferp field.
2017-01-08 16:55:48 +00:00
e2de9acdbc sg_io_v3: print sg_io_hdr.duration field as unsigned integer
* sg_io_v3.c (decode_response): Print duration field using %u format.
2017-01-08 19:53:53 +03:00
16d336702f sg_io_v3: print msg_status field
* sg_io_v3.c (decode_response): Print msg_status field.
2017-01-08 19:52:05 +03:00
1538b9dff3 sg_io: print names of array fields and corresponding length fields
* sg_io_v3.c (decode_request): Print names of cmd_len, cmdp,
and dxferp fields.
(decode_response): Print names of dxferp, sb_len_wr, and sbp fields.
* sg_io_v4.c (decode_request): Print names of request_len, request,
dout_xfer_len, and dout_xferp fields.
(decode_response): Print names of response_len, response,
and din_xferp fields.
2017-01-08 16:00:01 +00:00
e257082643 sg_io_v3: print status fields using %#x format specifier
The formerly used format string %02x led to misleading output as there
was no clear indication sometimes whether the printed integer was
decimal or hexadecimal.

* sg_io_v3.c (decode_response): Print status and masked_status fields
using %#x format specifier instead of %02x.
2017-01-08 15:51:59 +00:00
90bcf10061 sg_io_v4: print status fields in a hexadecimal form
The tradition is to print scsi status codes in a hexadecimal form.

* sg_io_v4.c (decode_response): Print driver_status, transport_status,
and device_status fields using %#x format specifier instead of %u.
2017-01-08 15:51:59 +00:00
11defb56a4 sg_io_v4: print request_tag and generated_tag fields in hex
The tradition is to print scsi tags in a hexadecimal form.

* sg_io_v4.c (decode_request): Print request_tag field
using ("%#" PRI__x64) format string.
(decode_response): Print generated_tag field using ("%#" PRI__x64)
format string.
2017-01-08 15:51:58 +00:00
653b9a6f95 sg_io_v4: print usr_ptr field in a hexadecimal form
As the nature of this field is pointer-like, print it
in a hexadecimal form.

* sg_io_v4.c (decode_request): Print usr_ptr field
using ("%#" PRI__x64) format string.
2017-01-08 15:36:42 +00:00
fb39d06748 sg_io_v4: do not print spare_in and spare_out fields
As the kernel does not touch these fields, there is no use
to print them.

* sg_io_v4.c (decode_request): Do not print spare_in field.
(decode_response): Do not print spare_out field.
2017-01-08 15:33:30 +00:00
0503b69486 sg_io: decode struct sg_io_hdr.info and struct sg_io_v4.info
Print struct sg_io_hdr.info and struct sg_io_v4.info using printflags.

* xlat/sg_io_info.in: New file.
* defs.h (sg_io_info): New xlat prototype.
* sg_io_v3.c: Include "xlat/sg_io_info.h".
(decode_response): Print struct_sg_io_hdr.info using printflags.
* sg_io_v4.c: (decode_response): Print struct sg_io_v4.info
using printflags.
2017-01-08 03:30:23 +00:00
0f774151a4 sg_io: decode struct sg_io_hdr.flags and struct sg_io_v4.flags
Print struct sg_io_hdr.flags and struct sg_io_v4.flags using printflags.

* xlat/sg_io_flags.in: New file.
* sg_io_v3.c: Include "xlat/sg_io_flags.h".
(decode_request): Print struct_sg_io_hdr.flags using printflags.
* xlat/bsg_flags.in: New file.
* sg_io_v4.c: Include "xlat/bsg_flags.h".
(decode_request): Print struct sg_io_v4.flags using printflags.
2017-01-08 03:30:02 +00:00
d30a9bf779 Mpersify struct sg_io_hdr
struct sg_io_hdr contains pointers and therefore has to be mpersified.

* defs.h (decode_sg_io_v3): Remove prototype.
* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
Mpersify it.
(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.
2017-01-08 01:05:50 +00:00
768d7cb78f Split scsi.c
Move decoders of SG_IO v3 and v4 APIs into separate files,
compile generic SG_IO decoder unconditionally.

* sg_io_v3.c: New file.
* sg_io_v4.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes.
* ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition.
* scsi.c: (print_sg_io_res): Remove.
(print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req
with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4,
compile uncoditionally.
(scsi_ioctl): Replace print_sg_io_req and print_sg_io_res
with decode_sg_io, compile uncoditionally.
Move [HAVE_SCSI_SG_H] code to sg_io_v3.c.
Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.
2017-01-08 00:01:03 +00:00
cdd27d2088 scsi: detect and print changes of interface id
* scsi.c (print_sg_io_v3_res): Detect and print changes
of struct sg_io_hdr.interface_id field between entering and exiting
syscall.
(print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard
field between entering and exiting syscall.
2017-01-07 19:09:37 +00:00
ff96efe158 scsi: print field names of all fields being printed
* scsi.c (print_sg_io_v3_req): Always print the name
of struct sg_io_hdr.interface_id field.
(print_sg_io_v4_req): Always print the name of struct sg_io_v4.guard
field.
(print_sg_io_req): Print unknown interface id as an integer.
(scsi_ioctl): Save interface id on entering syscall and use it
on exiting syscall.
2017-01-07 22:01:27 +03:00
ce616808a6 scsi: print struct sg_io_hdr.dxfer_direction field name
* scsi.c (print_sg_io_v3_req): Print struct sg_io_hdr.dxfer_direction
field name.
2017-01-07 21:55:40 +03:00
e95caf5505 scsi: print "protocol" and "subprotocol" field names of struct sg_io_v4
* scsi.c (print_sg_io_v4_req): Print field names
of struct sg_io_v4.protocol and struct sg_io_v4.subprotocol.
2017-01-07 21:45:48 +03:00
600457fa9d Print hexadecimal integer in error diagnostics using %#x
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.

* aio.c (startup_child, test_ptrace_seize): Print status
using %#x format specifier instead of %x.
2017-01-07 16:44:44 +00:00
a286680b04 aio: print hexadecimal integer using %#x
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.

* aio.c (print_common_flags): Print struct iocb.aio_flags using %#x
format specifier instead of %x.
* tests/aio.c (main): Likewise.
2017-01-07 16:44:44 +00:00
601a324df2 scsi: rewrite print_sg_io_buffer using printstr_ex(QUOTE_FORCE_HEX)
As printstr_ex has got QUOTE_FORCE_HEX flag support, there is no need
to implement it manually any longer.

* scsi.c (print_uchar): Remove.
(print_sg_io_buffer): Rewrite using printstr_ex(QUOTE_FORCE_HEX).
2017-01-06 16:31:35 +00:00
c119a6da7c getrandom: print string as hex-escaped
Since there is no reason to interpret the value returned by getrandom as
ASCII string, it makes sense to always print it as a hex-escaped string.

* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
to force hex-escaped string formatting.
* tests/getrandom.test: Remove no longer needed -xx flag as the string
is always printed in hexadecimal format now.

Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-01-06 11:43:50 +00:00
34a920baad util: add support for forcing printing string as hex-escaped
This could be useful in cases when some binary data should not be
interpreted as an ASCII string, but rather as an array of byte values.

* defs.h (QUOTE_FORCE_HEX): New macro constant.
* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
in user_style parameter.
2017-01-06 11:39:54 +00:00
a8f0442fd7 term: do not abort decoding in case of non-verbose output
The case of unset verbose is handled by umoven_or_printaddr, moreover,
exiting at this point is plain wrong and leads to last argument not
being printed while it should be.

* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Do not check verbose flags explicitly and do not
exit early if it is not set.
2017-01-06 11:39:33 +00:00
ae663f17fe tests: skip fault injection tests on hppa if the kernel is too old
* tests/fault_injection.sh: Add the minimal kernel version for hppa.
2017-01-05 20:46:48 +00:00
e752ef61c3 tests: skip readahead.test on MIPS n64 when built with glibc < 2.25
Due to a bug in glibc readahead syscall wrapper on MIPS n64,
this wrapper cannot be used in readahead.test.

* tests/readahead.c [HAVE_READAHEAD && LINUX_MIPSN64 && glibc < 2.25]:
Undefine HAVE_READAHEAD.

Reported-by: James Cowgill <james410@cowgill.org.uk>
2017-01-05 18:20:57 +00:00
92ac6131a1 tests: replace init_magic with fill_memory
Use the same fill_memory/fill_memory_ex interface in all affected tests.

* tests/ioctl_block.c (init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_evdev.c: Likewise.
* tests/ioctl_v4l2.c: Likewise.
* tests/ioctl_mtd.c (magic, init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_rtc.c: Likewise.
2017-01-05 01:34:24 +00:00
ff9f61dce9 tests: rewrite ioctl_v4l2 test without reliance on init_magic
* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros.
(main): Use them.  Rewrite expected output without assumptions
on any particular magic data.
2017-01-05 01:34:24 +00:00
84e3de2018 tests: remove redundant casts in fill_memory{,_ex} invocations
* tests/ioctl_loop.c (main): Remove redundant casts of fill_memory
first argument.
* tests/kexec_load.c (main): Likewise.
* tests/perf_event_open.c (main): Likewise.
* tests/quotactl.c (main): Likewise.
* tests/mq_sendrecv.c (main): Remove redundant casts of fill_memory_ex
first argument.
* tests/quotactl-xfs.c (main): Likewise.
2017-01-04 22:17:26 +00:00
801d42d947 tests: change the type of fill_memory{,_ex} first argument to void *
As these functions behave like memset, it's more convenient to have
the first argument of type void * like memset.

* tests/fill_memory.c (fill_memory, fill_memory_ex): Change the type
of first argument from "char *" to "void *".
* tests/tests.h (fill_memory, fill_memory_ex): Likewise.
2017-01-04 22:08:32 +00:00
23287f11fe tests: check non-verbose decoding of LOOP_* ioctls
* tests/ioctl_loop-nv.c: New file.
* tests/ioctl_loop-nv.test: New test.
* tests/ioctl_loop.c [!ABBREV] (ABBREV): Define to 0.
(print_loop_info, print_loop_info64): Handle [ABBREV != 0] case.
* tests/.gitignore: Add ioctl_loop-nv.
* tests/Makefile.am (check_PROGRAMS): Likewise.
2017-01-04 22:00:38 +00:00
2acabfe47a tests: add more checks of LOOP_* ioctls decoding
* tests/ioctl_loop.c: Include <linux/ioctl.h>.
(magic, lmagic): Move static constants ...
(main): ... here.  Change types of magic constants to kernel_ulong_t.
Add more checks.
2017-01-04 21:53:00 +00:00
3127a6a275 tests: check decoding of LOOP_* ioctls
* tests/ioctl_loop.c: New file.
* tests/ioctl_loop-v.c: Likewise.
* tests/ioctl_loop.test: New test.
* tests/ioctl_loop-v.test: Likewise.
* tests/.gitignore: Add ioctl_loop and ioctl_loop-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_loop.test and ioctl_loop-v.test.

Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-04 19:59:27 +00:00
17a2ba8415 Drop vsprintf.c
Drop custom vfprintf implementation that was disabled by default.
Apparently nobody tests strace with this vfprintf enabled, otherwise
multiple uses of format specifiers not supported by this custom vfprintf
would not left unnoticed.

The GNU C library is not the only libc available, so those who want
faster implementations of libc functions are encouraged to try building
strace with other libc implementations.

* vsprintf.c: Remove.
* Makefile.am (strace_SOURCES): Remove vsprintf.c.
* defs.h (USE_CUSTOM_PRINTF, strace_vfprintf): Remove.
* strace.c (tprintf): Replace strace_vfprintf with vfprintf.
2017-01-04 13:22:19 +00:00
297f570c2d loop: remove unnecessary verbose check
The verbose flag is responsible for dereferencing of addresses, and it
is perfectly handled by umove_or_printaddr; moreover, this early exit
leads to incorrect formatting of last argument.

* loop.c (loop_ioctl): Do not check verbose flag explicitly and do not
exit early if it is not set.
2017-01-04 13:22:19 +00:00
0fbbe358ee loop: fix lo_encrypt_key field output
lo_encrypt_key is a sized string with its size specified by
lo_encrypt_key_size field, so take lo_encrypt_key_size into account.

* loop.c (decode_loop_info, decode_loop_info64): Use minimum of
LO_KEY_SIZE and lo_encrypt_key_size field value as lo_encrypt_key size.
2017-01-04 13:22:19 +00:00
426b63f3fa loop: print lo_encrypt_key_size field of struct loop_info as unsigned
It is converted to an unsigned value in kernel (see loop_info64_from_old
in drivers/block/loop.c), so let's print it that way despite its type.

* loop.c (decode_loop_info): Print lo_encrypt_key_size as an uint32_t
value.
2017-01-04 13:22:19 +00:00
1ccc55eed2 tests: add more checks of unknown ioctl command formatting
* tests/ioctl.c (main): Additional check for unknown ioctl command
decoding.
* tests/ioctl_evdev.c (main): Likewise.
* tests/ioctl_dm.c: Include <linux/ioctl.h> for _IOC_SIZE and _IOC_NR.
(main) <dummy_dm_ioctl1, dummy_dm_ioctl2, dummy_dm_arg>: New constants.
Add more checks for unknown command formatting.
2017-01-04 13:22:19 +00:00
b00f54e881 ioctl: do not print explicit 0x prefix and do not specify minimum width
Specifying output width for size argument is rather misleading - it can
be up to 14 bits in size.  The use of explicit "0x" prefix is
discouraged because 0x0 looks ugly.  Usage of width specification along
with alternate form flag leads to inconsistent output for 0.
Let's use just plain %#x qualifiers instead.

* ioctl.c (ioctl_print_code): Change printf qualifiers for ioctl command
type, number and size to "%#x".
* tests/ioctl.c (main): Update expected test output.
* tests/ioctl_dm.c (main): Likewise.
* tests/ioctl_evdev.c (main): Likewise.
2017-01-04 13:22:19 +00:00
7ba63db908 loop: fix printing of the reserved field array items
They are of char type, so "hh" length modifier should be used (otherwise
they are printed incorrectly as they are sign extended implicitly when
passed as printf arguments in case char is a signed type which is true
for most compilers).

* loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx"
in printing routine for array elements of the "reserved" field of
loop_info structure.
2017-01-04 13:22:19 +00:00
589e3285d5 tests: check ioctl(SIOCGIFCONF) decoding
* tests/ioctl_sock_gifconf.c: New file.
* tests/ioctl_sock_gifconf.test: New test.
* tests/.gitignore: Add ioctl_sock_gifconf.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sock_gifconf.test.
2017-01-04 11:48:11 +00:00
5882b169a0 dm.c: add copyright notice 2017-01-04 11:46:20 +00:00
71a69a36f8 Add scno.h and syscallent.i to .gitignore files
* .gitignore: Add /scno.h and /syscallent.i.
* tests/.gitignore: Add scno.h and syscallent.i.
2017-01-04 11:29:32 +00:00
f2d80518f7 tests/.gitignore: add generated files that should be ignored
* tests/.gitignore: Replace addkey with add_key, add attach-f-p-cmd.
2017-01-04 11:28:48 +00:00
b58f75c5d4 Remove checks of __NR_* availability from strace source code
* strace.c: Remove __NR_tkill checks, assume it is always defined.
* util.c: Remove __NR_process_vm_readv checks and fallback definitions,
assume it is always defined.
2017-01-03 13:46:26 +00:00
2dd365f912 Include "scno.h" in files that check __NR_* constants
* strace.c: Include "scno.h".
* util.c: Likewise.
2017-01-03 11:27:35 +00:00
d6ea0d0204 Generate scno.h for use during the build of strace itself
* Makefile.am: Include scno.am.
($(strace_OBJECTS)): New rule.
2017-01-03 11:27:35 +00:00
cae1252903 Generate scno.h without invoking a generated executable helper
Generate scno.h using only those tools that are available for cross
build.  This allows to use scno.h during the build of strace itself.

* scno.am: New file.
* scno.head: New file.
* Makefile.am (EXTRA_DIST): Add it.
* tests/generate_scno.c: Remove.
* tests/.gitignore: Remove generate_scno.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(CLEANFILES): Remove scno.h.
(scno.h, $(scno_dependants)): Remove rules.
(scno_dependants): Remove.
($(objects)): New rule.
Include ../scno.am.
2017-01-01 20:59:11 +00:00
9eeb033ea6 Update all publicly shown copyright year number ranges
* COPYING: Update copyright year number range.
* configure.ac: Likewise.
* strace.c: Likewise.
* tests/strace-V.test: Use the current year for the check.
2017-01-01 11:33:40 +00:00
326b98927a defs.h: stop including <asm/unistd.h>
Limit the number of files where <asm/unistd.h> is included
to only those few that need it.

* defs.h: Do not include <asm/unistd.h>.
* clone.c: Include <asm/unistd.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2016-12-31 22:12:08 +00:00
4580f749b7 tests: do not use BUILT_SOURCES
* tests/Makefile.am (ksysent.$(OBJEXT)): New rule.
(BUILT_SOURCES): Remove.
2016-12-30 11:16:56 +00:00
c4cf9213a8 Fix cross build
This fixes cross build regression introduced by commit
v4.15-39-g605a705a63d533dceb3c2d489468fcd3aed3963c.

* tests/Makefile.am (BUILT_SOURCES): Remove scno.h
(objects, scno_dependants): New variables.
($(scno_dependants)): New rule.

Reported-by: Joakim Bech <joakim.bech@linaro.org>
2016-12-30 10:10:09 +00:00
b0b3f55b3b tests: do not use defs.h and syscall.h
* tests/generate_scno.c: Include "tests.h", "sysent.h", <stdio.h>,
<string.h>, and <asm/unistd.h> instead of "defs.h" and "syscall.h".
* tests/ksysent.c: Likewise.
* tests/nsyscalls.c: Include "tests.h", "sysent.h", <errno.h>,
<stdio.h>, and <unistd.h> instead of "defs.h" and "syscall.h".
2016-12-30 09:55:04 +00:00
ab7c67df8d Move definition of struct sysent and trace flags to a separate file
* sysent.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Include it.
(struct sysent, TRACE_FILE, TRACE_IPC, TRACE_NETWORK, TRACE_PROCESS,
TRACE_SIGNAL, TRACE_DESC, TRACE_MEMORY, SYSCALL_NEVER_FAILS,
STACKTRACE_INVALIDATE_CACHE, STACKTRACE_CAPTURE_ON_ENTER,
TRACE_INDIRECT_SUBCALL, COMPAT_SYSCALL_TYPES): Remove.
2016-12-30 09:45:10 +00:00
f73c5cfd75 Mpersify SIOC* ioctls
struct ifreq and struct ifconf are ABI-dependent and should have been
mpersified.

* defs.h (sock_ioctl): Remove prototype.
* sock.c (struct_ifconf, struct_ifreq): New typedefs.
(DEF_MPERS_TYPE(struct_ifconf), DEF_MPERS_TYPE(struct_ifreq),
MPERS_DEFS): New includes.
(print_ifreq, print_ifc_len, print_ifconf_ifreq): Replace struct ifreq
with struct_ifreq.
(decode_ifconf): Replace struct ifconf with struct_ifconf, struct ifreq
with struct_fireq.
(sock_ioctl): Wrap into MPERS_PRINTER_DECL.
2016-12-29 02:54:49 +00:00
2ca8e63ed0 sock: rewrite decode_ifconf
* sock.c (decode_ifconf): Rewrite.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-29 02:20:19 +00:00
8cc252e1fc xlat: update LOOP_* ioctl flags constants
* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_USE_AOPS
and LO_FLAGS_DIRECT_IO.
* xlat/loop_flags_options.in: Likewise.  Add default values
for constants.
2016-12-29 02:07:34 +00:00
a4ef4a796e loop: add fallback definitions for LOOP_* ioctl command constants
Since these are architecture-independent and have been added over the
kernel's lifetime, it makes sense to have these definitions in strace
itself.

* xlat/loop_cmds.in: New file.
* loop.c: Include "xlat/loop_cmds.h".
(loop_ioctl): Eliminate conditional compilation based on availability
of LOOP_* constant definitions.
2016-12-29 00:36:05 +00:00
6e0b6a6665 xlat: extend syntax
* xlat/gen.sh: Implement #stop directive that stops preprocessor
at the line it has been encountered during the first pass.  This could
be used, for example, to provide fallback definitions for constants
without defining xlat tables.
2016-12-29 00:30:26 +00:00
f0026a3818 loop: mpersify struct loop_info and loop_ioctl function
struct loop_info contains fields of type long, so it definitely should
have been mpersified.

* defs.h (loop_ioctl): Remove prototype.
* loop.c (struct_loop_info): New typedef.
Include DEF_MPERS_TYPE(struct_loop_info) and MPERS_DEFS.
(decode_loop_info): Replace struct loop_info with struct_loop_info.
Cast lo_inode, lo_init[0], and lo_init[1] to kernel_ulong_t and print
them using appropriate format specifiers.
(loop_ioctl): Wrap into MPERS_PRINTER_DECL.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-29 00:11:30 +00:00
52e3c75a1c loop: print lo_device and lo_rdevice fields using print_dev_t
* loop.c (decode_loop_info, decode_loop_info64): Use print_dev_t
for printing lo_device and lo_rdevice fields.
2016-12-29 00:11:30 +00:00
32e813144c Move device number printing code into a separate routine
* print_dev_t.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (print_dev_t): New prototype.
* dm.c: Do not include <sys/sysmacros.h>.
(dm_decode_device, dm_print_dev, dm_decode_dm_name_list): Use
print_dev_t function for printing device numbers.
* mknod.c: Do not include <sys/sysmacros.h>.
(decode_mknod): Use print_dev_t function for printing device number.
* print_struct_stat.c: Do not include <sys/sysmacros.h>.
(print_struct_stat): Use print_dev_t function for printing device
numbers.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-29 00:11:24 +00:00
54f2397c84 tests: enhance invalid address decoding check in seccomp-strict.test
* tests/seccomp-strict.c (main): Change the type of addr variable
containg the invalid address from unsigned long to kernel_ulong_t,
print it using %#llx format.
2016-12-28 22:33:38 +00:00
2add5258ec tests: check decoding of prctl PR_GET_TID_ADDRESS operation
* tests/prctl-tid_address.c: New file.
* tests/prctl-tid_address.test: New test.
* tests/.gitignore: Add prctl-tid_address.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-tid_address.test.
2016-12-28 22:18:36 +00:00
232d8c6c12 Update the publicly shown copyright information
Set the publicly shown copyright holder to "The strace developers.".

* COPYING: Update copyright information.
* configure.ac: Add AC_COPYRIGHT.
* strace.c (print_version): New function.
(init): Use it.
* tests/strace-V.test: Update expected output.
2016-12-28 18:33:46 +00:00
038222965a configure: specify project URL
* configure.ac (AC_INIT): Add URL.
2016-12-28 18:33:38 +00:00
a91068aec4 Document signal injection
* strace.1: Describe :signal=SIG option of the fault injection syntax.
* NEWS: Mention signal injection.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-28 18:33:38 +00:00
a864a32a76 Implement signal injection
This extends the fault injection capability with :signal=SIG option
which injects a signal on entering each syscall from the specified set.

:signal and :error options are complementary, if they are both specified
the syscall will be fault injected as usual and the specified signal
will be delivered to the tracee.

* defs.h (struct fault_opts): Change the type of err field to int16_t,
add signo field.
(trace_syscall): Add a pointer argument.
* qualify.c: Include "nsig.h".
(parse_fault_token): Handle signal= option.
(qualify_fault): Update default fault_opts.
* strace.c (trace): Forward signal number from trace_syscall
to ptrace_restart(PTRACE_SYSCALL).
* syscall.c (inject_syscall_fault_entering): Add pointer argument,
save there the signal number specified by fault options.  Do not inject
a syscall fault unless instructed by fault options.
(update_syscall_fault_exiting): Update the error code injection check.
(trace_syscall_entering): Add pointer argument, forward it to
inject_syscall_fault_entering.
(trace_syscall): Add pointer argument, forward it to
trace_syscall_entering.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-28 18:33:28 +00:00
22894ccff6 Update README.md
* README.md: Update homepage URL, mention command-line interface
and tampering capabilities in the description.
2016-12-28 11:39:00 +00:00
a7aed4a57d tests: robustify prctl-arg2-intptr.test
Robustify prctl-arg2-intptr.test against unrelated prctl invocations.

* tests/prctl-arg2-intptr.test: Filter out unrelated PR_GET_*
and PR_SET_* prctl calls.
2016-12-28 01:24:31 +00:00
277fec6316 signal: remove redundant checks around NSIG
* signal.c (struct old_sigaction, struct new_sigaction,
struct new_sigaction32): Remove safety checks for NSIG >= sizeof(long).
2016-12-27 23:49:06 +00:00
e9c702f9ad Introduce NSIG_BYTES
* nsig.h (NSIG_BYTES): New macro.
* desc.c: Use it in comments instead of NSIG.
* epoll.c: Likewise.
* poll.c: Likewise.
* signalfd.c: Likewise.
* signal.c: Likewise.
(sprintsigmask_n, print_sigset_addr_len_limit): Use it instead of NSIG.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
* tests/pselect6.c (main): Likewise.
2016-12-27 23:32:44 +00:00
5a25466437 Move NSIG ifdefery to a separate header file
* nsig.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c: Include "nsig.h" instead of <signal.h>, remove
NSIG workarounds.
* sigreturn.c: Likewise.
* syscall.c: Likewise.
* tests/pselect6.c: Likewise.
2016-12-27 23:18:21 +00:00
f91679316b Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro
* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
(truncate_klong_to_current_wordsize,
truncate_kulong_to_current_wordsize): Use it.
* mem.c (SYS_FUNC(old_mmap)): Likewise.
* util.c (umoven, umovestr, dumpiov_upto): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
2016-12-27 01:08:58 +00:00
835fb3c5f2 Simplify personality checks in msghdr.c and signal.c
* msghdr.c: Check for [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
* signal.c: Likewise.
2016-12-27 01:08:58 +00:00
19de67d239 Replace widen_to_long with truncate_klong_to_current_wordsize
* defs.h (widen_to_long): Remove.
(truncate_klong_to_current_wordsize): New static inline function.
* aio.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents): Use it
instead of widen_to_long.
* linux/sparc64/get_syscall_args.c (get_syscall_args): Update comment.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
2016-12-26 17:55:59 +00:00
885a97ec42 Replace widen_to_ulong with truncate_kulong_to_current_wordsize
* defs.h (widen_to_ulong): Remove.
(truncate_kulong_to_current_wordsize): New static inline function.
* io.c (do_preadv, do_pwritev): Use it instead of widen_to_ulong.
2016-12-26 17:47:55 +00:00
8990b601c2 Simplify print_lld_from_low_high_val ifdefery
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
[SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long
instead of zero_extend_signed_to_ull.
2016-12-26 17:06:12 +00:00
4e29ada846 Simplify getllval ifdefery
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* util.c (getllval): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
2016-12-26 16:54:31 +00:00
b5db9917f3 prctl: print pointer returned by PR_GET_TID_ADDRESS as kernel long
Since there is no compat handler for x32/n32, kernel returns kernel's
long as a result of the call.

Interesting, does any callee out there actually care to have enough room
allocated for kernel long?

* prctl.c (SYS_FUNC(prctl)): Use printnum_kptr instead of printnum_ptr
to print the value stored at address pointed by addr2 argument
of PR_GET_TID_ADDRESS operation.
2016-12-26 16:43:40 +00:00
c9000d43bd Add functions for printing pointers of kernel_ulong_t size
In cases where no compat for x32/n32 is implemented, pointer is of
kernel's long size, so it should be printed appropriately.

* defs.h [!current_klongsize] (printnum_addr_klong_int): New prototype.
(printnum_kptr): New macro.
* util.c [!current_klongsize] (printnum_addr_klong_int): New function.
2016-12-26 15:32:48 +00:00
3b4612b3ac Print indirect pointers as pointers
Originally, printnum_long_int was used, but it prints NULL incorrectly.

* defs.h (DECL_PRINTNUM_ADDR): New macro.
(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
[!current_wordsize] (printnum_addr_long_int): New prototype.
[!current_wordsize] (printnum_ptr): Use it.
[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
* util.c (DEF_PRINTNUM_ADDR): New macro.
(DEF_PRINTNUM_ADDR(int, unsigned int),
DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
provide printnum_addr_int and printnum_addr_int64, accordingly.
[!current_wordsize] (printnum_addr_long_int): New function.
* xet_robust_list.c (sprintaddr): New function.
(main): Use it, update expected output.
* tests/ipc_sem.c (main): Update expected output.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-26 15:29:06 +00:00
762b155643 ipc_sem: print 4th argument of semctl syscall as an address
* ipc_sem.c (SYS_FUNC(semctl)): Print 4th argument using printaddr.
* tests/ipc_sem.c (cleanup): Update expected output.
2016-12-26 15:05:41 +00:00
3fb2f299d2 Do not define printnum_long_int on systems with constant current_wordsize
* defs.h: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to select
definitions of printnum_slong, printnum_ulong, and printnum_ptr.
* util.c: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to decide
whether to compile printnum_long_int.
2016-12-26 13:50:14 +00:00
825acc827e umoven: detect invalid addresses
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.

* util.c (umoven): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umoven-illptr.c: New file.
* tests/umoven-illptr.test: New test.
* tests/.gitignore: Add umoven-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umoven-illptr.test.
2016-12-26 13:18:00 +00:00
ac300dd2d9 umovestr: detect invalid addresses
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.

* util.c (umovestr): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umovestr-illptr.c: New file.
* tests/umovestr-illptr.test: New test.
* tests/.gitignore: Add umovestr-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr-illptr.test.
2016-12-26 12:16:38 +00:00
5477470e9c lseek: simplify _llseek syscall decoder
After transition from long to kernel_ulong_t the implementation
could be made a bit simpler.

* lseek.c (SYS_FUNC(llseek)): Use direct cast to long long instead
of zero_extend_signed_to_ull.
2016-12-26 11:19:18 +00:00
b6351bc2ce lseek: merge two different implementations of lseek syscall decoder
After transition from long to kernel_ulong_t there are no mo
complications that required to keep a separate implementation
for x32 and mips n32.

* lseek.c (SYS_FUNC(lseek)): Merge two different implementations
into a single one.
2016-12-26 11:10:41 +00:00
a1e94e9c7a Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval
After transition from long to kernel_ulong_t these fields
are no longer needed.

* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
(RVAL_MASK): Update.
* io.c (print_lld_from_low_high_val): Check
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
Use u_arg instead of ext_arg.
* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
Remove.
[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
* linux/x86_64/get_error.c (get_error) [X32]: Remove.
* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
instead of ext_arg.  Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
to print_mmap.
* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
of RVAL_LUDECIMAL.
* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].  Use u_arg instead of ext_arg.
2016-12-26 10:43:35 +00:00
50b50e78f6 Remove getarg_klu
After transition from long to kernel_ulong_t we no longer need
tcp->ext_arg, and therefore a function to access it is also no longer
needed.

* defs.h (getarg_klu): Remove prototype.
* util.c (getarg_klu): Remove.
(printargs): Access tcp->u_arg directly
* bjm.c (SYS_FUNC(init_module)): Likewise.
* clone.c (SYS_FUNC(unshare)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Likewise.
* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mem.c (do_mprotect): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Likewise.
2016-12-26 10:43:35 +00:00
8aab60e8d3 Remove printaddr_klu
After transition from long to kernel_ulong_t we no longer need
two versions of printaddr function.

* defs.h (printaddr): Remove.
(printaddr_klu): Rename to printaddr.
* util.c (printaddr_klu): Likewise.
* bjm.c (SYS_FUNC(init_module)): Replace printaddr_klu with printaddr.
* mem.c (do_mprotect): Likewise.
2016-12-26 10:43:35 +00:00
a2c0cbc0d6 tests: check decoding of a subset of prctl operations
Check decoding of prctl operations that take the second syscall argument
as a pointer to an integer.

* tests/prctl-arg2-intptr.c: New file.
* tests/prctl-arg2-intptr.test: New test.
* tests/.gitignore: Add prctl-arg2-intptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-arg2-intptr.test.
2016-12-26 10:43:34 +00:00
89636759d7 Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.

Automatically replace PRI_kr[dux] with PRI_kl[dux] using
$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'

* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.
2016-12-26 10:43:34 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
e625443bb5 Redirect kernel_ureg_t and kernel_scno_t from unsigned long to kernel_ulong_t
* defs.h (struct tcb): Change u_rval type from long to kernel_long_t.
(PRI_krd, PRI_kru, PRI_krx): Redirect to PRI_kld, PRI_klu, and PRI_klx.
* kernel_types.h (kernel_scno_t, kernel_ureg_t): Redirect
to kernel_ulong_t.
2016-12-26 10:43:34 +00:00
1d5bb61c49 Print kernel_ureg_t and kernel_scno_t using dedicated format strings
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.

* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 10:43:04 +00:00
11aa97bfba vm_read_mem: detect address truncation
When sizeof(kernel_ureg_t) > sizeof(long), the tracee address passed
to vm_read_mem could be silently truncated.  Detect this situation
and return EIO when the tracee address does not fit into unsigned long.

* util.c (vm_read_mem): Save raddr argument into a temporary variable
truncated_raddr of type unsigned long.  Set errno to EIO and return -1
when truncated_raddr does not equal to raddr.
2016-12-26 10:08:53 +00:00
9cd050573c trace_syscall_exiting: prepare personality check for u_rval type change
* syscall.c (trace_syscall_exiting): Check for sizeof(tcp->u_rval)
instead of sizeof(long) when deciding how to print tcp->u_rval.
2016-12-26 10:08:53 +00:00
9050affe7c Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
Direct casts to kernel_ureg_t will not work after the change
of kernel_ureg_t from unsigned long to kernel_ulong_t.

* defs.h (ptr_to_kulong): New macro.
* block.c (print_blkpg_req): Use it instead of explicit casts
to kernel_ureg_t.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
* sigaltstack.c (print_stack_t): Likewise.
* sock.c (decode_ifconf): Likewise.
* sysctl.c (SYS_FUNC(sysctl)): Likewise.
* util.c (dumpiov_upto): Likewise.
* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
print_v4l2_ext_controls): Likewise.
2016-12-26 01:59:08 +00:00
9cbb1861ec umove*: remove redundant casts
* util.c (umoven, umovestr): Remove casts from unsigned long to pointer.
2016-12-26 01:29:35 +00:00
248f17d57f upoke: remove redundant casts
* upoke.c (upoke): Remove casts from unsigned long to pointer.
2016-12-26 01:29:35 +00:00
79cef3f3ff signal: cleanup decoding of sa_handler and sa_restorer
Change type of sa_handler and sa_restorer fields from function pointers
to unsigned long.  This saves the code from a lot of casts between
pointers and integers.

Rename __sa_handler to sa_handler__ as names starting with underscore
symbol are reserved and should not be used.

* signal.c (old_sigaction): Rename __sa_handler to sa_handler__,
all users updated.  Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(old_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_old_sigaction): Remove now redundant casts from
old_sigaction32.sa_handler__ to old_sigaction.sa_handler__,
from old_sigaction32.sa_restorer to old_sigaction.sa_restorer,
and from old_sigaction.sa_handler__ to unsigned long.  Print
old_sigaction.sa_restorer using printaddr.
* signal.c (new_sigaction): Rename __sa_handler to sa_handler__,
all users updated.  Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(new_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_new_sigaction): Remove now redundant casts from
new_sigaction32.sa_handler__ to new_sigaction.sa_handler__,
from new_sigaction32.sa_restorer to new_sigaction.sa_restorer,
and from new_sigaction.sa_handler__ to unsigned long.  Print
new_sigaction.sa_restorer using printaddr.
2016-12-25 23:24:08 +00:00
b2d117f249 signal: change signal handler address type from unsigned long to kernel_ureg_t
* signal.c (get_sa_handler_str, print_sa_handler): Change handler type
from unsigned long to kernel_ureg_t.
2016-12-25 23:21:22 +00:00
b816b59203 quota: change address argument type from unsigned long to kernel_ureg_t
* quota.c (decode_cmd_data): Change the type of data argument
from unsigned long to kernel_ureg_t.
2016-12-25 22:56:21 +00:00
7e5cd0e72b execve: prepare for handling big pointers
* execve.c (printargv): Change cp.p64 type from unsigned long
to kernel_ulong_t so it could handle wordsize > sizeof(long) properly.
2016-12-25 22:27:33 +00:00
276839aec6 clone: print clone flags without truncation
The flags argument is defined in kernel as unsigned long,
so change its decoding to avoid truncation.

* clone.c (SYS_FUNC(clone)): Change flags type from unsigned long
to kernel_ureg_t, print it using printflags64 instead of printflags.
2016-12-25 22:17:38 +00:00
d69c27760c Use printxval64 instead of printxval_long
After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
to stop using printxval_long proxy and pass syscall arguments directly
to printxval64.

* defs.h (printxval_long): Remove.
* fcntl.c (print_fcntl): Replace printxval_long with printxval64.
* mtd.c (mtd_ioctl): Likewise.
* numa.c (SYS_FUNC(mbind)): Likewise.
* or1k_atomic.c [OR1K] (SYS_FUNC(or1k_atomic)): Likewise.
* sysmips.c [MIPS] (SYS_FUNC(sysmips)): Likewise.
* term.c (term_ioctl): Likewise.
2016-12-25 21:59:59 +00:00
9f8b29f1cd Use printflags64 instead of printflags_long
After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
to stop using printflags_long proxy and pass syscall arguments directly
to printflags64.

* defs.h (printflags_long): Remove.
* fcntl.c (print_fcntl): Replace printflags_long with printflags64.
* numa.c (SYS_FUNC(get_mempolicy)): Likewise.
* perf.c (SYS_FUNC(perf_event_open)): Likewise.
* sram_alloc.c [BFIN] (SYS_FUNC(sram_alloc)): Likewise.
2016-12-25 21:55:01 +00:00
0eda4a0a4b upeek, upoke: change argument types from long to unsigned long
* defs.h (upeek, upoke): Change offset argument type from long
to unsigned long.  Change res argument type from long to kernel_ureg_t.
* upeek.c (upeek): Likewise.
* upoke.c (upoke.c): Likewise.
* syscall.c (print_pc) [ARCH_PC_PEEK_ADDR]: Change pc type from long
to kernel_ureg_t.
* linux/aarch64/arch_regs.c (arm_sp_ptr): Remove redundant cast.
* linux/metag/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/sh64/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/powerpc/getregs_old.c (getregs_old): Remove redundant casts.
* linux/alpha/arch_getrval2.c (getrval2): Change r20 type from long
to unsigned long.
* linux/alpha/arch_regs.c (alpha_r0, alpha_a3): Change type from long
to unsigned long.
* linux/bfin/arch_regs.c (bfin_r0): Likewise.
* linux/crisv10/arch_regs.c (cris_r10): Likewise.
* linux/hppa/arch_regs.c (hppa_r28): Likewise.
* linux/ia64/arch_regs.c (IA64_PSR_IS): Likewise.
* linux/microblaze/arch_regs.c (microblaze_r3): Likewise.
* linux/sh/arch_regs.c (sh_r0): Likewise.
* linux/sh64/arch_regs.c (sh64_r9): Likewise.
* linux/xtensa/arch_regs.c (xtensa_a2): Likewise.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Change addr type
from long to unsigned long.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/alpha/get_scno.c (arch_get_scno): Update for the change
of signedness.
* linux/arc/get_syscall_args.c (get_syscall_args): Change arc_args type
from pointer to long to pointer to unsigned long.
* linux/arm/arch_regs.c (arm_sp_ptr): Change type from pointer to long
to pointer to unsigned long.
* linux/arm/arch_regs.h (arm_sp_ptr): Likewise.
* linux/i386/arch_regs.c (i386_esp_ptr): Likewise.
* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
* linux/m68k/arch_regs.c (m68k_usp_ptr): Likewise.
* linux/m68k/arch_regs.h (m68k_usp_ptr): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Use umove
instead of umoven.
* linux/sh/arch_getrval2.c (getrval2): Change val type from long
to unsigned long.
2016-12-25 20:14:12 +00:00
44cb9c8356 arch_sigreturn: change tracee address type from long to unsigned long
* linux/arm/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to unsigned long.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Change the type
of addr and regs variables from long to unsigned long.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to kernel_ureg_t.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Change the type
of offset and addr variables from long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
7372d4a900 kexec: change flags type from unsigned long to kernel_ureg_t
* kexec.c (SYS_FUNC(kexec_load)): Change n variable type
from unsigned long to kernel_ureg_t.  Use printxval64 instead
of printxval_long.  Use printflags64 instead of printflags_long.
2016-12-25 11:32:46 +00:00
bbb1fa0c5f kexec: change types of pointers and sizes to kernel_ureg_t
* kexec.c (print_seg): Change the type of *seg and seg_buf variables
from unsigned long to kernel_ureg_t.
(print_kexec_segments): Change len argument type from unsigned long
to kernel_ureg_t.  Change seg variable type from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
94f801f14d printsiginfo: change len argument type from unsigned long to kernel_ureg_t
* printsiginfo.c (print_siginfo_array): Change len argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
6666c28424 signal: change address argument type from unsigned long to kernel_ureg_t
* signal.c (print_sigqueueinfo): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
53ec9ab555 statfs64: change size argument type from unsigned long to kernel_ureg_t
* defs.h (print_struct_statfs64): Change size argument type
from unsigned long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs64): Likewise.
* fstatfs64.c (SYS_FUNC(fstatfs64)): Pass size argument directly
to print_struct_statfs64.
* statfs64.c (SYS_FUNC(statfs64)): Likewise.
2016-12-25 11:32:46 +00:00
db28c91159 Cast tcp->u_rval to kernel_ureg_t instead of unsigned long
* fcntl.c (print_fcntl): Cast tcp->u_rval to kernel_ureg_t instead
of unsigned long.
* membarrier.c (SYS_FUNC(membarrier)): Likewise.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
* time.c (do_adjtimex): Likewise.
2016-12-25 11:32:46 +00:00
26102a5a87 decode_sockbuf: change addrlen argument type from long to kernel_ureg_t
* net.c (decode_sockbuf): Change addrlen argument type from long
to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
b19829eaf4 netlink: change size types from unsigned long to kernel_ureg_t
* defs.h (decode_netlink): Change len argument type from unsigned long
to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr): Likewise.
(decode_nlmsghdr_with_payload): Likewise.  Change nlmsg_len variable
type from unsigned long to unsigned int.
(decode_netlink): Change the type of len argument and next_len variable
from unsigned long to kernel_ureg_t.  Change nlmsg_len variable type
from unsigned long to unsigned int.
2016-12-25 11:32:46 +00:00
4ee3e80cb1 ipc_msg: change size types from unsigned long to kernel_ureg_t
* ipc_msg.c (tprint_msgsnd): Change count argument type
from unsigned long to kernel_ureg_t.  Change flags argument type
from unsigned long to unsigned int.
(tprint_msgrcv): Change the type of count and msgtyp arguments
from unsigned long to kernel_ureg_t.
(fetch_msgrcv_args): Change *pair type from unsigned long
to kernel_ureg_t.
(SYS_FUNC(msgrcv)): Change pair type from unsigned long
to kernel_ureg_t.
* print_msgbuf.c (tprint_msgbuf): Change count argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
0601cf5939 dumpiov_upto: change size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_upto): Change data_size argument type
from unsigned long to kernel_ureg_t.
* util.c (dumpiov_upto): Change the type of data_size argument
and iov_len variable from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
27cc81d61f msghdr: change cmsghdr size types from size_t to unsigned int
As the kernel does not accept control messages longer than the value
of int sysctl_optmem_max kernel variable exported as
/proc/sys/net/core/optmem_max, we do not print them either.

Since unsigned int has enough room to contain any valid control message
size, change all internal cmsghdr size types from size_t
to unsigned int.

* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_uint8_t,
print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr,
cmsg_printer, print_cmsg_type_data): Change data_len argument type
from size_t to unsigned int.
(cmsg_socket_printers): Change min_len type from size_t to unsigned int.
(decode_msg_control): Change the type of in_control_len argument,
cmsg_len, and len variables from size_t to kernel_ureg_t.
Change the type of cmsg_size, control_len, and buf_len variables
from size_t to unsigned int.
2016-12-25 11:32:45 +00:00
121e148978 msghdr: change register based size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
* msghdr.h (print_struct_msghdr): Likewise.
* msghdr.c (print_struct_msghdr): Likewise.  Cast msghdr.msg_iovlen
and msghdr.msg_controllen to kernel_ureg_t instead of unsigned long.
(decode_msghdr, dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(sendmsg)): Pass -1 instead of -1UL as data_size argument
to decode_msghdr.
* mmsghdr.c (print_struct_mmsghdr): Pass (kernel_ureg_t) -1 instead
of -1UL as data_size argument to print_struct_msghdr.
(dumpiov_in_mmsghdr): Cast msghdr.msg_iovlen to kernel_ureg_t instead
of unsigned long.
* syscall.c (dumpio): Pass -1 instead of -1UL as data_size argument
to dumpiov_in_msghdr
2016-12-25 11:32:45 +00:00
1049a1dae9 mq: remove redundant u_rval check
* mq.c (SYS_FUNC(mq_timedreceive)): Do not check for tcp->u_rval < 0,
syserror(tcp) is enough, and printstrn can handle len < 0 anyway.
2016-12-25 11:32:45 +00:00
3ccde53d7f io: change size types from unsigned long to kernel_ureg_t
* defs.h (tprint_iov_upto): Change the type of len and data_size
arguments from unsigned long to kernel_ureg_t.
(tprint_iov): Change the type of len argument from unsigned long
to kernel_ureg_t.
* io.c (print_iovec_config): Change data_size type from unsigned long
to kernel_ureg_t.
(print_iovec): Change the type of *iov, iov_buf, and len variables
from unsigned long to kernel_ureg_t.
(tprint_iov_upto): Change the type of len and data_size arguments, and
the type of iov variable from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
570314dd90 mount: change flags type from unsigned long to kernel_ureg_t
* mount.c (SYS_FUNC(mount)): Change the type of flags from unsigned long
to kernel_ureg_t, use printflags64 instead of printflags_long
to print it.
2016-12-25 11:32:45 +00:00
697ca3e41f mem: change mmap arguments type from unsigned long to kernel_ureg_t
* mem.c (print_mmap): Change the type of len, prot, and flags
from unsigned long to kernel_ureg_t.  Use printflags64 instead
of printflags_long.  Use printxval64 instead of printxval_long.
(SYS_FUNC(old_mmap)): Check for current_klongsize instead
of [AARCH64 || X86_64] to take X32 into account.
(SYS_FUNC(mremap)): Use printflags64 instead of printflags_long.
(SYS_FUNC(remap_file_pages)): Change the type of size, prot, pgoff, and
flags from unsigned long to kernel_ureg_t.  Use printflags64 instead
of printflags_long.  Use printxval64 instead of printxval_long.
[POWERPC] (SYS_FUNC(subpage_prot)): Change the type of len and nmemb
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
f8b6389263 numa: change size arguments type from unsigned long to kernel_ureg_t
* numa.c (print_node, print_addr): Add kernel_ureg_t support.
(print_nodemask): Change type of maxnodes argument from unsigned long
to kernel_ureg_t.
(SYS_FUNC(move_pages)): Change npages type from unsigned long
to kernel_ureg_t.  Change buf type from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
a8bf674039 print_sigset_addr_len: change len argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len): Change len argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.
2016-12-25 11:32:45 +00:00
569dc792d5 process_vm: change size arguments type from unsigned long to kernel_ureg_t
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change the type of local_iovcnt,
remote_iovcnt, and flags from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
00785bf73a printstr*: change len argument type from long to kernel_ureg_t
* defs.h (printstr_ex, printstrn): Change len argument type from long
to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
2016-12-25 11:32:45 +00:00
9ec1fb02ef xattr: change size arguments type from unsigned long to kernel_ureg_t
* xattr.c (print_xattr_val): Change type of insize and size arguments
from unsigned long to kernel_ureg_t.
(print_xattr_list): Change type of size argument from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
a3c2e4e20b printstr_ex: fix decoding of non-NUL-terminated strings when len == -1
Do not treat len == -1 in any special way.  All users who need the
string to be handled as a NUL-terminated string set QUOTE_0_TERMINATED
bit in user_style flags already.

* util.c (printstr_ex): Remove (len == -1) check.
* tests/printstr.c: New file.
* tests/printstr.test: New test.
* tests/.gitignore: Add printstr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add printstr.test.
2016-12-25 11:32:45 +00:00
9af28a4d13 Fix decoding of sethostname syscall
The second argument of sethostname syscall is not an unsigned long but
unsigned int.  The kernel does not look at the string argument when
the length argument is too long.

* hostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(SYS_FUNC(sethostname)): Treat the second argument as unsigned int.
Print the first argument as a pointer when the second argument exceeds
__NEW_UTS_LEN.
* tests/sethostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(main): Use it.  Check that the second argument of sethostname
is handled as unsigned int.  Check that the first argument is printed
as a pointer when the second argument exceeds __NEW_UTS_LEN.
2016-12-25 11:32:45 +00:00
bd43e0954b tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h
* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
(f8ill_ptr_to_kulong): New static inline function.
2016-12-25 11:32:45 +00:00
a940d1a60f printstr: rename to printstrn, add printstr as a thin wrapper
As about half of all printstr uses cases are invocations with the last
argument set to -1, create a dedicated function for this use case.

* defs.h (printstr): Rename to printstrn.  All callers updated.
(printstr): New static inline function.  All callers updated.
2016-12-25 11:32:45 +00:00
1cb75579e1 process: change ptrace arguments type from unsigned long to kernel_ureg_t
(SYS_FUNC(ptrace)): Change type of request and data arguments
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
50cba466e5 process: change tracee address type from unsigned long to kernel_ureg_t
* process.c (print_user_offset_addr): Change address argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(ptrace)): Change addr variable type from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
405279fa77 net: change address argument type from long to kernel_ureg_t
* net.c (decode_sockbuf, decode_pair_fd, print_linger, print_ucred,
print_tpacket_stats, print_icmp_filter, print_getsockopt, print_mreq,
print_mreq6, print_group_req, print_tpacket_req, print_packet_mreq,
print_setsockopt): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
aff8528b22 print_mq_attr: change address argument type from long to kernel_ureg_t
* print_mq_attr.c (printmqattr): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
91b63a91ae ipc_*: change address argument type from long to kernel_ureg_t
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv, fetch_msgrcv_args): Change
address argument type from long to kernel_ureg_t.
* ipc_msgctl.c (print_msqid_ds): Likewise.
* ipc_sem.c (tprint_sembuf_array): Likewise.
* ipc_shmctl.c (print_shmid_ds): Likewise.
2016-12-25 11:32:45 +00:00
fdcaa2fa42 print_msgbuf: change address argument type from long to kernel_ureg_t
* print_msgbuf.c (tprint_msgbuf): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
d4e4e873ee desc: change tracee address type from long to kernel_ureg_t
* desc.c (decode_select): Rename arg to addr, change its type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
fae76db73b uid: change address argument type from long to kernel_ureg_t
* uid.c (get_print_uid): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
93e2dfe0e5 time: change address argument type from long to kernel_ureg_t
* time.c (print_timezone, do_adjtimex): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
4f486f8207 sched: change address argument type from long to kernel_ureg_t
* sched.c (print_sched_attr): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
1575c3115a printsiginfo: change address argument type from long to kernel_ureg_t
* printsiginfo.c (printsiginfo_at): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
38392acb35 print_timex: change address argument type from long to kernel_ureg_t
* print_timex.c (print_timex): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7f83dba279 print_sigevent: change address argument type from long to kernel_ureg_t
* print_sigevent.c (print_sigevent): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
1c3c1ae44e poll: change address argument type from long to kernel_ureg_t
* poll.c (decode_poll_exiting): Change tracee address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
3f8d42d94f printrusage*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (printrusage32): Change address argument type
from long to kernel_ureg_t.
* printrusage.c (printrusage): Likewise.
[ALPHA] (printrusage32): Likewise.
* wait.c (printwaitn): Change the type of tracee address argument
of print_rusage from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
61b2e2199f print_time*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (sprint_timeval32, print_timeval32,
print_timeval32_pair, print_itimerval32): Change address argument type
from long to kernel_ureg_t.
* desc.c (decode_select): Change the type of tracee address argument
of print_tv_ts and sprint_tv_ts from long to kernel_ureg_t.
* print_timespec.c (print_timespec, sprint_timespec,
print_timespec_utime_pair, print_itimerspec): Change address argument
type from long to kernel_ureg_t.
* print_timeval.c (print_timeval, print_timeval_pair, sprint_timeval,
print_itimerval, print_timeval32, print_timeval32_pair,
print_itimerval32, sprint_timeval32): Likewise.
2016-12-25 11:32:44 +00:00
033c9cfc13 rtc: change type of ioctl 3rd argument from long to kernel_ureg_t
* rtc.c (decode_rtc_time, decode_rtc_wkalrm, decode_rtc_pll_info):
Change addr type from long to kernel_ureg_t.
(rtc_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
16300524f2 mtd: change type of ioctl 3rd argument from long to kernel_ureg_t
* mtd.c (decode_erase_info_user, decode_erase_info_user64,
decode_mtd_oob_buf, decode_mtd_oob_buf64, decode_otp_info,
decode_otp_select, decode_mtd_write_req, decode_mtd_info_user,
decode_nand_oobinfo, decode_nand_ecclayout_user, decode_mtd_ecc_stats):
Change addr type from long to kernel_ureg_t.
(mtd_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
e86ff37e3f hdio: change type of ioctl 3rd argument from long to kernel_ureg_t
* hdio.c (hdio_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
66834ea9a7 v4l2: change type of ioctl 3rd argument from long to kernel_ureg_t
* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc, print_v4l2_format,
print_v4l2_requestbuffers, print_v4l2_buffer, print_v4l2_framebuffer,
print_v4l2_buf_type, print_v4l2_streamparm, print_v4l2_standard,
print_v4l2_input, print_v4l2_control, print_v4l2_queryctrl,
print_v4l2_cropcap, print_v4l2_crop, print_v4l2_ext_controls,
print_v4l2_frmsizeenum, print_v4l2_frmivalenum,
print_v4l2_create_buffers, v4l2_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7f1742631f evdev: change type of ioctl 3rd argument from long to kernel_ureg_t
* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7ac5286986 btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t
* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
c322fba197 block: change type of ioctl 3rd argument from long to kernel_ureg_t
* block.c (block_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
10350d5eb0 Change type of ioctl 3rd argument from long to kernel_ureg_t
* defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t.
* dm.c (dm_known_ioctl, dm_ioctl): Likewise.
* file_ioctl.c (file_ioctl): Likewise.
* fs_x_ioctl.c (fs_x_ioctl): Likewise.
* ioctl.c (ioctl_decode): Likewise.
* loop.c (decode_loop_info, decode_loop_info64): Change addr type
from long to kernel_ureg_t.
(loop_ioctl): Change arg type from long to kernel_ureg_t.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res, scsi_ioctl): Likewise.
* sock.c (print_ifreq, sock_ioctl): Likewise.
(decode_ifconf): Change addr type from long to kernel_ureg_t.
* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Likewise.
(term_ioctl): Change arg type from long to kernel_ureg_t.
* ubi.c (ubi_ioctl): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.
2016-12-25 11:32:44 +00:00
98f8b95b0f ldt: change address argument type from long to kernel_ureg_t
* defs.h [HAVE_STRUCT_USER_DESC] (print_user_desc): Change address
argument type from long to kernel_ureg_t.
* ldt.c [HAVE_STRUCT_USER_DESC] (print_user_desc): Likewise.
2016-12-25 11:32:44 +00:00
1007f7a276 fcntl: change address argument type from long to kernel_ureg_t
* fcntl.c (printflock64, printflock, print_f_owner_ex): Change
address argument type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
ef54d3d838 execve: change address argument type from long to kernel_ureg_t
* execve.c (printargv, printargc): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
96512c4d78 dirent: change address argument type from long to kernel_ureg_t
* dirent.c (print_old_dirent): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
c96d9f17b1 bpf: change address argument type from long to kernel_ureg_t
* bpf.c (bpf_map_create, bpf_map_update_elem, bpf_map_delete_elem,
bpf_map_io, bpf_prog_load, SYS_FUNC(bpf)): Change address argument
type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
cdf05fb392 dump*: change address argument type from long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
Change address argument type from long to kernel_ureg_t.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
Likewise.
* util.c (dumpiov_upto, dumpstr): Likewise.
2016-12-25 11:32:44 +00:00
0aa9cf807e print_sigset_addr_len: change address argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len) Change address argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
decode_old_sigaction, decode_new_sigaction): Likewise.
2016-12-25 11:32:44 +00:00
3106adf4af decode_sockaddr: change address argument type from long to kernel_ureg_t
* defs.h (decode_sockaddr) Change tracee address argument type from long
to kernel_ureg_t.
* sockaddr.c (decode_sockaddr): Likewise.
2016-12-25 11:32:43 +00:00
4e80a2087d print_struct_statfs*: change address argument type from long to kernel_ureg_t
* defs.h (print_struct_statfs, print_struct_statfs64): Change address
argument type from long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs, print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs, fetch_struct_statfs64):
Likewise.
2016-12-25 11:32:43 +00:00
ce27e2acf4 fetch_struct_flock: change address argument type from long to kernel_ureg_t
* fetch_struct_flock.c (fetch_struct_flock, fetch_struct_flock64):
Change address argument type from long to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
0544f49daf fetch_seccomp_fprog: change address argument type from long to kernel_ureg_t
* fetch_seccomp_fprog.c (fetch_seccomp_fprog): Change address argument
type from long to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
bf20786de2 printnum_*, printpair_*: change address argument type from long to kernel_ureg_t
* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR, printnum_long_int): Change
address argument type from long to kernel_ureg_t.
* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
2016-12-25 11:32:43 +00:00
78b02c928a printpath*: change address argument type from long to kernel_ureg_t
* defs.h (printpath, printpathn): Change address argument type
from long to kernel_ureg_t.
* util.c (printpath, printpathn): Likewise.
2016-12-25 11:32:43 +00:00
5e4019c3bc printstr*: change address argument type from long to kernel_ureg_t
* defs.h (printstr_ex, printstr_ex): Change address argument type
from long to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
2016-12-25 11:32:43 +00:00
956e3a34a3 umove*: change tracee address argument type from long to kernel_ureg_t
* defs.h (umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* desc.c (umove_kulong_array_or_printaddr): Change tracee address
argument type from long to kernel_ureg_t.
* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise.
2016-12-25 11:32:43 +00:00
daa81a8612 futex: change address type from long to kernel_ureg_t
* futex.c (SYS_FUNC(futex)): Change address type from long
to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
cce907a428 file_handle: change address type from long to kernel_ureg_t
* file_handle.c (SYS_FUNC(name_to_handle_at),
SYS_FUNC(open_by_handle_at)): Change address type from long
to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
fc543e0637 printsiginfo: cast pointers to kernel_ureg_t instead of unsigned long
* printsiginfo.c (printsigval): Cast siginfo.si_ptr pointer
to kernel_ureg_t instead of unsigned long.
(print_si_info): Cast siginfo.si_addr and siginfo.si_call_addr pointers
to kernel_ureg_t instead of unsigned long.
2016-12-25 11:32:43 +00:00
3b213e9074 sigaltstack: cast pointers and sizes to kernel_ureg_t instead of unsigned long
* sigaltstack.c (print_stack_t): Cast sigaltstack.ss_sp pointer
and sigaltstack.ss_size to kernel_ureg_t instead of unsigned long.
2016-12-25 11:32:43 +00:00
e0c3675c37 v4l2: cast pointers to kernel_ureg_t instead of long
* v4l2.c (print_v4l2_ext_control): Cast v4l2_ext_control.string pointer
to kernel_ureg_t instead of long.
2016-12-25 02:19:17 +00:00
1b7b6b9002 v4l2: cast pointers to kernel_ureg_t instead of unsigned long
* v4l2.c (print_v4l2_buffer): Remove redundant cast.
(print_v4l2_framebuffer): Cast v4l2_framebuffer.base pointer
to kernel_ureg_t instead of unsigned long.
(print_v4l2_ext_controls): Cast v4l2_ext_controls.controls pointer
to kernel_ureg_t instead of unsigned long.
2016-12-25 02:19:17 +00:00
17ec19d2a9 sysctl: cast pointers to kernel_ureg_t instead of size_t
* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldval and
__sysctl_args.newval pointers to kernel_ureg_t instead of size_t.
2016-12-24 14:58:42 +00:00
a8631ca4bc sysctl: cast pointers to kernel_ureg_t instead of long
* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldlenp pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:42 +00:00
4d5523527b block: cast pointers to kernel_ureg_t instead of long
* block.c (print_blkpg_req): Cast blkpg_ioctl_arg.data pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:42 +00:00
23cbf90c18 dumpiov_upto: cast pointers to kernel_ureg_t instead of long
* util.c  (dumpiov_upto): Cast iovec.iov_base pointer to kernel_ureg_t
instead of long.
2016-12-24 14:58:42 +00:00
aa350a2b97 msghdr: cast pointers to kernel_ureg_t instead of long
* msghdr.c (print_struct_msghdr): Cast msghdr.msg_name pointer
to kernel_ureg_t instead of long.
(dumpiov_in_msghdr): Cast msghdr.msg_iov pointer to kernel_ureg_t
instead of long.
2016-12-24 14:58:41 +00:00
4d9a785bfd mmsghdr: cast pointers to kernel_ureg_t instead of long
* mmsghdr.c (dumpiov_in_mmsghdr): Cast msghdr.msg_iov pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:41 +00:00
857398e779 Remove redundant casts of ptrace arguments
* strace.c (maybe_switch_tcbs, trace): Do not cast ptrace 4th argument
from pointer to long type.
2016-12-24 14:58:41 +00:00
0868093228 ptrace_restart: cleanup
* strace.c (ptrace_restart): Replace the sequence of "if" statements
with a "switch" statement.
2016-12-24 14:58:39 +00:00
5691f4e23a ptrace_restart: change types of integer arguments to unsigned
* strace.c (ptrace_restart): Change types of "op" and "sig"
from int to unsigned int.
2016-12-24 14:58:29 +00:00
5ff0633279 process: remove redundant syserror checks
* process.c (SYS_FUNC(ptrace)): Remove syserror checks as both
print_siginfo_array and print_seccomp_fprog do the right thing
by using umoven_or_printaddr.
2016-12-24 14:58:29 +00:00
2808523085 sparc64: remove redundant casts
* linux/sparc64/get_syscall_args.c (get_syscall_args): Remove
redundant casts from uint32_t to long.
2016-12-24 14:58:29 +00:00
ef0d6e4699 numa: change address argument type from unsigned long to kernel_ureg_t
* numa.c (print_nodemask): Change address argument type from
unsigned long to kernel_ureg_t.
2016-12-23 22:24:23 +00:00
d7f98585ef net: change address argument type from unsigned long to kernel_ureg_t
* net.c (fetch_socklen): Change address argument type from
unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
657ab73f3a mem: change tracee address type from unsigned long to kernel_ureg_t
* mem.c (print_mmap, SYS_FUNC(remap_file_pages),
SYS_FUNC(subpage_prot)): Change the type of variables containing tracee
addresses from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
aa5e08eac5 kexec: change address argument type from unsigned long to kernel_ureg_t
* kexec.c (print_kexec_segments): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
b89258dcdd poll: change counter type from unsigned long to unsigned int
* poll.c (decode_poll_exiting): Change the type of printed and
max_printed counters from unsigned long to unsigned int.
2016-12-23 19:26:58 +00:00
8dbcedef30 xattr: change address argument type from unsigned long to kernel_ureg_t
* xattr.c (print_xattr_val, print_xattr_list): Change address
argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
6f3abb076c uid: change address argument type from unsigned long to kernel_ureg_t
* uid.c (print_groups): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
c9e380bb6c stat64: change address argument type from unsigned long to kernel_ureg_t
* stat64.c (decode_struct_stat64): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
6f6d3e4c60 stat: change address argument type from unsigned long to kernel_ureg_t
* stat.c (decode_struct_stat): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
cc6ef2f922 sigaltstack: change address argument type from unsigned long to kernel_ureg_t
* sigaltstack.c (print_stack_t): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
831feaf212 resource: change address argument type from unsigned long to kernel_ureg_t
* resource.c (print_rlimit64, print_rlimit32, decode_rlimit): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
a011ab10af printsiginfo: change address argument type from unsigned long to kernel_ureg_t
* printsiginfo.c (print_siginfo_array): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
30d13975a4 poll: change tracee address type from unsigned long to kernel_ureg_t
* poll.c (decode_poll_entering, decode_poll_exiting): Change the type
all tracee address variables from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
c15071b535 perf: change address argument type from unsigned long to kernel_ureg_t
* perf.c (fetch_perf_event_attr, print_perf_event_attr): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
5d0e737d00 pathtrace: change tracee address type from unsigned long to kernel_ureg_t
* pathtrace.c (upathmatch): Change address argument type
from unsigned long to kernel_ureg_t.
(pathtrace_match): Change the type of all tracee address variables
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
4c7a353896 scsi: change address argument type from unsigned long to kernel_ureg_t
* scsi.c (print_sg_io_buffer): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
f070096094 dm: change address argument type from unsigned long to kernel_ureg_t
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
173164923e oldstat: change address argument type from unsigned long to kernel_ureg_t
* oldstat.c (print_old_kernel_stat): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
edfeca944a capability: change address argument type from unsigned long to kernel_ureg_t
* capability.c (get_cap_header, print_cap_header, print_cap_data):
Change address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
5615c15036 btrfs: change address argument type from unsigned long to kernel_ureg_t
* btrfs.c (btrfs_print_qgroup_inherit): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
d4bb4510ba affinity: change address argument type from unsigned long to kernel_ureg_t
* affinity.c (print_affinitylist): Change address argument type from
unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
2b60571d86 aio: change address type from unsigned long to kernel_ureg_t
* aio.c (print_iocb): Remove casts to unsigned long.
(print_iocbp,  SYS_FUNC(io_submit)): Change address type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
8bb5c14488 mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* mmsghdr.c (save_mmsgvec_namelen, decode_mmsgvec): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
dc788de4e0 msghdr: change address argument type from unsigned long to kernel_ureg_t
* msghdr.c (decode_msg_control): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
50d25d1a60 fetch_struct_stat64: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_stat64.c (fetch_struct_stat64): Change address argument
type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
826dd22e46 fetch_struct_stat: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_stat.c (fetch_struct_stat): Change address argument
type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
5607a0e2b0 fetch_struct_msghdr: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_msghdr.c (fetch_struct_msghdr): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
f806439e29 fetch_struct_mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_mmsghdr.c (fetch_struct_mmsghdr): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
b6b3dc4361 decode_netlink: change address argument type from unsigned long to kernel_ureg_t
* defs.h (decode_netlink) Change address argument type
from unsigned long to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr, decode_nlmsghdr_with_payload,
decode_netlink): Likewise.
2016-12-23 19:26:57 +00:00
fde482b82e print_seccomp_*: change address argument type from unsigned long to kernel_ureg_t
* defs.h (print_seccomp_filter, print_seccomp_fprog): Change
address argument type from unsigned long to kernel_ureg_t.
* seccomp.c (print_seccomp_filter, print_seccomp_fprog,
decode_seccomp_set_mode_strict): Likewise.
2016-12-23 19:26:57 +00:00
5c252f970d tprint_iov*: change address argument type from unsigned long to kernel_ureg_t
* defs.h (tprint_iov, tprint_iov_upto): Change address argument type
from unsigned long to kernel_ureg_t.
* io.c (tprint_iov, tprint_iov_upto): Likewise.
2016-12-23 19:26:57 +00:00
399fceeb06 print_array: change tracee address type from unsigned long to kernel_ureg_t
* defs.h (print_array): Change start_addr type from unsigned long
to kernel_ureg_t.
* util.c (print_array): Likewise.  Change the type of all tracee
address variables from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
c239ebc31b Rename LONG_LONG to ULONG_LONG and change it to return unsigned long long
In all places where LONG_LONG is used the destination already has type
unsigned long long, so it is quite natural to change LONG_LONG as well.

* defs.h (LONG_LONG): Rename to ULONG_LONG, change return type
from long long to unsigned long long.  All callers updated.
2016-12-23 19:26:57 +00:00
6c9c122799 mem: remove redundant casts
* mem.c (SYS_FUNC(old_mmap)): Remove redundant cast
from kernel_ureg_t to unsigned long.
[S390] (SYS_FUNC(old_mmap_pgoff)): Remove redundant cast
from unsigned int to unsigned long.
2016-12-23 12:48:46 +00:00
274348cbac desc: remove redundant casts
* desc.c (umove_kulong_array_or_printaddr): Remove redundant cast
from uint32_t to kernel_ulong_t.
(SYS_FUNC(pselect6)): Remove redundant casts from kernel_ulong_t
to unsigned long.
2016-12-23 00:01:58 +00:00
89d8c578e7 print_sigevent: remove redundant cast
* print_sigevent.c (print_sigevent): Remove redundant cast from
struct_sigevent.sigev_value.sival_ptr to unsigned long as the former
is not a pointer but an unsigned integer.
2016-12-22 23:11:02 +00:00
d9d92cf220 tests: fix xattr.test for the case when listxattr returns a long list
* tests/xattr.c (DEFAULT_STRLEN): New macro.
(main): Use it to limit the length passed to print_quoted_memory.
Print ellipsis when the list returned by listxattr is too long.
2016-12-22 23:11:02 +00:00
2aa03c2af6 tests: test for correct ellipsis with -s in xattr
* tests/xattr-strings.c: New file.
* tests/xattr-strings.test: New test.
* tests/.gitignore: Add xattr-string.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add xattr-string.test.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
2016-12-22 23:11:02 +00:00
dd3548a691 xattr: use printstr_ex instead of print_quoted_string
This fixes the display when using `-s` to limit the string size
of the values displayed by {get,set}xattr.

* xattr.c (print_xattr_val): Remove static buffer.  Use printstr_ex
instead of print_quoted_string.

Reported-by: Марк Коренберг <socketpair@gmail.com>
Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
2016-12-22 23:11:02 +00:00
00265afe4a tests: use scno.h in finit_module, kcmp, renameat2 tests
* tests/finit_module.c: Include "scno.h".
* tests/kcmp.c: Likewise.
* tests/renameat2.c: Likewise.
2016-12-22 23:11:02 +00:00
fd4d4edd2b sock: cast pointers to kernel_ureg_t instead of unsigned long
* sock.c (decode_ifconf): Cast ifconf.ifc_buf pointer to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:29 +00:00
464566440a scsi: cast pointers to kernel_ureg_t instead of unsigned long
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Cast sg_io_hdr.cmdp,
sg_io_hdr.dxferp, and sg_io_hdr.sbp pointers to kernel_ureg_t instead
of unsigned long.
2016-12-21 23:35:29 +00:00
4b6d304c80 mtd: cast pointers to kernel_ureg_t instead of unsigned long
* mtd.c (decode_mtd_oob_buf): Cast mtd_oob_buf.ptr pointer
to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:29 +00:00
ac68c7db14 msghdr: cast pointers to kernel_ureg_t instead of unsigned long
* msghdr.c (print_struct_msghdr): Cast msghdr.msg_iov and
msghdr.msg_control pointers to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:29 +00:00
a06073fbbb evdev: cast tcp->u_rval to kernel_ureg_t instead of unsigned long
* evdev.c (decode_bitset): Cast tcp->u_rval to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:28 +00:00
fa66f3f700 evdev: cast pointers to kernel_ureg_t instead of unsigned long
* evdev.c (ff_effect_ioctl): Cast ff_periodic_effect.custom_data
pointer to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:28 +00:00
8afd294eb3 btrfs: cast pointers to kernel_ureg_t instead of unsigned long
* btrfs.c (btrfs_ioctl): Cast btrfs_ioctl_send_args.clone_sources
and btrfs_ioctl_vol_args_v2.qgroup_inherit pointers to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:28 +00:00
c6d15a9b0d Rework ifdefery around print_user_desc
* configure.ac (AC_CHECK_TYPES): Check for struct user_desc
in <asm/ldt.h>.
* clone.c (print_tls_arg): New function.
(SYS_FUNC(clone)): Use it.
(print_user_desc): Move prototype ...
* defs.h [HAVE_STRUCT_USER_DESC]: ... here.
* ldt.c: Check for HAVE_STRUCT_USER_DESC instead of architectures.
* linux/dummy.h: Likewise.
2016-12-21 23:35:27 +00:00
b0499e6d42 Introduce DECL_IOCTL macro to declare *_ioctl functions
* defs.h (DECL_IOCTL): New macro.
(dm_ioctl, file_ioctl, fs_x_ioctl, loop_ioctl, ptp_ioctl, scsi_ioctl,
sock_ioctl, term_ioctl, ubi_ioctl, uffdio_ioctl): Rewrite prototypes
using DECL_IOCTL.
2016-12-21 22:25:31 +00:00
2b5a0ea7db Introduce DECL_PRINT* macros to declare printnum_* and printpair_*
* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR): New macros.
(printnum_short, printnum_int, printnum_int64): Rewrite prototypes
using DECL_PRINTNUM.
(printpair_int, printpair_int64): Rewrite prototypes
using DECL_PRINTPAIR.
2016-12-21 22:25:30 +00:00
c30f689384 ioctl: use uintptr_t for casts between 32-bit integers and pointers
* ioctl.c (compare): Cast pointer to uintptr_t before assigning
it to an integer.
(ioctl_lookup): Cast integer to uintptr_t before passing it
as a pointer.
2016-12-21 22:25:30 +00:00
e68e2a84b0 scsi: use umove_or_printaddr
* scsi.c (scsi_ioctl): Use umove_or_printaddr.
2016-12-21 22:25:30 +00:00
73be1d7e2e Remove dumpiov wrapper
* defs.h (dumpiov): Remove.
* syscall.c (dumpio): Use dumpiov_upto instead of dumpiov.
2016-12-21 22:25:30 +00:00
4d7b7b18bd travis: fix enabling of gcc -Werror builds
* travis-build.sh: Use DISTCHECK_CONFIGURE_FLAGS instead
of CHECK_CONFIGURE_FLAGS and ENABLE_GCC_WERROR.
[$CC == gcc]: Add --enable-gcc-Werror to DISTCHECK_CONFIGURE_FLAGS
instead of ENABLE_GCC_WERROR.
[$CHECK == coverage]: Add --enable-code-coverage
to DISTCHECK_CONFIGURE_FLAGS instead of CHECK_CONFIGURE_FLAGS.
2016-12-21 22:25:30 +00:00
d51642053d printaddr: change argument type to kernel_ureg_t
* defs.h (printaddr): Change argument type from unsigned long
to kernel_ureg_t.
2016-12-21 03:03:08 +00:00
1eef9d28c7 tests: check decoding of unreadable ip_mreq and ipv6_mreq structures
* tests/ip_mreq.c (main): Check short read.
2016-12-21 03:03:08 +00:00
859c3074a6 tests: rewrite ip_mreq.c using arrays and iterators
* tests/ip_mreq.c (main): Create arrays of setsockopt arguments to test.
Iterate over these arrays invoking setsockopt and printing expected
output.
2016-12-21 03:03:08 +00:00
bb33a401ee tests: rewrite ip_mreq.c using tail_alloc
* tests/ip_mreq.c (main): Allocate objects of struct ip_mreq
and struct ipv6_mreq using tail_alloc instead of using stack.
2016-12-21 03:03:08 +00:00
f249e065a8 tests: rewrite ip_mreq.c without asserts
* tests/ip_mreq.c: Do not include <assert.h>.
(main): Do not use assert.  Use sprintrc instead of errno2name.
2016-12-21 03:03:04 +00:00
bf3a69ac75 Remove NEED_PTRACE_PROTOTYPE_WORKAROUND
Remove the workaround for broken ptrace prototypes
that seems to be unneeded for quite a long time.

* defs.h [NEED_PTRACE_PROTOTYPE_WORKAROUND]: Remove.
2016-12-20 14:58:57 +00:00
000fdc4b89 tests: use scno.h in tests of relatively new syscalls
* tests/add_key.c: Include "scno.h" after <asm/unistd.h>.
* tests/copy_file_range.c: Likewise.
* tests/execveat.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/membarrier.c: Likewise.
* tests/memfd_create.c: Likewise.
* tests/mlock2.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/userfaultfd.c: Likewise.
2016-12-20 05:10:21 +00:00
605a705a63 tests: generate scno.h from syscallent.h for use by other tests
Provide scno.h with fallback definitions of all __NR_* constants known
to strace for the personbality being tested.

Some tests need just __NR_* constants without any kernel support.
Such tests can include "scno.h" after <asm/unistd.h> to get definitions
of these constants when system headers are too old.

* tests/generate_scno.c: New file.
* tests/.gitignore: Add generate_scno.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(scno.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add scno.h.
2016-12-20 05:10:21 +00:00
c298e50d2a tests: fix potential errno clobbering in membarrier test
* tests/membarrier.c (main): Save errno.
2016-12-20 05:10:21 +00:00
552888b1ac Do not use widen_to_ulong in kexec.c and process_vm.c
Automatic argument truncation makes use of this function redundant.

* kexec.c (SYS_FUNC(kexec_load)): Do not invoke widen_to_ulong.
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Likewise.
2016-12-20 05:10:21 +00:00
6a360e2f3e x32: implement automatic argument truncation for compat syscalls
x32 syscalls starting with number 512 are compat syscalls that operate
on compat types.  Set COMPAT_SYSCALL_TYPES flag to these syscall entries
and make get_syscall_args truncate arguments of syscalls that have this
flag set, to avoid unpleasant alternative of adding multiple
widen_to_ulong invocations to individual syscall parsers.

preadv, pwritev, preadv2, and pwritev2 are exceptions: while these
syscalls operate on compat types, the offset argument has a regular
64-bit type, so the automatic argument truncation cannot be applied.

* defs.h (COMPAT_SYSCALL_TYPES): New macro.
* syscall.c (CST): New macro, defined to COMPAT_SYSCALL_TYPES.
* linux/ia64/syscallent.h: Do not include "../i386/syscallent.h"
unless [CST > 0].
* linux/x32/syscallent.h [512..533, 536..545]: Add CST flag.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Truncate arguments
of compat syscalls to 32-bit values.
* tests/ksysent.c (CST): New macro, defined to 0.
* tests/nsyscalls.c (CST): Likewise.
2016-12-20 05:10:21 +00:00
874caabc0f x32: fix decoding of mprotect and pkey_mprotect syscall arguments
As there are no compat versions of mprotect or pkey_mprotect syscalls
in x32 personality, "addr", "len", and "prot" syscall arguments have
kernel_ulong_t type and should be printed accordingly.

* mem.c (do_mprotect): Retrieve 1st, 2nd and 3rd arguments using
getarg_klu, print them using printaddr_klu, PRI_klu format,
and printflags64, correspondingly.
2016-12-20 05:09:13 +00:00
6caa97f543 Make tprint_iov function a static inline wrapper
* io.c (tprint_iov): Move ...
* defs.h: ... here, add static inline keywords.
2016-12-20 03:39:09 +00:00
0c6f755525 x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls
In x32 personality these syscalls use compat type for the 3rd argument,
therefore it has to be truncated there.

* io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using
widen_to_ulong.
2016-12-20 03:35:03 +00:00
5451e9ffa6 tests: fix preadv2-pwritev2 test on x32
On x32 p(read|write)v(|2) syscalls are implemented via compat, which
truncates len argument to unsigned int.

* tests/preadv2-pwritev2.c (main): Print vlen argument as unsigned long.
2016-12-20 00:32:40 +03:00
8e4c657a9d kexec: fix for the x32 ABI
There is no compat (and no 32-bit version, ever) for x32 ABI, so
kernel's long type should be used for arguments' values.

The only remaining thing is a pointer to cmdline string, but it is
currently broken on x32 anyway.

* kexec.c (SYS_FUNC(kexec_file_load)): Print the cmdline_len argument
as kernel long, retrieve it via getarg_klu; use printflags64 for
printing the flags argument, retrieve it via getarg_klu.
2016-12-20 00:13:27 +03:00
b3d82da686 Check for current_klongsize instead of current_personality where appropriate
current_klongsize checks are more universal, therefore they are usually
shorter and easier to comprehend.

* desc.c (umove_kulong_array_or_printaddr): Check for current_klongsize
instead of current_personality and current_wordsize.
* io.c (print_lld_from_low_high_val): Likewise.
* lseek.c (SYS_FUNC(lseek)): Likewise.
* resource.c (decode_rlimit): Likewise.
* syscall.c (is_negated_errno): Likewise.
* util.c (getllval, getarg_klu): Likewise.
2016-12-19 19:58:16 +00:00
a2485b86e7 Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t.  All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t.  All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:58:16 +00:00
e42dac4361 fcntl.c: print 64-bit fields of struct_kernel_flock64 using PRId64 format
* fcntl.c (print_struct_flock64): Print l_start and l_len fields
of struct_kernel_flock64 using PRId64 format.
2016-12-19 19:58:16 +00:00
42cbea6627 v4l2.c: print v4l2_ext_control.value64 using PRId64 format
* v4l2.c (print_v4l2_ext_control): Print value64 field
of struct_v4l2_ext_control using PRId64 format.
2016-12-19 19:58:16 +00:00
df5c46896b perf.c: print perf_event_attr.__reserved_1 using PRIx64 format
* perf.c (print_perf_event_attr): Print __reserved_1 field
of perf_event_attr using PRIx64 format.
2016-12-19 19:58:16 +00:00
cabcca717a btrfs.c: print 64-bit fields of btrfs_ioctl_vol_args_v2 using PRIu64 format
* block.c (btrfs_ioctl): Print size and transid fields
of struct_btrfs_ioctl_vol_args_v2 using PRIu64 format.
2016-12-19 19:58:16 +00:00
201fd3c185 block.c: change type of long long fileds to int64_t
* block.c (struct_blkpg_partition): Change type of start and length
fields from long long to int64_t.
(print_blkpg_req): Print them using PRId64 format.
2016-12-19 19:58:16 +00:00
1fe5d9bed5 Introduce current_klongsize in addition to current_wordsize
Subsequent commits are going to use current_klongsize
as the tracee's size of kernel_ulong_t type.

* defs.h (PERSONALITY0_KLONGSIZE): New macro.
[X86_64] (PERSONALITY2_KLONGSIZE): Likewise.
[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_KLONGSIZE): Likewise.
[SUPPORTED_PERSONALITIES == 1] (current_klongsize): Likewise.
[SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE ==
PERSONALITY1_KLONGSIZE] (current_klongsize): Likewise.
[SUPPORTED_PERSONALITIES != 1 && (SUPPORTED_PERSONALITIES != 2 ||
PERSONALITY0_KLONGSIZE != PERSONALITY1_KLONGSIZE)] (current_klongsize):
New variable prototype.
* syscall.c [!current_klongsize] (current_klongsize): New variable.
[!current_klongsize] (personality_klongsize): New array.
(set_personality) [!current_klongsize]: Update current_klongsize
with the appropriate value from personality_klongsize.
2016-12-19 14:39:48 +00:00
6452c4deeb configure: define SIZEOF_KERNEL_LONG_T macro
Provide SIZEOF_KERNEL_LONG_T macro in addition to SIZEOF_LONG and
SIZEOF_LONG_LONG for checking of kernel_long_t and kernel_ulong_t
types at the time of preprocessing.

* configure.ac (AC_CHECK_SIZEOF): Add kernel_long_t.
2016-12-19 14:37:59 +00:00
dfff7d5571 Remove getarg_ll
This function has never been used in the code, and in perspective
the whole ext_arg thing will go away.

* defs.h (getarg_ll): Remove prototype.
* util.c (getarg_ll): Remove.
2016-12-19 14:21:40 +00:00
fc346f1d91 struct tcb: make types of syscall arguments unsigned
This is the first step in the direction of revisiting current practice
of indiscriminate use of signed types for syscall arguments and memory
addresses.

* kernel_types.h (kernel_ureg_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of u_arg from long to kernel_ureg_t.
[HAVE_STRUCT_TCB_EXT_ARG]: Change type of ext_arg from long long
to unsigned long long.
* desc.c (decode_select): Change type of syscall arguments from long
to kernel_ureg_t.
(SYS_FUNC(oldselect)): Change type of select_args from long
to kernel_ureg_t.
* io.c (print_lld_from_low_high_val): Remove no longer needed cast
of syscall arguments to unsigned long.
* lseek.c (SYS_FUNC(lseek)): Cast syscall argument from unsigned long
to long.
* mem.c (print_mmap): Change type of syscall arguments from long
to kernel_ureg_t.
(SYS_FUNC(old_mmap), SYS_FUNC(old_mmap_pgoff)): Change type of u_arg
from long to kernel_ureg_t.
(SYS_FUNC(mmap), SYS_FUNC(mmap_pgoff), SYS_FUNC(mmap_pgoff)): Remove
no longer needed cast of syscall arguments to unsigned long.
* pathtrace.c (pathtrace_match): Change type of args and select_args
from long to kernel_ureg_t.
* util.c (getarg_ull): Remove no longer needed casts of syscall
arguments to unsigned types.
2016-12-19 12:38:29 +00:00
29107a40e9 s390: fix decoding of mmap2 syscall when arguments are not available
* mem.c [S390] (SYS_FUNC(old_mmap_pgoff)): Use umove_or_printaddr
instead of umoven to fetch mmap arguments, fix return value when this
fetch fails.
2016-12-19 12:34:51 +00:00
ed256d30ee Fix pathmatch of oldselect syscall on 64-bit architectures
* pathtrace.c (pathtrace_match): Fix fetching of 32-bit oldselect
arguments on 64-bit architectures.
2016-12-19 11:49:58 +00:00
4cb2d29f2f Cleanup oldselect
* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.
2016-12-19 11:40:43 +00:00
0547dc1ad5 Change scno type from long to unsigned long
Use an unsigned type for syscall numbers as they are not intended
for signed arithmetics.  Introduce kernel_scno_t as a typedef
to unsigned long, that could be changed later to kernel_ulong_t.

* kernel_types.h (kernel_scno_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of scno field from long
to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
(scno_in_range, scno_is_valid): Change argument type from unsigned long
to kernel_scno_t.
* linux/aarch64/set_scno.c (arch_set_scno): Change scno argument type
from long to kernel_scno_t.
* linux/alpha/set_scno.c (arch_set_scno): Likewise.
* linux/arc/set_scno.c (arch_set_scno): Likewise.
* linux/arm/set_scno.c (arch_set_scno): Likewise.
* linux/avr32/set_scno.c (arch_set_scno): Likewise.
* linux/bfin/set_scno.c (arch_set_scno): Likewise.
* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
* linux/hppa/set_scno.c (arch_set_scno): Likewise.
* linux/i386/set_scno.c (arch_set_scno): Likewise.
* linux/ia64/set_scno.c (arch_set_scno): Likewise.
* linux/m68k/set_scno.c (arch_set_scno): Likewise.
* linux/metag/set_scno.c (arch_set_scno): Likewise.
* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
* linux/mips/set_scno.c (arch_set_scno): Likewise.
* linux/nios2/set_scno.c (arch_set_scno): Likewise.
* linux/or1k/set_scno.c (arch_set_scno): Likewise.
* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
* linux/riscv/set_scno.c (arch_set_scno): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/sh/set_scno.c (arch_set_scno): Likewise.
* linux/sh64/set_scno.c (arch_set_scno): Likewise.
* linux/sparc/set_scno.c (arch_set_scno): Likewise.
* linux/tile/set_scno.c (arch_set_scno): Likewise.
* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
* linux/aarch64/get_scno.c (arch_get_scno): Change scno variable type
from long to kernel_scno_t.
* linux/alpha/get_scno.c (arch_get_scno): Likewise.
* linux/arm/get_scno.c (arch_get_scno): Likewise.
* linux/sh/get_scno.c (arch_get_scno): Likewise.
* linux/x86_64/get_scno.c (arch_get_scno): Likewise.
* syscall.c (arch_set_scno): Likewise.
(shuffle_scno): Change return type from long to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
2016-12-18 22:57:57 +00:00
ae39bba347 Lowercase SCNO_IN_RANGE and SCNO_IS_VALID
* defs.h (SCNO_IN_RANGE): Rename to scno_in_range.  All callers updated.
(SCNO_IS_VALID): Rename to scno_is_valid.  All callers updated.
2016-12-18 22:57:57 +00:00
832fd63fc4 Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions
* defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline
functions.
2016-12-18 22:57:57 +00:00
f73dcf3c21 count.c: use syserror instead of direct u_error access
* count.c (count_syscall): Use syserror instead of u_error.
2016-12-18 22:57:57 +00:00
f0ba3723f5 Replace "(unsigned long) -1L" with -1UL
* defs.h (dumpiov): Replace "(unsigned long) -1L" with -1UL.
* io.c (print_iovec, tprint_iov): Likewise.
* msghdr.c (SYS_FUNC(sendmsg)): Likewise.
* syscall.c (dumpio): Likewise.
* poll.c (decode_poll_exiting): Replace "(unsigned int) -1" with -1U.
2016-12-18 14:09:51 +00:00
ee75f4e926 Add toplevel recursive check-valgrind rule
* Makefile.am (.PHONY): Add check-valgrind-local.
(check-valgrind): New rule.
* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Add it.
2016-12-18 14:09:51 +00:00
0fcb3efcf3 m4: fix check-valgrind-* rules generated by AX_VALGRIND_CHECK
* m4/ax_valgrind_check.m4 (check-valgrind-$(1)): Depend
on $(BUILT_SOURCES), honor $(AM_MAKEFLAGS), build check-am
instead of check-TESTS.
2016-12-18 14:09:51 +00:00
c121227125 travis: do coverage using a dedicated build
* .travis.yml (after_success): Remove.
(matrix): Create an entry for the regular x86_64 target.
* travis-success.sh: Merge into ...
* travis-build.sh: ... this file.  Disable optimization
for coverage builds.
* travis-install.sh: Rename COVERAGE=true to CHECK=coverage.
2016-12-18 14:09:51 +00:00
faf03528c2 mips n32: provide fallback definitions of kernel_long_t/kernel_ulong_t
* kernel_types.h [!(HAVE___KERNEL_LONG_T && HAVE___KERNEL_ULONG_T) &&
LINUX_MIPSN32] (kernel_long_t, kernel_ulong_t): Define to long long types.
2016-12-17 12:06:24 +00:00
f958b3ce5b util: simplify definitions of bit mask constants in umovestr
* util.c (umovestr): Do not check for SIZEOF_LONG in definitions
of bit mask constants.
2016-12-17 12:06:24 +00:00
6f4ecb2add tests: check decoding of prctl operations without arguments
* tests/prctl-no-args.c: New file.
* tests/prctl-no-args.test: New test.
* tests/.gitignore: Add prctl-no-args.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-no-args.test.
2016-12-17 12:06:21 +00:00
2dd34a4da7 tests: check decoding of prctl PR_[GS]ET_SECUREBITS operations
* tests/prctl-securebits.c: New file.
* tests/prctl-securebits.test: New test.
* tests/.gitignore: Add prctl-securebits.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-securebits.test.
2016-12-17 12:06:07 +00:00
73e9623acf tests: check decoding of prctl PR_[GS]ET_DUMPABLE operations
* tests/prctl-dumpable.c: New file.
* tests/prctl-dumpable.test: New test.
* tests/.gitignore: Add prctl-dumpable.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-dumpable.test.
2016-12-17 12:02:07 +00:00
ea01cb0e5b prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE
* xlat/pr_dumpable.in: New file.
* prctl.c: Include "xlat/pr_dumpable.h".
(SYS_FUNC(prctl)): Decode returned value of PR_GET_DUMPABLE operation
and the second syscall argument of PR_SET_DUMPABLE operation
as SUID_DUMP_* constants.
2016-12-17 11:40:03 +00:00
f55ef46feb Include "kernel_types.h" in defs.h and tests/tests.h
As kernel_ulong_t type is going to be used in the definition
of struct tcb and in many function prototypes, make it readily
available for every source file by including "kernel_types.h"
in defs.h and tests/tests.h files.

* defs.h: Include "kernel_types.h".
* tests/tests.h: Likewise.
* desc.c: Do not include "kernel_types.h".
* dirent.c: Likewise.
* keyctl.c: Likewise.
* syscall.c: Likewise.
* linux/asm_stat.h: Likewise.
* tests/answer.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/fanotify_init.c: Likewise.
* tests/fanotify_mark.c: Likewise.
* tests/file_handle.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/getdents.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/inotify.c: Likewise.
* tests/inotify_init1.c: Likewise.
* tests/ioprio.c: Likewise.
* tests/ipc_msgbuf.c: Likewise.
* tests/kcmp.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/kexec_load.c: Likewise.
* tests/keyctl.c: Likewise.
* tests/lookup_dcookie.c: Likewise.
* tests/lseek.c: Likewise.
* tests/mq_sendrecv.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/prctl-pdeathsig.c: Likewise.
* tests/prctl-tsc.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/process_vm_readv_writev.c: Likewise.
* tests/read-write.c: Likewise.
* tests/setfsugid.c: Likewise.
* tests/setns.c: Likewise.
* tests/truncate.c: Likewise.
* tests/unshare.c: Likewise.
* tests/xgetrlimit.c: Likewise.
2016-12-16 12:01:44 +00:00
2fc39d0a4c Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.15-1.
* strace.spec.in: Likewise.
2016-12-15 00:08:06 +00:00
3a838cd31a xlat: provide fallback definitions for NETLINK_* constants
As new constants have been added gradually over kernel releases, define
all constant values to make newer constants decoded properly when strace
is built with older kernel headers.

* xlat/netlink_protocols.in: Add default values for constants.
* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]: Remove.
* socketutils.c: Likewise.
2016-12-14 08:09:10 +00:00
76d4eee640 tests: relax getaffinity return value check in tests/sched_xetaffinity.c
* tests/sched_xetaffinity.c (errstr): New variable.
(getaffinity, setaffinity): Initialize it.
(main): Use it.  Allow getaffinity return value to be less than
its cpusetsize argument.
2016-12-14 02:03:04 +00:00
a3f44329a5 tests: fix threads-execve.test for large pids
* tests/threads-execve.c (main): Fix expected output for large pids.
2016-12-14 01:02:03 +00:00
6dc96f5c75 Prepare for 4.15 release
* NEWS: Update for 4.15 release.
2016-12-13 20:21:22 +00:00
9b96cd97af .mailmap: add addresses of Thomas De Schampheleire
* .mailmap: Add both addresses of Thomas De Schampheleire here to avoid
duplications in CREDITS file.
2016-12-13 20:43:57 +00:00
8ed741fc59 Sync strace.spec and debian/ with packages
* debian/control: Add Vcs-* metadata from 4.13-0.1.
* debian/watch: Sync with 4.13-0.1.
* strace.spec.in: Sync with 4.14.0.100.622a-1.
2016-12-13 20:43:57 +00:00
3dac7272e8 tests: workaround a bug in GNU grep
Workaround a bug introduced in GNU grep 2.27, for details see
https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html

* tests/init.sh (grep_pid_status): New function.
* tests/detach-running.test: Use it instead of grep to search
in /proc/$pid/status.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
2016-12-13 20:21:22 +00:00
34283c2f82 tests: fix typo in comment inside prctl-tsc.c 2016-12-13 20:21:22 +00:00
54c7792bfd Fix libunwind segfault when -p is passed before -k
* strace.c (init) [USE_LIBUNWIND]: Call unwind_tcb_init after
unwind_init for all allocated tcb structures if stack trace is enabled.
* unwind.c (unwind_tcb_init): Skip if tcb is already initialized.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-13 20:21:22 +00:00
9555f21588 Update NEWS
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-13 20:10:44 +00:00
ab28d7f1e5 tests: skip fault injection tests on unsupported platforms
* tests/fault_injection.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/fault_injection-exit_group.test: Use it.
* tests/fault_injection.test: Likewise.
2016-12-07 19:46:13 +00:00
5aff0e3c6e tests: introduce require_min_kernel_version_or_skip function
* tests/init.sh (kernel_version_code,
require_min_kernel_version_or_skip): New functions.
* tests/threads-execve.test: Use require_min_kernel_version_or_skip.
2016-12-07 19:46:12 +00:00
d679dcd6aa tests: add descriptions to prctl-pdeathsig and prctl-tsc tests 2016-12-07 18:28:33 +00:00
a2633e4a59 tests: robustify prctl-pdeathsig.test and prctl-tsc.test
Rrobustify remaining prctl tests against unrelated prctl invocations

* tests/prctl-pdeathsig.test: Filter out unrelated PR_GET_* and PR_SET_*
prctl calls.
* tests/prctl-tsc.test: Likewise.
2016-12-07 16:22:50 +00:00
a3da3c32c1 Makefile.am: don't confuse CFLAGS and CFLAGS_FOR_BUILD
Commit dc427d50d9 enabled a number of extra
warning flags through configure.ac.  The configure script will determine
dynamically if CC supports these flags before adding them to WARN_CFLAGS.

ioctlsort is compiled with CC_FOR_BUILD, rather than CC.  Nevertheless,
the flags passed to this compilation also include WARN_CFLAGS (through
AM_CFLAGS).  This is incorrect: in a cross-compilation use case, CC
and CC_FOR_BUILD are not the same.  The former is the cross-compiler,
the latter is the host compiler.  Both may be of different versions
and support different warning flags.

In particular, this posed a problem when cross-compiling with a host
compiler gcc 4.1, which does not support all the new flags:

    /usr/bin/gcc -DHAVE_CONFIG_H   -I./linux/arm -I./linux/arm -I./linux
    -I./linux -I. -I. -I/host-sysroot/usr/include -Wall -Wempty-body
    -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op
    -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration
    -Wold-style-definition -Wsign-compare -Wtype-limits -Wwrite-strings -O2
    -I/host-sysroot/usr/include -DIOCTLSORT_INC=\"ioctls_all0.h\" -c -o
    ioctlsort0.o ./ioctlsort.c
    cc1: error: unrecognized command line option "-Wempty-body"
    cc1: error: unrecognized command line option "-Wignored-qualifiers"
    cc1: error: unrecognized command line option "-Wlogical-op"
    cc1: error: unrecognized command line option "-Wmissing-parameter-type"
    cc1: error: unrecognized command line option "-Wold-style-declaration"
    cc1: error: unrecognized command line option "-Wtype-limits"
    make[2]: *** [ioctlsort0.o] Error 1

* Makefile.am (AM_CFLAGS_FOR_BUILD, AM_CPPFLAGS_FOR_BUILD): New
variables.
(ioctlsort_CPPFLAGS): Use AM_CPPFLAGS_FOR_BUILD instead of AM_CPPFLAGS.
(ioctlsort_CFLAGS): Use AM_CFLAGS_FOR_BUILD instead of AM_CFLAGS.
(ioctlsort_LDFLAGS): Use AM_LDFLAGS_FOR_BUILD instead of AM_LDFLAGS.
* m4/ax_prog_cc_for_build.m4 (AX_PROG_CC_FOR_BUILD): Redirect
WARN_CFLAGS and gl_unknown_warnings_are_errors, call st_WARN_CFLAGS,
substitute WARN_CFLAGS_FOR_BUILD.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
2016-12-07 15:53:13 +00:00
f91def0384 m4: prepare gl_WARN_ADD for simultaneous use of multiple compilers
* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Change gl_Flags to use
_AC_LANG_PREFIX[]FLAGS in unquoted form.  Change gl_Warn to use gl_Flags
instead of _AC_LANG_ABBREV.  Change notification message to mention
the variable name of the compiler.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS): Do nothing if
gl_unknown_warnings_are_errors is set.
(gl_WARN_ADD): Change the use of gl_UNKNOWN_WARNINGS_ARE_ERRORS from
AC_REQUIRE to a regular call.
2016-12-07 15:53:13 +00:00
cdeb5dda0a AX_PROG_CC_FOR_BUILD: redirect more variables related to C compiler
Some of these variables cannot be redirected using traditional
pushdef/popdef mechanism because of complex constructions like
[ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu] employed by autoconf macros.
Use st_SAVE_VAR/st_RESTORE_VAR to workaround this issue.

* m4/ax_prog_cc_for_build.m4: Redirect ac_cv_prog_cc_stdc,
ac_cv_prog_cc_c11, ac_cv_prog_cc_c99, ac_cv_prog_cc_c89,
am_cv_prog_cc_c_o, and am_cv_CC_dependencies_compiler_type using
pushdef/popdef.
Redirect ac_c_decl_warn_flag, ac_c_preproc_warn_flag, ac_c_werror_flag,
ac_compile, ac_compiler_gnu, ac_cpp, ac_cv_c_compiler_gnu,
ac_cv_c_decl_report, and ac_link using st_SAVE_VAR/st_RESTORE_VAR.
2016-12-07 11:14:03 +00:00
9beaf2c3d3 Move all gl_WARN_ADD calls to a separate m4 macro
This is going to be needed for the upcoming AX_PROG_CC_FOR_BUILD
change.

* configure.ac: Call st_WARN_CFLAGS before AX_PROG_CC_FOR_BUILD.
Move all gl_WARN_ADD calls ...
* m4/st_warn_cflags.m4: ... here.
2016-12-07 10:59:52 +00:00
c26d031c1f m4: introduce st_SAVE_VAR and st_RESTORE_VAR macros
These new macros are going to be needed for the upcoming
AX_PROG_CC_FOR_BUILD change.

* m4/st_save_restore_var.m4: New file.
2016-12-07 10:58:24 +00:00
5c20f4aac4 tests: add valgrind support to "make check"
* m4/ax_valgrind_check.m4: Import from the autoconf-archive package.
* configure.ac: Invoke AX_VALGRIND_CHECK.
* valgrind.supp: Move to tests/strace.supp.
* Makefile.am (EXTRA_DIST): Remove valgrind.supp.
* tests/Makefile.am: Add @VALGRIND_CHECK_RULES@.
(VALGRIND_FLAGS, VALGRIND_SUPPRESSIONS_FILES): New variables.
(EXTRA_DIST): Add strace.supp.
* tests/init.sh: Add valgrind command prefix to $STRACE when appropriate.
2016-12-06 16:20:54 +00:00
427e7431ba tests: robustify threads-execve.test against race conditions
Due to probabilistic nature of the test, try it several times.

* tests/threads-execve.c (NUMBER_OF_ITERATIONS): Change to 1.
* tests/threads-execve.test: Iterate up to 10 times.
2016-12-06 16:20:51 +00:00
51694267bd tests: fix expected output in strace-ttt.test
If strace -ttt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.

* tests/strace-ttt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 15:27:21 +00:00
52fe35f262 tests: fix expected output in strace-tt.test
If strace -tt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.

* tests/strace-tt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 15:27:08 +00:00
a2002a648e tests: robustify redirect.test against race conditions
Introduce a synchronization mechanism between the tracee and its peer.

* tests/redirect.test: Change timeout file to $OUT.  Let the tracee
remove $LOG, wait for $LOG removal in its peer.
2016-12-06 13:16:42 +00:00
997f49f190 tests: robustify attach-f-p.test against race conditions
Introduce a synchronization mechanism between attach-f-p and strace.

* tests/attach-f-p-cmd.c: New file.
* tests/Makefile.am (check_PROGRAMS): Add attach-f-p-cmd.
* tests/attach-f-p.c: Include <sys/stat.h>.
(main): Write to stdout instead of descriptor 3.  Wait for the peer
writing to stdout.
* tests/attach-f-p.test: Assume that ./attach-f-p-cmd works.
Use $OUT for expected output.  Use attach-f-p-cmd for unlocking $OUT.
2016-12-06 09:09:18 +00:00
f91c9fe814 tests: robustify attach-p-cmd.test against race conditions
Introduce a synchronization mechanism between attach-p-cmd-p
and attach-p-cmd-cmd processes.

* tests/attach-p-cmd-cmd.c: Include <errno.h> and <sys/stat.h>.
(main): Wait for the lock directory creation by attach-p-cmd-p.
* tests/attach-p-cmd-p.c: Include <errno.h> and <sys/stat.h>.
(main): Create a lock directory and wait for its removal
by attach-p-cmd-cmd.
* tests/attach-p-cmd.test: Assume that test programs work.
2016-12-06 09:08:36 +00:00
45ed340016 Rewrite remaining qual_* parsers using bit sets
* defs.h (struct fault_opts): Replace forward declaration
with a definition.
(qualbits_t, qualify_read, qualify_write, qualify_signals): Remove.
(qual_flags): New function prototype.
(nsyscall_vec, sysent_vec, fault_vec): New variable prototypes.
* qualify.c (abbrev_set, fault_set, raw_set, trace_set, verbose_set):
New variables.
(qualify_read, qualify_write, qualify_signals): Add static qualifier.
(find_errno_by_name, lookup_class, parse_fault_expression,
parse_fault_token, qual_flags, qualify, qualify_abbrev, qualify_fault,
qualify_raw, qualify_syscall, qualify_syscall_class,
qualify_syscall_name, qualify_syscall_number, qualify_syscall_tokens,
qualify_trace, qualify_verbose, strip_prefix): New functions.
* syscall.c (nsyscall_vec, nsysent_vec): Remove static qualifier.
(MAX_NSYSCALLS1, MAX_NSYSCALLS2, MAX_NSYSCALLS, qual_vec, qual_flags,
qual_fault, qual_syscall, qual_options, fault_opts, qualify_one,
qualify_scno, lookup_class, qualify_syscall_class, qualify_syscall_name,
qual_syscall_ex, qual_syscall, strip_prefix, find_errno_by_name,
parse_fault_token, parse_fault_expression, qual_fault, qualify): Remove.
(decode_socket_subcall, decode_ipc_subcall, decode_mips_subcall,
get_scno): Update use of qual_flags.
(inject_syscall_fault_entering): Update per-personality allocation
of tcp->fault_vec.
* tests/fault_injection-exit_group.test: Check parsing of inversed
fault sets.
* tests/fault_injection.test: Check parsing of -efault=none.
* tests/options-syntax.test: Check parsing of invalid syscall numbers.
2016-12-05 20:49:59 +00:00
701792d70c Change qual_vec/qual_fault into static fixed size arrays
* defs.h (qual_vec, num_quals): Remove.
(qual_flags): Move ...
* syscall.c: ... here.
(num_quals, num_faults, MIN_QUALS, reallocate_vec, reallocate_qual,
reallocate_fault): Remove.
(qual_vec, qual_fault): Change into static fixed size arrays.
(qualify_one): Remove reallocate_qual and reallocate_fault calls.
(qualify): Likewise.  Replace num_quals and num_faults with
MAX_NSYSCALLS.
2016-12-05 20:49:59 +00:00
11abfb422a Rewrite qual_signal using bit sets
* defs.h (signal_set): New variable prototypes.
(qualify_signals): New function prototypes.
(QUAL_SIGNAL): Change to a value greater than 0xff.
(QUAL_FAULT): Change to a lower value.
* qualify.c (signal_set): New variable.
(sigstr_to_uint, qualify_signals): New functions.
* syscall.c (qual_signal): Remove.
(qual_options): Replace qual_signal with NULL.
(qualify): Use qualify_signals.
* strace.c (print_signalled, print_stopped): Use is_number_in_set
with signal_set argument.
2016-12-05 20:49:59 +00:00
05ac490cc7 Rewrite qual_desc using bit sets
As a side effect, this also fixes support of negated sets
of descriptors.

* defs.h (struct number_set): New forward declaration.
(read_set, write_set): New variable prototypes.
(is_number_in_set, qualify_read, qualify_write): New function
prototypes.
(QUAL_READ, QUAL_WRITE): Change to values greater than 0xff.
* qualify.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* syscall.c (qual_desc): Remove.
(qual_options): Replace qual_desc with NULL.
(qualify): Use qualify_read and qualify_write.
(dumpio): Use is_number_in_set.
* tests/options-syntax.test: Check invalid sets of descriptors.
* tests/readv.test: Check dumping of negated sets of descriptors.
2016-12-05 10:41:05 +00:00
1ac436f4c3 tests: skip redirect-fds.test when strace is wrapped with valgrind
valgrind is not as transparent as strace wrt standard descriptors,
so if strace is wrapped with valgrind, the test would check valgrind
transparency properties and fail imminently.

* tests/redirect-fds.test: Skip the test when $STRACE shows a presence
of valgrind.
2016-12-05 10:41:05 +00:00
ade6eef6dd Add valgrind.supp
As valgrind is not quite happy about the way how get_cpuset_size uses
sched_getaffinity, add a suppression file for this case.

* valgrind.supp: New file.
* Makefile.am (EXTRA_DIST): Add it.
2016-12-05 03:56:17 +00:00
58d8f96c25 affinity: pass 0 as a pid to sched_getaffinity
* affinity.c (get_cpuset_size): Pass 0 instead of getpid()
to sched_getaffinity.
2016-12-05 03:56:17 +00:00
cec2dc2ab5 affinity: document the method of finding out the cpuset size
* affinity.c (get_cpuset_size): Add a comment about sched_getaffinity.
2016-12-05 03:56:17 +00:00
8c9dc258e0 tests: make options-syntax.test tolerant of strace wrappers
Change the test to allow wrappers like STRACE="valgrind ./strace".

* tests/options-syntax.test: Strip all words but last from $STRACE
variable in all contexts where the name of strace executable is expected
in its output.
2016-12-05 03:56:17 +00:00
2ecb0a0467 Do not allocate memory for line buffered output
libc is perfectly capable of allocating memory for its buffers,
so let it do its job.

* strace.c (init): Do not allocate memory for setvbuf invocation.
2016-12-04 23:09:18 +00:00
6be0d91285 Update NEWS 2016-12-04 23:09:18 +00:00
5be0a95d8e tests: use kernel_ulong_t as argument type in setfsuid/setfsgid tests
* setfsugid.c: Include "kernel_types.h".
(main): Change type of entries of the "tests" array from long to
kernel_ulong_t.
2016-12-04 17:42:38 +00:00
6be94f1772 uid: print size as signed in setgroups/getgroups
As this is the type used in kernel.

* uid.c (SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Print size parameter
as "%d".
* tests/getgroups.c: Update expected output.
* tests/setgroups.c: Likewise.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-12-04 17:42:38 +00:00
3304d82108 uid: use printuid for printing UID/GID value
* uid.c (setfsuid, get_print_uid, print_gid): Use printuid.
* tests/setfsugid.c (printuid): New function.
(main): Use it to print UID/GID values.
* tests/setgroups.c: Likewise.
* tests/setugid.c (ugid2int): Remove.
(printuid): New function.
(main): Use it to print UID/GID values.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-12-04 17:42:38 +00:00
dcc9b9cdb2 tests: additional check for PTRACE_SETSIGINFO ptrace command
* tests/ptrace.c (main): Add an additional PTRACE_SETSIGINFO check.
2016-12-01 01:23:28 +00:00
3c8b673408 syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32
* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
Clear __X32_SYSCALL_BIT from scno on x32 personality.
2016-12-01 01:05:13 +00:00
9936b91d9f Print syscall names only for defined syscalls
The string literal "__NR_syscall_4294967295" is semantically incorrect
as there is no such constant defined.

* syscall.c (syscall_name): Return NULL if there is no syscall
corresponding to the given number.
* defs.h (syscall_name): Document this behaviour.
* printsiginfo.c (print_si_info): Print syscall name with "__NR_" prefix
only if there is a syscall corresponding to si_syscall number; print
a plain syscall number otherwise.
* tests/ptrace.c (main): Update expected output.
2016-12-01 00:08:39 +00:00
2432f78415 affinity: print cpu set as an array
* affinity.c: Add comma between elements of cpu set.
* tests/sched_xetaffinity.c (main): Update expected output.
2016-12-01 00:08:06 +00:00
635638feb3 statfs: fix printing format of f_fsid field
* print_statfs.c: Print f_fsid as a structure containing field "val"
which, in turn, is an array of two elements that used to be printed
as members of f_fsid structure.
* tests/statfs.expected: Update expected output.
* tests/xstatfsx.c (print_statfs): Likewise.
2016-12-01 00:06:39 +00:00
39c77d45d0 swap: always print priority value
* swapon.c (SYS_FUNC(swapon)): Do not check for non-zero the value
of the prio variable in order to print it.
* tests/swap.c (main): Update expected output.
2016-12-01 00:05:09 +00:00
3cfe169f37 tests: show pattern line number in match_grep
This makes debugging of failing test  a bit easier.

* tests/init.sh (match_grep): Add the cnt variable, increment it on every
pattern line read, print it as a prefix for non-matched pattern.
2016-12-01 00:02:07 +00:00
01e9ac81c4 futex: make output of the val3 argument of the FUTEX_WAKE_OP command more structured
It is a number which consists of several xlat values, not a structure.

* futex.c (SYS_FUNC(futex)): Modify output of the val3 argument
of the FUTEX_WAKE_OP futex syscall command.
* tests/futex.c (main): Update expected output.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-11-30 23:56:47 +00:00
d872902009 tests: additional checks for prctl-* tests
* tests/prctl-pdeathsig.c (main): Additional checks.
* tests/prctl-tsc.c (main): Likewise.
* tests/prctl-pdeathsig.test: Update value of -a argument.
* tests/prctl-tsc.test: Likewise.
2016-11-30 23:46:20 +00:00
d945e74377 tests: add prctl-pdeathsig.test and prctl-tsc.test
* tests/prctl-pdeathsig.c: New file.
* tests/prctl-tsc.c: Likewise.
* tests/prctl-pdeathsig.test: New test.
* tests/prctl-tsc.test: Likewise.
* tests/.gitignore: Add prctl-pdeathsig and prctl-tsc.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-pdeathsig.test and prctl-tsc.test.
2016-11-30 23:40:30 +00:00
ec8f783356 syscall: Simplify strip_prefix
* syscall.c (strip_prefix): Use strncmp instead of strlen+memcmp.
2016-11-30 16:52:28 +00:00
9f2980bd2c util: fix integer overflow check in string_to_uint_ex
* util.c (string_to_uint_ex): Fix the check for integer overflow
on systems where LONG_MAX == INT_MAX.
2016-11-30 16:52:05 +00:00
c422618120 Check dumping of io syscalls when descriptor arguments are sensibly large
* tests/tests.h (pipe_maxfd): New prototype.
* tests/pipe_maxfd.c: New file.
* tests/print_maxfd.c: Likewise.
* tests/.gitignore: Add print_maxfd.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(libtests_a_SOURCES): Add pipe_maxfd.c.
* tests/readv.c (main): Use pipe_maxfd() instead of pipe(),
fds[0] instead of 0, fds[1] instead of 1.
* tests/readv.test: Use print_maxfd to specify dump descriptor numbers.
2016-11-30 00:56:04 +00:00
1c599b4f3d dumpio: remove useless check
* syscall.c (dumpio): Remove SEN_printargs check.  Use tcp->s_ent->sen
directly.
2016-11-30 00:04:03 +00:00
07586a5b64 Fix dumping of io syscalls when descriptor argument has unused bits set
* syscall.c (dumpio): Explicitly cast the first argument of syscall
to "int", the same way as the kernel does.
* tests/read-write.c: Include <asm/unistd.h> and "kernel_types.h".
(k_read, k_write): New functions.
(test_dump, main): Use them.
2016-11-29 22:56:49 +00:00
54e164f630 x32: fix preadv2-pwritev2.test
* tests/preadv2-pwritev2.c: Include "kernel_types.h".
(main): Use kernel_ulong_t instead of unsigned long as types
of arguments of preadv2 and pwritev2 syscalls.
2016-11-29 19:51:15 +00:00
aad1e4a0bb x32: wire up preadv2 and pwritev2 syscalls
* linux/x32/syscallent.h [546]: Add preadv2 entry.
[547]: Add pwritev2 entry.
2016-11-29 10:05:16 +00:00
d454dac0dc signal: fix omission of field names in sigaction printers
* signal.c (decode_old_sigaction, decode_new_sigaction): Add printing
of the field names.
* tests/sigaction.awk: Update expected output.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-11-29 10:05:16 +00:00
ad53524377 Make date output format conform to ISO 8601
* util.c (sprinttime): Make date output conform to ISO 8601.
* tests/utime.c (print_tm): Update expected output.
* tests/xstatx.c (print_time): Likewise.
2016-11-29 10:05:16 +00:00
50e267c420 tests: rewrite utime.test without relying on libc utime wrapper
* tests/utime.c (k_utime): New function, a thin wrapper around
syscall(__NR_utime).
(main): Use it instead of utime.
* tests/utime.test: Update.
2016-11-29 04:08:47 +00:00
4399fa976a Fix meaning of negated sets in fault expressions
Change the parser of fault expression to follow the POLA:
-e fault=!SET
means that all syscalls except those from SET are subject to fault
injection;
-e fault=!SET1:error=ERRNO1, -e fault=!SET2:error=ERRNO2
means that all syscalls except those from SET2 are subject to fault
injection with error code ERRNO2, and all syscalls from SET2 that are
not in SET1 are subject to fault injection with error code ERRNO1.

* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
Handle negated QUAL_FAULT case differently.
* tests/fault_syntax.test: Add checks of negated sets.
2016-11-29 02:11:48 +00:00
c84536f975 print_sigevent: fix field names of sigev_value structure
* print_sigevent.c (print_sigevent): Change "int" to "sival_int", "ptr"
to "sival_ptr".
* tests/mq_sendrecv.c (main): Update expected output in accordance with
fixed field names.
* tests/timer_create.c (main): Likewise.
2016-11-29 00:33:01 +00:00
6602da1b90 tests: add more utime checks
* tests/utime.c: Include <unistd.h> and <asm/unistd.h>.
(main): Add checks for invalid pointers.
2016-11-29 00:27:51 +00:00
922712f8ff utime: fix omission of field names in utimbuf structure printing
* utime.c (SYS_FUNC(utime)): Print struct utimbuf as a structure,
not as an array (use curly brackets instead of square ones).
Add field names to the output.
* tests/utime.c (main): Update expected output.
2016-11-29 00:26:20 +00:00
d4d5aaa560 mem: print mincore output as an array
* mem.c (SYS_FUNC(minore)): Print commas between elements.
* tests/mincore.c (print_mincore): Update expected output in accordance
with syscall decoder formatting change.
2016-11-29 00:25:55 +00:00
a938b441d6 util: provide information whether xlat value has been found
This is necessary for the upcoming change in the output format
of the val3 argument of the FUTEX_WAKE_OP futex command.

* defs.h (printxvals, printxval_searchn): Change return type to int.
(printxval64, printxval, printxval_long): Likewise.  Forward the value
returned by printxvals call.
* util.c (printxvals, printxval_searchn): Change return type to int,
return 1 if xlat value has been found, 0 otherwise.
2016-11-29 00:23:13 +00:00
c1271b7341 util: check dflt argument for NULL in printxvals
This is necessary for the upcoming change in the output format
of the val3 argument of the FUTEX_WAKE_OP futex command.

* util.c (printxvals): Do not print dflt if it is NULL.
2016-11-29 00:22:05 +00:00
827b170b72 capability: fix omission of capability structure field names
* capability.c (print_cap_header, print_cap_data): Add field names
to the output.
* tests/caps.awk: Update test output.
2016-11-29 00:21:06 +00:00
447bdc55bf tests: fix "comparison between signed and unsigned" compilation warnings
* tests/readv.c (main): Cast r_len to int.
* tests/preadv2-pwritev2.c (dumpio): Likewise.
2016-11-28 20:55:10 +00:00
7b3b12b793 aarch64, arm, sparc: add comments on fault injection support in kernel
* linux/aarch64/set_scno.c: Note the kernel commit that introduced
NT_ARM_SYSTEM_CALL support.
* linux/arm/set_scno.c: Note the kernel commit that introduced
PTRACE_SET_SYSCALL support.
* linux/sparc/set_scno.c: Note the kernel commit that introduced
reloading from the syscall number register.
2016-11-28 19:46:50 +00:00
f3b5837608 tests: check -C option
* tests/strace-C.expected: New file.
* tests/strace-C.test: New test.
* tests/Makefile.am (MISC_TESTS): Add strace-C.test.
(EXTRA_DIST): Add strace-C.expected.
2016-11-28 16:57:30 +00:00
7e6f0b7b0c tests: check basic options syntax
* tests/options-syntax.test: New file.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-11-28 15:13:25 +00:00
0b98d8213e Fix -r option syntax
While -r option implies -t, it should not literally have the effect
of -t option, e.g. -rr should not increment tflag twice.

* strace.c (init): In the getopt loop, do not increment tflag for each
occurrence of -r option.  After the getopt loop, if rflag is set, set
tflag to 1.  Issue a warning that -tt has no effect with -r.
2016-11-28 15:13:25 +00:00
1aa0697738 Print timeval pair as an array of timeval entries
* print_timeval.c (print_timeval_item): New function.
(print_timeval_pair): Use it as a print_function in print_array call.
* tests/futimesat.c (main): Update to test new behaviour.
* tests/utimes.c (main): Likewise.
2016-11-28 04:38:42 +00:00
0bf550423c tests: treat tv_sec/tv_usec as signed types in futimesat and utimes tests
* tests/futimesat.c: Print tv_sec and tv_usec fields as signed types.
* tests/utimes.c: Likewise.
2016-11-28 04:26:35 +00:00
7491519823 alpha: print struct timeval32 consistently
* defs.h [ALPHA] (timeval32_t): New type.
[ALPHA] (print_timeval32_t): New prototype.
* print_timeval.c [ALPHA] (timeval32_t): Remove.
[ALPHA] (print_timeval32_t): Remove static keyword.
* printrusage.c [ALPHA] (printrusage32): Use timeval32_t instead
of local definition of struct timeval32.  Use print_timeval32_t.
2016-11-28 04:21:11 +00:00
70864ce6e0 Print struct timeval consistently
Use print_struct_timeval interface to print struct timeval.

* print_timeval.c (print_struct_timeval): New mpers printer.
* print_timex.c (print_timex): Use it.
* printrusage.c (printrusage): Likewise.
* v4l2.c (print_v4l2_buffer): Likewise.
* tests/getrusage.c (main): Print tv_sec and tv_usec fields as signed.
* tests/waitid.c (sprint_rusage): Likewise.

Suggested-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2016-11-28 04:07:37 +00:00
5f6a839d23 Split print_time.c
After commit v4.14-136-g151d1d1 that removed the last object common
for timespec and timeval parsers there is no need to keep them all
in a single file.

* print_timespec.c: New file.
* print_timeval.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* print_time.c: Move all timespec related code to print_timespec.c.
Move all timeval related code to print_timeval.c.
2016-11-28 02:45:13 +00:00
0aaa6976dd tests: check decoding of threads when a non-leader thread invokes execve
* tests/threads-execve.c: New file.
* tests/threads-execve.test: New test.
* tests/.gitignore: Add threads-execve.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(threads_execve_LDADD): New variable.
(MISC_TESTS): Add threads-execve.test.
2016-11-28 00:31:59 +00:00
f6c14637a3 tests: check decoding of fault injected exit_group syscall
* tests/answer.c: New file.
* tests/fault_injection-exit_group.expected: Likewise.
* tests/fault_injection-exit_group.test: New test.
* tests/.gitignore: Add answer.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fault_injection-exit_group.test.
(EXTRA_DIST): Add fault_injection-exit_group.expected.
2016-11-27 19:40:33 +00:00
2f948b9231 Set PTRACE_O_TRACEEXIT option and handle PTRACE_EVENT_EXIT events
Do not assume that some syscalls do not generate syscall-exit-stops.
When syscalls fail for any reason they may generate syscall-exit-stops.

The solution is to wait for an actual exit reported by PTRACE_EVENT_EXIT
and print the end of unfinished exiting syscall properly.

* exit.c: Remove.
* Makefile.am (strace_SOURCES): Remove exit.c.
* linux/dummy.h (sys_exit): Alias to printargs_d.
* strace.c (ptrace_setoptions): Add PTRACE_O_TRACEEXIT bit.
(print_event_exit): New function.
(trace): Use it in case of PTRACE_EVENT_EXIT.
* syscall.c (trace_syscall_entering): Remove special handling
of SEN_exit.
2016-11-27 14:22:58 +00:00
37c4d4bcfc Change printargs to return RVAL_DECODED
As printargs is invoked as a generic syscall decoder only and
it is not supposed to print anything on exiting, change printargs
to return RVAL_DECODED so it would not be called on exiting at all.

* util.c (printargs): Print args unconditionally, return RVAL_DECODED.
2016-11-27 14:22:58 +00:00
88017cbae8 Enhance error diagnostics of exit/exit_group decoder
* exit.c (SYS_FUNC(exit)): Print the name of syscall that has returned.
2016-11-26 20:54:31 +00:00
0c836eb060 Restrain from fault injection while the trace executes strace code
There is little use in injections of faults into syscalls made by strace.

* syscall.c (trace_syscall_entering): Clear QUAL_FAULT bit from
tcp->qual_flg when tcp->flags has TCB_HIDE_LOG bit set.
2016-11-26 20:54:01 +00:00
634a6a55e8 Move two global flags to tracee scope
A simultaneous use of -p option and tracing of a command available
since commit v4.11-183-gfa8c286 introduces a race condition because
the flags whether the first exec has happened are global.

Fix the race by moving hide_log_until_execve and hide_log_until_execve
global variables to TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
in struct tcb.flags, correspondingly.

* defs.h (TCB_HIDE_LOG, TCB_SKIP_DETACH_ON_FIRST_EXEC, hide_log):
New macros.
(hide_log_until_execve): Remove prototype.
* strace.c (skip_one_b_execve, hide_log_until_execve): Remove.
(startup_child): Set TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
in the allocated tcb structure.
(init): Remove initialization of hide_log_until_execve and
skip_one_b_execve.
(print_stopped): Use hide_log() instead of hide_log_until_execve.
(trace): Check and clear TCB_SKIP_DETACH_ON_FIRST_EXEC flag instead
of skip_one_b_execve.
* syscall.c (trace_syscall_entering): Clear TCB_HIDE_LOG flag instead of
hide_log_until_execve.
(trace_syscall_entering, trace_syscall_exiting): Check hide_log()
instead of hide_log_until_execve.
2016-11-26 19:47:38 +00:00
7910ac9638 Treat execveat as an execve family syscall
* syscall.c (trace_syscall_entering): Clear hide_log_until_execve flag
also when SEN_execveat is encountered.
2016-11-26 16:08:10 +00:00
d5b9c75d61 Change parser of fault expressions to conform the documentation
Make expressions like fault=SYSCALL1,SYSCALL2:error=EPERM work
as documented, i.e. fail both SYSCALL1 and SYSCALL2 with EPERM.

* syscall.c (parse_fault_expression): Remove const qualifier from
"name" and "token: variables, as well as from the return value.
(qual_fault): Remove const qualifier from "name" variables.
Split "name" into comma delimited tokens and pass each token
to individual qual_syscall_ex call.
(qualify): For QUAL_FAULT options, pass the whole option value
to their qualify methods without prior splitting into comma
delimited tokens.
* tests/fault_injection.test: Check it.
* tests/fault_syntax.test: Check empty syscall sets.
2016-11-25 23:47:32 +00:00
cba0d84def Simplify parse_fault_expression
* syscall.c (parse_fault_expression): Rewrite iterator over strtok_r
in a more concise way.
2016-11-24 21:35:05 +00:00
151d1d158c Fix omission of field names in printers of timeval structure
* print_time.c (time_fmt): Remove.
(timeval_fmt): New constant.
(print_timeval_t, sprint_timeval, print_timeval32_t, sprint_timeval32):
Use it instead of time_fmt.
* print_timex.c (print_timex): Print field names of the time field.
* printrusage.c (printrusage, printrusage32): Print field names
of ru_utime and ru_stime fields.
* tests/adjtimex.c (main): Add field names to expected output.
* tests/clock_nanosleep.c (main): Likewise.
* tests/futimesat.c (main): Likewise.
* tests/getrusage.c (main): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/oldselect.expected: Likewise.
* tests/utimes.c (main): Likewise.
* tests/wait4.c (sprint_rusage): Likewise.
* tests/waitid.c (sprint_rusage): Likewise.
* tests/xetitimer.c (main): Likewise.
* tests/xettimeofday.c (main): Likewise.
* tests/xselect.c (main): Likewise.
2016-11-26 00:40:53 +00:00
acdb08613e Fix omission of field names in printers of timespec structure
* print_time.c (timespec_fmt): New constant.
(print_timespec_t, sprint_timespec): Use it instead of time_fmt.
* tests/aio.c: Add field names to expected output.
* tests/clock_nanosleep.c (main): Likewise.
* tests/clock_xettime.c (main): Likewise.
* tests/futex.c (main): Likewise.
* tests/mq_sendrecv.c (do_send, do_recv): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/ppoll-v.expected: Likewise.
* tests/ppoll.expected: Likewise.
* tests/pselect6.c (main): Likewise.
* tests/recvmmsg-timeout.c (main): Likewise.
* tests/restart_syscall.c (main): Likewise.
* tests/rt_sigtimedwait.c (iterate, main): Likewise.
* tests/sched_rr_get_interval.c (main): Likewise.
* tests/semop.c (main): Likewise.
* tests/strace-T.expected: Likewise.
* tests/timer_xettime.c (main): Likewise.
* tests/timerfd_xettime.c (main): Likewise.
* tests/utimensat.c (print_ts): Likewise.
2016-11-26 00:40:53 +00:00
6daba2ec29 tests: robustify prctl-name.test against unrelated prctl invocations
* tests/prctl-name.test: Filter out unrelated PR_GET_* prctl calls.
2016-11-26 00:40:39 +00:00
994afa8b71 tests: cleanup prctl-name.c
* tests/prctl-name.c (main): Remove "len" variable, rename "len1"
to "len".  Remove "name1" variable, use "name" instead.
2016-11-22 01:46:07 +00:00
e4997ecb89 Move KVM_* ioctl entries from ioctls_inc*.h to ioctls_arch*.h
* linux/32/ioctls_inc_align32.h: Regenerate.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
2016-11-22 00:21:01 +00:00
5532ac185b maint: add more workarounds for alpha and powerpc
* maint/ioctls_sym.sh: Skip asm/core_*.h.  Filter out from
asm-generic/ioctls.h those macros that are defined using unavailable
struct termios2 on alpha and powerpc.
2016-11-22 00:21:01 +00:00
3317da7a3a Add ioctl definitions for 16-bit alignment
* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align16.h.
* linux/32/ioctls_inc_align16.h: New file.
* linux/32/ioctls_inc.h [M68K]: Include it.
2016-11-22 00:15:20 +00:00
702c5c29a1 maint: move KVM_* constants from ioctls_inc.h to ioctls_arch.h
* maint/ioctls_gen.sh: Place constants defined in linux/kvm.h
into ioctls_arch.h instead of ioctls_inc.h.
2016-11-22 00:15:20 +00:00
0bb5372ddd maint: harmonize use of ioctls_sym.sh
* maint/ioctls_gen.sh: Consistently specify INCLUDES for all
ioctls_sym.sh invocations.  Use $mydir to specify ioctls_sym.sh
location.
2016-11-21 22:34:05 +00:00
c06335cdd4 maint: rework workarounds for linux/kvm.h
* maint/ioctls_sym.sh: Remove pre-include linux/kvm.h workarounds.
Skip linux/kvm.h on those architectures that have no asm/kvm.h file.
Introduce post-process workarounds, add post-process workarounds
for linux/kvm.h.
2016-11-21 16:08:08 +00:00
e0bf512cfc Restructure strace.1
* strace.1 (OPTIONS): Add subsections.
(PROBLEMS): Rename to REPORTING BUGS.
(SEE ALSO): Move to the bottom.
2016-11-20 22:39:29 +00:00
10922d3112 prctl: implement decoding of PR_SET_FP_MODE and PR_GET_FP_MODE options
* xlat/pr_fp_mode.in: New file.
* prctl.c: Include "xlat/pr_fp_mode.h".
(SYS_FUNC(prctl)): Add handling for PR_SET_FP_MODE and PR_GET_FP_MODE
options.
2016-11-20 11:32:34 +00:00
c8af54e328 prctl: add braces for conditional blocks with else/else-if blocks having braces 2016-11-20 11:32:34 +00:00
6b7ad9947b prctl: cast arg2 to int in PR_SET_PTRACER handler
Kernel code does this when compares it with -1 (apart from comparing it with
PR_SET_PTRACER_ANY, which is also -1) in security/yama/yama_lsm.c.

* prctl.c (SYS_FUNC(prctl)) <PR_SET_PTRACER>: Cast arg2 to int before
comparing it with -1.
2016-11-20 11:32:34 +00:00
aeff861218 prctl: use getarg_ull for option value retrieval
The prctl syscall does not use compat on x32/n32, so argument types
are in fact kernel_ulong_t.

* prctl.c (print_prctl_args): Use getarg_ull, print as "%#llx" instead
of "%#lx".
(SYS_FUNC(prctl)): Use getarg_ull to store call arguments in arg2, arg3,
arg4, arg5 variables of type unsigned long long.  Use them in printing
routines.
(SYS_FUNC(arch_prctl)): Use getarg_ull to store call argument in addr
variable of type unsigned long long.  Print it as "%#llx" instead of
"%#lx".
2016-11-20 11:32:34 +00:00
1d82c0f8c0 block: add some definitions from <linux/blkpg.h>
This is done in order to fix build error on old distributions where
struct blkpg_ioctl_arg declaration is broken:

In file included from block.c:35:
/usr/include/linux/blkpg.h:36: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token
block.c: In function 'print_blkpg_req':
block.c:113: error: 'struct_blkpg_ioctl_arg' has no member named 'data'

(from SLE10)

* block.c: Include <linux/ioctl.h> instead of <linux/blkpg.h>.
(BLKPG, BLKPG_DEVNAMELTH, BLKPG_VOLNAMELTH): New macros.
(struct_blkpg_ioctl_arg, struct_blkpg_partition): New definitions,
copied from blkpg_ioctl_arg and blkpg_partition structures defined
in <linux/blkpg.h>.
2016-11-20 10:41:07 +00:00
2c9464c5a3 xlat: add values to new ARCH_* constants
Since UAPI header declares them under CONFIG_CHECKPOINT_RESTORE
and they would never be defined in user space.

* xlat/archvals.in: Add numeric values to ARCH_MAP_VDSO_* constants.
2016-11-20 02:41:30 +00:00
9eb38322fb prctl: include <linux/prctl.h> instead of <sys/prctl.h>
There are no users of prctl function in prctl.c, and all the rest
is provided by <linux/prctl.h> anyway.

* prctl.c: Include <linux/prctl.h> instead of <sys/prctl.h>.
2016-11-20 02:00:35 +00:00
9e8b95977d tests: check decoding of prctl PR_GET_NAME/PR_SET_NAME operations
* tests/prctl-name.c: New file.
* tests/prctl-name.test: New test.
* tests/.gitignore: Add prctl-name.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-name.test.
2016-11-20 01:33:16 +00:00
43017ef466 prctl: fix printing of PR_SET_NAME's argument
* prctl.c (SYS_FUNC(prctl)): Use printstr_ex with QUOTE_0_TERMINATED
instead of printstr to print the argument of PR_SET_NAME and PR_GET_NAME
operations.
2016-11-20 01:33:16 +00:00
52b85c6fdf printstr_ex: fix handling of last byte when QUOTE_0_TERMINATED bit set
* util.c (printstr_ex): Simplify handling of size == 0 case.
Do not artificially decrement size when QUOTE_0_TERMINATED bit is set.
Ensure that str[size] byte is non-zero if it hasn't been fetched.
2016-11-20 00:29:46 +00:00
03d65a05b9 printstr_ex: handle QUOTE_0_TERMINATED bit consistently
When user_style has QUOTE_0_TERMINATED bit set, printstr_ex prints
the fetched string as a NUL-terminated.
After this change, the string is being fetched as a NUL-terminated, too.

* util.c (printstr_ex): Use umovestr instead of umoven
if QUOTE_0_TERMINATED bit is set.
2016-11-19 21:01:03 +00:00
ead746af18 Cleanup fetch part of printstr_ex
* util.c (printstr_ex): Initialize "style" early, unify error handling.
2016-11-19 16:33:37 +00:00
6931903807 Update prctl ARCH_* constants
* xlat/archvals.in: Add ARCH_MAP_VDSO_X32, ARCH_MAP_VDSO_32, and
ARCH_MAP_VDSO_64 introduced by linux kernel commit v4.9-rc1~155^2~6.
2016-11-18 15:23:35 +00:00
76b57d67f0 Update V4L2_* constants
* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_TOUCH introduced
by linux kernel commit v4.9-rc4~7^2~422.
* xlat/v4l2_input_types.in: Add V4L2_CAP_TOUCH introduced
by linux kernel commit v4.9-rc4~7^2~422.
2016-11-18 15:23:35 +00:00
841744c4c9 Update fs *_MAGIC constants
* xlat/fsmagic.in: Add DAXFS_MAGIC introduced by linux kernel commit
v4.9-rc1~45^2^2~5.
2016-11-18 15:23:35 +00:00
2a914e6c1f Update MS_* constants
* xlat/mount_flags.in: Add MS_NOREMOTELOCK introduced
by linux kernel commit v4.9-rc1~57^2~1^2~7.
2016-11-18 15:23:35 +00:00
c4e428bd22 Update FALLOC_* constants
* xlat/falloc_flags.in: Add FALLOC_FL_UNSHARE_RANGE introduced
by linux kernel commit v4.9-rc1~31^2~69.
2016-11-18 15:23:35 +00:00
75cfe3346b Update BTRFS_* constants
* xlat/btrfs_features_compat_ro.in: Add
BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID introduced
by linux kernel commit v4.9-rc1~7^2^2~4.
2016-11-18 15:23:35 +00:00
a082fe833e Update BPF_* constants
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_PERF_EVENT introduced
by linux kernel commit v4.9-rc1~127^2~302^2~4.
2016-11-18 15:23:35 +00:00
79dca294d1 make-dist: use HEAD for making distribution package
* make-dist: Use HEAD commit instead of master branch by default.
2016-11-18 12:57:02 +00:00
95308d89ce tests: fix btrfs build error on some old systems
Fix the following build error on SLE 11 SP4:

btrfs.c: In function 'btrfs_test_dev_replace_ioctl':
btrfs.c:1570: error: unknown field 'start' specified in initializer

* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Move initialization
of struct btrfs_ioctl_dev_replace_args.start.srcdevid out of the
designated initializer.
2016-11-18 00:51:37 +00:00
f860e8c3e0 tests: check decoding of ERESTARTSYS error code
* tests/erestartsys.c: New file.
* tests/erestartsys.test: New test.
* tests/.gitignore: Add erestartsys.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add erestartsys.test.
2016-11-18 00:28:29 +00:00
57506ae00f Fix signame usage in qual_signal
Do not assume that the string returned by signame starts with "SIG"
prefix, this is not always the case.

* syscall.c (qual_signal): Skip signame return value
when it does not have "SIG" prefix.
2016-11-18 00:11:39 +00:00
8f73dc556e tests: check -e signal=set syntax
* tests/qual_signal.c: New file.
* tests/qual_signal.test: New test.
* tests/.gitignore: Add qual_signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_signal.test.
2016-11-18 00:11:27 +00:00
1658e9d4c6 Make -e fault= expressions cumulative
Change the way how subsequent -e fault= expressions are interpreted
to implement a cumulative behavior.  For example,
-e fault=file:when=3+ -e fault=chdir
now specifies that all chdir syscalls and 3+ file related syscalls
except chdir are subject for fault injection.

* syscall.c (qualify): Do not reset qual_vec for QUAL_FAULT.
* tests/fault_injection.test: Check it.
2016-11-17 15:44:21 +00:00
622af42dc3 tests: check syscall fault injection
* tests/fault_injection.c: New file.
* tests/fault_injection.test: New test.
* tests/fault_syntax.test: Likewise.
* tests/.gitignore: Add fault_injection.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add fault_injection.test and fault_syntax.test.
2016-11-16 17:27:46 +00:00
9cb6e03d4f Implement syscall fault injection
Introduce new -e fault=EXPR syntax that can be used to specify a subset
of syscalls that are subject of syscall fault injection, an error code
that has to be injected, and a frequency of injection.

The expression specifying syscall fault injection has the following
format: SET[:error=ERRNO][:when=FIRST[+[STEP]]]
where only SET is a required part and all the rest is optional.

The method used to implement syscall fault injection is the following:
on entering syscall the syscall number is substituted by an invalid
syscall number -1, and on exiting syscall the error code returned by
the kernel is substituted with the error code specified in the fault
expression.

This implementaion is based on the prototype developed
by Nahim El Atmani as a part of his GSoC 2016 strace project.

* defs.h (struct fault_opts): New forward declaration.
(struct tcb): Add fault_vec field.
(TCB_FAULT_INJ, QUAL_FAULT): New macros.
* strace.1: Document -e fault expression syntax.
* strace.c (usage): Mention -e fault expression.
(droptcb): Deallocate fault_vec member.
* syscall.c (qual_fault, arch_set_scno, arch_set_error): New prototypes.
(qual_options): Add "fault" option.
(struct fault_opts): New structure.
(num_faults): New variable.
(fault_vec): New array.
(syscall_fault_injected, tcb_fault_opts, reallocate_fault,
find_errno_by_name, qual_syscall_ex, strip_prefix, parse_fault_token,
parse_fault_expression, qual_fault, inject_syscall_fault_entering,
update_syscall_fault_exiting): New functions.
(qual_syscall): Use qual_syscall_ex.
(qualify_one): Add argument: a pointer to struct fault_opts, all callers
changed.  Copy struct fault_opts from the pointer to fault_vec.
Use reallocate_fault.
(qualify_scno, qualify_syscall_class, qualify_syscall_name): Add
argument: a pointer to struct fault_opts.
(qualify): Use reallocate_fault.  Do not check "all" class for
QUAL_FAULT qualifier.
(lookup_class): Check for "all" class.
(trace_syscall_entering): Use inject_syscall_fault_entering.
(trace_syscall_exiting): Use update_syscall_fault_exiting.  Clear
TCB_FAULT_INJ flag along with TCB_INSYSCALL.  Print " (INJECTED)" suffix
when the syscall has been injected successfully.
[ARCH_REGS_FOR_GETREGSET && !HAVE_GETREGS_OLD]
(ptrace_setregset): New function.
(ptrace_setregset_or_setregs): Define to ptrace_setregset.
[ARCH_REGS_FOR_GETREGS && !HAVE_GETREGS_OLD]
(ptrace_setregs): New function.
(ptrace_setregset_or_setregs): Define to ptrace_setregs.
[ptrace_setregset_or_setregs] (set_regs): New function.
Include "set_scno.c" and "set_error.c"
* NEWS: Mention this enhancement.
2016-11-16 17:26:58 +00:00
f1d0729f17 Implement arch specific methods of changing syscall number and error code
This introduces arch_set_error and arch_set_scno functions for each
supported architecture, needed to implement syscall fault injection.

* linux/aarch64/set_error.c: New file.
* linux/aarch64/set_scno.c: Likewise.
* linux/alpha/set_error.c: Likewise.
* linux/alpha/set_scno.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arc/set_scno.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/arm/set_scno.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/avr32/set_scno.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/bfin/set_scno.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/crisv10/set_scno.c: Likewise.
* linux/crisv32/set_error.c: Likewise.
* linux/crisv32/set_scno.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/hppa/set_scno.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/i386/set_scno.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/ia64/set_scno.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/m68k/set_scno.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/metag/set_scno.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/microblaze/set_scno.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/mips/set_scno.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/nios2/set_scno.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/or1k/set_scno.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/powerpc/set_scno.c: Likewise.
* linux/powerpc64/set_error.c: Likewise.
* linux/powerpc64/set_scno.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/riscv/set_scno.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/s390/set_scno.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh/set_scno.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sh64/set_scno.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc/set_scno.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/sparc64/set_scno.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/tile/set_scno.c: Likewise.
* linux/x32/set_error.c: Likewise.
* linux/x32/set_scno.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/x86_64/set_scno.c: Likewise.
* linux/xtensa/set_error.c: Likewise.
* linux/xtensa/set_scno.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2016-11-16 02:33:13 +00:00
05a3b0b518 cris: add syscall tables
The incomplete CRIS support introduced by commit v4.5.18-77-gea0e6e8
should not have been merged because it lacks essential parts, e.g.
syscall tables.

This change adds missing syscall tables for crisv10 and crisv32.

* linux/crisv10/syscallent.h: New file.
* linux/crisv32/syscallent.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2016-11-16 02:32:43 +00:00
081b2a821b Introduce string_to_uint_ex and string_to_uint_upto functions
* defs.h (string_to_uint_ex): New prototype.
(string_to_uint_upto): New function, a thin wrapper around
string_to_uint_ex.
* util.c (string_to_uint_ex): New function.
(string_to_uint): Change into a thin wrapper around string_to_uint_upto.
* strace.c (init): Use string_to_uint_upto.
* syscall.c (qualify_scno, qual_signal, qual_desc): Use
string_to_uint_upto instead of string_to_uint.
2016-11-16 01:41:51 +00:00
0323fa3217 Split qual_syscall into separate functions
Split qual_syscall into qualify_scno, qualify_syscall_class,
and qualify_syscall_name.
This might be needed later to implement syscall fault injection.

* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
New functions.
(qual_syscall): Use them.
2016-11-16 01:41:51 +00:00
b299b3e611 xtensa: wire up new syscalls
* linux/xtensa/syscallent.h [342..347]: New entries.
2016-11-15 01:09:51 +00:00
5df31f90ec arc: wire up new syscalls
* linux/arc/syscallent.h [247, 248]: New entries.
2016-11-14 01:07:59 +00:00
24eb02da83 tests: fix potential compilation warning in ioctl_block.c
ioctl_block.c:48: warning: 'init_magic' defined but not used

* tests/ioctl_block.c (init_magic): Define only for
[BLKTRACESETUP && HAVE_STRUCT_BLK_USER_TRACE_SETUP].
2016-11-13 22:29:30 +00:00
98a93b46fd Add support for pkey_mprotect, pkey_alloc, pkey_free syscalls
* linux/32/syscallent.h: Add syscall entries for pkey_* calls.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* mem.c (do_mprotect): New function, common handler for mprotect and
pkey_mprotect.
(SYS_FUNC(mprotect)): Convert to wrapper around do_mprotect.
(SYS_FUNC(pkey_mprotect)): New function.
* xlat/pkey_access.in: New file.
* pkeys.c: New file containing implementation of pkey_alloc and
pkey_free.
* Makefile.am: Add it.
* NEWS: Mention this enhancement.
* tests/.gitignore: Add pkey_alloc, pkey_free, and pkey_mprotect.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pkey_alloc.test, pkey_free.test, and
pkey_mprotect.test.
* tests/pkey_alloc.c: New file.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/pkey_alloc.test: New test.
* tests/pkey_free.test: Likewise.
* tests/pkey_mprotect.test: Likewise.
2016-11-13 21:41:58 +00:00
13c467bf69 tests: fix "constant is too large" compilation warnings
alarm.c: In function 'main':
alarm.c:41: warning: integer constant is too large for 'long' type
aio.c: In function 'main':
aio.c:162: warning: integer constant is too large for 'long' type
btrfs.c: In function 'btrfs_test_sync_ioctls':
btrfs.c:202: warning: integer constant is too large for 'long' type
btrfs.c: In function 'btrfs_test_subvol_ioctls':
btrfs.c:289: warning: integer constant is too large for 'long' type
btrfs.c:290: warning: integer constant is too large for 'long' type
dup2.c: In function 'main':
dup2.c:12: warning: integer constant is too large for 'long' type
dup2.c:13: warning: integer constant is too large for 'long' type
dup3.c: In function 'main':
dup3.c:13: warning: integer constant is too large for 'long' type
dup3.c:14: warning: integer constant is too large for 'long' type
epoll_create.c: In function 'main':
epoll_create.c:12: warning: integer constant is too large for 'long' type
epoll_ctl.c: In function 'invoke_syscall':
epoll_ctl.c:14: warning: integer constant is too large for 'long' type
faccessat.c: In function 'main':
faccessat.c:13: warning: integer constant is too large for 'long' type
fchdir.c: In function 'main':
fchdir.c:12: warning: integer constant is too large for 'long' type
struct_flock.c: In function 'invoke_test_syscall':
struct_flock.c:48: warning: integer constant is too large for 'long' type
struct_flock.c: In function 'test_flock_einval':
struct_flock.c:58: warning: integer constant is too large for 'long' type
struct_flock.c:59: warning: integer constant is too large for 'long' type
fcntl64.c: In function 'test_flock64_einval':
fcntl64.c:44: warning: integer constant is too large for 'long' type
fcntl64.c:45: warning: integer constant is too large for 'long' type
fcntl.c: In function 'test_flock64_einval':
fcntl.c:44: warning: integer constant is too large for 'long' type
fcntl.c:45: warning: integer constant is too large for 'long' type
fdatasync.c: In function 'main':
fdatasync.c:12: warning: integer constant is too large for 'long' type
flock.c: In function 'main':
flock.c:13: warning: integer constant is too large for 'long' type
xstatx.c: In function 'main':
xstatx.c:255: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatfsx.c: In function 'main':
xstatfsx.c:113: warning: integer constant is too large for 'long' type
fsync.c: In function 'main':
fsync.c:12: warning: integer constant is too large for 'long' type
ftruncate64.c: In function 'main':
ftruncate64.c:39: warning: integer constant is too large for 'long' type
futimesat.c: In function 'main':
futimesat.c:52: warning: integer constant is too large for 'long' type
futimesat.c:59: warning: integer constant is too large for 'long' type
get_mempolicy.c: In function 'main':
get_mempolicy.c:83: warning: integer constant is too large for 'long' type
get_mempolicy.c:84: warning: integer constant is too large for 'long' type
get_mempolicy.c:85: warning: integer constant is too large for 'long' type
get_mempolicy.c:86: warning: integer constant is too large for 'long' type
getdents.c: In function 'main':
getdents.c:109: warning: integer constant is too large for 'long' type
getdents.c:110: warning: integer constant is too large for 'long' type
getdents.c:114: warning: integer constant is too large for 'long' type
getdents64.c: In function 'main':
getdents64.c:114: warning: integer constant is too large for 'long' type
getdents64.c:115: warning: integer constant is too large for 'long' type
getdents64.c:119: warning: integer constant is too large for 'long' type
xgetrlimit.c: In function 'main':
xgetrlimit.c:71: warning: integer constant is too large for 'long' type
ioctl_block.c:44: warning: integer constant is too large for 'long' type
ioctl_block.c: In function 'main':
ioctl_block.c:136: warning: integer constant is too large for 'long' type
ioctl_block.c:137: warning: integer constant is too large for 'long' type
ioctl_block.c:161: warning: integer constant is too large for 'long' type
ioctl_block.c:170: warning: integer constant is too large for 'long' type
ioctl_block.c:171: warning: integer constant is too large for 'long' type
ioctl_evdev.c:42: warning: integer constant is too large for 'long' type
ioctl_mtd.c:46: warning: integer constant is too large for 'long' type
ioctl_rtc.c:40: warning: integer constant is too large for 'long' type
ioperm.c: In function 'main':
ioperm.c:12: warning: integer constant is too large for 'long' type
ioctl_v4l2.c: In function 'main':
ioctl_v4l2.c:409: warning: integer constant is too large for 'long' type
ipc.c: In function 'ipc_call':
ipc.c:52: warning: integer constant is too large for 'long' type
kill.c: In function 'main':
kill.c:59: warning: integer constant is too large for 'long' type
kill.c:62: warning: integer constant is too large for 'long' type
kill.c:63: warning: integer constant is too large for 'long' type
kill.c:68: warning: integer constant is too large for 'long' type
linkat.c: In function 'main':
linkat.c:14: warning: integer constant is too large for 'long' type
linkat.c:15: warning: integer constant is too large for 'long' type
mbind.c: In function 'main':
mbind.c:41: warning: integer constant is too large for 'long' type
mbind.c:43: warning: integer constant is too large for 'long' type
mbind.c:44: warning: integer constant is too large for 'long' type
migrate_pages.c: In function 'main':
migrate_pages.c:41: warning: integer constant is too large for 'long' type
In file included from mkdirat.c:10:
umode_t.c: In function 'test_syscall':
umode_t.c:47: warning: integer constant is too large for 'long' type
mknod.c: In function 'call_mknod':
mknod.c:16: warning: integer constant is too large for 'long' type
mknod.c: In function 'main':
mknod.c:23: warning: integer constant is too large for 'long' type
mknod.c:49: warning: integer constant is too large for 'long' type
mknod.c:56: warning: integer constant is too large for 'long' type
mknodat.c:12: warning: integer constant is too large for 'long' type
mknodat.c: In function 'call_mknodat':
mknodat.c:17: warning: integer constant is too large for 'long' type
mknodat.c: In function 'main':
mknodat.c:24: warning: integer constant is too large for 'long' type
mknodat.c:50: warning: integer constant is too large for 'long' type
mknodat.c:57: warning: integer constant is too large for 'long' type
mmap.c: In function 'main':
mmap.c:51: warning: integer constant is too large for 'long' type
move_pages.c: In function 'print_stat_pages':
move_pages.c:139: warning: integer constant is too large for 'long' type
move_pages.c: In function 'print_move_pages':
move_pages.c:166: warning: integer constant is too large for 'long' type
move_pages.c: In function 'main':
move_pages.c:188: warning: integer constant is too large for 'long' type
mq_sendrecv.c: In function 'main':
mq_sendrecv.c:238: warning: integer constant is too large for 'long' type
mq_sendrecv.c:401: warning: integer constant is too large for 'long' type
mq_sendrecv.c:403: warning: integer constant is too large for 'long' type
nsyscalls.c: In function 'test_syscall':
nsyscalls.c:64: warning: integer constant is too large for 'long' type
nsyscalls.c:65: warning: integer constant is too large for 'long' type
nsyscalls.c:66: warning: integer constant is too large for 'long' type
nsyscalls.c:67: warning: integer constant is too large for 'long' type
nsyscalls.c:68: warning: integer constant is too large for 'long' type
nsyscalls.c:69: warning: integer constant is too large for 'long' type
preadv-pwritev.c: In function 'main':
preadv-pwritev.c:162: warning: comparison between signed and unsigned
prlimit64.c: In function 'main':
prlimit64.c:65: warning: integer constant is too large for 'long' type
prlimit64.c:70: warning: integer constant is too large for 'long' type
remap_file_pages.c: In function 'main':
remap_file_pages.c:42: warning: integer constant is too large for 'long' type
remap_file_pages.c:43: warning: integer constant is too large for 'long' type
remap_file_pages.c:45: warning: integer constant is too large for 'long' type
renameat.c: In function 'main':
renameat.c:15: warning: integer constant is too large for 'long' type
renameat.c:16: warning: integer constant is too large for 'long' type
rt_sigqueueinfo.c: In function 'main':
rt_sigqueueinfo.c:41: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c: In function 'k_tgsigqueueinfo':
rt_tgsigqueueinfo.c:45: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c:46: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c:47: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c: In function 'main':
rt_tgsigqueueinfo.c:67: warning: integer constant is too large for 'long' type
sendfile.c: In function 'main':
sendfile.c:110: warning: integer constant is too large for 'long' type
sendfile64.c: In function 'main':
sendfile64.c💯 warning: integer constant is too large for 'long' type
set_mempolicy.c: In function 'main':
set_mempolicy.c:129: warning: integer constant is too large for 'long' type
set_mempolicy.c:130: warning: integer constant is too large for 'long' type
setrlimit.c: In function 'main':
setrlimit.c:44: warning: integer constant is too large for 'long' type
socketcall.c: In function 'test_socketcall':
socketcall.c:58: warning: integer constant is too large for 'long' type
splice.c: In function 'main':
splice.c:41: warning: integer constant is too large for 'long' type
splice.c:42: warning: integer constant is too large for 'long' type
splice.c:45: warning: integer constant is too large for 'long' type
splice.c:46: warning: integer constant is too large for 'long' type
symlinkat.c: In function 'main':
symlinkat.c:12: warning: integer constant is too large for 'long' type
sync_file_range.c: In function 'main':
sync_file_range.c:42: warning: integer constant is too large for 'long' type
sync_file_range.c:43: warning: integer constant is too large for 'long' type
syslog.c: In function 'main':
syslog.c:14: warning: integer constant is too large for 'long' type
tee.c: In function 'main':
tee.c:41: warning: integer constant is too large for 'long' type
tee.c:42: warning: integer constant is too large for 'long' type
timer_create.c: In function 'main':
timer_create.c:52: warning: integer constant is too large for 'long' type
timer_create.c:84: warning: integer constant is too large for 'long' type
timer_create.c:85: warning: integer constant is too large for 'long' type
truncate64.c: In function 'main':
truncate64.c:41: warning: integer constant is too large for 'long' type
xgetrlimit.c: In function 'main':
xgetrlimit.c:71: warning: integer constant is too large for 'long' type
umode_t.c: In function 'test_syscall':
umode_t.c:46: warning: integer constant is too large for 'long' type
unlinkat.c: In function 'main':
unlinkat.c:13: warning: integer constant is too large for 'long' type
waitpid.c: In function 'main':
waitpid.c:43: warning: integer constant is too large for 'long' type
waitid.c: In function 'poison':
waitid.c:141: warning: integer constant is too large for 'long' type
xetpriority.c: In function 'main':
xetpriority.c:15: warning: integer constant is too large for 'long' type
xetpriority.c:19: warning: integer constant is too large for 'long' type
xetpriority.c:20: warning: integer constant is too large for 'long' type
xetpgid.c: In function 'main':
xetpgid.c:43: warning: integer constant is too large for 'long' type
xetpgid.c:47: warning: integer constant is too large for 'long' type
xetpgid.c:48: warning: integer constant is too large for 'long' type

(SLES 11SP4, i386)

* tests/alarm.c (main): Add proper suffix to integer constant.
* tests/aio.c (main): Likewise.
* tests/btrfs.c (btrfs_test_sync_ioctls, btrfs_test_subvol_ioctls): Likewise.
* tests/dup2.c (main): Likewise.
* tests/dup3.c (main): Likewise.
* tests/epoll_create.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Likewise.
* tests/faccessat.c (main): Likewise.
* tests/fchdir.c (main): Likewise.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval): Likewise.
* tests/fdatasync.c (main): Likewise.
* tests/flock.c (main): Likewise.
* tests/fstat64.c (SAMPLE_SIZE): Likewise.
* tests/fstat.c (SAMPLE_SIZE): Likewise.
* tests/fsync.c (main): Likewise.
* tests/ftruncate64.c (main): Likewise.
* tests/futimesat.c (main): Likewise.
* tests/get_mempolicy.c (main): Likewise.
* tests/getdents.c (main): Likewise.
* tests/getdents64.c (main): Likewise.
* tests/ioctl_block.c (lmagic, main): Likewise.
* tests/ioctl_evdev.c (lmagic): Likewise.
* tests/ioctl_mtd.c (lmagic): Likewise.
* tests/ioctl_rtc.c (lmagic): Likewise.
* tests/ioctl_v4l2.c (main): Likewise.
* tests/ioperm.c (main): Likewise.
* tests/ipc.c (ipc_call): Likewise.
* tests/kill.c (main): Likewise.
* tests/linkat.c (main): Likewise.
* tests/lstat64.c (SAMPLE_SIZE): Likewise.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/mbind.c (main): Likewise.
* tests/migrate_pages.c (main): Likewise.
* tests/mkdirat.c (TEST_SYSCALL_PREFIX_ARGS): Likewise.
* tests/mknod.c (call_mknod, main): Likewise.
* tests/mknodat.c (fd, call_mknodat, main): Likewise.
* tests/mmap.c (main): Likewise.
* tests/move_pages.c (print_stat_pages, print_move_pages): Likewise.
* tests/mq_sendrecv.c (main): Likewise.
* tests/nsyscalls.c (test_syscall): Likewise.
* tests/prlimit64.c (main): Likewise.
* tests/remap_file_pages.c (main): Likewise.
* tests/renameat.c (main): Likewise.
* tests/rt_sigqueueinfo.c (main): Likewise.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo, main): Likewise.
* tests/sendfile.c (main): Likewise.
* tests/sendfile64.c (main): Likewise.
* tests/set_mempolicy.c (main): Likewise.
* tests/setrlimit.c (main): Likewise.
* tests/socketcall.c (test_socketcall): Likewise.
* tests/splice.c (main): Likewise.
* tests/stat64.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/struct_flock.c (invoke_test_syscall, test_flock_einval): Likewise.
* tests/symlinkat.c (main): Likewise.
* tests/sync_file_range.c (main): Likewise.
* tests/syslog.c (main): Likewise.
* tests/tee.c (main): Likewise.
* tests/timer_create.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/umode_t.c (test_syscall): Likewise.
* tests/unlinkat.c (main): Likewise.
* tests/waitid.c (main): Likewise.
* tests/waitpid.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
* tests/xgetrlimit.c (main): Likewise.
* tests/xstatfsx.c (main) [CHECK_ODD_SIZE]: Likewise.
* tests/xstatx.c (main): Likewise.
2016-11-13 21:36:58 +00:00
35126cda20 tests: fix "comparison between signed and unsigned" compilation warnings
preadv-pwritev.c: In function 'main':
preadv-pwritev.c:162: warning: comparison between signed and unsigned
readv.c: In function 'main':
readv.c:148: warning: comparison between signed and unsigned
recvmsg.c: In function 'main':
recvmsg.c:148: warning: comparison between signed and unsigned

* tests/preadv-pwritev.c (main): Cast r_len to int.
* tests/readv.c (main): Likewise.
* tests/recvmsg.c (main): Likewise.
2016-11-13 19:30:11 +00:00
695545a8b3 syscall.c: refactor getregs_old fallback in get_regs
This change moves remaining arch specific getregs_old code into
appropriate arch subdirectories and removes unnecessary code
duplication.

* linux/getregs_old.h: New file.
* linux/powerpc/getregs_old.h: Likewise.
* linux/powerpc64/getregs_old.h: Likewise.
* linux/x86_64/getregs_old.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* syscall.c: Include "getregs_old.h".
[X86_64 || POWERPC]: Remove.
[ARCH_REGS_FOR_GETREGSET] (ptrace_getregset_or_getregs): Define
to ptrace_getregset.
[ARCH_REGS_FOR_GETREGS] (ptrace_getregset_or_getregs): Define
to ptrace_getregs.
(get_regs): Check for ptrace_getregset_or_getregs instead
of ARCH_REGS_FOR_GETREGSET and ARCH_REGS_FOR_GETREGS.  Use
ptrace_getregset_or_getregs instead of ptrace_getregset and
ptrace_getregs.  Check for HAVE_GETREGS_OLD instead of X86_64
and POWERPC.  Use use_getregs_old instead of getregset_support
and old_kernel.
2016-11-13 11:16:15 +00:00
e061d67dff Rename BUILD_BUG_ON_ZERO macro
In order to avoid name clash on distributions which decide to include
kernel headers instead of UAPI ones.  For example, on SLES 11SP4:

gcc -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux -I. -Wall -O2 -c net.c
In file included from /usr/include/linux/sysctl.h:25:0,
                 from /usr/include/linux/netfilter.h:6,
                 from /usr/include/linux/netfilter_arp.h:8,
                 from /usr/include/linux/netfilter_arp/arp_tables.h:14,
                 from net.c:60:
net.c: In function 'print_packet_mreq':
gcc_compat.h:59:27: error: negative width in bit-field '<anonymous>'
 # define MUST_BE_ARRAY(a) BUILD_BUG_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
                           ^
defs.h:76:53: note: in expansion of macro 'MUST_BE_ARRAY'
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
                                                     ^
net.c:747:22: note: in expansion of macro 'ARRAY_SIZE'
   if (mreq.mr_alen > ARRAY_SIZE(mreq.mr_address))
                      ^
due to the fact BUILD_BUG_ON_ZERO is already defined in <linux/kernel.h>.

* gcc_compat.h (BUILD_BUG_ON_ZERO): Rename to FAIL_BUILD_ON_ZERO.
(MUST_BE_ARRAY): Update usage.
2016-11-13 11:04:49 +00:00
c93f39ca5b syscall.c: factor out ptrace_getregs from get_regs
Move the code that calls ptrace(PTRACE_GETREGS) to a separate function.

* syscall.c (ptrace_getregs): New function.
(get_regs): Use it.
2016-11-12 21:29:58 +00:00
1d886734c7 syscall.c: rename get_regset to ptrace_getregset
* syscall.c (get_regset): Rename to ptrace_getregset.
(get_regs): Rename get_regset to ptrace_getregset.
2016-11-12 21:29:58 +00:00
a00648aa2b m68k: switch to PTRACE_GETREGS
* Makefile.am (EXTRA_DIST): Add linux/m68k/arch_regs.h, remove
linux/m68k/get_syscall_result.c.
* linux/m68k/arch_regs.c (m68k_d0, ARCH_PC_PEEK_ADDR): Don't
define.
(m68k_regs, m68k_usp_ptr, ARCH_PC_REG, ARCH_REGS_FOR_GETREGS):
Define.
* linux/m68k/arch_regs.h: New file.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use m68k_usp_ptr.
* linux/m68k/get_error.c (get_error): Use m68k_regs.d0.
* linux/m68k/get_scno.c (arch_get_scno): Use m68k_regs.orig_d0.
* linux/m68k/get_syscall_args.c (get_syscall_args): Use m68k_regs.
* linux/m68k/get_syscall_result.c: Remove.
2016-11-12 21:29:58 +00:00
f8d3d18f39 tests: do not run old_mmap test on m68k
* tests/old_mmap.c: Skip test on m68k.
2016-11-12 21:29:58 +00:00
5e33997559 syscall.c: introduce reallocate_vec function
This might be needed later to implement syscall fault injection.

* syscall.c (reallocate_vec): New function.
(reallocate_qual): Use it.
2016-11-12 21:29:58 +00:00
5d2293dea6 Fix prototypes of qual_desc, qual_signal, and qual_syscall functions
* syscall.c (qual_desc, qual_signal, qual_syscall): Fix prototypes.
(struct qual_options): Fix type of "qualify" member.
2016-11-12 21:29:58 +00:00
f793bda073 linux/x32/syscallent.h: fix syscallent array initialisation on x32
Why gcc didn't complain about it? It is definitely an index clash.

* linux/x32/syscallent.h: Change initializer indices for empty records from
[327 ... 511] to [329 ... 511].
2016-11-12 21:03:55 +03:00
b5b750b289 Introduce upoke function
This will be needed to implement fault injection on those architectures
that lack PTRACE_SETREGSET/PTRACE_SETREGS support.

* defs.h (upoke): New prototype.
* upoke.c: New file.
* Makefile.am (libstrace_a_SOURCES): Add it.
2016-11-11 17:53:44 +00:00
d3fc04ebdf Update ioctl entries from linux 4.9
* linux/32/ioctls_inc_align32.h: Update from linux v4.9 using ioctls_gen.sh.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* NEWS: Mention this.
2016-11-11 17:53:28 +00:00
916b0c3594 Update NEWS 2016-11-10 22:44:49 +03:00
a507a0bb77 Add support for decoding of DM_* ioctl commands
* dm.c: New file.
* xlat/dm_flags.in: Likewise.
* Makefile.am (strace_SOURCES): Add dm.c.
* configure.ac (AC_CHECK_HEADERS): Add linux/dm-ioctl.h.
* defs.h (dm_ioctl): New prototype.
* ioctl.c (ioctl_decode) [HAVE_LINUX_DM_IOCTL_H]: Call dm_ioctl
for 0xfd ioctl type.
* tests/ioctl_dm.c: New file.
* tests/ioctl_dm-v.c: Likewise.
* tests/ioctl_dm.test: New test.
* tests/ioctl_dm-v.test: Likewise.
* tests/.gitignore: Add ioctl_dm and ioctl_dm-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_dm.test and ioctl_dm-v.test.

Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2016-11-10 22:44:49 +03:00
98b944bb66 Introduce ALIGNOF macro
* gcc_compat.h (ALIGNOF): New macro.
2016-11-10 22:44:49 +03:00
fdd97aac53 util: add support for QUOTE_0_TERMINATED in user_style to ptrintstr_ex
This enables printing size-limited (expectedly) ASCIZ strings.

This is done by increasing umoven size limit for sized strings by one
byte above max_strlen (enabling copying possible NUL byte in case len is
greater than max_strlen) and decreasing size after copying by one byte
in case QUOTE_0_TERMINATED is set (due to user_style or usage of len of
-1).  As a result, there is one excess byte for string_quote in case
QUOTE_0_TERMINATED is set so string_quote can check for NUL termination
of strings up to size bytes in size (which is len or max_strlen, whatever
is greater).

The catch here is that when string is not properly NUL-terminated and
QUOTE_0_TERMINATED is provided in user_style and len is less than
max_strlen then last non-NUL byte is not printed.  But ellipsis is
printed instead, being indication that string is not terminated
properly.  QUOTE_OMIT_TRAILING_0 should be used instead in case this
behaviour is not intended.

* util.c (printstr_ex): Copy one excess byte in case of non-negative len
provided and it is more than max_strlen; handle case of max_strlen of 0
in case QUOTE_0_TERMINATED is set separately; check for need of printing
ellipsis by checking resulting style against QUOTE_0_TERMINATED.
2016-11-10 22:44:18 +03:00
62218efa6c tests: check decoding of mq_{notify,open,timedreceive,timedsend,unlink}
* tests/mq_sendrecv.c: New file.
* tests/mq_sendrecv-read.c: Likewise.
* tests/mq_sendrecv-write.c: Likewise.
* tests/mq_sendrecv.test: New test.
* tests/mq_sendrecv-read.test: Likewise.
* tests/mq_sendrecv-write.test: Likewise.
* tests/.gitignore: Add mq_sendrecv, mq_sendrecv-read,
and mq_sendrecv-write.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(mq_sendrecv_LDADD, mq_sendrecv_read_LDADD, mq_sendrecv_write_LDADD):
New variables.
(DECODER_TESTS): Add mq_sendrecv.test, mq_sendrecv-read.test,
and mq_sendrecv-write.test.
2016-11-09 04:27:53 +03:00
64ac9ee785 tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work
* tests/times.c (main): Skip if clock_gettime consistenly returns zero
for CLOCK_PROCESS_CPUTIME_ID timer.
2016-11-08 15:32:47 +00:00
015aee943e tests: add tests for perf_event_attr structure decoding in perf_event_open
* configure.ac: Add checks for presence of various fields of struct
perf_event_attr defined in kernel headers.
* tests/perf_event_open.c: New file.
* tests/perf_event_open_unabbrev.c: Likewise.
* tests/perf_event_open.test: New test.
* tests/perf_event_open_unabbrev.test: Likewise.
* tests/.gitignore: Add perf_event_open, perf_event_open_unabbrev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add perf_event_open.test, perf_event_open_unabbrev.test.
2016-10-31 11:29:20 +03:00
6ed2a84aab Implement decoding of perf_event_attr structure in perf_event_open syscall
* linux/perf_event_struct.h: New file, definition of struct perf_event_attr
from Linux 4.8
* Makefile.am (strace_SOURCES): Add it.
* xlat/hw_breakpoint_len.in: New file.
* xlat/hw_breakpoint_type.in: Likewise.
* xlat/perf_attr_size.in: Likewise.
* xlat/perf_branch_sample_type.in: Likewise.
* xlat/perf_event_read_format.in: Likewise.
* xlat/perf_event_sample_format.in: Likewise.
* xlat/perf_hw_cache_id.in: Likewise.
* xlat/perf_hw_cache_op_id.in: Likewise.
* xlat/perf_hw_cache_op_result_id.in: Likewise.
* xlat/perf_hw_id.in: Likewise.
* xlat/perf_sw_ids.in: Likewise.
* xlat/perf_type_id.in: Likewise.
* perf.c [HAVE_LINUX_PERF_EVENT_H]: Remove inclusion of
<linux/perf_event.h>.
(PRINT_XLAT): New macro for simplifying printing values from
sorted xlat.
(printxlat_search): New function, wrapper for xlat_search with behaviour
similar to printval.
(print_perf_event_attr): New print_event_attr structure fetching and
printing function.
(SYS_FUNC(perf_event_open)): Use print_perf_event_attr for displaying
attr argument contents.
* tests/perf_event_open.c: Renamed to
tests/perf_event_open_nonverbose.c.
* tests/perf_event_open.test: add -e verbose=none in order to preserve
output format being checked (in case verbose output is enabled,
contents of attr arguments are shown now); rename to
tests/perf_event_open_nonverbose.test; add -e trace=perf_event_open.
2016-10-31 04:59:10 +03:00
48dd98ba81 tests: fix name spelling 2016-10-31 04:59:10 +03:00
fd992caa81 tests: fix name spelling 2016-10-30 22:54:27 +00:00
3d6436d7cb Update NEWS 2016-10-30 22:53:52 +00:00
06c8831cf4 Fix typo in comment in tests/quotactl.h 2016-10-31 01:32:45 +03:00
5ca0852f5f tests: fix invalid pointer checks in quotactl test
* tests/quotactl.h (bogus_special, bogus_addr): Move it...
* tests/quotactl.c (main): ... here; remove static and const qualifiers,
use memory after tail_alloc instead of magic numbers.
* tests/quotactl-xfs.c (main): Likewise.
2016-10-31 00:49:29 +03:00
3fb04c6aec tests: fix invalid pointer checks in getcpu test
* test/getcpu.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.
2016-10-31 00:49:29 +03:00
d6fd023b17 tests: fix invalid pointer checks in request_key test
* test/request_key.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.
2016-10-31 00:49:29 +03:00
64de69186e tests: fix invalid pointer checks in add_key test
* test/add_key.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.
2016-10-31 00:49:29 +03:00
c1c3fed7c9 statfs: use printxval_search
* print_statfs.c (print_statfs_type): Use printxval_search for printing
FS magic xlat value.
2016-10-31 00:49:28 +03:00
cdf0885fe0 util: add printing helper for sorted xlat arrays
* util.c (printxval_searchn): New function.
* defs.h (printxval_searchn): New prototype.
(printxval_search): New helper macro useful in conjunction with static
xlat arrays.
2016-10-31 00:49:28 +03:00
48252db2a2 defs: add check for argument being array to ARRAY_SIZE macro
* gcc_compat.h [GNUC_PREREQ(3, 0)] (BUILD_BUG_ON_ZERO): New macro.
(SAME_TYPE, MUST_BE_ARRAY): Likewise.
* defs.h (ARRAY_SIZE): Add MUST_BE_ARRAY for build-time type check.
2016-10-31 00:49:28 +03:00
a1a42e1f0d tests: check decoding of oldfstat, oldlstat, and oldstat syscalls
* tests/oldfstat.c: New file.
* tests/oldlstat.c: Likewise.
* tests/oldstat.c: Likewise.
* tests/oldfstat.test: New test.
* tests/oldlstat.test: Likewise.
* tests/oldstat.test: Likewise.
* tests/xstatx.c [!OLD_STAT]: define OLD_STAT to 0.
(print_stat) [OLD_STAT]: Print predefined values for
st_blksize/st_blocks.
(print_stat): Check for !OLD_STAT in nanosecond precision checks.
(main) [OLD_STAT]: Ignore EOVERFLOW.
(main): Test for successful rc in returned size value check;
print address only on non-successful rc.
* tests/.gitignore: Add oldfstat, oldlstat, and oldstat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add oldfstat.test, oldlstat.test, and oldstat.test.
2016-10-31 00:49:28 +03:00
7497b1c700 tests: additional tests of stat decoders
* tests/fstatx.c (IS_FSTAT): Define to 1.
* tests/fstatat64.c [__GLIBC__ && __sparc64__] (TEST_BOGUS_STRUCT_STAT):
Define to 0.
* tests/xstatx.c [!IS_STAT] (IS_STAT): Define to 0.
[!TEST_BOGUS_STRUCT_STAT] (TEST_BOGUS_STRUCT_STAT): Define to 1.
(main): Add a check for non-available pointer and a check
for block device file.
* tests/statx.sh: Add tracing of /dev/full file, specify alignment.
* tests/fstat.test: Specify alignment.
2016-10-31 00:49:28 +03:00
3815851894 tests: prepare for additional tests of stat decoders
PRINT_SYSCALL_HEADER/PRINT_SYSCALL_FOOTER now contain open/close brace
pair in order to save errno.  PRINT_SYSCALL_FOOTER now uses sprintrc for
printing rc/errno.

* tests/xstatx.c: Include <errno.h>.
(main): Update PRINT_SYSCALL_FOOTER call convention.
* tests/fstatat.c (PRINT_SYSCALL_HEADER): Add errno saving.
(PRINT_SYSCALL_FOOTER): Restore errno.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.
2016-10-31 00:49:28 +03:00
9c260b9e87 Provide a safe definition of O_ACCMODE
Some libcs e.g. musl are guilty of messing up with O_ACCMODE.

* open.c (O_ACCMODE): Redefine to 03.
2016-10-29 02:54:02 +03:00
0277a64986 Implement dumping of mq_timedsend and mq_timedreceive syscalls
* syscall.c (dumpio): Add SEN_mq_timedreceive and SEN_mq_timedsend.
2016-10-29 02:54:02 +03:00
2b50662498 mq: print msg_prio as a pointer, not as an immediate value
* mq.c (SYS_FUNC(mq_timedreceive)): Use printnum_int for printing
msg_prio argument.
2016-10-29 02:54:02 +03:00
26690859f6 mq: print msg payload only in case of successful mq_timedreceive call
Also, use u_rval for determining message size.

* mq.c (SYS_FUNC(mq_timedreceive)): Check for syserror and non-negative
u_rval before calling printstr on msg_ptr argument, or use printaddr otherwise;
provide u_rval as string size.
2016-10-29 02:54:02 +03:00
19bd947891 mq: Print msg_prio parameter as unsigned int in mq_timedsend
* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%ld"
to "%u", cast argument value to unsigned int.
2016-10-29 02:54:02 +03:00
3e22464ec7 mq: Properly print mq_flags field
mq_flags field of struct mq_attr can contain only O_NONBLOCK flag (other
flags are treated as invalid by mq_getsetattr). Moreover, this field is
ignored by mq_open at all (O_NONBLOCK is set via oflag, not via attr
attribute).

* xlat/mq_attr_flags.in: New file.
* print_mq_attr.c: Include xlat/mq_attr_flags.h.
(printmqattr): New parameter, bool decode_flags; cast members of struct
mq_attr to long long type; use mq_attr_flags xlat for printing mq_flags;
print mq_flags as flags only in case decode_flags parameter is set
to true.
* mq.c (SYS_FUNC(mq_open)): Specify value of false for decode_flags
parameter of printmqattr call.
(SYS_FUNC(mq_getsetattr)): Specify value of true for decode_flags
parameter of printmqattr call.
* tests/mq.expected: Update expected output.
2016-10-29 02:54:02 +03:00
0302a3186e mq: Print msg_len parameter as kernel_ulong_t
* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%lu"
to "%llu", use getarg_ull for obtaining msg_len parameter.
(SYS_FUNC(mq_timedreceive)): Likewise.
2016-10-29 02:54:02 +03:00
56b7651212 print_mq_attr: fix typo
* print_mq_attr.c (printmqattr): Print field name "mq_curmsgs"
instead of "mq_curmsg".
* tests/mq.expected: Update expected output.
2016-10-29 02:54:02 +03:00
34ccf12e07 mq: print mqdes parameter as int
It is defined as int in <linux/posix_types.h>.

* mq.c (SYS_FUNC(mq_timedsend)): Use "%d" conversion specifier instead
of "%ld" for printing mqdes (0th parameter), cast parameter value to
int.
(SYS_FUNC(mq_timedreceive)): Likewise.
(SYS_FUNC(mq_notify)): Likewise.
(SYS_FUNC(mq_getsetattr)): Likewise.
2016-10-29 02:54:02 +03:00
0a37603ef6 mq: curly brackets usage fix
Use curly brackets for denoting blocks in both of if branches if they
are already used in at least one branch.
2016-10-29 02:54:02 +03:00
9a4eb55465 tests: additional name_to_handle_at/open_by_handle_at checks
* tests/file_handle.c: Additional name_to_handle_at/open_by_handle_at
checks.
2016-10-29 02:54:02 +03:00
ad7f4354d5 tests: require only presence of __NR_* macros for file_handle test
* tests/file_handle.c: replace fcntl.h include with asm/unistd.h.
[MAX_HANDLE_SZ]: change to defined __NR_name_to_handle_at
&& defined __NR_open_by_handle_at, add fcntl.h include
[!MAX_HANDLE_SZ]: Add definition of MAX_HANDLE_SZ and struct
file_handle.
(main): Change name_to_handle_at and open_by_handle_at calls to syscall.
2016-10-29 02:54:01 +03:00
d6ee2bba25 tests: proper type conversion in keyctl test
* tests/keyctl.c (printarg): Add intermediate conversion of arg to uintptr_t
since kernel_ulong_t may be of different size.
2016-10-29 02:54:01 +03:00
8e1f1e7a92 file_handle: use separate xlat for name_ta_handle_at flags
Since the only two flags supported are AT_SYMLINK_FOLLOW and
AT_EMPTY_PATH.

* xlat/name_to_handle_at_flags.in: New file.
* file_handle.c (SYS_FUNC(name_to_handle_at)): Use name_to_handle_at_flags
for printing flags parameter.
2016-10-29 02:54:01 +03:00
88cac72e95 tests: check decoding of kexec_file_load and kexec_load syscalls
* tests/kexec_file_load.c: New file.
* tests/kexec_load.c: Likewise.
* tests/kexec_file_load.test: New test.
* tests/kexec_load.test: Likewise.
* tests/.gitignore: Add kexec_file_load and kexec_load.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kexec_file_load.test and kexec_load.test.
2016-10-29 02:54:01 +03:00
108d574c54 kexec: use widen_to_ulong since kexec_load has compat on x32/n32
Curiously, kexec_load uses compat on x32/n32, so its parameters should
be 4 bytes in size on these ABIs.

* kexec.c (SYS_FUNC(kexec_load)): Use widen_to_ulong for casting
parameters to proper size on x32/n32.
2016-10-29 02:54:01 +03:00
920b4d5114 kexec: fix zeroing of higher bits of flags parameter in kexec_load
* kexec.c (SYS_FUNC(kexec_load)): Perform type conversion before
negation in order to properly negate higher bits of KEXEC_ARCH_MASK.
2016-10-29 02:54:01 +03:00
41c468b26c kexec: add printing of struct kexec_segment field names
* kexec.c (print_seg): Print field names of the kexec_segment structure.
2016-10-29 02:54:01 +03:00
5732d38e1a tests: check decoding of unshare syscall
* tests/unshare.c: New file.
* tests/unshare.test: New test.
* tests/.gitignore: Add unshare.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unshare.test.
2016-10-29 02:54:01 +03:00
0cffca31df clone: use kernel_ulong_t as type of flags parameter of unshare call
Kernel declares flags parameter as long and looks like x32 and n32
implement no compat for this call.

* clone.c (SYS_FUNC(unshare)): Use getarg_ull and printflags64 for
obtaining and parsing flags parameter.
2016-10-29 02:54:01 +03:00
951f1b1163 clone: use separate flag list for unshare
Not all clone flags could be passed to unshare (see check_unshare_flags
function in kernel/fork.c).

* xlat/unshare_flags.in: New file.
* clone.c (SYS_FUNC(unshare)): Use unshare_flags for printing flags
parameter.
2016-10-29 02:54:01 +03:00
3fa672fa7a tests: check decoding of setns syscall
* tests/setns.c: New file.
* tests/setns.test: New test.
* tests/.gitignore: Add setns.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setns.test.
2016-10-29 02:54:01 +03:00
7b0ae21f5c clone: use separate xlat for nstype parameter of setns syscall
nstype is not flag set but specific type value against which it is
compared in kernel (see kernel/nsproxy.c, SYSCALL_DEFINE2(setns, ...)).

* xlat/setns_types.in: New file.
* clone.c: Use printxval and setns_types for nstype parameter.
2016-10-29 02:54:01 +03:00
aece0f417f tests: check non-verbose capget/capset output
* tests/caps-abbrev.awk: New file.
* tests/caps-abbrev.c: Likewise.
* tests/caps-abbrev.test: New test.
* tests/.gitignore: Add caps-abbrev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add caps-abbrev.test.
(EXTRA_DIST): Add caps-abbrev.awk.
2016-10-29 02:54:01 +03:00
f84b99b353 tests: additional capset decoder checks
* tests/caps.awk: Add patterns for additional checks.
* tests/caps.c: Implement additional checks.
2016-10-29 02:54:01 +03:00
73d66c84d5 tests: check decoding of fanotify_init syscall
* tests/fanotify_init.c: New file.
* tests/fanotify_init.test: New test.
* tests/.gitignore: Add fanotify_init.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fanotify_init.test.
2016-10-29 02:54:01 +03:00
e3645be4d6 tests: some additional checks for fanotify_mark
* tests/fanotify_mark.c (do_call): New function.
(main): Use it.
2016-10-29 02:54:01 +03:00
f3a326c85b tests: use sprintrc in tests/fanotify_mark.c
* tests/fanotify.c (main): Use sprintrc.
2016-10-29 02:54:01 +03:00
3b31d33ada tests: check decoding of {init,finit,delete}_module syscalls
* tests/delete_module.c: New file.
* tests/finit_module.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/init_module.c: Likewise.
* tests/delete_module.test: New test.
* tests/finit_module.test: Likewise.
* tests/init_module.test: Likewise.
* tests/.gitignore: Add delete_nodule, finit_module, and init_module.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add delete_module.test, finit_module.test,
and init_module.test.
(EXTRA_DIST): Add init_delete_module.h.
2016-10-29 02:54:01 +03:00
dad07434a8 bjm: use getarg_ull for retrieving first two parameters of init_module syscall
As init_module has no compat wrapper, its first parameter is a pointer
and the second is length, they both have the same size as kernel_ulong_t
type.

* bjm.c (SYS_FUNC(init_module)): Obtain first two parameters using
getarg_ull, print address argument using printaddr_ull, print length
argument using "%llu" conversion specifier.
2016-10-29 02:54:01 +03:00
b61f3251c0 Add printaddr_ull, change printaddr into a thin wrapper around it
* defs.h (printaddr_ull): New prototype.
(printaddr): Change to a static inline wrapper around printaddr_ull.
* util.c (printaddr): Rename to printaddr_ull, change argument type
to unsigned long long, change print format to %#llx.
2016-10-29 02:54:01 +03:00
73acaec01e xlat: add values for MODULE_INIT_* constants
* bjm.c (MODULE_INIT_IGNORE_MODVERSIONS, MODULE_INIT_IGNORE_VERMAGIC):
Remove.
* xlat/module_init_flags.in: Add values for
MODULE_INIT_IGNORE_MODVERSIONS and MODULE_INIT_IGNORE_VERMAGIC records.
2016-10-29 02:54:01 +03:00
d71973c31f Remove parser of create_module syscall
Since create_module syscall is present only in kernels before Linux 2.6
and strace does not support those kernels, there is no use to keep this
parser any longer.

* bjm.c (SYS_FUNC(create_module)): Remove.
* linux/dummy.h (sys_create_module): Add stub alias.
2016-10-29 02:54:01 +03:00
6a1632c7e1 tests: check decoding of process_vm_readv and process_vm_writev syscalls
* tests/process_vm_readv.c: New file.
* tests/process_vm_readv_writev.c: Likewise.
* tests/process_vm_writev.c: Likewise.
* tests/process_vm_readv.test: New test.
* tests/process_vm_writev.test: Likewise.
* tests/.gitignore: Add process_vm_readv and process_vm_writev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add process_vm_readv.test and process_vm_writev.test.
(EXTRA_DIST): Add process_vm_readv_writev.c.
2016-10-29 02:54:00 +03:00
5fbb3d299d process_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Use widen_to_ulong for local_iovcnt,
renote_iovcnt, and flags parameters.
2016-10-28 18:40:11 +00:00
714d68127a defs: add widen_to_ulong macro
This is similar to widen_to_long, but for unsigned values.

* defs.h (widen_to_ulong): New macro.
2016-10-28 18:40:11 +00:00
d44a77ca58 process_vm: print pid argument as int
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change conversion specifier for pid
argument from "%ld" to "%d".
2016-10-28 18:40:11 +00:00
44ffbf0adc process_vm: remove syserror check for iovec printing
This check had been done by print_array inside tprint_iov anyway.

* process_vm.c (SYS_FUNC(process_vm_readv)): Use tprint_iov_upto for
printing local_iov; do not check for syserror, provide decode_iov
parameter to tprint_iov{,_upto} based on its value instead.
2016-10-28 18:40:11 +00:00
030b61c92f io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_upto
This enables printing of iovec arrays even in case of failed syscall
(failed syscall doesn't mean that iovec itself is inaccessible and
useless).  One caveat here is that we should explicitly provide proper
IOV_DECODE_* value based on syserror value in case printing is performed
on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting
when syserror is up, since this may be called by code which tries to
print iovec containing local data, which should be perfectly accessible
(on the other hand, there are no cases of such behaviour at the moment).

Since iovecs themselves are printed even if syscall has failed now,
preadv test is updated to reflect this.  It is notable, though, that this
is the only place where this case is checked.

* io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror
instead of umoven_or_printaddr as umoven_func parameter.
(SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value
based on syserror(tcp) value.
* scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise.
* tests/preadv.c: Update expected output for the case when preadv
with singe-item iovec failed.
2016-10-28 18:40:11 +00:00
a980c9ebbd Move umoven_or_printaddr_ignore_syserror to util.c
* defs.h (umoven_or_printaddr_ignore_syserror): New prototype.
* v4l2.c (umoven_or_printaddr_ignore_syserror): Move ...
* util.c: ... here.
2016-10-28 18:40:10 +00:00
b0c4a35ac1 v4l2: check for verbose flag in umoven_or_printaddr_ignore_syserror
This change makes behaviour of umoven_or_printaddr_ignore_syserror in
line with umoven_or_printaddr when verbose flag is disabled.

* v4l2.c (umoven_or_printaddr_ignore_syserror): Simply call printaddr
when verbose flag is unset.
2016-10-28 18:40:10 +00:00
a49ba91595 tests: check decoding of kcmp syscall
* tests/kcmp.c: New file.
* tests/kcmp.test: New test.
* tests/.gitignore: Add kcmp.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kcmp.test.
2016-10-28 18:40:10 +00:00
63c27873b6 kcmp: print index parameters of unknown commands as kernel_ulong_t
* lookup_dcookie.c (SYS_FUNC(kcmp)): Use getarg_ull to retrieve idx1
and idx2, print them using %#llx format in case of unknown command.
2016-10-28 18:40:10 +00:00
8b0f48ee06 tests: check decoding of inotify family syscalls
* tests/inotify.c: New file.
* tests/inotify_init1.c: Likewise.
* tests/inotify.test: New test.
* tests/inotify_init1.test: Likewise.
* tests/.gitignore: Add inotify and inotify_init1.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add inotify.test and inotify_init1.test.
2016-10-27 23:31:44 +00:00
3f86e786f1 xlat: use IN_* prefix for inotify_init1 flag constants
* xlat/inotify_init_flags.in: Replace O_* prefix with IN_* prefix for
O_NONBLOCK and O_CLOEXEC constants, provide fallback definitions.
2016-10-27 23:31:44 +00:00
ebdf6914f1 tests: check decoding of lookup_dcookie syscall
* tests/lookup_dcookie.c: New file.
* tests/lookup_dcookie.test: New test.
* tests/.gitignore: Add lookup_dcookie.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add lookup_dcookie.test.
2016-10-27 23:31:42 +00:00
2119f8d6b0 lookup_dcookie: print len parameter as kernel_ulong_t
It is size_t and without compat on x32/n32.

* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Change conversion
specifier from "%lu" to "%llu", use getarg_ull for len argument
retrieval.
2016-10-27 21:44:58 +00:00
6e6c11d9dd defs.h: add offsetofend macro
Analogous to offsetof but returns structure offset after the specified
field.  Useful for checking whether specific field is present in obtained
data or specifying amount of data to copy based on the (last) field needed.

* defs.h (offsetofend): New macro.
2016-10-26 04:20:06 +03:00
d212c95b84 tests: move ARG_STR and similar macros to tests.h
* tests/add_key.c (_STR, ARG_STR): Move ...
* tests/tests.h: ... here.
(ARG_ULL_STR): New macro.
* tests/keyctl.c (ARG_STR): Remove.
* tests/quotactl.h (ARG_STR): Likewise.
* tests/request_key.c (ARG_STR): Likewise.
2016-10-26 04:18:34 +03:00
f0fb4e9de4 tests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h
* tests/fadvise.h (LL_PAIR, LL_VAL_TO_PAIR): Move ...
* tests/tests.h: ... here.
2016-10-26 04:13:24 +03:00
eabfa5e9e0 tests: check decoding of ioprio_get and ioprio_set syscalls
* tests/ioprio.c: New file.
* tests/ioprio.test: New test.
* tests/.gitignore: Add ioprio.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioprio.test.
2016-10-26 01:06:09 +00:00
79fb93a7c6 xlat: provide fallback definitions for CLOCK_* constants
Since new values have been added gradually over various kernel versions,
it's better to define them explicitly in order to avoid situations when
strace built with older kernel headers cannot decode some recently
defined values.

* xlat/clocknames.in: Add values for constants.
2016-10-26 01:06:09 +00:00
06934669ea tests: move fill_memory and fill_memory_ex into a separate file
* tests/fill_memory.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/quotactl.h (fill_memory, fill_memory_ex): Move to fill_memory.c.
* tests/tests.h (fill_memory, fill_memory_ex): New prototypes.
2016-10-26 01:06:09 +00:00
ab648c804c tests: add period parameter to fill_memory_ex
* tests/quotactl.h (fill_memory_ex): Add period parameter,
use it as a divisor in non-constant part of value.
(fill_memory): Specify period of 0x80 to fill_memory_ex call.
* tests/quotactl-xfs.c (main): Likewise.
2016-10-26 01:06:09 +00:00
e0916b6dc3 Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.14-1.
* strace.spec.in: Likewise.
2016-10-05 06:19:41 +00:00
821 changed files with 27322 additions and 7055 deletions

3
.gitignore vendored
View File

@ -24,6 +24,7 @@
/configure
/depcomp
/install-sh
/ioctl_iocdef.[ih]
/ioctl_redefs[12].h
/ioctlent[012].h
/ioctls_all[012].h
@ -49,6 +50,7 @@
/native_printer_decls.h
/native_printer_defs.h
/printers.h
/scno.h
/sen.h
/stamp-h1
/strace
@ -57,6 +59,7 @@
/strace.dsc
/strace.spec
/sys_func.h
/syscallent.i
/test-driver
/tests-m32
/tests-mx32

View File

@ -1,9 +1,11 @@
# Map git author names and email addresses to canonical/preferred form.
<ak@linux.intel.com> <ak@suse.de>
<chenjingpiao@gmail.com> <chenjingpiao@foxmail.com>
<dgilbert@redhat.com> <dave@treblig.org>
<holger@freyther.de> <zecke@selfish.org>
<kirill@shutemov.name> <kirill.shutemov@linux.intel.com>
<schwab@linux-m68k.org> <schwab@redhat.com>
<schwab@linux-m68k.org> <schwab@suse.de>
<thomas.de.schampheleire@gmail.com> <thomas.de_schampheleire@nokia.com>
<vda.linux@googlemail.com> <dvlasenk@redhat.com>
Eugene Syromyatnikov <evgsyr@gmail.com>

View File

@ -6,8 +6,6 @@ before_install: ./travis-install.sh
script: ./travis-build.sh
after_success: ./travis-success.sh
sudo: required
git:
@ -23,7 +21,6 @@ matrix:
- compiler: gcc
env:
- TARGET=x86_64
- COVERAGE=true
- compiler: gcc
env:
- TARGET=x32
@ -42,3 +39,7 @@ matrix:
- compiler: musl-gcc
env:
- TARGET=x86
- compiler: gcc
env:
- TARGET=x86_64
- CHECK=coverage

View File

@ -4,6 +4,7 @@ Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
Copyright (c) 1995, 1996 Michael Elizabeth Chastain <mec@duracef.shout.net>
Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
Copyright (C) 1998-2001 Wichert Akkerman <wakkerma@deephackmode.org>
Copyright (C) 2001-2017 The strace developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without

289
INSTALL
View File

@ -1,108 +1,107 @@
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved. This file is offered as-is, without
warranty of any kind.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
Briefly, the shell command './configure && make && make install' should
configure, build, and install this package. The following more-detailed
instructions are generic; see the 'README' file for instructions
specific to this package. Some packages provide this 'INSTALL' file but
do not implement all of the features documented below. The lack of an
optional feature in a given package is not necessarily a bug. More
recommendations for GNU packages can be found in *note Makefile
Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
The 'configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
those values to create a 'Makefile' in each directory of the package.
It may also create one or more '.h' files containing system-dependent
definitions. Finally, it creates a shell script 'config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
file 'config.log' containing compiler output (useful mainly for
debugging 'configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
It can also use an optional file (typically called 'config.cache' and
enabled with '--cache-file=config.cache' or simply '-C') that saves the
results of its tests to speed up reconfiguring. Caching is disabled by
default to prevent problems with accidental use of stale cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
to figure out how 'configure' could check whether to do them, and mail
diffs or instructions to the address given in the 'README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
some point 'config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The file 'configure.ac' (or 'configure.in') is used to create
'configure' by a program called 'autoconf'. You need 'configure.ac' if
you want to change it or regenerate 'configure' using a newer version of
'autoconf'.
The simplest way to compile this package is:
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
1. 'cd' to the directory containing the package's source code and type
'./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
Running 'configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
2. Type 'make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
3. Optionally, type 'make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
4. Type 'make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
user, and only the 'make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
5. Optionally, type 'make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
regular user, particularly if the prior 'make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
source code directory by typing 'make clean'. To also remove the
files that 'configure' created (so you can compile the package for
a different kind of computer), type 'make distclean'. There is
also a 'make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
7. Often, you can also type 'make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
8. Some packages, particularly those that use Automake, provide 'make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
targets like 'make install' and 'make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
'configure' script does not know about. Run './configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
You can give 'configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here is
an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
@ -111,90 +110,90 @@ is an example:
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
By default, 'make install' installs the package's commands under
'/usr/local/bin', include files under '/usr/local/include', etc. You
can specify an installation prefix other than '/usr/local' by giving
'configure' the option '--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
options like '--bindir=DIR' to specify different values for particular
kinds of files. Run 'configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the default
for these options is expressed in terms of '${prefix}', so that
specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
correct locations to 'configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
'make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
affected directory. For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
'${prefix}'. Any directories that were specified during 'configure',
but not in terms of '${prefix}', must each be overridden at install time
for the entire installation to be relocated. The approach of makefile
variable overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation. However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
The second method involves providing the 'DESTDIR' variable. For
example, 'make install DESTDIR=/alternate/directory' will prepend
'/alternate/directory' before all installation names. The approach of
'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
when some directory options were not specified in terms of '${prefix}'
at 'configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed with
an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
an extra prefix or suffix on their names by giving 'configure' the
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
Some packages pay attention to '--enable-FEATURE' options to
'configure', where FEATURE indicates an optional part of the package.
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
is something like 'gnu-as' or 'x' (for the X Window System). The
'README' should mention any '--enable-' and '--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
For packages that use the X Window System, 'configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
you can use the 'configure' options '--x-includes=DIR' and
'--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
execution of 'make' will be. For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
overridden with 'make V=0'.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
There may be some features 'configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
architectures, 'configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
'--build=TYPE' option. TYPE can either be a short name for the system
type, such as 'sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
@ -203,100 +202,100 @@ where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
See the file 'config.sub' for the possible values of each field. If
'config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
use the option '--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
eventually be run) with '--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
If you want to set default values for 'configure' scripts to share, you
can create a site shell script called 'config.site' that gives default
values for variables like 'CC', 'cache_file', and 'prefix'. 'configure'
looks for 'PREFIX/share/config.site' if it exists, then
'PREFIX/etc/config.site' if it exists. Or, you can set the
'CONFIG_SITE' environment variable to the location of the site script.
A warning: not all 'configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
environment passed to 'configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
them in the 'configure' command line, using 'VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
causes the specified 'gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
Autoconf limitation. Until the limitation is lifted, you can use this
workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
'configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
'configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
'--help'
'-h'
Print a summary of all of the options to 'configure', and exit.
`--help=short'
`--help=recursive'
'--help=short'
'--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
'configure', and exit. The 'short' variant lists options used only
in the top level, while the 'recursive' variant lists options also
present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
'--version'
'-V'
Print the version of Autoconf used to generate the 'configure'
script, and exit.
`--cache-file=FILE'
'--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
traditionally 'config.cache'. FILE defaults to '/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
'--config-cache'
'-C'
Alias for '--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
'--quiet'
'--silent'
'-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
suppress all normal output, redirect it to '/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
'--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
'configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
'--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names:: for
more details, including other options available for fine-tuning the
installation locations.
`--no-create'
`-n'
'--no-create'
'-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
'configure' also accepts some other, not widely useful, options. Run
'configure --help' for more details.

8
INSTALL-git.md Normal file
View File

@ -0,0 +1,8 @@
Build strace from git repository
================================
If you use the GIT version of strace there will be some files missing
that you need to build strace. These files are generated by tools from
the GNU Autoconf and Automake packages.
Note: rather than running `autoreconf` directly, use the `./bootstrap` script
and follow the instructions given in given in [INSTALL](INSTALL) file for further installation.

View File

@ -53,6 +53,9 @@ AM_CPPFLAGS = -I$(builddir)/$(OS)/$(ARCH) \
-I$(builddir) \
-I$(srcdir)
AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD)
AM_CPPFLAGS_FOR_BUILD = $(AM_CPPFLAGS)
include xlat/Makemodule.am
strace_CPPFLAGS = $(AM_CPPFLAGS)
@ -67,12 +70,14 @@ libstrace_a_SOURCES = \
fstatfs.c \
fstatfs64.c \
ipc.c \
sigreturn.c \
socketcall.c \
statfs.c \
statfs64.c \
sync_file_range.c \
sync_file_range2.c \
upeek.c \
upoke.c \
# end of libstrace_a_SOURCES
strace_SOURCES = \
@ -97,12 +102,12 @@ strace_SOURCES = \
desc.c \
dirent.c \
dirent64.c \
dm.c \
empty.h \
epoll.c \
evdev.c \
eventfd.c \
execve.c \
exit.c \
fadvise.c \
fallocate.c \
fanotify.c \
@ -166,21 +171,28 @@ strace_SOURCES = \
native_defs.h \
net.c \
netlink.c \
nsig.h \
numa.c \
oldstat.c \
open.c \
or1k_atomic.c \
pathtrace.c \
perf.c \
perf_event_struct.h \
personality.c \
pkeys.c \
poll.c \
prctl.c \
print_dev_t.c \
print_mq_attr.c \
print_msgbuf.c \
print_sg_req_info.c \
print_sigevent.c \
print_statfs.c \
print_struct_stat.c \
print_time.c \
print_timespec.c \
print_timeval.c \
print_timex.c \
printmode.c \
printrusage.c \
@ -190,6 +202,7 @@ strace_SOURCES = \
process_vm.c \
ptp.c \
ptrace.h \
qualify.c \
quota.c \
readahead.c \
readlink.c \
@ -197,17 +210,21 @@ strace_SOURCES = \
regs.h \
renameat.c \
resource.c \
rt_sigframe.c \
rt_sigreturn.c \
rtc.c \
sched.c \
sched_attr.h \
scsi.c \
seccomp.c \
seccomp_fprog.h \
sendfile.c \
sg_io_v3.c \
sg_io_v4.c \
sigaltstack.c \
sigevent.h \
signal.c \
signalfd.c \
sigreturn.c \
sock.c \
sockaddr.c \
socketutils.c \
@ -217,10 +234,13 @@ strace_SOURCES = \
stat64.c \
statfs.c \
statfs.h \
statx.c \
statx.h \
strace.c \
swapon.c \
syscall.c \
sysctl.c \
sysent.h \
sysinfo.c \
syslog.c \
sysmips.c \
@ -235,11 +255,11 @@ strace_SOURCES = \
umount.c \
uname.c \
userfaultfd.c \
ustat.c \
util.c \
utime.c \
utimes.c \
v4l2.c \
vsprintf.c \
wait.c \
xattr.c \
xlat.h \
@ -289,8 +309,10 @@ EXTRA_DIST = \
debian/watch \
errnoent.sh \
generate_sen.sh \
ioctl_iocdef.c \
ioctlsort.c \
linux/32/ioctls_inc.h \
linux/32/ioctls_inc_align16.h \
linux/32/ioctls_inc_align32.h \
linux/32/ioctls_inc_align64.h \
linux/32/syscallent.h \
@ -298,6 +320,7 @@ EXTRA_DIST = \
linux/64/syscallent.h \
linux/aarch64/arch_regs.c \
linux/aarch64/arch_regs.h \
linux/aarch64/arch_rt_sigframe.c\
linux/aarch64/arch_sigreturn.c \
linux/aarch64/errnoent1.h \
linux/aarch64/get_error.c \
@ -307,12 +330,15 @@ EXTRA_DIST = \
linux/aarch64/ioctls_arch1.h \
linux/aarch64/ioctls_inc0.h \
linux/aarch64/ioctls_inc1.h \
linux/aarch64/set_error.c \
linux/aarch64/set_scno.c \
linux/aarch64/signalent1.h \
linux/aarch64/syscallent.h \
linux/aarch64/syscallent1.h \
linux/alpha/arch_getrval2.c \
linux/alpha/arch_regs.c \
linux/alpha/arch_regs.h \
linux/alpha/arch_rt_sigframe.c \
linux/alpha/arch_sigreturn.c \
linux/alpha/errnoent.h \
linux/alpha/get_error.c \
@ -321,63 +347,91 @@ EXTRA_DIST = \
linux/alpha/get_syscall_result.c\
linux/alpha/ioctls_arch0.h \
linux/alpha/ioctls_inc0.h \
linux/alpha/set_error.c \
linux/alpha/set_scno.c \
linux/alpha/signalent.h \
linux/alpha/syscallent.h \
linux/alpha/userent.h \
linux/arc/arch_regs.c \
linux/arc/arch_regs.h \
linux/arc/arch_rt_sigframe.c \
linux/arc/get_error.c \
linux/arc/get_scno.c \
linux/arc/get_syscall_args.c \
linux/arc/ioctls_arch0.h \
linux/arc/ioctls_inc0.h \
linux/arc/set_error.c \
linux/arc/set_scno.c \
linux/arc/syscallent.h \
linux/arch_regs.h \
linux/arch_sigreturn.c \
linux/arm/arch_regs.c \
linux/arm/arch_regs.h \
linux/arm/arch_rt_sigframe.c \
linux/arm/arch_sigreturn.c \
linux/arm/get_error.c \
linux/arm/get_scno.c \
linux/arm/get_syscall_args.c \
linux/arm/ioctls_arch0.h \
linux/arm/ioctls_inc0.h \
linux/arm/set_error.c \
linux/arm/set_scno.c \
linux/arm/syscallent.h \
linux/arm/userent.h \
linux/avr32/arch_regs.c \
linux/avr32/arch_regs.h \
linux/avr32/arch_rt_sigframe.c \
linux/avr32/get_error.c \
linux/avr32/get_scno.c \
linux/avr32/get_syscall_args.c \
linux/avr32/ioctls_arch0.h \
linux/avr32/ioctls_inc0.h \
linux/avr32/set_error.c \
linux/avr32/set_scno.c \
linux/avr32/syscallent.h \
linux/avr32/userent.h \
linux/bfin/arch_regs.c \
linux/bfin/arch_rt_sigframe.c \
linux/bfin/get_error.c \
linux/bfin/get_scno.c \
linux/bfin/get_syscall_args.c \
linux/bfin/get_syscall_result.c \
linux/bfin/ioctls_arch0.h \
linux/bfin/ioctls_inc0.h \
linux/bfin/rt_sigframe.h \
linux/bfin/set_error.c \
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/hppa/arch_regs.c \
linux/hppa/arch_regs.h \
linux/hppa/arch_rt_sigframe.c \
linux/hppa/errnoent.h \
linux/hppa/get_error.c \
linux/hppa/get_scno.c \
@ -385,49 +439,68 @@ EXTRA_DIST = \
linux/hppa/get_syscall_result.c \
linux/hppa/ioctls_arch0.h \
linux/hppa/ioctls_inc0.h \
linux/hppa/rt_sigframe.h \
linux/hppa/set_error.c \
linux/hppa/set_scno.c \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
linux/i386/arch_regs.c \
linux/i386/arch_regs.h \
linux/i386/arch_rt_sigframe.c \
linux/i386/arch_sigreturn.c \
linux/i386/get_error.c \
linux/i386/get_scno.c \
linux/i386/get_syscall_args.c \
linux/i386/ioctls_arch0.h \
linux/i386/ioctls_inc0.h \
linux/i386/rt_sigframe.h \
linux/i386/set_error.c \
linux/i386/set_scno.c \
linux/i386/syscallent.h \
linux/i386/userent.h \
linux/i386/userent0.h \
linux/ia64/arch_getrval2.c \
linux/ia64/arch_regs.c \
linux/ia64/arch_regs.h \
linux/ia64/arch_sigreturn.c \
linux/ia64/arch_rt_sigframe.c \
linux/ia64/get_error.c \
linux/ia64/get_scno.c \
linux/ia64/get_syscall_args.c \
linux/ia64/ioctls_arch0.h \
linux/ia64/ioctls_inc0.h \
linux/ia64/rt_sigframe.h \
linux/ia64/set_error.c \
linux/ia64/set_scno.c \
linux/ia64/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
linux/m68k/arch_regs.c \
linux/m68k/arch_regs.h \
linux/m68k/arch_rt_sigframe.c \
linux/m68k/arch_sigreturn.c \
linux/m68k/get_error.c \
linux/m68k/get_scno.c \
linux/m68k/get_syscall_args.c \
linux/m68k/get_syscall_result.c \
linux/m68k/ioctls_arch0.h \
linux/m68k/ioctls_inc0.h \
linux/m68k/rt_sigframe.h \
linux/m68k/set_error.c \
linux/m68k/set_scno.c \
linux/m68k/syscallent.h \
linux/m68k/userent.h \
linux/metag/arch_regs.c \
linux/metag/arch_regs.h \
linux/metag/arch_rt_sigframe.c \
linux/metag/get_error.c \
linux/metag/get_scno.c \
linux/metag/get_syscall_args.c \
linux/metag/ioctls_arch0.h \
linux/metag/ioctls_inc0.h \
linux/metag/set_error.c \
linux/metag/set_scno.c \
linux/metag/syscallent.h \
linux/microblaze/arch_regs.c \
linux/microblaze/arch_rt_sigframe.c\
linux/microblaze/arch_sigreturn.c \
linux/microblaze/get_error.c \
linux/microblaze/get_scno.c \
@ -435,11 +508,14 @@ EXTRA_DIST = \
linux/microblaze/get_syscall_result.c \
linux/microblaze/ioctls_arch0.h \
linux/microblaze/ioctls_inc0.h \
linux/microblaze/set_error.c \
linux/microblaze/set_scno.c \
linux/microblaze/syscallent.h \
linux/microblaze/userent.h \
linux/mips/arch_getrval2.c \
linux/mips/arch_regs.c \
linux/mips/arch_regs.h \
linux/mips/arch_rt_sigframe.c \
linux/mips/arch_sigreturn.c \
linux/mips/errnoent.h \
linux/mips/genstub.sh \
@ -448,6 +524,9 @@ EXTRA_DIST = \
linux/mips/get_syscall_args.c \
linux/mips/ioctls_arch0.h \
linux/mips/ioctls_inc0.h \
linux/mips/rt_sigframe.h \
linux/mips/set_error.c \
linux/mips/set_scno.c \
linux/mips/signalent.h \
linux/mips/syscallent-compat.h \
linux/mips/syscallent-n32.h \
@ -458,52 +537,67 @@ EXTRA_DIST = \
linux/mtd-abi.h \
linux/netlink_diag.h \
linux/nios2/arch_regs.c \
linux/nios2/arch_regs.h \
linux/nios2/arch_rt_sigframe.c \
linux/nios2/get_error.c \
linux/nios2/get_scno.c \
linux/nios2/get_syscall_args.c \
linux/nios2/ioctls_arch0.h \
linux/nios2/ioctls_inc0.h \
linux/nios2/set_error.c \
linux/nios2/set_scno.c \
linux/nios2/syscallent.h \
linux/or1k/arch_regs.c \
linux/or1k/arch_regs.h \
linux/or1k/arch_rt_sigframe.c \
linux/or1k/get_error.c \
linux/or1k/get_scno.c \
linux/or1k/get_syscall_args.c \
linux/or1k/ioctls_arch0.h \
linux/or1k/ioctls_inc0.h \
linux/or1k/set_error.c \
linux/or1k/set_scno.c \
linux/or1k/syscallent.h \
linux/or1k/userent.h \
linux/personality.h \
linux/powerpc/arch_regs.c \
linux/powerpc/arch_regs.h \
linux/powerpc/arch_rt_sigframe.c\
linux/powerpc/arch_sigreturn.c \
linux/powerpc/errnoent.h \
linux/powerpc/get_error.c \
linux/powerpc/get_scno.c \
linux/powerpc/get_syscall_args.c \
linux/powerpc/getregs_old.c \
linux/powerpc/ioctls_arch0.h \
linux/powerpc/ioctls_inc0.h \
linux/powerpc/set_error.c \
linux/powerpc/set_scno.c \
linux/powerpc/syscallent.h \
linux/powerpc/userent.h \
linux/powerpc64/arch_regs.c \
linux/powerpc64/arch_regs.h \
linux/powerpc64/arch_rt_sigframe.c\
linux/powerpc64/arch_sigreturn.c \
linux/powerpc64/errnoent.h \
linux/powerpc64/errnoent1.h \
linux/powerpc64/get_error.c \
linux/powerpc64/get_scno.c \
linux/powerpc64/get_syscall_args.c \
linux/powerpc64/getregs_old.c \
linux/powerpc64/ioctls_arch0.h \
linux/powerpc64/ioctls_arch1.h \
linux/powerpc64/ioctls_inc0.h \
linux/powerpc64/ioctls_inc1.h \
linux/powerpc64/rt_sigframe.h \
linux/powerpc64/set_error.c \
linux/powerpc64/set_scno.c \
linux/powerpc64/signalent1.h \
linux/powerpc64/syscallent.h \
linux/powerpc64/syscallent1.h \
linux/powerpc64/userent.h \
linux/ptp_clock.h \
linux/riscv/arch_regs.c \
linux/riscv/arch_regs.h \
linux/riscv/arch_rt_sigframe.c \
linux/riscv/errnoent1.h \
linux/riscv/get_error.c \
linux/riscv/get_scno.c \
@ -512,50 +606,68 @@ EXTRA_DIST = \
linux/riscv/ioctls_arch1.h \
linux/riscv/ioctls_inc0.h \
linux/riscv/ioctls_inc1.h \
linux/riscv/set_error.c \
linux/riscv/set_scno.c \
linux/riscv/signalent1.h \
linux/riscv/syscallent.h \
linux/riscv/syscallent1.h \
linux/rt_sigframe.h \
linux/s390/arch_regs.c \
linux/s390/arch_regs.h \
linux/s390/arch_rt_sigframe.c \
linux/s390/arch_sigreturn.c \
linux/s390/get_error.c \
linux/s390/get_scno.c \
linux/s390/get_syscall_args.c \
linux/s390/ioctls_arch0.h \
linux/s390/ioctls_inc0.h \
linux/s390/rt_sigframe.h \
linux/s390/set_error.c \
linux/s390/set_scno.c \
linux/s390/syscallent.h \
linux/s390/userent.h \
linux/s390/userent0.h \
linux/s390/userent1.h \
linux/s390x/arch_regs.c \
linux/s390x/arch_regs.h \
linux/s390x/arch_rt_sigframe.c \
linux/s390x/arch_sigreturn.c \
linux/s390x/get_error.c \
linux/s390x/get_scno.c \
linux/s390x/get_syscall_args.c \
linux/s390x/ioctls_arch0.h \
linux/s390x/ioctls_inc0.h \
linux/s390x/rt_sigframe.h \
linux/s390x/set_error.c \
linux/s390x/set_scno.c \
linux/s390x/syscallent.h \
linux/s390x/userent.h \
linux/sh/arch_getrval2.c \
linux/sh/arch_regs.c \
linux/sh/arch_rt_sigframe.c \
linux/sh/get_error.c \
linux/sh/get_scno.c \
linux/sh/get_syscall_args.c \
linux/sh/get_syscall_result.c \
linux/sh/ioctls_arch0.h \
linux/sh/ioctls_inc0.h \
linux/sh/set_error.c \
linux/sh/set_scno.c \
linux/sh/syscallent.h \
linux/sh/userent.h \
linux/sh/userent0.h \
linux/sh64/arch_regs.c \
linux/sh64/arch_regs.h \
linux/sh64/arch_rt_sigframe.c \
linux/sh64/get_error.c \
linux/sh64/get_scno.c \
linux/sh64/get_syscall_args.c \
linux/sh64/get_syscall_result.c \
linux/sh64/ioctls_arch0.h \
linux/sh64/ioctls_inc0.h \
linux/sh64/rt_sigframe.h \
linux/sh64/set_error.c \
linux/sh64/set_scno.c \
linux/sh64/syscallent.h \
linux/sh64/userent.h \
linux/signalent.h \
@ -563,6 +675,7 @@ EXTRA_DIST = \
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 \
@ -571,12 +684,16 @@ EXTRA_DIST = \
linux/sparc/get_syscall_args.c \
linux/sparc/ioctls_arch0.h \
linux/sparc/ioctls_inc0.h \
linux/sparc/rt_sigframe.h \
linux/sparc/set_error.c \
linux/sparc/set_scno.c \
linux/sparc/signalent.h \
linux/sparc/syscallent.h \
linux/sparc/userent.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_sigreturn.c \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
@ -587,6 +704,9 @@ EXTRA_DIST = \
linux/sparc64/ioctls_arch1.h \
linux/sparc64/ioctls_inc0.h \
linux/sparc64/ioctls_inc1.h \
linux/sparc64/rt_sigframe.h \
linux/sparc64/set_error.c \
linux/sparc64/set_scno.c \
linux/sparc64/signalent.h \
linux/sparc64/signalent1.h \
linux/sparc64/syscallent.h \
@ -596,6 +716,7 @@ EXTRA_DIST = \
linux/syscall.h \
linux/tile/arch_regs.c \
linux/tile/arch_regs.h \
linux/tile/arch_rt_sigframe.c \
linux/tile/arch_sigreturn.c \
linux/tile/errnoent1.h \
linux/tile/get_error.c \
@ -605,6 +726,9 @@ EXTRA_DIST = \
linux/tile/ioctls_arch1.h \
linux/tile/ioctls_inc0.h \
linux/tile/ioctls_inc1.h \
linux/tile/rt_sigframe.h \
linux/tile/set_error.c \
linux/tile/set_scno.c \
linux/tile/signalent1.h \
linux/tile/syscallent.h \
linux/tile/syscallent1.h \
@ -615,6 +739,7 @@ EXTRA_DIST = \
linux/userent0.h \
linux/x32/arch_regs.c \
linux/x32/arch_regs.h \
linux/x32/arch_rt_sigframe.c \
linux/x32/arch_sigreturn.c \
linux/x32/errnoent1.h \
linux/x32/get_error.c \
@ -624,12 +749,16 @@ EXTRA_DIST = \
linux/x32/ioctls_arch1.h \
linux/x32/ioctls_inc0.h \
linux/x32/ioctls_inc1.h \
linux/x32/rt_sigframe.h \
linux/x32/set_error.c \
linux/x32/set_scno.c \
linux/x32/signalent1.h \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
linux/x86_64/arch_regs.c \
linux/x86_64/arch_regs.h \
linux/x86_64/arch_rt_sigframe.c \
linux/x86_64/arch_sigreturn.c \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
@ -637,13 +766,15 @@ EXTRA_DIST = \
linux/x86_64/get_error.c \
linux/x86_64/get_scno.c \
linux/x86_64/get_syscall_args.c \
linux/x86_64/getregs_old.c \
linux/x86_64/ioctls_arch0.h \
linux/x86_64/ioctls_arch1.h \
linux/x86_64/ioctls_arch2.h \
linux/x86_64/ioctls_inc0.h \
linux/x86_64/ioctls_inc1.h \
linux/x86_64/ioctls_inc2.h \
linux/x86_64/rt_sigframe.h \
linux/x86_64/set_error.c \
linux/x86_64/set_scno.c \
linux/x86_64/signalent1.h \
linux/x86_64/signalent2.h \
linux/x86_64/syscallent.h \
@ -651,12 +782,15 @@ EXTRA_DIST = \
linux/x86_64/syscallent2.h \
linux/x86_64/userent.h \
linux/xtensa/arch_regs.c \
linux/xtensa/arch_rt_sigframe.c \
linux/xtensa/get_error.c \
linux/xtensa/get_scno.c \
linux/xtensa/get_syscall_args.c \
linux/xtensa/get_syscall_result.c \
linux/xtensa/ioctls_arch0.h \
linux/xtensa/ioctls_inc0.h \
linux/xtensa/set_error.c \
linux/xtensa/set_scno.c \
linux/xtensa/syscallent.h \
linux/xtensa/userent.h \
maint/ioctls_gen.sh \
@ -667,6 +801,7 @@ EXTRA_DIST = \
mpers.sh \
mpers_test.sh \
mpers_xlat.h \
scno.head \
signalent.sh \
strace-graph \
strace-log-merge \
@ -677,6 +812,9 @@ EXTRA_DIST = \
xlat/gen.sh \
xlate.el
.PHONY: check-valgrind-local
check-valgrind-local:
.PHONY: srpm
srpm: dist-xz
rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
@ -720,9 +858,9 @@ news-check: NEWS
ioctlsort_CC = $(CC_FOR_BUILD)
ioctlsort_DEFS = $(DEFS)
ioctlsort_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
ioctlsort_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD)
ioctlsort_CFLAGS = $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
ioctlsort_CPPFLAGS = $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD)
ioctlsort_CFLAGS = $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
ioctlsort_LDFLAGS = $(AM_LDFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD)
ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
@ -739,10 +877,19 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
ioctlent%.h: ioctlsort%
./$< > $@
# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
# ioctlsort *for build*, hence this magic.
ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
$(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
ioctl_iocdef.h: ioctl_iocdef.i
sed -n 's/^DEFINE HOST/#define /p' $< > $@
ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
$(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
$(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
@ -751,9 +898,14 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioc
BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
ioctl_iocdef.h ioctl_iocdef.i \
native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
include scno.am
$(strace_OBJECTS): scno.h
# defines mpers_source_files
include mpers.am
srcdir_mpers_source_files = $(patsubst %,$(srcdir)/%,$(mpers_source_files))
@ -780,7 +932,7 @@ mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
m%_type_defs.h: $(srcdir_mpers_source_files)
for f in $^; do \
sed -r -n 's/^#include DEF_MPERS_TYPE\(([^)]+)\)/#ifdef MPERS_$(mpers_PREFIX)\1\n# define \1 MPERS_$(mpers_PREFIX)\1\n#endif/p' $$f || exit; \
sed -r -n 's/^#[[:space:]]*include DEF_MPERS_TYPE\(([^)]+)\)/#ifdef MPERS_$(mpers_PREFIX)\1\n# define \1 MPERS_$(mpers_PREFIX)\1\n#endif/p' $$f || exit; \
done > $@-t
echo '#undef MPERS_PRINTER_NAME' >> $@-t
echo '#define MPERS_PRINTER_NAME(printer_name) printer_name' >> $@-t

102
NEWS
View File

@ -1,3 +1,105 @@
Noteworthy changes in release ?.?? (????-??-??)
===============================================
* Changes in command line syntax
* Syscall classes specified in -e trace= option now have % prefix (like
-e trace=%process). Old style class names without leading % are still
supported, but considered deprecated now.
* Improvements
* Enhanced decoding of sched_setattr syscall.
* Added -e trace=%sched option for tracing sched_* syscalls.
* Implemented decoding of signal mask in rt_sigreturn syscall on alpha, arc,
arm, avr32, bfin, cris, hppa, m68k, metag, microblaze, mips, nios2, or1k,
powerpc, powerpc64, riscv, sh, sh64, sparc, sparc64, tile, x86, and xtensa
architectures.
* Implemented decoding of statx syscall.
* Updated lists of ioctl commands from Linux 4.11.
* Portability
* On powerpc and powerpc64 linux kernel >= 2.6.23 is required.
Older versions without a decent PTRACE_GETREGS support will not work.
* On x86_64 linux kernel >= 2.6.34 is required.
Older versions without a decent PTRACE_GETREGSET support will not work.
* Bug fixes
* Fixed decoding of flags argument of preadv2 and pwritev2 syscalls on x32.
Noteworthy changes in release 4.16 (2017-02-14)
===============================================
* Improvements
* Implemented syscall return value injection (-e inject=SET:retval= option).
* Implemented signal injection (-e inject=SET:signal= option).
* Implemented decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE.
* Implemented decoding of all SG_* ioctl commands.
* Implemented decoding of ustat syscall.
* Implemented decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
and BPF_PROG_DETACH commands of bpf syscall.
* Enhanced decoding of sg_io_hdr and sg_io_v4 structures.
* Enhanced decoding of get_robust_list, getrandom, io_submit, set_robust_list
syscalls.
* Enhanced decoding of entities of kernel long type on x32 and mips n32 ABIs.
* Updated lists of IP_*, IPV6_*, and LOOP_* constants.
* Updated lists of ioctl commands from Linux 4.10.
* Added decoding of recently added syscalls on avr32, microblaze, ppc,
and ppc64.
* Bug fixes
* Fixed pathmatch of oldselect syscall on 64-bit architectures.
* Fixed decoding of mmap2 syscall on s390 when arguments are not available.
* Fixed decoding of kexec_file_load, mprotect, pkey_mprotect, prctl, preadv*,
and pwritev* syscalls on x32.
* Fixed printing of string arguments of getxattr and setxattr syscalls
when -s option is used to limit the printed string size.
* Fixed decoding of ifconf, ifreq, and loop_info structures on non-native
personalities.
* Fixed decoding of SG_* and LOOP_* ioctl commands.
* Fixed build on mips with musl libc.
* Fixed cross-building of ioctlsort.
* Applied minor formatting fixes to the manual page.
Noteworthy changes in release 4.15 (2016-12-14)
===============================================
* Changes in behavior
* Time stamps are now printed according to ISO 8601.
* Changed output format of val3 parameter of futex FUTEX_WAKE_OP operation.
* The last argument of mincore, sched_getaffinity, and sched_setaffinity
syscalls is now formatted as an array.
* Improvements
* Implemented syscall fault injection (-e fault=... option).
* Implemented decoding of DM_* ioctl commands.
* Implemented decoding of attr parameter of perf_event_open syscall.
* Implemented decoding of pkey_alloc, pkey_free, and pkey_mprotect syscalls.
* Implemented dumping of mq_timedsend and mq_timedreceive syscalls.
* Implemented decoding of PR_SET_FP_MODE and PR_GET_FP_MODE operations
of prctl syscall.
* Implemented PTRACE_GETREGS API support on m68k.
* Updated lists of ARCH_*, BPF_*, BTRFS_*, FALLOC_*, MS_*, *_MAGIC,
and V4L2_* constants.
* Updated lists of ioctl commands from Linux 4.9.
* Added decoding of recently added syscalls on arc, x32, and xtensa.
* Enhanced manual page.
* Bug fixes
* Fixed corner cases in decoding of exit, exit_group, futimesat, getgroups,
getresuid, init_module, inotify_init1, kcmp, kexec_load, lookup_dcookie,
mq_getsetattr, mq_notify, mq_open, mq_timedreceive, mq_timedsend,
name_to_handle_at, prctl, process_vm_readv, process_vm_writev, setfsuid,
setgroups, setns, unshare, and utimes syscalls.
* Fixed handling of verbose flag in printing of controls array
of struct v4l2_ext_controls.
* Fixed omission of field names in the output of capability, sigaction,
sigevent, statfs, timespec, timeval, and utimbuf structures.
* Fixed printing of unknown syscalls in siginfo structure.
* Fixed decoding of ioctl constants on m68k.
* Fixed cris architecture support.
* Fixed cross build when host compiler does not support the same
set of warning flags as the cross compiler.
* Fixed build on SLE10 and SLE11.
Noteworthy changes in release 4.14 (2016-10-04)
===============================================

2
README
View File

@ -8,7 +8,7 @@ See the file INSTALL for compilation and installation instructions.
See the file NEWS for information on what has changed in recent versions.
The project's homepage is at
https://sourceforge.net/projects/strace/
https://strace.io
strace has a mailing list:
strace-devel@lists.sourceforge.net.

View File

@ -1,10 +1,6 @@
Requirements
============
If you use the GIT version of strace there will be some files missing
that you need to build strace. These files are generated by tools from
the GNU Autoconf and Automake packages.
Note: rather than run `autoreconf' directly, use the `./bootstrap' script.
If you use the GIT version of strace, please refer to INSTALL-git.md file.
No more ChangeLog file

View File

@ -1,9 +1,14 @@
This is [strace](http://strace.io) -- a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as [ptrace](http://man7.org/linux/man-pages/man2/ptrace.2.html).
strace - the linux syscall tracer
=================================
strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file [COPYING](https://raw.githubusercontent.com/strace/strace/master/COPYING) for details.
This is [strace](https://strace.io) -- a diagnostic, debugging and instructional userspace utility with a traditional command-line interface for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as [ptrace](http://man7.org/linux/man-pages/man2/ptrace.2.html).
See the file [NEWS](https://raw.githubusercontent.com/strace/strace/master/NEWS) for information on what has changed in recent versions.
strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file [COPYING](COPYING) for details.
Please send bug reports and enhancements to [the strace mailing list](https://lists.sourceforge.net/lists/listinfo/strace-devel).
See the file [NEWS](NEWS) for information on what has changed in recent versions.
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.
[![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

@ -35,10 +35,21 @@ get_cpuset_size(void)
static unsigned int cpuset_size;
if (!cpuset_size) {
pid_t pid = getpid();
/*
* If the cpuset size passed to sched_getaffinity is less
* than necessary to store the bitmask, the kernel does not
* look at the mask pointer and fails with EINVAL.
*
* If the cpuset size is large enough, the kernel fails with
* EFAULT on inaccessible mask pointers.
*
* This undocumented kernel feature can be used to probe
* the kernel and find out the minimal valid cpuset size
* without allocating any memory for the CPU affinity mask.
*/
cpuset_size = 128;
while (cpuset_size &&
sched_getaffinity(pid, cpuset_size, NULL) == -1 &&
sched_getaffinity(0, cpuset_size, NULL) == -1 &&
EINVAL == errno) {
cpuset_size <<= 1;
}
@ -50,7 +61,8 @@ get_cpuset_size(void)
}
static void
print_affinitylist(struct tcb *tcp, const unsigned long addr, const unsigned int len)
print_affinitylist(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned int len)
{
const unsigned int max_size = get_cpuset_size();
const unsigned int umove_size = len < max_size ? len : max_size;
@ -75,7 +87,7 @@ print_affinitylist(struct tcb *tcp, const unsigned long addr, const unsigned int
if (i < 0)
break;
tprintf("%s%d", sep, i);
sep = " ";
sep = ", ";
}
if (size < len)
tprintf("%s...", sep);

26
aio.c
View File

@ -87,7 +87,7 @@ print_common_flags(struct tcb *tcp, const struct iocb *cb)
printfd(tcp, cb->aio_resfd);
}
if (cb->aio_flags & ~IOCB_FLAG_RESFD)
tprintf(", flags=%x", cb->aio_flags);
tprintf(", flags=%#x", cb->aio_flags);
#endif
}
@ -130,8 +130,7 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
case SUB_COMMON:
if (cb->aio_lio_opcode == 1 && iocb_is_valid(cb)) {
tprints(", str=");
printstr(tcp, (unsigned long) cb->aio_buf,
(unsigned long) cb->aio_nbytes);
printstrn(tcp, cb->aio_buf, cb->aio_nbytes);
} else {
tprintf(", buf=%#" PRIx64, (uint64_t) cb->aio_buf);
}
@ -162,13 +161,13 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
static bool
print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
unsigned long addr;
kernel_ulong_t addr;
struct iocb cb;
if (elem_size < sizeof(long)) {
if (elem_size < sizeof(kernel_ulong_t)) {
addr = * (unsigned int *) elem_buf;
} else {
addr = * (unsigned long *) elem_buf;
addr = * (kernel_ulong_t *) elem_buf;
}
tprints("{");
@ -181,12 +180,13 @@ print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
SYS_FUNC(io_submit)
{
const long nr = widen_to_long(tcp->u_arg[1]);
const unsigned long addr = tcp->u_arg[2];
unsigned long iocbp;
const kernel_long_t nr =
truncate_klong_to_current_wordsize(tcp->u_arg[1]);
const kernel_ulong_t addr = tcp->u_arg[2];
kernel_ulong_t iocbp;
printaddr(tcp->u_arg[0]);
tprintf(", %ld, ", nr);
tprintf(", %" PRI_kld ", ", nr);
if (nr < 0)
printaddr(addr);
@ -237,9 +237,9 @@ SYS_FUNC(io_getevents)
{
if (entering(tcp)) {
printaddr(tcp->u_arg[0]);
tprintf(", %ld, %ld, ",
widen_to_long(tcp->u_arg[1]),
widen_to_long(tcp->u_arg[2]));
tprintf(", %" PRI_kld ", %" PRI_kld ", ",
truncate_klong_to_current_wordsize(tcp->u_arg[1]),
truncate_klong_to_current_wordsize(tcp->u_arg[2]));
} else {
struct io_event buf;
print_array(tcp, tcp->u_arg[3], tcp->u_rval, &buf, sizeof(buf),

19
bjm.c
View File

@ -33,17 +33,9 @@
#include "xlat/delete_module_flags.h"
SYS_FUNC(create_module)
{
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
return RVAL_DECODED | RVAL_HEX;
}
SYS_FUNC(delete_module)
{
printstr(tcp, tcp->u_arg[0], -1);
printstr(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(delete_module_flags, tcp->u_arg[1], "O_???");
@ -53,15 +45,12 @@ SYS_FUNC(delete_module)
SYS_FUNC(init_module)
{
printaddr(tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2], -1);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2]);
return RVAL_DECODED;
}
#define MODULE_INIT_IGNORE_MODVERSIONS 1
#define MODULE_INIT_IGNORE_VERMAGIC 2
#include "xlat/module_init_flags.h"
SYS_FUNC(finit_module)
@ -70,7 +59,7 @@ SYS_FUNC(finit_module)
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* param_values */
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, tcp->u_arg[1]);
tprints(", ");
/* flags */
printflags(module_init_flags, tcp->u_arg[2], "MODULE_INIT_???");

40
block.c
View File

@ -32,9 +32,27 @@
#include DEF_MPERS_TYPE(struct_blkpg_ioctl_arg)
#include DEF_MPERS_TYPE(struct_blkpg_partition)
#include <linux/blkpg.h>
#include <linux/ioctl.h>
#include <linux/fs.h>
typedef struct {
int op;
int flags;
int datalen;
void *data;
} struct_blkpg_ioctl_arg;
#define BLKPG_DEVNAMELTH 64
#define BLKPG_VOLNAMELTH 64
typedef struct {
int64_t start; /* starting offset in bytes */
int64_t length; /* length in bytes */
int pno; /* partition number */
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
to be used in kernel messages */
char volname[BLKPG_VOLNAMELTH]; /* volume label */
} struct_blkpg_partition;
#define BLKTRACE_BDEV_SIZE 32
typedef struct blk_user_trace_setup {
char name[BLKTRACE_BDEV_SIZE]; /* output */
@ -46,11 +64,12 @@ typedef struct blk_user_trace_setup {
uint32_t pid;
} struct_blk_user_trace_setup;
typedef struct blkpg_ioctl_arg struct_blkpg_ioctl_arg;
typedef struct blkpg_partition struct_blkpg_partition;
#include MPERS_DEFS
#ifndef BLKPG
# define BLKPG _IO(0x12,105)
#endif
/*
* ioctl numbers <= 114 are present in Linux 2.4. The following ones have been
* added since then and headers containing them may not be available on every
@ -110,9 +129,10 @@ print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg)
tprintf(", flags=%d, datalen=%d, data=",
blkpg->flags, blkpg->datalen);
if (!umove_or_printaddr(tcp, (long) blkpg->data, &p)) {
tprintf("{start=%lld, length=%lld, pno=%d, devname=",
(long long) p.start, (long long) p.length, p.pno);
if (!umove_or_printaddr(tcp, ptr_to_kulong(blkpg->data), &p)) {
tprintf("{start=%" PRId64 ", length=%" PRId64
", pno=%d, devname=",
p.start, p.length, p.pno);
print_quoted_string(p.devname, sizeof(p.devname),
QUOTE_0_TERMINATED);
tprints(", volname=");
@ -123,14 +143,14 @@ print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg)
tprints("}");
}
MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *tcp,
const unsigned int code, const long arg)
MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
/* take arg as a value, not as a pointer */
case BLKRASET:
case BLKFRASET:
tprintf(", %lu", arg);
tprintf(", %" PRI_klu, arg);
break;
/* return an unsigned short */

111
bpf.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2017 Quentin Monnet <quentin.monnet@6wind.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -35,9 +36,12 @@
#include "xlat/bpf_map_types.h"
#include "xlat/bpf_prog_types.h"
#include "xlat/bpf_map_update_elem_flags.h"
#include "xlat/bpf_attach_type.h"
#include "xlat/bpf_attach_flags.h"
static int
bpf_map_create(struct tcb *tcp, const long addr, unsigned int size)
bpf_map_create(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_type, key_size, value_size, max_entries;
@ -61,7 +65,8 @@ bpf_map_create(struct tcb *tcp, const long addr, unsigned int size)
}
static void
bpf_map_update_elem(struct tcb *tcp, const long addr, unsigned int size)
bpf_map_update_elem(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_fd;
@ -88,7 +93,8 @@ bpf_map_update_elem(struct tcb *tcp, const long addr, unsigned int size)
}
static void
bpf_map_delete_elem(struct tcb *tcp, const long addr, unsigned int size)
bpf_map_delete_elem(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_fd;
@ -110,7 +116,8 @@ bpf_map_delete_elem(struct tcb *tcp, const long addr, unsigned int size)
}
static int
bpf_map_io(struct tcb *tcp, const long addr, unsigned int size, const char *text)
bpf_map_io(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int size,
const char *const text)
{
struct bpf_io_elem_struct {
uint32_t map_fd;
@ -142,7 +149,8 @@ bpf_map_io(struct tcb *tcp, const long addr, unsigned int size, const char *text
}
static int
bpf_prog_load(struct tcb *tcp, const long addr, unsigned int size)
bpf_prog_load(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t prog_type, insn_cnt;
@ -165,17 +173,92 @@ bpf_prog_load(struct tcb *tcp, const long addr, unsigned int size)
printxval(bpf_prog_types, attr.prog_type, "BPF_PROG_TYPE_???");
tprintf(", insn_cnt=%u, insns=%#" PRIx64 ", license=",
attr.insn_cnt, attr.insns);
printstr(tcp, attr.license, -1);
printstr(tcp, attr.license);
tprintf(", log_level=%u, log_size=%u, log_buf=%#" PRIx64 ", kern_version=%u}",
attr.log_level, attr.log_size, attr.log_buf, attr.kern_version);
return RVAL_DECODED | RVAL_FD;
}
static int
bpf_obj_manage(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
uint32_t bpf_fd;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED | RVAL_FD;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED | RVAL_FD;
tprints("{pathname=");
printpath(tcp, attr.pathname);
tprints(", bpf_fd=");
printfd(tcp, attr.bpf_fd);
tprints("}");
return RVAL_DECODED | RVAL_FD;
}
static int
bpf_prog_attach_detach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size, bool print_attach)
{
struct {
uint32_t target_fd, attach_bpf_fd, attach_type, attach_flags;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED;
tprints("{target_fd=");
printfd(tcp, attr.target_fd);
if (print_attach) {
tprints(", attach_bpf_fd=");
printfd(tcp, attr.attach_bpf_fd);
}
tprints(", attach_type=");
printxval(bpf_attach_type, attr.attach_type, "BPF_???");
if (print_attach) {
tprints(", attach_flags=");
printflags(bpf_attach_flags, attr.attach_flags, "BPF_F_???");
}
tprints("}");
return RVAL_DECODED;
}
static int
bpf_prog_attach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
return bpf_prog_attach_detach(tcp, addr, size, true);
}
static int
bpf_prog_detach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
return bpf_prog_attach_detach(tcp, addr, size, false);
}
SYS_FUNC(bpf)
{
const int cmd = tcp->u_arg[0];
const long addr = tcp->u_arg[1];
const unsigned int cmd = tcp->u_arg[0];
const kernel_ulong_t addr = tcp->u_arg[1];
const unsigned int size = tcp->u_arg[2];
int rc = RVAL_DECODED;
@ -203,6 +286,18 @@ SYS_FUNC(bpf)
case BPF_PROG_LOAD:
rc = bpf_prog_load(tcp, addr, size);
break;
case BPF_OBJ_PIN:
rc = bpf_obj_manage(tcp, addr, size);
break;
case BPF_OBJ_GET:
rc = bpf_obj_manage(tcp, addr, size);
break;
case BPF_PROG_ATTACH:
rc = bpf_prog_attach(tcp, addr, size);
break;
case BPF_PROG_DETACH:
rc = bpf_prog_detach(tcp, addr, size);
break;
default:
printaddr(addr);
break;

17
btrfs.c
View File

@ -204,7 +204,7 @@ btrfs_print_balance_args(const char *name, const struct btrfs_balance_args *bba)
}
static void
btrfs_print_balance(struct tcb *tcp, const long arg, bool out)
btrfs_print_balance(struct tcb *const tcp, const kernel_ulong_t arg, bool out)
{
struct btrfs_ioctl_balance_args balance_args;
@ -376,7 +376,7 @@ print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
}
static void
btrfs_print_qgroup_inherit(struct tcb *tcp, const unsigned long qgi_addr)
btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr)
{
struct btrfs_qgroup_inherit inherit;
@ -512,7 +512,8 @@ print_btrfs_ioctl_space_info(struct tcb *tcp, void *elem_buf,
}
MPERS_PRINTER_DECL(int, btrfs_ioctl,
struct tcb *tcp, const unsigned int code, const long arg)
struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
/* Take no arguments; command only. */
@ -1216,7 +1217,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("...");
else {
uint64_t record;
print_array(tcp, (unsigned long) args.clone_sources,
print_array(tcp, ptr_to_kulong(args.clone_sources),
args.clone_sources_count,
&record, sizeof(record),
umoven_or_printaddr,
@ -1316,11 +1317,11 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
printflags64(btrfs_snap_flags_v2, args.flags,
"BTRFS_SUBVOL_???");
if (args.flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
tprintf(", size=%llu, qgroup_inherit=",
(unsigned long long) args.size);
tprintf(", size=%" PRIu64 ", qgroup_inherit=",
(uint64_t) args.size);
btrfs_print_qgroup_inherit(tcp,
(unsigned long) args.qgroup_inherit);
ptr_to_kulong(args.qgroup_inherit));
}
tprints(", name=");
print_quoted_string(args.name, sizeof(args.name),
@ -1328,7 +1329,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("}");
return 0;
}
tprintf("{transid=%llu}", (unsigned long long) args.transid);
tprintf("{transid=%" PRIu64 "}", (uint64_t) args.transid);
break;
}

View File

@ -52,19 +52,19 @@ enum {
#include "xlat/cap_version.h"
typedef struct user_cap_header_struct {
struct user_cap_header_struct {
uint32_t version;
int pid;
} *cap_user_header_t;
};
typedef struct user_cap_data_struct {
struct user_cap_data_struct {
uint32_t effective;
uint32_t permitted;
uint32_t inheritable;
} *cap_user_data_t;
};
static cap_user_header_t
get_cap_header(struct tcb *tcp, unsigned long addr)
static const struct user_cap_header_struct *
get_cap_header(struct tcb *const tcp, const kernel_ulong_t addr)
{
static struct user_cap_header_struct header;
@ -78,17 +78,18 @@ get_cap_header(struct tcb *tcp, unsigned long addr)
}
static void
print_cap_header(struct tcb *tcp, unsigned long addr, cap_user_header_t h)
print_cap_header(struct tcb *const tcp, const kernel_ulong_t addr,
const struct user_cap_header_struct *const h)
{
if (!addr || !h) {
printaddr(addr);
return;
}
tprints("{");
tprints("{version=");
printxval(cap_version, h->version,
"_LINUX_CAPABILITY_VERSION_???");
tprintf(", %d}", h->pid);
tprintf(", pid=%d}", h->pid);
}
static void
@ -105,7 +106,8 @@ print_cap_bits(const uint32_t lo, const uint32_t hi)
}
static void
print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
print_cap_data(struct tcb *const tcp, const kernel_ulong_t addr,
const struct user_cap_header_struct *const h)
{
struct user_cap_data_struct data[2];
unsigned int len;
@ -124,18 +126,18 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
if (umoven_or_printaddr(tcp, addr, len * sizeof(data[0]), data))
return;
tprints("{");
tprints("{effective=");
print_cap_bits(data[0].effective, len > 1 ? data[1].effective : 0);
tprints(", ");
tprints(", permitted=");
print_cap_bits(data[0].permitted, len > 1 ? data[1].permitted : 0);
tprints(", ");
tprints(", inheritable=");
print_cap_bits(data[0].inheritable, len > 1 ? data[1].inheritable : 0);
tprints("}");
}
SYS_FUNC(capget)
{
cap_user_header_t h;
const struct user_cap_header_struct *h;
if (entering(tcp)) {
h = get_cap_header(tcp, tcp->u_arg[0]);
@ -150,7 +152,8 @@ SYS_FUNC(capget)
SYS_FUNC(capset)
{
cap_user_header_t h = get_cap_header(tcp, tcp->u_arg[0]);
const struct user_cap_header_struct *const h =
get_cap_header(tcp, tcp->u_arg[0]);
print_cap_header(tcp, tcp->u_arg[0], h);
tprints(", ");
print_cap_data(tcp, tcp->u_arg[1], h);

53
clone.c
View File

@ -30,14 +30,16 @@
*/
#include "defs.h"
#include <sched.h>
#include <asm/unistd.h>
#ifndef CSIGNAL
# define CSIGNAL 0x000000ff
#endif
#include "xlat/clone_flags.h"
#include "xlat/setns_types.h"
#include "xlat/unshare_flags.h"
#if defined IA64
# define ARG_FLAGS 0
@ -73,25 +75,40 @@
# define ARG_CTID 4
#endif
#if defined I386 || defined X86_64 || defined X32
extern void print_user_desc(struct tcb *, long);
#endif /* I386 || X86_64 || X32 */
static void
print_tls_arg(struct tcb *const tcp, const kernel_ulong_t addr)
{
#ifdef HAVE_STRUCT_USER_DESC
# if SUPPORTED_PERSONALITIES > 1
if (current_personality == 1)
# endif
{
print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
}
# if SUPPORTED_PERSONALITIES > 1
else
# endif
#endif /* HAVE_STRUCT_USER_DESC */
{
printaddr(tcp->u_arg[ARG_TLS]);
}
}
SYS_FUNC(clone)
{
if (exiting(tcp)) {
const char *sep = "|";
unsigned long flags = tcp->u_arg[ARG_FLAGS];
kernel_ulong_t flags = tcp->u_arg[ARG_FLAGS];
tprints("child_stack=");
printaddr(tcp->u_arg[ARG_STACK]);
tprints(", ");
#ifdef ARG_STACKSIZE
if (ARG_STACKSIZE != -1)
tprintf("stack_size=%#lx, ",
tprintf("stack_size=%#" PRI_klx ", ",
tcp->u_arg[ARG_STACKSIZE]);
#endif
tprints("flags=");
if (!printflags(clone_flags, flags &~ CSIGNAL, NULL))
if (!printflags64(clone_flags, flags &~ CSIGNAL, NULL))
sep = "";
if ((flags & CSIGNAL) != 0)
tprintf("%s%s", sep, signame(flags & CSIGNAL));
@ -103,22 +120,8 @@ SYS_FUNC(clone)
printaddr(tcp->u_arg[ARG_PTID]);
}
if (flags & CLONE_SETTLS) {
#if defined I386 || defined X86_64 || defined X32
# ifndef I386
if (current_personality == 1)
# endif
{
tprints(", tls=");
print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
}
# ifndef I386
else
# endif
#endif /* I386 || X86_64 || X32 */
{
tprints(", tls=");
printaddr(tcp->u_arg[ARG_TLS]);
}
tprints(", tls=");
print_tls_arg(tcp, tcp->u_arg[ARG_TLS]);
}
if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) {
tprints(", child_tidptr=");
@ -144,14 +147,14 @@ SYS_FUNC(setns)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
printxval(setns_types, tcp->u_arg[1], "CLONE_NEW???");
return RVAL_DECODED;
}
SYS_FUNC(unshare)
{
printflags_long(clone_flags, tcp->u_arg[0], "CLONE_???");
printflags64(unshare_flags, tcp->u_arg[0], "CLONE_???");
return RVAL_DECODED;
}

View File

@ -32,11 +32,15 @@
AC_PREREQ(2.57)
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
[strace-devel@lists.sourceforge.net])
[strace-devel@lists.sourceforge.net],
[strace],
[https://strace.io])
AC_COPYRIGHT([Copyright (C) 1999-2017 The strace developers.])
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests])
AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
@ -47,6 +51,7 @@ AC_SUBST(DEB_CHANGELOGTIME)
AC_PROG_CC
AC_PROG_CPP
st_WARN_CFLAGS
AX_PROG_CC_FOR_BUILD
AC_PROG_INSTALL
AC_PROG_RANLIB
@ -210,29 +215,26 @@ AC_SUBST(arch_mx32)
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],
[#include <sgidefs.h>],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], ,
[AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
# requires GCC >= 3.4
AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIO32 ? 1 : - 1];]])],
[st_cv_mips_abi=o32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIN32 ? 1 : - 1];]])],
[st_cv_mips_abi=n32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABI64 ? 1 : - 1];]])],
[st_cv_mips_abi=n64],
[st_cv_mips_abi=unknown])])])])
case "$st_cv_mips_abi" in
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _ABIO32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _ABIN32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _ABI64.]);;
*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
esac
MIPS_ABI="$st_cv_mips_abi"
@ -251,29 +253,6 @@ esac
AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
[Define to 1 if you want OABI support on ARM EABI.])
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wempty-body])
gl_WARN_ADD([-Wformat-security])
gl_WARN_ADD([-Wignored-qualifiers])
gl_WARN_ADD([-Winit-self])
gl_WARN_ADD([-Wlogical-op])
gl_WARN_ADD([-Wmissing-parameter-type])
gl_WARN_ADD([-Wnested-externs])
gl_WARN_ADD([-Wold-style-declaration])
gl_WARN_ADD([-Wold-style-definition])
gl_WARN_ADD([-Wsign-compare])
gl_WARN_ADD([-Wtype-limits])
gl_WARN_ADD([-Wwrite-strings])
AC_ARG_ENABLE([gcc-Werror],
[AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
[case $enableval in
yes) gl_WARN_ADD([-Werror]) ;;
no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
esac]
)
AC_SUBST([WARN_CFLAGS])
AC_C_BIGENDIAN
AC_C_TYPEOF
@ -291,7 +270,6 @@ AC_CHECK_FUNCS(m4_normalize([
futimens
if_indextoname
open64
pipe2
prctl
preadv
process_vm_readv
@ -316,12 +294,12 @@ 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_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,,
[#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
AC_CHECK_TYPES(m4_normalize([
struct pt_all_user_regs,
struct ia64_fpreg,
@ -347,6 +325,30 @@ AC_CHECK_MEMBERS(m4_normalize([
siginfo_t.si_overrun
]),,, [#include <signal.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct perf_event_attr.precise_ip,
struct perf_event_attr.mmap_data,
struct perf_event_attr.sample_id_all,
struct perf_event_attr.exclude_host,
struct perf_event_attr.exclude_guest,
struct perf_event_attr.exclude_callchain_kernel,
struct perf_event_attr.exclude_callchain_user,
struct perf_event_attr.mmap2,
struct perf_event_attr.comm_exec,
struct perf_event_attr.use_clockid,
struct perf_event_attr.context_switch,
struct perf_event_attr.write_backward,
struct perf_event_attr.bp_type,
struct perf_event_attr.config1,
struct perf_event_attr.config2,
struct perf_event_attr.branch_sample_type,
struct perf_event_attr.sample_regs_user,
struct perf_event_attr.sample_stack_user,
struct perf_event_attr.sample_regs_intr,
struct perf_event_attr.aux_watermark,
struct perf_event_attr.sample_max_stack
]),,, [#include <linux/perf_event.h>])
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/sysmips.h
@ -354,6 +356,7 @@ AC_CHECK_HEADERS(m4_normalize([
elf.h
inttypes.h
linux/bsg.h
linux/dm-ioctl.h
linux/dqblk_xfs.h
linux/falloc.h
linux/fiemap.h
@ -387,6 +390,7 @@ AC_CHECK_HEADERS(m4_normalize([
sys/shm.h
sys/signalfd.h
sys/xattr.h
ustat.h
]))
AC_CHECK_HEADERS([asm/sigcontext.h],,, [#include <signal.h>])
@ -419,6 +423,28 @@ AC_CHECK_HEADERS([linux/bpf.h], [
AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
[Define to 1 if union bpf_attr.log_buf initialization works])
fi
AC_CACHE_CHECK([whether union bpf_attr.bpf_fd initialization works],
[st_cv_have_union_bpf_attr_bpf_fd],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .bpf_fd = 0 };]])],
[st_cv_have_union_bpf_attr_bpf_fd=yes],
[st_cv_have_union_bpf_attr_bpf_fd=no])])
if test $st_cv_have_union_bpf_attr_bpf_fd = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_BPF_FD, [1],
[Define to 1 if union bpf_attr.bpf_fd initialization works])
fi
AC_CACHE_CHECK([whether union bpf_attr.attach_flags initialization works],
[st_cv_have_union_bpf_attr_attach_flags],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .attach_flags = 0 };]])],
[st_cv_have_union_bpf_attr_attach_flags=yes],
[st_cv_have_union_bpf_attr_attach_flags=no])])
if test $st_cv_have_union_bpf_attr_attach_flags = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_ATTACH_FLAGS, [1],
[Define to 1 if union bpf_attr.attach_flags initialization works])
fi
])
AC_CHECK_TYPES([struct statfs], [
@ -479,8 +505,10 @@ AC_CHECK_DECLS(m4_normalize([
AC_CHECK_DECLS(m4_normalize([
LO_FLAGS_READ_ONLY,
LO_FLAGS_USE_AOPS,
LO_FLAGS_AUTOCLEAR,
LO_FLAGS_PARTSCAN
LO_FLAGS_PARTSCAN,
LO_FLAGS_DIRECT_IO
]),,, [#include <linux/loop.h>])
AC_CHECK_DECLS(m4_normalize([
@ -631,6 +659,7 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
AC_CHECK_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"])
AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
@ -770,6 +799,9 @@ fi
st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AX_VALGRIND_DFLT([sgcheck], [off])
AX_VALGRIND_CHECK
AC_CONFIG_FILES([Makefile
tests/Makefile
tests-m32/Makefile

View File

@ -42,7 +42,7 @@ SYS_FUNC(copy_file_range)
printnum_int64(tcp, tcp->u_arg[3], "%" PRId64);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[4]);
tprintf("%" PRI_klu ", ", tcp->u_arg[4]);
/* unsigned int flags */
tprintf("%u", (unsigned int) tcp->u_arg[5]);

View File

@ -53,17 +53,16 @@ count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
struct timeval wtv;
struct timeval *tv = &wtv;
struct call_counts *cc;
unsigned long scno = tcp->scno;
if (!SCNO_IN_RANGE(scno))
if (!scno_in_range(tcp->scno))
return;
if (!counts)
counts = xcalloc(nsyscalls, sizeof(*counts));
cc = &counts[scno];
cc = &counts[tcp->scno];
cc->calls++;
if (tcp->u_error)
if (syserror(tcp))
cc->errors++;
/* tv = wall clock time spent while in syscall */

18
debian/changelog.in vendored
View File

@ -4,6 +4,24 @@ strace (@PACKAGE_VERSION@-1) experimental; urgency=low
-- Strace <@PACKAGE_BUGREPORT@> @DEB_CHANGELOGTIME@
strace (4.16-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 14 Feb 2017 10:11:12 +0000
strace (4.15-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Wed, 14 Dec 2016 08:09:10 +0000
strace (4.14-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 04 Oct 2016 18:19:20 +0000
strace (4.13-1) unstable; urgency=medium
* New upstream version.

4
debian/control vendored
View File

@ -4,7 +4,9 @@ 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
Standards-Version: 3.9.6
Homepage: http://sourceforge.net/projects/strace/
Homepage: https://strace.io
Vcs-Git: https://anonscm.debian.org/git/collab-maint/strace.git
Vcs-Browser: https://anonscm.debian.org/git/collab-maint/strace.git
Package: strace
Architecture: alpha amd64 arm64 armeb armel armhf hppa i386 ia64 m68k mips mipsel mips64 mips64el or1k powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32

2
debian/watch vendored
View File

@ -1,2 +1,2 @@
version=3
opts="uversionmangle=s/-/./g" http://sf.net/strace/strace-([[:digit:].-]*)\.tar\.xz
opts=pgpsigurlmangle=s/$/.asc/,uversionmangle=s/-/./g http://sf.net/strace/strace-([[:digit:].-]*)\.tar\.xz

534
defs.h
View File

@ -2,6 +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.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,10 +52,11 @@
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include <asm/unistd.h>
#include "kernel_types.h"
#include "mpers_type.h"
#include "gcc_compat.h"
#include "sysent.h"
#ifndef HAVE_STRERROR
const char *strerror(int);
@ -68,7 +70,12 @@ const char *strerror(int);
extern char *stpcpy(char *dst, const char *src);
#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#ifndef offsetofend
# define offsetofend(type, member) \
(offsetof(type, member) + sizeof(((type *)NULL)->member))
#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
/* macros */
#ifndef MAX
@ -119,15 +126,6 @@ extern char *stpcpy(char *dst, const char *src);
#define USE_SEIZE 1
/* To force NOMMU build, set to 1 */
#define NOMMU_SYSTEM 0
/*
* Set to 1 to use speed-optimized vfprintf implementation.
* It results in strace using about 5% less CPU in user space
* (compared to glibc version).
* But strace spends a lot of time in kernel space,
* so overall it does not appear to be a significant win.
* Thus disabled by default.
*/
#define USE_CUSTOM_PRINTF 0
#ifndef ERESTARTSYS
# define ERESTARTSYS 512
@ -144,7 +142,8 @@ extern char *stpcpy(char *dst, const char *src);
#if defined X86_64
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY2_WORDSIZE 4
# define PERSONALITY2_WORDSIZE 4
# define PERSONALITY2_KLONGSIZE PERSONALITY0_KLONGSIZE
#elif defined AARCH64 \
|| defined POWERPC64 \
|| defined RISCV \
@ -162,12 +161,14 @@ extern char *stpcpy(char *dst, const char *src);
# define DEFAULT_PERSONALITY 0
#endif
#define PERSONALITY0_WORDSIZE SIZEOF_LONG
#define PERSONALITY0_WORDSIZE SIZEOF_LONG
#define PERSONALITY0_KLONGSIZE SIZEOF_KERNEL_LONG_T
#define PERSONALITY0_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
#define PERSONALITY0_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
#if SUPPORTED_PERSONALITIES > 1
# define PERSONALITY1_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
# define PERSONALITY1_KLONGSIZE PERSONALITY1_WORDSIZE
#endif
#if SUPPORTED_PERSONALITIES > 1 && defined HAVE_M32_MPERS
@ -192,24 +193,20 @@ extern char *stpcpy(char *dst, const char *src);
# define PERSONALITY2_INCLUDE_FUNCS "empty.h"
#endif
typedef struct sysent {
unsigned nargs;
int sys_flags;
int sen;
int (*sys_func)();
const char *sys_name;
} struct_sysent;
typedef struct ioctlent {
const char *symbol;
unsigned int code;
} struct_ioctlent;
#if defined LINUX_MIPSN32 || defined X32
# define HAVE_STRUCT_TCB_EXT_ARG 1
#else
# define HAVE_STRUCT_TCB_EXT_ARG 0
#endif
struct inject_opts {
uint16_t first;
uint16_t step;
uint16_t signo;
int rval;
};
#define MAX_ERRNO_VALUE 4095
#define INJECT_OPTS_RVAL_DEFAULT (-(MAX_ERRNO_VALUE + 1))
/* Trace Control Block */
struct tcb {
@ -217,13 +214,9 @@ struct tcb {
int pid; /* If 0, this tcb is free */
int qual_flg; /* qual_flags[scno] or DEFAULT_QUAL_FLAGS + RAW */
unsigned long u_error; /* Error code */
long scno; /* System call number */
long u_arg[MAX_ARGS]; /* System call arguments */
#if HAVE_STRUCT_TCB_EXT_ARG
long long ext_arg[MAX_ARGS];
long long u_lrval; /* long long return value */
#endif
long u_rval; /* Return value */
kernel_ulong_t scno; /* System call number */
kernel_ulong_t u_arg[MAX_ARGS]; /* System call arguments */
kernel_long_t u_rval; /* Return value */
#if SUPPORTED_PERSONALITIES > 1
unsigned int currpers; /* Personality at the time of scno update */
#endif
@ -235,6 +228,7 @@ struct tcb {
void (*_free_priv_data)(void *); /* Callback for freeing priv_data */
const struct_sysent *s_ent; /* sysent[scno] or dummy struct for bad scno */
const struct_sysent *s_prev_ent; /* for "resuming interrupted SYSCALL" msg */
struct inject_opts *inject_vec[SUPPORTED_PERSONALITIES];
struct timeval stime; /* System time usage as of last process wait */
struct timeval dtime; /* Delta for system time usage */
struct timeval etime; /* Syscall entry time */
@ -271,16 +265,19 @@ struct tcb {
#define TCB_ATTACHED 0x08 /* We attached to it already */
#define TCB_REPRINT 0x10 /* We should reprint this syscall on exit */
#define TCB_FILTERED 0x20 /* This system call has been filtered out */
#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 */
/* qualifier flags */
#define QUAL_TRACE 0x001 /* this system call should be traced */
#define QUAL_ABBREV 0x002 /* abbreviate the structures of this syscall */
#define QUAL_VERBOSE 0x004 /* decode the structures of this syscall */
#define QUAL_RAW 0x008 /* print all args in hex for this syscall */
#define QUAL_SIGNAL 0x010 /* report events with this signal */
#define QUAL_READ 0x020 /* dump data read on this file descriptor */
#define QUAL_WRITE 0x040 /* dump data written to this file descriptor */
typedef uint8_t qualbits_t;
#define QUAL_INJECT 0x010 /* tamper with this system call on purpose */
#define QUAL_SIGNAL 0x100 /* report events with this signal */
#define QUAL_READ 0x200 /* dump data read from this file descriptor */
#define QUAL_WRITE 0x400 /* dump data written to this file descriptor */
#define DEFAULT_QUAL_FLAGS (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE)
@ -290,6 +287,7 @@ typedef uint8_t qualbits_t;
#define verbose(tcp) ((tcp)->qual_flg & QUAL_VERBOSE)
#define abbrev(tcp) ((tcp)->qual_flg & QUAL_ABBREV)
#define filtered(tcp) ((tcp)->flags & TCB_FILTERED)
#define hide_log(tcp) ((tcp)->flags & TCB_HIDE_LOG)
#include "xlat.h"
@ -301,6 +299,7 @@ extern const struct xlat msg_flags[];
extern const struct xlat open_access_modes[];
extern const struct xlat open_mode_flags[];
extern const struct xlat resource_flags[];
extern const struct xlat sg_io_info[];
extern const struct xlat socketlayers[];
extern const struct xlat whence_codes[];
@ -309,34 +308,14 @@ extern const struct xlat whence_codes[];
#define RVAL_HEX 001 /* hex format */
#define RVAL_OCTAL 002 /* octal format */
#define RVAL_UDECIMAL 003 /* unsigned decimal format */
#if HAVE_STRUCT_TCB_EXT_ARG
# if 0 /* unused so far */
# define RVAL_LDECIMAL 004 /* long decimal format */
# define RVAL_LHEX 005 /* long hex format */
# define RVAL_LOCTAL 006 /* long octal format */
# endif
# define RVAL_LUDECIMAL 007 /* long unsigned decimal format */
#endif /* HAVE_STRUCT_TCB_EXT_ARG */
#define RVAL_FD 010 /* file descriptor */
#define RVAL_MASK 017 /* mask for these values */
#define RVAL_MASK 013 /* mask for these values */
#define RVAL_STR 020 /* Print `auxstr' field after return val */
#define RVAL_NONE 040 /* Print nothing */
#define RVAL_DECODED 0100 /* syscall decoding finished */
#define TRACE_FILE 001 /* Trace file-related syscalls. */
#define TRACE_IPC 002 /* Trace IPC-related syscalls. */
#define TRACE_NETWORK 004 /* Trace network-related syscalls. */
#define TRACE_PROCESS 010 /* Trace process-related syscalls. */
#define TRACE_SIGNAL 020 /* Trace signal-related syscalls. */
#define TRACE_DESC 040 /* Trace file descriptor-related syscalls. */
#define TRACE_MEMORY 0100 /* Trace memory mapping-related syscalls. */
#define SYSCALL_NEVER_FAILS 0200 /* Syscall is always successful. */
#define STACKTRACE_INVALIDATE_CACHE 0400 /* Trigger proc/maps cache updating */
#define STACKTRACE_CAPTURE_ON_ENTER 01000 /* Capture stacktrace on "entering" stage */
#define TRACE_INDIRECT_SUBCALL 02000 /* Syscall is an indirect socket/ipc subcall. */
#define IOCTL_NUMBER_UNKNOWN 0
#define IOCTL_NUMBER_HANDLED 1
#define IOCTL_NUMBER_STOP_LOOKUP 010
@ -389,7 +368,6 @@ extern bool count_wallclock;
extern unsigned int qflag;
extern bool not_failing_only;
extern unsigned int show_fd_path;
extern bool hide_log_until_execve;
/* are we filtering traces based on paths? */
extern const char **paths_selected;
#define tracing_paths (paths_selected != NULL)
@ -422,30 +400,28 @@ void *xreallocarray(void *ptr, size_t nmemb, size_t size)
ATTRIBUTE_ALLOC_SIZE((2, 3));
char *xstrdup(const char *str) ATTRIBUTE_MALLOC;
#if USE_CUSTOM_PRINTF
/*
* See comment in vsprintf.c for allowed formats.
* Short version: %h[h]u, %zu, %tu are not allowed, use %[l[l]]u.
*/
int strace_vfprintf(FILE *fp, const char *fmt, va_list args);
#else
# define strace_vfprintf vfprintf
#endif
extern int read_int_from_file(const char *, int *);
extern void set_sortby(const char *);
extern void set_overhead(int);
extern void qualify(const char *);
extern void print_pc(struct tcb *);
extern int trace_syscall(struct tcb *);
extern int trace_syscall(struct tcb *, unsigned int *);
extern void count_syscall(struct tcb *, const struct timeval *);
extern void call_summary(FILE *);
extern void clear_regs(void);
extern void get_regs(pid_t pid);
extern int get_scno(struct tcb *tcp);
extern const char *syscall_name(long scno);
extern int get_scno(struct tcb *);
extern kernel_ulong_t get_rt_sigframe_addr(struct tcb *);
/**
* Convert syscall number to 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);
extern const char *err_name(unsigned long err);
extern bool is_erestart(struct tcb *);
@ -467,30 +443,42 @@ static inline int set_tcb_priv_ulong(struct tcb *tcp, unsigned long val)
return set_tcb_priv_data(tcp, (void *) val, 0);
}
extern int umoven(struct tcb *, long, unsigned int, void *);
extern int
umoven(struct tcb *tcp, kernel_ulong_t addr, unsigned int len, void *laddr);
#define umove(pid, addr, objp) \
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int umoven_or_printaddr(struct tcb *, long, unsigned int, void *);
extern int
umoven_or_printaddr(struct tcb *tcp, kernel_ulong_t addr,
unsigned int len, void *laddr);
#define umove_or_printaddr(pid, addr, objp) \
umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int umovestr(struct tcb *, long, unsigned int, char *);
extern int upeek(int pid, long, long *);
extern int
umoven_or_printaddr_ignore_syserror(struct tcb *tcp, kernel_ulong_t addr,
unsigned int len, void *laddr);
extern int
umovestr(struct tcb *tcp, 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 bool
print_array(struct tcb *tcp,
const unsigned long start_addr,
const size_t nmemb,
void *const elem_buf,
const size_t elem_size,
int (*const umoven_func)(struct tcb *,
long,
kernel_ulong_t start_addr,
size_t nmemb,
void *elem_buf,
size_t elem_size,
int (*umoven_func)(struct tcb *,
kernel_ulong_t,
unsigned int,
void *),
bool (*const print_func)(struct tcb *,
bool (*print_func)(struct tcb *,
void *elem_buf,
size_t elem_size,
void *opaque_data),
void *const opaque_data);
void *opaque_data);
#if defined ALPHA || defined IA64 || defined MIPS \
|| defined SH || defined SPARC || defined SPARC64
@ -510,12 +498,21 @@ extern const char *xlookup(const struct xlat *, const uint64_t);
extern const char *xlat_search(const struct xlat *, const size_t, const uint64_t);
extern unsigned long get_pagesize(void);
extern int
string_to_uint_ex(const char *str, char **endptr,
unsigned int max_val, const char *accepted_ending);
extern int string_to_uint(const char *str);
static inline int
string_to_uint_upto(const char *const str, unsigned int max_val)
{
return string_to_uint_ex(str, NULL, max_val, NULL);
}
extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits);
#define QUOTE_0_TERMINATED 0x01
#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02
#define QUOTE_OMIT_TRAILING_0 0x08
#define QUOTE_FORCE_HEX 0x10
extern int string_quote(const char *, char *, unsigned int, unsigned int);
extern int print_quoted_string(const char *, unsigned int, unsigned int);
@ -524,21 +521,23 @@ extern int print_quoted_string(const char *, unsigned int, unsigned int);
* b refers to the higher numbered u_arg
*/
#ifdef WORDS_BIGENDIAN
# define LONG_LONG(a,b) \
((long long)((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32)))
# define ULONG_LONG(a,b) \
((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32))
#else
# define LONG_LONG(a,b) \
((long long)((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32)))
# define ULONG_LONG(a,b) \
((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32))
#endif
extern int getllval(struct tcb *, unsigned long long *, int);
extern int printllval(struct tcb *, const char *, int)
ATTRIBUTE_FORMAT((printf, 2, 0));
extern void printaddr(long);
extern void printxvals(const uint64_t, const char *, const struct xlat *, ...)
extern void printaddr(kernel_ulong_t addr);
extern int printxvals(const uint64_t, const char *, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
extern long long getarg_ll(struct tcb *tcp, int argn);
extern unsigned long long getarg_ull(struct tcb *tcp, int argn);
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 printargs(struct tcb *);
extern int printargs_u(struct tcb *);
extern int printargs_d(struct tcb *);
@ -550,53 +549,31 @@ extern const char *sprinttime(time_t);
extern void print_symbolic_mode_t(unsigned int);
extern void print_numeric_umode_t(unsigned short);
extern void print_numeric_long_umask(unsigned long);
extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long);
extern void dumpiov_in_mmsghdr(struct tcb *, long);
extern void dumpiov_upto(struct tcb *, int, long, unsigned long);
#define dumpiov(tcp, len, addr) \
dumpiov_upto((tcp), (len), (addr), (unsigned long) -1L)
extern void dumpstr(struct tcb *, long, int);
extern void printstr_ex(struct tcb *, long addr, long len,
unsigned int user_style);
extern bool printnum_short(struct tcb *, long, const char *)
ATTRIBUTE_FORMAT((printf, 3, 0));
extern bool printnum_int(struct tcb *, long, const char *)
ATTRIBUTE_FORMAT((printf, 3, 0));
extern bool printnum_int64(struct tcb *, long, const char *)
ATTRIBUTE_FORMAT((printf, 3, 0));
extern void print_dev_t(unsigned long long dev);
extern void print_abnormal_hi(kernel_ulong_t);
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
extern bool printnum_long_int(struct tcb *, long, const char *, const char *)
ATTRIBUTE_FORMAT((printf, 3, 0))
ATTRIBUTE_FORMAT((printf, 4, 0));
# define printnum_slong(tcp, addr) \
printnum_long_int((tcp), (addr), "%" PRId64, "%d")
# define printnum_ulong(tcp, addr) \
printnum_long_int((tcp), (addr), "%" PRIu64, "%u")
# define printnum_ptr(tcp, addr) \
printnum_long_int((tcp), (addr), "%#" PRIx64, "%#x")
#elif SIZEOF_LONG > 4
# define printnum_slong(tcp, addr) \
printnum_int64((tcp), (addr), "%" PRId64)
# define printnum_ulong(tcp, addr) \
printnum_int64((tcp), (addr), "%" PRIu64)
# define printnum_ptr(tcp, addr) \
printnum_int64((tcp), (addr), "%#" PRIx64)
#else
# define printnum_slong(tcp, addr) \
printnum_int((tcp), (addr), "%d")
# define printnum_ulong(tcp, addr) \
printnum_int((tcp), (addr), "%u")
# define printnum_ptr(tcp, addr) \
printnum_int((tcp), (addr), "%#x")
#endif
extern void
dumpiov_in_msghdr(struct tcb *, kernel_ulong_t addr, kernel_ulong_t data_size);
extern void
dumpiov_in_mmsghdr(struct tcb *, kernel_ulong_t addr);
extern void
dumpiov_upto(struct tcb *, int len, kernel_ulong_t addr, kernel_ulong_t data_size);
extern void
dumpstr(struct tcb *, kernel_ulong_t addr, int len);
extern void
printstr_ex(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len,
unsigned int user_style);
extern void
printpathn(struct tcb *, kernel_ulong_t addr, unsigned int n);
extern void
printpath(struct tcb *, kernel_ulong_t addr);
extern bool printpair_int(struct tcb *, long, const char *)
ATTRIBUTE_FORMAT((printf, 3, 0));
extern bool printpair_int64(struct tcb *, long, const char *)
ATTRIBUTE_FORMAT((printf, 3, 0));
extern void printpath(struct tcb *, long);
extern void printpathn(struct tcb *, long, unsigned int);
#define TIMESPEC_TEXT_BUFSIZE \
(sizeof(intmax_t)*3 * 2 + sizeof("{tv_sec=%jd, tv_nsec=%jd}"))
extern void printfd(struct tcb *, int);
@ -604,47 +581,74 @@ extern void print_sockaddr(struct tcb *tcp, const void *, int);
extern bool print_sockaddr_by_inode(const unsigned long, const enum sock_proto);
extern bool print_sockaddr_by_inode_cached(const unsigned long);
extern void print_dirfd(struct tcb *, int);
extern int decode_sockaddr(struct tcb *, long, int);
#ifdef ALPHA
extern void printrusage32(struct tcb *, long);
extern const char *sprint_timeval32(struct tcb *tcp, long);
extern void print_timeval32(struct tcb *tcp, long);
extern void print_timeval32_pair(struct tcb *tcp, long);
extern void print_itimerval32(struct tcb *tcp, long);
#endif
extern int
decode_sockaddr(struct tcb *, kernel_ulong_t addr, int addrlen);
extern void printuid(const char *, const unsigned int);
extern void print_sigset_addr_len(struct tcb *, long, long);
extern void
print_sigset_addr_len(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len);
extern void
print_sigset_addr(struct tcb *, kernel_ulong_t addr);
extern const char *sprintsigmask_n(const char *, const void *, unsigned int);
#define tprintsigmask_addr(prefix, mask) \
tprints(sprintsigmask_n((prefix), (mask), sizeof(mask)))
extern void printsignal(int);
extern void tprint_iov(struct tcb *, unsigned long, unsigned long, enum iov_decode);
extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned long,
enum iov_decode, unsigned long);
extern void decode_netlink(struct tcb *, unsigned long, unsigned long);
extern void
tprint_iov_upto(struct tcb *, kernel_ulong_t len, kernel_ulong_t addr,
enum iov_decode, kernel_ulong_t data_size);
extern void
decode_netlink(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len);
extern void tprint_open_modes(unsigned int);
extern const char *sprint_open_modes(unsigned int);
extern void print_seccomp_filter(struct tcb *, unsigned long);
extern void print_seccomp_fprog(struct tcb *, unsigned long, unsigned short);
extern void
print_seccomp_filter(struct tcb *, kernel_ulong_t addr);
extern void
print_seccomp_fprog(struct tcb *, kernel_ulong_t addr, unsigned short len);
struct strace_stat;
extern void print_struct_stat(struct tcb *tcp, const struct strace_stat *const st);
struct strace_statfs;
extern void print_struct_statfs(struct tcb *tcp, long);
extern void print_struct_statfs64(struct tcb *tcp, long, unsigned long);
extern void
print_struct_statfs(struct tcb *, kernel_ulong_t addr);
extern void
print_struct_statfs64(struct tcb *, kernel_ulong_t addr, kernel_ulong_t size);
extern void print_ifindex(unsigned int);
extern int file_ioctl(struct tcb *, const unsigned int, long);
extern int fs_x_ioctl(struct tcb *, const unsigned int, long);
extern int loop_ioctl(struct tcb *, const unsigned int, long);
extern int ptp_ioctl(struct tcb *, const unsigned int, long);
extern int scsi_ioctl(struct tcb *, const unsigned int, long);
extern int sock_ioctl(struct tcb *, const unsigned int, long);
extern int term_ioctl(struct tcb *, const unsigned int, long);
extern int ubi_ioctl(struct tcb *, const unsigned int, long);
extern int uffdio_ioctl(struct tcb *, const unsigned int, long);
struct number_set;
extern struct number_set read_set;
extern struct number_set write_set;
extern struct number_set signal_set;
extern bool is_number_in_set(unsigned int number, const struct number_set *);
extern void qualify(const char *);
extern unsigned int qual_flags(const unsigned int);
#define DECL_IOCTL(name) \
extern int \
name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg)
DECL_IOCTL(dm);
DECL_IOCTL(file);
DECL_IOCTL(fs_x);
DECL_IOCTL(ptp);
DECL_IOCTL(scsi);
DECL_IOCTL(term);
DECL_IOCTL(ubi);
DECL_IOCTL(uffdio);
#undef DECL_IOCTL
extern int decode_sg_io_v4(struct tcb *, const kernel_ulong_t arg);
extern int tv_nz(const struct timeval *);
extern int tv_cmp(const struct timeval *, const struct timeval *);
@ -664,11 +668,17 @@ extern void unwind_capture_stacktrace(struct tcb* tcp);
#endif
static inline void
printstr(struct tcb *tcp, long addr, long len)
printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len)
{
printstr_ex(tcp, addr, len, 0);
}
static inline void
printstr(struct tcb *tcp, kernel_ulong_t addr)
{
printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED);
}
static inline int
printflags(const struct xlat *x, unsigned int flags, const char *dflt)
{
@ -676,29 +686,41 @@ printflags(const struct xlat *x, unsigned int flags, const char *dflt)
}
static inline int
printflags_long(const struct xlat *x, unsigned long flags, const char *dflt)
{
return printflags64(x, flags, dflt);
}
static inline void
printxval64(const struct xlat *x, const uint64_t val, const char *dflt)
{
printxvals(val, dflt, x, NULL);
return printxvals(val, dflt, x, NULL);
}
static inline void
static inline int
printxval(const struct xlat *x, const unsigned int val, const char *dflt)
{
printxvals(val, dflt, x, NULL);
return printxvals(val, dflt, x, NULL);
}
static inline void
printxval_long(const struct xlat *x, const unsigned long val, const char *dflt)
tprint_iov(struct tcb *tcp, kernel_ulong_t len, kernel_ulong_t addr,
enum iov_decode decode_iov)
{
printxvals(val, dflt, x, NULL);
tprint_iov_upto(tcp, len, addr, decode_iov, -1);
}
#ifdef ALPHA
typedef struct {
int tv_sec, tv_usec;
} timeval32_t;
extern void print_timeval32_t(const timeval32_t *);
extern void printrusage32(struct tcb *, kernel_ulong_t);
extern const char *sprint_timeval32(struct tcb *tcp, kernel_ulong_t);
extern void print_timeval32(struct tcb *tcp, kernel_ulong_t);
extern void print_timeval32_pair(struct tcb *tcp, kernel_ulong_t);
extern void print_itimerval32(struct tcb *tcp, kernel_ulong_t);
#endif
#ifdef HAVE_STRUCT_USER_DESC
extern void print_user_desc(struct tcb *, kernel_ulong_t addr);
#endif
/* Strace log generation machinery.
*
* printing_tcp: tcb which has incomplete line being printed right now.
@ -733,24 +755,120 @@ extern unsigned current_personality;
#if SUPPORTED_PERSONALITIES == 1
# define current_wordsize PERSONALITY0_WORDSIZE
# define current_klongsize PERSONALITY0_KLONGSIZE
#else
# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_WORDSIZE == PERSONALITY1_WORDSIZE
# define current_wordsize PERSONALITY0_WORDSIZE
# else
extern unsigned current_wordsize;
# endif
# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE == PERSONALITY1_KLONGSIZE
# define current_klongsize PERSONALITY0_KLONGSIZE
# else
extern unsigned current_klongsize;
# endif
#endif
/* In many, many places we play fast and loose and use
* tprintf("%d", (int) tcp->u_arg[N]) to print fds, pids etc.
* We probably need to use widen_to_long() instead:
*/
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
# define widen_to_long(v) (current_wordsize == 4 ? (long)(int32_t)(v) : (long)(v))
#else
# define widen_to_long(v) ((long)(v))
#define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG \
(SIZEOF_KERNEL_LONG_T > 4 \
&& (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize)))
#define DECL_PRINTNUM(name) \
extern bool \
printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
ATTRIBUTE_FORMAT((printf, 3, 0))
DECL_PRINTNUM(short);
DECL_PRINTNUM(int);
DECL_PRINTNUM(int64);
#undef DECL_PRINTNUM
#define DECL_PRINTNUM_ADDR(name) \
extern bool \
printnum_addr_ ## name(struct tcb *, kernel_ulong_t addr)
DECL_PRINTNUM_ADDR(int);
DECL_PRINTNUM_ADDR(int64);
#undef DECL_PRINTNUM_ADDR
#ifndef current_wordsize
extern bool
printnum_long_int(struct tcb *, kernel_ulong_t addr,
const char *fmt_long, const char *fmt_int)
ATTRIBUTE_FORMAT((printf, 3, 0))
ATTRIBUTE_FORMAT((printf, 4, 0));
extern bool printnum_addr_long_int(struct tcb *, kernel_ulong_t addr);
# define printnum_slong(tcp, addr) \
printnum_long_int((tcp), (addr), "%" PRId64, "%d")
# define printnum_ulong(tcp, addr) \
printnum_long_int((tcp), (addr), "%" PRIu64, "%u")
# define printnum_ptr(tcp, addr) \
printnum_addr_long_int((tcp), (addr))
#elif current_wordsize > 4
# define printnum_slong(tcp, addr) \
printnum_int64((tcp), (addr), "%" PRId64)
# define printnum_ulong(tcp, addr) \
printnum_int64((tcp), (addr), "%" PRIu64)
# define printnum_ptr(tcp, addr) \
printnum_addr_int64((tcp), (addr))
#else /* current_wordsize == 4 */
# define printnum_slong(tcp, addr) \
printnum_int((tcp), (addr), "%d")
# define printnum_ulong(tcp, addr) \
printnum_int((tcp), (addr), "%u")
# define printnum_ptr(tcp, addr) \
printnum_addr_int((tcp), (addr))
#endif
#ifndef current_klongsize
extern bool printnum_addr_klong_int(struct tcb *, kernel_ulong_t addr);
# define printnum_kptr(tcp, addr) \
printnum_addr_klong_int((tcp), (addr))
#elif current_klongsize > 4
# define printnum_kptr(tcp, addr) \
printnum_addr_int64((tcp), (addr))
#else /* current_klongsize == 4 */
# define printnum_kptr(tcp, addr) \
printnum_addr_int((tcp), (addr))
#endif
#define DECL_PRINTPAIR(name) \
extern bool \
printpair_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
ATTRIBUTE_FORMAT((printf, 3, 0))
DECL_PRINTPAIR(int);
DECL_PRINTPAIR(int64);
#undef DECL_PRINTPAIR
static inline kernel_long_t
truncate_klong_to_current_wordsize(const kernel_long_t v)
{
#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
if (current_wordsize < sizeof(v)) {
return (int) v;
} else
#endif
{
return v;
}
}
static inline kernel_ulong_t
truncate_kulong_to_current_wordsize(const kernel_ulong_t v)
{
#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
if (current_wordsize < sizeof(v)) {
return (unsigned int) v;
} else
#endif
{
return v;
}
}
/*
* Cast a pointer or a pointer-sized integer to kernel_ulong_t.
*/
#define ptr_to_kulong(v) ((kernel_ulong_t) (unsigned long) (v))
/*
* Zero-extend a signed integer type to unsigned long long.
*/
@ -775,8 +893,6 @@ extern const struct_sysent sysent0[];
extern const char *const errnoent0[];
extern const char *const signalent0[];
extern const struct_ioctlent ioctlent0[];
extern qualbits_t *qual_vec[SUPPORTED_PERSONALITIES];
#define qual_flags (qual_vec[current_personality])
#if SUPPORTED_PERSONALITIES > 1
extern const struct_sysent *sysent;
@ -794,7 +910,10 @@ extern unsigned nsyscalls;
extern unsigned nerrnos;
extern unsigned nsignals;
extern unsigned nioctlents;
extern unsigned num_quals;
extern const unsigned int nsyscall_vec[SUPPORTED_PERSONALITIES];
extern const struct_sysent *const sysent_vec[SUPPORTED_PERSONALITIES];
extern struct inject_opts *inject_vec[SUPPORTED_PERSONALITIES];
#ifdef IN_MPERS_BOOTSTRAP
/* Transform multi-line MPERS_PRINTER_DECL statements to one-liners. */
@ -808,18 +927,25 @@ extern unsigned num_quals;
# define MPERS_PRINTER_DECL(type, name, ...) type MPERS_FUNC_NAME(name)(__VA_ARGS__)
#endif /* !IN_MPERS_BOOTSTRAP */
/*
* If you need non-NULL sysent[scno].sys_func, non-NULL sysent[scno].sys_name,
* and non-indirect sysent[scno].sys_flags.
*/
#define SCNO_IS_VALID(scno) \
((unsigned long)(scno) < nsyscalls \
&& sysent[scno].sys_func \
&& !(sysent[scno].sys_flags & TRACE_INDIRECT_SUBCALL))
/* Checks that sysent[scno] is not out of range. */
static inline bool
scno_in_range(kernel_ulong_t scno)
{
return scno < nsyscalls;
}
/* Only ensures that sysent[scno] isn't out of range */
#define SCNO_IN_RANGE(scno) \
((unsigned long)(scno) < nsyscalls)
/*
* Checks whether scno is not out of range,
* its corresponding sysent[scno].sys_func is non-NULL,
* and its sysent[scno].sys_flags has no TRACE_INDIRECT_SUBCALL flag set.
*/
static inline bool
scno_is_valid(kernel_ulong_t scno)
{
return scno_in_range(scno)
&& sysent[scno].sys_func
&& !(sysent[scno].sys_flags & TRACE_INDIRECT_SUBCALL);
}
#define MPERS_FUNC_NAME__(prefix, name) prefix ## name
#define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name)
@ -829,6 +955,16 @@ extern unsigned num_quals;
#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp)
#if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
# define PRI_kl "ll"
#else
# define PRI_kl "l"
#endif
#define PRI_kld PRI_kl"d"
#define PRI_klu PRI_kl"u"
#define PRI_klx PRI_kl"x"
/*
* The kernel used to define 64-bit types on 64-bit systems on a per-arch
* basis. Some architectures would use unsigned long and others would use

77
desc.c
View File

@ -69,17 +69,17 @@ SYS_FUNC(dup3)
}
static int
decode_select(struct tcb *tcp, long *args,
void (*print_tv_ts) (struct tcb *, const long),
const char * (*sprint_tv_ts) (struct tcb *, const long))
decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
void (*const print_tv_ts) (struct tcb *, kernel_ulong_t),
const char * (*const sprint_tv_ts) (struct tcb *, kernel_ulong_t))
{
int i, j;
int nfds, fdsize;
fd_set *fds = NULL;
const char *sep;
long arg;
kernel_ulong_t addr;
/* Kernel truncates arg[0] to int, we do the same. */
/* Kernel truncates args[0] to int, we do the same. */
nfds = (int) args[0];
/* Kernel rejects negative nfds, so we don't parse it either. */
@ -102,13 +102,13 @@ decode_select(struct tcb *tcp, long *args,
if (verbose(tcp) && fdsize > 0)
fds = malloc(fdsize);
for (i = 0; i < 3; i++) {
arg = args[i+1];
addr = args[i+1];
tprints(", ");
if (!fds) {
printaddr(arg);
printaddr(addr);
continue;
}
if (umoven_or_printaddr(tcp, arg, fdsize, fds))
if (umoven_or_printaddr(tcp, addr, fdsize, fds))
continue;
tprints("[");
for (j = 0, sep = "";; j++) {
@ -146,8 +146,8 @@ decode_select(struct tcb *tcp, long *args,
for (i = 0; i < 3 && ready_fds > 0; i++) {
int first = 1;
arg = args[i+1];
if (!arg || !fds || umoven(tcp, arg, fdsize, fds) < 0)
addr = args[i+1];
if (!addr || !fds || umoven(tcp, addr, fdsize, fds) < 0)
continue;
for (j = 0;; j++) {
j = next_set_bit(fds, j, nfds);
@ -192,26 +192,26 @@ decode_select(struct tcb *tcp, long *args,
SYS_FUNC(oldselect)
{
long long_args[5];
#undef oldselect_args
#if SIZEOF_LONG == 4
# define oldselect_args long_args
#else
kernel_ulong_t select_args[5];
unsigned int oldselect_args[5];
unsigned int i;
#endif
if (umove(tcp, tcp->u_arg[0], &oldselect_args) < 0) {
printaddr(tcp->u_arg[0]);
return 0;
if (sizeof(*select_args) == sizeof(*oldselect_args)) {
if (umove_or_printaddr(tcp, tcp->u_arg[0], &select_args)) {
return 0;
}
} 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];
}
}
#ifndef oldselect_args
for (i = 0; i < 5; i++) {
long_args[i] = oldselect_args[i];
}
#endif
return decode_select(tcp, long_args, print_timeval, sprint_timeval);
#undef oldselect_args
return decode_select(tcp, select_args, print_timeval, sprint_timeval);
}
#ifdef ALPHA
@ -226,27 +226,23 @@ SYS_FUNC(select)
return decode_select(tcp, tcp->u_arg, print_timeval, sprint_timeval);
}
#include "kernel_types.h"
static int
umove_kulong_array_or_printaddr(struct tcb *tcp, const long addr,
kernel_ulong_t *ptr, size_t n)
umove_kulong_array_or_printaddr(struct tcb *const tcp, const kernel_ulong_t addr,
kernel_ulong_t *const ptr, const size_t n)
{
#if defined X86_64 || defined X32
if (current_personality == 1) {
#else
if (current_wordsize < sizeof(*ptr)) {
#endif
#ifndef current_klongsize
if (current_klongsize < sizeof(*ptr)) {
uint32_t ptr32[n];
int r = umove_or_printaddr(tcp, addr, &ptr32);
if (!r) {
size_t i;
for (i = 0; i < n; ++i)
ptr[i] = (kernel_ulong_t) ptr32[i];
ptr[i] = ptr32[i];
}
return r;
}
#endif /* !current_klongsize */
return umoven_or_printaddr(tcp, addr, n * sizeof(*ptr), ptr);
}
@ -260,10 +256,9 @@ SYS_FUNC(pselect6)
if (!umove_kulong_array_or_printaddr(tcp, tcp->u_arg[5],
data, ARRAY_SIZE(data))) {
tprints("{");
/* NB: kernel requires data[1] == NSIG / 8 */
print_sigset_addr_len(tcp, (unsigned long) data[0],
(unsigned long) data[1]);
tprintf(", %llu}", (unsigned long long) data[1]);
/* NB: kernel requires data[1] == NSIG_BYTES */
print_sigset_addr_len(tcp, data[0], data[1]);
tprintf(", %" PRI_klu "}", data[1]);
}
}

View File

@ -33,14 +33,12 @@
#include DEF_MPERS_TYPE(kernel_dirent)
#include "kernel_types.h"
#include MPERS_DEFS
#define D_NAME_LEN_MAX 256
static void
print_old_dirent(struct tcb *tcp, long addr)
print_old_dirent(struct tcb *const tcp, const kernel_ulong_t addr)
{
kernel_dirent d;
@ -68,7 +66,7 @@ SYS_FUNC(readdir)
print_old_dirent(tcp, tcp->u_arg[1]);
/* Not much point in printing this out, it is always 1. */
if (tcp->u_arg[2] != 1)
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
}

587
dm.c Normal file
View File

@ -0,0 +1,587 @@
/*
* Support for decoding of DM_* ioctl commands.
*
* Copyright (c) 2016 Mikulas Patocka <mpatocka@redhat.com>
* Copyright (c) 2016 Masatake Yamato <yamato@redhat.com>
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "defs.h"
#ifdef HAVE_LINUX_DM_IOCTL_H
# include <linux/dm-ioctl.h>
# include <linux/ioctl.h>
# if DM_VERSION_MAJOR == 4
/* Definitions for command which have been added later */
# ifndef DM_LIST_VERSIONS
# define DM_LIST_VERSIONS _IOWR(DM_IOCTL, 0xd, struct dm_ioctl)
# endif
# ifndef DM_TARGET_MSG
# define DM_TARGET_MSG _IOWR(DM_IOCTL, 0xe, struct dm_ioctl)
# endif
# ifndef DM_DEV_SET_GEOMETRY
# define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, 0xf, struct dm_ioctl)
# endif
static void
dm_decode_device(const unsigned int code, const struct dm_ioctl *ioc)
{
switch (code) {
case DM_REMOVE_ALL:
case DM_LIST_DEVICES:
case DM_LIST_VERSIONS:
break;
default:
if (ioc->dev) {
tprints(", dev=");
print_dev_t(ioc->dev);
}
if (ioc->name[0]) {
tprints(", name=");
print_quoted_string(ioc->name, DM_NAME_LEN,
QUOTE_0_TERMINATED);
}
if (ioc->uuid[0]) {
tprints(", uuid=");
print_quoted_string(ioc->uuid, DM_UUID_LEN,
QUOTE_0_TERMINATED);
}
break;
}
}
static void
dm_decode_values(struct tcb *tcp, const unsigned int code,
const struct dm_ioctl *ioc)
{
if (entering(tcp)) {
switch (code) {
case DM_TABLE_LOAD:
tprintf(", target_count=%" PRIu32,
ioc->target_count);
break;
case DM_DEV_SUSPEND:
if (ioc->flags & DM_SUSPEND_FLAG)
break;
/* Fall through */
case DM_DEV_RENAME:
case DM_DEV_REMOVE:
case DM_DEV_WAIT:
tprintf(", event_nr=%" PRIu32,
ioc->event_nr);
break;
}
} else if (!syserror(tcp)) {
switch (code) {
case DM_DEV_CREATE:
case DM_DEV_RENAME:
case DM_DEV_SUSPEND:
case DM_DEV_STATUS:
case DM_DEV_WAIT:
case DM_TABLE_LOAD:
case DM_TABLE_CLEAR:
case DM_TABLE_DEPS:
case DM_TABLE_STATUS:
case DM_TARGET_MSG:
tprintf(", target_count=%" PRIu32,
ioc->target_count);
tprintf(", open_count=%" PRIu32,
ioc->open_count);
tprintf(", event_nr=%" PRIu32,
ioc->event_nr);
break;
}
}
}
#include "xlat/dm_flags.h"
static void
dm_decode_flags(const struct dm_ioctl *ioc)
{
tprints(", flags=");
printflags(dm_flags, ioc->flags, "DM_???");
}
static void
dm_decode_dm_target_spec(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t target_spec_size =
sizeof(struct dm_target_spec);
uint32_t i;
uint32_t offset = ioc->data_start;
uint32_t offset_end;
if (abbrev(tcp)) {
if (ioc->target_count)
tprints(", ...");
return;
}
for (i = 0; i < ioc->target_count; i++) {
struct dm_target_spec s;
offset_end = offset + target_spec_size;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
tprints(", ");
if (i >= max_strlen) {
tprints("...");
break;
}
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprintf("{sector_start=%" PRI__u64 ", length=%" PRI__u64,
s.sector_start, s.length);
if (exiting(tcp))
tprintf(", status=%" PRId32, s.status);
tprints(", target_type=");
print_quoted_string(s.target_type, DM_MAX_TYPE_NAME,
QUOTE_0_TERMINATED);
tprints(", string=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
if (entering(tcp))
offset += s.next;
else
offset = ioc->data_start + s.next;
if (offset <= offset_end)
goto misplaced;
}
return;
misplaced:
tprints(", /* misplaced struct dm_target_spec */ ...");
}
bool
dm_print_dev(struct tcb *tcp, void *dev_ptr, size_t dev_size, void *dummy)
{
uint64_t *dev = (uint64_t *) dev_ptr;
print_dev_t(*dev);
return 1;
}
static void
dm_decode_dm_target_deps(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t target_deps_dev_offs =
offsetof(struct dm_target_deps, dev);
uint64_t dev_buf;
struct dm_target_deps s;
uint32_t offset = ioc->data_start;
uint32_t offset_end = offset + target_deps_dev_offs;
uint32_t space;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
tprints(", ");
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
if (umove_or_printaddr(tcp, addr + offset, &s))
return;
space = (ioc->data_size - offset_end) / sizeof(dev_buf);
if (s.count > space)
goto misplaced;
tprintf("{count=%u, deps=", s.count);
print_array(tcp, addr + offset_end, s.count, &dev_buf, sizeof(dev_buf),
umoven_or_printaddr, dm_print_dev, NULL);
tprints("}");
return;
misplaced:
tprints("/* misplaced struct dm_target_deps */ ...");
}
static void
dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t name_list_name_offs =
offsetof(struct dm_name_list, name);
struct dm_name_list s;
uint32_t offset = ioc->data_start;
uint32_t offset_end;
uint32_t count;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
for (count = 0;; count++) {
offset_end = offset + name_list_name_offs;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
tprints(", ");
if (count >= max_strlen) {
tprints("...");
break;
}
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
if (!count && !s.dev) {
tprints("/* no devices present */");
break;
}
tprints("{dev=");
print_dev_t(s.dev);
tprints("name=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
if (!s.next)
break;
offset += s.next;
if (offset <= offset_end)
goto misplaced;
}
return;
misplaced:
tprints(", /* misplaced struct dm_name_list */ ...");
}
static void
dm_decode_dm_target_versions(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t target_vers_name_offs =
offsetof(struct dm_target_versions, name);
struct dm_target_versions s;
uint32_t offset = ioc->data_start;
uint32_t offset_end;
uint32_t count;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
for (count = 0;; count++) {
offset_end = offset + target_vers_name_offs;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
tprints(", ");
if (count >= max_strlen) {
tprints("...");
break;
}
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprints("{name=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprintf(", version=%" PRIu32 ".%" PRIu32 ".%" PRIu32 "}",
s.version[0], s.version[1], s.version[2]);
if (!s.next)
break;
offset += s.next;
if (offset <= offset_end)
goto misplaced;
}
return;
misplaced:
tprints(", /* misplaced struct dm_target_versions */ ...");
}
static void
dm_decode_dm_target_msg(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t target_msg_message_offs =
offsetof(struct dm_target_msg, message);
uint32_t offset = ioc->data_start;
uint32_t offset_end = offset + target_msg_message_offs;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
if (offset_end > offset && offset_end <= ioc->data_size) {
struct dm_target_msg s;
tprints(", ");
if (umove_or_printaddr(tcp, addr + offset, &s))
return;
tprintf("{sector=%" PRI__u64 ", message=", s.sector);
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
} else {
tprints(", /* misplaced struct dm_target_msg */");
}
}
static void
dm_decode_string(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
uint32_t offset = ioc->data_start;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
if (offset < ioc->data_size) {
tprints(", string=");
printstr_ex(tcp, addr + offset, ioc->data_size - offset,
QUOTE_0_TERMINATED);
} else {
tprints(", /* misplaced string */");
}
}
static inline bool
dm_ioctl_has_params(const unsigned int code)
{
switch (code) {
case DM_VERSION:
case DM_REMOVE_ALL:
case DM_DEV_CREATE:
case DM_DEV_REMOVE:
case DM_DEV_SUSPEND:
case DM_DEV_STATUS:
case DM_TABLE_CLEAR:
return false;
}
return true;
}
static int
dm_known_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
struct dm_ioctl *ioc = NULL;
struct dm_ioctl *entering_ioc = NULL;
bool ioc_changed = false;
if (entering(tcp)) {
ioc = malloc(sizeof(*ioc));
if (!ioc)
return 0;
} else {
ioc = alloca(sizeof(*ioc));
}
if ((umoven(tcp, arg, offsetof(struct dm_ioctl, data), ioc) < 0) ||
(ioc->data_size < offsetof(struct dm_ioctl, data_size))) {
if (entering(tcp))
free(ioc);
return 0;
}
if (entering(tcp))
set_tcb_priv_data(tcp, ioc, free);
else {
entering_ioc = get_tcb_priv_data(tcp);
/*
* retrieve_status, __dev_status called only in case of success,
* so it looks like there's no need to check open_count,
* event_nr, target_count, dev fields for change (they are
* printed only in case of absence of errors).
*/
if (!entering_ioc ||
(ioc->version[0] != entering_ioc->version[0]) ||
(ioc->version[1] != entering_ioc->version[1]) ||
(ioc->version[2] != entering_ioc->version[2]) ||
(ioc->data_size != entering_ioc->data_size) ||
(ioc->data_start != entering_ioc->data_start) ||
(ioc->flags != entering_ioc->flags))
ioc_changed = true;
}
if (exiting(tcp) && syserror(tcp) && !ioc_changed)
return 1;
/*
* device mapper code uses %d in some places and %u in another, but
* fields themselves are declared as __u32.
*/
tprintf("%s{version=%u.%u.%u", entering(tcp) ? ", " : " => ",
ioc->version[0], ioc->version[1], ioc->version[2]);
/*
* if we use a different version of ABI, do not attempt to decode
* ioctl fields
*/
if (ioc->version[0] != DM_VERSION_MAJOR) {
tprints(", /* Unsupported device mapper ABI version */ ...");
goto skip;
}
tprintf(", data_size=%u", ioc->data_size);
if (dm_ioctl_has_params(code))
tprintf(", data_start=%u", ioc->data_start);
if (ioc->data_size < offsetof(struct dm_ioctl, data)) {
tprints(", /* Incorrect data_size */ ...");
goto skip;
}
dm_decode_device(code, ioc);
dm_decode_values(tcp, code, ioc);
dm_decode_flags(ioc);
switch (code) {
case DM_DEV_WAIT:
case DM_TABLE_STATUS:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_target_spec(tcp, arg, ioc);
break;
case DM_TABLE_LOAD:
if (exiting(tcp))
break;
dm_decode_dm_target_spec(tcp, arg, ioc);
break;
case DM_TABLE_DEPS:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_target_deps(tcp, arg, ioc);
break;
case DM_LIST_DEVICES:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_name_list(tcp, arg, ioc);
break;
case DM_LIST_VERSIONS:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_target_versions(tcp, arg, ioc);
break;
case DM_TARGET_MSG:
if (entering(tcp))
dm_decode_dm_target_msg(tcp, arg, ioc);
else if (!syserror(tcp) && ioc->flags & DM_DATA_OUT_FLAG)
dm_decode_string(tcp, arg, ioc);
break;
case DM_DEV_RENAME:
case DM_DEV_SET_GEOMETRY:
if (exiting(tcp))
break;
dm_decode_string(tcp, arg, ioc);
break;
}
skip:
tprints("}");
return 1;
}
int
dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
case DM_VERSION:
case DM_REMOVE_ALL:
case DM_LIST_DEVICES:
case DM_DEV_CREATE:
case DM_DEV_REMOVE:
case DM_DEV_RENAME:
case DM_DEV_SUSPEND:
case DM_DEV_STATUS:
case DM_DEV_WAIT:
case DM_TABLE_LOAD:
case DM_TABLE_CLEAR:
case DM_TABLE_DEPS:
case DM_TABLE_STATUS:
case DM_LIST_VERSIONS:
case DM_TARGET_MSG:
case DM_DEV_SET_GEOMETRY:
return dm_known_ioctl(tcp, code, arg);
default:
return 0;
}
}
# else /* !(DM_VERSION_MAJOR == 4) */
int
dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
{
return 0;
}
# endif /* DM_VERSION_MAJOR == 4 */
#endif /* HAVE_LINUX_DM_IOCTL_H */

View File

@ -109,9 +109,9 @@ SYS_FUNC(epoll_pwait)
epoll_wait_common(tcp);
if (exiting(tcp)) {
tprints(", ");
/* NB: kernel requires arg[5] == NSIG / 8 */
/* NB: kernel requires arg[5] == NSIG_BYTES */
print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
tprintf(", %lu", tcp->u_arg[5]);
tprintf(", %" PRI_klu, tcp->u_arg[5]);
}
return 0;
}

41
evdev.c
View File

@ -76,7 +76,7 @@ decode_envelope(void *const data)
}
static int
ff_effect_ioctl(struct tcb *tcp, long arg)
ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -135,7 +135,7 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
decode_envelope(&ffe.u.periodic.envelope);
tprintf(", custom_len=%u, custom_data=",
ffe.u.periodic.custom_len);
printaddr((unsigned long) ffe.u.periodic.custom_data);
printaddr(ptr_to_kulong(ffe.u.periodic.custom_data));
tprints("}");
break;
case FF_RUMBLE:
@ -154,7 +154,7 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
}
static int
abs_ioctl(struct tcb *tcp, long arg)
abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -188,7 +188,7 @@ abs_ioctl(struct tcb *tcp, long arg)
}
static int
keycode_ioctl(struct tcb *tcp, long arg)
keycode_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -205,7 +205,7 @@ keycode_ioctl(struct tcb *tcp, long arg)
# ifdef EVIOCGKEYCODE_V2
static int
keycode_V2_ioctl(struct tcb *tcp, long arg)
keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -242,7 +242,7 @@ keycode_V2_ioctl(struct tcb *tcp, long arg)
# endif /* EVIOCGKEYCODE_V2 */
static int
getid_ioctl(struct tcb *tcp, long arg)
getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -262,13 +262,14 @@ getid_ioctl(struct tcb *tcp, long arg)
}
static int
decode_bitset(struct tcb *tcp, long arg, const struct xlat decode_nr[],
const unsigned int max_nr, const char *dflt)
decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
const struct xlat decode_nr[], const unsigned int max_nr,
const char *const dflt)
{
tprints(", ");
unsigned int size;
if ((unsigned long) tcp->u_rval > max_nr)
if ((kernel_ulong_t) tcp->u_rval > max_nr)
size = max_nr;
else
size = tcp->u_rval;
@ -304,7 +305,8 @@ decode_bitset(struct tcb *tcp, long arg, const struct xlat decode_nr[],
# ifdef EVIOCGMTSLOTS
static int
mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
mtslots_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
tprints(", ");
@ -336,7 +338,7 @@ mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
# if defined EVIOCGREP || defined EVIOCSREP
static int
repeat_ioctl(struct tcb *tcp, long arg)
repeat_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
printpair_int(tcp, arg, "%u");
@ -345,7 +347,8 @@ repeat_ioctl(struct tcb *tcp, long arg)
# endif /* EVIOCGREP || EVIOCSREP */
static int
bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
const kernel_ulong_t arg)
{
switch (ev_nr) {
case EV_SYN:
@ -395,7 +398,8 @@ bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
}
static int
evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
evdev_read_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
/* fixed-number fixed-length commands */
switch (code) {
@ -434,7 +438,7 @@ evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
if (syserror(tcp))
printaddr(arg);
else
printstr(tcp, arg, tcp->u_rval);
printstrn(tcp, arg, tcp->u_rval);
return 1;
# ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
@ -469,7 +473,8 @@ evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
}
static int
evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
evdev_write_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
/* fixed-number fixed-length commands */
switch (code) {
@ -492,7 +497,7 @@ evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
# ifdef EVIOCREVOKE
case EVIOCREVOKE:
# endif
tprintf(", %lu", arg);
tprintf(", %" PRI_klu, arg);
return 1;
# ifdef EVIOCSCLOCKID
case EVIOCSCLOCKID:
@ -509,8 +514,8 @@ evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
return 0;
}
MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *tcp,
const unsigned int code, const long arg)
MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *const tcp,
const unsigned int code, const kernel_ulong_t arg)
{
switch(_IOC_DIR(code)) {
case _IOC_READ:

View File

@ -34,7 +34,7 @@
#include "defs.h"
static void
printargv(struct tcb *tcp, long addr)
printargv(struct tcb *const tcp, kernel_ulong_t addr)
{
if (!addr || !verbose(tcp)) {
printaddr(addr);
@ -49,8 +49,8 @@ printargv(struct tcb *tcp, long addr)
for (n = 0; addr; sep = ", ", addr += wordsize, ++n) {
union {
unsigned int p32;
unsigned long p64;
char data[sizeof(long)];
kernel_ulong_t p64;
char data[sizeof(kernel_ulong_t)];
} cp;
if (umoven(tcp, addr, wordsize, cp.data)) {
@ -70,13 +70,13 @@ printargv(struct tcb *tcp, long addr)
break;
}
tprints(sep);
printstr(tcp, wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64, -1);
printstr(tcp, wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64);
}
tprints("]");
}
static void
printargc(struct tcb *tcp, long addr)
printargc(struct tcb *const tcp, kernel_ulong_t addr)
{
if (!addr || !verbose(tcp)) {
printaddr(addr);

15
exit.c
View File

@ -1,15 +0,0 @@
#include "defs.h"
SYS_FUNC(exit)
{
if (exiting(tcp)) {
error_msg("_exit returned!");
return -1;
}
/* special case: we stop tracing this process, finish line now */
tprintf("%ld) ", tcp->u_arg[0]);
tabto();
tprints("= ?\n");
line_ended();
return 0;
}

View File

@ -42,7 +42,7 @@ SYS_FUNC(fadvise64)
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld", 1);
tprintf(", %llu, ", getarg_ull(tcp, argn++));
tprintf(", %" PRI_klu ", ", tcp->u_arg[argn++]);
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
return RVAL_DECODED;

28
fcntl.c
View File

@ -46,15 +46,15 @@ print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
printxval(lockfcmds, (unsigned short) fl->l_type, "F_???");
tprints(", l_whence=");
printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???");
tprintf(", l_start=%lld, l_len=%lld",
(long long) fl->l_start, (long long) fl->l_len);
tprintf(", l_start=%" PRId64 ", l_len=%" PRId64,
(int64_t) fl->l_start, (int64_t) fl->l_len);
if (getlk)
tprintf(", l_pid=%lu", (unsigned long) fl->l_pid);
tprints("}");
}
static void
printflock64(struct tcb *tcp, const long addr, const int getlk)
printflock64(struct tcb *const tcp, const kernel_ulong_t addr, const int getlk)
{
struct_kernel_flock64 fl;
@ -63,7 +63,7 @@ printflock64(struct tcb *tcp, const long addr, const int getlk)
}
static void
printflock(struct tcb *tcp, const long addr, const int getlk)
printflock(struct tcb *const tcp, const kernel_ulong_t addr, const int getlk)
{
struct_kernel_flock64 fl;
@ -72,7 +72,7 @@ printflock(struct tcb *tcp, const long addr, const int getlk)
}
static void
print_f_owner_ex(struct tcb *tcp, const long addr)
print_f_owner_ex(struct tcb *const tcp, const kernel_ulong_t addr)
{
struct { int type, pid; } owner;
@ -96,11 +96,11 @@ print_fcntl(struct tcb *tcp)
break;
case F_SETOWN:
case F_SETPIPE_SZ:
tprintf(", %ld", tcp->u_arg[2]);
tprintf(", %" PRI_kld, tcp->u_arg[2]);
break;
case F_DUPFD:
case F_DUPFD_CLOEXEC:
tprintf(", %ld", tcp->u_arg[2]);
tprintf(", %" PRI_kld, tcp->u_arg[2]);
return RVAL_DECODED | RVAL_FD;
case F_SETFL:
tprints(", ");
@ -122,15 +122,15 @@ print_fcntl(struct tcb *tcp)
break;
case F_NOTIFY:
tprints(", ");
printflags_long(notifyflags, tcp->u_arg[2], "DN_???");
printflags64(notifyflags, tcp->u_arg[2], "DN_???");
break;
case F_SETLEASE:
tprints(", ");
printxval_long(lockfcmds, tcp->u_arg[2], "F_???");
printxval64(lockfcmds, tcp->u_arg[2], "F_???");
break;
case F_ADD_SEALS:
tprints(", ");
printflags_long(f_seals, tcp->u_arg[2], "F_SEAL_???");
printflags64(f_seals, tcp->u_arg[2], "F_SEAL_???");
break;
case F_SETSIG:
tprints(", ");
@ -143,7 +143,7 @@ print_fcntl(struct tcb *tcp)
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = sprintflags("flags ", fdflags,
(unsigned long) tcp->u_rval);
(kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETFL:
if (entering(tcp) || syserror(tcp))
@ -171,13 +171,13 @@ print_fcntl(struct tcb *tcp)
case F_GETLEASE:
if (entering(tcp) || syserror(tcp))
return 0;
tcp->auxstr = xlookup(lockfcmds, (unsigned long) tcp->u_rval);
tcp->auxstr = xlookup(lockfcmds, (kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GET_SEALS:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = sprintflags("seals ", f_seals,
(unsigned long) tcp->u_rval);
(kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETSIG:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
@ -185,7 +185,7 @@ print_fcntl(struct tcb *tcp)
tcp->auxstr = signame(tcp->u_rval);
return RVAL_STR;
default:
tprintf(", %#lx", tcp->u_arg[2]);
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
break;
}
return RVAL_DECODED;

View File

@ -34,8 +34,8 @@ typedef struct seccomp_fprog seccomp_fprog_t;
#include MPERS_DEFS
MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog,
struct tcb *tcp, const long addr, void *p)
MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct seccomp_fprog *pfp = p;
seccomp_fprog_t mfp;

View File

@ -51,8 +51,8 @@ typedef struct_kernel_flock64 struct_flock64;
&& FLOCK_MEMBERS_EQ(type, l_len) \
&& FLOCK_MEMBERS_EQ(type, l_pid))
MPERS_PRINTER_DECL(bool, fetch_struct_flock,
struct tcb *tcp, const long addr, void *p)
MPERS_PRINTER_DECL(bool, fetch_struct_flock, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct_kernel_flock64 *pfl = p;
struct_flock mfl;
@ -71,8 +71,8 @@ MPERS_PRINTER_DECL(bool, fetch_struct_flock,
return true;
}
MPERS_PRINTER_DECL(bool, fetch_struct_flock64,
struct tcb *tcp, const long addr, void *p)
MPERS_PRINTER_DECL(bool, fetch_struct_flock64, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct_kernel_flock64 *pfl = p;
struct_flock64 mfl;

View File

@ -43,7 +43,8 @@ typedef struct mmsghdr struct_mmsghdr;
*/
MPERS_PRINTER_DECL(int, fetch_struct_mmsghdr,
struct tcb *tcp, const unsigned long addr, void *p)
struct tcb *const tcp, const kernel_ulong_t addr,
void *const p)
{
struct mmsghdr *p_native = p;
struct_mmsghdr v_compat;

View File

@ -43,9 +43,10 @@ typedef struct msghdr struct_msghdr;
*/
MPERS_PRINTER_DECL(int, fetch_struct_msghdr,
struct tcb *tcp, const unsigned long addr, void *p)
struct tcb *const tcp, const kernel_ulong_t addr,
void *const p)
{
struct msghdr *p_native = p;
struct msghdr *const p_native = p;
struct_msghdr v_compat;
if (sizeof(*p_native) == sizeof(v_compat))

View File

@ -70,7 +70,7 @@ typedef struct stat struct_stat;
#endif
MPERS_PRINTER_DECL(bool, fetch_struct_stat,
struct tcb *tcp, const unsigned long addr,
struct tcb *const tcp, const kernel_ulong_t addr,
struct strace_stat *const dst)
{
#ifdef HAVE_STRUCT_STAT

View File

@ -68,7 +68,7 @@ typedef struct stat64 struct_stat64;
#endif
MPERS_PRINTER_DECL(bool, fetch_struct_stat64,
struct tcb *tcp, const unsigned long addr,
struct tcb *const tcp, const kernel_ulong_t addr,
struct strace_stat *const dst)
{
#ifdef HAVE_STRUCT_STAT64

View File

@ -40,7 +40,8 @@ typedef struct statfs64 struct_statfs64;
#include "statfs.h"
MPERS_PRINTER_DECL(bool, fetch_struct_statfs,
struct tcb *tcp, const long addr, struct strace_statfs *p)
struct tcb *const tcp, const kernel_ulong_t addr,
struct strace_statfs *const p)
{
struct_statfs b;
@ -78,8 +79,8 @@ MPERS_PRINTER_DECL(bool, fetch_struct_statfs,
#endif
MPERS_PRINTER_DECL(bool, fetch_struct_statfs64,
struct tcb *tcp, const long addr, const unsigned long size,
struct strace_statfs *p)
struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t size, struct strace_statfs *const p)
{
struct_statfs64 b;

View File

@ -27,6 +27,8 @@
#include "defs.h"
#include "xlat/name_to_handle_at_flags.h"
#ifndef MAX_HANDLE_SZ
# define MAX_HANDLE_SZ 128
#endif
@ -39,7 +41,7 @@ typedef struct {
SYS_FUNC(name_to_handle_at)
{
file_handle_header h;
const long addr = tcp->u_arg[2];
const kernel_ulong_t addr = tcp->u_arg[2];
if (entering(tcp)) {
/* dirfd */
@ -58,7 +60,8 @@ SYS_FUNC(name_to_handle_at)
tprints(", ");
/* flags */
printflags(at_flags, tcp->u_arg[4], "AT_???");
printflags(name_to_handle_at_flags, tcp->u_arg[4],
"AT_???");
return RVAL_DECODED;
}
@ -95,7 +98,7 @@ SYS_FUNC(name_to_handle_at)
tprints(", ");
/* flags */
printflags(at_flags, tcp->u_arg[4], "AT_???");
printflags(name_to_handle_at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
}
@ -103,7 +106,7 @@ SYS_FUNC(name_to_handle_at)
SYS_FUNC(open_by_handle_at)
{
file_handle_header h;
const long addr = tcp->u_arg[1];
const kernel_ulong_t addr = tcp->u_arg[1];
/* mount_fd */
printfd(tcp, tcp->u_arg[0]);

View File

@ -123,7 +123,8 @@ print_fiemap_extent(struct tcb *tcp, void *elem_buf, size_t elem_size, void *dat
#endif /* HAVE_LINUX_FIEMAP_H */
int
file_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
file_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
case FICLONE: /* W */

View File

@ -30,7 +30,8 @@
#include <linux/fs.h>
int
fs_x_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
fs_x_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
#ifdef FITRIM

View File

@ -2,13 +2,11 @@
SYS_FUNC(fstatfs64)
{
const unsigned long size = tcp->u_arg[1];
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprintf(", %lu, ", size);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
} else {
print_struct_statfs64(tcp, tcp->u_arg[2], size);
print_struct_statfs64(tcp, tcp->u_arg[2], tcp->u_arg[1]);
}
return 0;
}

27
futex.c
View File

@ -43,11 +43,11 @@
SYS_FUNC(futex)
{
const long uaddr = tcp->u_arg[0];
const kernel_ulong_t uaddr = tcp->u_arg[0];
const int op = tcp->u_arg[1];
const int cmd = op & 127;
const long timeout = tcp->u_arg[3];
const long uaddr2 = tcp->u_arg[4];
const kernel_ulong_t timeout = tcp->u_arg[3];
const kernel_ulong_t uaddr2 = tcp->u_arg[4];
const unsigned int val = tcp->u_arg[2];
const unsigned int val2 = tcp->u_arg[3];
const unsigned int val3 = tcp->u_arg[5];
@ -91,13 +91,19 @@ SYS_FUNC(futex)
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
tprints(", {");
tprints(", ");
if ((val3 >> 28) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakeops, (val3 >> 28) & 0x7, "FUTEX_OP_???");
tprintf(", %u, ", (val3 >> 12) & 0xfff);
printxval(futexwakecmps, (val3 >> 24) & 0xf, "FUTEX_OP_CMP_???");
tprintf(", %u}", val3 & 0xfff);
tprints("FUTEX_OP_OPARG_SHIFT<<28|");
if (printxval(futexwakeops, (val3 >> 28) & 0x7, NULL))
tprints("<<28");
else
tprints("<<28 /* FUTEX_OP_??? */");
tprintf("|%#x<<12|", (val3 >> 12) & 0xfff);
if (printxval(futexwakecmps, (val3 >> 24) & 0xf, NULL))
tprints("<<24");
else
tprints("<<24 /* FUTEX_OP_CMP_??? */");
tprintf("|%#x", val3 & 0xfff);
break;
case FUTEX_WAIT_REQUEUE_PI:
tprintf(", %u", val);
@ -115,7 +121,8 @@ SYS_FUNC(futex)
break;
default:
tprintf(", %u", val);
tprintf(", %#lx", timeout);
tprints(", ");
printaddr(timeout);
tprints(", ");
printaddr(uaddr2);
tprintf(", %#x", val3);

View File

@ -52,6 +52,16 @@
# define ATTRIBUTE_PACKED /* empty */
#endif
#if GNUC_PREREQ(3, 0)
# define SAME_TYPE(x, y) __builtin_types_compatible_p(typeof(x), typeof(y))
# define FAIL_BUILD_ON_ZERO(expr) (sizeof(int[-1 + 2 * !!(expr)]) * 0)
/* &(a)[0] is a pointer and not an array, shouldn't be treated as the same */
# define MUST_BE_ARRAY(a) FAIL_BUILD_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
#else
# define SAME_TYPE(x, y) 0
# define MUST_BE_ARRAY(a) 0
#endif
#if GNUC_PREREQ(3, 0)
# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
#else
@ -70,6 +80,12 @@
# define ATTRIBUTE_SENTINEL /* empty */
#endif
#if GNUC_PREREQ(4, 1)
# define ALIGNOF(t_) __alignof__(t_)
#else
# define ALIGNOF(t_) (sizeof(struct {char x_; t_ y_;}) - sizeof(t_))
#endif
#if GNUC_PREREQ(4, 3)
# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
#else

View File

@ -7,7 +7,7 @@ SYS_FUNC(getcwd)
printaddr(tcp->u_arg[0]);
else
printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
tprintf(", %lu", tcp->u_arg[1]);
tprintf(", %" PRI_klu, tcp->u_arg[1]);
}
return 0;
}

View File

@ -7,8 +7,9 @@ SYS_FUNC(getrandom)
if (syserror(tcp))
printaddr(tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[1]);
printstr_ex(tcp, tcp->u_arg[0], tcp->u_rval,
QUOTE_FORCE_HEX);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
printflags(getrandom_flags, tcp->u_arg[2], "GRND_???");
}
return 0;

4
hdio.c
View File

@ -36,8 +36,8 @@ typedef struct hd_geometry struct_hd_geometry;
#include MPERS_DEFS
MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *tcp,
const unsigned int code, const long arg)
MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *const tcp,
const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
case HDIO_GETGEO:

View File

@ -1,9 +1,24 @@
#include "defs.h"
#ifdef HAVE_LINUX_UTSNAME_H
# include <linux/utsname.h>
#endif
#ifndef __NEW_UTS_LEN
# define __NEW_UTS_LEN 64
#endif
SYS_FUNC(sethostname)
{
printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[1]);
unsigned int len = tcp->u_arg[1];
if (len > __NEW_UTS_LEN) {
printaddr(tcp->u_arg[0]);
} else {
printstrn(tcp, tcp->u_arg[0], len);
}
tprintf(", %u", len);
return RVAL_DECODED;
}
@ -15,8 +30,8 @@ SYS_FUNC(gethostname)
if (syserror(tcp))
printaddr(tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], -1);
tprintf(", %lu", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[0]);
tprintf(", %" PRI_klu, tcp->u_arg[1]);
}
return 0;
}

357
install.texi Normal file
View File

@ -0,0 +1,357 @@
@c This file is imported from GNU Autoconf and edited to produce
@c the INSTALL file.
@ifclear autoconf
@unnumbered Installation Instructions
Copyright @copyright{} 1994-1996, 1999-2002, 2004-2013 Free Software
Foundation, Inc.
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved. This file is offered as-is, without
warranty of any kind.
@end ifclear
@node Basic Installation
@section Basic Installation
Briefly, the shell command
@samp{./configure@tie{}&& make@tie{}&& make@tie{}install}
should configure, build, and install this package. The following
more-detailed instructions are generic; see the @file{README} file for
instructions specific to this package.
@ifclear autoconf
Some packages provide this @file{INSTALL} file but do not implement all
of the features documented below. The lack of an optional feature in a
given package is not necessarily a bug.
@end ifclear
More recommendations for GNU packages can be found in
@ref{Makefile Conventions, , Makefile Conventions, standards,
GNU Coding Standards}.
The @command{configure} shell script attempts to guess correct values
for various system-dependent variables used during compilation. It uses
those values to create a @file{Makefile} in each directory of the
package. It may also create one or more @file{.h} files containing
system-dependent definitions. Finally, it creates a shell script
@file{config.status} that you can run in the future to recreate the
current configuration, and a file @file{config.log} containing compiler
output (useful mainly for debugging @command{configure}).
It can also use an optional file (typically called @file{config.cache}
and enabled with @option{--cache-file=config.cache} or simply
@option{-C}) that saves the results of its tests to speed up
reconfiguring. Caching is disabled by default to prevent problems with
accidental use of stale cache files.
If you need to do unusual things to compile the package, please try to
figure out how @command{configure} could check whether to do them, and
mail diffs or instructions to the address given in the @file{README} so
they can be considered for the next release. If you are using the
cache, and at some point @file{config.cache} contains results you don't
want to keep, you may remove or edit it.
The file @file{configure.ac} (or @file{configure.in}) is used to create
@file{configure} by a program called @command{autoconf}. You need
@file{configure.ac} if you want to change it or regenerate
@file{configure} using a newer version of @command{autoconf}.
The simplest way to compile this package is:
@enumerate
@item
@command{cd} to the directory containing the package's source code and type
@samp{./configure} to configure the package for your system.
Running @command{configure} might take a while. While running, it prints some
messages telling which features it is checking for.
@item
Type @samp{make} to compile the package.
@item
Optionally, type @samp{make check} to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
@item
Type @samp{make install} to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular user,
and only the @samp{make install} phase executed with root privileges.
@item
Optionally, type @samp{make installcheck} to repeat any self-tests, but
this time using the binaries in their final installed location. This
target does not install anything. Running this target as a regular
user, particularly if the prior @samp{make install} required root
privileges, verifies that the installation completed correctly.
@item
You can remove the program binaries and object files from the source
code directory by typing @samp{make clean}. To also remove the files
that @command{configure} created (so you can compile the package for a
different kind of computer), type @samp{make distclean}. There is also
a @samp{make maintainer-clean} target, but that is intended mainly for
the package's developers. If you use it, you may have to get all sorts
of other programs in order to regenerate files that came with the
distribution.
@item
Often, you can also type @samp{make uninstall} to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
@item
Some packages, particularly those that use Automake, provide @samp{make
distcheck}, which can by used by developers to test that all other
targets like @samp{make install} and @samp{make uninstall} work
correctly. This target is generally not run by end users.
@end enumerate
@node Compilers and Options
@section Compilers and Options
Some systems require unusual options for compilation or linking that the
@command{configure} script does not know about. Run @samp{./configure
--help} for details on some of the pertinent environment variables.
You can give @command{configure} initial values for configuration
parameters by setting variables in the command line or in the environment.
Here is an example:
@example
./configure CC=c99 CFLAGS=-g LIBS=-lposix
@end example
@xref{Defining Variables}, for more details.
@node Installation Names
@section Installation Names
By default, @samp{make install} installs the package's commands under
@file{/usr/local/bin}, include files under @file{/usr/local/include}, etc.
You can specify an
installation prefix other than @file{/usr/local} by giving
@command{configure} the option @option{--prefix=@var{prefix}}, where
@var{prefix} must be an absolute file name.
You can specify separate installation prefixes for architecture-specific
files and architecture-independent files. If you pass the option
@option{--exec-prefix=@var{prefix}} to @command{configure}, the
package uses @var{prefix} as the prefix for installing programs and
libraries. Documentation and other data files still use the
regular prefix.
In addition, if you use an unusual directory layout you can give options
like @option{--bindir=@var{dir}} to specify different values for
particular kinds of files. Run @samp{configure --help} for a list of
the directories you can set and what kinds of files go in them. In
general, the default for these options is expressed in terms of
@samp{$@{prefix@}}, so that specifying just @option{--prefix} will
affect all of the other directory specifications that were not
explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to @command{configure}; however, many packages provide
one or both of the following shortcuts of passing variable assignments
to the @samp{make install} command line to change installation locations
without having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, @samp{make install
prefix=/alternate/directory} will choose an alternate location for all
directory configuration variables that were expressed in terms of
@samp{$@{prefix@}}. Any directories that were specified during
@command{configure}, but not in terms of @samp{$@{prefix@}}, must each be
overridden at install time for the entire
installation to be relocated. The approach of makefile variable
overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation. However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.
The second method involves providing the @samp{DESTDIR} variable. For
example, @samp{make install DESTDIR=/alternate/directory} will prepend
@samp{/alternate/directory} before all installation names. The approach
of @samp{DESTDIR} overrides is not required by the GNU Coding
Standards, and does not work on platforms that have drive letters. On
the other hand, it does better at avoiding recompilation issues, and
works well even when some directory options were not specified in terms
of @samp{$@{prefix@}} at @command{configure} time.
@node Optional Features
@section Optional Features
If the package supports it, you can cause programs to be installed with
an extra prefix or suffix on their names by giving @command{configure}
the option @option{--program-prefix=@var{PREFIX}} or
@option{--program-suffix=@var{SUFFIX}}.
Some packages pay attention to @option{--enable-@var{feature}} options
to @command{configure}, where @var{feature} indicates an optional part
of the package. They may also pay attention to
@option{--with-@var{package}} options, where @var{package} is something
like @samp{gnu-as} or @samp{x} (for the X Window System). The
@file{README} should mention any @option{--enable-} and @option{--with-}
options that the package recognizes.
For packages that use the X Window System, @command{configure} can
usually find the X include and library files automatically, but if it
doesn't, you can use the @command{configure} options
@option{--x-includes=@var{dir}} and @option{--x-libraries=@var{dir}} to
specify their locations.
Some packages offer the ability to configure how verbose the execution
of @command{make} will be. For these packages, running
@samp{./configure --enable-silent-rules} sets the default to minimal
output, which can be overridden with @code{make V=1}; while running
@samp{./configure --disable-silent-rules} sets the default to verbose,
which can be overridden with @code{make V=0}.
@node System Type
@section Specifying the System Type
There may be some features @command{configure} cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
@emph{same} architectures, @command{configure} can figure that out, but
if it prints a message saying it cannot guess the machine type, give it
the @option{--build=@var{type}} option. @var{type} can either be a
short name for the system type, such as @samp{sun4}, or a canonical name
which has the form:
@example
@var{cpu}-@var{company}-@var{system}
@end example
@noindent
where @var{system} can have one of these forms:
@example
@var{os}
@var{kernel}-@var{os}
@end example
See the file @file{config.sub} for the possible values of each field.
If @file{config.sub} isn't included in this package, then this package
doesn't need to know the machine type.
If you are @emph{building} compiler tools for cross-compiling, you
should use the option @option{--target=@var{type}} to select the type of
system they will produce code for.
If you want to @emph{use} a cross compiler, that generates code for a
platform different from the build platform, you should specify the
@dfn{host} platform (i.e., that on which the generated programs will
eventually be run) with @option{--host=@var{type}}.
@node Sharing Defaults
@section Sharing Defaults
If you want to set default values for @command{configure} scripts to
share, you can create a site shell script called @file{config.site} that
gives default values for variables like @code{CC}, @code{cache_file},
and @code{prefix}. @command{configure} looks for
@file{@var{prefix}/share/config.site} if it exists, then
@file{@var{prefix}/etc/config.site} if it exists. Or, you can set the
@code{CONFIG_SITE} environment variable to the location of the site
script. A warning: not all @command{configure} scripts look for a site
script.
@node Defining Variables
@section Defining Variables
Variables not defined in a site shell script can be set in the
environment passed to @command{configure}. However, some packages may
run configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the @command{configure} command line, using @samp{VAR=value}.
For example:
@example
./configure CC=/usr/local2/bin/gcc
@end example
@noindent
causes the specified @command{gcc} to be used as the C compiler (unless it is
overridden in the site shell script).
@noindent
Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
to an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
@example
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
@end example
@node configure Invocation
@section @command{configure} Invocation
@command{configure} recognizes the following options to control how it
operates.
@table @option
@item --help
@itemx -h
Print a summary of all of the options to @command{configure}, and exit.
@item --help=short
@itemx --help=recursive
Print a summary of the options unique to this package's
@command{configure}, and exit. The @code{short} variant lists options
used only in the top level, while the @code{recursive} variant lists
options also present in any nested packages.
@item --version
@itemx -V
Print the version of Autoconf used to generate the @command{configure}
script, and exit.
@item --cache-file=@var{file}
@cindex Cache, enabling
Enable the cache: use and save the results of the tests in @var{file},
traditionally @file{config.cache}. @var{file} defaults to
@file{/dev/null} to disable caching.
@item --config-cache
@itemx -C
Alias for @option{--cache-file=config.cache}.
@item --quiet
@itemx --silent
@itemx -q
Do not print messages saying which checks are being made. To suppress
all normal output, redirect it to @file{/dev/null} (any error messages
will still be shown).
@item --srcdir=@var{dir}
Look for the package's source code in directory @var{dir}. Usually
@command{configure} can determine that directory automatically.
@item --prefix=@var{dir}
Use @var{dir} as the installation prefix. @ref{Installation Names}
for more details, including other options available for fine-tuning
the installation locations.
@item --no-create
@itemx -n
Run the configure checks, but stop before creating any output files.
@end table
@noindent
@command{configure} also accepts some other, not widely useful, options.
Run @samp{configure --help} for more details.
@c Local Variables:
@c fill-column: 72
@c ispell-local-dictionary: "american"
@c indent-tabs-mode: nil
@c whitespace-check-buffer-indent: nil
@c End:

139
io.c
View File

@ -41,8 +41,8 @@ SYS_FUNC(read)
if (syserror(tcp))
printaddr(tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu", tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
}
@ -51,22 +51,22 @@ SYS_FUNC(write)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
}
struct print_iovec_config {
enum iov_decode decode_iov;
unsigned long data_size;
kernel_ulong_t data_size;
};
static bool
print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
const unsigned long *iov;
unsigned long iov_buf[2], len;
const kernel_ulong_t *iov;
kernel_ulong_t iov_buf[2], len;
struct print_iovec_config *c = data;
if (elem_size < sizeof(iov_buf)) {
@ -85,14 +85,14 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
case IOV_DECODE_STR:
if (len > c->data_size)
len = c->data_size;
if (c->data_size != (unsigned long) -1L)
if (c->data_size != (kernel_ulong_t) -1)
c->data_size -= len;
printstr(tcp, iov[0], len);
printstrn(tcp, iov[0], len);
break;
case IOV_DECODE_NETLINK:
if (len > c->data_size)
len = c->data_size;
if (c->data_size != (unsigned long) -1L)
if (c->data_size != (kernel_ulong_t) -1)
c->data_size -= len;
decode_netlink(tcp, iov[0], iov[1]);
break;
@ -101,7 +101,7 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
break;
}
tprintf(", iov_len=%lu}", iov[1]);
tprintf(", iov_len=%" PRI_klu "}", iov[1]);
return true;
}
@ -111,22 +111,16 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
* Example: recvmsg returing a short read.
*/
void
tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr,
enum iov_decode decode_iov, unsigned long data_size)
tprint_iov_upto(struct tcb *const tcp, const kernel_ulong_t len,
const kernel_ulong_t addr, const enum iov_decode decode_iov,
const kernel_ulong_t data_size)
{
unsigned long iov[2];
kernel_ulong_t iov[2];
struct print_iovec_config config =
{ .decode_iov = decode_iov, .data_size = data_size };
print_array(tcp, addr, len, iov, current_wordsize * 2,
umoven_or_printaddr, print_iovec, &config);
}
void
tprint_iov(struct tcb *tcp, unsigned long len, unsigned long addr,
enum iov_decode decode_iov)
{
tprint_iov_upto(tcp, len, addr, decode_iov, (unsigned long) -1L);
umoven_or_printaddr_ignore_syserror, print_iovec, &config);
}
SYS_FUNC(readv)
@ -136,8 +130,9 @@ SYS_FUNC(readv)
tprints(", ");
} else {
tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
syserror(tcp) ? IOV_DECODE_ADDR :
IOV_DECODE_STR, tcp->u_rval);
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
}
@ -147,7 +142,7 @@ SYS_FUNC(writev)
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
}
@ -161,8 +156,8 @@ SYS_FUNC(pread)
if (syserror(tcp))
printaddr(tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
printllval(tcp, "%lld", 3);
}
return 0;
@ -172,8 +167,8 @@ SYS_FUNC(pwrite)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, ", tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
printllval(tcp, "%lld", 3);
return RVAL_DECODED;
@ -182,38 +177,20 @@ SYS_FUNC(pwrite)
static void
print_lld_from_low_high_val(struct tcb *tcp, int arg)
{
#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
# if SUPPORTED_PERSONALITIES > 1
# ifdef X86_64
if (current_personality != 1)
# else
if (current_wordsize == sizeof(long))
# endif
# endif
tprintf("%ld", tcp->u_arg[arg]);
# if SUPPORTED_PERSONALITIES > 1
else
tprintf("%ld",
((unsigned long) tcp->u_arg[arg + 1] << current_wordsize * 8)
| (unsigned long) tcp->u_arg[arg]);
# endif
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
#elif HAVE_STRUCT_TCB_EXT_ARG
# if SUPPORTED_PERSONALITIES > 1
if (current_personality == 1) {
tprintf("%lld",
(zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
| zero_extend_signed_to_ull(tcp->u_arg[arg]));
#if SIZEOF_KERNEL_LONG_T > 4
# ifndef current_klongsize
if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
tprintf("%" PRI_kld, (tcp->u_arg[arg + 1] << 32)
| tcp->u_arg[arg]);
} else
# endif
# endif /* !current_klongsize */
{
tprintf("%lld", tcp->ext_arg[arg]);
tprintf("%" PRI_kld, tcp->u_arg[arg]);
}
#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && !HAVE_STRUCT_TCB_EXT_ARG */
#else /* SIZEOF_KERNEL_LONG_T == 4 */
tprintf("%lld",
(zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
| zero_extend_signed_to_ull(tcp->u_arg[arg]));
((long long) tcp->u_arg[arg + 1] << 32)
| ((long long) tcp->u_arg[arg]));
#endif
}
@ -226,9 +203,13 @@ do_preadv(struct tcb *tcp, const int flags_arg)
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR,
tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[2]);
kernel_ulong_t len =
truncate_kulong_to_current_wordsize(tcp->u_arg[2]);
tprint_iov_upto(tcp, len, tcp->u_arg[1],
syserror(tcp) ? IOV_DECODE_ADDR :
IOV_DECODE_STR, tcp->u_rval);
tprintf(", %" PRI_klu ", ", len);
print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
@ -243,18 +224,16 @@ SYS_FUNC(preadv)
return do_preadv(tcp, -1);
}
SYS_FUNC(preadv2)
{
return do_preadv(tcp, 5);
}
static int
do_pwritev(struct tcb *tcp, const int flags_arg)
{
kernel_ulong_t len =
truncate_kulong_to_current_wordsize(tcp->u_arg[2]);
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %lu, ", tcp->u_arg[2]);
tprint_iov(tcp, len, tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %" PRI_klu ", ", len);
print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
@ -269,9 +248,29 @@ SYS_FUNC(pwritev)
return do_pwritev(tcp, -1);
}
/*
* x32 is the only architecture where preadv2 takes 5 arguments
* instead of 6, see preadv64v2 in kernel sources.
* Likewise, x32 is the only architecture where pwritev2 takes 5 arguments
* instead of 6, see pwritev64v2 in kernel sources.
*/
#if defined X86_64
# define PREADV2_PWRITEV2_FLAGS_ARG_NO (current_personality == 2 ? 4 : 5)
#elif defined X32
# define PREADV2_PWRITEV2_FLAGS_ARG_NO (current_personality == 0 ? 4 : 5)
#else
# define PREADV2_PWRITEV2_FLAGS_ARG_NO 5
#endif
SYS_FUNC(preadv2)
{
return do_preadv(tcp, PREADV2_PWRITEV2_FLAGS_ARG_NO);
}
SYS_FUNC(pwritev2)
{
return do_pwritev(tcp, 5);
return do_pwritev(tcp, PREADV2_PWRITEV2_FLAGS_ARG_NO);
}
#include "xlat/splice_flags.h"
@ -285,7 +284,7 @@ SYS_FUNC(tee)
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[2]);
tprintf("%" PRI_klu ", ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
@ -307,7 +306,7 @@ SYS_FUNC(splice)
printnum_int64(tcp, tcp->u_arg[3], "%" PRId64);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[4]);
tprintf("%" PRI_klu ", ", tcp->u_arg[4]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[5], "SPLICE_F_???");
@ -321,7 +320,7 @@ SYS_FUNC(vmsplice)
tprints(", ");
/* const struct iovec *iov, unsigned long nr_segs */
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %lu, ", tcp->u_arg[2]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");

16
ioctl.c
View File

@ -42,7 +42,7 @@
static int
compare(const void *a, const void *b)
{
const unsigned int code1 = (const unsigned long) a;
const unsigned int code1 = (const uintptr_t) a;
const unsigned int code2 = ((struct_ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
@ -52,7 +52,7 @@ ioctl_lookup(const unsigned int code)
{
struct_ioctlent *iop;
iop = bsearch((const void *) (const unsigned long) code, ioctlent,
iop = bsearch((const void *) (const uintptr_t) code, ioctlent,
nioctlents, sizeof(ioctlent[0]), compare);
while (iop > ioctlent) {
iop--;
@ -79,7 +79,7 @@ ioctl_print_code(const unsigned int code)
{
tprints("_IOC(");
printflags(ioctl_dirs, _IOC_DIR(code), "_IOC_???");
tprintf(", 0x%02x, 0x%02x, 0x%02x)",
tprintf(", %#x, %#x, %#x)",
_IOC_TYPE(code), _IOC_NR(code), _IOC_SIZE(code));
}
@ -227,7 +227,7 @@ static int
ioctl_decode(struct tcb *tcp)
{
const unsigned int code = tcp->u_arg[1];
const long arg = tcp->u_arg[2];
const kernel_ulong_t arg = tcp->u_arg[2];
switch (_IOC_TYPE(code)) {
#if defined(ALPHA) || defined(POWERPC)
@ -255,10 +255,8 @@ ioctl_decode(struct tcb *tcp)
return block_ioctl(tcp, code, arg);
case 'X':
return fs_x_ioctl(tcp, code, arg);
#ifdef HAVE_SCSI_SG_H
case 0x22:
return scsi_ioctl(tcp, code, arg);
#endif
case 'L':
return loop_ioctl(tcp, code, arg);
case 'M':
@ -281,6 +279,10 @@ ioctl_decode(struct tcb *tcp)
#ifdef HAVE_LINUX_BTRFS_H
case 0x94:
return btrfs_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_DM_IOCTL_H
case 0xfd:
return dm_ioctl(tcp, code, arg);
#endif
default:
break;
@ -319,7 +321,7 @@ SYS_FUNC(ioctl)
if (ret)
--ret;
else
tprintf(", %#lx", tcp->u_arg[2]);
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
ret |= RVAL_DECODED;
} else {
if (ret)

43
ioctl_iocdef.c Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2017 Alexey Neyman <stilor@att.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This file is *PREPROCESSED*, not *COMPILED* for host and the result
* is included into ioctlsort (which is compiled for build). Since some
* of these values are used in structure initializers, they cannot be
* defined as 'const unsigned int' - instead, they have to be macros.
* Hence, the result of preprocessing will be run through sed to change
* 'DEFINE' into '#define'
*/
#include <linux/ioctl.h>
DEFINE HOST_IOC_NONE _IOC_NONE
DEFINE HOST_IOC_READ _IOC_READ
DEFINE HOST_IOC_WRITE _IOC_WRITE
DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT

View File

@ -33,7 +33,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/ioctl.h>
#include "ioctl_iocdef.h"
struct ioctlent {
const char *info;

View File

@ -2,7 +2,7 @@
SYS_FUNC(ioperm)
{
tprintf("%#lx, %#lx, %d",
tprintf("%#" PRI_klx ", %#" PRI_klx ", %d",
tcp->u_arg[0], tcp->u_arg[1], (int) tcp->u_arg[2]);
return RVAL_DECODED;

2
ipc.c
View File

@ -45,7 +45,7 @@ SYS_FUNC(ipc)
unsigned int i;
for (i = 1; i < tcp->s_ent->nargs; ++i)
tprintf(", %#lx", tcp->u_arg[i]);
tprintf(", %#" PRI_klx, tcp->u_arg[i]);
return RVAL_DECODED;
}

View File

@ -57,8 +57,8 @@ SYS_FUNC(msgget)
}
static void
tprint_msgsnd(struct tcb *tcp, const long addr, const unsigned long count,
const unsigned long flags)
tprint_msgsnd(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t count, const unsigned int flags)
{
tprint_msgbuf(tcp, addr, count);
printflags(ipc_msg_flags, flags, "MSG_???");
@ -78,15 +78,16 @@ SYS_FUNC(msgsnd)
}
static void
tprint_msgrcv(struct tcb *tcp, const long addr, const unsigned long count,
const long msgtyp)
tprint_msgrcv(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t count, const kernel_ulong_t msgtyp)
{
tprint_msgbuf(tcp, addr, count);
tprintf("%ld, ", msgtyp);
tprintf("%" PRI_kld ", ", msgtyp);
}
static int
fetch_msgrcv_args(struct tcb *tcp, const long addr, unsigned long *pair)
fetch_msgrcv_args(struct tcb *const tcp, const kernel_ulong_t addr,
kernel_ulong_t *const pair)
{
if (current_wordsize == sizeof(*pair)) {
if (umoven_or_printaddr(tcp, addr, 2 * sizeof(*pair), pair))
@ -117,10 +118,10 @@ SYS_FUNC(msgrcv)
tprint_msgrcv(tcp, tcp->u_arg[3],
tcp->u_arg[1], tcp->u_arg[4]);
} else {
unsigned long pair[2];
kernel_ulong_t pair[2];
if (fetch_msgrcv_args(tcp, tcp->u_arg[3], pair))
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
else
tprint_msgrcv(tcp, pair[0],
tcp->u_arg[1], pair[1]);

View File

@ -51,7 +51,7 @@ typedef struct msqid64_ds msqid_ds_t;
#include "xlat/msgctl_flags.h"
static void
print_msqid_ds(struct tcb *tcp, const long addr, int cmd)
print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
{
/* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
@ -101,7 +101,7 @@ SYS_FUNC(msgctl)
PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
tprints(", ");
} else {
const long addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
const kernel_ulong_t addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
print_msqid_ds(tcp, addr, tcp->u_arg[1]);
}
return 0;

View File

@ -57,7 +57,8 @@ print_sembuf(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
#endif
static void
tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned int count)
tprint_sembuf_array(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned int count)
{
#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
struct sembuf sb;
@ -125,7 +126,7 @@ SYS_FUNC(semctl)
) {
printnum_ptr(tcp, tcp->u_arg[3]);
} else {
tprintf("%#lx", tcp->u_arg[3]);
printaddr(tcp->u_arg[3]);
}
return RVAL_DECODED;
}

View File

@ -48,7 +48,7 @@ SYS_FUNC(shmget)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
print_numeric_umode_t(tcp->u_arg[2] & 0777);

View File

@ -51,7 +51,7 @@ typedef struct shmid64_ds shmid_ds_t;
#include "xlat/shmctl_flags.h"
static void
print_shmid_ds(struct tcb *tcp, const long addr, int cmd)
print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
{
/* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
@ -101,7 +101,7 @@ SYS_FUNC(shmctl)
PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
tprints(", ");
} else {
const long addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
const kernel_ulong_t addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
print_shmid_ds(tcp, addr, tcp->u_arg[1]);
}
return 0;

6
kcmp.c
View File

@ -33,8 +33,8 @@ SYS_FUNC(kcmp)
pid_t pid1 = tcp->u_arg[0];
pid_t pid2 = tcp->u_arg[1];
int type = tcp->u_arg[2];
unsigned long idx1 = tcp->u_arg[3];
unsigned long idx2 = tcp->u_arg[4];
kernel_ulong_t idx1 = tcp->u_arg[3];
kernel_ulong_t idx2 = tcp->u_arg[4];
tprintf("%d, %d, ", pid1, pid2);
printxval(kcmp_types, type, "KCMP_???");
@ -51,7 +51,7 @@ SYS_FUNC(kcmp)
case KCMP_VM:
break;
default:
tprintf(", %#lx, %#lx", idx1, idx2);
tprintf(", %#" PRI_klx ", %#" PRI_klx, idx1, idx2);
}
return RVAL_DECODED;

View File

@ -35,7 +35,7 @@
typedef __kernel_long_t kernel_long_t;
typedef __kernel_ulong_t kernel_ulong_t;
# elif defined __x86_64__ && defined __ILP32__
# elif (defined __x86_64__ && defined __ILP32__) || defined LINUX_MIPSN32
typedef long long kernel_long_t;
typedef unsigned long long kernel_ulong_t;

32
kexec.c
View File

@ -40,8 +40,8 @@
static bool
print_seg(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
const unsigned long *seg;
unsigned long seg_buf[4];
const kernel_ulong_t *seg;
kernel_ulong_t seg_buf[4];
if (elem_size < sizeof(seg_buf)) {
unsigned int i;
@ -53,25 +53,25 @@ print_seg(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
seg = elem_buf;
}
tprints("{");
tprints("{buf=");
printaddr(seg[0]);
tprintf(", %lu, ", seg[1]);
tprintf(", bufsz=%" PRI_klu ", mem=", seg[1]);
printaddr(seg[2]);
tprintf(", %lu}", seg[3]);
tprintf(", memsz=%" PRI_klu "}", seg[3]);
return true;
}
static void
print_kexec_segments(struct tcb *tcp, const unsigned long addr,
const unsigned long len)
print_kexec_segments(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t len)
{
if (len > KEXEC_SEGMENT_MAX) {
printaddr(addr);
return;
}
unsigned long seg[4];
kernel_ulong_t seg[4];
const size_t sizeof_seg = ARRAY_SIZE(seg) * current_wordsize;
print_array(tcp, addr, len, seg, sizeof_seg,
@ -82,19 +82,19 @@ SYS_FUNC(kexec_load)
{
/* entry, nr_segments */
printaddr(tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
/* segments */
print_kexec_segments(tcp, tcp->u_arg[2], tcp->u_arg[1]);
tprints(", ");
/* flags */
unsigned long n = tcp->u_arg[3];
printxval_long(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
n &= ~KEXEC_ARCH_MASK;
kernel_ulong_t n = tcp->u_arg[3];
printxval64(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
n &= ~(kernel_ulong_t) KEXEC_ARCH_MASK;
if (n) {
tprints("|");
printflags_long(kexec_load_flags, n, "KEXEC_???");
printflags64(kexec_load_flags, n, "KEXEC_???");
}
return RVAL_DECODED;
@ -111,12 +111,12 @@ SYS_FUNC(kexec_file_load)
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* cmdline_len */
tprintf("%lu, ", tcp->u_arg[2]);
tprintf("%" PRI_klu ", ", tcp->u_arg[2]);
/* cmdline */
printstr(tcp, tcp->u_arg[3], tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[3], tcp->u_arg[2]);
tprints(", ");
/* flags */
printflags_long(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
printflags64(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
return RVAL_DECODED;
}

View File

@ -26,7 +26,6 @@
*/
#include "defs.h"
#include "kernel_types.h"
typedef int32_t key_serial_t;
@ -52,15 +51,15 @@ print_keyring_serial_number(key_serial_t id)
SYS_FUNC(add_key)
{
/* type */
printstr(tcp, tcp->u_arg[0], -1);
printstr(tcp, tcp->u_arg[0]);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, tcp->u_arg[1]);
/* payload */
tprints(", ");
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
printstrn(tcp, tcp->u_arg[2], tcp->u_arg[3]);
/* payload length */
tprintf(", %lu, ", tcp->u_arg[3]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[3]);
/* keyring serial number */
print_keyring_serial_number(tcp->u_arg[4]);
@ -70,13 +69,13 @@ SYS_FUNC(add_key)
SYS_FUNC(request_key)
{
/* type */
printstr(tcp, tcp->u_arg[0], -1);
printstr(tcp, tcp->u_arg[0]);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, tcp->u_arg[1]);
/* callout_info */
tprints(", ");
printstr(tcp, tcp->u_arg[2], -1);
printstr(tcp, tcp->u_arg[2]);
/* keyring serial number */
tprints(", ");
print_keyring_serial_number(tcp->u_arg[3]);
@ -97,7 +96,7 @@ keyctl_update_key(struct tcb *tcp, key_serial_t id, kernel_ulong_t addr,
{
print_keyring_serial_number(id);
tprints(", ");
printstr(tcp, addr, len);
printstrn(tcp, addr, len);
tprintf(", %llu", zero_extend_signed_to_ull(len));
}
@ -136,9 +135,9 @@ keyctl_keyring_search(struct tcb *tcp, key_serial_t id1, kernel_ulong_t addr1,
{
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr1, -1);
printstr(tcp, addr1);
tprints(", ");
printstr(tcp, addr2, -1);
printstr(tcp, addr2);
tprints(", ");
print_keyring_serial_number(id2);
}
@ -158,7 +157,7 @@ keyctl_instantiate_key(struct tcb *tcp, key_serial_t id1, kernel_ulong_t addr,
{
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr, len);
printstrn(tcp, addr, len);
tprintf(", %llu, ", zero_extend_signed_to_ull(len));
print_keyring_serial_number(id2);
}
@ -257,7 +256,7 @@ keyctl_dh_compute(struct tcb *tcp, kernel_ulong_t params, kernel_ulong_t buf,
kernel_ulong_t rval = (tcp->u_rval >= 0) &&
((kernel_ulong_t) tcp->u_rval > len) ? len :
(kernel_ulong_t) tcp->u_rval;
printstr(tcp, buf, rval);
printstrn(tcp, buf, rval);
}
tprintf(", %llu", zero_extend_signed_to_ull(len));
}
@ -269,10 +268,10 @@ keyctl_dh_compute(struct tcb *tcp, kernel_ulong_t params, kernel_ulong_t buf,
SYS_FUNC(keyctl)
{
int cmd = tcp->u_arg[0];
unsigned long long arg2 = getarg_ull(tcp, 1);
unsigned long long arg3 = getarg_ull(tcp, 2);
unsigned long long arg4 = getarg_ull(tcp, 3);
unsigned long long arg5 = getarg_ull(tcp, 4);
kernel_ulong_t arg2 = tcp->u_arg[1];
kernel_ulong_t arg3 = tcp->u_arg[2];
kernel_ulong_t arg4 = tcp->u_arg[3];
kernel_ulong_t arg5 = tcp->u_arg[4];
if (entering(tcp)) {
printxval(keyctl_commands, cmd, "KEYCTL_???");
@ -291,7 +290,7 @@ SYS_FUNC(keyctl)
break;
case KEYCTL_JOIN_SESSION_KEYRING:
printstr(tcp, arg2, -1);
printstr(tcp, arg2);
break;
case KEYCTL_UPDATE:
@ -364,7 +363,9 @@ SYS_FUNC(keyctl)
return 0;
default:
tprintf("%#llx, %#llx, %#llx, %#llx", arg2, arg3, arg4, arg5);
tprintf("%#" PRI_klx ", %#" PRI_klx
", %#" PRI_klx ", %#" PRI_klx,
arg2, arg3, arg4, arg5);
break;
}

10
ldt.c
View File

@ -33,12 +33,12 @@
#include "defs.h"
#if defined I386 || defined X86_64 || defined X32
#ifdef HAVE_STRUCT_USER_DESC
# include <asm/ldt.h>
void
print_user_desc(struct tcb *tcp, const long addr)
print_user_desc(struct tcb *const tcp, const kernel_ulong_t addr)
{
struct user_desc desc;
@ -67,12 +67,12 @@ print_user_desc(struct tcb *tcp, const long addr)
SYS_FUNC(modify_ldt)
{
tprintf("%ld, ", tcp->u_arg[0]);
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(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
}
@ -105,7 +105,7 @@ SYS_FUNC(get_thread_area)
return 0;
}
#endif /* I386 || X86_64 || X32 */
#endif /* HAVE_STRUCT_USER_DESC */
#if defined(M68K) || defined(MIPS)
SYS_FUNC(set_thread_area)

View File

@ -1,4 +1,6 @@
#if defined X86_64 || defined X32 \
#if defined M68K
# include "32/ioctls_inc_align16.h"
#elif defined X86_64 || defined X32 \
|| SIZEOF_STRUCT_I64_I32 < SIZEOF_LONG_LONG * 2
# include "32/ioctls_inc_align32.h"
#else

File diff suppressed because it is too large Load Diff

View File

@ -93,6 +93,7 @@
{ "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_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@ -263,11 +264,14 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_IRQ_WAIT", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_ATTRS", _IOC_READ|_IOC_WRITE, 0x6468, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_PUT_IMAGE", _IOC_WRITE, 0x6467, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_VBLANK_PIPE", _IOC_WRITE, 0x644d, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_VBLANK_SWAP", _IOC_READ|_IOC_WRITE, 0x644f, 0x0c },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_DISABLE", _IOC_NONE, 0x6901, 0x00 },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_ENABLE", _IOC_NONE, 0x6900, 0x00 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_BLIT", _IOC_WRITE, 0x6448, 0x34 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_CLEAR", _IOC_WRITE, 0x6444, 0x14 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_DMA_BOOTSTRAP", _IOC_READ|_IOC_WRITE, 0x644c, 0x1c },
@ -286,7 +290,7 @@
{ "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, 0x20 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 },
{ "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/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
@ -450,8 +454,10 @@
{ "linux/android/binder.h", "BC_REGISTER_LOOPER", _IOC_NONE, 0x630b, 0x00 },
{ "linux/android/binder.h", "BC_RELEASE", _IOC_WRITE, 0x6306, 0x04 },
{ "linux/android/binder.h", "BC_REPLY", _IOC_WRITE, 0x6301, 0x40 },
{ "linux/android/binder.h", "BC_REPLY_SG", _IOC_WRITE, 0x6312, 0x48 },
{ "linux/android/binder.h", "BC_REQUEST_DEATH_NOTIFICATION", _IOC_WRITE, 0x630e, 0x0c },
{ "linux/android/binder.h", "BC_TRANSACTION", _IOC_WRITE, 0x6300, 0x40 },
{ "linux/android/binder.h", "BC_TRANSACTION_SG", _IOC_WRITE, 0x6311, 0x48 },
{ "linux/android/binder.h", "BINDER_SET_CONTEXT_MGR", _IOC_WRITE, 0x6207, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_PRIORITY", _IOC_WRITE, 0x6206, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_TIMEOUT", _IOC_WRITE, 0x6203, 0x08 },
@ -557,6 +563,9 @@
{ "linux/auto_fs4.h", "AUTOFS_IOC_EXPIRE_MULTI", _IOC_WRITE, 0x9366, 0x04 },
{ "linux/auto_fs4.h", "AUTOFS_IOC_PROTOSUBVER", _IOC_READ, 0x9367, 0x04 },
{ "linux/blkpg.h", "BLKPG", _IOC_NONE, 0x1269, 0x00 },
{ "linux/blkzoned.h", "BLKREPORTZONE", _IOC_READ|_IOC_WRITE, 0x1282, 0x10 },
{ "linux/blkzoned.h", "BLKRESETZONE", _IOC_WRITE, 0x1283, 0x10 },
{ "linux/bt-bmc.h", "BT_BMC_IOCTL_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/btrfs.h", "BTRFS_IOC_ADD_DEV", _IOC_WRITE, 0x940a, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE", _IOC_WRITE, 0x940c, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE_CTL", _IOC_WRITE, 0x9421, 0x04 },
@ -1311,123 +1320,9 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ARM_VCPU_INIT", _IOC_WRITE, 0xaeae, 0x20 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_PCI_DEVICE", _IOC_READ, 0xae69, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_INTX_MASK", _IOC_WRITE, 0xaea4, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_ENTRY", _IOC_WRITE, 0xae74, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_NR", _IOC_WRITE, 0xae73, 0x08 },
{ "linux/kvm.h", "KVM_CHECK_EXTENSION", _IOC_NONE, 0xae03, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_DEVICE", _IOC_READ|_IOC_WRITE, 0xaee0, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_IRQCHIP", _IOC_NONE, 0xae60, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
{ "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
{ "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
{ "linux/kvm.h", "KVM_DEASSIGN_PCI_DEVICE", _IOC_WRITE, 0xae72, 0x40 },
{ "linux/kvm.h", "KVM_DIRTY_TLB", _IOC_WRITE, 0xaeaa, 0x0c },
{ "linux/kvm.h", "KVM_ENABLE_CAP", _IOC_WRITE, 0xaea3, 0x68 },
{ "linux/kvm.h", "KVM_GET_API_VERSION", _IOC_NONE, 0xae00, 0x00 },
{ "linux/kvm.h", "KVM_GET_CLOCK", _IOC_READ, 0xae7c, 0x30 },
{ "linux/kvm.h", "KVM_GET_CPUID2", _IOC_READ|_IOC_WRITE, 0xae91, 0x08 },
{ "linux/kvm.h", "KVM_GET_DEBUGREGS", _IOC_READ, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_GET_DEVICE_ATTR", _IOC_WRITE, 0xaee2, 0x18 },
{ "linux/kvm.h", "KVM_GET_DIRTY_LOG", _IOC_WRITE, 0xae42, 0x10 },
{ "linux/kvm.h", "KVM_GET_EMULATED_CPUID", _IOC_READ|_IOC_WRITE, 0xae09, 0x08 },
{ "linux/kvm.h", "KVM_GET_FPU", _IOC_READ, 0xae8c, 0x1a0 },
{ "linux/kvm.h", "KVM_GET_IRQCHIP", _IOC_READ|_IOC_WRITE, 0xae62, 0x208 },
{ "linux/kvm.h", "KVM_GET_LAPIC", _IOC_READ, 0xae8e, 0x400 },
{ "linux/kvm.h", "KVM_GET_MP_STATE", _IOC_READ, 0xae98, 0x04 },
{ "linux/kvm.h", "KVM_GET_MSRS", _IOC_READ|_IOC_WRITE, 0xae88, 0x08 },
{ "linux/kvm.h", "KVM_GET_MSR_INDEX_LIST", _IOC_READ|_IOC_WRITE, 0xae02, 0x04 },
{ "linux/kvm.h", "KVM_GET_NR_MMU_PAGES", _IOC_NONE, 0xae45, 0x00 },
{ "linux/kvm.h", "KVM_GET_ONE_REG", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_GET_PIT", _IOC_READ|_IOC_WRITE, 0xae65, 0x48 },
{ "linux/kvm.h", "KVM_GET_PIT2", _IOC_READ, 0xae9f, 0x70 },
{ "linux/kvm.h", "KVM_GET_REGS", _IOC_READ, 0xae81, 0x90 },
{ "linux/kvm.h", "KVM_GET_REG_LIST", _IOC_READ|_IOC_WRITE, 0xaeb0, 0x08 },
{ "linux/kvm.h", "KVM_GET_SREGS", _IOC_READ, 0xae83, 0x138 },
{ "linux/kvm.h", "KVM_GET_SUPPORTED_CPUID", _IOC_READ|_IOC_WRITE, 0xae05, 0x08 },
{ "linux/kvm.h", "KVM_GET_TSC_KHZ", _IOC_NONE, 0xaea3, 0x00 },
{ "linux/kvm.h", "KVM_GET_VCPU_EVENTS", _IOC_READ, 0xae9f, 0x40 },
{ "linux/kvm.h", "KVM_GET_VCPU_MMAP_SIZE", _IOC_NONE, 0xae04, 0x00 },
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },
{ "linux/kvm.h", "KVM_IRQ_LINE", _IOC_WRITE, 0xae61, 0x08 },
{ "linux/kvm.h", "KVM_IRQ_LINE_STATUS", _IOC_READ|_IOC_WRITE, 0xae67, 0x08 },
{ "linux/kvm.h", "KVM_KVMCLOCK_CTRL", _IOC_NONE, 0xaead, 0x00 },
{ "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 },
{ "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 },
{ "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
{ "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
{ "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
{ "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x04 },
{ "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
{ "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
{ "linux/kvm.h", "KVM_S390_VCPU_FAULT", _IOC_WRITE, 0xae52, 0x04 },
{ "linux/kvm.h", "KVM_SET_BOOT_CPU_ID", _IOC_NONE, 0xae78, 0x00 },
{ "linux/kvm.h", "KVM_SET_CLOCK", _IOC_WRITE, 0xae7b, 0x30 },
{ "linux/kvm.h", "KVM_SET_CPUID", _IOC_WRITE, 0xae8a, 0x08 },
{ "linux/kvm.h", "KVM_SET_CPUID2", _IOC_WRITE, 0xae90, 0x08 },
{ "linux/kvm.h", "KVM_SET_DEBUGREGS", _IOC_WRITE, 0xaea2, 0x80 },
{ "linux/kvm.h", "KVM_SET_DEVICE_ATTR", _IOC_WRITE, 0xaee1, 0x18 },
{ "linux/kvm.h", "KVM_SET_FPU", _IOC_WRITE, 0xae8d, 0x1a0 },
{ "linux/kvm.h", "KVM_SET_GSI_ROUTING", _IOC_WRITE, 0xae6a, 0x08 },
{ "linux/kvm.h", "KVM_SET_GUEST_DEBUG", _IOC_WRITE, 0xae9b, 0x48 },
{ "linux/kvm.h", "KVM_SET_IDENTITY_MAP_ADDR", _IOC_WRITE, 0xae48, 0x08 },
{ "linux/kvm.h", "KVM_SET_IRQCHIP", _IOC_READ, 0xae63, 0x208 },
{ "linux/kvm.h", "KVM_SET_LAPIC", _IOC_WRITE, 0xae8f, 0x400 },
{ "linux/kvm.h", "KVM_SET_MEMORY_ALIAS", _IOC_WRITE, 0xae43, 0x20 },
{ "linux/kvm.h", "KVM_SET_MEMORY_REGION", _IOC_WRITE, 0xae40, 0x18 },
{ "linux/kvm.h", "KVM_SET_MP_STATE", _IOC_WRITE, 0xae99, 0x04 },
{ "linux/kvm.h", "KVM_SET_MSRS", _IOC_WRITE, 0xae89, 0x08 },
{ "linux/kvm.h", "KVM_SET_NR_MMU_PAGES", _IOC_NONE, 0xae44, 0x00 },
{ "linux/kvm.h", "KVM_SET_ONE_REG", _IOC_WRITE, 0xaeac, 0x10 },
{ "linux/kvm.h", "KVM_SET_PIT", _IOC_READ, 0xae66, 0x48 },
{ "linux/kvm.h", "KVM_SET_PIT2", _IOC_WRITE, 0xaea0, 0x70 },
{ "linux/kvm.h", "KVM_SET_REGS", _IOC_WRITE, 0xae82, 0x90 },
{ "linux/kvm.h", "KVM_SET_SIGNAL_MASK", _IOC_WRITE, 0xae8b, 0x04 },
{ "linux/kvm.h", "KVM_SET_SREGS", _IOC_WRITE, 0xae84, 0x138 },
{ "linux/kvm.h", "KVM_SET_TSC_KHZ", _IOC_NONE, 0xaea2, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSS_ADDR", _IOC_NONE, 0xae47, 0x00 },
{ "linux/kvm.h", "KVM_SET_USER_MEMORY_REGION", _IOC_WRITE, 0xae46, 0x20 },
{ "linux/kvm.h", "KVM_SET_VAPIC_ADDR", _IOC_WRITE, 0xae93, 0x08 },
{ "linux/kvm.h", "KVM_SET_VCPU_EVENTS", _IOC_WRITE, 0xaea0, 0x40 },
{ "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
{ "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
{ "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
{ "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
{ "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
{ "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
{ "linux/kvm.h", "KVM_X86_GET_MCE_CAP_SUPPORTED", _IOC_READ, 0xae9d, 0x08 },
{ "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
{ "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
{ "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_IO_VIO", _IOC_READ|_IOC_WRITE, 0x4c43, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_SUBMIT_VIO", _IOC_READ|_IOC_WRITE, 0x4c42, 0x40 },
{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
@ -1568,6 +1463,10 @@
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nsfs.h", "NS_GET_NSTYPE", _IOC_NONE, 0xb703, 0x00 },
{ "linux/nsfs.h", "NS_GET_OWNER_UID", _IOC_NONE, 0xb704, 0x00 },
{ "linux/nsfs.h", "NS_GET_PARENT", _IOC_NONE, 0xb702, 0x00 },
{ "linux/nsfs.h", "NS_GET_USERNS", _IOC_NONE, 0xb701, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
@ -1776,6 +1675,8 @@
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
{ "linux/rpmsg.h", "RPMSG_CREATE_EPT_IOCTL", _IOC_WRITE, 0xb501, 0x28 },
{ "linux/rpmsg.h", "RPMSG_DESTROY_EPT_IOCTL", _IOC_NONE, 0xb502, 0x00 },
{ "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
{ "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
{ "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@ -1815,6 +1716,18 @@
{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x24 },
{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x24 },
{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x24 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_LSP", _IOC_WRITE, 0x70df, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_USR", _IOC_WRITE, 0x70e1, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ADD_USR_TO_LR", _IOC_WRITE, 0x70e4, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ENABLE_DISABLE_MBR", _IOC_WRITE, 0x70e5, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ERASE_LR", _IOC_WRITE, 0x70e6, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_LOCK_UNLOCK", _IOC_WRITE, 0x70dd, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_LR_SETUP", _IOC_WRITE, 0x70e3, 0x128 },
{ "linux/sed-opal.h", "IOC_OPAL_REVERT_TPR", _IOC_WRITE, 0x70e2, 0x108 },
{ "linux/sed-opal.h", "IOC_OPAL_SAVE", _IOC_WRITE, 0x70dc, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_SECURE_ERASE_LR", _IOC_WRITE, 0x70e7, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_SET_PW", _IOC_WRITE, 0x70e0, 0x220 },
{ "linux/sed-opal.h", "IOC_OPAL_TAKE_OWNERSHIP", _IOC_WRITE, 0x70de, 0x108 },
{ "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x04 },
{ "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
{ "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@ -1862,6 +1775,7 @@
{ "linux/sockios.h", "SIOCGMIIPHY", 0, 0x8947, 0 },
{ "linux/sockios.h", "SIOCGMIIREG", 0, 0x8948, 0 },
{ "linux/sockios.h", "SIOCGRARP", 0, 0x8961, 0 },
{ "linux/sockios.h", "SIOCGSKNS", 0, 0x894C, 0 },
{ "linux/sockios.h", "SIOCOUTQNSD", 0, 0x894B, 0 },
{ "linux/sockios.h", "SIOCPROTOPRIVATE", 0, 0x89E0, 0 },
{ "linux/sockios.h", "SIOCRTMSG", 0, 0x890D, 0 },
@ -2528,23 +2442,23 @@
{ "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
{ "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
@ -2779,6 +2693,7 @@
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x14 },
{ "staging/android/ion.h", "ION_IOC_CUSTOM", _IOC_READ|_IOC_WRITE, 0x4906, 0x08 },
{ "staging/android/ion.h", "ION_IOC_FREE", _IOC_READ|_IOC_WRITE, 0x4901, 0x04 },
{ "staging/android/ion.h", "ION_IOC_HEAP_QUERY", _IOC_READ|_IOC_WRITE, 0x4908, 0x18 },
{ "staging/android/ion.h", "ION_IOC_IMPORT", _IOC_READ|_IOC_WRITE, 0x4905, 0x08 },
{ "staging/android/ion.h", "ION_IOC_MAP", _IOC_READ|_IOC_WRITE, 0x4902, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SHARE", _IOC_READ|_IOC_WRITE, 0x4904, 0x08 },

View File

@ -93,6 +93,7 @@
{ "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_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@ -263,11 +264,14 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_IRQ_WAIT", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_ATTRS", _IOC_READ|_IOC_WRITE, 0x6468, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_PUT_IMAGE", _IOC_WRITE, 0x6467, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_VBLANK_PIPE", _IOC_WRITE, 0x644d, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_VBLANK_SWAP", _IOC_READ|_IOC_WRITE, 0x644f, 0x0c },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_DISABLE", _IOC_NONE, 0x6901, 0x00 },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_ENABLE", _IOC_NONE, 0x6900, 0x00 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_BLIT", _IOC_WRITE, 0x6448, 0x34 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_CLEAR", _IOC_WRITE, 0x6444, 0x14 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_DMA_BOOTSTRAP", _IOC_READ|_IOC_WRITE, 0x644c, 0x1c },
@ -286,7 +290,7 @@
{ "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, 0x20 },
{ "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/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
@ -450,8 +454,10 @@
{ "linux/android/binder.h", "BC_REGISTER_LOOPER", _IOC_NONE, 0x630b, 0x00 },
{ "linux/android/binder.h", "BC_RELEASE", _IOC_WRITE, 0x6306, 0x04 },
{ "linux/android/binder.h", "BC_REPLY", _IOC_WRITE, 0x6301, 0x40 },
{ "linux/android/binder.h", "BC_REPLY_SG", _IOC_WRITE, 0x6312, 0x48 },
{ "linux/android/binder.h", "BC_REQUEST_DEATH_NOTIFICATION", _IOC_WRITE, 0x630e, 0x0c },
{ "linux/android/binder.h", "BC_TRANSACTION", _IOC_WRITE, 0x6300, 0x40 },
{ "linux/android/binder.h", "BC_TRANSACTION_SG", _IOC_WRITE, 0x6311, 0x48 },
{ "linux/android/binder.h", "BINDER_SET_CONTEXT_MGR", _IOC_WRITE, 0x6207, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_PRIORITY", _IOC_WRITE, 0x6206, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_TIMEOUT", _IOC_WRITE, 0x6203, 0x08 },
@ -557,6 +563,9 @@
{ "linux/auto_fs4.h", "AUTOFS_IOC_EXPIRE_MULTI", _IOC_WRITE, 0x9366, 0x04 },
{ "linux/auto_fs4.h", "AUTOFS_IOC_PROTOSUBVER", _IOC_READ, 0x9367, 0x04 },
{ "linux/blkpg.h", "BLKPG", _IOC_NONE, 0x1269, 0x00 },
{ "linux/blkzoned.h", "BLKREPORTZONE", _IOC_READ|_IOC_WRITE, 0x1282, 0x10 },
{ "linux/blkzoned.h", "BLKRESETZONE", _IOC_WRITE, 0x1283, 0x10 },
{ "linux/bt-bmc.h", "BT_BMC_IOCTL_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/btrfs.h", "BTRFS_IOC_ADD_DEV", _IOC_WRITE, 0x940a, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE", _IOC_WRITE, 0x940c, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE_CTL", _IOC_WRITE, 0x9421, 0x04 },
@ -1311,123 +1320,9 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ARM_VCPU_INIT", _IOC_WRITE, 0xaeae, 0x20 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_PCI_DEVICE", _IOC_READ, 0xae69, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_INTX_MASK", _IOC_WRITE, 0xaea4, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_ENTRY", _IOC_WRITE, 0xae74, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_NR", _IOC_WRITE, 0xae73, 0x08 },
{ "linux/kvm.h", "KVM_CHECK_EXTENSION", _IOC_NONE, 0xae03, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_DEVICE", _IOC_READ|_IOC_WRITE, 0xaee0, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_IRQCHIP", _IOC_NONE, 0xae60, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
{ "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
{ "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
{ "linux/kvm.h", "KVM_DEASSIGN_PCI_DEVICE", _IOC_WRITE, 0xae72, 0x40 },
{ "linux/kvm.h", "KVM_DIRTY_TLB", _IOC_WRITE, 0xaeaa, 0x10 },
{ "linux/kvm.h", "KVM_ENABLE_CAP", _IOC_WRITE, 0xaea3, 0x68 },
{ "linux/kvm.h", "KVM_GET_API_VERSION", _IOC_NONE, 0xae00, 0x00 },
{ "linux/kvm.h", "KVM_GET_CLOCK", _IOC_READ, 0xae7c, 0x30 },
{ "linux/kvm.h", "KVM_GET_CPUID2", _IOC_READ|_IOC_WRITE, 0xae91, 0x08 },
{ "linux/kvm.h", "KVM_GET_DEBUGREGS", _IOC_READ, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_GET_DEVICE_ATTR", _IOC_WRITE, 0xaee2, 0x18 },
{ "linux/kvm.h", "KVM_GET_DIRTY_LOG", _IOC_WRITE, 0xae42, 0x10 },
{ "linux/kvm.h", "KVM_GET_EMULATED_CPUID", _IOC_READ|_IOC_WRITE, 0xae09, 0x08 },
{ "linux/kvm.h", "KVM_GET_FPU", _IOC_READ, 0xae8c, 0x00 },
{ "linux/kvm.h", "KVM_GET_IRQCHIP", _IOC_READ|_IOC_WRITE, 0xae62, 0x208 },
{ "linux/kvm.h", "KVM_GET_LAPIC", _IOC_READ, 0xae8e, 0x400 },
{ "linux/kvm.h", "KVM_GET_MP_STATE", _IOC_READ, 0xae98, 0x04 },
{ "linux/kvm.h", "KVM_GET_MSRS", _IOC_READ|_IOC_WRITE, 0xae88, 0x08 },
{ "linux/kvm.h", "KVM_GET_MSR_INDEX_LIST", _IOC_READ|_IOC_WRITE, 0xae02, 0x04 },
{ "linux/kvm.h", "KVM_GET_NR_MMU_PAGES", _IOC_NONE, 0xae45, 0x00 },
{ "linux/kvm.h", "KVM_GET_ONE_REG", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_GET_PIT", _IOC_READ|_IOC_WRITE, 0xae65, 0x48 },
{ "linux/kvm.h", "KVM_GET_PIT2", _IOC_READ, 0xae9f, 0x70 },
{ "linux/kvm.h", "KVM_GET_REGS", _IOC_READ, 0xae81, 0x98 },
{ "linux/kvm.h", "KVM_GET_REG_LIST", _IOC_READ|_IOC_WRITE, 0xaeb0, 0x08 },
{ "linux/kvm.h", "KVM_GET_SREGS", _IOC_READ, 0xae83, 0x00 },
{ "linux/kvm.h", "KVM_GET_SUPPORTED_CPUID", _IOC_READ|_IOC_WRITE, 0xae05, 0x08 },
{ "linux/kvm.h", "KVM_GET_TSC_KHZ", _IOC_NONE, 0xaea3, 0x00 },
{ "linux/kvm.h", "KVM_GET_VCPU_EVENTS", _IOC_READ, 0xae9f, 0x40 },
{ "linux/kvm.h", "KVM_GET_VCPU_MMAP_SIZE", _IOC_NONE, 0xae04, 0x00 },
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },
{ "linux/kvm.h", "KVM_IRQ_LINE", _IOC_WRITE, 0xae61, 0x08 },
{ "linux/kvm.h", "KVM_IRQ_LINE_STATUS", _IOC_READ|_IOC_WRITE, 0xae67, 0x08 },
{ "linux/kvm.h", "KVM_KVMCLOCK_CTRL", _IOC_NONE, 0xaead, 0x00 },
{ "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 },
{ "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 },
{ "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
{ "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
{ "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
{ "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x04 },
{ "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
{ "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
{ "linux/kvm.h", "KVM_S390_VCPU_FAULT", _IOC_WRITE, 0xae52, 0x04 },
{ "linux/kvm.h", "KVM_SET_BOOT_CPU_ID", _IOC_NONE, 0xae78, 0x00 },
{ "linux/kvm.h", "KVM_SET_CLOCK", _IOC_WRITE, 0xae7b, 0x30 },
{ "linux/kvm.h", "KVM_SET_CPUID", _IOC_WRITE, 0xae8a, 0x08 },
{ "linux/kvm.h", "KVM_SET_CPUID2", _IOC_WRITE, 0xae90, 0x08 },
{ "linux/kvm.h", "KVM_SET_DEBUGREGS", _IOC_WRITE, 0xaea2, 0x80 },
{ "linux/kvm.h", "KVM_SET_DEVICE_ATTR", _IOC_WRITE, 0xaee1, 0x18 },
{ "linux/kvm.h", "KVM_SET_FPU", _IOC_WRITE, 0xae8d, 0x00 },
{ "linux/kvm.h", "KVM_SET_GSI_ROUTING", _IOC_WRITE, 0xae6a, 0x08 },
{ "linux/kvm.h", "KVM_SET_GUEST_DEBUG", _IOC_WRITE, 0xae9b, 0x08 },
{ "linux/kvm.h", "KVM_SET_IDENTITY_MAP_ADDR", _IOC_WRITE, 0xae48, 0x08 },
{ "linux/kvm.h", "KVM_SET_IRQCHIP", _IOC_READ, 0xae63, 0x208 },
{ "linux/kvm.h", "KVM_SET_LAPIC", _IOC_WRITE, 0xae8f, 0x400 },
{ "linux/kvm.h", "KVM_SET_MEMORY_ALIAS", _IOC_WRITE, 0xae43, 0x20 },
{ "linux/kvm.h", "KVM_SET_MEMORY_REGION", _IOC_WRITE, 0xae40, 0x18 },
{ "linux/kvm.h", "KVM_SET_MP_STATE", _IOC_WRITE, 0xae99, 0x04 },
{ "linux/kvm.h", "KVM_SET_MSRS", _IOC_WRITE, 0xae89, 0x08 },
{ "linux/kvm.h", "KVM_SET_NR_MMU_PAGES", _IOC_NONE, 0xae44, 0x00 },
{ "linux/kvm.h", "KVM_SET_ONE_REG", _IOC_WRITE, 0xaeac, 0x10 },
{ "linux/kvm.h", "KVM_SET_PIT", _IOC_READ, 0xae66, 0x48 },
{ "linux/kvm.h", "KVM_SET_PIT2", _IOC_WRITE, 0xaea0, 0x70 },
{ "linux/kvm.h", "KVM_SET_REGS", _IOC_WRITE, 0xae82, 0x98 },
{ "linux/kvm.h", "KVM_SET_SIGNAL_MASK", _IOC_WRITE, 0xae8b, 0x04 },
{ "linux/kvm.h", "KVM_SET_SREGS", _IOC_WRITE, 0xae84, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSC_KHZ", _IOC_NONE, 0xaea2, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSS_ADDR", _IOC_NONE, 0xae47, 0x00 },
{ "linux/kvm.h", "KVM_SET_USER_MEMORY_REGION", _IOC_WRITE, 0xae46, 0x20 },
{ "linux/kvm.h", "KVM_SET_VAPIC_ADDR", _IOC_WRITE, 0xae93, 0x08 },
{ "linux/kvm.h", "KVM_SET_VCPU_EVENTS", _IOC_WRITE, 0xaea0, 0x40 },
{ "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
{ "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
{ "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
{ "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
{ "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
{ "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
{ "linux/kvm.h", "KVM_X86_GET_MCE_CAP_SUPPORTED", _IOC_READ, 0xae9d, 0x08 },
{ "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
{ "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
{ "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_IO_VIO", _IOC_READ|_IOC_WRITE, 0x4c43, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_SUBMIT_VIO", _IOC_READ|_IOC_WRITE, 0x4c42, 0x40 },
{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
@ -1568,6 +1463,10 @@
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nsfs.h", "NS_GET_NSTYPE", _IOC_NONE, 0xb703, 0x00 },
{ "linux/nsfs.h", "NS_GET_OWNER_UID", _IOC_NONE, 0xb704, 0x00 },
{ "linux/nsfs.h", "NS_GET_PARENT", _IOC_NONE, 0xb702, 0x00 },
{ "linux/nsfs.h", "NS_GET_USERNS", _IOC_NONE, 0xb701, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
@ -1776,6 +1675,8 @@
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
{ "linux/rpmsg.h", "RPMSG_CREATE_EPT_IOCTL", _IOC_WRITE, 0xb501, 0x28 },
{ "linux/rpmsg.h", "RPMSG_DESTROY_EPT_IOCTL", _IOC_NONE, 0xb502, 0x00 },
{ "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
{ "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
{ "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@ -1815,6 +1716,18 @@
{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x28 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_LSP", _IOC_WRITE, 0x70df, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_USR", _IOC_WRITE, 0x70e1, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ADD_USR_TO_LR", _IOC_WRITE, 0x70e4, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ENABLE_DISABLE_MBR", _IOC_WRITE, 0x70e5, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ERASE_LR", _IOC_WRITE, 0x70e6, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_LOCK_UNLOCK", _IOC_WRITE, 0x70dd, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_LR_SETUP", _IOC_WRITE, 0x70e3, 0x128 },
{ "linux/sed-opal.h", "IOC_OPAL_REVERT_TPR", _IOC_WRITE, 0x70e2, 0x108 },
{ "linux/sed-opal.h", "IOC_OPAL_SAVE", _IOC_WRITE, 0x70dc, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_SECURE_ERASE_LR", _IOC_WRITE, 0x70e7, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_SET_PW", _IOC_WRITE, 0x70e0, 0x220 },
{ "linux/sed-opal.h", "IOC_OPAL_TAKE_OWNERSHIP", _IOC_WRITE, 0x70de, 0x108 },
{ "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x04 },
{ "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
{ "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@ -1862,6 +1775,7 @@
{ "linux/sockios.h", "SIOCGMIIPHY", 0, 0x8947, 0 },
{ "linux/sockios.h", "SIOCGMIIREG", 0, 0x8948, 0 },
{ "linux/sockios.h", "SIOCGRARP", 0, 0x8961, 0 },
{ "linux/sockios.h", "SIOCGSKNS", 0, 0x894C, 0 },
{ "linux/sockios.h", "SIOCOUTQNSD", 0, 0x894B, 0 },
{ "linux/sockios.h", "SIOCPROTOPRIVATE", 0, 0x89E0, 0 },
{ "linux/sockios.h", "SIOCRTMSG", 0, 0x890D, 0 },
@ -2528,23 +2442,23 @@
{ "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
{ "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
@ -2779,6 +2693,7 @@
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x14 },
{ "staging/android/ion.h", "ION_IOC_CUSTOM", _IOC_READ|_IOC_WRITE, 0x4906, 0x08 },
{ "staging/android/ion.h", "ION_IOC_FREE", _IOC_READ|_IOC_WRITE, 0x4901, 0x04 },
{ "staging/android/ion.h", "ION_IOC_HEAP_QUERY", _IOC_READ|_IOC_WRITE, 0x4908, 0x18 },
{ "staging/android/ion.h", "ION_IOC_IMPORT", _IOC_READ|_IOC_WRITE, 0x4905, 0x08 },
{ "staging/android/ion.h", "ION_IOC_MAP", _IOC_READ|_IOC_WRITE, 0x4902, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SHARE", _IOC_READ|_IOC_WRITE, 0x4904, 0x08 },

View File

@ -123,16 +123,16 @@
[115] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" },
[116] = { 3, 0, SEN(syslog), "syslog" },
[117] = { 4, 0, SEN(ptrace), "ptrace" },
[118] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
[119] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" },
[120] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" },
[121] = { 2, 0, SEN(sched_getparam), "sched_getparam" },
[122] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[123] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[124] = { 0, 0, SEN(sched_yield), "sched_yield" },
[125] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"},
[126] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"},
[127] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[118] = { 2, TSC, SEN(sched_setparam), "sched_setparam" },
[119] = { 3, TSC, SEN(sched_setscheduler), "sched_setscheduler" },
[120] = { 1, TSC, SEN(sched_getscheduler), "sched_getscheduler" },
[121] = { 2, TSC, SEN(sched_getparam), "sched_getparam" },
[122] = { 3, TSC, SEN(sched_setaffinity), "sched_setaffinity" },
[123] = { 3, TSC, SEN(sched_getaffinity), "sched_getaffinity" },
[124] = { 0, TSC, SEN(sched_yield), "sched_yield" },
[125] = { 1, TSC, SEN(sched_get_priority_max), "sched_get_priority_max"},
[126] = { 1, TSC, SEN(sched_get_priority_min), "sched_get_priority_min"},
[127] = { 2, TSC, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[128] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[129] = { 2, TS, SEN(kill), "kill" },
[130] = { 2, TS, SEN(kill), "tkill" },
@ -264,20 +264,23 @@
[271] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" },
[272] = { 5, 0, SEN(kcmp), "kcmp" },
[273] = { 3, TD, SEN(finit_module), "finit_module" },
[274] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[275] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[274] = { 3, TSC, SEN(sched_setattr), "sched_setattr" },
[275] = { 4, TSC, SEN(sched_getattr), "sched_getattr" },
[276] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[277] = { 3, 0, SEN(seccomp), "seccomp", },
[278] = { 3, 0, SEN(getrandom), "getrandom", },
[279] = { 2, TD, SEN(memfd_create), "memfd_create", },
[280] = { 3, TD, SEN(bpf), "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
[283] = { 2, 0, SEN(membarrier), "membarrier", },
[277] = { 3, 0, SEN(seccomp), "seccomp" },
[278] = { 3, 0, SEN(getrandom), "getrandom" },
[279] = { 2, TD, SEN(memfd_create), "memfd_create" },
[280] = { 3, TD, SEN(bpf), "bpf" },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[283] = { 2, 0, SEN(membarrier), "membarrier" },
[284] = { 3, TM, SEN(mlock2), "mlock2" },
[285] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[286] = { 6, TD, SEN(preadv2), "preadv2" },
[287] = { 6, TD, SEN(pwritev2), "pwritev2" },
[288] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[289] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[290] = { 1, 0, SEN(pkey_free), "pkey_free" },
#undef sys_ARCH_mmap
#undef ARCH_WANT_SYNC_FILE_RANGE2

View File

@ -93,6 +93,7 @@
{ "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_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@ -263,11 +264,14 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_IRQ_WAIT", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_ATTRS", _IOC_READ|_IOC_WRITE, 0x6468, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_PUT_IMAGE", _IOC_WRITE, 0x6467, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_VBLANK_PIPE", _IOC_WRITE, 0x644d, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_VBLANK_SWAP", _IOC_READ|_IOC_WRITE, 0x644f, 0x0c },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_DISABLE", _IOC_NONE, 0x6901, 0x00 },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_ENABLE", _IOC_NONE, 0x6900, 0x00 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_BLIT", _IOC_WRITE, 0x6448, 0x34 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_CLEAR", _IOC_WRITE, 0x6444, 0x14 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_DMA_BOOTSTRAP", _IOC_READ|_IOC_WRITE, 0x644c, 0x20 },
@ -286,7 +290,7 @@
{ "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, 0x20 },
{ "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/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
@ -450,8 +454,10 @@
{ "linux/android/binder.h", "BC_REGISTER_LOOPER", _IOC_NONE, 0x630b, 0x00 },
{ "linux/android/binder.h", "BC_RELEASE", _IOC_WRITE, 0x6306, 0x04 },
{ "linux/android/binder.h", "BC_REPLY", _IOC_WRITE, 0x6301, 0x40 },
{ "linux/android/binder.h", "BC_REPLY_SG", _IOC_WRITE, 0x6312, 0x48 },
{ "linux/android/binder.h", "BC_REQUEST_DEATH_NOTIFICATION", _IOC_WRITE, 0x630e, 0x0c },
{ "linux/android/binder.h", "BC_TRANSACTION", _IOC_WRITE, 0x6300, 0x40 },
{ "linux/android/binder.h", "BC_TRANSACTION_SG", _IOC_WRITE, 0x6311, 0x48 },
{ "linux/android/binder.h", "BINDER_SET_CONTEXT_MGR", _IOC_WRITE, 0x6207, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_PRIORITY", _IOC_WRITE, 0x6206, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_TIMEOUT", _IOC_WRITE, 0x6203, 0x08 },
@ -557,6 +563,9 @@
{ "linux/auto_fs4.h", "AUTOFS_IOC_EXPIRE_MULTI", _IOC_WRITE, 0x9366, 0x04 },
{ "linux/auto_fs4.h", "AUTOFS_IOC_PROTOSUBVER", _IOC_READ, 0x9367, 0x04 },
{ "linux/blkpg.h", "BLKPG", _IOC_NONE, 0x1269, 0x00 },
{ "linux/blkzoned.h", "BLKREPORTZONE", _IOC_READ|_IOC_WRITE, 0x1282, 0x10 },
{ "linux/blkzoned.h", "BLKRESETZONE", _IOC_WRITE, 0x1283, 0x10 },
{ "linux/bt-bmc.h", "BT_BMC_IOCTL_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/btrfs.h", "BTRFS_IOC_ADD_DEV", _IOC_WRITE, 0x940a, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE", _IOC_WRITE, 0x940c, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE_CTL", _IOC_WRITE, 0x9421, 0x04 },
@ -1311,123 +1320,9 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ARM_VCPU_INIT", _IOC_WRITE, 0xaeae, 0x20 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_PCI_DEVICE", _IOC_READ, 0xae69, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_INTX_MASK", _IOC_WRITE, 0xaea4, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_ENTRY", _IOC_WRITE, 0xae74, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_NR", _IOC_WRITE, 0xae73, 0x08 },
{ "linux/kvm.h", "KVM_CHECK_EXTENSION", _IOC_NONE, 0xae03, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_DEVICE", _IOC_READ|_IOC_WRITE, 0xaee0, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_IRQCHIP", _IOC_NONE, 0xae60, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
{ "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
{ "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
{ "linux/kvm.h", "KVM_DEASSIGN_PCI_DEVICE", _IOC_WRITE, 0xae72, 0x40 },
{ "linux/kvm.h", "KVM_DIRTY_TLB", _IOC_WRITE, 0xaeaa, 0x10 },
{ "linux/kvm.h", "KVM_ENABLE_CAP", _IOC_WRITE, 0xaea3, 0x68 },
{ "linux/kvm.h", "KVM_GET_API_VERSION", _IOC_NONE, 0xae00, 0x00 },
{ "linux/kvm.h", "KVM_GET_CLOCK", _IOC_READ, 0xae7c, 0x30 },
{ "linux/kvm.h", "KVM_GET_CPUID2", _IOC_READ|_IOC_WRITE, 0xae91, 0x08 },
{ "linux/kvm.h", "KVM_GET_DEBUGREGS", _IOC_READ, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_GET_DEVICE_ATTR", _IOC_WRITE, 0xaee2, 0x18 },
{ "linux/kvm.h", "KVM_GET_DIRTY_LOG", _IOC_WRITE, 0xae42, 0x10 },
{ "linux/kvm.h", "KVM_GET_EMULATED_CPUID", _IOC_READ|_IOC_WRITE, 0xae09, 0x08 },
{ "linux/kvm.h", "KVM_GET_FPU", _IOC_READ, 0xae8c, 0x1a0 },
{ "linux/kvm.h", "KVM_GET_IRQCHIP", _IOC_READ|_IOC_WRITE, 0xae62, 0x208 },
{ "linux/kvm.h", "KVM_GET_LAPIC", _IOC_READ, 0xae8e, 0x400 },
{ "linux/kvm.h", "KVM_GET_MP_STATE", _IOC_READ, 0xae98, 0x04 },
{ "linux/kvm.h", "KVM_GET_MSRS", _IOC_READ|_IOC_WRITE, 0xae88, 0x08 },
{ "linux/kvm.h", "KVM_GET_MSR_INDEX_LIST", _IOC_READ|_IOC_WRITE, 0xae02, 0x04 },
{ "linux/kvm.h", "KVM_GET_NR_MMU_PAGES", _IOC_NONE, 0xae45, 0x00 },
{ "linux/kvm.h", "KVM_GET_ONE_REG", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_GET_PIT", _IOC_READ|_IOC_WRITE, 0xae65, 0x48 },
{ "linux/kvm.h", "KVM_GET_PIT2", _IOC_READ, 0xae9f, 0x70 },
{ "linux/kvm.h", "KVM_GET_REGS", _IOC_READ, 0xae81, 0x90 },
{ "linux/kvm.h", "KVM_GET_REG_LIST", _IOC_READ|_IOC_WRITE, 0xaeb0, 0x08 },
{ "linux/kvm.h", "KVM_GET_SREGS", _IOC_READ, 0xae83, 0x138 },
{ "linux/kvm.h", "KVM_GET_SUPPORTED_CPUID", _IOC_READ|_IOC_WRITE, 0xae05, 0x08 },
{ "linux/kvm.h", "KVM_GET_TSC_KHZ", _IOC_NONE, 0xaea3, 0x00 },
{ "linux/kvm.h", "KVM_GET_VCPU_EVENTS", _IOC_READ, 0xae9f, 0x40 },
{ "linux/kvm.h", "KVM_GET_VCPU_MMAP_SIZE", _IOC_NONE, 0xae04, 0x00 },
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },
{ "linux/kvm.h", "KVM_IRQ_LINE", _IOC_WRITE, 0xae61, 0x08 },
{ "linux/kvm.h", "KVM_IRQ_LINE_STATUS", _IOC_READ|_IOC_WRITE, 0xae67, 0x08 },
{ "linux/kvm.h", "KVM_KVMCLOCK_CTRL", _IOC_NONE, 0xaead, 0x00 },
{ "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 },
{ "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 },
{ "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
{ "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
{ "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
{ "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x08 },
{ "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
{ "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
{ "linux/kvm.h", "KVM_S390_VCPU_FAULT", _IOC_WRITE, 0xae52, 0x08 },
{ "linux/kvm.h", "KVM_SET_BOOT_CPU_ID", _IOC_NONE, 0xae78, 0x00 },
{ "linux/kvm.h", "KVM_SET_CLOCK", _IOC_WRITE, 0xae7b, 0x30 },
{ "linux/kvm.h", "KVM_SET_CPUID", _IOC_WRITE, 0xae8a, 0x08 },
{ "linux/kvm.h", "KVM_SET_CPUID2", _IOC_WRITE, 0xae90, 0x08 },
{ "linux/kvm.h", "KVM_SET_DEBUGREGS", _IOC_WRITE, 0xaea2, 0x80 },
{ "linux/kvm.h", "KVM_SET_DEVICE_ATTR", _IOC_WRITE, 0xaee1, 0x18 },
{ "linux/kvm.h", "KVM_SET_FPU", _IOC_WRITE, 0xae8d, 0x1a0 },
{ "linux/kvm.h", "KVM_SET_GSI_ROUTING", _IOC_WRITE, 0xae6a, 0x08 },
{ "linux/kvm.h", "KVM_SET_GUEST_DEBUG", _IOC_WRITE, 0xae9b, 0x48 },
{ "linux/kvm.h", "KVM_SET_IDENTITY_MAP_ADDR", _IOC_WRITE, 0xae48, 0x08 },
{ "linux/kvm.h", "KVM_SET_IRQCHIP", _IOC_READ, 0xae63, 0x208 },
{ "linux/kvm.h", "KVM_SET_LAPIC", _IOC_WRITE, 0xae8f, 0x400 },
{ "linux/kvm.h", "KVM_SET_MEMORY_ALIAS", _IOC_WRITE, 0xae43, 0x20 },
{ "linux/kvm.h", "KVM_SET_MEMORY_REGION", _IOC_WRITE, 0xae40, 0x18 },
{ "linux/kvm.h", "KVM_SET_MP_STATE", _IOC_WRITE, 0xae99, 0x04 },
{ "linux/kvm.h", "KVM_SET_MSRS", _IOC_WRITE, 0xae89, 0x08 },
{ "linux/kvm.h", "KVM_SET_NR_MMU_PAGES", _IOC_NONE, 0xae44, 0x00 },
{ "linux/kvm.h", "KVM_SET_ONE_REG", _IOC_WRITE, 0xaeac, 0x10 },
{ "linux/kvm.h", "KVM_SET_PIT", _IOC_READ, 0xae66, 0x48 },
{ "linux/kvm.h", "KVM_SET_PIT2", _IOC_WRITE, 0xaea0, 0x70 },
{ "linux/kvm.h", "KVM_SET_REGS", _IOC_WRITE, 0xae82, 0x90 },
{ "linux/kvm.h", "KVM_SET_SIGNAL_MASK", _IOC_WRITE, 0xae8b, 0x04 },
{ "linux/kvm.h", "KVM_SET_SREGS", _IOC_WRITE, 0xae84, 0x138 },
{ "linux/kvm.h", "KVM_SET_TSC_KHZ", _IOC_NONE, 0xaea2, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSS_ADDR", _IOC_NONE, 0xae47, 0x00 },
{ "linux/kvm.h", "KVM_SET_USER_MEMORY_REGION", _IOC_WRITE, 0xae46, 0x20 },
{ "linux/kvm.h", "KVM_SET_VAPIC_ADDR", _IOC_WRITE, 0xae93, 0x08 },
{ "linux/kvm.h", "KVM_SET_VCPU_EVENTS", _IOC_WRITE, 0xaea0, 0x40 },
{ "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
{ "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
{ "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
{ "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
{ "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
{ "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
{ "linux/kvm.h", "KVM_X86_GET_MCE_CAP_SUPPORTED", _IOC_READ, 0xae9d, 0x08 },
{ "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
{ "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
{ "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_IO_VIO", _IOC_READ|_IOC_WRITE, 0x4c43, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_SUBMIT_VIO", _IOC_READ|_IOC_WRITE, 0x4c42, 0x40 },
{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
@ -1568,6 +1463,10 @@
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nsfs.h", "NS_GET_NSTYPE", _IOC_NONE, 0xb703, 0x00 },
{ "linux/nsfs.h", "NS_GET_OWNER_UID", _IOC_NONE, 0xb704, 0x00 },
{ "linux/nsfs.h", "NS_GET_PARENT", _IOC_NONE, 0xb702, 0x00 },
{ "linux/nsfs.h", "NS_GET_USERNS", _IOC_NONE, 0xb701, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
@ -1776,6 +1675,8 @@
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
{ "linux/rpmsg.h", "RPMSG_CREATE_EPT_IOCTL", _IOC_WRITE, 0xb501, 0x28 },
{ "linux/rpmsg.h", "RPMSG_DESTROY_EPT_IOCTL", _IOC_NONE, 0xb502, 0x00 },
{ "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
{ "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
{ "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@ -1815,6 +1716,18 @@
{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x28 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_LSP", _IOC_WRITE, 0x70df, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_USR", _IOC_WRITE, 0x70e1, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ADD_USR_TO_LR", _IOC_WRITE, 0x70e4, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ENABLE_DISABLE_MBR", _IOC_WRITE, 0x70e5, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ERASE_LR", _IOC_WRITE, 0x70e6, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_LOCK_UNLOCK", _IOC_WRITE, 0x70dd, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_LR_SETUP", _IOC_WRITE, 0x70e3, 0x128 },
{ "linux/sed-opal.h", "IOC_OPAL_REVERT_TPR", _IOC_WRITE, 0x70e2, 0x108 },
{ "linux/sed-opal.h", "IOC_OPAL_SAVE", _IOC_WRITE, 0x70dc, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_SECURE_ERASE_LR", _IOC_WRITE, 0x70e7, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_SET_PW", _IOC_WRITE, 0x70e0, 0x220 },
{ "linux/sed-opal.h", "IOC_OPAL_TAKE_OWNERSHIP", _IOC_WRITE, 0x70de, 0x108 },
{ "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x08 },
{ "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
{ "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@ -1862,6 +1775,7 @@
{ "linux/sockios.h", "SIOCGMIIPHY", 0, 0x8947, 0 },
{ "linux/sockios.h", "SIOCGMIIREG", 0, 0x8948, 0 },
{ "linux/sockios.h", "SIOCGRARP", 0, 0x8961, 0 },
{ "linux/sockios.h", "SIOCGSKNS", 0, 0x894C, 0 },
{ "linux/sockios.h", "SIOCOUTQNSD", 0, 0x894B, 0 },
{ "linux/sockios.h", "SIOCPROTOPRIVATE", 0, 0x89E0, 0 },
{ "linux/sockios.h", "SIOCRTMSG", 0, 0x890D, 0 },
@ -2528,23 +2442,23 @@
{ "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
{ "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x08 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x08 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x08 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
@ -2779,6 +2693,7 @@
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x20 },
{ "staging/android/ion.h", "ION_IOC_CUSTOM", _IOC_READ|_IOC_WRITE, 0x4906, 0x10 },
{ "staging/android/ion.h", "ION_IOC_FREE", _IOC_READ|_IOC_WRITE, 0x4901, 0x04 },
{ "staging/android/ion.h", "ION_IOC_HEAP_QUERY", _IOC_READ|_IOC_WRITE, 0x4908, 0x18 },
{ "staging/android/ion.h", "ION_IOC_IMPORT", _IOC_READ|_IOC_WRITE, 0x4905, 0x08 },
{ "staging/android/ion.h", "ION_IOC_MAP", _IOC_READ|_IOC_WRITE, 0x4902, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SHARE", _IOC_READ|_IOC_WRITE, 0x4904, 0x08 },

View File

@ -116,16 +116,16 @@
[115] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" },
[116] = { 3, 0, SEN(syslog), "syslog" },
[117] = { 4, 0, SEN(ptrace), "ptrace" },
[118] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
[119] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" },
[120] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" },
[121] = { 2, 0, SEN(sched_getparam), "sched_getparam" },
[122] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[123] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[124] = { 0, 0, SEN(sched_yield), "sched_yield" },
[125] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"},
[126] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"},
[127] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[118] = { 2, TSC, SEN(sched_setparam), "sched_setparam" },
[119] = { 3, TSC, SEN(sched_setscheduler), "sched_setscheduler" },
[120] = { 1, TSC, SEN(sched_getscheduler), "sched_getscheduler" },
[121] = { 2, TSC, SEN(sched_getparam), "sched_getparam" },
[122] = { 3, TSC, SEN(sched_setaffinity), "sched_setaffinity" },
[123] = { 3, TSC, SEN(sched_getaffinity), "sched_getaffinity" },
[124] = { 0, TSC, SEN(sched_yield), "sched_yield" },
[125] = { 1, TSC, SEN(sched_get_priority_max), "sched_get_priority_max"},
[126] = { 1, TSC, SEN(sched_get_priority_min), "sched_get_priority_min"},
[127] = { 2, TSC, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[128] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[129] = { 2, TS, SEN(kill), "kill" },
[130] = { 2, TS, SEN(kill), "tkill" },
@ -137,7 +137,7 @@
[136] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" },
[137] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" },
[138] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" },
[139] = { 0, TS, SEN(sigreturn), "rt_sigreturn" },
[139] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
[140] = { 3, 0, SEN(setpriority), "setpriority" },
[141] = { 2, 0, SEN(getpriority), "getpriority" },
[142] = { 4, 0, SEN(reboot), "reboot" },
@ -257,17 +257,20 @@
[271] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" },
[272] = { 5, 0, SEN(kcmp), "kcmp" },
[273] = { 3, TD, SEN(finit_module), "finit_module" },
[274] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[275] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[274] = { 3, TSC, SEN(sched_setattr), "sched_setattr" },
[275] = { 4, TSC, SEN(sched_getattr), "sched_getattr" },
[276] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[277] = { 3, 0, SEN(seccomp), "seccomp", },
[278] = { 3, 0, SEN(getrandom), "getrandom", },
[279] = { 2, TD, SEN(memfd_create), "memfd_create", },
[280] = { 3, TD, SEN(bpf), "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
[283] = { 2, 0, SEN(membarrier), "membarrier", },
[277] = { 3, 0, SEN(seccomp), "seccomp" },
[278] = { 3, 0, SEN(getrandom), "getrandom" },
[279] = { 2, TD, SEN(memfd_create), "memfd_create" },
[280] = { 3, TD, SEN(bpf), "bpf" },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[283] = { 2, 0, SEN(membarrier), "membarrier" },
[284] = { 3, TM, SEN(mlock2), "mlock2" },
[285] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[286] = { 6, TD, SEN(preadv2), "preadv2" },
[287] = { 6, TD, SEN(pwritev2), "pwritev2" },
[288] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[289] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[290] = { 1, 0, SEN(pkey_free), "pkey_free" },

View File

@ -28,7 +28,7 @@ static union {
#define arm_regs arm_regs_union.arm_r
uint64_t *const aarch64_sp_ptr = (uint64_t *) &aarch64_regs.sp;
uint32_t *const arm_sp_ptr = (uint32_t *) &arm_regs.ARM_sp;
uint32_t *const arm_sp_ptr = &arm_regs.ARM_sp;
static struct iovec aarch64_io = {
.iov_base = &arm_regs_union
};

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#undef FUNC_GET_RT_SIGFRAME_ADDR
#define FUNC_GET_RT_SIGFRAME_ADDR \
static kernel_ulong_t arm_get_rt_sigframe_addr(struct tcb *tcp)
#include "arm/arch_rt_sigframe.c"
#undef FUNC_GET_RT_SIGFRAME_ADDR
#define FUNC_GET_RT_SIGFRAME_ADDR DEF_FUNC_GET_RT_SIGFRAME_ADDR
FUNC_GET_RT_SIGFRAME_ADDR
{
return tcp->currpers == 1 ? arm_get_rt_sigframe_addr(tcp)
: *aarch64_sp_ptr;
}

View File

@ -2,7 +2,7 @@
static int
arch_get_scno(struct tcb *tcp)
{
long scno = 0;
kernel_ulong_t scno = 0;
switch (aarch64_io.iov_len) {
case sizeof(aarch64_regs):

25
linux/aarch64/set_error.c Normal file
View File

@ -0,0 +1,25 @@
#define arch_set_error arm_set_error
#define arch_set_success arm_set_success
#include "arm/set_error.c"
#undef arch_set_success
#undef arch_set_error
static int
arch_set_error(struct tcb *tcp)
{
if (aarch64_io.iov_len == sizeof(arm_regs))
return arm_set_error(tcp);
aarch64_regs.regs[0] = -tcp->u_error;
return set_regs(tcp->pid);
}
static int
arch_set_success(struct tcb *tcp)
{
if (aarch64_io.iov_len == sizeof(arm_regs))
return arm_set_success(tcp);
aarch64_regs.regs[0] = tcp->u_rval;
return set_regs(tcp->pid);
}

22
linux/aarch64/set_scno.c Normal file
View File

@ -0,0 +1,22 @@
#ifndef NT_ARM_SYSTEM_CALL
# define NT_ARM_SYSTEM_CALL 0x404
#endif
/*
* NT_ARM_SYSTEM_CALL regset is supported by linux kernel
* starting with commit v3.19-rc1~59^2~16.
*/
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
unsigned int n = (uint16_t) scno;
const struct iovec io = {
.iov_base = &n,
.iov_len = sizeof(n)
};
int rc = ptrace(PTRACE_SETREGSET, tcp->pid, NT_ARM_SYSTEM_CALL, &io);
if (rc && errno != ESRCH)
perror_msg("arch_set_scno: NT_ARM_SYSTEM_CALL pid:%d scno:%#x",
tcp->pid, n);
return rc;
}

View File

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

View File

@ -1,3 +1,3 @@
static long alpha_r0;
static long alpha_a3;
static unsigned long alpha_r0;
static unsigned long alpha_a3;
#define ARCH_PC_PEEK_ADDR REG_PC

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
FUNC_GET_RT_SIGFRAME_ADDR
{
unsigned long addr;
return upeek(tcp->pid, REG_FP, &addr) ? 0 : addr;
}

View File

@ -1,13 +1,13 @@
static void
arch_sigreturn(struct tcb *tcp)
{
long addr;
unsigned long addr;
if (upeek(tcp->pid, REG_FP, &addr) < 0)
return;
addr += offsetof(struct sigcontext, sc_mask);
tprints("{mask=");
print_sigset_addr_len(tcp, addr, NSIG / 8);
print_sigset_addr(tcp, addr);
tprints("}");
}

View File

@ -2,7 +2,7 @@
static int
arch_get_scno(struct tcb *tcp)
{
long scno = 0;
kernel_ulong_t scno = 0;
if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0)
return -1;
@ -13,10 +13,10 @@ arch_get_scno(struct tcb *tcp)
* Do some sanity checks to figure out if it's
* really a syscall entry
*/
if (!SCNO_IN_RANGE(scno)) {
if (alpha_a3 == 0 || alpha_a3 == -1) {
if (!scno_in_range(scno)) {
if (alpha_a3 == 0 || alpha_a3 == -1UL) {
if (debug_flag)
error_msg("stray syscall exit: r0 = %ld", scno);
error_msg("stray syscall exit: r0 = %lu", scno);
return 0;
}
}

13
linux/alpha/set_error.c Normal file
View File

@ -0,0 +1,13 @@
static int
arch_set_error(struct tcb *tcp)
{
alpha_r0 = tcp->u_error;
return upoke(tcp->pid, 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));
}

5
linux/alpha/set_scno.c Normal file
View File

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

View File

@ -26,92 +26,92 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[ 0] = { 6, 0, SEN(printargs), "osf_syscall" }, /*not implemented */
[ 0] = { 6, 0, SEN(printargs), "osf_syscall" }, /* not implemented */
[ 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] = { 5, 0, SEN(printargs), "osf_old_open" }, /*not implemented */
[ 5] = { 5, 0, SEN(printargs), "osf_old_open" }, /* not implemented */
[ 6] = { 1, TD, SEN(close), "close" },
[ 7] = { 4, TP, SEN(osf_wait4), "osf_wait4" },
[ 8] = { 5, 0, SEN(printargs), "osf_old_creat" }, /*not implemented */
[ 8] = { 5, 0, SEN(printargs), "osf_old_creat" }, /* not implemented */
[ 9] = { 2, TF, SEN(link), "link" },
[ 10] = { 1, TF, SEN(unlink), "unlink" },
[ 11] = { 5, 0, SEN(printargs), "osf_execve" }, /*not implemented */
[ 11] = { 5, 0, SEN(printargs), "osf_execve" }, /* not implemented */
[ 12] = { 1, TF, SEN(chdir), "chdir" },
[ 13] = { 1, TD, SEN(fchdir), "fchdir" },
[ 14] = { 3, TF, SEN(mknod), "mknod" },
[ 15] = { 2, TF, SEN(chmod), "chmod" },
[ 16] = { 3, TF, SEN(chown), "chown" },
[ 17] = { 1, TM|SI, SEN(brk), "brk" },
[ 18] = { 5, 0, SEN(printargs), "osf_getfsstat" }, /*not implemented */
[ 18] = { 5, 0, SEN(printargs), "osf_getfsstat" }, /* not implemented */
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, 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" },
[ 25] = { 5, 0, SEN(printargs), "exec_with_loader" }, /*not implemented */
[ 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 */
[ 28] = { 5, 0, SEN(printargs), "osf_nsendmsg" }, /*not implemented */
[ 29] = { 5, 0, SEN(printargs), "osf_nrecvfrom" }, /*not implemented */
[ 30] = { 5, 0, SEN(printargs), "osf_naccept" }, /*not implemented */
[ 31] = { 5, 0, SEN(printargs), "osf_ngetpeername" }, /*not implemented */
[ 32] = { 5, 0, SEN(printargs), "osf_ngetsockname" }, /*not implemented */
[ 27] = { 5, 0, SEN(printargs), "osf_nrecvmsg" }, /* not implemented */
[ 28] = { 5, 0, SEN(printargs), "osf_nsendmsg" }, /* not implemented */
[ 29] = { 5, 0, SEN(printargs), "osf_nrecvfrom" }, /* not implemented */
[ 30] = { 5, 0, SEN(printargs), "osf_naccept" }, /* not implemented */
[ 31] = { 5, 0, SEN(printargs), "osf_ngetpeername" }, /* not implemented */
[ 32] = { 5, 0, SEN(printargs), "osf_ngetsockname" }, /* not implemented */
[ 33] = { 2, TF, SEN(access), "access" },
[ 34] = { 5, 0, SEN(printargs), "osf_chflags" }, /*not implemented */
[ 35] = { 5, 0, SEN(printargs), "osf_fchflags" }, /*not implemented */
[ 34] = { 5, 0, SEN(printargs), "osf_chflags" }, /* not implemented */
[ 35] = { 5, 0, SEN(printargs), "osf_fchflags" }, /* not implemented */
[ 36] = { 0, 0, SEN(sync), "sync" },
[ 37] = { 2, TS, SEN(kill), "kill" },
[ 38] = { 5, 0, SEN(printargs), "osf_old_stat" }, /*not implemented */
[ 38] = { 5, TF, SEN(printargs), "osf_old_stat" }, /* not implemented */
[ 39] = { 2, 0, SEN(setpgid), "setpgid" },
[ 40] = { 5, 0, SEN(printargs), "osf_old_lstat" }, /*not implemented */
[ 40] = { 5, TF, SEN(printargs), "osf_old_lstat" }, /* not implemented */
[ 41] = { 1, TD, SEN(dup), "dup" },
[ 42] = { 0, TD, SEN(pipe), "pipe" },
[ 43] = { 4, 0, SEN(printargs), "osf_set_program_attributes" },
[ 44] = { 5, 0, SEN(printargs), "osf_profil" }, /*not implemented */
[ 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] = { 1, NF, SEN(getxgid), "getxgid" },
[ 46] = { 5, 0, SEN(printargs), "osf_old_sigaction" }, /* not implemented */
[ 47] = { 0, NF, SEN(getxgid), "getxgid" },
[ 48] = { 2, TS, SEN(sigprocmask), "osf_sigprocmask" },
[ 49] = { 5, 0, SEN(printargs), "osf_getlogin" }, /*not implemented */
[ 50] = { 5, 0, SEN(printargs), "osf_setlogin" }, /*not implemented */
[ 49] = { 5, 0, SEN(printargs), "osf_getlogin" }, /* not implemented */
[ 50] = { 5, 0, SEN(printargs), "osf_setlogin" }, /* not implemented */
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 1, TS, SEN(sigpending), "sigpending" },
[ 53] = { },
[ 54] = { 3, TD, SEN(ioctl), "ioctl" },
[ 55] = { 5, 0, SEN(printargs), "osf_reboot" }, /*not implemented */
[ 56] = { 5, 0, SEN(printargs), "osf_revoke" }, /*not implemented */
[ 55] = { 5, 0, SEN(printargs), "osf_reboot" }, /* not implemented */
[ 56] = { 5, 0, SEN(printargs), "osf_revoke" }, /* not implemented */
[ 57] = { 2, TF, SEN(symlink), "symlink" },
[ 58] = { 3, TF, SEN(readlink), "readlink" },
[ 59] = { 3, TF|TP|SE|SI, SEN(execve), "execve" },
[ 60] = { 1, NF, SEN(umask), "umask" },
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 5, 0, SEN(printargs), "osf_old_fstat" }, /*not implemented */
[ 62] = { 5, TD, SEN(printargs), "osf_old_fstat" }, /* not implemented */
[ 63] = { 0, 0, SEN(getpgrp), "getpgrp" },
[ 64] = { 0, 0, SEN(getpagesize), "getpagesize" },
[ 65] = { 5, TM, SEN(printargs), "osf_mremap" }, /*not implemented */
[ 65] = { 5, TM, SEN(printargs), "osf_mremap" }, /* not implemented */
[ 66] = { 0, TP, SEN(vfork), "vfork" },
[ 67] = { 2, TF, SEN(stat), "stat" },
[ 68] = { 2, TF, SEN(lstat), "lstat" },
[ 69] = { 5, TM, SEN(printargs), "osf_sbrk" }, /*not implemented */
[ 70] = { 5, 0, SEN(printargs), "osf_sstk" }, /*not implemented */
[ 69] = { 5, TM, SEN(printargs), "osf_sbrk" }, /* not implemented */
[ 70] = { 5, 0, SEN(printargs), "osf_sstk" }, /* not implemented */
[ 71] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[ 72] = { 5, 0, SEN(printargs), "osf_old_vadvise" }, /*not implemented */
[ 72] = { 5, 0, SEN(printargs), "osf_old_vadvise" }, /* not implemented */
[ 73] = { 2, TM|SI, SEN(munmap), "munmap" },
[ 74] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[ 75] = { 3, TM, SEN(madvise), "madvise" },
[ 76] = { 0, 0, SEN(vhangup), "vhangup" },
[ 77] = { 5, 0, SEN(printargs), "osf_kmodcall" }, /*not implemented */
[ 78] = { 5, TM, SEN(printargs), "osf_mincore" }, /*not implemented */
[ 77] = { 5, 0, SEN(printargs), "osf_kmodcall" }, /* not implemented */
[ 78] = { 5, TM, SEN(printargs), "osf_mincore" }, /* not implemented */
[ 79] = { 2, 0, SEN(getgroups), "getgroups" },
[ 80] = { 2, 0, SEN(setgroups), "setgroups" },
[ 81] = { 5, 0, SEN(printargs), "osf_old_getpgrp" }, /*not implemented */
[ 81] = { 5, 0, SEN(printargs), "osf_old_getpgrp" }, /* not implemented */
[ 82] = { 2, 0, SEN(setpgrp), "setpgrp" },
[ 83] = { 3, 0, SEN(osf_setitimer), "osf_setitimer" },
[ 84] = { 5, 0, SEN(printargs), "osf_old_wait" }, /*not implemented */
[ 85] = { 5, 0, SEN(printargs), "osf_table" }, /*not implemented */
[ 84] = { 5, 0, SEN(printargs), "osf_old_wait" }, /* not implemented */
[ 85] = { 5, 0, SEN(printargs), "osf_table" }, /* not implemented */
[ 86] = { 2, 0, SEN(osf_getitimer), "osf_getitimer" },
[ 87] = { 2, 0, SEN(gethostname), "gethostname" },
[ 88] = { 2, 0, SEN(sethostname), "sethostname" },
@ -133,15 +133,15 @@
[104] = { 3, TN, SEN(bind), "bind" },
[105] = { 5, TN, SEN(setsockopt), "setsockopt" },
[106] = { 2, TN, SEN(listen), "listen" },
[107] = { 5, 0, SEN(printargs), "osf_plock" }, /*not implemented */
[108] = { 5, 0, SEN(printargs), "osf_old_sigvec" }, /*not implemented */
[109] = { 5, 0, SEN(printargs), "osf_old_sigblock" }, /*not implemented */
[110] = { 5, 0, SEN(printargs), "osf_old_sigsetmask" }, /*not implemented */
[107] = { 5, 0, SEN(printargs), "osf_plock" }, /* not implemented */
[108] = { 5, 0, SEN(printargs), "osf_old_sigvec" }, /* not implemented */
[109] = { 5, 0, SEN(printargs), "osf_old_sigblock" }, /* not implemented */
[110] = { 5, 0, SEN(printargs), "osf_old_sigsetmask" }, /* not implemented */
[111] = { 3, TS, SEN(sigsuspend), "sigsuspend" },
[112] = { 2, 0, SEN(printargs), "osf_sigstack" },
[113] = { 3, TN, SEN(recvmsg), "recvmsg" },
[114] = { 3, TN, SEN(sendmsg), "sendmsg" },
[115] = { 5, 0, SEN(printargs), "osf_old_vtrace" }, /*not implemented */
[115] = { 5, 0, SEN(printargs), "osf_old_vtrace" }, /* not implemented */
[116] = { 2, 0, SEN(osf_gettimeofday), "osf_gettimeofday" },
[117] = { 2, 0, SEN(osf_getrusage), "osf_getrusage" },
[118] = { 5, TN, SEN(getsockopt), "getsockopt" },
@ -165,42 +165,42 @@
[136] = { 2, TF, SEN(mkdir), "mkdir" },
[137] = { 1, TF, SEN(rmdir), "rmdir" },
[138] = { 2, 0, SEN(osf_utimes), "osf_utimes" },
[139] = { 5, 0, SEN(printargs), "osf_old_sigreturn" },
[140] = { 5, 0, SEN(printargs), "osf_adjtime" }, /*not implemented */
[139] = { 5, 0, SEN(printargs), "osf_old_sigreturn" }, /* not implemented */
[140] = { 5, 0, SEN(printargs), "osf_adjtime" }, /* not implemented */
[141] = { 3, TN, SEN(getpeername), "getpeername" },
[142] = { 5, 0, SEN(printargs), "osf_gethostid" }, /*not implemented */
[143] = { 5, 0, SEN(printargs), "osf_sethostid" }, /*not implemented */
[142] = { 5, 0, SEN(printargs), "osf_gethostid" }, /* not implemented */
[143] = { 5, 0, SEN(printargs), "osf_sethostid" }, /* not implemented */
[144] = { 2, 0, SEN(getrlimit), "getrlimit" },
[145] = { 2, 0, SEN(setrlimit), "setrlimit" },
[146] = { 5, 0, SEN(printargs), "osf_old_killpg" }, /*not implemented */
[146] = { 5, 0, SEN(printargs), "osf_old_killpg" }, /* not implemented */
[147] = { 0, 0, SEN(setsid), "setsid" },
[148] = { 4, TF, SEN(quotactl), "quotactl" },
[149] = { 5, 0, SEN(printargs), "osf_oldquota" }, /*not implemented */
[149] = { 5, 0, SEN(printargs), "osf_oldquota" }, /* not implemented */
[150] = { 3, TN, SEN(getsockname), "getsockname" },
[151 ... 152] = { },
[153] = { 5, 0, SEN(printargs), "osf_pid_block" }, /*not implemented */
[154] = { 5, 0, SEN(printargs), "osf_pid_unblock" }, /*not implemented */
[153] = { 5, 0, SEN(printargs), "osf_pid_block" }, /* not implemented */
[154] = { 5, 0, SEN(printargs), "osf_pid_unblock" }, /* not implemented */
[155] = { },
[156] = { 3, TS, SEN(sigaction), "sigaction" },
[157] = { 5, 0, SEN(printargs), "osf_sigwaitprim" }, /*not implemented */
[158] = { 5, 0, SEN(printargs), "osf_nfssvc" }, /*not implemented */
[157] = { 5, 0, SEN(printargs), "osf_sigwaitprim" }, /* not implemented */
[158] = { 5, 0, SEN(printargs), "osf_nfssvc" }, /* not implemented */
[159] = { 4, 0, SEN(printargs), "osf_getdirentries" },
[160] = { 3, 0, SEN(osf_statfs), "osf_statfs" },
[161] = { 3, 0, SEN(osf_fstatfs), "osf_fstatfs" },
[160] = { 3, TF, SEN(osf_statfs), "osf_statfs" },
[161] = { 3, TD, SEN(osf_fstatfs), "osf_fstatfs" },
[162] = { },
[163] = { 5, 0, SEN(printargs), "osf_asynch_daemon" }, /*not implemented */
[164] = { 5, 0, SEN(printargs), "osf_getfh" }, /*not implemented */
[163] = { 5, 0, SEN(printargs), "osf_asynch_daemon" }, /* not implemented */
[164] = { 5, 0, SEN(printargs), "osf_getfh" }, /* not implemented */
[165] = { 2, 0, SEN(printargs), "osf_getdomainname" },
[166] = { 2, 0, SEN(setdomainname), "setdomainname" },
[167 ... 168] = { },
[169] = { 5, 0, SEN(printargs), "osf_exportfs" }, /*not implemented */
[169] = { 5, 0, SEN(printargs), "osf_exportfs" }, /* not implemented */
[170 ... 180] = { },
[181] = { 5, 0, SEN(printargs), "osf_alt_plock" }, /*not implemented */
[181] = { 5, 0, SEN(printargs), "osf_alt_plock" }, /* not implemented */
[182 ... 183] = { },
[184] = { 5, 0, SEN(printargs), "osf_getmnt" }, /*not implemented */
[184] = { 5, 0, SEN(printargs), "osf_getmnt" }, /* not implemented */
[185 ... 186] = { },
[187] = { 5, 0, SEN(printargs), "osf_alt_sigpending" }, /*not implemented */
[188] = { 5, 0, SEN(printargs), "osf_alt_setsid" }, /*not implemented */
[187] = { 5, 0, SEN(printargs), "osf_alt_sigpending" }, /* not implemented */
[188] = { 5, 0, SEN(printargs), "osf_alt_setsid" }, /* not implemented */
[189 ... 198] = { },
[199] = { 4, 0, SEN(printargs), "osf_swapon" },
[200] = { 3, TI, SEN(msgctl), "msgctl" },
@ -216,63 +216,63 @@
[210] = { 3, TI, SEN(shmctl), "shmctl" },
[211] = { 1, TI|TM|SI, SEN(shmdt), "shmdt" },
[212] = { 3, TI, SEN(shmget), "shmget" },
[213] = { 5, 0, SEN(printargs), "osf_mvalid" }, /*not implemented */
[214] = { 5, 0, SEN(printargs), "osf_getaddressconf" }, /*not implemented */
[215] = { 5, 0, SEN(printargs), "osf_msleep" }, /*not implemented */
[216] = { 5, 0, SEN(printargs), "osf_mwakeup" }, /*not implemented */
[213] = { 5, 0, SEN(printargs), "osf_mvalid" }, /* not implemented */
[214] = { 5, 0, SEN(printargs), "osf_getaddressconf" }, /* not implemented */
[215] = { 5, 0, SEN(printargs), "osf_msleep" }, /* not implemented */
[216] = { 5, 0, SEN(printargs), "osf_mwakeup" }, /* not implemented */
[217] = { 3, TM, SEN(msync), "msync" },
[218] = { 5, 0, SEN(printargs), "osf_signal" }, /*not implemented */
[219] = { 5, 0, SEN(printargs), "osf_utc_gettime" }, /*not implemented */
[220] = { 5, 0, SEN(printargs), "osf_utc_adjtime" }, /*not implemented */
[218] = { 5, 0, SEN(printargs), "osf_signal" }, /* not implemented */
[219] = { 5, 0, SEN(printargs), "osf_utc_gettime" }, /* not implemented */
[220] = { 5, 0, SEN(printargs), "osf_utc_adjtime" }, /* not implemented */
[221] = { },
[222] = { 5, 0, SEN(printargs), "osf_security" }, /*not implemented */
[223] = { 5, 0, SEN(printargs), "osf_kloadcall" }, /*not implemented */
[224] = { 5, 0, SEN(printargs), "osf_stat" }, /*not implemented */
[225] = { 5, 0, SEN(printargs), "osf_lstat" }, /*not implemented */
[226] = { 5, 0, SEN(printargs), "osf_fstat" }, /*not implemented */
[227] = { 3, 0, SEN(osf_statfs), "osf_statfs64" }, /*not implemented */
[228] = { 3, 0, SEN(osf_fstatfs), "osf_fstatfs64" }, /*not implemented */
[222] = { 5, 0, SEN(printargs), "osf_security" }, /* not implemented */
[223] = { 5, 0, SEN(printargs), "osf_kloadcall" }, /* not implemented */
[224] = { 2, TF, SEN(printargs), "osf_stat" },
[225] = { 2, TF, SEN(printargs), "osf_lstat" },
[226] = { 2, TD, SEN(printargs), "osf_fstat" },
[227] = { 3, TF, SEN(osf_statfs), "osf_statfs64" },
[228] = { 3, TD, SEN(osf_fstatfs), "osf_fstatfs64" },
[229 ... 232] = { },
[233] = { 1, 0, SEN(getpgid), "getpgid" },
[234] = { 1, 0, SEN(getsid), "getsid" },
[235] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[236] = { 5, 0, SEN(printargs), "osf_waitid" }, /*not implemented */
[237] = { 5, 0, SEN(printargs), "osf_priocntlset" }, /*not implemented */
[238] = { 5, 0, SEN(printargs), "osf_sigsendset" }, /*not implemented */
[239] = { 5, 0, SEN(printargs), "osf_set_speculative" }, /*not implemented */
[240] = { 5, 0, SEN(printargs), "osf_msfs_syscall" }, /*not implemented */
[241] = { 5, 0, SEN(printargs), "osf_sysinfo" },
[242] = { 5, 0, SEN(printargs), "osf_uadmin" }, /*not implemented */
[243] = { 5, 0, SEN(printargs), "osf_fuser" }, /*not implemented */
[236] = { 5, 0, SEN(printargs), "osf_waitid" }, /* not implemented */
[237] = { 5, 0, SEN(printargs), "osf_priocntlset" }, /* not implemented */
[238] = { 5, 0, SEN(printargs), "osf_sigsendset" }, /* not implemented */
[239] = { 5, 0, SEN(printargs), "osf_set_speculative" }, /* not implemented */
[240] = { 5, 0, SEN(printargs), "osf_msfs_syscall" }, /* not implemented */
[241] = { 3, 0, SEN(printargs), "osf_sysinfo" },
[242] = { 5, 0, SEN(printargs), "osf_uadmin" }, /* not implemented */
[243] = { 5, 0, SEN(printargs), "osf_fuser" }, /* not implemented */
[244] = { 2, 0, SEN(printargs), "osf_proplist_syscall" },
[245] = { 5, 0, SEN(printargs), "osf_ntp_adjtime" }, /*not implemented */
[246] = { 5, 0, SEN(printargs), "osf_ntp_gettime" }, /*not implemented */
[247] = { 5, 0, SEN(printargs), "osf_pathconf" }, /*not implemented */
[248] = { 5, 0, SEN(printargs), "osf_fpathconf" }, /*not implemented */
[245] = { 5, 0, SEN(printargs), "osf_ntp_adjtime" }, /* not implemented */
[246] = { 5, 0, SEN(printargs), "osf_ntp_gettime" }, /* not implemented */
[247] = { 5, 0, SEN(printargs), "osf_pathconf" }, /* not implemented */
[248] = { 5, 0, SEN(printargs), "osf_fpathconf" }, /* not implemented */
[249] = { },
[250] = { 5, 0, SEN(printargs), "osf_uswitch" }, /*not implemented */
[250] = { 5, 0, SEN(printargs), "osf_uswitch" }, /* not implemented */
[251] = { 2, 0, SEN(printargs), "osf_usleep_thread" },
[252] = { 5, 0, SEN(printargs), "osf_audcntl" }, /*not implemented */
[253] = { 5, 0, SEN(printargs), "osf_audgen" }, /*not implemented */
[252] = { 5, 0, SEN(printargs), "osf_audcntl" }, /* not implemented */
[253] = { 5, 0, SEN(printargs), "osf_audgen" }, /* not implemented */
[254] = { 3, 0, SEN(sysfs), "sysfs" },
[255] = { 5, 0, SEN(printargs), "osf_subsys_info" }, /*not implemented */
[255] = { 5, 0, SEN(printargs), "osf_subsys_info" }, /* not implemented */
[256] = { 5, 0, SEN(printargs), "osf_getsysinfo" },
[257] = { 5, 0, SEN(printargs), "osf_setsysinfo" },
[258] = { 5, 0, SEN(printargs), "osf_afs_syscall" }, /*not implemented */
[259] = { 5, 0, SEN(printargs), "osf_swapctl" }, /*not implemented */
[260] = { 5, 0, SEN(printargs), "osf_memcntl" }, /*not implemented */
[261] = { 5, 0, SEN(printargs), "osf_fdatasync" }, /*not implemented */
[258] = { 5, 0, SEN(printargs), "osf_afs_syscall" }, /* not implemented */
[259] = { 5, 0, SEN(printargs), "osf_swapctl" }, /* not implemented */
[260] = { 5, 0, SEN(printargs), "osf_memcntl" }, /* not implemented */
[261] = { 5, 0, SEN(printargs), "osf_fdatasync" }, /* not implemented */
[262 ... 299] = { },
[300] = { 2, 0, SEN(bdflush), "bdflush" },
[301] = { 3, 0, SEN(printargs), "sethae" },
[301] = { 1, 0, SEN(printargs), "sethae" },
[302] = { 5, TF, SEN(mount), "mount" },
[303] = { 1, 0, SEN(adjtimex), "old_adjtimex" },
[304] = { 1, TF, SEN(swapoff), "swapoff" },
[305] = { 3, TD, SEN(getdents), "getdents" },
[306] = { 2, 0, SEN(create_module), "create_module" },
[306] = { 2, 0, SEN(create_module), "create_module" }, /* not implemented */
[307] = { 3, 0, SEN(init_module), "init_module" },
[308] = { 2, 0, SEN(delete_module), "delete_module" },
[309] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" },
[309] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" }, /* not implemented */
[310] = { 3, 0, SEN(syslog), "syslog" },
[311] = { 4, 0, SEN(reboot), "reboot" },
[312] = { 5, TP, SEN(clone), "clone" },
@ -293,24 +293,24 @@
[327] = { 2, 0, SEN(ustat), "ustat" },
[328] = { 2, TF, SEN(statfs), "statfs" },
[329] = { 2, TD, SEN(fstatfs), "fstatfs" },
[330] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
[331] = { 2, 0, SEN(sched_getparam), "sched_getparam" },
[332] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" },
[333] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" },
[334] = { 0, 0, SEN(sched_yield), "sched_yield" },
[335] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"},
[336] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"},
[337] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[338] = { 5, 0, SEN(afs_syscall), "afs_syscall" },
[330] = { 2, TSC, SEN(sched_setparam), "sched_setparam" },
[331] = { 2, TSC, SEN(sched_getparam), "sched_getparam" },
[332] = { 3, TSC, SEN(sched_setscheduler), "sched_setscheduler" },
[333] = { 1, TSC, SEN(sched_getscheduler), "sched_getscheduler" },
[334] = { 0, TSC, SEN(sched_yield), "sched_yield" },
[335] = { 1, TSC, SEN(sched_get_priority_max), "sched_get_priority_max"},
[336] = { 1, TSC, SEN(sched_get_priority_min), "sched_get_priority_min"},
[337] = { 2, TSC, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[338] = { 5, 0, SEN(afs_syscall), "afs_syscall" }, /* not implemented */
[339] = { 1, 0, SEN(uname), "uname" },
[340] = { 2, 0, SEN(nanosleep), "nanosleep" },
[341] = { 5, TM|SI, SEN(mremap), "mremap" },
[342] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[342] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, /* not implemented */
[343] = { 3, 0, SEN(setresuid), "setresuid" },
[344] = { 3, 0, SEN(getresuid), "getresuid" },
[345] = { 5, 0, SEN(printargs), "pciconfig_read" },
[346] = { 5, 0, SEN(printargs), "pciconfig_write" },
[347] = { 5, 0, SEN(query_module), "query_module" },
[347] = { 5, 0, SEN(query_module), "query_module" }, /* not implemented */
[348] = { 5, 0, SEN(prctl), "prctl" },
[349] = { 4, TD, SEN(pread), "pread64" },
[350] = { 4, TD, SEN(pwrite), "pwrite64" },
@ -336,7 +336,7 @@
[370] = { 4, TD|TN, SEN(sendfile), "sendfile" },
[371] = { 3, 0, SEN(setresgid), "setresgid" },
[372] = { 3, 0, SEN(getresgid), "getresgid" },
[373] = { 4, 0, SEN(printargs), "dipc" }, /*not implemented */
[373] = { 4, 0, SEN(printargs), "dipc" }, /* not implemented */
[374] = { 2, TF, SEN(pivotroot), "pivot_root" },
[375] = { 3, TM, SEN(mincore), "mincore" },
[376] = { 3, 0, SEN(printargs), "pciconfig_iobase" },
@ -358,9 +358,9 @@
[392] = { 2, TF, SEN(removexattr), "lremovexattr" },
[393] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
[394] = { 6, 0, SEN(futex), "futex" },
[395] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[396] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[397] = { 5, 0, SEN(tuxcall), "tuxcall" },
[395] = { 3, TSC, SEN(sched_setaffinity), "sched_setaffinity" },
[396] = { 3, TSC, SEN(sched_getaffinity), "sched_getaffinity" },
[397] = { 5, 0, SEN(tuxcall), "tuxcall" }, /* not implemented */
[398] = { 2, TM, SEN(io_setup), "io_setup" },
[399] = { 1, TM, SEN(io_destroy), "io_destroy" },
[400] = { 5, 0, SEN(io_getevents), "io_getevents" },
@ -390,10 +390,10 @@
[425] = { 2, TF, SEN(stat64), "stat64" },
[426] = { 2, TF, SEN(lstat64), "lstat64" },
[427] = { 2, TD, SEN(fstat64), "fstat64" },
[428] = { 5, 0, SEN(vserver), "vserver" },
[429] = { 6, TM, SEN(mbind), "mbind" },
[430] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[431] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[428] = { 5, 0, SEN(vserver), "vserver" }, /* not implemented */
[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" },
[433] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[434] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
@ -439,7 +439,7 @@
[474] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[475] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[476] = { 3, TD|TS, SEN(signalfd), "signalfd" },
[477] = { 4, TD, SEN(timerfd), "timerfd" },
[477] = { 4, TD, SEN(timerfd), "timerfd" }, /* not implemented */
[478] = { 1, TD, SEN(eventfd), "eventfd" },
[479] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
[480] = { 4, TD, SEN(fallocate), "fallocate" },
@ -470,9 +470,9 @@
[505] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" },
[506] = { 5, 0, SEN(kcmp), "kcmp" },
[507] = { 3, TD, SEN(finit_module), "finit_module" },
[508] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[509] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[508] = { 3, TSC, SEN(sched_setattr), "sched_setattr" },
[509] = { 4, TSC, SEN(sched_getattr), "sched_getattr" },
[510] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[511] = { 3, 0, SEN(getrandom), "getrandom", },
[512] = { 2, TD, SEN(memfd_create), "memfd_create", },
[513] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
[511] = { 3, 0, SEN(getrandom), "getrandom" },
[512] = { 2, TD, SEN(memfd_create), "memfd_create" },
[513] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },

View File

@ -1,3 +1,4 @@
static struct user_regs_struct arc_regs;
unsigned long *const arc_sp_ptr = &arc_regs.sp;
#define ARCH_REGS_FOR_GETREGSET arc_regs
#define ARCH_PC_REG arc_regs.efa

1
linux/arc/arch_regs.h Normal file
View File

@ -0,0 +1 @@
extern unsigned long *const arc_sp_ptr;

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
FUNC_GET_RT_SIGFRAME_ADDR
{
return *arc_sp_ptr;
}

View File

@ -2,7 +2,7 @@
static int
get_syscall_args(struct tcb *tcp)
{
long *arc_args = &arc_regs.scratch.r0;
unsigned long *arc_args = &arc_regs.scratch.r0;
unsigned int i;
for (i = 0; i < MAX_ARGS; ++i)

13
linux/arc/set_error.c Normal file
View File

@ -0,0 +1,13 @@
static int
arch_set_error(struct tcb *tcp)
{
arc_regs.scratch.r0 = -tcp->u_error;
return set_regs(tcp->pid);
}
static int
arch_set_success(struct tcb *tcp)
{
arc_regs.scratch.r0 = tcp->u_rval;
return set_regs(tcp->pid);
}

6
linux/arc/set_scno.c Normal file
View File

@ -0,0 +1,6 @@
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
arc_regs.scratch.r8 = scno;
return set_regs(tcp->pid);
}

View File

@ -1,6 +1,8 @@
#define sys_ARCH_mmap sys_mmap_pgoff
#include "32/syscallent.h"
/* [244 ... 259] are arch specific */
[244] = { 3, 0, SEN(printargs), "arc_cacheflush"},
[244] = { 3, 0, SEN(printargs), "cacheflush" },
[245] = { 1, 0, SEN(printargs), "arc_settls" },
[246] = { 0, 0, SEN(printargs), "arc_gettls" },
[247] = { 3, 0, SEN(sysfs), "sysfs" },
[248] = { 3, 0, SEN(printargs), "arc_usr_cmpxchg"},

View File

@ -1,5 +1,3 @@
#warning sigreturn/rt_sigreturn signal mask decoding is not implemented for this architecture
static void
arch_sigreturn(struct tcb *tcp)
{

View File

@ -1,5 +1,5 @@
static struct pt_regs arm_regs;
long *const arm_sp_ptr = &arm_regs.ARM_sp;
unsigned long *const arm_sp_ptr = (unsigned long *) &arm_regs.ARM_sp;
#define ARCH_REGS_FOR_GETREGS arm_regs
#define ARCH_PC_REG arm_regs.ARM_pc

View File

@ -1 +1 @@
extern long *const arm_sp_ptr;
extern unsigned long *const arm_sp_ptr;

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
FUNC_GET_RT_SIGFRAME_ADDR
{
return *arm_sp_ptr;
}

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