Compare commits

..

586 Commits
v4.10 ... v4.11

Author SHA1 Message Date
2acb065f42 Prepare for 4.11 release
* NEWS: Update for 4.11 release.
* debian/changelog: 4.11-1.
* strace.spec: 4.11-1.
2015-12-21 20:21:22 +00:00
4fa8073d87 Sync strace.spec and debian/ with packages
* debian/changelog: Sync with 4.10-3.
* debian/control: Likewise.
* debian/rules: Likewise.
* strace.spec: Sync with 4.10-3.
2015-12-20 00:58:36 +00:00
9c067ea8c8 .mailmap: add addresses of Kirill A. Shutemov
* .mailmap: Add both addresses of Kirill A. Shutemov here
to avoid duplications in CREDITS file.
2015-12-20 00:25:10 +00:00
7405b1225a NEWS: Prepare for 4.11 release 2015-12-19 20:57:30 +00:00
23828a5bbf ia64: wire up mlock2 syscall
* linux/ia64/syscallent.h [1346]: Add mlock2 entry.
2015-12-18 20:55:40 +00:00
38a34c9349 Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't.  This
change fixes the inconsistency by adding missing copyright headers.

It doesn't mean that copyright headers became maintained.  In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
2015-12-17 17:56:48 +00:00
d1c663a2d0 tests/aio.c: include <time.h>
* tests/aio.c: Include <time.h> for struct timespec.

Reported-by: Szabolcs Nagy <nsz@port70.net>
2015-12-16 02:00:01 +00:00
4b08afdf05 mpers.sh: switch to DWARF version 2 format for better portability
* mpers.sh (CFLAGS): Replace -gdwarf-4 with -gdwarf-2.
2015-12-16 01:26:27 +00:00
d2bcb1639e mpers.awk: add support for DWARF version 2 format
* mpers.awk: Handle DW_AT_data_member_location in DWARF v2 format.
2015-12-16 01:25:10 +00:00
e67c8e44db Replace %Ld/%Lu printf format specifiers with %lld/%llu
As %Ld and %Lu printf format specifiers are not quite portable,
replace them with %lld and %llu, respectively.

* desc.c (SYS_FUNC(pselect6)): Replace %Lu with %llu.
* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Likewise.
* times.c (SYS_FUNC(times)): Likewise.
* fcntl.c (print_struct_flock64): Replace %Ld with %lld.
* tests/ftruncate.c (main): Replace %Lu with %llu.
* tests/ftruncate64.c (main): Likewise.
* tests/getdents.c (print_dirent): Likewise.
* tests/llseek.c (main): Likewise.
* tests/lseek.c (main): Likewise.
* tests/truncate.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/xstatx.c (main): Likewise.
* tests/pselect6.c (main): Replace %Ld with %lld.
* tests/xselect.c(main): Likewise.

Reported-by: Szabolcs Nagy <nsz@port70.net>
2015-12-16 00:07:16 +00:00
34683e3926 Fix SYS_FUNC and SEN macros for musl
The syscall_name argument was subject to macro expansion because
it was passed down to other macros before it was prefixed.

musl libc defines lfs64 names as macros (e.g. fstat64 as fstat)
so SYS_FUNC(fstat64) was expanded to sys_fstat.

This change adds the prefix before the name is passed to other macros,
i.e. the argument of SYS_FUNC_NAME is already prefixed with sys_.

* defs.h (SYS_FUNC): Add sys_ prefix to SYS_FUNC_NAME's argument.
(SYS_FUNC_NAME): Do not add sys_ prefix to MPERS_FUNC_NAME's argument.
* linux/ia64/syscallent.h (SYS_FUNC_NAME): Do not add sys_ prefix
to MPERS_FUNC_NAME's argument.
* syscall.c (SEN_NAME): Remove.
(SEN): Replace SEN_NAME call with its definition.  Add sys_ prefix
to SYS_FUNC_NAME's argument.
2015-12-16 00:06:59 +00:00
b6b38fa73b tests/times.test: workaround libc bug on x32
As glibc times wrapper on x32 is known to wrongly truncate and then sign
extend the syscall return value, invoke the syscall directly on x32.

* tests/times.c (main) [__NR_times && __x86_64__ && __ILP32__]:
Invoke times syscall using inline asm.
2015-12-15 23:34:03 +00:00
c4afd6dc7a mpers.awk: make fillers added to the output structure more predictable
* mpers.awk (array_seq): New function.
(what_is): Use it for printing filler names.  Tweak return types.
* mpers_test.sh: Use a more complicated sample type to test mpers
machinery.
2015-12-15 23:33:34 +00:00
54d18a279a Robustify mpers.awk against input containing index loops
Make mpers.awk check for potential index loops.  Such loops should not
normally happen, but mpers.awk will not go into infinite recursion if
they do.

* mpers.awk (enter, leave): New functions.
(what_is): Use them.
2015-12-15 03:35:26 +00:00
59992183a6 Robustify mpers.awk against invalid input
Make mpers.awk check that accessed elements of the main array that
are expected to have non-empty values really meet this requirement.

* mpers.awk (array_get): New function.
(what_is, END): Use it.
* mpers_test.sh: Use a more complicated type to test mpers machinery.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2015-12-15 02:04:38 +00:00
da126fbd77 Replace HAVE_LITTLE_ENDIAN_LONG_LONG with WORDS_BIGENDIAN
* defs.h: Use WORDS_BIGENDIAN instead of HAVE_LITTLE_ENDIAN_LONG_LONG.
* configure.ac (AC_LITTLE_ENDIAN_LONG_LONG): Remove.
* m4/long_long.m4: Remove.
2015-12-14 11:57:59 +00:00
ba70eb12b2 Remove unused parser of xmknod syscall
The last reference to this parser was removed by commit
v4.10-45-gdf4dd8b.

* mknod.c [SPARC || SPARC64] (SYS_FUNC(xmknod)): Remove.
2015-12-14 00:08:24 +00:00
703a7166ae tests/restart_syscall: add a workaround for old arm kernels
As arm kernels used to overwrite ARM_r0 with -EINTR after
ERESTART_RESTARTBLOCK, update regexp to workaround this.

* tests/restart_syscall.c (main) [__arm__]: Add 0xfffffffc as a valid
alternative value for the first argument of restarted nanosleep syscall.
2015-12-13 01:12:55 +00:00
2c2f663584 tests/.gitignore: add ksysent.h
tests/ksysent.h is a generated file listed in CLEANFILES.
This change complements commit v4.10-566-gbab4ef4.

* tests/.gitignore: Add ksysent.h.
2015-12-12 00:02:16 +00:00
90c7de66b9 aarch64: make arm registers unsigned
Follow the x86_64 example and define registers in arm_pt_regs
as unsigned, to avoid potential sign extension bugs.

This also fixes --enable-gcc-Werror build.

* linux/aarch64/arch_regs.c (arm_pt_regs): Change uregs's type
from int to uint32_t.

Reported-by: Sergey Bolshakov <sbolshakov@altlinux.org>
2015-12-11 10:52:42 +00:00
bab4ef4272 tests: add ksysent.test
Check that syscall names and numbers defined in syscallent files
match kernel __NR_* constants defined by <asm/unistd.h>.

Tested on various platforms, including the following combinations
of architectures and kernel headers:

x86_64: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.12, 3.11,
3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
i386: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.11,
3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
aarch64: 4.4-rc
alpha: 4.3
arm eabi: 4.4-rc, 4.2, 4.1
hppa: 3.18
ia64: 3.18
mips o32: 4.1
ppc: 3.18
ppc64: 3.10-rhel, 2.6.32-rhel
s390: 3.18
s390x: 3.18
sparc: 4.1
sparc: 3.18
x32: 3.19

The only platform which is known at this moment to fail the test
is CentOS-5 provided by OBS.  On x86_64 instance it fails with
error: "prlimit64" syscall #300 is "fanotify_init" in syscallent.h
and on i586 it similarly fails with
error: "prlimit64" syscall #338 is "fanotify_init" in syscallent.h
So this is a real platform bug that is not likely to be worked around
on the strace side.

* tests/ksysent.c: New file.
* tests/ksysent.sed: Likewise.
* tests/ksysent.test: New test.
* tests/Makefile.am (AM_CPPFLAGS): Add -I$(builddir).
(check_PROGRAMS): Add ksysent.
(TESTS): Add ksysent.test.
(EXTRA_DIST): Add ksysent.sed.
(ksysent.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add ksysent.h.
* tests/.gitignore: Add ksysent.
2015-12-10 02:06:25 +00:00
a5c16b8656 Document that syscall names match kernel __NR_* constants
* strace.1: Note syscall naming difference between architectures
and the rule of choosing the right syscall name in each case.
2015-12-09 15:59:15 +00:00
cdd2f84d8f ia64: print all ia32 syscalls using printargs
Printing of ia32 syscalls on ia64 must have been broken for a long time.
Do not pretend that it works, print ia32 syscalls using printargs
instead.

* linux/ia64/syscallent.h: Remove all redefinitions of sys_* macros.
Stop including"../dummy.h".  Include "../i386/syscallent.h" with
SYS_FUNC_NAME macro temporarily redirected to printargs.
2015-12-09 11:48:52 +00:00
232cf04c83 Fix build on architectures for which arch_sigreturn is not implemented
This complements commit 527b42ff8d.

* linux/arch_sigreturn.c (arch_sigreturn): Define.
2015-12-09 11:46:43 +00:00
c37173f76d aarch64: swap 64-bit and 32-bit personalities
Let native 64-bit personality be personality 0, and 32-bit personality
be personality 1, to follow the traditional layout used for other
architectures.

* defs.h [AARCH64]: Swap PERSONALITY0_WORDSIZE and
PERSONALITY1_WORDSIZE, remove DEFAULT_PERSONALITY.
[AARCH64 && HAVE_M32_MPERS]: Rename PERSONALITY1_* to PERSONALITY0_*.
* file.c [AARCH64 || defined X86_64 || defined X32]: Define
STAT32_PERSONALITY for AARCH64 as well.
* syscall.c (update_personality) [AARCH64]: Adjust PERSONALITY_NAMES.
* linux/aarch64/errnoent1.h: Adjust comment.
* linux/aarch64/get_error.c (get_error): Adjust tcp->currpers check.
* linux/aarch64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Likewise.
* linux/aarch64/get_scno.c (arch_get_scno): Adjust update_personality
invocations.
* linux/aarch64/ioctls_arch0.h: Swap with ...
* linux/aarch64/ioctls_arch1.h: ... this file.
* linux/aarch64/ioctls_inc0.h: Swap with ...
* linux/aarch64/ioctls_inc1.h: ... this file.
* linux/aarch64/syscallent.h: Swap with ...
* linux/aarch64/syscallent1.h: ... this file.
2015-12-09 01:09:11 +00:00
e3a2fe007b mips: fix fadvise64 syscall entries
* linux/mips/syscallent-n32.h [6216]: Change syscall handler
from fadvise64 to fadvise64_64.
* linux/mips/syscallent-n64.h [5215]: Rename from "fadvise64_64"
to "fadvise64"
* linux/mips/syscallent-o32.h [4254]: Likewise.
2015-12-08 22:35:26 +00:00
ebb38bc5bb xtensa: wire up syncfs syscall
* linux/xtensa/syscallent.h [179]: Add syncfs entry.
2015-12-08 21:19:53 +00:00
2b722e20c8 sh, sh64: fix syscall entries
* linux/sh/syscallent.h [322]: Fix timerfd_create entry.
* linux/sh64/syscallent.h [350]: Likewise.
[0]: Fix restart_syscall entry.
2015-12-08 21:19:53 +00:00
57dfe5f814 powerpc, powerpc64: wire up mlock2 syscall
* linux/powerpc/syscallent.h [378]: Add mlock2 entry.
* linux/powerpc64/syscallent.h: Likewise.
2015-12-08 21:19:53 +00:00
b506f78d02 hppa: fix syscall entries
* linux/hppa/syscallent.h: Swap [343] and [344] entries.
2015-12-08 21:19:53 +00:00
19a6d71915 avr32: update syscall entries
* linux/avr32/syscallent.h [0]: Rename from setup to restart_syscall.
[284 ... 320]: New entries.
2015-12-08 21:19:53 +00:00
8e7c92b6b7 m68k: fix syscall names
* linux/m68k/syscallent.h [335]: Rename "atomic_comxchg_32"
to "atomic_cmpxchg_32".
2015-12-08 21:19:53 +00:00
59a1586bcb sparc: update syscall names
* linux/sparc/syscallent.h [160]: Rename "sched_setaffinity"
to "sched_set_affinity".
[161]: Rename "sched_getaffinity" to "sched_get_affinity".
2015-12-08 21:19:53 +00:00
d4bb0ba7e8 powerpc, powerpc64: update syscall names
* linux/powerpc/syscallent.h [201]: Rename "MOL" to "multiplexer".
[225]: Rename "tux" to "tuxcall".
[256]: Rename "debug_setcontext" to "sys_debug_setcontext".
* linux/powerpc64/syscallent.h: Likewise.
2015-12-08 21:19:53 +00:00
a8b0ceffc2 alpha: update syscall entries
* linux/alpha/syscallent.h [224 ... 228]: Add stub entries.
[100]: Rename "osf_getpriority" to "getpriority".
[255]: Rename "osf_subsysinfo" to "osf_subsys_info".
[303]: Rename "adjtimex32" to "old_adjtimex".
[319]: Rename "sysctl" to "_sysctl".
[320]: Remove.
2015-12-08 21:19:53 +00:00
476ec393c3 Fix mmap syscall entries
Change syscall names to match kernel __NR_* constants.

* linux/avr32/syscallent.h [90]: Rename "mmap" to "mmap2".
* linux/bfin/syscallent.h [90]: Rename "old_mmap" to "mmap".
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* tests/mmap.c (main): Remove old_mmap from expected output.
* tests/mmap.test: Remove old_mmap from the list of mmap syscalls.
2015-12-08 21:19:43 +00:00
69b7307225 Fix select and _newselect syscall entries
Change syscall names to match kernel __NR_* constants.
This reverts commit ddcf54969d.

* linux/arm/syscallent.h [82]: Rename "oldselect" to "select".
[142]: Rename "select" to "_newselect".
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h [82]: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/hppa/syscallent.h [142]: Rename "select" to "_newselect".
* linux/mips/syscallent-n32.h [6022]: Rename "select" to "_newselect".
* linux/mips/syscallent-n64.h [5022]: Likewise.
* linux/mips/syscallent-o32.h [4142]: Likewise.
* linux/s390/syscallent.h [142]: Rename "select" to "_newselect".
* linux/sparc/syscallent.h [230]: Rename "select" to "_newselect".
* tests/oldselect.test: Rename oldselect to select.  Convert
from match_grep to match_diff.
* tests/oldselect.expected: Likewise.
* xselect.c: New file, based on select.c.
* tests/_newselect.c: New file.
* tests/select.c: Replace with a wrapper around xselect.c.
* tests/select.test: Parametrize.
* tests/_newselect.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add _newselect.
(TESTS): Add _newselect.test.
(EXTRA_DIST): Add xselect.c.
* tests/.gitignore: Add _newselect.
2015-12-08 21:19:40 +00:00
dd360922d1 Fix exit syscall entries
Change syscall names to match kernel __NR_* constants.

* linux/avr32/syscallent.h [1]: Rename "_exit" to "exit".
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h [60]: Rename "_exit" to "exit".
* linux/x86_64/syscallent.h: Likewise.
2015-12-08 21:19:35 +00:00
5090dde123 Fix pread64 and pwrite64 syscall entries
Change syscall names to match kernel __NR_* constants.

* linux/alpha/syscallent.h [349]: Rename "pread" to "pread64".
[350]: Rename "pwrite" to "pwrite64".
* linux/ia64/syscallent.h [1148]: Rename "pread" to "pread64".
[1149]: Rename "pwrite" to "pwrite64".
* linux/sh/syscallent.h [180]: Rename "pread" to "pread64".
[181]: Rename "pwrite" to "pwrite64".
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h [17]: Rename "pread" to "pread64".
[18]: Rename "pwrite" to "pwrite64".
* linux/x86_64/syscallent.h: Likewise.
2015-12-08 21:19:16 +00:00
718990f210 tests: sort the list of tests
* tests/Makefile.am (TESTS): Sort the list of regular tests.
* tests/.gitignore: Sort.
2015-12-08 19:07:24 +00:00
f04eeddbc5 ia64: fix remap_file_pages syscall entry
* linux/ia64/syscallent.h (1125): Set to remap_file_pages.
2015-12-08 04:16:15 +00:00
59281fc8a1 bfin, i386: remove sysentry for nonexistent security syscall
* linux/bfin/syscallent.h (223): Remove.
* linux/i386/syscallent.h: Likewise.
2015-12-08 02:51:02 +00:00
77c0cde116 build: add -D_FILE_OFFSET_BITS=64 to _CPPFLAGS instead of _CFLAGS
* tests/Makefile.am (fstat64_CFLAGS): Rename to fstat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(fstatat64_CFLAGS): Rename to fstatat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(ftruncate64_CFLAGS): Rename to ftruncate64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(lstat64_CFLAGS): Rename to lstat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(mmap64_CFLAGS): Rename to mmap64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(newfstatat_CFLAGS): Rename to newfstatat_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(stat64_CFLAGS): Rename to stat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(statfs_CFLAGS): Rename to statfs_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(truncate64_CFLAGS): Rename to truncate64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(uio_CFLAGS): Rename to uio_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
2015-12-08 00:29:42 +00:00
323cc92d60 Move x32 <asm/stat.h> replacement to x32 specific directory
As tests-m*32/Makefile.am files now refer to proper arch specific
directories, it's possible to relocate x32 <asm/stat.h> replacement
to its arch specific directory.

* linux/x86_64/asm_stat.h: Move ...
* linux/x32/asm_stat.h: ... here, remove x32 guard.
* Makefile.am (strace_SOURCES): Remove linux/x86_64/asm_stat.h.
2015-12-08 00:14:26 +00:00
860b3a692b build: set arch specific -m switches in tests-m*32/Makefile.am files properly
* tests/Makefile.am (ARCH_MFLAGS, AM_LDFLAGS): New variables.
(AM_CPPFLAGS): Use ARCH_MFLAGS.
* bootstrap: In tests-m32/Makefile.am and tests-mx32/Makefile.am,
add -m32 and -mx32, respectively, to ARCH_MFLAGS instead of AM_CFLAGS.
2015-12-08 00:14:10 +00:00
1e04e57a7a build: initialize ARCH variable in tests-m*32/Makefile.am files properly
* configure.ac (arch_m32): Set to sparc on sparc64, powerpc on
powerpc64, arm on aarch64, i386 on x86_64 and x32, $arch in other cases.
(arch_mx32): Set to x32 on x86_64, $arch in other cases.
(AC_SUBST): Add arch_m32 and arch_mx32.
* bootstrap: Substitute @arch@ with @arch_m32@ in tests-m32/Makefile.am.
Substitute @arch@ with @arch_mx32@ in tests-mx32/Makefile.am.
2015-12-08 00:13:38 +00:00
08a178366a tests: add umount.test and umount2.test
* tests/umount.c: New file.
* tests/umount2.c: Likewise.
* tests/umount.test: New test.
* tests/umount2.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add umount and umount2.
(TESTS): Add umount.test and umount2.test.
* tests/.gitignore: Add umount and umount2.
2015-12-07 01:23:39 +00:00
6a8095eaed avr32: fix umount2 syscall entry
* linux/avr32/syscallent.h: Rename umount to umount2.
2015-12-07 00:38:43 +00:00
97af1be4c6 Update umount2 flags
* umount.c (MNT_FORCE, MNT_DETACH, MNT_EXPIRE): Move definitions ...
* xlat/umount_flags.in: ... here.  Add UMOUNT_NOFOLLOW.
2015-12-07 00:38:38 +00:00
431d7fd21a Print the first argument of umount2 syscall as a path
* umount.c (SYS_FUNC(umount2)): Use printpath instead of printstr.

This fixes Debian bug #785050.
2015-12-07 00:10:58 +00:00
eb76c4be15 prctl: add PR_CAP_AMBIENT parser
* xlat/pr_cap_ambient.in: New file.
* prctl.c: Include "xlat/pr_cap_ambient.h".
(SYS_FUNC(prctl)): Handle PR_CAP_AMBIENT.
2015-12-06 15:33:53 +00:00
1b283307d1 prctl: finish decoding of several commands on entering syscall
* prctl.c (SYS_FUNC(prctl)): Return RVAL_DECODED after decoding of
PR_GET_DUMPABLE, PR_GET_KEEPCAPS, PR_GET_SECCOMP, PR_GET_TIMERSLACK,
PR_GET_TIMING, and PR_CAPBSET_READ commands.
2015-12-06 15:29:04 +00:00
b165910f98 Fix build on systems that lack EM_FRV definition
* xlat/audit_arch.in: Guard AUDIT_ARCH_FRV with EM_FRV check.
2015-12-06 15:13:01 +00:00
4bbed305da times.test: workaround buggy libc
* tests/times.c: Include <sys/syscall.h>.
(main): On systems where user's and kernel's long types are the same,
prefer direct times syscall over libc's times function because
the latter is more prone to return value truncation.
2015-12-06 07:59:20 +00:00
fc0a22d40b times.test: reduce cpu time consumption, increase struct tms diversity
* tests/times.c (main): Reduce cpu time consumption fourfold,
make the parent process consume less cpu time than the child process
so that members of the structure returned by times syscall would be
more likely to contain different values.
2015-12-06 07:24:16 +00:00
bb509aafb6 mips n32, x32: fix printing of times syscall return value
As times syscall returns kernel's long value, it has to be printed as
RVAL_LUDECIMAL on systems where long type is less than kernel's long.

* times.c (SYS_FUNC(times)) [RVAL_LUDECIMAL && !IN_MPERS]:
Return RVAL_LUDECIMAL instead of RVAL_UDECIMAL.
2015-12-06 07:24:16 +00:00
4f109266ec unix-yy.test: fix portability issue
* tests/unix-yy-connect.awk (r_close_listen): Quote square brackets
that are not part of a bracket expression.
2015-12-06 07:24:16 +00:00
02d92d095c inet-cmsg.test: skip the test when the network is not functional
* tests/inet-cmsg.c (main): Return 77 if inet datagram socket
cannot be bound to INADDR_LOOPBACK.
2015-12-06 01:02:17 +00:00
2154702865 fcntl: skip F_GETLK64, F_SETLK64, and F_SETLKW64 in fcntl syscall parser
As the kernel recognizes F_GETLK64, F_SETLK64, and F_SETLKW64 commands
in fcntl64 syscall only, do not parse their structures in fcntl parser.

* xlat/fcntlcmds.in: Move F_GETLK64, F_SETLK64, and F_SETLKW64 ...
* xlat/fcntl64cmds.in: ... here.
* fcntl.c: Include "xlat/fcntl64cmds.h".
(print_fcntl): Move printing of first two syscall arguments
and handling of F_GETLK64, F_SETLK64, and F_SETLKW64 commands ...
(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): ... here.
* tests/fcntl.c: New file, based on struct_flock.c.
* tests/fcntl64.c: Likewise.
* tests/struct_flock.c (test_flock_einval, create_sample): New functions.
(test_flock): Use test_flock_einval.
(test_flock64, main): Remove.
* tests/fcntl.test: New test.
* tests/fcntl64.test: Likewise.
* tests/struct_flock.test: Remove.
* tests/Makefile.am (check_PROGRAMS): Add fcntl and fcntl64,
remove struct_flock.
(TESTS): Add fcntl.test and fcntl64.test, remove struct_flock.test.
(EXTRA_DIST) Add struct_flock.c.
* tests/.gitignore: Add fcntl and fcntl64, remove struct_flock.
2015-12-05 19:35:51 +00:00
03202dac48 print_fcntl: finish with unrecognized commands on entering syscall
* fcntl.c (print_fcntl): Merge two switch statements.
2015-12-05 17:54:26 +00:00
211d6ef4b6 fcntl: create a separate parser for fcntl64 syscall
* fcntl.c(print_fcntl): New function, made from SYS_FUNC(fcntl).
(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use it.
* linux/32/syscallent.h: Change parser of fcntl64 to SEN(fcntl64).
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2015-12-04 23:12:14 +00:00
c9d2501a36 travis-ci: add build matrix 2015-12-05 00:04:12 +00:00
144a9db236 tests: replace old stat tests with stat.test and stat64.test
* tests/stat.c: Replace with a wrapper around lstatx.c
* tests/stat.test: Replace with a wrapper around statx.sh.
* tests/stat32-v.test: Remove.
* tests/stat32.c: Remove.
* tests/stat64-v.test: Remove.
* tests/stat64.c: New file.
* tests/stat64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Replace stat32 with stat64.
(stat_CFLAGS): Rename to stat64_CFLAGS.
(TESTS): Replace stat32-v.test and stat64-v.test with stat64.test.
* tests/.gitignore: Replace stat32 with stat64.
2015-12-05 00:03:49 +00:00
38e37686f2 tests: add lstat.test and lstat64.test
* tests/lstat.c: New file.
* tests/lstat64.c: Likewise.
* tests/lstatx.c: Likewise.
* tests/lstat.test: New test.
* tests/lstat64.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add lstat and lstat64.
(lstat64_CFLAGS): Define.
(TESTS): Add lstat.test and lstat64.test.
(EXTRA_DIST): Add lstatx.c.
* tests/.gitignore: Add lstat and lstat64.
2015-12-05 00:03:02 +00:00
c863827ddb tests: add fstat.test and fstat64.test
* tests/fstat.c: New file.
* tests/fstat64.c: Likewise.
* tests/fstatx.c: Likewise.
* tests/fstat.test: New test.
* tests/fstat64.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add fstat and fstat64.
(fstat64_CFLAGS): Define.
(TESTS): Add fstat.test and fstat64.test.
(EXTRA_DIST): Add fstatx.c.
* tests/.gitignore: Add fstat and fstat64.
2015-12-05 00:02:44 +00:00
cc2baf339f tests: prepare for detailed testing of stat family syscalls
Parametrize code from fstatat.c to support <asm/stat.h>
as an alternative to <sys/stat.h> and move it to a separate file.

* tests/statx.sh: New file, based on fstatat64.test.
* tests/fstatat64.test: Use it.
* tests/newfstatat.test: Likewise.
* tests/xstatx.c: New file, based on fstatat.c.
* tests/fstatat.c: Use it.
* tests/Makefile.am (EXTRA_DIST): Add statx.sh and xstatx.c.
* tests/fstatat64.c (FSTATAT_NAME): Change to TEST_SYSCALL_NAME.
* tests/newfstatat.c: Likewise.
2015-12-05 00:01:56 +00:00
8b6046a052 ioctl: allow to stop decoding number
For some ioctls, like from drm, the identification of the correct ioctl
is done by custom code.  Specifying IOCTL_NUMBER_STOP_LOOKUP on
return of ioctl_decode_command_number() disables further calls to
ioctl_lookup().

* defs.h (IOCTL_NUMBER_UNKNOWN, IOCTL_NUMBER_HANDLED,
IOCTL_NUMBER_STOP_LOOKUP): Add macros representing ioctl number state
decoding.
* ioctl.c (SYS_FUNC(ioctl)): Skip ioctl_lookup() when
ioctl_decode_command_number() returns a value with
IOCTL_NUMBER_STOP_LOOKUP flag is set.

Suggested-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-12-04 18:05:38 +00:00
5421855219 tests: skip restart_syscall.test on x32
The syscall number of restart_syscall returned by the kernel in case
of ERESTART_RESTARTBLOCK is broken on x32 from the beginning, see
https://lkml.org/lkml/2015/11/30/790

Until that improves, skip the test on x32.

* tests/restart_syscall.c (main) [__x86_64__ && __ILP32__]: Return 77.
2015-12-04 16:57:23 +00:00
a5aa080ae6 x32: fix decoding of i386 personality lseek syscall
On x32, tcp->ext_arg is not initialized for i386 personality,
so tcp->u_arg has to be used instead.

* lseek.c (SYS_FUNC(lseek)) [X32]: Handle "current_personality == 1" case.
2015-12-04 16:42:30 +00:00
cfde1e3f0f x86_64, x32: add a replacement for <asm/stat.h>
Some old kernel headers, Ubuntu 14.04 in particular, provide
<asm/stat.h> editions that are completely wrong for x32.
Workaround this issue by providing a replacement.

* linux/x86_64/asm_stat.h: New file.
* linux/x32/asm_stat.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
2015-12-04 15:22:58 +00:00
c31481fc68 Add a wrapper around <asm/stat.h>
* linux/asm_stat.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Use it.
2015-12-04 15:03:12 +00:00
5627cf9080 kernel_types.h: protect from double inclusion
* kernel_types.h: Add #include guard.
2015-12-04 14:32:52 +00:00
530d462783 fstatat64.test: lift /proc requirement
While -P option needs /proc to match descriptors, it does not use
/proc to match pathnames.  As this test does not need descriptor
match, the /proc requirement can be safely lifted.

* tests/fstatat64.test: Lift /proc/self/fd/ requirement.
2015-12-03 15:48:43 +00:00
b0e61152ca tests: add fstatat64.test and newfstatat.test
* configure.ac (AC_CHECK_FUNCS): Add fstatat, ftruncate, and futimens.
* tests/fstatat.c: New file.
* tests/fstatat64.c: Likewise.
* tests/newfstatat.c: Likewise.
* tests/fstatat64.test: New test.
* tests/newfstatat.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add fstatat64 and newfstatat.
(fstatat64_CFLAGS, newstatat_CFLAGS): Define.
(TESTS): Add fstatat64.test and newfstatat.test.
(EXTRA_DIST): Add fstatat.c.
* tests/.gitignore: Add fstatat64 and newfstatat.
2015-12-02 01:02:39 +00:00
84940d4892 alpha, ppc, sh, sh64: fix fstatat64 syscall entries
* linux/alpha/syscallent.h (newfstatat): Change sys_name to fstatat64.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
2015-12-01 11:35:21 +00:00
fdb3544ef2 ppc64: clone syscallent.h from ppc
* linux/powerpc64/syscallent.h: Clone from linux/powerpc/syscallent.h
with entries for numbers 192..197, 204, 226, and 254 unassigned.
2015-12-01 11:28:43 +00:00
9db0797b22 tests: add lseek.test and llseek.test
* tests/llseek.c: New file.
* tests/lseek.c: Likewise.
* tests/llseek.test: New test.
* tests/lseek.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add llseek and lseek.
(TESTS): Add llseek.test and lseek.test.
* tests/.gitignore: Add llseek and lseek.
2015-12-01 08:29:12 +00:00
431d63c13f tests: add ftruncate64.test and truncate64.test
* tests/ftruncate64.c: New file.
* tests/truncate64.c: Likewise.
* tests/ftruncate64.test: New test.
* tests/truncate64.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add ftruncate64 and truncate64.
(ftruncate64_CFLAGS, truncate64_CFLAGS): Define.
(TESTS): Add ftruncate64.test and truncate64.test.
* tests/.gitignore: Add ftruncate64 and truncate64.
2015-12-01 08:28:45 +00:00
c1bb87a99d tests: add ftruncate.test and truncate.test
* tests/ftruncate.c: New file.
* tests/truncate.c: Likewise.
* tests/ftruncate.test: New test.
* tests/truncate.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add ftruncate and truncate.
(TESTS): Add ftruncate.test and truncate.test.
* tests/.gitignore: Add ftruncate and truncate.
2015-12-01 08:28:42 +00:00
170a4cfe1c build: robustify linux/fcntl.h check
* configure.ac (AC_CHECK_TYPES): Support older linux kernel headers
by including <sys/types.h> before <linux/fcntl.h>.
2015-11-30 16:20:19 +00:00
7386ca7a07 syscall.c: move inclusion of arch specific files to the end of file
Move inclusion of arch specific files that define static functions to
the end of syscall.c.

* syscall.c (get_syscall_result_regs, get_error, getregs_old):
New forward declarations.
(arch_get_scno): Move forward.
Move inclusion of "get_scno.c", "get_syscall_args.c",
"get_syscall_result.c", "get_error.c", and "getregs_old.c"
to the end of file.
2015-11-30 15:31:30 +00:00
f3e9e61d78 x86_64: change getregs_old to forward ptrace return code
* linux/x86_64/getregs_old.c (getregs_old): Change to return ptrace
return code.
* syscall.c (get_regs) [ARCH_REGS_FOR_GETREGSET && X86_64]: Use
getregs_old return code.
2015-11-30 15:30:05 +00:00
5105d4ac96 Cleanup print_pc
Apparently, there are only two types of instruction pointer printers
depending on the architecture: those that print a register that was
fetched earlier, and those that fetch a register themselves using upeek.
With this change, architectures of the first type have ARCH_PC_REG
defined in their arch_regs.c file, architectures of the first type
have ARCH_PC_PEEK_ADDR defined there, and the common code in syscall.c
uses these macros to print the instruction pointer.

* Makefile.am (EXTRA_DIST): Remove linux/*/print_pc.c.
* linux/*/print_pc.c: Remove.
* linux/aarch64/arch_regs.c(ARCH_PC_REG): Define macro.
* linux/arc/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/arm/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/avr32/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/i386/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/ia64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/metag/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/mips/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/nios2/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/or1k/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/powerpc64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/powerpc/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/s390/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/s390x/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/sparc64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/sparc/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/tile/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/x32/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/x86_64/arch_regs.c(ARCH_PC_REG): Likewise.
* linux/alpha/arch_regs.c(ARCH_PC_PEEK_ADDR): Define macro.
* linux/bfin/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/crisv10/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/crisv32/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/hppa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/m68k/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/microblaze/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/sh64/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/sh/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* linux/xtensa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
* syscall.c (print_pc): Stop including "print_pc.c".
Use ARCH_PC_REG or ARCH_PC_PEEK_ADDR.
2015-11-30 03:30:51 +00:00
16510517f1 cleanup: make get_scno.c files more readable
Make get_scno.c files more self-contained.  While they are still
being included by syscall.c, the latter no longer provides
a function framework for them.

* linux/aarch64/get_scno.c (arch_get_scno): Define.
* linux/alpha/get_scno.c: Likewise.
* linux/arc/get_scno.c: Likewise.
* linux/arm/get_scno.c: Likewise.
* linux/avr32/get_scno.c: Likewise.
* linux/bfin/get_scno.c: Likewise.
* linux/crisv10/get_scno.c: Likewise.
* linux/hppa/get_scno.c: Likewise.
* linux/i386/get_scno.c: Likewise.
* linux/ia64/get_scno.c: Likewise.
* linux/m68k/get_scno.c: Likewise.
* linux/metag/get_scno.c: Likewise.
* linux/microblaze/get_scno.c: Likewise.
* linux/mips/get_scno.c: Likewise.
* linux/nios2/get_scno.c: Likewise.
* linux/or1k/get_scno.c: Likewise.
* linux/powerpc/get_scno.c: Likewise.
* linux/powerpc64/get_scno.c: Likewise.
* linux/s390/get_scno.c: Likewise.
* linux/sh/get_scno.c: Likewise.
* linux/sh64/get_scno.c: Likewise.
* linux/sparc/get_scno.c: Likewise.
* linux/sparc64/get_scno.c: Likewise.
* linux/tile/get_scno.c: Likewise.
* linux/x86_64/get_scno.c: Likewise.
* linux/xtensa/get_scno.c: Likewise.
* syscall.c (arch_get_scno): New declaration.
Include "get_scno.c" in file scope.
(get_scno): Use arch_get_scno.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-30 01:46:52 +00:00
64672a6526 cleanup: make get_syscall_args.c files more readable
Make get_syscall_args.c files more self-contained.  While they are
still being included by syscall.c, the latter no longer defines
get_syscall_args function.

* linux/aarch64/get_syscall_args.c: Include "arm/get_syscall_args.c"
with get_syscall_args temporarily defined to arm_get_syscall_args.
(get_syscall_args): Define.
* linux/alpha/get_syscall_args.c (get_syscall_args): Define.
* linux/arc/get_syscall_args.c: Likewise.
* linux/arm/get_syscall_args.c: Likewise.
* linux/avr32/get_syscall_args.c: Likewise.
* linux/bfin/get_syscall_args.c: Likewise.
* linux/crisv10/get_syscall_args.c: Likewise.
* linux/hppa/get_syscall_args.c: Likewise.
* linux/i386/get_syscall_args.c: Likewise.
* linux/ia64/get_syscall_args.c: Likewise.
* linux/m68k/get_syscall_args.c: Likewise.
* linux/metag/get_syscall_args.c: Likewise.
* linux/microblaze/get_syscall_args.c: Likewise.
* linux/mips/get_syscall_args.c: Likewise.
* linux/nios2/get_syscall_args.c: Likewise.
* linux/or1k/get_syscall_args.c: Likewise.
* linux/powerpc/get_syscall_args.c: Likewise.
* linux/s390/get_syscall_args.c: Likewise.
* linux/sh/get_syscall_args.c: Likewise.
* linux/sh64/get_syscall_args.c: Likewise.
* linux/sparc/get_syscall_args.c: Likewise.
* linux/tile/get_syscall_args.c: Likewise.
* linux/x86_64/get_syscall_args.c: Likewise.
* linux/xtensa/get_syscall_args.c: Likewise.
* syscall.c (get_syscall_args): Remove.
Include "get_syscall_args.c" in file scope.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-30 00:57:14 +00:00
f51aec6abf cleanup: make get_syscall_result.c files more readable
Make get_syscall_result.c files more self-contained.  While they are
still being included by syscall.c, the latter no longer provides
a function framework for them.

* linux/alpha/get_syscall_result.c (get_syscall_result_regs): Define.
* linux/bfin/get_syscall_result.c: Likewise.
* linux/crisv10/get_syscall_result.c: Likewise.
* linux/hppa/get_syscall_result.c: Likewise.
* linux/m68k/get_syscall_result.c: Likewise.
* linux/microblaze/get_syscall_result.c: Likewise.
* linux/sh/get_syscall_result.c: Likewise.
* linux/sh64/get_syscall_result.c: Likewise.
* linux/xtensa/get_syscall_result.c: Likewise.
* syscall.c [!ARCH_REGS_FOR_GETREGSET && !ARCH_REGS_FOR_GETREGS]:
Define USE_GET_SYSCALL_RESULT_REGS macro.
[USE_GET_SYSCALL_RESULT_REGS]: Include "get_syscall_result.c".
(get_syscall_result) [USE_GET_SYSCALL_RESULT_REGS]: Stop including
"get_syscall_result.c".  Call get_syscall_result_regs.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-30 00:01:01 +00:00
0c8c5c9f4e cleanup: make get_error.c files more readable
Make get_error.c files more self-sustained.  While they are still being
included by syscall.c, the latter no longer defines get_error function.

* linux/aarch64/get_error.c: Include "arm/get_error.c" with get_error
temporarily defined to arm_get_error.
(get_error): Define.
* linux/alpha/get_error.c (get_error): Define.
* linux/arc/get_error.c: Likewise.
* linux/arm/get_error.c: Likewise.
* linux/avr32/get_error.c: Likewise.
* linux/bfin/get_error.c: Likewise.
* linux/crisv10/get_error.c: Likewise.
* linux/hppa/get_error.c: Likewise.
* linux/i386/get_error.c: Likewise.
* linux/ia64/get_error.c: Likewise.
* linux/m68k/get_error.c: Likewise.
* linux/metag/get_error.c: Likewise.
* linux/microblaze/get_error.c: Likewise.
* linux/mips/get_error.c: Likewise.
* linux/nios2/get_error.c: Likewise.
* linux/or1k/get_error.c: Likewise.
* linux/powerpc/get_error.c: Likewise.
* linux/s390/get_error.c: Likewise.
* linux/sh/get_error.c: Likewise.
* linux/sh64/get_error.c: Likewise.
* linux/sparc/get_error.c: Likewise.
* linux/sparc64/get_error.c: Likewise.
* linux/tile/get_error.c: Likewise.
* linux/x86_64/get_error.c: Likewise.
* linux/xtensa/get_error.c: Likewise.
* syscall.c: Include "get_error.c" in file scope.
(get_error): Remove.  Move arch independent code ...
(get_syscall_result): ... here.  Update get_error invocation.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-29 00:06:45 +00:00
527b42ff8d cleanup: make arch_sigreturn.c files more readable
Make arch_sigreturn.c files more self-sustained.  While they are
still being included by sigreturn.c, the latter no longer defines
arch_sigreturn function.

* linux/alpha/arch_sigreturn.c (arch_sigreturn): Define.
* linux/arm/arch_sigreturn.c: Likewise.
* linux/crisv10/arch_sigreturn.c: Likewise.
* linux/i386/arch_sigreturn.c: Likewise.
* linux/ia64/arch_sigreturn.c: Likewise.
* linux/m68k/arch_sigreturn.c: Likewise.
* linux/microblaze/arch_sigreturn.c: Likewise.
* linux/mips/arch_sigreturn.c: Likewise.
* linux/powerpc/arch_sigreturn.c: Likewise.
* linux/s390/arch_sigreturn.c: Likewise.
* linux/sparc/arch_sigreturn.c: Likewise.
* linux/tile/arch_sigreturn.c: Likewise.
* linux/x32/arch_sigreturn.c: Remove code.
Include "x86_64/arch_sigreturn.c".
* linux/x86_64/arch_sigreturn.c: Stop including "x32/arch_sigreturn.c".
Include "i386/arch_sigreturn.c" with arch_sigreturn temporarily defined
to i386_arch_sigreturn.
(arch_sigreturn): Define.  Add x32 personality support there.
* sigreturn.c: Remove arch_sigreturn header and footer.

Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-11-28 02:58:29 +00:00
690235ab0f Add initial Travis CI support
* .travis.yml: New file.
* travis-ci.sh: Likewise.
2015-11-26 17:07:33 +00:00
e8199b25e0 tests: remove temporary files left after two tests
* tests/net-yy.test: Remove "$LOG"-connect and "$LOG"-accept.
* tests/unix-yy.test: Likewise.
2015-11-27 17:24:46 +00:00
2400e9ea54 tests: skip stat32-v.test on x32
Explicitly skip 32-bit stat test on x32 even if libc pretends
to support it.

* tests/stat.c (main) [__x86_64__ && __ILP32__]: Skip.
2015-11-27 17:06:38 +00:00
0ca438d13b tests: fix ipc_msgbuf.test on x32
* tests/ipc_msgbuf.c: Include "config.h" and "kernel_types.h".
(main): Replace "long" with "kernel_long_t" in struct msgbuf.
2015-11-27 14:15:30 +00:00
4408e8595c x32: fix pselect6 decoding
* desc.c: Include "kernel_types.h".
(umove_kulong_array_or_printaddr): New function.
(SYS_FUNC(pselect6)): Use it.
2015-11-27 04:37:46 +00:00
26207512e2 x32: fix sigreturn decoding
* linux/x32/arch_sigreturn.c: Implement x32_rt_sigreturn decoding.
* linux/x86_64/arch_sigreturn.c: Handle (current_personality == 0)
case only.
Include "x32/arch_sigreturn.c" instead of "i386/arch_sigreturn.c".
2015-11-27 03:34:23 +00:00
bdb07e38dd x32: fix struct dirent decoding
* kernel_types.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_TYPES): Check for __kernel_long_t
and __kernel_ulong_t in <asm/posix_types.h>.
* dirent.c: Stop including <dirent.h>.
(kernel_dirent): Remove.
Include "kernel_types.h".
(print_old_dirent, SYS_FUNC(getdents)): Print variables
of kernel_ulong_t type using %Lu format.
* syscall.c (kernel_long_t, kernel_ulong_t): Remove.
Include "kernel_types.h".
* tests/getdents.c (kernel_dirent): Remove.
Include "kernel_types.h".
(print_dirent): Print variables of kernel_ulong_t type using %Lu format.
2015-11-27 01:51:22 +00:00
a2fdfe96d5 Refer to -h on incorrect usage
* defs.h (error_msg_and_help): New prototype.
* strace.c (error_msg_and_help): New function.
(error_opt_arg, init): Use it.
(usage): Remove unnecessary arguments.
* count.c: Use the new function.
2015-11-27 02:38:59 +03:00
3272d2902c Rearrange flags descriptions in the usage text
* strace.c (usage): Rearrange descriptions.
* tests/strace-k.test: Change the option detecting regexp accordingly.
2015-11-27 02:38:57 +03:00
4f7db9ac82 tests: run in "set -x" mode if VERBOSE variable is non-null
* tests/init.sh: Enter "set -x" mode if $VERBOSE is non-null.
2015-11-26 21:25:31 +00:00
9c40599755 tests: fix match_diff usage
Fix argument order in match_diff invocations:
the first argument has to be actual output,
the second argument has to be expected output.

* tests/aio.test: Swap match_diff arguments.
* tests/clock_nanosleep.test: Likewise.
* tests/clock_xettime.test: Likewise.
* tests/file_handle.test: Likewise.
* tests/getdents.test: Likewise.
* tests/getdents64.test: Likewise.
* tests/getrandom.test: Likewise.
* tests/inet-cmsg.test: Likewise.
* tests/ioctl.test: Likewise.
* tests/membarrier.test: Likewise.
* tests/mlock2.test: Likewise.
* tests/nanosleep.test: Likewise.
* tests/pselect6.test: Likewise.
* tests/readdir.test: Likewise.
* tests/readlink.test: Likewise.
* tests/readlinkat.test: Likewise.
* tests/rt_sigqueueinfo.test: Likewise.
* tests/seccomp.test: Likewise.
* tests/select.test: Likewise.
* tests/sendfile.test: Likewise.
* tests/sendfile64.test: Likewise.
* tests/struct_flock.test: Likewise.
* tests/sysinfo.test: Likewise.
* tests/time.test: Likewise.
* tests/timer_create.test: Likewise.
* tests/timer_xettime.test: Likewise.
* tests/timerfd_xettime.test: Likewise.
* tests/times-fail.test: Likewise.
* tests/times.test: Likewise.
* tests/umovestr2.test: Likewise.
* tests/userfaultfd.test: Likewise.
* tests/utime.test: Likewise.
* tests/utimensat.test: Likewise.
* tests/xet_robust_list.test: Likewise.
* tests/xetitimer.test: Likewise.
* tests/xettimeofday.test: Likewise.
2015-11-26 20:36:35 +00:00
c6e5e2c134 x86_64: fix x32 personality support in print_llu_from_low_high_val
x86 is the only personality supported on x86_64
that has 32-bit syscall arguments.

* io.c (print_llu_from_low_high_val) [X86_64]: Fix
current_personality == 2 case.
2015-11-26 20:29:25 +00:00
6974c91c02 x86_64: fix x32 personality support in getllval
x86 is the only personality supported on x86_64
that has 32-bit syscall arguments.

* util.c (getllval) [X86_64]: Fix current_personality == 2 case.
2015-11-26 18:25:34 +00:00
4c65ff00ee tests/file_handle: fix expected output
* tests/file_handle.c (main): Parametrize handle_type
in open_by_handle_at parser output.
2015-11-26 16:49:39 +00:00
bb746ff803 startup_attach: fix compilation warning
* strace.c (startup_attach): Split single error_msg statement with
variable number of arguments to silence a compilation warning.
2015-11-26 01:56:44 +00:00
db9af94715 .gitignore: add mpers_xlat.h
Ignore mpers_xlat.h generated since commit v4.10-454-g5cb45b2.

* .gitignore: Add /mpers_xlat.h.

Reported-by: Elvira Khabirova <lineprinter0@gmail.com>
2015-11-26 01:49:36 +00:00
cc1e149be9 tests: add struct_flock.test
* tests/struct_flock.c: New file.
* tests/struct_flock.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add struct_flock.
(TESTS): Add struct_flock.test.
* tests/.gitignore: Add struct_flock.
2015-11-26 01:37:35 +00:00
1a713d9c8e Convert parsers of flock structures to new mpers infrastructure
* fetch_struct_flock.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* fcntl.c (print_struct_flock64): New function.
(printflock64): Use fetch_struct_flock64 and print_struct_flock64.
(printflock): Use fetch_struct_flock and print_struct_flock64.
2015-11-26 01:37:34 +00:00
c7c5270966 fcntl.c: implement decoding for all known operations
* xlat/f_owner_types.in: New file.
* xlat/f_seals.in: Likewise.
* fcntl.c: Include "xlat/f_owner_types.h" and "xlat/f_seals.h".
(print_f_owner_ex): New function.
(SYS_FUNC(fcntl)): Use it.
Handle F_SETPIPE_SZ, F_GETPIPE_SZ, F_OFD_SETLKW,
F_OFD_SETLK, F_SETOWN_EX, F_ADD_SEALS, F_SETSIG,
F_OFD_GETLK, F_GETOWN_EX, F_GET_SEALS, F_GETSIG.
2015-11-26 01:37:34 +00:00
46129c998a fcntl.c: mark F_DUPFD and F_DUPFD_CLOEXEC return code with RVAL_FD flag
* fcntl.c (SYS_FUNC(fcntl)): Set RVAL_FD flag in the return code
for F_DUPFD and F_DUPFD_CLOEXEC operations.
2015-11-26 01:37:34 +00:00
5cad846407 fcntl.c: remove redundant ifdefs
* fcntl.c (USE_PRINTFLOCK64): Remove macro.
(printflock64): Define unconditionally.
(SYS_FUNC(fcntl)): Do not check for USE_PRINTFLOCK64,
F_DUPFD_CLOEXEC, F_NOTIFY, F_SETLEASE, and F_GETLEASE macros.
2015-11-26 01:37:34 +00:00
bcc73975fd Update F_* constants
* xlat/fcntlcmds.in: Add F_SETOWN_EX, F_GETOWN_EX, F_GETOWNER_UIDS,
F_OFD_GETLK, F_OFD_SETLK, F_OFD_SETLKW, and F_CANCELLK.
Remove F_ALLOCSP, F_BLKSIZE, F_BLOCKS, F_CHKFL, F_CNVT, F_DUP2FD,
F_ISSTREAM, F_NPRIV, F_PRIV, F_QUOTACL, F_REVOKE, F_RGETLK, F_RSETLK,
F_RSETLKW, F_SHARE, and F_UNSHARE.
Add default values.
2015-11-26 01:37:34 +00:00
db62a712f9 Update LOCK_* constants
* xlat/flockcmds.in: Add LOCK_MAND, LOCK_READ, LOCK_WRITE, and LOCK_RW.
Add default values.
2015-11-26 01:37:34 +00:00
6250e6c5ed fcntl.c: use <linux/fcntl.h> instead of <fcntl.h>
Include <linux/fcntl.h> for proper definitions of F_* constants
and flock structures.

* configure.ac (AC_CHECK_TYPES): Check for struct flock, struct flock64,
struct __kernel_flock, and struct __kernel_flock64 in <linux/fcntl.h>.
* flock.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* fcntl.c: Include it instead of <fcntl.h>.
(struct flock64): Remove.
(printflock): Use struct_kernel_flock instead of struct flock.
(printflock64): Use struct_kernel_flock64 instead of struct flock64.
2015-11-26 01:37:34 +00:00
a5ffa18f13 mpers: fix compound types with arbitrary member alignments
* mpers.sh: Compound types are now represented as packed
with character arrays as explicit fillers inbetween members
and at the end.
2015-11-26 01:37:34 +00:00
ba10a421b8 Support C libraries without System V shared memory/ipc
Some systems (like Bionic) omit support for SysV related code.  That
means no C library headers for strace to include.  Add configure tests
to probe the headers from the kernel and use them when they are
available.

It might make more sense to never rely on the C library's headers as
there is no guarantee or requirement that the structure layout between
apps and the C library match that what is passed to the kernel.

* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
on what is available.
* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
Fallback to <linux/msg.h> when available.
* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
based on what is available.  Note missing support for old ipc structs.
* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
on what is available.  Only decode sembuf when available.
* ipc_shm.c: Fallback to <linux/shm.h> when available.
* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
based on what is available.  Note missing support for old ipc structs.
* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
2015-11-26 01:36:58 +00:00
3422849673 CREDITS.in: add Jian Zhen
Thanks to Jian Zhen for donation of https://github.com/strace/ and
strace.io.

* CREDITS.in: Add Jian Zhen.
2015-11-25 19:10:56 +00:00
329288b6f9 Fix syscall entries of unimplemented getpmsg and putpmsg syscalls
* linux/ia64/syscallent.h (getpmsg): Change SEN(printargs)
to SEN(getpmsg).
(putpmsg): Change SEN(printargs) to SEN(putpmsg).
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/arm/syscallent.h (getpmsg, putpmsg): Set sys_flags to TN.
* linux/bfin/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/hppa/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/i386/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/m68k/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/microblaze/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/powerpc/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/s390/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/s390x/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/x32/syscallent.h (getpmsg, putpmsg): Likewise.
* linux/x86_64/syscallent.h (getpmsg, putpmsg): Likewise.
2015-11-24 02:50:40 +00:00
a56a81c1ec Remove parsers of getpmsg and putpmsg syscalls
These system calls are not implemented in the Linux kernel.

* linux/dummy.h(getpmsg, putpmsg): Move to the list of deprecated
syscalls.
* Makefile.am (strace_SOURCES): Remove stream.c.
* stream.c: Remove.
* xlat/pmsgflags.in: Remove.
2015-11-24 02:42:38 +00:00
aae525f94e Remove parser of query_module syscall
Since query_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: Do not include <sys/*>, "xlat/qm_which.h",
and "xlat/modflags.h".
(MOD_*, QM_*, module_symbol, module_info, SYS_FUNC(query_module)):
Remove.
* linux/dummy.h (sys_query_module): Add stub alias.
* xlat/modflags.in: Remove.
* xlat/qm_which.in: Remove.
2015-11-24 02:30:45 +00:00
25cb5cb04f Fix syscall entries of deprecated sysfs syscall
* linux/alpha/syscallent.h (sysfs): Change nargs from 5 to 3.
* linux/hppa/syscallent.h (sysfs): Likewise.
* linux/mips/syscallent-n32.h (sysfs): Likewise.
* linux/mips/syscallent-n64.h (sysfs): Likewise.
2015-11-24 02:23:18 +00:00
10bd3157b8 Move sysfs syscall to deprecated category
* linux/dummy.h (sys_sysfs): Move to the list of deprecated syscalls.
2015-11-24 02:21:35 +00:00
a318cc0532 Fix syscall entries of deprecated bdflush syscall
* linux/alpha/syscallent.h (bdflush): Change nargs from 0 to 2.
* linux/arm/syscallent.h (bdflush): Likewise.
* linux/avr32/syscallent.h (bdflush): Likewise.
* linux/bfin/syscallent.h (bdflush): Likewise.
* linux/hppa/syscallent.h (bdflush): Likewise.
* linux/i386/syscallent.h (bdflush): Likewise.
* linux/ia64/syscallent.h (bdflush): Likewise.
* linux/m68k/syscallent.h (bdflush): Likewise.
* linux/microblaze/syscallent.h (bdflush): Likewise.
* linux/powerpc/syscallent.h (bdflush): Likewise.
* linux/s390/syscallent.h (bdflush): Likewise.
* linux/s390x/syscallent.h (bdflush): Likewise.
* linux/sh/syscallent.h (bdflush): Likewise.
* linux/sh64/syscallent.h (bdflush): Likewise.
* linux/sparc/syscallent.h (bdflush): Likewise.
2015-11-24 02:17:48 +00:00
4b3a1703bd Implement name_to_handle_at and open_by_handle_at syscalls decoding
* file_handle.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_name_to_handle_at, sys_open_by_handle_at):
Remove stub aliases.
* pathtrace.c (pathtrace_match): Add SEN_name_to_handle_at.
* tests/file_handle.c: New file.
* tests/file_handle.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add file_handle.
(TESTS): Add file_handle.test.
* tests/.gitignore: Add file_handle.
2015-11-22 23:21:35 +00:00
60d7524090 Implement lookup_dcookie syscall decoding
* lookup_dcookie.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_lookup_dcookie): Remove stub alias.
2015-11-22 23:10:12 +00:00
ea1970500e Implement kexec_file_load syscall decoding
* xlat/kexec_file_load_flags.in: New file.
* kexec.c: Include "xlat/kexec_file_load_flags.h".
(SYS_FUNC(kexec_file_load)): New function.
* linux/dummy.h (sys_kexec_file_load): Remove stub alias.
* pathtrace.c (pathtrace_match): Add SEN_kexec_file_load.
2015-11-22 23:10:12 +00:00
7aa9c0d299 Implement kcmp syscall decoding
* kcmp.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_kcmp): Remove stub alias.
* xlat/kcmp_types.in: New file.
2015-11-22 23:10:12 +00:00
dcd00c3943 Implement iopl syscall decoding
* iopl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_iopl): Remove stub alias.
2015-11-22 23:10:12 +00:00
2aa180e36a Implement ioperm syscall decoding
* ioperm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_ioperm): Remove stub alias.
2015-11-22 23:10:12 +00:00
a17f593e50 net: fix printing of IP_RECVOPTS/IP_RETOPTS cmsg options
* net.c (print_cmsg_ip_opts): Print each byte as unsigned char.
2015-11-22 23:09:59 +00:00
87d64ed61f userfaultfd: fix pathtrace support
* pathtrace.c (pathtrace_match): Add SEN_userfaultfd.
2015-11-22 19:59:58 +00:00
1f111cff5a Implement IPPROTO_IP control messages decoding
* net.c: Include "xlat/ip_cmsg_types.h".
(print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_checksum,
print_cmsg_ip_origdstaddr): New functions.
(print_cmsg_type_data): Add generic SOL_IP level decoding.
Use these functions for decoding of IP_PKTINFO, IP_TTL, IP_TOS,
IP_RECVOPTS, IP_RETOPTS, IP_RECVERR, IP_ORIGDSTADDR, IP_CHECKSUM,
and SCM_SECURITY type messages.
* xlat/ip_cmsg_types.in: New file.
* xlat/sockipoptions.in: Move IP_RETOPTS before IP_RECVRETOPTS.
* tests/inet-cmsg.c: New file.
* tests/inet-cmsg.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add inet-cmsg.
(TESTS): Add inet-cmsg.test.
* tests/.gitignore: Add inet-cmsg.

Suggested-by: Orion Poplawski <orion@cora.nwra.com>
2015-11-22 02:56:45 +00:00
1103b4ee86 Simplify control messages printers
Do not pass sizeof(struct cmsghdr) to every cmsg printer.

* net.c (printcmsghdr): Pass pointer to cmsg_data and length
of cmsg_data to print_cmsg_type_data.
(print_cmsg_type_data): Update prototype.  Pass pointer to cmsg_data
and length of cmsg_data to cmsg printers.
(print_scm_rights, print_scm_creds, print_scm_security): Update.
2015-11-22 02:42:45 +00:00
1019f002c1 net: factor out address printing code to a separate function
* net.c (sockaddr_buf_t): New type.
(print_sockaddr): New function.
(printsock, print_group_req): Use it.
2015-11-21 02:52:23 +00:00
5cb45b25a3 mpers: skip xlat struct definitions in mpers mode
Avoid duplicate definitions of xlat structures in files
compiled in mpers mode.

Each xlat file defines the corresponding xlat struct with
either global or local visibility using the following rules:

- if xlat struct declaration is available in defs.h,
  a global definition is provided in regular mode,
  and nothing is provided in mpers mode;
- otherwise, if xlat file is included by a mpers source file,
  a global definition is provided in regular mode
  (unless no mpers mode is supported on this architecture,
  in that case, a local definition is provided instead),
  and a declaration is provided in mpers mode;
- otherwise, a local definition is provided in regular mode,
  and an error message is printed in mpers mode.

Fallback definitions of constants provided by xlat files
remain available in all modes.

* bootstrap: Invoke generate_mpers_am.sh before xlat/gen.sh.
* defs.h (adjtimex_modes, adjtimex_status, sigev_value): Remove.
* generate_mpers_am.sh: Generate mpers_xlat.h.
* Makefile.am (EXTRA_DIST): Add mpers_xlat.h.
* print_sigevent.c: Include "xlat/sigev_value.h" unconditionally.
* print_timex.c: Include "xlat/adjtimex_modes.h" and
"xlat/adjtimex_status.h" unconditionally.
* xlat/gen.sh (cond_xlat): Move printing of fallback definitions ...
(cond_def): ... here.
(gen_header): Check also mpers_xlat.h for global declarations
of xlat structures.
Process input file twice, first time print directives
only, second time print everything.
Wrap struct xlat into #ifdef IN_MPERS ... #else ... #endif.
* xlat/getrandom_flags.in: Cleanup.
2015-11-20 05:44:49 +00:00
7528a0b2e1 tests: rewrite getdents test in C for better coverage
* tests/getdents.awk: Remove.
* tests/getdents.out: Remove.
* tests/getdents.c: New file.
* tests/getdents.test: Rewrite.
* tests/getdents64.c: New file.
* tests/getdents64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getdents and getdents64.
(TESTS): Add getdents64.test.
(EXTRA_DIST): Remove getdents.awk and getdents.out.
* tests/.gitignore: Add getdents and getdents64.
2015-11-20 00:08:48 +00:00
4f461581b7 tests: add readdir.test
* tests/readdir.c: New file.
* tests/readdir.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add readdir.
(TESTS): Add readdir.test.
* tests/.gitignore: Add readdir.
2015-11-19 22:57:42 +00:00
a367db8e5b Mpersify parsers of readdir and getdents syscalls
* defs.h (dirent_types): New xlat prototype.
* dirent.c: Stop including "xlat/direnttypes.h".
(kernel_dirent): New typedef.  Mpersify it.
(print_old_dirent): Use it instead of old_dirent_t.
(SYS_FUNC(getdents)): Use it instead of struct kernel_dirent.
Rename direnttypes to dirent_types.
(SYS_FUNC(getdents64)): Move ...
* dirent64.c: ... here.  Rename direnttypes to dirent_types.
Include "xlat/dirent_types.h".
* Makefile.am (strace_SOURCES): Add dirent64.c.
* xlat/direnttypes.in: Rename to xlat/dirent_types.in.
2015-11-19 22:49:58 +00:00
a2df1c12de getdents: fix typos in array output
Array should be enclosed by square brakets, and elements should be
separated by commas.

* dirent.c (SYS_FUNC(getdents), SYS_FUNC(getdents64)): Fix typos
in array output.
* tests/getdents.awk: Update regexps to match fixed output.
* tests/getdents.out: Update output.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
2015-11-19 17:52:35 +00:00
f54cb96f7f printcmsghdr: move type and data decoders to a separate function
* net.c (print_scm_rights, print_scm_creds, print_scm_security): Change
to return void.  Move printing of struct cmsghdr closing '}' ...
(printcmsghdr): ... here.  Move type and data decoders to ...
(print_cmsg_type_data): ... new function.
2015-11-19 00:31:32 +00:00
b36d132907 Assume that libc provides sendmsg
Starting with commit v4.6-281-g7af9f35, we implicitly assume that
HAVE_SENDMSG is always defined.  Therefore, the check for sendmsg
availability is redundant and could be safely removed.

* configure.ac (AC_CHECK_FUNCS): Remove sendmsg.
* linux/dummy.h [!HAVE_SENDMSG] (sys_recvmsg, sys_sendmsg): Remove
stub aliases.
* net.c [HAVE_SENDMSG]: Define unconditionally.
* syscall.c (dumpio) [HAVE_SENDMSG]: Likewise.
2015-11-18 23:18:17 +00:00
3a1e95d14e net.c: move fallback definition of SCM_SECURITY to xlat/
* net.c: Move fallback definition of SCM_SECURITY ...
* xlat/scmvals.in: ... here.
2015-11-18 23:11:34 +00:00
0d0a50aa25 Implement mlock2 syscall decoding
* mem.c: Include "xlat/mlock_flags.h".
(SYS_FUNC(mlock2)): New function.
* xlat/mlock_flags.in: New file.
* xlat/mlockall_flags.in: Add MCL_ONFAULT, add default values.
* linux/dummy.h (mlock2): Remove.
* tests/mlock2.c: New file.
* tests/mlock2.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mlock2.
(TESTS): Add mlock2.test.
* tests/.gitignore Add mlock2.
2015-11-17 00:40:22 +00:00
2aec1e67df Implement membarrier syscall decoding
* membarrier.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/membarrier_cmds.in: New file.
* linux/dummy.h (membarrier): Remove.
* tests/membarrier.c: New file.
* tests/membarrier.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add membarrier.
(TESTS): Add membarrier.test.
* tests/.gitignore: Add membarrier.
2015-11-17 00:40:22 +00:00
a6ebdb149e Implement userfaultfd syscall decoding
* userfaultfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/uffd_flags.in: New file.
* linux/dummy.h (userfaultfd): Remove.
* tests/userfaultfd.c: New file.
* tests/userfaultfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add userfaultfd.
(TESTS): Add userfaultfd.test.
* tests/.gitignore: Add userfaultfd.
2015-11-17 00:40:22 +00:00
1fc01fdee6 ia64: wire up kcmp syscall
ia64 has kcmp syscall starting with linux kernel commit
v4.3-rc7-1-gd305c47.

* linux/ia64/syscallent.h (kcmp): New entry.
2015-11-17 00:40:22 +00:00
7171821dde powerpc: wire up direct sysv ipc syscalls
Starting with linux commit v4.3-rc3-33-ga342361, powerpc has
direct sysv ipc syscalls in addition to traditional ipc syscall.

* linux/powerpc/syscallent.h (semop, semget, semctl, semtimedop, msgsnd,
msgrcv, msgget, msgctl, shmat, shmdt, shmget, shmctl): New entries.
2015-11-17 00:40:21 +00:00
401d4bd601 Wire up userfaultfd, membarrier, and mlock2 syscalls
* linux/dummy.h (membarrier, mlock2, userfaultfd): New stub aliases.
* linux/32/syscallent.h (userfaultfd, membarrier, mlock2): New entries.
* linux/64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/arm/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/hppa/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/i386/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/ia64/syscallent.h (userfaultfd, membarrier): Likewise.
* linux/m68k/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/microblaze/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-n32.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-n64.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-o32.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/powerpc/syscallent.h (userfaultfd, membarrier): Likewise.
* linux/s390/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/s390x/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/sparc/syscallent.h (membarrier, userfaultfd, mlock2): Likewise.
* linux/x32/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/x86_64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
2015-11-17 00:39:49 +00:00
71af1158ec sprintflags: skip zero flags
Tweak sprintflags behaviour to match printflags.

* util.c (sprintflags): Skip zero flags unless the value passed
to sprintflags is also zero.
2015-11-16 03:08:41 +00:00
79bddff923 printflags: handle empty xlats
If the set of headers are unable to produce a valid list, printflags
will try to pass NULL to tprints which crashes.  Add a sanity check
for this edge case.

* util.c (printflags): Check xlat->str is not NULL.
2015-11-16 03:08:41 +00:00
35bd0b8b84 mpers: forward mpers_DEFS to mpers.sh
mpers_DEFS has to be forwarded to mpers.sh so that config.h would be
properly included by defs.h at preprocessor stage.

* Makefile.am (mpers-m%.stamp): Add the whole $(mpers_sh_opts) set of
options to mpers.sh's CPPFLAGS.
2015-11-16 03:08:41 +00:00
0f8af61154 tests/ioctl: workaround glibc ioctl wrapper on powerpc
* tests/ioctl.c (main) [POWERPC] Disable TCGETS test.
2015-11-16 03:08:41 +00:00
b3ab30f218 powerpc: wire up switch_endian syscall
powerpc has switch_endian syscall starting with linux commit
v4.0-rc4-67-g529d235.

* linux/powerpc/syscallent.h (switch_endian): New entry.
2015-11-15 16:51:55 +00:00
a1982b404b sparc: reserve more space for new syscalls
Move socket subcalls further down the table to make room
for new syscalls.

* linux/sparc/syscallent.h (SYS_socket_subcall): Raise from 353 to 400.
2015-11-15 16:48:50 +00:00
b070229f56 m68k: wire up direct socket syscalls
Starting with linux commit v4.3-rc3-1-g5b3f33e, m68k has direct
socket syscalls in addition to traditional socketcall syscall.

* linux/m68k/syscallent.h (socket, socketpair, bind, connect, listen,
accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
sendmsg, recvfrom, recvmsg, shutdown, recvmmsg, sendmmsg): New entries.
2015-11-15 03:05:34 +00:00
5f394f5e14 i386: wire up direct socket syscalls
Starting with linux commit v4.2-rc1-64-g9dea5dc, x86 has direct
socket syscalls in addition to traditional socketcall syscall.

* linux/i386/syscallent.h (socket, socketpair, bind, connect, listen,
accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
sendmsg, recvfrom, recvmsg, shutdown): New entries.
2015-11-15 03:05:34 +00:00
4b499f4190 s390, s390x: update syscall tables
* linux/s390/syscallent.h: Add new syscalls available with kernel 4.3.0.
* linux/s390x/syscallent.h: Likewise.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2015-11-11 22:32:37 +00:00
370eb16ed2 Fix *_printer_defs.h rules ambiguousness
There is an ambiguousness in *_printer_defs.h rules definition:

$ grep '^[^ ]*_defs\.h: ' Makefile.am
m%_defs.h: $(srcdir_mpers_source_files)
%_printer_defs.h: $(srcdir_mpers_source_files)

While it appears to work with GNU make, it has to be fixed nevertheless.

* Makefile.am (m%_defs.h): Rename to m%_type_defs.h.
(mpers_m32_targets): Rename m32_defs.h to m32_type_defs.h.
(mpers_mx32_targets): Rename mx32_defs.h to mx32_type_defs.h.
* mpers_type.h: Rename m32_defs.h to m32_type_defs.h,
mx32_defs.h to mx32_type_defs.h.
* .gitignore: Likewise.

Reported-by: Elliott Hughes <enh@google.com>
2015-11-07 23:33:47 +00:00
c3410ba543 fcntl.c: make use of RVAL_DECODED
* fcntl.c (SYS_FUNC(fcntl)): Return RVAL_DECODED for write-only operations.
2015-10-09 02:18:27 +00:00
2512003cea desc.c: move parser of fcntl syscall to a separate file
* fcntl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (printflock64, printflock, SYS_FUNC(fcntl)): Move to fcntl.c.
2015-10-08 22:41:54 +00:00
5d68f468f4 desc.c: move parser of flock syscall to a separate file
* flock.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (SYS_FUNC(flock)): Move to flock.c.
2015-10-08 22:41:54 +00:00
f4d6a0d4e1 tests: fix false uio.test failures
* tests/uio.c (main): Use descriptor number 0 in pread/pwrite
and preadv/pwritev syscalls.
* tests/uio.expected: Update regexps.

Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
2015-10-08 22:41:40 +00:00
ad25c74f4b Fix make -j builds
In files generated by mpers scripts, includes directives are taken from
original files where the type definition was done.  This causes to
include defs.h in multiple files.  defs.h includes printers.h header,
which is a generated header.

This patch add an explicit dependency to printers.h for the mpers
scripts.

* Makefile.am (mpers-m%.stamp): Add printers.h to order-only
prerequisites.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-10-01 22:20:10 +00:00
0656ce9822 mpers: fix shell code to conform better to POSIX
The `echo -n` behavior is non-portable, so use printf instead.

* generate_mpers_am.sh: Change `echo -n` to `printf`.
2015-09-29 19:38:26 +00:00
9c4fc3404c ioctl: fix ioctl command number decoding in case of conflicts
When a command number was decoded through ioctl_decode_command_number(),
there was no check for conflicts with other potential ioctls numbers.

For example:
	ioctl(fd, MCE_GET_RECORD_LEN, &i);
output:
	ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0
instead of:
	ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0

* ioctl.c (SYS_FUNC(ioctl)): Fix ioctl command number decoding
in case of conflicts.
* tests/ioctl.c (main): Add a case for command number conflicts.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-09-23 23:29:30 +00:00
fb2a54300e tests: convert ioctl.test from match_grep to match_diff
* tests/ioctl.c (main): Print expected output.
* tests/ioctl.test: Use match_diff instead of match_grep.
* tests/ioctl.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove ioctl.expected.
2015-09-23 23:29:27 +00:00
7a12974e95 Convert parser of seccomp filter program to new mpers infrastructure
* seccomp_fprog.h: New file.
* fetch_seccomp_fprog.c: New file.
* Makefile.am (strace_SOURCES): Add them.
* seccomp.c: Include "seccomp_fprog.h".
(print_seccomp_filter): Use fetch_seccomp_fprog.
2015-09-20 00:02:26 +00:00
3b731941f3 tests/init.sh: enhance match_grep error diagnostics
* tests/init.sh (match_grep): Check patterns one by one,
output only those patterns that didn't match.
2015-09-19 04:04:49 +03:00
a69854a90b tests/init.sh: fix comment
* tests/init.sh (match_awk): Fix usage description.
2015-09-19 04:04:49 +03:00
39e3be6d74 tests: add one more case to select.test
* tests/select.c (main): Check how timeout is printed
on exiting syscall.
2015-09-19 04:04:49 +03:00
10a40757bf tests: uncouple pselect6 from select.test
* tests/select.c Do not include <string.h>.
Include <sys/syscall.h>.
[!__NR_select]: Skip the test.
(main): Remove pselect6 support, test just select syscall.
* tests/select.test: Remove all pselect6 checks, test just
select syscall.
2015-09-19 04:04:49 +03:00
100bf7c896 tests: robustify select test
* tests/select.c: Do not include <assert.h>.
(main): Skip the test instead of assertions.
Add some padding to the timeval structure.
2015-09-19 04:04:49 +03:00
81ea4bf063 tests: add one more case to pselect6.test
* tests/pselect6.c (main): Check how timeout is printed
on exiting syscall.
2015-09-19 04:04:49 +03:00
5d98310e00 tests: robustify pselect6 test
* tests/pselect6.c: Do not include <assert.h> and <string.h>.
Include <sys/syscall.h>.
[!__NR_pselect6]: Skip the test.
(main): Skip the test instead of assertions.
Add some padding to the timespec structure.
2015-09-19 04:04:49 +03:00
4cb5ccca24 Convert another parser of struct timeval to new mpers infrastructure
* print_time.c (sprint_timeval): New mpers printer.
[ALPHA] (sprint_timeval32): New function.
* defs.h [ALPHA] (sprint_timeval32): New prototype.
(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
* desc.c (decode_select): Replace bitness parameter with two printers.
Use them instead of printtv_bitness and sprinttv.
(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
to decode_select.
[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
to decode_select.
(pselect6): Pass print_timespec and sprint_timespec to decode_select.
* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.
2015-09-19 04:04:49 +03:00
2950de3631 Convert another parser of struct timespec to new mpers infrastructure
* print_time.c (sprint_timespec): New mpers printer.
* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
(sprint_timespec): Remove.
* time.c (sprint_timespec): Remove.
* net.c (sys_recvmmsg): Update callers.
* poll.c (decode_poll_exiting): Likewise.
2015-09-19 04:04:49 +03:00
6c528f5502 tests: add another case to pselect6 test
* tests/pselect6.c: Include <sys/time.h>.
(handler): New function.
(main): Install an interval timer.
Use it to check how ERESTARTNOHAND is printed.
2015-09-19 04:04:49 +03:00
f57edf4d37 Fix decoding of gettimeofday and settimeofday
* time.c (print_timezone): new function.
(sys_gettimeofday, sys_settimeofday): Use it instead of print_timeval
to print struct timezone.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday): Use it
instead of print_timeval32 to print struct timezone.
* tests/xettimeofday.c: New file.
* tests/xettimeofday.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xettimeofday.
(TESTS): Add xettimeofday.
* tests/.gitignore: Add xettimeofday.
2015-09-19 04:04:49 +03:00
f1e3a32045 Convert parser of struct timeval to new mpers infrastructure
* defs.h (printtv, printtv_special): Remove.
[ALPHA] (print_timeval32, print_timeval32_pair): New prototypes.
* print_time.c (print_timeval): New mpers printer.
[ALPHA] (print_timeval32, print_timeval32_pair): New functions.
* time.c (sys_gettimeofday, sys_settimeofday): Use print_timeval
instead of printtv.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday):
Use print_timeval32 instead of printtv_bitness.
* utimes.c [ALPHA] (sys_osf_utimes): Use print_timeval32_pair
instead of printtv_bitness.
2015-09-19 04:04:49 +03:00
5938526c81 Convert parser of struct timespec to new mpers infrastructure
* defs.h (print_timespec): Remove.
* print_time.c (print_timespec): New mpers printer.
* futex.c (sys_futex): Use print_timespec instead of printtv.
* ipc_sem.c (sys_semtimedop): Likewise.
* mq.c (sys_mq_timedsend, sys_mq_timedreceive): Likewise.
* time.c (clock_settime, clock_gettime, clock_nanosleep): Likewise.
(print_timespec): Remove.
2015-09-19 04:04:49 +03:00
f94d8d6e55 Remove unused parser of adjtime syscall
* time.c (sys_adjtime): Remove.
2015-09-19 04:04:49 +03:00
c648b4a832 Fix decoding of clock_nanosleep
* time.c (sys_clock_nanosleep): Use is_erestart,
temporarily_clear_syserror, and restore_cleared_syserror.
* tests/clock_nanosleep.c: New file.
* tests/clock_nanosleep.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add clock_nanosleep.
(TESTS): Add clock_nanosleep.test.
* tests/.gitignore: Add clock_nanosleep.
2015-09-19 04:04:49 +03:00
9af94a2f48 Add is_erestart helper function
* defs.h (is_erestart): New prototype.
* syscall.c (is_erestart): New function.
* time.c (sys_nanosleep): Use is_erestart,
temporarily_clear_syserror, and restore_cleared_syserror.
2015-09-19 04:04:49 +03:00
3858b93ad9 Add helper functions to clear/restore syserror
* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
New prototypes.
* syscall.c (saved_u_error): New variable.
(temporarily_clear_syserror, restore_cleared_syserror): New functions.
* aio.c (sys_io_getevents): Use temporarily_clear_syserror
and restore_cleared_syserror.
* mq.c (sys_mq_timedreceive): Likewise.
* signal.c (sys_rt_sigtimedwait): Likewise.
2015-09-19 04:04:49 +03:00
593602ce5a tests: add nanosleep.test
* tests/nanosleep.c: New file.
* tests/nanosleep.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add nanosleep.
(TESTS): Add nanosleep.test.
* tests/.gitignore: Add nanosleep.
2015-09-19 04:04:48 +03:00
640623c41e tests: rewrite restart_syscall in C
* tests/restart_syscall.c: New file.
* tests/restart_syscall.expected: Remove.
* tests/restart_syscall_unknown.expected: Remove.
* tests/restart_syscall.test: Update to use restart_syscall.
* tests/Makefile.am (check_PROGRAMS): Add restart_syscall.
(EXTRA_DIST): Remove restart_syscall.expected
and restart_syscall_unknown.expected.
* tests/.gitignore: Add restart_syscall.
2015-09-19 04:04:48 +03:00
135f5cf634 Properly initialize siginfo_t object passed to print_stopped function
* strace.c (trace): Clear the whole siginfo_t variable before passing it
to ptrace(PTRACE_GETSIGINFO) because the latter may initialize only a
part of the structure.
2015-09-19 04:04:48 +03:00
9d4c892ceb tests: add clock_xettime.test
* tests/clock_xettime.c: New file.
* tests/clock_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add clock_xettime.
(TESTS): Add clock_xettime.test.
* tests/.gitignore: Add clock_xettime.
2015-09-19 04:04:48 +03:00
322be80342 Convert parser of struct itimerval to new mpers infrastructure
* defs.h [ALPHA] (print_itimerval32): New prototype.
* print_time.c (print_itimerval): New mpers printer.
[ALPHA] (timeval32_t): New typedef.
[ALPHA] (print_timeval32_t, print_itimerval32): New functions.
* time.c (sys_getitimer, sys_setitimer): Use print_itimerval instead
of printitv.
[ALPHA] (sys_osf_getitimer, sys_osf_setitimer): Use print_itimerval32
instead of printitv_bitness.
(tprint_timeval32, tprint_timeval, printitv_bitness, printitv): Remove.
2015-09-19 04:04:27 +03:00
12431f76be tests: add xetitimer.test
* tests/xetitimer.c: New file.
* tests/xetitimer.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xetitimer.
(TESTS): Add xetitimer.test.
* tests/.gitignore: Add xetitimer.
2015-09-19 04:04:27 +03:00
2206085929 Convert parser of struct itimerspec to new mpers infrastructure
* print_time.c (print_itimerspec): New mpers printer.
* time.c (sys_timer_settime, sys_timer_gettime, sys_timerfd,
sys_timerfd_settime, sys_timerfd_gettime): Use it instead of printitv.
2015-09-19 04:03:47 +03:00
207ba11125 print_time.c: introduce print_timespec_t helper
* print_time.c (time_fmt): New constant string.
(print_timeval_t): Use it.
(print_timespec_t): New function.
(print_timespec_t_utime): Use it.
2015-09-17 23:23:45 +00:00
79cafcd337 tests: add timerfd_xettime.test
* tests/timerfd_xettime.c: New file.
* tests/timerfd_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timerfd_xettime.
(TESTS): Add timerfd_xettime.test.
* tests/.gitignore: Add timerfd_xettime.
2015-09-17 23:23:41 +00:00
1314098cde tests: add timer_xettime.test
* tests/timer_xettime.c: New file.
* tests/timer_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timer_xettime.
(TESTS): Add timer_xettime.test.
* tests/.gitignore: Add timer_xettime.
2015-09-17 23:22:43 +00:00
ba40d85234 time.c: move parser of time syscall to print_time.c
* time.c (current_time_t_is_int32): Remove.
(sys_time): Move ...
* print_time.c: ... here.  Mpersify time_t.
2015-09-17 16:10:53 +00:00
5eb2362cff print_time.c: remove unused function parameters
* print_time.c (print_timespec_t_utime, print_timeval_t): Remove
"struct tcb *" parameter.
(print_timespec_utime_pair, print_timeval_pair): Update callers.
2015-09-17 15:12:42 +00:00
0dbb7acc35 Add struct timex.tai support
* configure.ac (AC_CHECK_MEMBERS): Add struct timex.tai.
* print_timex.c (print_timex) [HAVE_STRUCT_TIMEX_TAI]: Print tai field.
* tests/adjtimex.c (main) [HAVE_STRUCT_TIMEX_TAI]: Likewise.
2015-09-17 13:26:22 +00:00
dad1eef568 Convert parser of struct timex to new mpers infrastructure
* defs.h (adjtimex_modes, adjtimex_status): New xlat prototypes.
* print_timex.c (struct_timex): New typedef.  Mpersify it.
[IN_MPERS]: Do not include "xlat/adjtimex_modes.h"
and "xlat/adjtimex_status.h".
[SUPPORTED_PERSONALITIES > 1]: Remove.
(tprint_timeval): Remove.
(tprint_timex): Rename to print_timex.  Mpersify it.
* time.c (do_adjtimex): Rename tprint_timex to print_timex.
* tests/adjtimex.c: New file.
* tests/adjtimex.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add adjtimex.
(TESTS): Add adjtimex.test.
* tests/.gitignore: Add adjtimex.
2015-09-17 13:25:53 +00:00
dd6bf4b6b4 Move parser of struct timex to a separate file
* print_timex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* time.c (tprint_timex32, tprint_timex): Move to print_timex.c.
2015-09-17 13:23:12 +00:00
b8f0c9286a Enhance parser of struct sigevent
* print_sigevent.c (print_sigevent): Always print names
of struct_sigevent fields along with their values.
Print signal name of sigev_signo for those sigev_notify values
that require valid signal numbers.
* tests/timer_create.c: New file.
* tests/timer_create.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timer_create.
(TESTS): Add timer_create.test.
* tests/.gitignore: Add timer_create.
2015-09-17 13:22:57 +00:00
6f950cc499 Convert parser of struct sigevent to new mpers infrastructure
* defs.h (sigev_value): New prototype.
(printsigevent): Remove.
* print_sigevent.c (struct_sigevent): New typedef.  Mpersify it.
[IN_MPERS]: Do not include "xlat/sigev_value.h".
(printsigevent32): Remove.
(printsigevent): Rename to print_sigevent.  Mpersify it.
* mq.c (sys_mq_notify): Rename printsigevent to print_sigevent.
* time.c (sys_timer_create): Likewise.
2015-09-16 21:16:28 +00:00
d6b0558ad6 Move parser of struct sigevent to a separate file
* print_sigevent.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* time.c (printsigevent32, printsigevent): Move to print_sigevent.c.
2015-09-16 18:05:43 +00:00
644a8093a2 time.c: move fallback definitions of SIGEV_* values to xlat/
* time.c: Move fallback definitions of SIGEV_* values ...
* xlat/sigev_value.in: ... here.
2015-09-16 12:09:52 +00:00
e2fb0bb2cf Simplify use of mpers printers
* native_defs.h: New file.
* syscall.c: Include it.
* mpers_type.h [!IN_MPERS] (MPERS_DEFS): Change to "native_defs.h".
* defs.h (MPERS_PRINTER_NAME): Remove.
[SUPPORTED_PERSONALITIES > 1] (MPERS_PRINTER_NAME, printers): Move ...
* Makefile.am (printers.h): ... here.
Add macro definitions for mpers printers.
(m%_defs.h): Add redefinition of MPERS_PRINTER_NAME and inclusion
of "$(mpers_PREFIX)printer_decls.h".
(strace_SOURCES): Add native_defs.h.
* README-mpers: Update instructions for using mpers printers.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Call tprint_msgbuf directly.
* mq.c (sys_mq_open, mq_getsetattr): Call printmqattr directly.
* process.c (sys_ptrace): Call printsiginfo_at directly.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Likewise.
* resource.c (sys_getrusage): Call printrusage directly.
* utimes.c (sys_utimensat): Call print_timespec_utime_pair directly.
(sys_utimes, sys_futimesat): Call print_timeval_pair directly.
* wait.c (printwaitn): Call printrusage directly.
(sys_waitid): Call printrusage and printsiginfo_at directly.
2015-09-16 00:14:55 +00:00
b172a94d02 Add a new helper function umove_ulong_array_or_printaddr
* defs.h (umove_ulong_array_or_printaddr): New prototype.
* util.c (umove_ulong_array_or_printaddr): New function.
* desc.c (sys_pselect6): Use it instead of open-coding
a proxy struct parser for different personalities.
* io.c (tprint_iov_upto): Use it instead of open-coding
a struct iovec parser for different personalities.
* kexec.c (print_kexec_segments): Use it instead of open-coding
a struct kexec_segment parser for different personalities.
(print_seg): Pass arguments using an array.
2015-09-15 11:23:27 +00:00
77a1b6bc41 tests: add pselect6.test
* tests/pselect6.c: New file.
* tests/pselect6.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pselect6.
(TESTS): Add pselect6.test.
* tests/.gitignore: Add pselect6.
2015-09-15 02:14:38 +00:00
09a1a5a2ca Rename umove_long_or_printaddr to umove_ulong_or_printaddr
Rename the recently added function to reflect what kind of data type
it actually deals with: unsigned long int, without sign extension.

* defs.h (umove_long_or_printaddr): Rename to umove_ulong_or_printaddr,
chage 3rd argument to unsigned long *.
* util.c (umove_long_or_printaddr): Likewise.
* aio.c (sys_io_submit): Update callers.
2015-09-14 23:02:29 +00:00
a1fa83d8e1 aarch64, ppc64, sparc64, tile: hook up mpers printers
* defs.h [AARCH64 && HAVE_M32_MPERS]: Define PERSONALITY0_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS,
and PERSONALITY0_INCLUDE_PRINTERS_DEFS.
[POWERPC64 && HAVE_M32_MPERS]: Define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS,
and PERSONALITY1_INCLUDE_PRINTERS_DEFS.
[SPARC64 && HAVE_M32_MPERS]: Likewise.
[TILE && HAVE_M32_MPERS]: Likewise.
2015-09-14 22:33:23 +00:00
6375f151a7 Add PowerPC specific ptrace constants
* xlat/ptrace_cmds.in: Add PowerPC specific ptrace constants.
2015-09-14 17:31:36 +00:00
cb7699c2d0 Update SCTP_* constants
* xlat/socksctpoptions.in: Add SCTP_GET_ASSOC_ID_LIST, SCTP_AUTO_ASCONF,
SCTP_PEER_ADDR_THLDS, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO,
SCTP_DEFAULT_SNDINFO, SCTP_SOCKOPT_CONNECTX, SCTP_SOCKOPT_CONNECTX3,
and SCTP_GET_ASSOC_STATS.
2015-09-14 17:27:07 +00:00
456f41ab30 Update F_* constants
* xlat/fcntlcmds.in: Add F_SETPIPE_SZ, F_GETPIPE_SZ, F_ADD_SEALS,
and F_GET_SEALS.
2015-09-14 17:21:10 +00:00
e96869bd96 Update RENAME_* constants
* xlat/rename_flags.in: Add RENAME_WHITEOUT.
2015-09-14 17:16:32 +00:00
a9cda6940a Update SO_* constants
* xlat/sockoptions.in: Add SO_ATTACH_BPF, SO_BPF_EXTENSIONS,
SO_BUSY_POLL, SO_DETACH_BPF, SO_GET_FILTER, SO_INCOMING_CPU,
SO_LOCK_FILTER, SO_MAX_PACING_RATE, SO_PEEK_OFF, SO_RXQ_OVFL,
SO_SELECT_ERR_QUEUE, and SO_WIFI_STATUS.
2015-09-14 17:04:22 +00:00
718dc4361c Update INPUT_PROP_* constants
* xlat/evdev_prop.in: Add INPUT_PROP_ACCELEROMETER.
2015-09-14 16:20:25 +00:00
d6414fbdcc Update KEY_* constants
* xlat/evdev_keycode.in: Add KEY_ROTATE_DISPLAY, KEY_NUMERIC_A,
KEY_NUMERIC_B, KEY_NUMERIC_C, and KEY_NUMERIC_D.
2015-09-14 16:19:25 +00:00
137bf1b910 Update FALLOC_FL_* constants
* xlat/falloc_flags.in: Add FALLOC_FL_INSERT_RANGE.
2015-09-14 16:04:17 +00:00
d44ffe041b Update AF_* and PF_* constants
* xlat/addrfams.in: Add AF_IB and AF_MPLS.
* xlat/domains.in: Add PF_IB and PF_MPLS.
2015-09-14 16:00:39 +00:00
209f695f93 Update TCP_* constants
* xlat/socktcpoptions.in: Add TCP_NOTSENT_LOWAT, TCP_CC_INFO,
TCP_SAVE_SYN, and TCP_SAVED_SYN.
2015-09-14 15:50:44 +00:00
7f0063ca6c Update PACKET_* constants
* xlat/sockpacketoptions.in: Add PACKET_VNET_HDR, PACKET_TX_TIMESTAMP,
PACKET_TIMESTAMP, PACKET_FANOUT, PACKET_TX_HAS_OFF, PACKET_QDISC_BYPASS,
PACKET_ROLLOVER_STATS, and PACKET_FANOUT_DATA.
2015-09-14 15:46:47 +00:00
57c29189aa Update BPF_MAP_TYPE_* constants
* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERF_EVENT_ARRAY.
2015-09-14 15:40:17 +00:00
6fda3314fc Update IPPROTO_* constants
* xlat/inet_protocols.in: Add IPPROTO_MPLS.
2015-09-14 15:29:41 +00:00
3fe9d3669e Update IP_* constants
* xlat/sockipoptions.in: Add IP_CHECKSUM and IP_BIND_ADDRESS_NO_PORT.
2015-09-14 15:01:02 +00:00
8e0442d43c Update PTRACE_O_* constants
* ptrace.h: Define PTRACE_O_SUSPEND_SECCOMP.
* xlat/ptrace_setoptions_flags.in: Add it.
2015-09-14 14:42:28 +00:00
b02bcfadcb Update PR_* constants
* xlat/prctl_options.in: Add PR_SET_FP_MODE, PR_GET_FP_MODE,
and PR_CAP_AMBIENT.
2015-09-14 13:25:24 +00:00
b0d1955e17 Update SECBIT_* constants
* xlat/secbits.in: Add SECBIT_NO_CAP_AMBIENT_RAISE
and SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED.
2015-09-14 13:21:01 +00:00
e2a3370f67 mpers.m4: workaround missing gnu/stubs-*.h files
On some systems missing gnu/stubs-*.h files make -m32/-mx32 compilation
checks fail.  As we want to support multiple personalities despite of
this limitation, workaround the check by creating empty gnu stub files
if necessary.

* m4/mpers.m4 (st_MPERS): Check for the gnu stub file.  Create an empty
gnu stub file if the system one is missing.
* Makefile.am (DISTCLEANFILES): Add gnu/stubs-32.h and gnu/stubs-x32.h.
2015-08-28 08:46:24 +00:00
9d77b562d3 tests: add times-fail.test
* tests/times-fail.c: New file.
* tests/times-fail.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add times-fail.
(TESTS): Add times-fail.test.
* tests/.gitignore: Add times-fail.
2015-08-28 08:46:24 +00:00
7a036055af tests: add times.test
* tests/times.c: New file.
* tests/times.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add times.
(TESTS): Add times.test.
(times_LDADD): Define.
* tests/.gitignore: Add times.
2015-08-28 08:46:24 +00:00
6773d6d8a1 Mpersify parser of times syscall
Fix multiple personalities support in parser of times syscall by
mpersifying struct tms.

* times.c (tms_t): New typedef.  Mpersify it.
(sys_times): Use it instead of struct tms.
2015-08-28 08:46:23 +00:00
22d997e538 tests: add sysinfo.test
* tests/sysinfo.c: New file.
* tests/sysinfo.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sysinfo.
(TESTS): Add sysinfo.test.
* tests/.gitignore: Add sysinfo.
2015-08-28 08:46:23 +00:00
0ec7e21155 Mpersify parser of sysinfo syscall
Fix multiple personalities support in parser of sysinfo syscall by
mpersifying struct sysinfo.

* sysinfo.c (sysinfo_t): New typedef.  Mpersify it.
(sys_sysinfo): Use it instead of struct sysinfo.
2015-08-28 08:46:23 +00:00
d0a61871c8 Enhance msgctl syscall decoding
Make parser of msgctl syscall print struct msqid_ds.

* ipc_msgctl.c (msqid_ds_t): New typedef.  Mpersify it.
(print_msqid_ds): New function.  Use msqid_ds_t.
(sys_msgctl): Use print_msqid_ds.
* tests/ipc_msg.c: Update for struct msqid_ds support.
2015-08-28 08:46:23 +00:00
0a6af9b0a4 Enhance shmctl syscall decoding
Make parser of shmctl syscall print struct shmid_ds.

* ipc_shmctl.c (shmid_ds_t): New typedef.  Mpersify it.
(print_shmid_ds): New function.  Use shmid_ds_t.
(sys_shmctl): Use print_shmid_ds.
* tests/ipc_shm.c: Update for struct shmid_ds support.
2015-08-28 08:46:23 +00:00
b7699b55dd tests: add ipc_msgbuf.test
* tests/ipc_msgbuf.c: New file.
* tests/ipc_msgbuf.expected: Likewise.
* tests/ipc_msgbuf.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ipc_msgbuf.
(TESTS): Add ipc_msgbuf.test.
(EXTRA_DIST): Add ipc_msgbuf.expected.
* tests/.gitignore: Add ipc_msgbuf.
2015-08-28 08:46:23 +00:00
c2445b4aa7 Mpersify tprint_msgsnd and tprint_msgrcv
Fix multiple personalities support in tprint_msgsnd and tprint_msgrcv
by converting tprint_msgbuf into a mpersified printer.

* print_msgbuf.c (msgbuf_t): New typedef.  Mpersify it.
(tprint_msgbuf): Use it instead of long.
Wrap function name into MPERS_PRINTER_DECL.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Use mpersified
tprint_msgbuf.
2015-08-28 08:46:23 +00:00
422f793364 tests: add mq.test
* tests/mq.c: New file.
* tests/mq.expected: Likewise.
* tests/mq.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mq.
(TESTS): Add mq.test.
(EXTRA_DIST): Add mq.expected.
(mq_LDADD): Add -lrt.
* tests/.gitignore: Add mq.
2015-08-28 08:46:23 +00:00
1f53730965 Mpersify parsers of mq_open and mq_getsetattr syscalls
Fix multiple personalities support in parsers of mq_open and
mq_getsetattr by converting printmqattr into a mpersified printer.

* print_mq_attr.c (mq_attr_t): New typedef.  Mpersify it.
(printmqattr): Use it instead of struct mq_attr.  Wrap function name
into MPERS_PRINTER_DECL.
* mq.c (mq_open, mq_getsetattr): Use mpersified printmqattr.
2015-08-28 08:46:23 +00:00
cde9ef7183 tests: add wait.test
* tests/wait.c: New file.
* tests/wait.expected: Likewise.
* tests/wait.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add wait.
(TESTS): Add wait.test.
(EXTRA_DIST): Add wait.expected.
* tests/.gitignore: Add wait.
2015-08-28 08:46:23 +00:00
6fb8c6feb9 Mpersify parsers of getrusage, waitpid, wait4, and waitid syscalls
Fix multiple personalities support in parsers of getrusage, waitpid,
wait4, and waitid syscalls by converting printrusage into a mpersified
printer.

* defs.h (printrusage): Remove.
* printrusage.c (rusage_t): New typedef.  Mpersify it.
(printrusage): Use it instead of struct rusage.
Wrap function name into MPERS_PRINTER_DECL.
* resource.c (sys_getrusage): Use mpersified printrusage.
* wait.c (printwaitn, sys_waitid): Likewise.
2015-08-28 08:46:23 +00:00
3b7674c6df tests: add rt_sigqueueinfo.test
* tests/rt_sigqueueinfo.c: New file.
* tests/rt_sigqueueinfo.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add rt_sigqueueinfo.
(TESTS): Add rt_sigqueueinfo.test.
* tests/.gitignore: Add rt_sigqueueinfo.
2015-08-28 08:46:23 +00:00
a0b62498fd Mpersify printsiginfo_at printer
Fix multiple personalities support in parsers of ptrace,
rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
by converting printsiginfo_at into a mpersified printer.

* printsiginfo.c (siginfo_t): Mpersify.
(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
* defs.h (printsiginfo_at): Remove.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
printsiginfo_at.
* process.c (sys_ptrace): Likewise.
* wait.c (sys_waitid): Likewise.
2015-08-28 08:46:23 +00:00
cbbc23a2a4 Mpersify parser of sigaltstack syscall
Fix multiple personalities support in parser of sigaltstack syscall by
mpersifying stack_t typedef.

* sigaltstack.c (stack_t): Mpersify.
(print_stack_t): Use it.
2015-08-28 08:46:23 +00:00
6b6a55c2b4 Mpersify parser of utime syscall
Fix multiple personalities support in parser of utime syscall by using
mpersified utimbuf_t typedef.

* utime.c (utimbuf_t): New typedef.  Mpersify it.
(sys_utime): Use it instead of a locally defined union.
2015-08-28 08:46:23 +00:00
78e48eb430 tests: add utimensat.test
* tests/utimensat.c: New file.
* tests/utimensat.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add utimensat.
(TESTS): Add utimensat.test.
* configure.ac (AC_CHECK_FUNCS): Add utimensat.
* tests/.gitignore: Add utimensat.
2015-08-28 08:46:23 +00:00
b5a23ed381 Mpersify parsers of utimes, futimesat, and utimensat syscalls
Fix multiple personalities support in parsers of utimes, futimesat,
and utimensat syscalls by introducing two mpersified printers:
print_timeval_pair and print_timespec_utime_pair.

* print_time.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* utimes.c (decode_utimes): Remove.
(sys_utimes, sys_futimesat): Use print_timeval_pair instead
of decode_utimes.
(sys_utimensat): Use print_timespec_utime_pair instead of decode_utimes.
2015-08-28 08:46:23 +00:00
092942206c Add mpers support
Add a subsystem for semi-automatical definition of how parsers should
work with personality-dependent (mpers) types of tracee's data.  Create
auxiliary libraries containing mpers syscall parsers and printer
functions, one library for each possible nonnative target personality.

Currently some parsers do not handle differences in definitions of data
types between personalities, namely LP64 and ILP32.  When
this is the case, long integers, pointers, and all compound
types containing long and pointer members may be printed incorrectly,
because of differences in sizes, offsets and alignments.

Since in most cases these are the only differences in desired behaviour
of parsers and printers for different personalities, a correct way
would be to compile one source code into multiple parsers, differing
only in definitions of mpers types.

To get a definition of a given type for nonnative personality
a very basic .c file containing a declaration of a variable of this type
is being compiled for this personality (using -m32 or -mx32 compiler
flag).  Information about the type is then being extracted from
this binary's DWARF debug info with an awk script and put
into a corresponding header file.  Resulting headers are being used to
compile mpers variations of syscall parsers and printer functions.

In addition to syscall parsers, there can occur a need to create mpers
printing functions, which then can be called from many places
in the code (for example, printsiginfo_at).  Such functions (printers)
are marked in a special manner.

For each possible nonnative target personality a library is being
created, containing mpers variations of syscall parsers and printers.
Only syscall parsers from files marked in a special manner and specially
marked functions from such files are being recompiled and included
in these libraries.

generate_mpers_am.sh is called by bootstrap to find the files
from strace_SOURCES which include MPERS_DEFS.  During compilation,
these files are being inspected for inclusions of DEF_MPERS_TYPE,
and nonnative variations of each included type are being generated
by an awk script.

Mpers parser names are being modified during inclusions of syscallent
headers for nonnative personalities.  Pointers to printers are
being stored in structs struct_printers, and a master
pointer printers is being updated on every set_personality.

* README-mpers: New README explaining how to use mpers support.
* empty.h: New empty file.
* generate_mpers_am.sh: New file.
* mpers.awk: Likewise.
* mpers.sh: Likewise.
* mpers_test.sh: Likewise.
* mpers_type.h: Likewise.
* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
of the file.
(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
(BUILT_SOURCES, CLEANFILES): Add new generated files:
native_printer_decls.h, native_printer_defs.h, printers.h,
[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
$(mpers_mx32_targets).
(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
%_printer_decls.h, %_printer_defs.h, clean-local,
native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
New targets.
* bootstrap: Add generate_mpers_am.sh.
* configure.ac: Add AC_PROG_RANLIB.
* m4/mpers.m4: Add HAVE_MPERS variable.  Add $st_cv_mpers checks.
* defs.h: Include mpers_type.h.
Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
Redefine SYS_FUNC_NAME.  Define MPERS_PRINTER_DECL.
[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
for X86_64, X32.
[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
for X86_64.
Add fallback definitions of
PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
(printers): New struct.  Update it when needed.
* .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h,
m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32,
mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h,
mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h,
native_printer_decls.h, native_printer_defs.h, and printers.h.
2015-08-28 08:46:23 +00:00
c633188e82 tests: convert readlink.test and readlinkat.test from match_awk to match_diff
* tests/readlink.c (main): Print expected output.
* tests/readlinkat.c (main): Likewise.
* tests/readlink.test: Use match_diff instead of match_awk.
* tests/readlinkat.test: Likewise.
* tests/readlink.awk: Remove.
* tests/readlinkat.awk: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove readlink.awk and readlinkat.awk.
2015-08-28 08:43:57 +00:00
f008b01b69 tests: convert getrandom.test from match_awk to match_diff
* tests/getrandom.c (main): Print expected output.
* tests/getrandom.test: Use match_diff instead of match_awk.
* tests/getrandom.awk: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove getrandom.awk.
2015-08-28 08:16:43 +00:00
4960b2f008 tests: convert select.test from match_awk to match_diff
* tests/select.c (main): Print expected output.
* tests/select.test: Use match_diff instead of match_awk.
* tests/select.awk: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove select.awk.
2015-08-27 08:24:39 +00:00
f14a8e1665 tests: convert several tests from match_grep to match_diff
* tests/sendfile.test: Use match_diff instead of match_grep.
* tests/sendfile64.test: Likewise.
* tests/time.test: Likewise.
* tests/utime.test: Likewise.
* tests/xet_robust_list.test: Likewise.
* tests/sendfile.c (main): Update match patterns for match_diff.
* tests/sendfile64.c (main): Likewise.
* tests/time.c (main): Likewise.
* tests/utime.c (main): Likewise.
* tests/xet_robust_list.c (main): Likewise.
2015-08-27 00:09:46 +00:00
f6a36f0c9e tests: fix match_diff usage
The first argument of match_diff should be the file with expected
output, the second argument - the file with actual output.

* tests/aio.test: Swap match_diff arguments.
* tests/restart_syscall.test: Likewise.
* tests/seccomp.test: Likewise.
* tests/umovestr2.test: Likewise.
2015-08-27 00:09:46 +00:00
cf3ecbdd5f build: fix -I options
* configure.ac (AM_INIT_AUTOMAKE): Add nostdinc.
* Makefile.am (AM_CPPFLAGS): Append -I$(builddir) and -I$(srcdir).
* tests/Makefile.am (AM_CPPFLAGS): Likewise.
2015-08-27 00:09:45 +00:00
f56046e459 aio: rewrite from libaio.h to linux/aio_abi.h
* configure.ac (AC_CHECK_HEADERS): Remove libaio.h.
* aio.c: Assume that <linux/aio_abi.h> is available,
include it instead of <libaio.h>.
[!IOCB_RESFD]: Remove.
(enum iocb_sub): Remove SUB_POLL.
(tprint_lio_opcode): Update.
(print_common_flags): Use IOCB_FLAG_RESFD instead of IOCB_RESFD,
rename fields of struct iocb.
(iocb_is_valid, print_iocb_header, print_iocb): New functions.
(sys_io_submit): Use print_iocb.
(print_io_event): Fix struct io_event decoding.
(sys_io_cancel): Use print_iocb_header.
* strace.spec (BuildRequires): Remove libaio-devel.
* tests/aio.c (main): Test IOCB_CMD_PREADV, io_cancel,
and struct io_event decoding.
* tests/aio.test (syscalls): Add io_cancel.
2015-08-26 21:05:17 +00:00
13c2173393 Fix multiple personalities support in parser of io_submit syscall
Introduce a new helper function to fetch tracee's long integers
and use it to fix multiple personalities support in io_submit parser.

* defs.h (umove_long_or_printaddr): New prototype.
* util.c (umove_long_or_printaddr): New function.
* aio.c (sys_io_submit): Use it to fetch tracee's pointers.
* tests/aio.c: New file.
* tests/aio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add aio.
(TESTS): Add aio.test.
* tests/.gitignore: Add aio.
2015-08-26 21:05:17 +00:00
857adac3a5 tests: fix build on systems that lack O_CLOEXEC definition
* tests/epoll_create1.c (main): Check that O_CLOEXEC is defined.
* tests/eventfd.c (main): Likewise.
* tests/signalfd.c (main): Likewise.
2015-08-26 21:05:17 +00:00
ff6b6f3f72 tests: fix build on systems that lack AT_FDCWD definition
* tests/readlinkat.c: Stop including <fcntl.h>.
(main): Replace AT_FDCWD with -100.
2015-08-26 20:23:31 +00:00
56872838e4 Fix printing of io_getevents first argument
* aio.c (sys_io_getevents): Print first argument using "%lu" format.
2015-08-26 16:16:47 +00:00
54646b8e05 decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list.  The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions.  See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.

To support this, extend the printxval function to take multiple sets of
xlats as varargs.  Then we add the new get/set lists, and pass them down
in the net code when decoding things.

A simple example is iptables; before:
	getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
	getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
	getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
	getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0

If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.

* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument.  Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this.  Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
2015-08-26 12:09:25 +00:00
fffe50d321 Fix build on systems that lack VIDIOC_CREATE_BUFS definition
* v4l2.c (v4l2_ioctl): Check that v4l2_ioctl is defined.
2015-08-26 11:55:05 +00:00
69c1570d55 Fix build on systems that lack EM_ARM/EM_OPENRISC definitions
* xlat/audit_arch.in: Guard AUDIT_ARCH_ARM and AUDIT_ARCH_ARMEB
with EM_ARM check.  Guard AUDIT_ARCH_OPENRISC with EM_OPENRISC check.
2015-08-26 11:52:43 +00:00
642ee798b2 Fix build on systems that lack UBI_IOCVOLCRBLK/UBI_IOCVOLRMBLK definitions
* mtd.c (ubi_ioctl): Check that UBI_IOCVOLCRBLK and UBI_IOCVOLRMBLK
are defined.
2015-08-25 21:48:36 +00:00
12cca59aed Fix build on systems that lack O_CLOEXEC definition
* xlat/efd_flags.in: Check that O_CLOEXEC is defined.
* xlat/epollflags.in: Likewise.
* xlat/sfd_flags.in: Likewise.
* xlat/timerfdflags.in: Fix O_CLOEXEC check.
2015-08-25 10:05:08 +00:00
3595f4ae15 printsiginfo.c: fix integer conversions
* printsiginfo.c (printsigsource): Print si_pid and si_uid as unsigned
integers.
(printsigval): Print si_int as signed int.
2015-08-21 21:08:30 +03:00
d8ef5e70db Fix decoding of times syscall return value
Always print return value of successful times syscall
as unsigned long integer.

* times.c (sys_times): Return RVAL_UDECIMAL unless syserror.
2015-08-20 21:37:41 +00:00
3585b06f79 mq.c: remove repeated code
* mq.c (sys_mq_open): Use printmqattr instead of implementing it again.
[HAVE_MQUEUE_H]: Remove.
2015-08-20 22:29:15 +03:00
d079fb19f2 ipc_msg.c: fix multiple personalities support in msgrcv ipc subcall
When msgrcv syscall is an ipc subcall, msgp (pointer to struct msgbuf)
and msgtyp (message type) syscall arguments are passed via proxy
structure which definition significantly depends on tracee's
wordsize.

* ipc_msg.c (fetch_msgrcv_args): New function.
(sys_msgrcv): Use it.
2015-08-20 22:21:04 +03:00
c01ad06002 ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.

* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c.  Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
2015-08-20 22:21:04 +03:00
af86bd5bb3 .gitignore: add sen.h and sys_func.h 2015-08-20 22:21:04 +03:00
49182851eb tests: add sendfile.test and sendfile64.test
* tests/sendfile.c: New file.
* tests/sendfile64.c: New file.
* tests/sendfile.test: New test.
* tests/sendfile64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sendfile and sendfile64.
(TESTS): Add sendfile.test and sendfile64.test.
* tests/.gitignore: Add sendfile and sendfile64.
2015-08-19 14:15:07 +00:00
22f8b2753c sendfile: decode file offset both on entering and exiting syscall
When sendfile is called with a valid pointer to a file offset variable,
kernel updates this variable on successfull exit from syscall.

* sendfile.c (sys_sendfile, sys_sendfile64): Print tcp->u_arg[2]
on exiting syscall as well as on entering.
2015-08-19 13:36:44 +00:00
ac2e728a6e io.c: move sendfile parsers to a separate file
* sendfile.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c
2015-08-19 13:36:44 +00:00
d77f6693e4 Make printnum_* functions return boolean status
With this change, printnum_* functions return true iff they
successfully fetched necessary data from tracee's memory.

* defs.h (printnum_short, printnum_int, printnum_int64,
printnum_long_int, printpair_int, printpair_int64): Return bool.
* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
2015-08-19 13:36:44 +00:00
6684b6857c mips: print _MIPS_SIM in configure.ac for debug purposes
* configure.ac [MIPS]: Print _MIPS_SIM.
2015-08-19 13:36:44 +00:00
daae8f9204 xtensa: fix several syscall entries
* linux/xtensa/syscallent.h: Fix nargs in splice, tee, vmsplice,
pselect6, ppoll, epoll_pwait, and set_robust_list syscall entries.
2015-08-19 13:36:44 +00:00
9f1eb12d11 ia64: fix syscall numbers for set_robust_list, get_robust_list, and splice syscalls
* linux/ia64/syscallent.h: Place syscall entries for set_robust_list,
get_robust_list, and splice in correct order.
2015-08-19 13:36:44 +00:00
41b9facc2a tests: add a test for get_robust_list and set_robust_list decoding
* tests/xet_robust_list.c: New file.
* tests/xet_robust_list.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xet_robust_list.
(TESTS): Add xet_robust_list.test.
* tests/.gitignore: Add xet_robust_list.
2015-08-18 20:28:54 +00:00
fe50316d2c Simplify printing of get_robust_list first argument
* get_robust_list.c (sys_get_robust_list): Print first argument
using "%d" format.
2015-08-18 19:16:36 +00:00
afac9f0207 Fix io_setup first argument printing
* aio.c (sys_io_setup): Print first argument using "%u" format.
2015-08-18 16:42:37 +00:00
2479ef0bce Fix printing tracee's long integers
Replace ambiguous printnum_long that used to fetch native long integers
from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
that fetch tracee's pointer, signed long, and unsigned long integers.

* defs.h (printnum_long, printpair_long): Remove prototypes.
(printnum_int64, printpair_int64): Remove macros, declare functions
unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New prototype.
(printnum_ptr, printnum_slong, printnum_ulong): New macros.
* aio.c (sys_io_setup): Use printnum_ulong.
* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
and printnum_ulong.
* io.c (print_off_t): Remove.
(sys_sendfile): Use printnum_ulong.
* ipc.c (sys_semctl): Use printnum_ptr.
* prctl.c (sys_prctl): Likewise.
* process.c (sys_ptrace): Likewise.
* rtc.c (rtc_ioctl): Use printnum_ulong.
* util.c (printnum_long, printpair_long): Remove.
(printnum_int64, printpair_int64): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New function.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
2015-08-18 16:15:33 +00:00
f9b455cfd2 Fix time syscall decoding for some personalities
* time.c (current_time_t_is_int32): Define.
(sys_time): Use it, printnum_int, and printnum_int64 instead
of printnum_long.
* tests/time.c: New file.
* tests/time.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add time.
(TESTS): Add time.test.
* tests/.gitignore: Add time.
2015-08-18 15:10:55 +00:00
d2eaf67486 signal: SIGSYS: decode si_syscall & si_arch fields
When receiving SIGSYS, the si_syscall & si_arch fields are set to known
values, so make sure we decode their values into the symbol settings.
This makes stracing seccomp failures much easier.

* defs.h (syscall_name): New prototype.
* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
(print_si_info): Decode si_syscall & si_arch for SIGSYS.
* syscall.c (undefined_scno_name): Delete.
(syscall_name): New function.
(trace_syscall_entering): Change undefined_scno_name to syscall_name.
(trace_syscall_exiting): Likewise.
* xlat/audit_arch.in: New file.
2015-08-18 07:51:54 +00:00
4d2c8a2cf7 ipc.c: remove unnecesarry #ifdef IPC_64
* ipc.c (PRINTCTL): Remove #ifdef IPC_64 check as IPC_64 is always
defined at this point.
2015-08-18 07:48:37 +00:00
254ff1e623 resource.c: move times parser to a separate file
* times.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_times): Move to times.c.
2015-08-16 10:05:19 +00:00
f1bb6391ea sysctl.c: remove KERN_JAVA_* defines handling
This has been obsoleted by binfmt_misc since Linux 2.1.43.

* sysctl.c (sys_sysctl): Remove KERN_JAVA_INTERPRETER
and KERN_JAVA_APPLETVIEWER.
2015-08-16 09:41:28 +00:00
3a58e46d45 sysinfo.c: remove obsolete code
struct sysinfo members totalhigh, freehigh and mem_unit are present
since Linux 2.3.48.

* configure.ac (AC_CHECK_MEMBERS): Remove struct sysinfo checks.
* sysinfo.c (sys_sysinfo): Remove HAVE_STRUCT_SYSINFO_* checks.
2015-08-16 09:37:28 +00:00
3af6aabe52 tests: add readlink.test and readlinkat.test
* tests/readlink.c: New file.
* tests/readlink.awk: Likewise.
* tests/readlinkat.c: Likewise.
* tests/readlinkat.awk: Likewise.
* tests/readlink.test: New test.
* tests/readlinkat.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add readlink and readlinkat.
(TESTS): Add readlink.test and readlinkat.test.
(EXTRA_DIST): Add readlink.awk and readlinkat.awk.
* tests/.gitignore: Add readlink and readlinkat.
2015-08-15 02:21:22 +02:00
525eed33fa Print nanoseconds along with seconds in stat family syscalls
* configure.ac (AC_CHECK_MEMBERS): Add stat.st_atim.tv_nsec,
stat.st_ctim.tv_nsec, stat.st_mtim.tv_nsec, stat.st_atime_nsec,
stat.st_atime_csec, and stat.st_mtime_nsec.
* file.c: Explicitly define HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC and HAVE_STRUCT_STAT_ST_MTIME_NSEC
for locally defined types.
* printstat.h (DO_PRINTSTAT): Print st_atime_nsec, st_ctime_nsec,
and st_mtime_nsec members.
* tests/stat.c [_FILE_OFFSET_BITS == 64]: Use st_atime_nsec,
st_ctime_nsec, and st_mtime_nsec via st_atim.tv_nsec, st_ctim.tv_nsec,
and st_mtim.tv_nsec.
(main): Print st_atime_nsec, st_ctime_nsec, and st_mtime_nsec members.

This fixes Fedora bug #1251176.
2015-08-09 09:19:55 +00:00
30ac0627f2 signalfd4: fix flags decoding
* configure.ac (AC_CHECK_FUNCS): Add eventfd.
(AC_CHECK_HEADERS): Add sys/signalfd.h.
* signalfd.c: Include <fcntl.h>.
[HAVE_SYS_SIGNALFD_H] Include <sys/signalfd.h>.
Include "xlat/sfd_flags.h".
(do_signalfd): Use sfd_flags for flags decoding.
* xlat/sfd_flags.in: New file.
* tests/signalfd.c: Likewise.
* tests/signalfd.expected: Likewise.
* tests/signalfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add signalfd.
(TESTS): Add signalfd.test.
(EXTRA_DIST): Add signalfd.expected.
* tests/.gitignore: Add signalfd.
2015-08-03 09:57:14 +00:00
9e8a84fa3d signalfd, signalfd4: mark return code with RVAL_FD flag
* signalfd.c (do_signalfd): Set RVAL_FD flag in the return code.
2015-08-03 09:14:28 +00:00
2307d5c968 signal.c: move signalfd parsers to a separate file
* signalfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (do_signalfd, sys_signalfd, sys_signalfd4): Move to signalfd.c
2015-08-03 09:12:26 +00:00
57823c6836 perf_event_open: mark return code with RVAL_FD flag
* perf.c (sys_perf_event_open): Set RVAL_FD flag in the return code.
2015-08-03 09:09:27 +00:00
2a4f0521fc pipe, pipe2, socketpair: print returned descriptors using printfd
* net.c (printpair_fd, decode_pair_fd): New functions.
(do_pipe, sys_socketpair): Use them.
2015-08-03 09:09:26 +00:00
3d463be47e socket: mark return code with RVAL_FD flag
* net.c (sys_socket): Set RVAL_FD flag in the return code.
* tests/net-yy-accept.awk: Update socket and bind regexps.
* tests/unix-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Update socket and connect regexps.
* tests/unix-yy-connect.awk: Likewise.
2015-08-03 09:09:26 +00:00
07c878a9b5 timerfd, timerfd_create: mark return code with RVAL_FD flag
* time.c (sys_timerfd, sys_timerfd_create): Set RVAL_FD flag
in the return code.
2015-08-03 09:09:00 +00:00
323d912e0c inotify_init1: mark return code with RVAL_FD flag
* inotify.c (sys_inotify_init1): Set RVAL_FD flag in the return code.
2015-08-02 01:34:57 +00:00
5d22f0742a fanotify_init: mark return code with RVAL_FD flag
* fanotify.c (sys_fanotify_init): Set RVAL_FD flag in the return code.
2015-08-02 01:31:40 +00:00
baaa41c97a Fix epoll_create syscall decoding
* epoll.c (sys_epoll_create): New function.
* linux/dummy.h (sys_epoll_create): Remove.
2015-08-02 00:10:52 +00:00
7b378e6b04 epoll_create1: mark return code with RVAL_FD flag
* epoll.c (sys_epoll_create1): Set RVAL_FD flag in the return code.
2015-08-02 00:10:52 +00:00
2716346602 epoll_create1: fix pathtrace support
* pathtrace.c (pathtrace_match): Add SEN_epoll_create1.
2015-08-02 00:10:52 +00:00
bf62c1b52d epoll_create1: fix flags decoding
* xlat/epollflags.in: Remove EPOLL_NONBLOCK, provide fallback definition
for EPOLL_CLOEXEC.
* tests/epoll_create1.c: New file.
* tests/epoll_create1.expected: Likewise.
* tests/epoll_create1.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add epoll_create1.
(TESTS): Add epoll_create1.test.
(EXTRA_DIST): Add epoll_create1.expected.
* tests/.gitignore: Add epoll_create1.
2015-08-02 00:10:48 +00:00
aba868c6c4 desc.c: move epoll parsers to a separate file
* epoll.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (sys_epoll_create1, print_epoll_event, sys_epoll_ctl,
print_epoll_event_array, epoll_wait_common, epoll_wait, epoll_pwait):
Move to epoll.c.
2015-08-01 23:30:03 +00:00
c8cba990a2 eventfd2: fix flags decoding
* configure.ac (AC_CHECK_HEADERS): Add sys/eventfd.h.
* eventfd.c: Include <fcntl.h>.
[HAVE_SYS_EVENTFD_H] Include <sys/eventfd.h>.
Include "xlat/efd_flags.h".
(do_eventfd): Use efd_flags for flags decoding.
* xlat/efd_flags.in: New file.
* tests/eventfd.c: New file.
* tests/eventfd.expected: Likewise.
* tests/eventfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add eventfd.
(TESTS): Add eventfd.test.
(EXTRA_DIST): Add eventfd.expected.
* tests/.gitignore: Add eventfd.
2015-08-01 22:23:58 +00:00
00cc35079e eventfd: print first argument as unsigned int
* eventfd.c (do_eventfd): Explicitly cast initial value to unsigned int.
2015-08-01 20:46:43 +00:00
ede0c48554 Mark eventfd return code with RVAL_FD flag
* eventfd.c (do_eventfd): Set RVAL_FD flag in the return code.
2015-08-01 20:46:43 +00:00
28471d17f9 desc.c: move eventfd parsers to a separate file
* eventfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (do_eventfd, sys_eventfd, sys_eventfd2): Move to eventfd.c.
2015-08-01 20:46:43 +00:00
73a4fa43f5 Update PERF_FLAG_* constants
* xlat/perf_event_open_flags.in: Add PERF_FLAG_FD_CLOEXEC,
provide fallback definitions.
2015-08-01 20:46:43 +00:00
0d60cf753e desc.c: move perf_event_open parser to a separate file
* perf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (sys_perf_event_open): Move to perf.c.
2015-08-01 20:46:37 +00:00
2c217fd8e2 time.c: remove obsolete code from adjtimex parser
Linux versions 1.3.28 and below are not supported.

* time.c (tprint_timex) [LINUX_VERSION_CODE < 66332]: Remove.
2015-08-01 16:52:43 +00:00
f9ce39d1e4 ipc.c: move fallback definitions of msg, sem, and shm constants to xlat/
* ipc.c: Move MSG_STAT and MSG_INFO definitions to xlat/msgctl_flags.in.
Move SHM_STAT and SHM_INFO definitions to xlat/shmctl_flags.in.
Move SEM_STAT and SEM_INFO definitions to xlat/semctl_flags.in.
2015-08-01 16:52:43 +00:00
0c0453a1cb tests/ppoll: replace SIGABRT with SIGHUP
Use SIGHUP instead of SIGABRT, the number of the former
is more portable across architectures.

* tests/ppoll.c (test2): Replace SIGABRT with SIGHUP.
* tests/ppoll.expected: Update regexp.
* tests/ppoll-v.expected: Likewise.
2015-08-01 16:52:13 +00:00
3b9d315e8c decode_poll_exiting: reserve more space in output buffer
* poll.c (decode_poll_exiting): Reserve more space in output buffer.
2015-08-01 08:37:46 +00:00
d9fb450748 Cleanup poll/ppoll decoders
* poll.c (decode_poll): Split into print_pollfd, decode_poll_entering,
and decode_poll_exiting.
(sys_poll, sys_ppoll): Update callers.
* tests/ppoll.c: New file.
* tests/ppoll.expected: Likewise.
* tests/ppoll-v.expected: Likewise.
* tests/ppoll.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ppoll.
(TESTS): Add ppoll.test.
(EXTRA_DIST): Add ppoll.expected and ppoll-v.expected.
* tests/.gitignore: Add ppoll.
2015-07-30 22:03:07 +00:00
c18b002fe9 poll: print timeout argument as int
* poll.c (sys_poll): Explicitly cast timeout argument to int.
2015-07-30 22:03:07 +00:00
811bda6225 stream.c: move poll and ppoll parsers to a separate file
* poll.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* stream.c (decode_poll, sys_poll, sys_ppoll): Move to poll.c.
2015-07-30 22:03:07 +00:00
80d5e012a1 Assume that <poll.h> is available
* configure.ac (AC_CHECK_HEADERS): Remove poll.h and sys/poll.h.
* pathtrace.c: Include <poll.h> unconditionally.
* stream.c: Likewise.
[HAVE_SYS_POLL_H]: Compile unconditionally.
[!HAVE_SYS_POLL_H]: Remove.
2015-07-30 22:03:07 +00:00
ea7ef9365f tests: add oldselect.test
* tests/oldselect.c: New file.
* tests/oldselect.expected: Likewise.
* tests/oldselect.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add oldselect.
(TESTS): Add oldselect.test.
(EXTRA_DIST): Add oldselect.expected.
* tests/.gitignore: Add oldselect.
2015-07-30 22:03:07 +00:00
c44df3e3ca Fix oldselect decoding on 64-bit architectures
As struct sel_arg_struct is an array of 32-bit values,
fetch it using an intermediate array on 64-bit architectures.

* desc.c (sys_oldselect): Rename args to long_args.
[SIZEOF_LONG == 4] Alias oldselect_args to long_args.
[SIZEOF_LONG != 4] Introduce oldselect_args to fetch oldselect args.
* linux/sh64/syscallent.h (oldselect): Remove.
2015-07-30 22:02:56 +00:00
52dc1506ab net.c: use printaddr
* net.c (printsock, sys_recvfrom): Use printaddr.
2015-07-30 13:53:42 +00:00
383386de73 net.c: recvfrom fixes
This change fixes these three problems (before/after is shown):

On interrupted syscall, flags are not decoded:

    -recvfrom(3, 0x7fff0a41e306, 10, 2, 0, 0) = ? ERESTARTSYS
    +recvfrom(3, 0x7fff0a41e306, 10, MSG_PEEK, 0, 0) = ? ERESTARTSYS

If peer address is unavalable (example: anon sockets from socketpair()),
kernel returns socklen of 0, but we ignore that and show bogus sockaddr data:

    -recvfrom(3, "123456789\0", 10, MSG_PEEK, {sa_family=0x7777 /* AF_??? */, sa_data="wwwwwwwwwwwwww"}, [0]) = 10
    +recvfrom(3, "123456789\0", 10, MSG_PEEK, 0x7ffde6edf760, [0]) = 10

SYS_FUNC(recvfrom) passes address of fromlen, not fromlen, to printsock():

    -               printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
    +               printsock(tcp, tcp->u_arg[4], fromlen);

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-07-30 13:38:32 +02:00
1d246ce3d4 prctl: decode Android-specific PR_SET_VMA
Android kernels have a prctl to name VMAs.

* prctl.c (sys_prctl) [__ANDROID__]: Decode PR_SET_VMA.
2015-07-29 22:54:11 +00:00
0e4b1f2eb3 mips: fix stub files
This complements commit 140ecf8766.

* linux/mips/genstub.sh: Output SEN(printargs) instead of printargs.

Reported-by: Elliott Hughes <enh@google.com>
2015-07-29 22:54:11 +00:00
4e3ded36ef tests/bpf: fix build with incompatibly old linux/bpf.h and/or gcc
* configure.ac: Check how union bpf_attr.log_buf initialization works.
* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_LOG_BUF.
2015-07-29 22:53:07 +00:00
3456bcca67 Implement sched_getattr and sched_setattr syscalls decoding
* xlat/sched_flags.in: New file.
* sched.c: Include "xlat/sched_flags.h".
(print_sched_attr, sys_sched_setattr, sys_sched_getattr): New functions.
* linux/dummy.h (sys_sched_getattr, sys_sched_setattr): Remove.
* tests/sched_xetattr.c: New file.
* tests/sched_xetattr.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sched_xetattr.
(TESTS): Add sched_xetattr.test.
* tests/.gitignore: Add sched_xetattr.
2015-07-29 09:18:26 +00:00
95b84ea641 Implement memfd_create syscall decoding
* memfd_create.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_memfd_create): Remove.
* pathtrace.c (pathtrace_match): Add SEN_memfd_create.
* xlat/memfd_create_flags.in: New file.
* tests/memfd_create.c: New file.
* tests/memfd_create.expected: Likewise.
* tests/memfd_create.test: New test.
* tests/Makefile.am: (check_PROGRAMS): Add memfd_create.
(TESTS): Add memfd_create.test.
(EXTRA_DIST): Add memfd_create.expected.
* tests/.gitignore: Add memfd_create.
2015-07-29 09:18:26 +00:00
e46534351d Fix builds where HAVE_MQUEUE_H isn't defined
Android doesn't have <mqueue.h>.

* ipc.c (sys_mq_open) [!HAVE_MQUEUE_H]: Fix printaddr invocation.
2015-07-28 22:40:01 +00:00
afa10d877c tests/restart_syscall: skip if nanosleep looks uninterrupted
* tests/restart_syscall.test: Skip if restart_syscall is not detected
and nanosleep syscall looks uninterrupted.
2015-07-27 15:27:43 +00:00
7c2210190a Implement execveat syscall decoding
* execve.c (decode_execve): New function.
(sys_execve): Use it.
(sys_execveat): New function.
* linux/dummy.h (sys_execveat): Remove.
* tests/execveat.c: New file.
* tests/execveat.expected: Likewise.
* tests/execveat-v.expected: Likewise.
* tests/execveat.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add execveat.
(TESTS): Add execveat.test.
(EXTRA_DIST): Add execveat.expected and execveat-v.expected.
* tests/.gitignore: Add execveat.
2015-07-27 15:27:43 +00:00
4ff687bb31 execve: fix support of personalities with different word size
* execve.c (printargc): Do not assume that host and target pointers have
the same size.
* tests/execve.c: New file.
* tests/execve.expected: Likewise.
* tests/execve-v.expected: Likewise.
* tests/execve.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add execve.
(TESTS): Add execve.test.
(EXTRA_DIST): Add execve.expected and execve-v.expected.
* tests/.gitignore: Add execve.
2015-07-27 15:27:43 +00:00
ddb53dd142 Implement bpf syscall decoding
* bpf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Add linux/bpf.h.
* linux/dummy.h (sys_bpf): Remove.
* pathtrace.c (pathtrace_match): Add SEN_bpf.
* xlat/bpf_commands.in: New file.
* xlat/bpf_map_types.in: New file.
* xlat/bpf_map_update_elem_flags.in: New file.
* xlat/bpf_prog_types.in: New file.
* tests/bpf.c: New file.
* tests/bpf.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add bpf.
(TESTS): Add bpf.test.
* tests/.gitignore: Add bpf.
2015-07-27 15:27:43 +00:00
3691562e7d prctl: fix decoding of unrecognized commands
The use of printargs introduced by commit v4.10-179-g210a6b6 is wrong:
when the first argument is already printed, printargs cannot be called.

* prctl.c (print_prctl_args): New function.
(sys_prctl): Use it.
2015-07-25 09:55:02 +00:00
f8b49133b7 Macroize -m32/-mx32 configure checks
Prepare for additional configure checks that would be needed
for new multiple personalities support.

* m4/mpers.m4: New file.
* configure.ac: Use it.
2015-07-23 11:39:32 +00:00
04fcb99972 tests/uid: import uid overflow check from tests/uid16
* tests/uid.c (main): Skip if the uid returned by getuid matches
/proc/sys/kernel/overflowuid.
2015-07-22 19:47:39 +00:00
ae61067ce6 sh64: fix inotify_{add,rm}_watch syscall entries
* linux/sh64/syscallent.h (inotify_add_watch, inotify_rm_watch):
Set sys_func.
2015-07-21 19:09:35 +00:00
1e0efbb18d microblaze: fix several syscall entries
* linux/microblaze/syscallent.h (signalfd4, eventfd2, epoll_create1,
dup3, pipe2, inotify_init1, recvmmsg): Set sys_func.
2015-07-21 19:09:35 +00:00
be547c19da hppa: fix several syscall entries
* linux/hppa/syscallent.h (remap_file_pages, mq_open, mq_unlink,
mq_timedsend, mq_timedreceive, mq_notify, mq_getsetattr,
clock_nanosleep, signalfd, timerfd): Set sys_func.
2015-07-21 19:09:35 +00:00
d00eb1f58d ia64: fix getpagesize syscall entry
* linux/ia64/syscallent.h (getpagesize): Fux nargs.
2015-07-21 19:09:35 +00:00
76c9f0ecb7 avr32: fix fstatat64 syscall entry
* linux/avr32/syscallent.h (fstatat64): Set sys_func.
2015-07-21 19:09:35 +00:00
ecabdcf959 alpha: fix 2 dummy osf syscall entries
* linux/alpha/syscallent.h (osf_set_program_attributes): Fix nargs.
(osf_sigstack): Fix nargs and sys_name.
2015-07-21 19:09:35 +00:00
82841f7e7e alpha, arm, ia64, mips, sh64: fix semop syscall entries
* linux/alpha/syscallent.h (semop): Fix nargs, set sys_func.
* linux/ia64/syscallent.h (semop): Set sys_func.
* linux/mips/syscallent-n32.h (semop): Likewise.
* linux/mips/syscallent-n64.h (semop): Likewise.
* linux/arm/syscallent.h (semop): Fix nargs.
* linux/sh64/syscallent.h (semop): Likewise.
2015-07-21 19:09:35 +00:00
ece9ce6fea m68k: fix getpagesize decoding
* linux/m68k/syscallent.h (getpagesize): Set sys_func.
* mem.c [M68K] (sys_getpagesize): Define.
2015-07-21 19:09:35 +00:00
f1548d93f1 tests/ip_mreq: skip if basic setsockopt operations fail
* tests/ip_mreq.c (main): Return 77 if basic
IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP options cannot be set.
2015-07-21 19:09:35 +00:00
95eaf19644 tests: use -lpthread instead of -pthread
On some obscure systems, -lpthread is more likely to work than -pthread.

* tests/Makefile.am (filter_unavailable_LDFLAGS): Rename to
filter_unavailable_LDADD and change to -lpthread.
2015-07-21 19:09:35 +00:00
ce93bbdef1 mips o32: fix utimensat syscall entry
* linux/mips/syscallent-o32.h (utimensat): set sys_flags and sys_func.
2015-07-21 19:09:35 +00:00
ba8b9556bb linux/mips/syscallent-compat.h: use designated initializers
Change linux/mips/syscallent-compat.h to use designated initializers
like normal syscallent.h files.

* linux/mips/syscallent-compat.h: Use designated initializers.
2015-07-21 19:09:35 +00:00
a3eb3b410d linux/mips/syscallent-compat.h: fix initalization of empty entries
This complements commit 140ecf8766.

* linux/mips/syscallent-compat.h: Fix initalization of empty entries.
2015-07-21 19:09:35 +00:00
716fb20263 Remove unused parsers of getmsg and putmsg
* stream.c [SPARC || SPARC64] (sys_putmsg, sys_getmsg): Remove.
Stop including "xlat/msgflags.h".
* xlat/msgflags.in: Remove.
2015-07-20 22:41:56 +00:00
fa6c0879c7 sigreturn: make use of RVAL_DECODED
* sigreturn.c (arch_sigreturn): New function.
(sys_sigreturn): Use it.  Return RVAL_DECODED.
* linux/alpha/arch_sigreturn.c: Update.
* linux/crisv10/arch_sigreturn.c: Likewise.
* linux/m68k/arch_sigreturn.c: Likewise.
* linux/microblaze/arch_sigreturn.c: Likewise.
* linux/x86_64/arch_sigreturn.c: Likewise.
2015-07-20 22:03:07 +00:00
eebb5616bf or1k_atomic.c: make use of RVAL_DECODED
* or1k_atomic.c (sys_or1k_atomic): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
57ae04e402 Update openat parser for the RVAL_DECODED change
* open.c (sys_openat): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
d9e87921de bjm.c: make use of RVAL_DECODED
* bjm.c (sys_create_module, sys_delete_module, sys_init_module,
sys_finit_module): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
0b2eabeed4 access.c: make use of RVAL_DECODED
* access.c (decode_access, sys_faccessat): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
8aa2a81233 affinity.c: make use of RVAL_DECODED
* affinity.c (sys_sched_setaffinity): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
a52375f748 affinity.c: use printaddr and umove_or_printaddr
* affinity.c (print_affinitylist): Use printaddr and umove_or_printaddr.
(sys_sched_getaffinity): Remove redundant u_rval check.
2015-07-20 22:03:07 +00:00
07eaf50848 aio.c: enhance io_* syscalls decoding
* aio.c (sys_io_setup): Use printnum_int64 and printnum_long.
(sys_io_destroy, sys_io_submit): Update for RVAL_DECODED.
(sys_io_submit): Use umove_or_printaddr and printaddr.
Enclose iocb array in square brackets.
Change to traditional structure output format.
(print_io_event): New function.
(sys_io_cancel, sys_io_getevents): Use it.
(sys_io_cancel): Use umove_or_printaddr and printaddr.
(sys_io_getevents): Use printaddr.
2015-07-20 22:03:07 +00:00
4b6fc98816 cacheflush.c: make use of RVAL_DECODED
* cacheflush.c (sys_cacheflush): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
bb16ee1f65 cacheflush.c: use printaddr
* cacheflush.c (sys_cacheflush): Use printaddr.
2015-07-20 22:03:07 +00:00
ff33aac4e9 capability.c: make use of RVAL_DECODED
* capability.c (sys_capset): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
c70da7c15e capability.c: use printaddr and umove_or_printaddr
* capability.c (get_cap_header): Use printaddr.
(print_cap_data): Use printaddr and umove_or_printaddr.
2015-07-20 22:03:07 +00:00
474083a189 chdir.c: make use of RVAL_DECODED
* chdir.c (sys_chdir): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
a4d45720d0 chmod.c: make use of RVAL_DECODED
* chmod.c (decode_chmod): Change to return void.
(sys_chmod, sys_fchmodat): Update callers.  Update for RVAL_DECODED.
(sys_fchmod): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
10e407dfb3 clone.c: make use of RVAL_DECODED
* clone.c (sys_setns, sys_unshare, sys_fork): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
cbabaf9141 Alias sys_epoll_create to printargs_ld
* desc.c (sys_epoll_create): Remove.
* linux/dummy.h (sys_epoll_create): Alias to printargs_ld.
2015-07-20 22:03:07 +00:00
df0c18c4a3 desc.c: make use of RVAL_DECODED
* desc.c (sys_flock, sys_close, sys_dup, do_dup2, sys_epoll_create1,
sys_epoll_ctl, do_eventfd, sys_perf_event_open): Update
for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
e6019fd424 desc.c: do not use xmalloc, use umove_or_printaddr and printaddr
* desc.c (printflock64, printflock): Use umove_or_printaddr.
(decode_select): Do not use xmalloc.  Use umoven_or_printaddr
and printaddr.
(sys_oldselect): Use printaddr.
(sys_epoll_ctl): Use umoven_or_printaddr and printaddr.
(print_epoll_event_array): New function.
(sys_epoll_wait_common): Use it.
(sys_pselect6): Use umove_or_printaddr.
(sys_eventfd2): Use printaddr.
2015-07-20 22:03:07 +00:00
d4b3f6a8e2 xlat/epollctls.in: add default values
* xlat/epollctls.in (EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD): Add
default values.
2015-07-20 22:03:07 +00:00
3ef50217c1 dirent.c: do not use xmalloc
* dirent.c (print_old_dirent): Use umove_or_printaddr.
(sys_readdir): Use printaddr.
(sys_getdents, sys_getdents64): Do not use xmalloc for dirents,
treat malloc failure the same way as umoven failure.  Use printaddr.
2015-07-20 22:03:07 +00:00
7e56b4e5ae execve.c: make use of RVAL_DECODED
* execve.c (sys_execve, sys_execv): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
ad18132608 execve.c: use printaddr and umove_or_printaddr
* execve.c (printargv): Use umoven_or_printaddr.
(sys_execve, sys_execv): Use printaddr.
2015-07-20 22:03:07 +00:00
429c6775d4 fadvise.c: make use of RVAL_DECODED
* fadvise.c (sys_fadvise64, sys_fadvise64_64): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
5dcf3b1642 fallocate.c: make use of RVAL_DECODED
* fallocate.c (sys_fallocate): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
a3a7ffee58 fanotify.c: make use of RVAL_DECODED
* fanotify.c (sys_fanotify_init, sys_fanotify_mark): Update
for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
f891bb4373 fchownat.c: make use of RVAL_DECODED
* fchownat.c (sys_fchownat): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
b6d80ffe02 file.c: use umove_or_printaddr
* file.c (printstat32, printstatsol): Remove.
(printstat, printstat64, printoldstat): Use umove_or_printaddr.
2015-07-20 22:03:07 +00:00
b5821091ee futex.c: enhance futex syscall decoding
* futex.c (sys_futex): Use switch statement.  Use printaddr.
Print uint32_t syscall arguments using %u format.
Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
a9183c3958 get_robust_list.c: use printnum_long
* get_robust_list.c (sys_get_robust_list): Use printnum_long.
2015-07-20 22:03:07 +00:00
bc863e9cae getcpu.c: use printnum_int and printaddr
* getcpu.c (sys_getcpu): Use printnum_int and printaddr.
2015-07-20 22:03:07 +00:00
071193f620 getcwd.c: use printaddr
* getcwd.c (sys_getcwd): Use printaddr.
2015-07-20 22:03:07 +00:00
aa9f687ff3 getrandom.c: use printaddr
* getrandom.c (sys_getrandom): Use printaddr.
2015-07-20 22:03:07 +00:00
3aced79818 hostname.c: make use of RVAL_DECODED
* hostname.c (sys_sethostname): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
3f08e2d4d5 hostname.c: use printaddr
* hostname.c (sys_gethostname): Use printaddr.
2015-07-20 22:03:07 +00:00
fe3cdfc68d inotify.c: make use of RVAL_DECODED
* inotify.c (sys_inotify_add_watch, sys_inotify_rm_watch,
sys_inotify_init1): Update for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
1f255fd968 io.c: make use of RVAL_DECODED
* io.c (sys_write, sys_writev, sys_pwrite, sys_pwritev, sys_sendfile,
sys_sendfile64, sys_tee, sys_splice, sys_vmsplice): Update
for RVAL_DECODED.
2015-07-20 22:03:06 +00:00
dd5f0cef93 Use printnum_int64 instead of print_loff_t
* defs.h (print_loff_t): Remove.
* io.c (print_loff_t): Remove.
(sys_sendfile64, sys_splice): Use printnum_int64 instead of print_loff_t.
* mtd.c (mtd_ioctl): Likewise.
2015-07-20 22:03:06 +00:00
43b5a1f985 io.c: use printaddr and umove_or_printaddr
* io.c (sys_read, sys_pread): Use printaddr.
(tprint_iov_upto): Do not fetch data in case of syserror.
Use printaddr.
(sys_readv, sys_preadv): Remove redundant check for syserror.
(print_off_t): Use printnum_int and printnum_long.
(print_loff_t): Use umove_or_printaddr.
2015-07-20 22:03:06 +00:00
a58ad74f79 ioprio.c: make use of RVAL_DECODED
* ioprio.c (sys_ioprio_set): Update for RVAL_DECODED.
2015-07-20 22:03:06 +00:00
2370d53281 ipc.c: use printaddr and umove_or_printaddr
* ipc.c (sys_msgctl): Use printaddr.
(tprint_msgbuf): New function.
(tprint_msgsnd, tprint_msgrcv): Use it.
(sys_msgrcv): Use umove_or_printaddr.
(tprint_sembuf): Rename to tprint_sembuf_array.
(tprint_sembuf): New function.
(tprint_sembuf_array): Use it.
(sys_semop, sys_semtimedop): Update callers.
(sys_shmctl, sys_shmat, sys_shmdt): Use printaddr.
(sys_mq_open, printmqattr): Use printaddr and umove_or_printaddr.
* tests/ipc_msg.c (main): Update msgctl IPC_RMID regexp.
* tests/ipc_shm.c (main): Update shmctl IPC_RMID regexp.
2015-07-20 22:03:06 +00:00
2f444dc871 kexec.c: use printaddr and umove_or_printaddr
* kexec.c (print_seg): New function.
(print_kexec_segments): Use it.  Use printaddr and umove_or_printaddr.
(kexec_load): Use printaddr.  Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
4eef291671 keyctl.c: make use of RVAL_DECODED
* keyctl.c (sys_add_key, sys_request_key): Update for RVAL_DECODED.
(keyctl_join_session_keyring, keyctl_handle_key,
keyctl_set_reqkey_keyring): Remove.
(keyctl_get_keyring_id, keyctl_update_key, keyctl_handle_key_key,
keyctl_read_key, keyctl_keyring_search, keyctl_chown_key,
keyctl_instantiate_key, keyctl_instantiate_key_iov, keyctl_negate_key,
keyctl_reject_key, keyctl_set_timeout, keyctl_get_persistent,
keyctl_setperm_key): Change to return void.
Update for RVAL_DECODED.
(sys_keyctl): Update callers.  Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
5f6ca3d475 keyctl.c: use printaddr
* keyctl.c (keyctl_read_key): Use printaddr.
2015-07-20 01:42:01 +00:00
583526e44a ldt.c: make use of RVAL_DECODED
* ldt.c (sys_modify_ldt, sys_set_thread_area, sys_get_thread_area):
Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
79a45942b6 ldt.c: use printaddr and umove_or_printaddr
* ldt.c [I386 || X86_64 || X32] (print_user_desc):
Use umove_or_printaddr.
[I386 || X86_64 || X32] (sys_modify_ldt): Use printaddr.
[(M68K || MIPS] (set_thread_area): Likewise.
[I386 || X86_64 || X32] (set_thread_area): Do not fetch data
if !verbose.
[I386 || X86_64 || X32] (get_thread_area): Remove redundant check
for syserror.
2015-07-20 01:42:01 +00:00
4e33965809 link.c: make use of RVAL_DECODED
* link.c (sys_link, sys_linkat, sys_unlinkat, sys_symlinkat): Update
for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
ed88a50630 lseek.c: make use of RVAL_DECODED
* lseek.c (sys_lseek): Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
7db808d749 lseek.c: use printnum_int64
* lseek.c (sys_llseek): Use printnum_int64.
2015-07-20 01:42:01 +00:00
85813ceb2d mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers.  Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
2c389f6751 mem.c: use printaddr and umove_or_printaddr
* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
2015-07-20 01:42:01 +00:00
c15dd41453 mknod.c: make use of RVAL_DECODED
* mknod.c (decode_mknod): Change to return void.
Update for RVAL_DECODED.
(sys_mknod, sys_mknodat): Update callers.  Update for RVAL_DECODED.
[SPARC || SPARC64] (xmknod): Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
ef08ed1a03 mount.c: make use of RVAL_DECODED
* mount.c (sys_mount): Update for RVAL_DECODED.
2015-07-20 01:42:01 +00:00
5935850c4d mount.c: use printaddr
* mount.c (sys_mount): Use printaddr.
2015-07-20 01:42:00 +00:00
771c2a4651 Alias sys_connect to sys_bind
* linux/dummy.h (sys_connect): Alias to sys_bind.
* net.c (sys_connect): Remove.
2015-07-20 01:42:00 +00:00
219b3a79b4 net.c: make use of RVAL_DECODED
* net.c (sys_socket, sys_bind, sys_listen, sys_send, sys_sendto,
sys_sendmsg, sys_shutdown, sys_setsockopt): Update for RVAL_DECODED.
2015-07-20 01:42:00 +00:00
6c277da205 net.c: use printaddr and umove_or_printaddr
* net.c (printsock): Use printaddr and umove_or_printaddr.
(printcmsghdr, printmsghdr, printmmsghdr, decode_mmsg, do_sockname,
sys_recv, sys_recvfrom, sys_recvmsg, do_pipe, print_linger, print_ucred,
print_tpacket_stats, print_icmp_filter, print_getsockopt,
print_group_req, print_tpacket_req, print_packet_mreq,
print_setsockopt): Use printaddr.
(print_mreq, print_mreq6): Use umove_or_printaddr.
2015-07-20 01:42:00 +00:00
10020ae191 tests: add sigaltstack.test
* tests/sigaltstack.c: New file.
* tests/sigaltstack.expected: Likewise.
* tests/sigaltstack.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sigaltstack.
(TESTS): Add sigaltstack.test.
(EXTRA_DIST): sigaltstack.expected.
* tests/.gitignore: Add sigaltstack.
2015-07-18 00:01:40 +00:00
b1c448cd47 bootstrap: delete personality test directories beforehand
* bootstrap: Delete tests-m32 and tests-mx32 directories
before creating them.
2015-07-18 00:01:40 +00:00
0e946ab2c2 defs.h: do not include <signal.h>
* printsiginfo.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Do not include <signal.h>.
(printsiginfo): Remove.
* printsiginfo.c: Include <signal.h> and "printsiginfo.h".
* strace.c: Likewise.
* sigaltstack.c: Include <signal.h>.
* signal.c: Likewise.
* sigreturn.c: Likewise.
* time.c: Likewise.
2015-07-18 00:01:40 +00:00
1e08a160f7 resource.c: move printrusage and printrusage32 to a separate file
* printrusage.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (printrusage, [ALPHA] printrusage32): Move
to printrusage.c.
2015-07-18 00:01:40 +00:00
d62d8fd671 open.c: make use of RVAL_DECODED
* open.c (decode_open, sys_creat): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
ada84324ae personality.c: make use of RVAL_DECODED
* personality.c (sys_personality): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
a528eb5b49 printsiginfo.c: use umove_or_printaddr
* printsiginfo.c (printsiginfo_at): Use umove_or_printaddr.
2015-07-18 00:01:40 +00:00
210a6b6884 prctl.c: make use of RVAL_DECODED
* prctl.c (prctl_enter, prctl_exit): Merge into sys_prctl.
(sys_prctl, sys_arch_prctl): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
7c53e984ac prctl.c: use printaddr and umove_or_printaddr
* prctl.c (prctl_exit): Use printaddr and umove_or_printaddr.
2015-07-18 00:01:40 +00:00
14446ebcf6 process.c: use printaddr
* process.c (sys_ptrace): Use printaddr.
2015-07-18 00:01:40 +00:00
684c9e9d3d process_vm.c: make use of RVAL_DECODED
* process_vm.c (sys_process_vm_writev): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
66a344c006 process_vm.c: use printaddr
* process_vm.c (sys_process_vm_readv): Use printaddr.
2015-07-18 00:01:40 +00:00
307945d4d9 reboot.c: make use of RVAL_DECODED
* reboot.c (sys_reboot): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
0564623abf Enhance quotactl decoding
* quota.c (decode_cmd_data): Use umove_or_printaddr.
(sys_quotactl): Do not disable the parser in verbose mode.
Decode all "set" commands on entering syscall.
2015-07-18 00:01:40 +00:00
8ef8a4c095 readahead.c: make use of RVAL_DECODED
* readahead.c (sys_readahead.c): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
8e0a18fa7f readlink.c: use printaddr
* readlink.c (decode_readlink): Use printaddr.
2015-07-18 00:01:40 +00:00
fe62e3312b renameat.c: make use of RVAL_DECODED
* renameat.c (sys_renameat, sys_renameat2): Update for RVAL_DECODED.
2015-07-18 00:01:40 +00:00
2b15a5848e resource.c: make use of RVAL_DECODED
* resource.c (sys_setrlimit, sys_getpriority, sys_setpriority):
Update for RVAL_DECODED.
2015-07-18 00:01:39 +00:00
7cc79b4137 resource.c: use umove_or_printaddr
* resource.c (print_rlimit64, print_rlimit32, printrusage32,
printrusage, sys_times): Use umove_or_printaddr.
(decode_rlimit64): Remove.
(decode_rlimit): Remove redundant checks.
[defined(current_wordsize) && current_wordsize != 4] (decode_rlimit):
Define to print_rlimit64.
(sys_prlimit64): Replace decode_rlimit64 with print_rlimit64.
2015-07-18 00:01:39 +00:00
10c408acea sched.c: make use of RVAL_DECODED
* sched.c (sys_sched_setscheduler, sys_sched_setparam,
sys_sched_get_priority_min): Update for RVAL_DECODED.
2015-07-18 00:01:39 +00:00
f8bf1d5633 sched.c: use printnum_int and printaddr
* sched.c (sys_sched_setscheduler, sys_sched_getparam,
sys_sched_setparam): Use printnum_int for sched_param decoding.
(sched_rr_get_interval): Use printaddr.
2015-07-18 00:01:39 +00:00
8277ec9c60 scsi.c: use printaddr
* scsi.c (print_sg_io_buffer): Use printaddr.
2015-07-18 00:01:39 +00:00
1252d26db8 seccomp.c: make use of RVAL_DECODED
* seccomp.c (sys_seccomp): Update for RVAL_DECODED.
2015-07-17 01:16:16 +00:00
931ebbfd92 seccomp.c: use printaddr and umove_or_printaddr
* seccomp.c (decode_fprog, decode_seccomp_set_mode_strict):
Use printaddr.
(print_seccomp_filter): Use umove_or_printaddr.
2015-07-17 01:16:16 +00:00
401295ea32 sigaltstack.c: use printaddr and umove_or_printaddr
* sigaltstack.c (print_stack_t): Use umove_or_printaddr and printaddr.
2015-07-17 01:16:16 +00:00
0e45b50ce6 signal.c: make use of RVAL_DECODED
* signal.c (sys_sigsuspend, sys_kill, sys_tgkill, sys_rt_sigsuspend,
sys_rt_sigqueueinfo, sys_rt_tgsigqueueinfo, sys_restart_syscall,
do_signalfd): Update for RVAL_DECODED.
2015-07-17 00:54:55 +00:00
735843e23a signal.c: use printaddr and umove_or_printaddr
* signal.c (print_sigset_addr_len, decode_old_sigaction):
Use printaddr and umove_or_printaddr.
(sys_signal): Use printaddr.
(sys_sigprocmask, sys_sigpending, sys_rt_sigprocmask,
sys_rt_sigpending): Remove redundant checks for syserror.
(decode_new_sigaction): Use umove_or_printaddr.
2015-07-17 00:54:55 +00:00
490d58c394 sram_alloc.c: make use of RVAL_DECODED
* sram_alloc.c [BFIN] (sys_sram_alloc): Update for RVAL_DECODED.
2015-07-16 23:44:57 +00:00
fd55b54112 statfs.c: use umove_or_printaddr
* statfs.c (printstatfs, printstatfs64, printcompat_statfs64):
Use umove_or_printaddr.
2015-07-16 23:44:57 +00:00
9afb4d06c0 swapon.c: make use of RVAL_DECODED
* swapon.c (sys_swapon): Update for RVAL_DECODED.
2015-07-16 23:44:57 +00:00
63bae232d2 swapon.c: move fallback definitions of swap options to xlat/
* swapon.c: Move definitions of SWAP_FLAG_* flags ...
* xlat/swap_flags.in: ... here.
2015-07-16 23:44:57 +00:00
69c1c4e46a sync_file_range2: fix typo in flags decoding
* sync_file_range.c (sys_sync_file_range2): Fix typo in flags decoding.
2015-07-16 23:44:57 +00:00
d6ed7948f7 sync_file_range.c: make use of RVAL_DECODED
* sync_file_range.c (sys_sync_file_range, sys_sync_file_range2): Update
for RVAL_DECODED.
2015-07-16 23:44:57 +00:00
5717e7af0d syslog.c: use umove_or_printaddr and RVAL_DECODED
* sysctl.c (sys_sysctl): Use umove_or_printaddr and RVAL_DECODED.
2015-07-16 23:44:57 +00:00
be6d79146c sysinfo.c: use umove_or_printaddr
* sysinfo.c (sys_sysinfo): Use umove_or_printaddr.
2015-07-16 22:58:12 +00:00
279df2cc75 syslog.c: make use of RVAL_DECODED
* syslog.c (sys_syslog): Update for RVAL_DECODED.
2015-07-16 22:58:12 +00:00
aa06f46d01 syslog.c: use printaddr
* syslog.c (sys_syslog): Use printaddr.
2015-07-16 22:58:12 +00:00
040de57477 sysmips.c: cleanup
* sysmips.c [MIPS] (sys_sysmips): Use switch statement.  Use printaddr.
Fix misprinted ", " delimiter.
2015-07-16 22:58:12 +00:00
034f98e10d sysmips.c: make use of RVAL_DECODED
* sysmips.c [MIPS] (sys_sysmips): Update for RVAL_DECODED.
2015-07-16 22:58:12 +00:00
76c8f66c4d time.c: make use of RVAL_DECODED
* time.c (sys_settimeofday, sys_osf_settimeofday, sys_clock_settime,
sys_timerfd, sys_timerfd_create, sys_timerfd_settime): Update
for RVAL_DECODED.
(timerfd_gettime): Decode struct itimerspec argument on exiting syscall.
2015-07-16 22:58:12 +00:00
7117835861 time.c: use printaddr, printnum_int, and umoven_or_printaddr
* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.
2015-07-16 22:58:12 +00:00
9f7027371c sprinttv: do not fetch data in case of syserror
* time.c (sprinttv): Do not fetch data in case syserror.
Print address instead of {...} in case of umove failure.
(sys_gettimeofday, sys_osf_gettimeofday, sys_adjtime, sys_clock_gettime,
clock_nanosleep): Remove now redundant checks for syserror.
2015-07-16 22:58:12 +00:00
927f026d4c truncate.c: make use of RVAL_DECODED
* truncate.c (sys_truncate, sys_truncate64, sys_ftruncate,
sys_ftruncate64): Update for RVAL_DECODED.
2015-07-16 22:58:12 +00:00
ff235c89ea umask.c: make use of RVAL_DECODED
* umask.c (sys_umask): Update for RVAL_DECODED.
2015-07-16 22:58:12 +00:00
c1f37f6e7a umount.c: make use of RVAL_DECODED
* umount.c (sys_umount2): Update for RVAL_DECODED.
2015-07-16 22:58:12 +00:00
c9a199278b utimes.c: make use of RVAL_DECODED
* utimes.c (decode_utimes): Change to return void.
Update for RVAL_DECODED.
(sys_utimes, sys_futimesat, sys_utimensat, sys_osf_utimes):
Update callers.  Update for RVAL_DECODED.
2015-07-16 22:57:52 +00:00
8ef543929a tests/uid.test: adopt for alpha
Make the test work on alpha that has getxuid syscall instead of getuid.

* tests/uid.awk (BEGIN): Update getuid regexp to match both getuid
and getxuid syscalls.
* tests/uid.c (main): Allow __NR_getxuid as an alternative
to __NR_getuid.
* tests/uid.test: If getuid syscall is not available, probe for
getxuid syscall.
2015-07-16 22:13:56 +00:00
14278620c9 uid.c: make use of RVAL_DECODED
* uid.c (sys_setuid, sys_setreuid, sys_setresuid, sys_chown, sys_fchown,
sys_setgroups): Update for RVAL_DECODED.
2015-07-16 01:36:55 +00:00
288a87049c uid.c: use printaddr and umoven_or_printaddr
* uid.c (get_print_uid): Use umoven_or_printaddr.
(sys_getresuid): Do not check for syserror, get_print_uid now does
the right thing.
(sys_setgroups, sys_getgroups): Add const qualifier to local variables
that are assigned once.  Use printaddr.
2015-07-16 01:36:55 +00:00
fdd0fce3d3 ia64: wire up utimensat syscall
* linux/ia64/syscallent.h (utimensat): New entry.
2015-07-16 01:36:55 +00:00
e5fe1400c0 decode_utimes: enclose timespec array in square brackets
* utimes.c (decode_utimes): enclose timespec array in square brackets
instead of curly brackets.
2015-07-16 01:36:55 +00:00
9809e3ab0a uname.c: use umove_or_printaddr
* uname.c (sys_uname): Use umove_or_printaddr.
2015-07-16 01:36:55 +00:00
d27cccaeff tests: add utime.test
* tests/utime.c: New file.
* tests/utime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add utime.
(TESTS): Add utime.test.
* tests/.gitignore: Add utime.
2015-07-16 01:36:47 +00:00
8d51f43946 utime.c: make use of RVAL_DECODED
* utime.c (sys_utime): Update for RVAL_DECODED.
2015-07-16 01:35:27 +00:00
cec41dd2b3 utime.c: use umoven_or_printaddr
* utime.c (sys_utime): Use umoven_or_printaddr.
2015-07-16 01:35:27 +00:00
90cfe8fbff wait.c: use printaddr and umove_or_printaddr
* wait.c (waitid): Do not check for NULL the address passed
to printrusage.
(printwaitn): Likewise.
Use printaddr and umove_or_printaddr for fetching wait status.
2015-07-15 00:49:27 +00:00
f6026b6e65 wait: move fallback definitions of wait options to xlat/
* wait.c: Move definitions of __W* flags ...
* xlat/wait4_options.in: ... here.
2015-07-15 00:33:20 +00:00
b60b2a5aa3 tests: add xattr.test
* tests/xattr.c: New file.
* tests/xattr.expected: Likewise.
* tests/xattr.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xattr.
(TESTS): Add xattr.test.
(EXTRA_DIST): Add xattr.expected.
* tests/.gitignore: Add xattr.
2015-07-15 00:09:08 +00:00
6156d81cef xattr.c: make use of RVAL_DECODED
* xattr.c (sys_setxattr, sys_fsetxattr, sys_removexattr,
sys_fremovexattr): Update for RVAL_DECODED.
2015-07-14 23:38:58 +00:00
105c35bb19 print_xattr_val: do not fetch data in case of !verbose || syserror
* xattr.c (print_xattr_val): Do not fetch data in case
of !verbose || syserror.   Use printaddr.
2015-07-14 23:34:06 +00:00
8ae9c0913e print_xattr_list: use printaddr
* xattr.c (print_xattr_list): Use printaddr.
2015-07-14 23:31:35 +00:00
d45548d82e print_xattr_val: remove unused argument
* xattr.c (print_xattr_val): Remove unused "failed" argument.
(sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr): Update
all callers.
2015-07-14 23:29:47 +00:00
7a9ec1273c print_xattr_list: remove redundant address check
* xattr.c (print_xattr_list): Do not check for NULL the address passed
to printstr.
2015-07-14 23:29:12 +00:00
b10ae62d31 ipc.c: make use of RVAL_DECODED
* ipc.c (sys_mq_notify, sys_mq_open, sys_mq_timedreceive,
sys_mq_timedsend, sys_msgctl, sys_msgget, sys_msgsnd, sys_semctl,
sys_semget, sys_semop, sys_semtimedop, sys_shmctl, sys_shmdt,
sys_shmget): Update for RVAL_DECODED.
(sys_shmat): Decode all arguments on entering syscall.
2015-07-14 22:07:35 +00:00
61b7989a01 umoven_or_printaddr: do not fetch data if not in verbose mode
After this change, umoven_or_printaddr and its callers, including
printnum_* and printpair_*, will not fetch data in !verbose mode.

* util.c (umoven_or_printaddr): Do not call umoven if !verbose.
2015-07-14 22:07:35 +00:00
850ba4b1e9 Change printnum_* printers to honor syserror
With this change, printnum_* printers will not attempt to fetch data
in case of exiting(tcp) && syserror(tcp).
All "at exiting" decoders that call these printers have been made
ready for this change in previous commits.

* util.c (DEF_PRINTNUM, DEF_PRINTPAIR): Use umove_or_printaddr.
* prctl.c (prctl_exit): Use printnum_int and printnum_long.
(sys_arch_prctl): Do not check for syserror.
2015-07-14 21:59:26 +00:00
fd3cdc04d8 term.c: enhance tty ioctl parser
Decode as much data on entering syscall as possible.

* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): New functions.
(term_ioctl): Use them.  Update for RVAL_DECODED.
2015-07-13 20:16:24 +00:00
483c15f4be Change comparisons with function pointers to comparisons with SENs
* pathtrace.c (pathtrace_match): Change all comparisons with function
pointers to a single SEN based switch.
* syscall.c (dumpio, trace_syscall_entering): Change all comparisons
with function pointers to comparisons with SENs.
* ipc.c (sys_ipc): Remove.
* sock.c (sys_socketcall): Likewise.
* linux/dummy.h (sys_ipc, sys_socketcall): New aliases.
2015-07-12 22:31:49 +00:00
28e32df56f Add unique syscall entry numbers (SENs)
* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sen.h.
(syscallent_names, syscallent_patterns, syscallent_files): New variables.
(sen.h): New rule.
* defs.h (struct sysent): Add sen field.
* generate_sen.sh: New file.
* linux/syscall.h: Include "sen.h".
* syscall.c (SEN_NAME): New temporary macro.
(SEN): Use it to prepend syscall entry number.
2015-07-12 22:31:49 +00:00
140ecf8766 Introduce SEN macro
* syscall.c (SEN): New temporary macro.
* linux/dummy.h (sys_printargs): New macro.
* linux/subcall.h: Wrap all sys_func entries using SEN.
* linux/*/syscallent*.h: Likewise.
2015-07-12 22:31:40 +00:00
3d0e1f331f scsi.c: enhance SG_IO ioctl parser
Fix SG_IO ioctl output in case of failed umove

* scsi.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Update for RVAL_DECODED.
(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res): Do not print address in case of failed umove.
(scsi_ioctl): Use printaddr.
2015-07-10 22:58:48 +00:00
317d19e8e9 ptp.c: enhance ptp ioctl parser
* ptp.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Update for RVAL_DECODED.
(ptp_ioctl): Use umove_or_printaddr.
2015-07-10 22:54:29 +00:00
eddefd64c3 mtd.c: enhance mtd and ubi ioctl parsers
Decode as much data on entering syscall as possible.

* xlat/mtd_file_mode_options.in: New file.
* mtd.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Include "xlat/mtd_file_mode_options.h".
Update for RVAL_DECODED.
(mtd_ioctl, ubi_ioctl): Use printnum_int and umove_or_printaddr.
2015-07-10 22:52:58 +00:00
b93c110079 sock.c: enhance socket ioctl parser
Decode as much data on entering syscall as possible.

* sock.c: Update for RVAL_DECODED.
(print_addr): Remove.
(print_ifreq_addr, print_ifreq, print_ifc_len, decode_ifconf): New
functions.
(sock_ioctl) Use them.  Use umove_or_printaddr.
2015-07-10 22:30:46 +00:00
a0beac1538 block.c: enhance block ioctl parser
* block.c: Update for RVAL_DECODED.
Define BLKROTATIONAL and BLKZEROOUT.
(block_ioctl): Decode them.  Use printnum_short, printnum_int,
printnum_long, printpair_int64, and umove_or_printaddr.
(print_blkpg_req, block_ioctl): Use umove_or_printaddr.
2015-07-10 22:26:56 +00:00
1dbe6839eb blkpg_ops: add BLKPG_RESIZE_PARTITION constant
* xlat/blkpg_ops.in: Add BLKPG_RESIZE_PARTITION.

Reported-by: Christian Neukirchen <chneukirchen@gmail.com>
2015-07-09 11:57:18 +00:00
3cfabeb881 loop.c: enhance loop ioctl parser
Decode as much data on entering syscall as possible.

* loop.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Update for RVAL_DECODED.
(decode_loop_info, decode_loop_info64): New functions.
(loop_ioctl): Use them.  Decode LOOP_SET_STATUS, LOOP_SET_STATUS64,
LOOP_SET_FD, LOOP_CHANGE_FD, LOOP_CTL_ADD and LOOP_CTL_REMOVE on
entering syscall.
Print LOOP_SET_FD and LOOP_CHANGE_FD arguments using printfd.
2015-07-09 02:04:34 +00:00
97317d9d83 rtc.c: enhance rtc ioctl parser
* rtc.c: Update for RVAL_DECODED.
(print_rtc): Rename to print_rtc_time.
(decode_rtc_time, decode_rtc_wkalrm): New functions.
(rtc_ioctl): Use them.
[RTC_VL_READ]: Decode RTC_VL_READ.
Use printnum_long for RTC_IRQP_READ and RTC_EPOCH_READ decoding.
2015-07-09 02:01:58 +00:00
b679508f6e Use printpair_int
* evdev.c (repeat_ioctl): Use printpair_int.
* net.c (do_pipe, sys_socketpair): Likewise.
2015-07-09 01:43:44 +00:00
69127a3a8d Add several generic integer pairs printing functions
Add functions to fetch and print pairs of integer types.
Note that these printers do not attempt to fetch data
in case of exiting(tcp) && syserror(tcp).

printnum_* printers will follow as soon as all callers are made ready
for this change.

* defs.h (printpair_int, printpair_long, printpair_int64): New
prototypes.
* util.c (DEF_PRINTPAIR): New macro.
(printpair_int, printpair_long, printpair_int64): New functions.
2015-07-09 01:41:51 +00:00
c88163e5bd Add two generic integer printing functions
Add printnum_short and printnum_int64 in addition to already existing
printnum_int and printnum_long.

* defs.h (printnum_short, printnum_int64): New prototypes.
* util.c (DEF_PRINTNUM): New macro.
(printnum_int, printnum_long): Use DEF_PRINTNUM.
(printnum_short, printnum_int64): New functions.
2015-07-09 01:35:41 +00:00
332a32619c Add address printing functions
printaddr is a simple function implementing "print NULL or address"
idiom.
umoven_or_printaddr is a wrapper around umoven that has the same return
value semantics as umoven but also prints the address when the data
is not going to be fetched (in case of exiting(tcp) && syserror(tcp))
or cannot be fetched (umoven fails).
umove_or_printaddr is a macro wrapper around umoven_or_printaddr that
mirrors umove wrapper around umoven.

* defs.h (printaddr, umoven_or_printaddr): New prototypes.
(umove_or_printaddr): New macro.
* util.c (printaddr, umoven_or_printaddr): New functions.
2015-07-09 01:21:56 +00:00
204c2bc9cb Implement RVAL_DECODED flag
Implement a method for "on entering" parsers to return
"done with decoding" information to their callers.

If a syscall parser called from trace_syscall_entering returns a value
with RVAL_DECODED bit set, record this value in tcp->sys_func_rval
and use it in trace_syscall_exiting instead of calling the parser on
exiting syscall.

If an ioctl parser returned RVAL_DECODED, this would tell
SYS_FUNC(ioctl) that the decoding is finished but fallback printing of
the ioctl command argument is needed, while e.g. RVAL_DONE+1 would mean
that the decoding is finished and no fallback decoding is needed.

* defs.h (struct tcb): Add sys_func_rval.
(RVAL_DECODED): New macro.
* syscall.c (trace_syscall_entering): Initialize tcp->sys_func_rval
along with setting TCB_INSYSCALL flag.
(trace_syscall_exiting): Use tcp->sys_func_rval instead of calling
tcp->s_ent->sys_func when the former has RVAL_DECODED flag set.
Reset tcp->sys_func_rval along with clearing TCB_INSYSCALL flag.
* ioctl.c (sys_ioctl): Set RVAL_DECODED flag on exiting.
Print ioctl argument iff RVAL_DECODED is set and fallback decoding
is requested.
2015-07-09 01:08:01 +00:00
746db06d91 time.c: move rtc ioctl parser to a separate file
* rtc.c: new file
* Makefile.am (strace_SOURCES): Add it.
* time.c (print_rtc, rtc_ioctl): Move to rtc.c.
2015-07-05 21:37:26 +00:00
8c3e8e7db7 term.c: fix typo
* term.c: Rename TCLFLSH to TCFLSH.
2015-07-05 21:37:26 +00:00
34bd4d255f Do not include sys/filio.h
* configure.ac (AC_CHECK_HEADERS): Remove sys/filio.h.
* term.c: Do not include <sys/filio.h>.
2015-07-05 16:20:14 +00:00
4f63c11388 ioctl: prepare ioctl_decode_command_number for future changes
* ioctl.c (ioctl_decode_command_number): Change 1st arg to struct tcb*.
(sys_ioctl): Update callers.
2015-07-02 22:32:27 +00:00
802c942a36 ioctl: simplify ioctl_decode signature
* ioctl.c (ioctl_decode): Remove 2nd and 3rd parameters.
(sys_ioctl): Update callers.
2015-07-02 22:32:21 +00:00
2803e75450 ioctl: consistently use name "code" for ioctl request code
* ioctl.c (evdev_decode_number, hiddev_decode_number,
ioctl_decode_command_number): Rename "arg" to "code".
2015-07-02 22:23:53 +00:00
044eef2186 Move ioctl syscall parser to ioctl.c
* io.c (sys_ioctl): Move ...
* ioctl.c: ... here.
(ioctl_lookup, ioctl_next_match, ioctl_print_code, ioctl_decode,
ioctl_decode_command_number): Declare as static.
* defs.h (ioctl_lookup, ioctl_next_match, ioctl_print_code,
ioctl_decode, ioctl_decode_command_number): Remove.
2015-07-02 21:42:51 +00:00
e10b4f02eb ioctl: remove obsolete registry of ioctl characters
* ioctl.c: Remove registry of ioctl characters.
2015-07-02 21:34:39 +00:00
4b80f34c93 Fix filtering of <unavailable> syscalls
* syscall.c (trace_syscall_exiting): Skip filtered syscalls also in case
of get_regs or get_syscall_result failure.
* tests/filter-unavailable.c: New file.
* tests/filter-unavailable.expected: Likewise.
* tests/filter-unavailable.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add filter-unavailable.
(filter_unavailable_LDFLAGS): Add -pthread.
(TESTS): Add filter-unavailable.test.
(EXTRA_DIST): Add filter-unavailable.expected.
* tests/.gitignore: Add filter-unavailable.

Reported-by: Bryan Matsuo <bryan.matsuo@gmail.com>
2015-06-30 17:28:02 +00:00
de4a680206 Fix -qq option in conjunction with -o option
This change makes -qq option work in conjunction with -o option,
thus complementing commit v4.7-222-g01997cf.

* strace.c (init): Do not reset qflag.
2015-06-30 16:32:41 +00:00
6455f0a11e xtensa: wire up new syscalls
* linux/xtensa/syscallent.h (bpf, execveat): New entries.
2015-06-30 16:32:41 +00:00
4c3ea5df3c bfin: wire up new syscalls
* linux/bfin/syscallent.h (kcmp, finit_module, sched_setattr,
sched_getattr, renameat2, seccomp, getrandom, memfd_create,
bpf, execveat): New entries.
2015-06-30 16:28:36 +00:00
25d729fd5a alpha: wire up new syscalls
* linux/alpha/syscallent.h (getrandom, memfd_create, execveat):
New entries.
2015-06-30 15:41:19 +00:00
68cb82e0f1 tests: skip stat32 test if struct stat is defined incorrectly
If stat.st_mode returned by syscall is 0, it means that the definition
of struct stat in <asm/stat.h> is incorrect.  This is the case e.g. on
mips n32 where the only available stat syscall is 64-bit but at the same
time struct stat defined by <asm/stat.h> is 32-bit.

* tests/stat.c (main) [NR_stat]: Return 77 if st_mode is 0.
2015-06-17 21:07:56 +00:00
d93c4e80b3 Consistenly use #ifdef to check for AC_DEFINE'd macros
* aio.c (print_common_flags): Use #ifdef in the check for
HAVE_STRUCT_IOCB_U_C_FLAGS.
* defs.h: Use #ifdef in the check for HAVE_LITTLE_ENDIAN_LONG_LONG.
* net.c: Use #ifdef in the check for HAVE_SENDMSG.
* syscall.c (dumpio): Likewise.
* printstat.h (DO_PRINTSTAT): Use #ifdef in checks for
HAVE_STRUCT_STAT_ST_* macros.
* util.c: Use #ifdef in checks for HAVE_SYS_XATTR_H.
2015-06-17 20:09:13 +00:00
0c5619538f xattr: move fallback definitions of xattr flags to xlat/
* xattr.c: Include <sys/xattr.h> insread of <linux/xattr.h>.
Move definitions of XATTR_* flags ...
* xlat/xattrflags.in: ... here.
2015-06-17 19:56:11 +00:00
f64a4395d9 link: move fallback definitions of AT_* constants to xlat/
* link.c: Move definitions of AT_* constants ...
* xlat/at_flags.in: ... here.
2015-06-17 19:45:26 +00:00
fddeeba9b8 net: move fallback definitions of SOL_* constants to xlat/
* net.c: Move definitions of SOL_* constants ...
* xlat/socketlayers.in: ... here.
2015-06-17 19:23:30 +00:00
003cc9f66a futex: move fallback definitions of futex constants to xlat/
* futex.c: Move definitions of FUTEX_OP_CMP_* constants ...
* xlat/futexwakecmps.in: ... here.
* futex.c: Move definitions of other FUTEX_OP_* constants ...
* xlat/futexwakeops.in: ... here.
* futex.c: Move definitions of remaining FUTEX_* constants except
FUTEX_PRIVATE_FLAG and FUTEX_CLOCK_REALTIME flags ...
* xlat/futexops.in: ... here.
2015-06-17 19:23:25 +00:00
14f4038ad7 clone: move definitions of cloning flags to xlat/
* clone.c: Include <sched.h>.  Move definitions of CLONE_* flags ...
* xlat/clone_flags.in: ... here.
2015-06-17 18:36:53 +00:00
cf7ee30c6b Update mount flags constants
* mount.c: Remove definitions of mount flags constants.
* xlat/mount_flags.in: Update from linux v4.0, add default values.
2015-06-16 10:55:19 +00:00
a863072706 mount: update parser to match kernel behaviour
* mount.c (sys_mount): Do not decode type and data strings for
MS_SHARED, MS_PRIVATE, MS_SLAVE, and MS_UNBINDABLE mount flags
that do not imply valid strings.
2015-06-16 10:55:19 +00:00
c8cf5fed1d mount: robustify MS_MGC_VAL decoding
* mount.c (sys_mount): When printing mount flags, do not assume that
(flags & MS_MGC_MSK) == MS_MGC_VAL.
2015-06-16 01:30:49 +00:00
7bee462a64 net: decode setsockopt() multicast arguments
* configure.ac (AC_CHECK_FUNCS): Add inet_pton.
* net.c (print_mreq, print_mreq6): New functions.
(print_setsockopt): Use them to decode IP_ADD_MEMBERSHIP,
IP_DROP_MEMBERSHIP, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP,
IPV6_JOIN_ANYCAST, and IPV6_LEAVE_ANYCAST.
* tests/ip_mreq.c: New file.
* tests/ip_mreq.expected: Likewise.
* tests/ip_mreq.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ip_mreq.
(TESTS): Add ip_mreq.test.
(EXTRA_DIST): ip_mreq.expected.
* tests/.gitignore: Add ip_mreq.

Based on patch by Ben Noordhuis <info@bnoordhuis.nl>.
2015-06-08 23:02:27 +00:00
0b95590ee2 Update IPV6 socket options constants
* xlat/sockipv6options.in: Update from linux v4.0.
2015-06-08 23:02:27 +00:00
ae28093c65 net: factor out interface index printing code
* net.c (print_ifindex): New function.
(printsock) [HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID]: Use it.
2015-06-05 20:13:21 +00:00
6c8ef051f7 Consistently use error_msg instead of fprintf(stderr)
* linux/alpha/get_scno.c: Use error_msg.
* linux/arm/get_scno.c: Likewise.
* linux/mips/get_scno.c: Likewise.
* linux/sh/get_scno.c: Likewise.
* linux/x86_64/get_scno.c: Likewise.
* exit.c (sys_exit): Likewise.
* pathtrace.c (pathtrace_select, pathtrace_match): Likewise.
* strace.c (alloctcb, droptcb, detach, startup_attach,
test_ptrace_seize, init, cleanup, print_debug_info,
maybe_allocate_tcb, startup_tcb, trace): Likewise.
* syscall.c (update_personality, trace_syscall_exiting,
get_scno): Likewise.
* unwind.c (DPRINTF): Likewise.
* tests/bexecve.test: Update patterns.
* tests/detach-stopped.test: Likewise.
2015-05-25 23:31:31 +00:00
df3899149e Consistently print OOM diagnostic messages
* bjm.c (sys_query_module): Use error_msg to print OOM diagnostics.
* util.c (dumpiov, dumpstr): Likewise.
2015-05-25 22:25:22 +00:00
3e9d71feaa Introduce memory allocation wrappers
Introduce wrappers to the following functions that do memory allocation:
malloc, calloc, realloc, strdup.

This commit is a follow-up to the related discussions in strace-devel ML:
http://sourceforge.net/p/strace/mailman/message/33618180/
http://sourceforge.net/p/strace/mailman/message/33733470/

* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
* xmalloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* count.c (count_syscall, call_summary_pers): Use xcalloc.
* desc.c (decode_select): Use xmalloc.
* dirent.c (sys_getdents, sys_getdents64): Likewise.
* net.c (sys_recvmmsg): Use xstrdup.
* pathtrace.c (storepath): Use xreallocarray.
(pathtrace_match): Use xmalloc.
* strace.c (die_out_of_memory): Move to xmalloc.c.
(expand_tcbtab): Use xcalloc and xreallocarray.
(startup_child): Use xstrdup.
(init): Use xmalloc, xcalloc, and xstrdup.
* syscall.c (reallocate_qual): Use xreallocarray.
(qualify): Use xstrdup.
* unwind.c (unwind_tcb_init): Use xmalloc.
(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
(get_symbol_name): Use xreallocarray.
(stacktrace_walk, queue_put): Use xmalloc.
* util.c (printstr): Use xmalloc.
* vsprintf.c (strace_vfprintf): Likewise.
2015-05-25 22:25:22 +00:00
8c20d8926c Fix ioctl entries on 32-bit architectures with 64-bit aligned structures
Some ioctl constants are defined to different values on those 32-bit
architectures where structures containing a 64-bit field are aligned on
a 8-byte boundary and have a size multiple of 8 bytes, and on other
32-bit architectures.

* configure.ac: Check the size of a structure containing a 64-bit field.
* linux/32/ioctls_inc.h: Rename to ...
* linux/32/ioctls_inc_align32.h: ... this.
* linux/32/ioctls_inc_align64.h: New file.
* linux/32/ioctls_inc.h: Include either 32/ioctls_inc_align32.h
or ioctls_inc_align64.h depending on SIZEOF_STRUCT_I64_I32.
* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align32.h and
* linux/32/ioctls_inc_align64.h.
* tests/ioctl.c (main): Test for VIDIOC_ENUMINPUT.
* tests/ioctl.expected: Check VIDIOC_ENUMINPUT decoding.

Reported-by: Philippe De Muyter <phdm@macqel.be>
2015-05-21 22:53:42 +00:00
f95cf99556 maint: make linux/kvm.h parseable on arm
* maint/ioctls_sym.sh [AARCH64 || ARM]: Add missing definitions for
structures referenced from linux/kvm.h.
2015-05-21 17:48:38 +00:00
e459ba943e v4l2: add decoding for VIDIOC_S_CROP's arg
* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_S_CROP's arg.
2015-05-21 17:48:38 +00:00
bd8dd776db Add support for Altera's Nios-II softcore architecture
This commit adds strace support for Altera's Nios-II.  The architecture
is supported by Linux since v3.19, and it implements the generic syscall
ABI.

* configure.ac: Add nios2 support.
* cacheflush.c [NIOS2] (sys_cacheflush): New function.
* linux/nios2/*: New Nios-II specific files.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
2015-05-19 22:41:49 +00:00
86b4fb5bc5 v4l2: VIDIOC_CROPCAP: add missing braces around arg printout
* v4l2.c (v4l2_ioctl): case VIDIOC_CROPCAP: add missing braces around arg
printout.
2015-05-19 22:31:10 +00:00
7e88896a16 maint: avoid effects of locale when sorting files
* maint/ioctls_gen.sh: Invoke sort with LC_COLLATE=C.
* maint/ioctls_hex.sh: Likewise.
* maint/ioctls_sym.sh: Likewise.

Reported-by: Philippe De Muyter <phdm@macqel.be>
2015-05-19 18:00:07 +00:00
6779e71acc v4l2: add decoding for VIDIOC_CREATE_BUFS's arg.
* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_CREATE_BUFS's arg.
2015-04-18 13:26:48 +00:00
f34b97f89d mips o32: decode indirect syscall
Implement decoding of MIPS O32 specific indirect syscall.

* syscall.c [LINUX_MIPSO32] (decode_mips_subcall, sys_syscall):
New functions.
(trace_syscall_entering) [LINUX_MIPSO32]: Use decode_mips_subcall.
* linux/mips/syscallent-o32.h (4000): Change sys_func to sys_syscall.

Reported-and-tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
2015-04-17 23:02:15 +00:00
71fb134da6 debian: add gawk to Build-Depends
* debian/control (Build-Depends): Add gawk.
Patch by Reiner Herrmann <reiner@reiner-h.de>.

This fixes Debian bug #780992.
2015-04-14 17:22:54 +00:00
b704e8fbb4 tests: fix bexecve.test for the case of mixed personalities
Fix bexecve.test when the executable being run does not match the
native architecture.

* tests/bexecve.test: Use "set_ptracer_any" instead of "sh".
Allow for a personality switch notification in the strace output.
2015-04-14 16:04:08 +00:00
25c804ce42 tests: add a test for "resuming interrupted nanosleep"
* tests/restart_syscall.test: New test.
* tests/restart_syscall.expected: New file.
* tests/restart_syscall_unknown.expected: Likewise.
* tests/Makefile.am (TESTS): Add restart_syscall.test.
(EXTRA_DIST): Add restart_syscall.expected
(TEST_LOG_COMPILER): Change to "env".
(OS, ARCH, AM_TEST_LOG_FLAGS): Define.
and restart_syscall_unknown.expected.
2015-04-07 23:01:47 +00:00
dfd4e3f338 tests: strip executable bit from *.expected files 2015-04-07 21:11:50 +00:00
a0bd3749fc Declare syscall parsers using SYS_FUNC macro
Introduce SYS_FUNC macro to declare and define all syscall parsers.

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
(sys_func.h): New rule.
* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
* linux/syscall.h: Include "sys_func.h".
[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
Remove other declarations.
* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
and osf_fstatfs syscall parsers.
* *.c: Use SYS_FUNC to define syscall parsers.
2015-04-07 11:22:49 +00:00
cc59f14fb8 Fix confusing "resuming interrupted unknown" message
Dmitry reported seeing the following:

    $ sleep 2 & sleep 1; ./strace -erestart_syscall -p $!
    [1] 12345
    Process 12345 attached
    restart_syscall(<... resuming interrupted unknown ...>) = 0

Fixing it by replacing "unknown" with "system call".

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-04-07 12:46:59 +02:00
79c5c5d792 tests: workaround old gawk versions that do not provide @include support
Some of our tests use GNU awk @include extension, but not all currently
used versions of GNU awk support it.  Skip these tests if gawk does not
provide @include support.

* tests/init.sh (check_gawk): New function.
(match_awk): Use it.
2015-04-07 00:10:39 +00:00
a402810530 tests: rewrite umovestr2.test without using grep
The regular expression generated by umovestr2.c on systems with large
page size is too big for GNU grep.  Rewrite the test to use diff
instead of grep.

* tests/umovestr2.test: Use match_diff instead of match_grep.
* tests/umovestr2.c (main): Convert output from regexp to plain text.
2015-04-06 22:17:28 +00:00
87af1935fb Cleanup process_vm_writev syscall decoding
* process_vm.c (sys_process_vm_writev): Do not check for syserror,
it is not applicable on entering syscall.
2015-03-31 21:00:39 +00:00
ea1fea6982 umovestr: read chunks of memory up to pagesize at a time
* defs.h (get_pagesize): New prototype.
* mem.c (get_pagesize) Make global.
* util.c (PAGMASK): Remove.
(vm_read_mem): New process_vm_readv proxy function.
(umoven, umovestr): Use it.
(umovestr): Read chunks up to pagesize at a time.
2015-03-31 20:56:38 +00:00
48321344d7 umovestr: fix short read bug
* util.c (umovestr): Check the right address.
* tests/umovestr.c: New file.
* tests/umovestr2.c: Likewise.
* tests/umovestr.expected: Likewise.
* tests/umovestr.test: New test.
* tests/umovestr2.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add umovestr and umovestr2.
(TESTS): Add umovestr.test and umovestr2.test.
(EXTRA_DIST): Add umovestr.expected.
* tests/.gitignore: Add umovestr and umovestr2.

Reported-by: Josef T. Burger <bolo@cs.wisc.edu>
2015-03-31 20:52:41 +00:00
b2893c9e9e When process_vm_readv fails with EPERM, try PTRACE_PEEKDATA
process_vm_readv() and ptrace(PTRACE_PEEKDATA) have inconsistent access
control rules wrt traced processes: process_vm_readv() is more likely to
fail with EPERM than ptrace(PTRACE_PEEKDATA) when tracing a process that
has execve'd a privileged executable.

* util.c (umoven, umovestr): If process_vm_readv returned EPERM,
fall back to ptrace(PTRACE_PEEKDATA).

Reported-by: Andrew Guertin <lists@dolphinling.net>
2015-03-31 15:06:01 +00:00
5647cf86fc Use macros for gcc attributes
* defs.h (error_msg, perror_msg, error_msg_and_die, perror_msg_and_die,
die_out_of_memory, printllval, printnum_int, printnum_long, tprintf):
Use ATTRIBUTE_* macros for gcc attributes.
* file.c (struct stat64): Likewise.
* statfs.c (struct compat_statfs64): Likewise.
* strace.c (die, exec_or_die, init): Likewise.
* linux/sparc/arch_sigreturn.c: Likewise.
* linux/ubi-user.h: Likewise.
2015-03-30 00:33:06 +00:00
c84d0b8363 Introduce macros for gcc attributes
Define macros for gcc attributes that are already in use
or going to be used soon.

* defs.h (GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): New macros.
2015-03-30 00:32:56 +00:00
3460dc486d Include <linux/ioctl.h> for _IOC_* macros
Fix a compilation failure with musl libc.

* evdev.c: Include <linux/ioctl.h>.
* ioctl.c: Include <linux/ioctl.h> instead of <asm/ioctl.h>.
* ioctlsort.c: Likewise.

Reported-by: Dima Krasner <dima@dimakrasner.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2015-03-28 22:37:30 +00:00
d34e00b293 Include <sys/stat.h> for S_I* macros
Fix a compilation failure with musl libc.

* mknod.c: Include <sys/stat.h>.
* printmode.c: Likewise.

Reported-by: Dima Krasner <dima@dimakrasner.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2015-03-28 22:37:06 +00:00
537c964fe9 signal.c: move siginfo_t parsers to a separate file
* printsiginfo.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (printsiginfo): Change second argument's type from int to bool.
* signal.c: Stop defining siginfo_t related constants.
Move inclusion of xlat/sig*_codes.h files to printsiginfo.c
(printsigsource, printsigval, printsiginfo_at): Move to printsiginfo.c.
(printsiginfo): Change second argument's type from int to bool,
split, and move to printsiginfo.c.
2015-03-27 23:41:00 +00:00
f7430b7065 Update siginfo_t constants
* xlat/sigbus_codes.in: Add BUS_MCEERR_AR and BUS_MCEERR_AO,
add default values.
* xlat/sigtrap_codes.in: Add TRAP_BRANCH and TRAP_HWBKPT,
add default values.
* xlat/sigsegv_codes.in: Add SEGV_BNDERR, add default values.
* xlat/sigchld_codes.in: Add default values.
* xlat/sigemt_codes.in: Likewise.
* xlat/sigfpe_codes.in: Likewise.
* xlat/sigill_codes.in: Likewise.
* xlat/siginfo_codes.in: Likewise.
* xlat/sigpoll_codes.in: Likewise.
* xlat/sigsys_codes.in: Likewise.
2015-03-27 22:51:51 +00:00
174bb2b36e signal.c: move sigaltstack parser to a separate file
* sigaltstack.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (print_stack_t, sys_sigaltstack): Move to sigaltstack.c.
* xlat/sigaltstack_flags.in: Add default values.
2015-03-26 15:43:07 +00:00
b6ef71b6f4 Move sparc64 get_scno() code where it belongs
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-25 15:22:49 +01:00
588a90f0f0 sparc: rename personality 2 files to personality 1
Run-tested in qemu 32-bit sparc.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-25 15:21:57 +01:00
df4dd8b540 sparc: delete personality 1
Personality 1 for sparc and sparc64 appears to be an old attempt
to support stracing Solaris binaries.

It stalled after the only syscall, solaris_open, was covered:
all other solaris_foo's are printargs.

This change deletes personality 1. Now sparc is an one-personality
arch, and sparc64 is a two-personality one.

For clarity, pure renaming of personality 2 files to personality 1 for sparc64
is performed in the next commit - this prevents a state where syscallent1.h
seems to indergo a lot of changes, where in fact in is deleted, and then
replaced by syscallent2.h

Therefore, tree at this commit will not build.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-25 15:21:57 +01:00
602d717a62 qemu_multiarch_testing/*: make it easier to do debug in sandboxes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-24 20:54:26 +01:00
430143bf8d sparc: fix v4.10-25-g8497b62 fallout
Before:

$ sleep 3 & ./strace -p $!
Process 8703 attached
syscall: unknown syscall trap 1a800003 00025d58
syscall_516(0, 0x40080000, 0, 0xfc000f00, 0x28, 0xefc03b18) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

After:

$ sleep 3 & ./strace -p $!
Process 8725 attached
restart_syscall(<... resuming interrupted nanosleep ...>) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-24 19:39:47 +01:00
ea00900a85 get_scno: add diagnostics for invalid syscall numbers
* syscall.c (get_scno): Print a debug level message
for !SCNO_IS_VALID syscall numbers.
2015-03-24 01:59:07 +00:00
9945ec97c6 arm: fix v4.10-25-g8497b62 fallout
Starting with commit v4.10-25-g8497b62,

arm$ ./strace true
pid 1234 stray syscall exit
Segmentation fault

Fix this by updating ARM syscall sanity check.
In particular, get_scno() should not set TCB_INSYSCALL flag because
other code assumes that s_ent is properly initialized when this flag
is set.

* linux/arm/get_scno.c: Check syscall number after fetching.
Do not apply the check to SCNO_IN_RANGE syscalls.
Do not set TCB_INSYSCALL flag.
Extend diagnostics and move it to debug level.
2015-03-24 01:41:51 +00:00
8e8d7d219e mips: fix pipe syscall decoding
* linux/mips/arch_getrval2.c: New file.
* Makefile.am (EXTRA_DIST): Add it.
* defs.h [MIPS] (HAVE_GETRVAL2): Define.
2015-03-24 00:05:43 +00:00
a3c483545a sigreturn.c: split arch specific code into separate arch files
Split code that use arch-specific registers to separate arch files.

* sigreturn.c (sys_sigreturn): Move arch-specific code
to linux/*/arch_sigreturn.c, include "arch_sigreturn.c".
* linux/arch_sigreturn.c: New file.
* Makefile.am (EXTRA_DIST): Add linux/arch_sigreturn.c
and linux/*/arch_sigreturn.c files.
2015-03-23 22:25:05 +00:00
d70d1c4aa6 syscall.c: split arch specific code into separate arch files
Split code that use arch-specific registers to separate arch files.

* syscall.c: Move definitions of variables containing fetched registers
to linux/*/arch_regs.c files.
[HAVE_GETRVAL2] (getrval2): Move arch-specific code
to linux/*/arch_getrval2.c, include "arch_getrval2.c".
(print_pc): Move arch-specific code to linux/*/print_pc.c files,
include "print_pc.c".
[X86_64] (x86_64_getregs_old): Rename to getregs_old, move to
linux/x86_64/getregs_old.c, include "getregs_old.c".
[POWERPC] (powerpc_getregs_old): Rename to getregs_old, move to
linux/powerpc/getregs_old.c, include "getregs_old.c".
(get_regs) [X86_64, POWERPC]: Update callers.
(get_scno): Move arch-specific code to linux/*/get_scno.c,
include "get_scno.c".
(get_syscall_args): Move arch-specific code
to linux/*/get_syscall_args.c, include "get_syscall_args.c".
(get_error): Move arch-specific code to linux/*/get_error.c,
include "get_error.c".
(get_syscall_result): Move arch-specific code
to linux/*/get_syscall_result.c, include "get_syscall_result.c".
* Makefile.am (EXTRA_DIST): Add new linux/*/*.c files.
2015-03-23 22:24:59 +00:00
1b78607767 syscall.c: prepare for the split
Move functions that use arch-specific registers to the end of file.
2015-03-23 20:20:00 +00:00
144cda220b Move get_regs error check from trace_syscall_entering to get_scno
Starting with commit v4.10-25-g8497b62, get_scno() can be called outside
trace_syscall_entering(), so move the get_regs_error check from
trace_syscall_entering() to get_scno().

* syscall.c (trace_syscall_entering): Move get_regs_error check ...
(get_scno): ... here.
2015-03-23 20:15:29 +00:00
78ed3f3558 alpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding
Fix pipe syscall decoding on alpha.
Fix pipe2 syscall decoding on ia64, sh, sparc, and sparc64.

* configure.ac (AC_CHECK_FUNCS): Add pipe2.
* defs.h [ALPHA || IA64 || SH || SPARC || SPARC64] (HAVE_GETRVAL2):
Define.
* net.c (do_pipe): Check HAVE_GETRVAL2 instead of architecture macros.
Do not use getrval2 for pipe2 decoding.
Print address if umove call fails.
* syscall.c (getrval2): Check HAVE_GETRVAL2 instead of architecture
macros.  Implement for [ALPHA].
* tests/pipe.c: New file.
* tests/pipe.expected: New file.
* tests/pipe.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pipe.
(TESTS): Add pipe.test.
(EXTRA_DIST): Add pipe.expected.
* tests/.gitignore: Add pipe.
2015-03-23 03:16:51 +00:00
c215569efe decode_socket_subcall: fetch all arguments with a single umoven call
* syscall.c (decode_socket_subcall): Replace umoven fetch loop
with a single umoven call.
2015-03-22 15:52:40 +00:00
68ba190f0a New test: test/many_looping_threads.c
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 20:59:39 +01:00
f1e5b6a91e test/.gitignore: add missing test targets
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 20:19:02 +01:00
7d27c63806 Trivial optimization in sys_sigreturn()
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 20:11:53 +01:00
7e69ed98cd Change last parameter of umoven() from char* to void*
Saves tons of casts.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 19:50:53 +01:00
9dce83b8bd Remove unused struct tcb::inst field
It is unused since we dropped support for kernels without PTRACE_SETOPTIONS.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 19:34:47 +01:00
35431577b5 test/Makefile: add missing test targets
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 18:54:16 +01:00
364728dba0 Move the comment about termination logic where it belongs
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 18:40:53 +01:00
4bb2ffd464 startup_tcb() never fails, remove code which checks for failures
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 18:13:45 +01:00
8497b6222e Show the syscall name in "resuming interrupted call" message
When signal is received, or if we have attached to a process,
current syscall (if process is in one) gets restarted.

Some syscalls are restarted via "restart_syscall()" mechanism.
On such sycalls, we don't show _which_ syscall gets restarted.

IOW: users want to see "resuming interrupted nanosleep"
instead of "resuming interrupted call" when they attach to "sleep 999".

Kernel does expose this information. The only thing we need is
to fetch syscall# on attach, and save it.

This patch does this. It adds tcp->s_prev_ent, which is
a pointer to struct_sysent of the previous syscall of this tracee.
It can be NULL.

sys_restart_syscall() is made to use it when the message is generated.

To similarly handle restart_syscall() *after signals*, not just
on attach, on each syscall exit patch saves exited syscall's data
in the same member (tcp->s_prev_ent).

Example:

    $ sleep 3 & strace -p $!
    Process 8728 attached
    restart_syscall(<... resuming interrupted nanosleep ...>) = 0
    _exit(0)                                = ?
    +++ exited with 0 +++

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 18:04:53 +01:00
e7d671bd4a tests: add a test for mmap/mprotect/munmap decoding
* tests/mmap.c: New file.
* tests/mmap64.c: New file.
* tests/mmap.test: New test.
* tests/mmap64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mmap and mmap64.
(mmap64_CFLAGS): Define.
(TESTS): Add mmap.test and mmap64.test.
* tests/.gitignore: Add mmap and mmap64.
2015-03-20 02:15:11 +00:00
b4aefa7595 sparc, sparc64: fix decoding of mmap2
* linux/sparc/syscallent.h (mmap2): Decode with sys_mmap_4koff,
not sys_mmap.
* linux/sparc64/syscallent2.h (mmap2): Decode with sys_mmap_pgoff,
not sys_mmap.
2015-03-20 00:28:31 +00:00
485f8fb250 tests: add a test for SECCOMP_MODE_FILTER decoding
* tests/seccomp.c: New file.
* tests/seccomp.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add seccomp.
(TESTS): Add seccomp.test.
* tests/.gitignore: Add seccomp.
2015-03-19 00:40:49 +00:00
226bf1c21b tests: factor out common awk code
Factor out awk code used in several tests to match.awk.

* tests/match.awk: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/caps.awk: Use it.
* tests/getdents.awk: Likewise.
* tests/getrandom.awk: Likewise.
* tests/select.awk: Likewise.
* tests/sigaction.awk: Likewise.
* tests/init.sh (match_awk): Use gawk not awk.  Define AWKPATH.
* tests/getdents.test: Likewise.
2015-03-18 22:41:17 +00:00
6add1b09d6 tests: skip netlink based tests when resources are not available
* tests/netlink_inet_diag.c (main): Return 77 if socket, bind,
or listen syscall fail.
* tests/netlink_unix_diag.c (main): Likewise.
2015-03-18 22:39:20 +00:00
babe7f6a30 aarch64, arm: decode extra padded compat struct statfs64
According to arch/arm/kernel/sys_oabi-compat.c,
struct statfs64 has extra padding with EABI.

* statfs.c [AARCH64 || defined ARM] (COMPAT_STATFS64_PADDED_SIZE):
Define.
(do_statfs64_fstatfs64): New function, factored out from sys_statfs64.
[COMPAT_STATFS64_PADDED_SIZE]: Check it in addition to
sizeof(struct compat_statfs64).
(sys_statfs64, sys_fstatfs64): Use do_statfs64_fstatfs64.

Reported-and-tested-by: Elliott Hughes <enh@google.com>
2015-03-18 17:39:15 +00:00
8f54664d68 tests: factor out common shell code to functions
Factor out shell code used in several tests to common functions.

* tests/fanotify_mark.expected: New file.
* tests/ioctl.expected: New file.
* tests/net-fd.expected: New file.
* tests/net.expected: New file.
* tests/statfs.expected: New file.
* tests/sun_path.expected: New file.
* tests/uio.expected: New file.
* tests/ipc.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add them.
* tests/init.sh (dump_log_and_fail_with, run_prog,
run_prog_skip_if_failed, run_strace, run_strace_merge,
match_awk, match_diff, match_grep): New functions.
* tests/*.test: Use them.
2015-03-18 02:29:36 +00:00
1b5b5670eb Show f_flags field in printstatfs
printstatfs64 was right, but printstatfs was missing f_flags.
Noticed on aarch64.

* statfs.c (printstatfs) [_STATFS_F_FLAGS]: Print statfs.f_flags.

Signed-off-by: Elliott Hughes <enh@google.com>
2015-03-18 01:31:23 +00:00
68804b3267 tests/uid*: use fchown* instead of chown*
Newer architectures have no chown syscall, so use fchown* syscalls
for testing printuid.

* tests/uid.test: Use fchown instead of chown.
* tests/uid.c: Test __NR_fchown instead of __NR_chown.
(main): Use __NR_fchown instead of __NR_chown.
* tests/uid32.c: Test __NR_fchown32 instead of __NR_chown32.
(main): Use __NR_fchown32 instead of __NR_chown32.
* tests/uid16.c: Test __NR_fchown and __NR_fchown32 instead
of __NR_chown and __NR_chown32.
(main): Use __NR_fchown instead of __NR_chown.
* tests/uid.awk: Update regexp.
2015-03-16 18:20:57 +00:00
f79252f072 stat64-v.test: add newfstatat syscall support
Newer architectures have no stat syscall, so stat() is implemented there
using newfstatat syscall.

* tests/stat.c (STAT_FNAME): Rename to STAT_PREFIX.  Update callers.
[_FILE_OFFSET_BITS == 64] (STAT_PREFIX): Add newfstatat support.
(main) [!NR_stat]: Add newfstatat support.

Reported-by: Andreas Schwab <schwab@suse.de>
2015-03-16 17:39:19 +00:00
71d6ffc6ed aarch64: properly decode generic syscalls
* linux/aarch64/syscallent1.h: Don't override entries 277 to 1023.
2015-03-16 16:25:09 +01:00
33557845ad tests: verify that all patterns match
* tests/ipc_msg.test: Count matches to verify that all patterns match.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
2015-03-16 16:22:24 +01:00
bce1ff5f88 Fix stat64 st_[acm]time decoding for personalities with 32-bit time_t
STRUCT_STAT.st_[acm]time are declared as unsigned int for some
personalities, while time_t is signed.

* printstat.h (DO_PRINTSTAT): If st_[acm]time have the same size as int,
explicitly cast them to int.
* tests/stat64-v.test: Test that negative time_t is decoded properly.

Reported-by: Andreas Schwab <schwab@suse.de>
2015-03-16 14:23:09 +00:00
499c5aad0c semctl: fix indirect syscall decoding
On architectures where the semctl call is implemented by the ipc syscall
the 4th argument is passed by reference.

* ipc.c (sys_semctl): Handle the indirect ipc subcall case.
* tests/ipc_sem.c (main): Optionally match indirection
in the 4th argument of semctl calls.

Reported-by: Andreas Schwab <schwab@suse.de>
2015-03-16 14:23:09 +00:00
3aa45f3cc2 tests/ipc_*: match IPC_64 flag
* tests/ipc_msg.c (main): Optionally match "IPC_64|" in the third
argument of the ipc call.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
2015-03-16 14:26:58 +01:00
fa5ce37246 Fix crash in ipc_sem test
Properly use union semun as argument of semctl.

* tests/ipc_sem.c (main): Properly use union semun as argument of
semctl.  Don't handle EFAULT specially.
* tests/ipc_sem.test: Revert last change.
2015-03-16 12:18:36 +01:00
712f0e12bd m68k: fix sigreturn decoding
* sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
signal mask from the proper place.
2015-03-16 10:55:20 +01:00
0e3811d791 aarch64: fix ioctl decoding
* linux/aarch64/ioctls_inc0.h: Rename from ioctls_inc1.h.
* linux/aarch64/ioctls_inc1.h: Rename from ioctls_inc0.h.
* linux/aarch64/ioctls_arch0.h: Rename from ioctls_arch1.h.
* linux/aarch64/ioctls_arch1.h: Rename from ioctls_arch0.h.
2015-03-16 10:15:29 +01:00
95336102eb tests/select.test: handle architectures using pselect6 syscall
* tests/select.awk (BEGIN): Update regexps to match both select
and pselect6 syscalls.
* tests/select.test: Probe for both select and pselect6 syscall.
2015-03-12 17:22:07 +01:00
64fc9cedc4 Distribute linux/aarch64/arch_regs.h
* Makefile.am (EXTRA_DIST): Add linux/aarch64/arch_regs.h.
2015-03-12 14:15:50 +01:00
dbadf7bcc8 Fix decoding of mmap2 for arm
* syscallent.h (mmap2): Decode with sys_mmap_4koff, not
sys_mmap_pgoff.
2015-03-12 10:52:22 +01:00
a897136801 m68k: define HAVE_SA_RESTORER
On m68k the kernel sigaction structure has the sa_restorer member for
historical reasons.

* signal.c (HAVE_SA_RESTORER): Define for M68K.
2015-03-12 10:24:27 +01:00
d76d306952 aarch64: fix rt_sigreturn decoding
* sigreturn.c (sys_sigreturn) [AARCH64]: Fix personality check.
2015-03-11 16:34:09 +00:00
91bdbb46ff maint: post-release administrivia
* NEWS: Add header line for next release.
2015-03-09 22:05:40 +00:00
726 changed files with 38433 additions and 25900 deletions

23
.gitignore vendored
View File

@ -38,7 +38,30 @@ Makefile.in
/ioctls_all[012].h
/ioctlsort[012]
/sen.h
/sys_func.h
/strace-*.tar.xz
/tests-m32
/tests-mx32
/libmpers-m32.a
/libmpers-mx32.a
/m32_funcs.h
/m32_printer_decls.h
/m32_printer_defs.h
/m32_type_defs.h
/mpers-m32
/mpers-m32.stamp
/mpers-mx32
/mpers-mx32.stamp
/mpers.am
/mpers_xlat.h
/mx32_funcs.h
/mx32_printer_decls.h
/mx32_printer_defs.h
/mx32_type_defs.h
/native_printer_decls.h
/native_printer_defs.h
/printers.h

View File

@ -1,6 +1,7 @@
# Map git author names and email addresses to canonical/preferred form.
<ak@linux.intel.com> <ak@suse.de>
<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>
<vda.linux@googlemail.com> <dvlasenk@redhat.com>

25
.travis.yml Normal file
View File

@ -0,0 +1,25 @@
language: c
dist: trusty
script: ./travis-ci.sh
sudo: required
addons:
apt:
packages:
- gcc-multilib
- libacl1-dev
env:
global:
- ENABLE_GCC_WERROR="--enable-gcc-Werror"
- SLEEP_A_BIT="sleep 0.1"
- VERBOSE="1"
matrix:
include:
- env: TARGET=x86_64
- env: TARGET=x32
- env: TARGET=x86

View File

@ -39,6 +39,7 @@ Greg Banks gbanks@pocketpenguins.com
Henrik Storner storner@osiris.ping.dk
Jakub Jelinek jj@ultra.linux.cz
Jeff Mahoney jeffm@suse.com
Jian Zhen zhenjl@gmail.com
Joe Ilacqua spike@world.std.com
Johannes Stezenbach js@sig21.net
Ju"rgen Fluk louis@marco.de

View File

@ -1,4 +1,32 @@
# Automake input for strace.
#
# Copyright (c) 2002-2009 Roland McGrath <roland@redhat.com>
# Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@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.
if HAVE_M32_RUNTIME
TESTS_M32 = tests-m32
@ -21,16 +49,24 @@ AM_CFLAGS = $(WARN_CFLAGS)
AM_CPPFLAGS = -I$(builddir)/$(OS)/$(ARCH) \
-I$(srcdir)/$(OS)/$(ARCH) \
-I$(builddir)/$(OS) \
-I$(srcdir)/$(OS)
-I$(srcdir)/$(OS) \
-I$(builddir) \
-I$(srcdir)
include xlat/Makemodule.am
strace_CPPFLAGS = $(AM_CPPFLAGS)
strace_LDFLAGS =
strace_LDADD =
noinst_LIBRARIES =
strace_SOURCES = \
access.c \
affinity.c \
aio.c \
bjm.c \
block.c \
bpf.c \
cacheflush.c \
capability.c \
caps0.h \
@ -41,14 +77,24 @@ strace_SOURCES = \
count.c \
desc.c \
dirent.c \
dirent64.c \
empty.h \
epoll.c \
evdev.c \
eventfd.c \
execve.c \
exit.c \
fadvise.c \
fallocate.c \
fanotify.c \
fchownat.c \
fcntl.c \
fetch_seccomp_fprog.c \
fetch_struct_flock.c \
file.c \
file_handle.c \
flock.c \
flock.h \
futex.c \
get_robust_list.c \
getcpu.c \
@ -58,25 +104,52 @@ strace_SOURCES = \
inotify.c \
io.c \
ioctl.c \
ioperm.c \
iopl.c \
ioprio.c \
ipc.c \
ipc_defs.h \
ipc_msg.c \
ipc_msgctl.c \
ipc_sem.c \
ipc_shm.c \
ipc_shmctl.c \
kcmp.c \
kernel_types.h \
kexec.c \
keyctl.c \
ldt.c \
link.c \
linux/asm_stat.h \
linux/x32/asm_stat.h \
lookup_dcookie.c \
loop.c \
lseek.c \
mem.c \
membarrier.c \
memfd_create.c \
mknod.c \
mount.c \
mpers_type.h \
mq.c \
mtd.c \
native_defs.h \
net.c \
open.c \
or1k_atomic.c \
pathtrace.c \
perf.c \
personality.c \
poll.c \
prctl.c \
print_mq_attr.c \
print_msgbuf.c \
print_sigevent.c \
print_time.c \
print_timex.c \
printmode.c \
printrusage.c \
printsiginfo.c \
printsiginfo.h \
printstat.h \
process.c \
process_vm.c \
@ -89,17 +162,21 @@ strace_SOURCES = \
regs.h \
renameat.c \
resource.c \
rtc.c \
sched.c \
scsi.c \
seccomp.c \
seccomp_fprog.h \
sendfile.c \
sigaltstack.c \
signal.c \
signalfd.c \
sigreturn.c \
sock.c \
socketutils.c \
sram_alloc.c \
statfs.c \
strace.c \
stream.c \
swapon.c \
sync_file_range.c \
syscall.c \
@ -109,27 +186,29 @@ strace_SOURCES = \
sysmips.c \
term.c \
time.c \
times.c \
truncate.c \
uid.c \
uid16.c \
umask.c \
umount.c \
uname.c \
userfaultfd.c \
util.c \
utime.c \
utimes.c \
v4l2.c \
vsprintf.c \
wait.c \
xattr.c
xattr.c \
xmalloc.c \
# end of strace_SOURCES
if USE_LIBUNWIND
strace_SOURCES += unwind.c
strace_CPPFLAGS = $(AM_CPPFLAGS) $(libunwind_CPPFLAGS)
strace_LDFLAGS = $(libunwind_LDFLAGS)
strace_LDADD = $(libunwind_LIBS)
else
strace_CPPFLAGS = $(AM_CPPFLAGS)
strace_CPPFLAGS += $(libunwind_CPPFLAGS)
strace_LDFLAGS += $(libunwind_LDFLAGS)
strace_LDADD += $(libunwind_LIBS)
endif
noinst_HEADERS = defs.h
@ -159,12 +238,21 @@ EXTRA_DIST = \
debian/strace64.manpages \
debian/watch \
errnoent.sh \
generate_sen.sh \
ioctlsort.c \
linux/32/ioctls_inc.h \
linux/32/ioctls_inc_align32.h \
linux/32/ioctls_inc_align64.h \
linux/32/syscallent.h \
linux/64/ioctls_inc.h \
linux/64/syscallent.h \
linux/aarch64/arch_regs.c \
linux/aarch64/arch_regs.h \
linux/aarch64/arch_sigreturn.c \
linux/aarch64/errnoent1.h \
linux/aarch64/get_error.c \
linux/aarch64/get_scno.c \
linux/aarch64/get_syscall_args.c\
linux/aarch64/ioctls_arch0.h \
linux/aarch64/ioctls_arch1.h \
linux/aarch64/ioctls_inc0.h \
@ -172,66 +260,142 @@ EXTRA_DIST = \
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_sigreturn.c \
linux/alpha/errnoent.h \
linux/alpha/get_error.c \
linux/alpha/get_scno.c \
linux/alpha/get_syscall_args.c \
linux/alpha/get_syscall_result.c\
linux/alpha/ioctls_arch0.h \
linux/alpha/ioctls_inc0.h \
linux/alpha/signalent.h \
linux/alpha/syscallent.h \
linux/alpha/userent.h \
linux/arc/arch_regs.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/syscallent.h \
linux/arch_regs.h \
linux/arch_sigreturn.c \
linux/arm/arch_regs.c \
linux/arm/arch_regs.h \
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/syscallent.h \
linux/arm/userent.h \
linux/avr32/arch_regs.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/syscallent.h \
linux/avr32/userent.h \
linux/bfin/arch_regs.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/syscallent.h \
linux/bfin/userent.h \
linux/crisv10/arch_regs.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/userent.h \
linux/crisv32/arch_regs.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/userent.h \
linux/dummy.h \
linux/errnoent.h \
linux/hppa/arch_regs.c \
linux/hppa/arch_regs.h \
linux/hppa/errnoent.h \
linux/hppa/get_error.c \
linux/hppa/get_scno.c \
linux/hppa/get_syscall_args.c \
linux/hppa/get_syscall_result.c \
linux/hppa/ioctls_arch0.h \
linux/hppa/ioctls_inc0.h \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
linux/i386/arch_regs.c \
linux/i386/arch_regs.h \
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/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/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/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
linux/m68k/arch_regs.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/syscallent.h \
linux/m68k/userent.h \
linux/metag/arch_regs.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/syscallent.h \
linux/microblaze/arch_regs.c \
linux/microblaze/arch_sigreturn.c \
linux/microblaze/get_error.c \
linux/microblaze/get_scno.c \
linux/microblaze/get_syscall_args.c \
linux/microblaze/get_syscall_result.c \
linux/microblaze/ioctls_arch0.h \
linux/microblaze/ioctls_inc0.h \
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_sigreturn.c \
linux/mips/errnoent.h \
linux/mips/genstub.sh \
linux/mips/get_error.c \
linux/mips/get_scno.c \
linux/mips/get_syscall_args.c \
linux/mips/ioctls_arch0.h \
linux/mips/ioctls_inc0.h \
linux/mips/signalent.h \
@ -242,20 +406,43 @@ EXTRA_DIST = \
linux/mips/syscallent.h \
linux/mips/userent.h \
linux/mtd-abi.h \
linux/nios2/arch_regs.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/syscallent.h \
linux/or1k/arch_regs.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/syscallent.h \
linux/or1k/userent.h \
linux/personality.h \
linux/powerpc/arch_regs.c \
linux/powerpc/arch_regs.h \
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/syscallent.h \
linux/powerpc/userent.h \
linux/powerpc64/arch_regs.c \
linux/powerpc64/arch_regs.h \
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 \
@ -265,66 +452,92 @@ EXTRA_DIST = \
linux/powerpc64/syscallent1.h \
linux/powerpc64/userent.h \
linux/ptp_clock.h \
linux/s390/arch_regs.c \
linux/s390/arch_regs.h \
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/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_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/syscallent.h \
linux/s390x/userent.h \
linux/sh/arch_getrval2.c \
linux/sh/arch_regs.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/syscallent.h \
linux/sh/userent.h \
linux/sh/userent0.h \
linux/sh64/arch_regs.c \
linux/sh64/arch_regs.h \
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/syscallent.h \
linux/sh64/userent.h \
linux/signalent.h \
linux/sock_diag.h \
linux/sparc/arch_getrval2.c \
linux/sparc/arch_regs.c \
linux/sparc/arch_regs.h \
linux/sparc/dummy2.h \
linux/sparc/arch_sigreturn.c \
linux/sparc/errnoent.h \
linux/sparc/errnoent1.h \
linux/sparc/gen.pl \
linux/sparc/ioctlent1.h \
linux/sparc/get_error.c \
linux/sparc/get_scno.c \
linux/sparc/get_syscall_args.c \
linux/sparc/ioctls_arch0.h \
linux/sparc/ioctls_inc0.h \
linux/sparc/signalent.h \
linux/sparc/signalent1.h \
linux/sparc/syscall1.h \
linux/sparc/syscallent.h \
linux/sparc/syscallent1.h \
linux/sparc/userent.h \
linux/sparc64/arch_getrval2.c \
linux/sparc64/arch_regs.c \
linux/sparc64/arch_regs.h \
linux/sparc64/dummy2.h \
linux/sparc64/arch_sigreturn.c \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
linux/sparc64/errnoent2.h \
linux/sparc64/ioctlent1.h \
linux/sparc64/get_error.c \
linux/sparc64/get_scno.c \
linux/sparc64/get_syscall_args.c\
linux/sparc64/ioctls_arch0.h \
linux/sparc64/ioctls_arch2.h \
linux/sparc64/ioctls_arch1.h \
linux/sparc64/ioctls_inc0.h \
linux/sparc64/ioctls_inc2.h \
linux/sparc64/ioctls_inc1.h \
linux/sparc64/signalent.h \
linux/sparc64/signalent1.h \
linux/sparc64/signalent2.h \
linux/sparc64/syscall1.h \
linux/sparc64/syscallent.h \
linux/sparc64/syscallent1.h \
linux/sparc64/syscallent2.h \
linux/sparc64/userent.h \
linux/subcall.h \
linux/syscall.h \
linux/tile/arch_regs.c \
linux/tile/arch_regs.h \
linux/tile/arch_sigreturn.c \
linux/tile/errnoent1.h \
linux/tile/get_error.c \
linux/tile/get_scno.c \
linux/tile/get_syscall_args.c \
linux/tile/ioctls_arch0.h \
linux/tile/ioctls_arch1.h \
linux/tile/ioctls_inc0.h \
@ -337,8 +550,13 @@ EXTRA_DIST = \
linux/unix_diag.h \
linux/userent.h \
linux/userent0.h \
linux/x32/arch_regs.c \
linux/x32/arch_regs.h \
linux/x32/arch_sigreturn.c \
linux/x32/errnoent1.h \
linux/x32/get_error.c \
linux/x32/get_scno.c \
linux/x32/get_syscall_args.c \
linux/x32/ioctls_arch0.h \
linux/x32/ioctls_arch1.h \
linux/x32/ioctls_inc0.h \
@ -347,10 +565,16 @@ EXTRA_DIST = \
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_sigreturn.c \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
linux/x86_64/gentab.pl \
linux/x86_64/get_error.c \
linux/x86_64/get_scno.c \
linux/x86_64/get_syscall_args.c \
linux/x86_64/getregs_old.c \
linux/x86_64/ioctls_arch0.h \
linux/x86_64/ioctls_arch1.h \
linux/x86_64/ioctls_arch2.h \
@ -363,6 +587,11 @@ EXTRA_DIST = \
linux/x86_64/syscallent1.h \
linux/x86_64/syscallent2.h \
linux/x86_64/userent.h \
linux/xtensa/arch_regs.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/syscallent.h \
@ -371,6 +600,10 @@ EXTRA_DIST = \
maint/ioctls_hex.sh \
maint/ioctls_sym.sh \
maint/print_ioctlent.c \
mpers.awk \
mpers.sh \
mpers_test.sh \
mpers_xlat.h \
signalent.sh \
strace-graph \
strace-log-merge \
@ -385,11 +618,25 @@ EXTRA_DIST = \
srpm: dist-xz
rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
BUILT_SOURCES = .version
$(srcdir)/.version:
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
strace_SOURCES_c = $(filter %.c,$(strace_SOURCES))
sys_func.h: $(patsubst %,$(srcdir)/%,$(strace_SOURCES_c))
for f in $^; do \
sed -n 's/^SYS_FUNC(.*/extern &;/p' $$f; \
done | sort -u > $@
syscallent_names = subcall.h syscallent.h syscallent1.h \
syscallent-n32.h syscallent-n64.h syscallent-o32.h
syscallent_patterns = $(patsubst %,\%/%,$(syscallent_names))
syscallent_files = $(filter $(syscallent_patterns),$(EXTRA_DIST))
sen.h: $(patsubst %,$(srcdir)/%,$(syscallent_files))
for f in $^; do cat -- $$f; done | \
$(srcdir)/generate_sen.sh > $@
dist-hook:
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
@ -415,8 +662,6 @@ ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(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))
BUILT_SOURCES += $(ioctlent_h)
CLEANFILES = $(ioctlent_h)
ioctlent%.h: ioctlsort%
./$< > $@
@ -430,6 +675,110 @@ ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
cat $^ > $@
BUILT_SOURCES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
CLEANFILES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
# defines mpers_source_files
include mpers.am
srcdir_mpers_source_files = $(patsubst %,$(srcdir)/%,$(mpers_source_files))
mpers_NAME =
mpers_PREFIX = $(mpers_NAME)_
mpers_DEFS = $(DEFS)
mpers_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
mpers_CPPFLAGS = $(strace_CPPFLAGS) $(CPPFLAGS)
mpers_sh_opts = $(mpers_DEFS) $(mpers_INCLUDES) $(mpers_CPPFLAGS)
libmpers_CPPFLAGS = $(AM_CPPFLAGS) -DIN_MPERS
# mpers targets
mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
for f in $^; do \
CC="$(CC)" CFLAGS="$(mpers_sh_opts)" \
CPP="$(CPP)" CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \
$(srcdir)/mpers.sh -$(mpers_NAME) $$f || exit; \
done
> $@
m%_type_defs.h: $(srcdir_mpers_source_files)
for f in $^; do \
sed -n 's/^#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
echo '#include "$(mpers_PREFIX)printer_decls.h"' >> $@-t
mv $@-t $@
m%_funcs.h: $(srcdir_mpers_source_files)
for f in $^; do \
sed -n 's/^SYS_FUNC(\([^)]\+\))/#undef sys_\1\n#define sys_\1 $(mpers_PREFIX)sys_\1/p' $$f || exit; \
done > $@-t && \
echo '#include "sys_func.h"' >> $@-t
mv $@-t $@
# printers
printers.h: $(srcdir_mpers_source_files)
echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
echo 'typedef struct {' >> $@-t
for f in $^; do \
sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/ \1 (*\2) \3;\n#define \2 MPERS_PRINTER_NAME(\2)\n/p' $$f || exit; \
done >> $@-t
echo '} struct_printers;' >> $@-t
echo 'extern const struct_printers *printers;' >> $@-t
echo '#define MPERS_PRINTER_NAME(printer_name) printers->printer_name' >> $@-t
mv $@-t $@
%_printer_decls.h: $(srcdir_mpers_source_files)
echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
for f in $^; do \
sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/extern \1 $(mpers_PREFIX)\2\3;/p' $$f || exit; \
done >> $@-t
mv $@-t $@
%_printer_defs.h: $(srcdir_mpers_source_files)
echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
for f in $^; do \
sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/\.\2 = $(mpers_PREFIX)\2,/p' $$f || exit; \
done >> $@-t
mv $@-t $@
native_printer_decls.h native_printer_defs.h: mpers_PREFIX =
if HAVE_M32_MPERS
strace_LDADD += libmpers-m32.a
noinst_LIBRARIES += libmpers-m32.a
libmpers_m32_a_SOURCES = $(mpers_source_files)
libmpers_m32_a_CPPFLAGS = $(libmpers_CPPFLAGS) -DMPERS_IS_m32 -I$(builddir)/mpers-m32
mpers_m32_targets = mpers-m32.stamp m32_type_defs.h m32_funcs.h m32_printer_decls.h m32_printer_defs.h
BUILT_SOURCES += $(mpers_m32_targets)
CLEANFILES += $(mpers_m32_targets)
$(mpers_m32_targets): mpers_NAME = m32
endif # HAVE_M32_MPERS
if HAVE_MX32_MPERS
strace_LDADD += libmpers-mx32.a
noinst_LIBRARIES += libmpers-mx32.a
libmpers_mx32_a_SOURCES = $(mpers_source_files)
libmpers_mx32_a_CPPFLAGS = $(libmpers_CPPFLAGS) -DMPERS_IS_mx32 -I$(builddir)/mpers-mx32
mpers_mx32_targets = mpers-mx32.stamp mx32_type_defs.h mx32_funcs.h mx32_printer_decls.h mx32_printer_defs.h
BUILT_SOURCES += $(mpers_mx32_targets)
CLEANFILES += $(mpers_mx32_targets)
$(mpers_mx32_targets): mpers_NAME = mx32
endif # HAVE_MX32_MPERS
clean-local:
-rm -rf mpers-m32 mpers-mx32
if MAINTAINER_MODE
gen_changelog_start_date = 2009-07-08 20:00

80
NEWS
View File

@ -1,3 +1,83 @@
Noteworthy changes in release 4.11 (2015-12-21)
===============================================
* Changes in behavior
* Some syscalls have different names depending on architecture and
personality. In these cases, syscall filtering and printing now
consistently uses the names that match corresponding __NR_* kernel
macros of the tracee's architecture and personality.
* Added strace prefix to all diagnostic messages.
* Improvements
* Enhanced and extended test suite.
* Implemented reliable tracing of processes whose personality differs
from the personality of strace, fixed decoding of 32-bit personality
syscalls on 64-bit architectures.
* When some data referenced by syscall arguments is irrelevant or cannot
be read from tracee's memory, strace now prints its address consistently.
* When a syscall is restarted using restart_syscall mechanism, strace now
shows the syscall name on architectures that expose this information.
* Print values returned by epoll_create1, eventfd, eventfd2, fanotify_init,
inotify_init1, perf_event_open, pipe, pipe2, signalfd, signalfd4, socket,
socketpair, timerfd, and timerfd_create syscalls, as well as F_DUPFD and
F_DUPFD_CLOEXEC fcntl commands, as file descriptors.
* Optimized decoding of indirect socket syscalls.
* Implemented decoding of nanoseconds along with seconds in stat family
syscalls (addresses Fedora bug #1251176).
* Implemented decoding of struct statfs.f_flags in statfs syscall.
* Implemented decoding of siginfo_t.si_syscall and siginfo_t.si_arch
in SIGSYS signal.
* Implemented decoding of indirect syscall on mips o32.
* Implemented decoding of IPPROTO_IP control messages.
* Implemented decoding of setsockopt syscall multicast arguments.
* Enhanced decoding of struct sigevent.
* Enhanced decoding of block, loop, mtd, ptp, rtc, SG_IO, socket, tty,
and v4l2 ioctl syscall arguments.
* Enhanced decoding of epoll_create, fcntl, fcntl64, futex, getdents,
getdents64, getsockopt, io_*, mount, msgctl, prctl, quotactl, recvfrom,
sendfile, setsockopt, and shmctl syscalls.
* Implemented decoding of bpf, execveat, ioperm, iopl, kcmp, kexec_file_load,
lookup_dcookie, membarrier, memfd_create, mlock2, name_to_handle_at,
open_by_handle_at, sched_getattr, sched_setattr, and userfaultfd syscalls.
* Updated lists of AF_*, EPOLL_*, FALLOC_FL_*, F_*, INPUT_PROP_*, IPPROTO_*,
IPV6_*, IP_*, KEY_*, LOCK_*, MNT_*, MS_*, PACKET_*, PERF_FLAG_*, PF_*,
PR_*, PTRACE_O_*, RENAME_*, SCTP_*, SECBIT_*, SO_*, TCP_*, and siginfo_t
constants.
* Added Nios II architecture support.
* Added new syscall entries to match Linux 4.4.
* Bug fixes
* Fixed potential short read of strings from tracee's memory.
* Fixed -qq option in conjunction with -o option.
* Fixed filtering of <unavailable> syscalls.
* Fixed decoding of ioctl syscall command on aarch64 and 32-bit architectures
with 64-bit aligned structures.
* Fixed decoding of eventfd2, epoll_create1, signalfd4, and sync_file_range2
syscall flags arguments.
* Fixed decoding of 4th argument of clock_nanosleep syscall.
* Fixed decoding of getpagesize syscall on m68k.
* Fixed decoding of getrandom and seccomp syscalls on aarch64.
* Fixed decoding of timezone argument of gettimeofday and settimeofday
* syscalls.
* Fixed decoding of offset argument of mmap2 syscall on arm, sparc,
and sparc64.
* Fixed decoding of pipe syscall on alpha and mips.
* Fixed decoding of pipe2 syscall on ia64, sh, sparc, and sparc64.
* Fixed decoding of signal mask argument of pselect6 syscall on x32.
* Fixed decoding of signal mask of rt_sigreturn syscall on aarch64, m68k,
and x32.
* Fixed decoding of 4th argument of semctl indirect syscall.
* Fixed decoding of sa_restorer and sa_mask of sigaction syscall on m68k.
* Fixed decoding of statfs64 and fstatfs64 syscalls on arm eabi.
* Fixed decoding of struct dirent on x32.
* Fixed decoding of times syscall return value on mips n32 and x32.
* Fixed decoding of path argument of umount2 syscall
(addresses Debian bug #785050).
* Worked around a kernel bug in tracing privileged executables.
* Fixed various errors in mapping between syscall numbers and associated
information like the number of syscall arguments, the name of syscall,
and syscall decoder.
Noteworthy changes in release 4.10 (2015-03-06)
===============================================

14
README-mpers Normal file
View File

@ -0,0 +1,14 @@
To use mpers functionality, one should:
* typedef all of the target types which are compound and not typedefed
already;
* for each target type, include DEF_MPERS_TYPE(target_type_t), these can
be included conditionally;
* include MPERS_DEFS once;
* before inclusion of MPERS_DEFS include all important headers
(containing definitions of these types or other behaviour-affecting
defines);
* printers should be defined
as MPERS_PRINTER_DECL(return_type, function_name)(args),
inside files that include MPERS_DEFS these printers should be called
as MPERS_FUNC_NAME(function_name)(args), in other files
they should be called just as function_name(args).

View File

@ -7,24 +7,20 @@
static int
decode_access(struct tcb *tcp, int offset)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprints(", ");
printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
}
return 0;
printpath(tcp, tcp->u_arg[offset]);
tprints(", ");
printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
return RVAL_DECODED;
}
int
sys_access(struct tcb *tcp)
SYS_FUNC(access)
{
return decode_access(tcp, 0);
}
int
sys_faccessat(struct tcb *tcp)
SYS_FUNC(faccessat)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
print_dirfd(tcp, tcp->u_arg[0]);
return decode_access(tcp, 1);
}

View File

@ -1,57 +1,84 @@
/*
* Copyright (c) 2002-2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2009-2015 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.
*/
#include "defs.h"
static void
print_affinitylist(struct tcb *tcp, long list, unsigned int len)
print_affinitylist(struct tcb *tcp, const unsigned long addr, const unsigned int len)
{
int first = 1;
unsigned long w, min_len;
unsigned long w;
const unsigned int size = len * sizeof(w);
const unsigned long end = addr + size;
unsigned long cur, abbrev_end;
if (abbrev(tcp) && len / sizeof(w) > max_strlen)
min_len = len - max_strlen * sizeof(w);
else
min_len = 0;
for (; len >= sizeof(w) && len > min_len;
len -= sizeof(w), list += sizeof(w)) {
if (umove(tcp, list, &w) < 0)
break;
if (first)
tprints("{");
else
if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
!addr || !len || size / sizeof(w) != len || end < addr) {
printaddr(addr);
return;
}
if (abbrev(tcp)) {
abbrev_end = addr + max_strlen * sizeof(w);
if (abbrev_end < addr)
abbrev_end = end;
} else {
abbrev_end = end;
}
tprints("[");
for (cur = addr; cur < end; cur += sizeof(w)) {
if (cur > addr)
tprints(", ");
first = 0;
if (cur >= abbrev_end) {
tprints("...");
break;
}
if (umove_or_printaddr(tcp, cur, &w))
break;
tprintf("%lx", w);
}
if (len) {
if (first)
tprintf("%#lx", list);
else
tprintf(", %s}", (len >= sizeof(w) && len > min_len ?
"???" : "..."));
} else {
tprints(first ? "{}" : "}");
}
tprints("]");
}
int
sys_sched_setaffinity(struct tcb *tcp)
SYS_FUNC(sched_setaffinity)
{
if (entering(tcp)) {
tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]);
}
return 0;
tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]);
return RVAL_DECODED;
}
int
sys_sched_getaffinity(struct tcb *tcp)
SYS_FUNC(sched_getaffinity)
{
if (entering(tcp)) {
tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
} else {
if (tcp->u_rval == -1)
tprintf("%#lx", tcp->u_arg[2]);
else
print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval);
print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval);
}
return 0;
}

312
aio.c
View File

@ -29,46 +29,26 @@
*/
#include "defs.h"
#ifdef HAVE_LIBAIO_H
# include <libaio.h>
#endif
#include <linux/aio_abi.h>
/* Not defined in libaio.h */
#ifndef IOCB_RESFD
# define IOCB_RESFD (1 << 0)
#endif
int
sys_io_setup(struct tcb *tcp)
SYS_FUNC(io_setup)
{
if (entering(tcp))
tprintf("%ld, ", tcp->u_arg[0]);
else {
if (syserror(tcp))
tprintf("0x%0lx", tcp->u_arg[1]);
else {
unsigned long user_id;
if (umove(tcp, tcp->u_arg[1], &user_id) == 0)
tprintf("{%lu}", user_id);
else
tprints("{...}");
}
}
tprintf("%u, ", (unsigned int) tcp->u_arg[0]);
else
printnum_ulong(tcp, tcp->u_arg[1]);
return 0;
}
int
sys_io_destroy(struct tcb *tcp)
SYS_FUNC(io_destroy)
{
if (entering(tcp))
tprintf("%lu", tcp->u_arg[0]);
return 0;
}
tprintf("%lu", tcp->u_arg[0]);
#ifdef HAVE_LIBAIO_H
return RVAL_DECODED;
}
enum iocb_sub {
SUB_NONE, SUB_COMMON, SUB_POLL, SUB_VECTOR
SUB_NONE, SUB_COMMON, SUB_VECTOR
};
static enum iocb_sub
@ -82,8 +62,8 @@ tprint_lio_opcode(unsigned cmd)
{ "pwrite", SUB_COMMON },
{ "fsync", SUB_NONE },
{ "fdsync", SUB_NONE },
{ "op4", SUB_NONE },
{ "poll", SUB_POLL },
{ "preadx", SUB_NONE },
{ "poll", SUB_NONE },
{ "noop", SUB_NONE },
{ "preadv", SUB_VECTOR },
{ "pwritev", SUB_VECTOR },
@ -98,176 +78,180 @@ tprint_lio_opcode(unsigned cmd)
}
static void
print_common_flags(struct iocb *iocb)
print_common_flags(const struct iocb *cb)
{
#if HAVE_STRUCT_IOCB_U_C_FLAGS
if (iocb->u.c.flags & IOCB_RESFD)
tprintf(", resfd=%d", iocb->u.c.resfd);
if (iocb->u.c.flags & ~IOCB_RESFD)
tprintf(", flags=%x", iocb->u.c.flags);
#else
# warning "libaio.h is too old => limited io_submit decoding"
/* IOCB_FLAG_RESFD is available since v2.6.22-rc1~47 */
#ifdef IOCB_FLAG_RESFD
if (cb->aio_flags & IOCB_FLAG_RESFD)
tprintf(", resfd=%d", cb->aio_resfd);
if (cb->aio_flags & ~IOCB_FLAG_RESFD)
tprintf(", flags=%x", cb->aio_flags);
#endif
}
#endif /* HAVE_LIBAIO_H */
int
sys_io_submit(struct tcb *tcp)
static bool
iocb_is_valid(const struct iocb *cb)
{
if (entering(tcp)) {
#ifdef HAVE_LIBAIO_H
long nr = tcp->u_arg[1];
/* if nr <= 0, we end up printing just "{}" */
tprintf("%lu, %ld, {", tcp->u_arg[0], tcp->u_arg[1]);
{
long i;
struct iocb **iocbs = (void *)tcp->u_arg[2];
//FIXME: decoding of 32-bit call by 64-bit strace
return cb->aio_buf == (unsigned long) cb->aio_buf &&
cb->aio_nbytes == (size_t) cb->aio_nbytes &&
(ssize_t) cb->aio_nbytes >= 0;
}
for (i = 0; i < nr; i++, iocbs++) {
enum iocb_sub sub;
struct iocb *iocbp;
struct iocb iocb;
if (i)
tprints(", ");
static enum iocb_sub
print_iocb_header(const struct iocb *cb)
{
enum iocb_sub sub;
if (umove(tcp, (unsigned long)iocbs, &iocbp)) {
tprintf("%#lx", (unsigned long)iocbs);
/* No point in trying to read iocbs+1 etc */
/* (nr can be ridiculously large): */
break;
}
if (umove(tcp, (unsigned long)iocbp, &iocb)) {
tprintf("{%#lx}", (unsigned long)iocbp);
continue;
}
tprints("{");
if (iocb.data)
tprintf("data:%p, ", iocb.data);
if (iocb.key)
tprintf("key:%u, ", iocb.key);
sub = tprint_lio_opcode(iocb.aio_lio_opcode);
if (iocb.aio_reqprio)
tprintf(", reqprio:%d", iocb.aio_reqprio);
tprintf(", filedes:%d", iocb.aio_fildes);
switch (sub) {
case SUB_COMMON:
#if HAVE_DECL_IO_CMD_PWRITE
if (iocb.aio_lio_opcode == IO_CMD_PWRITE) {
tprints(", str:");
printstr(tcp, (unsigned long)iocb.u.c.buf,
iocb.u.c.nbytes);
} else
#endif
tprintf(", buf:%p", iocb.u.c.buf);
tprintf(", nbytes:%lu, offset:%lld",
iocb.u.c.nbytes,
iocb.u.c.offset);
print_common_flags(&iocb);
break;
case SUB_VECTOR:
tprintf(", %lld", iocb.u.v.offset);
print_common_flags(&iocb);
tprints(", ");
tprint_iov(tcp, iocb.u.v.nr,
(unsigned long)iocb.u.v.vec,
#if HAVE_DECL_IO_CMD_PWRITEV
iocb.aio_lio_opcode == IO_CMD_PWRITEV
#else
0
#endif
);
break;
case SUB_POLL:
tprintf(", %x", iocb.u.poll.events);
break;
case SUB_NONE:
break;
}
tprints("}");
if (cb->aio_data)
tprintf("data=%#" PRIx64 ", ",
(uint64_t) cb->aio_data);
if (cb->aio_key)
tprintf("key=%u, ", cb->aio_key);
sub = tprint_lio_opcode(cb->aio_lio_opcode);
if (cb->aio_reqprio)
tprintf(", reqprio=%hd", cb->aio_reqprio);
tprintf(", fildes=%d", cb->aio_fildes);
return sub;
}
static void
print_iocb(struct tcb *tcp, const struct iocb *cb)
{
enum iocb_sub sub = print_iocb_header(cb);
switch (sub) {
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);
} else {
tprintf(", buf=%#" PRIx64, (uint64_t) cb->aio_buf);
}
tprintf(", nbytes=%" PRIu64 ", offset=%" PRId64,
(uint64_t) cb->aio_nbytes, (int64_t) cb->aio_offset);
print_common_flags(cb);
break;
case SUB_VECTOR:
if (iocb_is_valid(cb)) {
tprints(", iovec=");
tprint_iov(tcp, cb->aio_nbytes, cb->aio_buf,
cb->aio_lio_opcode == 8);
} else {
tprintf(", buf=%#" PRIx64 ", nbytes=%" PRIu64,
(uint64_t) cb->aio_buf,
(uint64_t) cb->aio_nbytes);
}
tprintf(", offset=%" PRId64, (int64_t) cb->aio_offset);
print_common_flags(cb);
break;
case SUB_NONE:
break;
}
}
SYS_FUNC(io_submit)
{
long nr = tcp->u_arg[1];
/* if nr <= 0, we end up printing just "[]" */
tprintf("%lu, %ld, [", tcp->u_arg[0], nr);
{
long i;
long iocbs = tcp->u_arg[2];
for (i = 0; i < nr; ++i, iocbs += current_wordsize) {
unsigned long iocbp;
struct iocb cb;
if (i)
tprints(", ");
if (umove_ulong_or_printaddr(tcp, iocbs, &iocbp)) {
/*
* No point in trying to read the whole array
* because nr can be ridiculously large.
*/
break;
}
tprints("{");
if (!umove_or_printaddr(tcp, iocbp, &cb))
print_iocb(tcp, &cb);
tprints("}");
}
tprints("}");
#else
# warning "libaio.h is not available => no io_submit decoding"
tprintf("%lu, %ld, %#lx", tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
#endif
}
tprints("]");
return RVAL_DECODED;
}
static int
print_io_event(struct tcb *tcp, const long addr)
{
struct io_event event;
if (umove_or_printaddr(tcp, addr, &event))
return -1;
tprintf("{data=%#" PRIx64 ", obj=%#" PRIx64
", res=%" PRId64 ", res2=%" PRId64 "}",
(uint64_t) event.data, (uint64_t) event.obj,
(int64_t) event.res, (int64_t) event.res2);
return 0;
}
int
sys_io_cancel(struct tcb *tcp)
SYS_FUNC(io_cancel)
{
if (entering(tcp)) {
#ifdef HAVE_LIBAIO_H
struct iocb iocb;
#endif
tprintf("%lu, ", tcp->u_arg[0]);
#ifdef HAVE_LIBAIO_H
if (umove(tcp, tcp->u_arg[1], &iocb) == 0) {
tprintf("{%p, %u, %u, %u, %d}, ",
iocb.data, iocb.key,
(unsigned)iocb.aio_lio_opcode,
(unsigned)iocb.aio_reqprio, iocb.aio_fildes);
} else
#endif
tprints("{...}, ");
} else {
if (tcp->u_rval < 0)
tprints("{...}");
else {
#ifdef HAVE_LIBAIO_H
struct io_event event;
if (umove(tcp, tcp->u_arg[2], &event) == 0)
tprintf("{%p, %p, %ld, %ld}",
event.data, event.obj,
event.res, event.res2);
else
#endif
tprints("{...}");
struct iocb cb;
if (!umove_or_printaddr(tcp, tcp->u_arg[1], &cb)) {
tprints("{");
print_iocb_header(&cb);
tprints("}");
}
tprints(", ");
} else {
print_io_event(tcp, tcp->u_arg[2]);
}
return 0;
}
int
sys_io_getevents(struct tcb *tcp)
SYS_FUNC(io_getevents)
{
if (entering(tcp)) {
tprintf("%ld, %ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1],
tcp->u_arg[2]);
tprintf("%lu, %ld, %ld, ",
tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
} else {
if (tcp->u_rval == 0) {
tprints("{}");
tprints("[]");
} else {
#ifdef HAVE_LIBAIO_H
struct io_event *events = (void *)tcp->u_arg[3];
long i, nr = tcp->u_rval;
for (i = 0; i < nr; i++, events++) {
struct io_event event;
if (i == 0)
tprints("{");
tprints("[");
else
tprints(", ");
if (umove(tcp, (unsigned long)events, &event) != 0) {
tprints("{...}");
continue;
}
tprintf("{%p, %p, %ld, %ld}", event.data,
event.obj, event.res, event.res2);
if (print_io_event(tcp, (long)events))
break;
}
tprints("}, ");
#else
tprints("{...}");
#endif
tprints("], ");
}
/*
* Since the timeout parameter is read by the kernel
* on entering syscall, it has to be decoded the same way
* whether the syscall has failed or not.
*/
temporarily_clear_syserror(tcp);
print_timespec(tcp, tcp->u_arg[4]);
restore_cleared_syserror(tcp);
}
return 0;
}

172
bjm.c
View File

@ -30,168 +30,32 @@
#include "defs.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/utsname.h>
/* Bits of module.flags. */
#define MOD_UNINITIALIZED 0
#define MOD_RUNNING 1
#define MOD_DELETED 2
#define MOD_AUTOCLEAN 4
#define MOD_VISITED 8
#define MOD_USED_ONCE 16
#define MOD_JUST_FREED 32
#define MOD_INITIALIZING 64
/* Values for query_module's which. */
#define QM_MODULES 1
#define QM_DEPS 2
#define QM_REFS 3
#define QM_SYMBOLS 4
#define QM_INFO 5
struct module_symbol
{
unsigned long value;
const char *name;
};
struct module_info
{
unsigned long addr;
unsigned long size;
unsigned long flags;
long usecount;
};
#include "xlat/qm_which.h"
#include "xlat/modflags.h"
#include "xlat/delete_module_flags.h"
int
sys_query_module(struct tcb *tcp)
SYS_FUNC(create_module)
{
if (entering(tcp)) {
printstr(tcp, tcp->u_arg[0], -1);
tprints(", ");
printxval(qm_which, tcp->u_arg[1], "QM_???");
tprints(", ");
} else {
size_t ret;
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
if (!verbose(tcp) || syserror(tcp) ||
umove(tcp, tcp->u_arg[4], &ret) < 0) {
tprintf("%#lx, %lu, %#lx", tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
} else if (tcp->u_arg[1]==QM_INFO) {
struct module_info mi;
if (umove(tcp, tcp->u_arg[2], &mi) < 0) {
tprintf("%#lx, ", tcp->u_arg[2]);
} else {
tprintf("{address=%#lx, size=%lu, flags=",
mi.addr, mi.size);
printflags(modflags, mi.flags, "MOD_???");
tprintf(", usecount=%lu}, ", mi.usecount);
}
tprintf("%lu", (unsigned long)ret);
} else if ((tcp->u_arg[1]==QM_MODULES) ||
(tcp->u_arg[1]==QM_DEPS) ||
(tcp->u_arg[1]==QM_REFS)) {
tprints("{");
if (!abbrev(tcp)) {
char* data = malloc(tcp->u_arg[3]);
char* mod = data;
size_t idx;
if (!data) {
fprintf(stderr, "out of memory\n");
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
if (umoven(tcp, tcp->u_arg[2],
tcp->u_arg[3], data) < 0) {
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
for (idx = 0; idx < ret; idx++) {
tprintf("%s%s",
(idx ? ", " : ""),
mod);
mod += strlen(mod)+1;
}
}
free(data);
}
} else
tprintf(" /* %lu entries */ ", (unsigned long)ret);
tprintf("}, %lu", (unsigned long)ret);
} else if (tcp->u_arg[1]==QM_SYMBOLS) {
tprints("{");
if (!abbrev(tcp)) {
char* data = malloc(tcp->u_arg[3]);
struct module_symbol* sym = (struct module_symbol*)data;
size_t idx;
if (!data) {
fprintf(stderr, "out of memory\n");
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
if (umoven(tcp, tcp->u_arg[2],
tcp->u_arg[3], data) < 0) {
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
for (idx = 0; idx < ret; idx++) {
tprintf("%s{name=%s, value=%lu}",
(idx ? " " : ""),
data+(long)sym->name,
sym->value);
sym++;
}
}
free(data);
}
} else
tprintf(" /* %lu entries */ ", (unsigned long)ret);
tprintf("}, %ld", (unsigned long)ret);
} else {
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
tprintf(", %#lx", tcp->u_arg[4]);
}
}
return 0;
return RVAL_DECODED | RVAL_HEX;
}
int
sys_create_module(struct tcb *tcp)
SYS_FUNC(delete_module)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
}
return RVAL_HEX;
printstr(tcp, tcp->u_arg[0], -1);
tprints(", ");
printflags(delete_module_flags, tcp->u_arg[1], "O_???");
return RVAL_DECODED;
}
int
sys_delete_module(struct tcb *tcp)
SYS_FUNC(init_module)
{
if (entering(tcp)) {
printstr(tcp, tcp->u_arg[0], -1);
tprints(", ");
printflags(delete_module_flags, tcp->u_arg[1], "O_???");
}
return 0;
}
tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2], -1);
int
sys_init_module(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2], -1);
}
return 0;
return RVAL_DECODED;
}
#define MODULE_INIT_IGNORE_MODVERSIONS 1
@ -199,12 +63,8 @@ sys_init_module(struct tcb *tcp)
#include "xlat/module_init_flags.h"
int
sys_finit_module(struct tcb *tcp)
SYS_FUNC(finit_module)
{
if (exiting(tcp))
return 0;
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
@ -214,5 +74,5 @@ sys_finit_module(struct tcb *tcp)
/* flags */
printflags(module_init_flags, tcp->u_arg[2], "MODULE_INIT_???");
return 0;
return RVAL_DECODED;
}

256
block.c
View File

@ -46,55 +46,59 @@ struct blk_user_trace_setup {
};
#ifndef BLKTRACESETUP
#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
# define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
#endif
#ifndef BLKTRACESTART
#define BLKTRACESTART _IO(0x12,116)
# define BLKTRACESTART _IO(0x12,116)
#endif
#ifndef BLKTRACESTOP
#define BLKTRACESTOP _IO(0x12,117)
# define BLKTRACESTOP _IO(0x12,117)
#endif
#ifndef BLKTRACETEARDOWN
#define BLKTRACETEARDOWN _IO(0x12,118)
# define BLKTRACETEARDOWN _IO(0x12,118)
#endif
#ifndef BLKDISCARD
#define BLKDISCARD _IO(0x12,119)
# define BLKDISCARD _IO(0x12,119)
#endif
#ifndef BLKIOMIN
#define BLKIOMIN _IO(0x12,120)
# define BLKIOMIN _IO(0x12,120)
#endif
#ifndef BLKIOOPT
#define BLKIOOPT _IO(0x12,121)
# define BLKIOOPT _IO(0x12,121)
#endif
#ifndef BLKALIGNOFF
#define BLKALIGNOFF _IO(0x12,122)
# define BLKALIGNOFF _IO(0x12,122)
#endif
#ifndef BLKPBSZGET
#define BLKPBSZGET _IO(0x12,123)
# define BLKPBSZGET _IO(0x12,123)
#endif
#ifndef BLKDISCARDZEROES
#define BLKDISCARDZEROES _IO(0x12,124)
# define BLKDISCARDZEROES _IO(0x12,124)
#endif
#ifndef BLKSECDISCARD
#define BLKSECDISCARD _IO(0x12,125)
# define BLKSECDISCARD _IO(0x12,125)
#endif
#ifndef BLKROTATIONAL
# define BLKROTATIONAL _IO(0x12,126)
#endif
#ifndef BLKZEROOUT
# define BLKZEROOUT _IO(0x12,127)
#endif
#include "xlat/blkpg_ops.h"
static void
print_blkpg_req(struct tcb *tcp, struct blkpg_ioctl_arg *blkpg)
print_blkpg_req(struct tcb *tcp, const struct blkpg_ioctl_arg *blkpg)
{
struct blkpg_partition p;
tprints("{");
printxval(blkpg_ops, blkpg->op, "BLKPG_???");
tprintf(", flags=%d, datalen=%d, ",
tprintf(", flags=%d, datalen=%d, data=",
blkpg->flags, blkpg->datalen);
if (umove(tcp, (long) blkpg->data, &p) < 0)
tprintf("%#lx}", (long) blkpg->data);
else {
if (!umove_or_printaddr(tcp, (long) blkpg->data, &p)) {
tprintf("{start=%lld, length=%lld, pno=%d, devname=",
p.start, p.length, p.pno);
print_quoted_string(p.devname, sizeof(p.devname),
@ -102,47 +106,35 @@ print_blkpg_req(struct tcb *tcp, struct blkpg_ioctl_arg *blkpg)
tprints(", volname=");
print_quoted_string(p.volname, sizeof(p.volname),
QUOTE_0_TERMINATED);
tprints("}}");
tprints("}");
}
tprints("}");
}
int
block_ioctl(struct tcb *tcp, const unsigned int code, long arg)
block_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
{
switch (code) {
/* take arg as a value, not as a pointer */
case BLKRASET:
case BLKFRASET:
if (entering(tcp))
tprintf(", %ld", arg);
tprintf(", %lu", arg);
break;
/* take a signed int */
case BLKROSET:
case BLKBSZSET:
#ifdef FIFREEZE
/* First seen in linux-2.6.29 */
case FIFREEZE:
case FITHAW:
#endif
if (entering(tcp)) {
int val;
if (umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %d", val);
}
tprints(", ");
printnum_int(tcp, arg, "%d");
break;
/* returns an unsigned short */
/* return an unsigned short */
case BLKSECTGET:
if (exiting(tcp)) {
unsigned short val;
if (syserror(tcp) || umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %u", (unsigned)val);
}
case BLKROTATIONAL:
if (entering(tcp))
return 0;
tprints(", ");
printnum_short(tcp, arg, "%hu");
break;
/* return a signed int */
@ -150,13 +142,10 @@ block_ioctl(struct tcb *tcp, const unsigned int code, long arg)
case BLKBSZGET:
case BLKSSZGET:
case BLKALIGNOFF:
if (exiting(tcp)) {
int val;
if (syserror(tcp) || umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %d", val);
}
if (entering(tcp))
return 0;
tprints(", ");
printnum_int(tcp, arg, "%d");
break;
/* return an unsigned int */
@ -164,71 +153,57 @@ block_ioctl(struct tcb *tcp, const unsigned int code, long arg)
case BLKIOMIN:
case BLKIOOPT:
case BLKDISCARDZEROES:
if (exiting(tcp)) {
unsigned int val;
if (syserror(tcp) || umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %u", val);
}
if (entering(tcp))
return 0;
tprints(", ");
printnum_int(tcp, arg, "%u");
break;
/* return a signed long */
case BLKRAGET:
case BLKFRAGET:
if (exiting(tcp)) {
long val;
if (syserror(tcp) || umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %ld", val);
}
if (entering(tcp))
return 0;
tprints(", ");
printnum_slong(tcp, arg);
break;
/* returns an unsigned long */
case BLKGETSIZE:
if (exiting(tcp)) {
unsigned long val;
if (syserror(tcp) || umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %lu", val);
}
if (entering(tcp))
return 0;
tprints(", ");
printnum_ulong(tcp, arg);
break;
#ifdef HAVE_BLKGETSIZE64
/* return an uint64_t */
/* returns an uint64_t */
case BLKGETSIZE64:
if (exiting(tcp)) {
uint64_t val;
if (syserror(tcp) || umove(tcp, arg, &val) < 0)
tprintf(", %#lx", arg);
else
tprintf(", %" PRIu64, val);
}
if (entering(tcp))
return 0;
tprints(", ");
printnum_int64(tcp, arg, "%" PRIu64);
break;
#endif
/* More complex types */
/* takes a pair of uint64_t */
case BLKDISCARD:
case BLKSECDISCARD:
if (entering(tcp)) {
uint64_t range[2];
if (umove(tcp, arg, range) < 0)
tprintf(", %#lx", arg);
else
tprintf(", {%" PRIx64 ", %" PRIx64 "}",
range[0], range[1]);
}
case BLKZEROOUT:
tprints(", ");
printpair_int64(tcp, arg, "%" PRIx64);
break;
/* More complex types */
case HDIO_GETGEO:
if (exiting(tcp)) {
if (entering(tcp))
return 0;
else {
struct hd_geometry geo;
if (syserror(tcp) || umove(tcp, arg, &geo) < 0)
tprintf(", %#lx", arg);
else
tprintf(", {heads=%u, sectors=%u, "
tprints(", ");
if (!umove_or_printaddr(tcp, arg, &geo))
tprintf("{heads=%u, sectors=%u, "
"cylinders=%u, start=%lu}",
(unsigned)geo.heads,
(unsigned)geo.sectors,
@ -237,70 +212,79 @@ block_ioctl(struct tcb *tcp, const unsigned int code, long arg)
}
break;
case BLKPG:
if (entering(tcp)) {
struct blkpg_ioctl_arg blkpg;
if (umove(tcp, arg, &blkpg) < 0)
tprintf(", %#lx", arg);
else {
tprints(", ");
print_blkpg_req(tcp, &blkpg);
}
}
case BLKPG: {
struct blkpg_ioctl_arg blkpg;
tprints(", ");
if (!umove_or_printaddr(tcp, arg, &blkpg))
print_blkpg_req(tcp, &blkpg);
break;
}
case BLKTRACESETUP:
if (entering(tcp)) {
struct blk_user_trace_setup buts;
if (umove(tcp, arg, &buts) < 0)
tprintf(", %#lx", arg);
else
tprintf(", {act_mask=%u, buf_size=%u, "
"buf_nr=%u, start_lba=%" PRIu64 ", "
"end_lba=%" PRIu64 ", pid=%u}",
(unsigned)buts.act_mask, buts.buf_size,
buts.buf_nr, buts.start_lba,
buts.end_lba, buts.pid);
}
if (exiting(tcp)) {
tprints(", ");
if (umove_or_printaddr(tcp, arg, &buts))
break;
tprintf("{act_mask=%u, buf_size=%u, "
"buf_nr=%u, start_lba=%" PRIu64 ", "
"end_lba=%" PRIu64 ", pid=%u",
(unsigned)buts.act_mask, buts.buf_size,
buts.buf_nr, buts.start_lba,
buts.end_lba, buts.pid);
return 1;
} else {
struct blk_user_trace_setup buts;
if (syserror(tcp) || umove(tcp, arg, &buts) < 0)
tprintf(", %#lx", arg);
else {
tprints(", {name=");
print_quoted_string(buts.name, sizeof(buts.name),
QUOTE_0_TERMINATED);
if (syserror(tcp)) {
tprints("}");
break;
}
tprints(", ");
if (umove(tcp, arg, &buts) < 0) {
tprints("???}");
break;
}
tprints(", name=");
print_quoted_string(buts.name, sizeof(buts.name),
QUOTE_0_TERMINATED);
tprints("}");
break;
}
break;
#ifdef FITRIM
/* First seen in linux-2.6.37 */
case FITRIM:
if (entering(tcp)) {
struct fstrim_range fstrim;
if (umove(tcp, arg, &fstrim))
tprintf(", %#lx", arg);
else
tprintf(", {start=%#" PRIx64 ", len=%#" PRIx64 ", "
"minlen=%#" PRIx64 "}", (uint64_t) fstrim.start,
(uint64_t) fstrim.len, (uint64_t) fstrim.minlen);
}
case FITRIM: {
struct fstrim_range fstrim;
tprints(", ");
if (!umove_or_printaddr(tcp, arg, &fstrim))
tprintf("{start=%#" PRIx64 ", "
"len=%#" PRIx64 ", "
"minlen=%#" PRIx64 "}",
(uint64_t) fstrim.start,
(uint64_t) fstrim.len,
(uint64_t) fstrim.minlen);
break;
}
#endif
/* No arguments or unhandled */
/* No arguments */
case BLKRRPART:
case BLKFLSBUF:
case BLKTRACESTART:
case BLKTRACESTOP:
case BLKTRACETEARDOWN:
case BLKFLSBUF: /* Requires driver knowlege */
case BLKRRPART: /* No args */
default:
if (entering(tcp))
tprintf(", %#lx", arg);
#ifdef FIFREEZE
case FIFREEZE:
case FITHAW:
#endif
break;
default:
return RVAL_DECODED;
}
};
return 1;
return RVAL_DECODED | 1;
}

View File

@ -1,18 +1,20 @@
#!/bin/sh -eu
for m in -m32 -mx32; do
mkdir -p tests$m
find tests$m -type l -delete
sed "s/^AM_CFLAGS[[:space:]]*=.*/& $m/" \
tests/Makefile.am > tests$m/Makefile.am
for m in m32 mx32; do
tests=tests-$m
rm -rf $tests
mkdir $tests
sed "s/@arch@/@arch_$m@/;s/^ARCH_MFLAGS[[:space:]]*=.*/& -$m/" \
tests/Makefile.am > $tests/Makefile.am
for f in tests/*; do
case "${f##*/}" in
Makefile*) continue;;
esac
ln -s ../"$f" tests$m/
ln -s ../"$f" $tests/
done
done
./generate_mpers_am.sh
./xlat/gen.sh
exec autoreconf -f -i "$@"

215
bpf.c Normal file
View File

@ -0,0 +1,215 @@
/*
* Copyright (c) 2015 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.
*/
#include "defs.h"
#ifdef HAVE_LINUX_BPF_H
# include <linux/bpf.h>
#endif
#include "xlat/bpf_commands.h"
#include "xlat/bpf_map_types.h"
#include "xlat/bpf_prog_types.h"
#include "xlat/bpf_map_update_elem_flags.h"
static int
bpf_map_create(struct tcb *tcp, const long addr, unsigned int size)
{
struct {
uint32_t map_type, key_size, value_size, max_entries;
} 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("{map_type=");
printxval(bpf_map_types, attr.map_type, "BPF_MAP_TYPE_???");
tprintf(", key_size=%u, value_size=%u, max_entries=%u}",
attr.key_size, attr.value_size, attr.max_entries);
return RVAL_DECODED | RVAL_FD;
}
static void
bpf_map_update_elem(struct tcb *tcp, const long addr, unsigned int size)
{
struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
uint64_t ATTRIBUTE_ALIGNED(8) value;
uint64_t flags;
} attr = {};
if (!size) {
printaddr(addr);
return;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return;
tprints("{map_fd=");
printfd(tcp, attr.map_fd);
tprintf(", key=%#" PRIx64 ", value=%#" PRIx64 ", flags=",
attr.key, attr.value);
printxval(bpf_map_update_elem_flags, attr.flags, "BPF_???");
tprints("}");
}
static void
bpf_map_delete_elem(struct tcb *tcp, const long addr, unsigned int size)
{
struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
} attr = {};
if (!size) {
printaddr(addr);
return;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return;
tprints("{map_fd=");
printfd(tcp, attr.map_fd);
tprintf(", key=%#" PRIx64 "}", attr.key);
}
static int
bpf_map_io(struct tcb *tcp, const long addr, unsigned int size, const char *text)
{
struct bpf_io_elem_struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
uint64_t ATTRIBUTE_ALIGNED(8) value;
} attr = {};
if (exiting(tcp)) {
if (!syserror(tcp) && !umove_or_printaddr(tcp, addr, &attr))
tprintf(", %s=%#" PRIx64, text, attr.value);
tprints("}");
return RVAL_DECODED;
}
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("{map_fd=");
printfd(tcp, attr.map_fd);
tprintf(", key=%#" PRIx64, attr.key);
return 0;
}
static int
bpf_prog_load(struct tcb *tcp, const long addr, unsigned int size)
{
struct {
uint32_t prog_type, insn_cnt;
uint64_t ATTRIBUTE_ALIGNED(8) insns, license;
uint32_t log_level, log_size;
uint64_t ATTRIBUTE_ALIGNED(8) log_buf;
uint32_t kern_version;
} 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("{prog_type=");
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);
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;
}
SYS_FUNC(bpf)
{
const int cmd = tcp->u_arg[0];
const long addr = tcp->u_arg[1];
const unsigned int size = tcp->u_arg[2];
int rc = RVAL_DECODED;
if (entering(tcp)) {
printxval(bpf_commands, cmd, "BPF_???");
tprints(", ");
}
switch (cmd) {
case BPF_MAP_CREATE:
rc = bpf_map_create(tcp, addr, size);
break;
case BPF_MAP_LOOKUP_ELEM:
rc = bpf_map_io(tcp, addr, size, "value");
break;
case BPF_MAP_UPDATE_ELEM:
bpf_map_update_elem(tcp, addr, size);
break;
case BPF_MAP_DELETE_ELEM:
bpf_map_delete_elem(tcp, addr, size);
break;
case BPF_MAP_GET_NEXT_KEY:
rc = bpf_map_io(tcp, addr, size, "next_key");
break;
case BPF_PROG_LOAD:
rc = bpf_prog_load(tcp, addr, size);
break;
default:
printaddr(addr);
break;
}
if (rc & RVAL_DECODED)
tprintf(", %u", size);
return rc;
}

View File

@ -1,3 +1,34 @@
/*
* Copyright (c) 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* Copyright (c) 2010 Mike Frysinger <vapier@gentoo.org>
* Copyright (c) 2010 Carmelo Amoroso <carmelo.amoroso@st.com>
* Copyright (c) 2015 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
* Copyright (c) 2014-2015 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.
*/
#include "defs.h"
#ifdef HAVE_ASM_CACHECTL_H
@ -20,21 +51,20 @@ static const struct xlat cacheflush_flags[] = {
XLAT_END
};
int
sys_cacheflush(struct tcb *tcp)
SYS_FUNC(cacheflush)
{
if (entering(tcp)) {
/* addr */
tprintf("%#lx, ", tcp->u_arg[0]);
/* scope */
printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
tprints(", ");
/* flags */
printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
/* len */
tprintf(", %lu", tcp->u_arg[3]);
}
return 0;
/* addr */
printaddr(tcp->u_arg[0]);
tprints(", ");
/* scope */
printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
tprints(", ");
/* flags */
printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
/* len */
tprintf(", %lu", tcp->u_arg[3]);
return RVAL_DECODED;
}
#endif /* M68K */
@ -46,18 +76,16 @@ static const struct xlat cacheflush_flags[] = {
XLAT_END
};
int
sys_cacheflush(struct tcb *tcp)
SYS_FUNC(cacheflush)
{
if (entering(tcp)) {
/* start addr */
tprintf("%#lx, ", tcp->u_arg[0]);
/* length */
tprintf("%ld, ", tcp->u_arg[1]);
/* flags */
printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE");
}
return 0;
/* start addr */
printaddr(tcp->u_arg[0]);
/* length */
tprintf(", %ld, ", tcp->u_arg[1]);
/* flags */
printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE");
return RVAL_DECODED;
}
#endif /* BFIN */
@ -78,17 +106,28 @@ static const struct xlat cacheflush_flags[] = {
XLAT_END
};
int
sys_cacheflush(struct tcb *tcp)
SYS_FUNC(cacheflush)
{
if (entering(tcp)) {
/* addr */
tprintf("%#lx, ", tcp->u_arg[0]);
/* len */
tprintf("%lu, ", tcp->u_arg[1]);
/* flags */
printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
}
return 0;
/* addr */
printaddr(tcp->u_arg[0]);
/* len */
tprintf(", %lu, ", tcp->u_arg[1]);
/* flags */
printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
return RVAL_DECODED;
}
#endif /* SH */
#ifdef NIOS2
SYS_FUNC(cacheflush)
{
/* addr */
printaddr(tcp->u_arg[0]);
/* len */
tprintf(", %lu, ", tcp->u_arg[3]);
/* scope and flags (cache type) are currently ignored */
return RVAL_DECODED;
}
#endif /* NIOS2 */

View File

@ -1,3 +1,32 @@
/*
* Copyright (c) 2000 Wichert Akkerman <wakkerma@debian.org>
* Copyright (c) 2011 Denys Vlasenko <dvlasenk@redhat.com>
* Copyright (c) 2005-2015 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.
*/
#include "defs.h"
/* these constants are the same as in <linux/capability.h> */
@ -51,13 +80,8 @@ 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)
{
if (!addr) {
tprints("NULL");
return;
}
if (!h) {
tprintf("%#lx", addr);
if (!addr || !h) {
printaddr(addr);
return;
}
@ -86,14 +110,8 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
struct user_cap_data_struct data[2];
unsigned int len;
if (!addr) {
tprints("NULL");
return;
}
if (!h || !verbose(tcp) ||
(exiting(tcp) && syserror(tcp))) {
tprintf("%#lx", addr);
if (!addr || !h) {
printaddr(addr);
return;
}
@ -103,10 +121,8 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
else
len = 1;
if (umoven(tcp, addr, len * sizeof(data[0]), (char *) data) < 0) {
tprintf("%#lx", addr);
if (umoven_or_printaddr(tcp, addr, len * sizeof(data[0]), data))
return;
}
tprints("{");
print_cap_bits(data[0].effective, len > 1 ? data[1].effective : 0);
@ -117,8 +133,7 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
tprints("}");
}
int
sys_capget(struct tcb *tcp)
SYS_FUNC(capget)
{
cap_user_header_t h;
@ -133,14 +148,12 @@ sys_capget(struct tcb *tcp)
return 0;
}
int
sys_capset(struct tcb *tcp)
SYS_FUNC(capset)
{
if (entering(tcp)) {
cap_user_header_t 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);
}
return 0;
cap_user_header_t 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);
return RVAL_DECODED;
}

10
chdir.c
View File

@ -1,10 +1,8 @@
#include "defs.h"
int
sys_chdir(struct tcb *tcp)
SYS_FUNC(chdir)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
}
return 0;
printpath(tcp, tcp->u_arg[0]);
return RVAL_DECODED;
}

40
chmod.c
View File

@ -1,35 +1,31 @@
#include "defs.h"
static int
decode_chmod(struct tcb *tcp, int offset)
static void
decode_chmod(struct tcb *tcp, const int offset)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprintf(", %#lo", tcp->u_arg[offset + 1]);
}
return 0;
printpath(tcp, tcp->u_arg[offset]);
tprintf(", %#lo", tcp->u_arg[offset + 1]);
}
int
sys_chmod(struct tcb *tcp)
SYS_FUNC(chmod)
{
return decode_chmod(tcp, 0);
decode_chmod(tcp, 0);
return RVAL_DECODED;
}
int
sys_fchmodat(struct tcb *tcp)
SYS_FUNC(fchmodat)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
return decode_chmod(tcp, 1);
print_dirfd(tcp, tcp->u_arg[0]);
decode_chmod(tcp, 1);
return RVAL_DECODED;
}
int
sys_fchmod(struct tcb *tcp)
SYS_FUNC(fchmod)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprintf(", %#lo", tcp->u_arg[1]);
}
return 0;
printfd(tcp, tcp->u_arg[0]);
tprintf(", %#lo", tcp->u_arg[1]);
return RVAL_DECODED;
}

95
clone.c
View File

@ -1,32 +1,41 @@
/*
* Copyright (c) 1999-2000 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2002-2005 Roland McGrath <roland@redhat.com>
* Copyright (c) 2008 Jan Kratochvil <jan.kratochvil@redhat.com>
* Copyright (c) 2009-2013 Denys Vlasenko <dvlasenk@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* 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"
/* defines copied from linux/sched.h since we can't include that
* ourselves (it conflicts with *lots* of libc includes)
*/
#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
#define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */
#define CLONE_IDLETASK 0x00001000 /* kernel-only flag */
#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
#define CLONE_THREAD 0x00010000 /* Same thread group? */
#define CLONE_NEWNS 0x00020000 /* New namespace group? */
#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
#define CLONE_STOPPED 0x02000000 /* Start in stopped state */
#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
#define CLONE_NEWIPC 0x08000000 /* New ipcs */
#define CLONE_NEWUSER 0x10000000 /* New user namespace */
#define CLONE_NEWPID 0x20000000 /* New pid namespace */
#define CLONE_NEWNET 0x40000000 /* New network namespace */
#define CLONE_IO 0x80000000 /* Clone io context */
#include <sched.h>
#ifndef CSIGNAL
# define CSIGNAL 0x000000ff
#endif
#include "xlat/clone_flags.h"
@ -68,8 +77,7 @@
extern void print_user_desc(struct tcb *, long);
#endif /* I386 || X86_64 || X32 */
int
sys_clone(struct tcb *tcp)
SYS_FUNC(clone)
{
if (exiting(tcp)) {
const char *sep = "|";
@ -123,29 +131,22 @@ sys_clone(struct tcb *tcp)
return 0;
}
int
sys_setns(struct tcb *tcp)
SYS_FUNC(setns)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
}
return 0;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
return RVAL_DECODED;
}
int
sys_unshare(struct tcb *tcp)
SYS_FUNC(unshare)
{
if (entering(tcp))
printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
return 0;
printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
return RVAL_DECODED;
}
int
sys_fork(struct tcb *tcp)
SYS_FUNC(fork)
{
if (exiting(tcp))
return RVAL_UDECIMAL;
return 0;
return RVAL_DECODED | RVAL_UDECIMAL;
}

View File

@ -1,4 +1,34 @@
dnl Process this file with autoconf to create configure. Use autoreconf.
# Configure template for strace.
#
# Copyright (c) 1999-2001 Wichert Akkerman <wichert@deephackmode.org>
# Copyright (c) 2002-2009 Roland McGrath <roland@redhat.com>
# Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@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.
AC_PREREQ(2.57)
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
@ -6,15 +36,18 @@ AC_INIT([strace],
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip silent-rules parallel-tests])
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz no-dist-gzip silent-rules parallel-tests])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_RANLIB
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
case "$host_cpu" in
bfin)
arch=bfin
@ -34,6 +67,7 @@ m68k)
;;
sparc64*)
arch=sparc64
arch_m32=sparc
AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
;;
sparc*)
@ -59,6 +93,7 @@ powerpc*)
# error 32 bit
#endif], [], arch=powerpc64, arch=powerpc)
if test "$arch" = "powerpc64"; then
arch_m32=powerpc
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
;;
@ -68,6 +103,7 @@ arm*)
;;
aarch64*)
arch=aarch64
arch_m32=arm
AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
;;
avr32*)
@ -99,11 +135,13 @@ sh*)
AC_DEFINE([SH], 1, [Define for the SH architecture.])
;;
x86?64*)
arch_m32=i386
AC_TRY_COMPILE(
[#ifndef __ILP32__
# error not x32
#endif], [], arch=x32, arch=x86_64)
if test "$arch" = "x86_64"; then
arch_mx32=x32
AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
else
AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
@ -125,6 +163,11 @@ microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
nios2*)
arch=nios2
AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
;;
or1k*)
arch=or1k
AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
@ -142,24 +185,36 @@ xtensa*)
esac
AC_MSG_RESULT($arch)
test -n "$arch_m32" ||
arch_m32=$arch
test -n "$arch_mx32" ||
arch_mx32=$arch
AC_SUBST(arch)
AC_SUBST(arch_m32)
AC_SUBST(arch_mx32)
if test "$arch" = mips; then
AC_CACHE_CHECK([for MIPS ABI], [ac_cv_mips_abi],
AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
[#include <sgidefs.h>],
[AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
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_cv_mips_abi=o32],
[st_cv_mips_abi=o32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
[ac_cv_mips_abi=n32],
[st_cv_mips_abi=n32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
[ac_cv_mips_abi=n64],
[ac_cv_mips_abi=unknown])])])])
case "$ac_cv_mips_abi" in
[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.]);;
@ -201,11 +256,14 @@ AC_HEADER_STDBOOL
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_atim.tv_nsec,
struct stat.st_blksize,
struct stat.st_blocks,
struct stat.st_ctim.tv_nsec,
struct stat.st_flags,
struct stat.st_fstype,
struct stat.st_gen,
struct stat.st_mtim.tv_nsec,
struct stat.st_rdev
]))
@ -219,25 +277,30 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
AC_LITTLE_ENDIAN_LONG_LONG
AC_CHECK_FUNCS(m4_normalize([
fanotify_mark
fopen64
fork
fputs_unlocked
fstatat
ftruncate
futimens
if_indextoname
inet_ntop
inet_pton
pipe2
prctl
preadv
process_vm_readv
pwritev
sendmsg
sendmmsg
sigaction
signalfd
stpcpy
strerror
strsignal
utimensat
]))
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
@ -250,26 +313,35 @@ AC_CHECK_HEADERS(m4_normalize([
linux/falloc.h
linux/filter.h
linux/hiddev.h
linux/ip_vs.h
linux/ipc.h
linux/mmtimer.h
linux/msg.h
linux/perf_event.h
linux/seccomp.h
linux/securebits.h
linux/sem.h
linux/shm.h
linux/utsname.h
mqueue.h
netinet/sctp.h
poll.h
scsi/sg.h
stropts.h
sys/conf.h
sys/epoll.h
sys/eventfd.h
sys/fanotify.h
sys/filio.h
sys/ioctl.h
sys/poll.h
sys/ipc.h
sys/msg.h
sys/reg.h
sys/sem.h
sys/shm.h
sys/signalfd.h
sys/vfs.h
sys/xattr.h
]))
AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
[], [], [#include <stddef.h>
#include <sys/socket.h>
@ -277,10 +349,24 @@ AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
AC_CHECK_HEADERS(m4_normalize([
linux/netfilter_arp/arp_tables.h
linux/netfilter_bridge/ebtables.h
linux/netfilter_ipv4/ip_tables.h
linux/netfilter_ipv6/ip6_tables.h
]), [], [], [#include <netinet/in.h>
#include <net/if.h>])
AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_atime_nsec,
struct stat.st_ctime_nsec,
struct stat.st_mtime_nsec
]),,, [#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES([struct stat64],,, [#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
@ -297,21 +383,34 @@ AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
siginfo_t.si_timerid,
siginfo_t.si_overrun],,, [#include <signal.h>])
AC_CHECK_MEMBERS([struct sysinfo.totalhigh,
struct sysinfo.freehigh,
struct sysinfo.mem_unit],,, [#include <sys/sysinfo.h>])
AC_CHECK_TYPES([struct flock,
struct flock64,
struct __kernel_flock,
struct __kernel_flock64],,, [#include <sys/types.h>
#include <linux/fcntl.h>])
AC_CHECK_TYPES([struct flock64],,, [#include <fcntl.h>])
AC_CHECK_TYPES([__kernel_long_t, __kernel_ulong_t],,, [#include <asm/posix_types.h>])
AC_CHECK_HEADERS([libaio.h], [
AC_CHECK_MEMBERS([struct iocb.u.c.flags],,, [#include <libaio.h>])
AC_CHECK_DECLS([IO_CMD_PWRITE, IO_CMD_PWRITEV],,, [#include <libaio.h>])
])
AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
AC_CHECK_HEADERS([linux/input.h], [
AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
])
AC_CHECK_HEADERS([linux/bpf.h], [
AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
[st_cv_have_union_bpf_attr_log_buf],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .log_buf = 0 };]])],
[st_cv_have_union_bpf_attr_log_buf=yes],
[st_cv_have_union_bpf_attr_log_buf=no])])
if test $st_cv_have_union_bpf_attr_log_buf = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
[Define to 1 if union bpf_attr.log_buf initialization works])
fi
])
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS(m4_normalize([
PTRACE_PEEKUSER,
@ -710,6 +809,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([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
@ -845,33 +945,8 @@ if test "$arch" = mips && test "$no_create" != yes; then
fi
fi
have_m32=no
case "$arch" in
aarch64|powerpc64|sparc64|tile|x32|x86_64)
AC_MSG_CHECKING([for -m32 runtime support])
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -m32"
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
[have_m32=yes],[have_m32=no],[have_m32=no])
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($have_m32)
;;
esac
AM_CONDITIONAL([HAVE_M32_RUNTIME], [test "$have_m32" = yes])
have_mx32=no
case "$arch" in
x86_64)
AC_MSG_CHECKING([for -mx32 runtime support])
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mx32"
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
[have_mx32=yes],[have_mx32=no],[have_mx32=no])
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($have_mx32)
;;
esac
AM_CONDITIONAL([HAVE_MX32_RUNTIME], [test "$have_mx32" = yes])
st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
AC_OUTPUT

13
count.c
View File

@ -58,11 +58,8 @@ count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
if (!SCNO_IN_RANGE(scno))
return;
if (!counts) {
counts = calloc(nsyscalls, sizeof(*counts));
if (!counts)
die_out_of_memory();
}
if (!counts)
counts = xcalloc(nsyscalls, sizeof(*counts));
cc = &counts[scno];
cc->calls++;
@ -143,7 +140,7 @@ set_sortby(const char *sortby)
else if (strcmp(sortby, "nothing") == 0)
sortfun = NULL;
else {
error_msg_and_die("invalid sortby: '%s'", sortby);
error_msg_and_help("invalid sortby: '%s'", sortby);
}
}
@ -171,9 +168,7 @@ call_summary_pers(FILE *outf)
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
sorted_count = calloc(sizeof(int), nsyscalls);
if (!sorted_count)
die_out_of_memory();
sorted_count = xcalloc(sizeof(int), nsyscalls);
call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0;
if (overhead.tv_sec == -1) {
tv_mul(&overhead, &shortest, 8);

36
debian/changelog vendored
View File

@ -1,5 +1,35 @@
strace (4.10-1) experimental; urgency=low
strace (4.11-1) unstable; urgency=low
[ Dmitry V. Levin ]
* New upstream version.
+ fixed decoding of path argument of umount2 syscall, closes: #785050
-- Dmitry V. Levin <ldv@altlinux.org> Mon, 21 Dec 2015 20:21:22 +0000
strace (4.10-3) unstable; urgency=medium
* Really fix mips* builds - fix sys_syscall() handling.
Closes: #781753
* Clean up strace64.substvars at clean time
* Remove ancient changelog entries that annoy lintian
* Update Standards-Version to 3.9.6 (no changes needed)
-- Steve McIntyre <93sam@debian.org> Wed, 08 Jul 2015 23:44:03 +0100
strace (4.10-2) unstable; urgency=medium
* Fix building on arm64 using patches from upstream. Closes: #790770
* Fix various test suite failures using patches from upstream.
Closes: #781040
* Fix mips o32 build. Thanks to Arturo Borrero Gonzalez
<arturo.borrero.glez@gmail.com> for tracking this.
* Add build-dependency on gawk for the test suite. Closes: #780992
-- Steve McIntyre <93sam@debian.org> Thu, 02 Jul 2015 02:03:25 +0100
strace (4.10-1) unstable; urgency=low
[ Dmitry V. Levin ]
* New upstream version.
+ enhanced ioctl decoding, closes: #692913
+ enabled mips64el build, closes: #773375
@ -7,7 +37,7 @@ strace (4.10-1) experimental; urgency=low
+ updated generic and added arch-specific PTRACE_* constants,
closes: #734554
-- Dmitry V. Levin <ldv@altlinux.org> Fri, 06 Mar 2015 13:14:15 +0000
-- Steve McIntyre <93sam@debian.org> Sat, 21 Mar 2015 22:18:25 +0000
strace (4.9-2) unstable; urgency=medium
@ -767,7 +797,7 @@ strace (3.1-11) unstable; urgency=low
* Ported to libc6 / glibc2 (Bug# 11729)
* Compress manpage
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Fri, 1 Aug 1997 00:13:38 +02
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Fri, 1 Aug 1997 00:13:38 +0200
strace (3.1-10) unstable; urgency=low

4
debian/control vendored
View File

@ -2,8 +2,8 @@ Source: strace
Maintainer: Steve McIntyre <93sam@debian.org>
Section: utils
Priority: optional
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [i386 powerpc s390 sparc], debhelper (>= 7.0.0)
Standards-Version: 3.9.5
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [i386 powerpc s390 sparc], debhelper (>= 7.0.0), gawk
Standards-Version: 3.9.6
Homepage: http://sourceforge.net/projects/strace/
Package: strace

2
debian/rules vendored
View File

@ -62,7 +62,7 @@ build64/Makefile:
clean:
dh_testdir
dh_testroot
rm -rf build build64 strace64.1
rm -rf build build64 strace64.1 debian/strace64.substvars
dh_clean
binary: binary-indep binary-arch

281
defs.h
View File

@ -50,11 +50,12 @@
/* #include <ctype.h> */
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/syscall.h>
#include "mpers_type.h"
#ifndef HAVE_STRERROR
const char *strerror(int);
#endif
@ -67,8 +68,46 @@ const char *strerror(int);
extern char *stpcpy(char *dst, const char *src);
#endif
#if !defined __GNUC__
# define __attribute__(x) /*nothing*/
#if defined __GNUC__ && defined __GNUC_MINOR__
# define GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
# define __attribute__(x) /* empty */
# define GNUC_PREREQ(maj, min) 0
#endif
#if GNUC_PREREQ(2, 5)
# define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
#else
# define ATTRIBUTE_NORETURN /* empty */
#endif
#if GNUC_PREREQ(2, 7)
# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args))
# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg)))
# define ATTRIBUTE_PACKED __attribute__((__packed__))
#else
# define ATTRIBUTE_FORMAT(args) /* empty */
# define ATTRIBUTE_ALIGNED(arg) /* empty */
# define ATTRIBUTE_PACKED /* empty */
#endif
#if GNUC_PREREQ(3, 0)
# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
#else
# define ATTRIBUTE_MALLOC /* empty */
#endif
#if GNUC_PREREQ(3, 1)
# define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
#else
# define ATTRIBUTE_NOINLINE /* empty */
#endif
#if GNUC_PREREQ(4, 3)
# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
#else
# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
#endif
#ifndef offsetof
@ -152,26 +191,43 @@ extern char *stpcpy(char *dst, const char *src);
#if defined(SPARC) || defined(SPARC64)
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
# if defined(SPARC64)
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY2_WORDSIZE 8
# else
# define SUPPORTED_PERSONALITIES 2
# endif /* SPARC64 */
#endif /* SPARC[64] */
# define PERSONALITY1_WORDSIZE 8
# ifdef HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# endif
# endif
#endif
#ifdef X86_64
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
# define PERSONALITY2_WORDSIZE 4
# ifdef HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# endif
# ifdef HAVE_MX32_MPERS
# define PERSONALITY2_INCLUDE_FUNCS "mx32_funcs.h"
# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h"
# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h"
# endif
#endif
#ifdef X32
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
# ifdef HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# endif
#endif
#ifdef ARM
@ -181,15 +237,24 @@ extern char *stpcpy(char *dst, const char *src);
#ifdef AARCH64
/* The existing ARM personality, then AArch64 */
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 8
# define DEFAULT_PERSONALITY 1
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
# ifdef HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# endif
#endif
#ifdef POWERPC64
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
# ifdef HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# endif
#endif
#ifdef TILE
@ -199,6 +264,11 @@ extern char *stpcpy(char *dst, const char *src);
# ifdef __tilepro__
# define DEFAULT_PERSONALITY 1
# endif
# ifdef HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
# endif
#endif
#ifndef SUPPORTED_PERSONALITIES
@ -211,9 +281,38 @@ extern char *stpcpy(char *dst, const char *src);
# define PERSONALITY0_WORDSIZE SIZEOF_LONG
#endif
#ifndef PERSONALITY0_INCLUDE_PRINTERS_DECLS
# define PERSONALITY0_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
#endif
#ifndef PERSONALITY0_INCLUDE_PRINTERS_DEFS
# define PERSONALITY0_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
#endif
#ifndef PERSONALITY1_INCLUDE_PRINTERS_DECLS
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
#endif
#ifndef PERSONALITY1_INCLUDE_PRINTERS_DEFS
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
#endif
#ifndef PERSONALITY2_INCLUDE_PRINTERS_DECLS
# define PERSONALITY2_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
#endif
#ifndef PERSONALITY2_INCLUDE_PRINTERS_DEFS
# define PERSONALITY2_INCLUDE_PRINTERS_DEFS "native_printer_defs.h"
#endif
#ifndef PERSONALITY1_INCLUDE_FUNCS
# define PERSONALITY1_INCLUDE_FUNCS "empty.h"
#endif
#ifndef PERSONALITY2_INCLUDE_FUNCS
# 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;
@ -239,15 +338,15 @@ struct tcb {
#if SUPPORTED_PERSONALITIES > 1
unsigned int currpers; /* Personality at the time of scno update */
#endif
int sys_func_rval; /* Syscall entry parser's return value */
int curcol; /* Output column for this process */
FILE *outf; /* Output file for this process */
const char *auxstr; /* Auxiliary info from syscall (see RVAL_STR) */
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 timeval stime; /* System time usage as of last process wait */
struct timeval dtime; /* Delta for system time usage */
struct timeval etime; /* Syscall entry time */
/* Support for tracing forked processes: */
long inst[2]; /* Saved clone args (badly named) */
#ifdef USE_LIBUNWIND
struct UPT_info* libunwind_ui;
@ -311,8 +410,10 @@ struct xlat {
extern const struct xlat addrfams[];
extern const struct xlat at_flags[];
extern const struct xlat dirent_types[];
extern const struct xlat open_access_modes[];
extern const struct xlat open_mode_flags[];
extern const struct xlat resource_flags[];
extern const struct xlat whence_codes[];
/* Format of syscall return values */
@ -334,6 +435,8 @@ extern const struct xlat whence_codes[];
#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. */
@ -346,6 +449,12 @@ extern const struct xlat whence_codes[];
#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
#define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL)
#if defined(ARM) || defined(AARCH64) \
|| defined(I386) || defined(X32) || defined(X86_64) \
|| defined(IA64) \
@ -390,13 +499,22 @@ extern unsigned os_release;
#undef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };
void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void error_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void error_msg_and_help(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void perror_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void die_out_of_memory(void) ATTRIBUTE_NORETURN;
void error_msg(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
void perror_msg(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
void error_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
void perror_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
void die_out_of_memory(void) __attribute__ ((noreturn));
void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
void *xcalloc(size_t nmemb, size_t size)
ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1, 2));
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
/*
@ -418,14 +536,30 @@ 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 umoven(struct tcb *, long, unsigned int, char *);
extern bool is_erestart(struct tcb *);
extern void temporarily_clear_syserror(struct tcb *);
extern void restore_cleared_syserror(struct tcb *);
extern int umoven(struct tcb *, long, unsigned int, void *);
#define umove(pid, addr, objp) \
umoven((pid), (addr), sizeof(*(objp)), (char *) (objp))
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int umoven_or_printaddr(struct tcb *, long, unsigned int, void *);
#define umove_or_printaddr(pid, addr, objp) \
umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int umove_ulong_or_printaddr(struct tcb *, long, unsigned long *);
extern int umove_ulong_array_or_printaddr(struct tcb *, long, unsigned long *, size_t);
extern int umovestr(struct tcb *, long, unsigned int, char *);
extern int upeek(int pid, long, long *);
#if defined(SPARC) || defined(SPARC64) || defined(IA64) || defined(SH)
#if defined ALPHA || defined IA64 || defined MIPS \
|| defined SH || defined SPARC || defined SPARC64
# define HAVE_GETRVAL2
extern long getrval2(struct tcb *);
#else
# undef HAVE_GETRVAL2
#endif
extern const char *signame(const int);
@ -436,6 +570,7 @@ extern int getfdpath(struct tcb *, int, char *, unsigned);
extern const char *xlookup(const struct xlat *, const unsigned int);
extern const char *xlat_search(const struct xlat *, const size_t, const unsigned int);
extern unsigned long get_pagesize(void);
extern int string_to_uint(const char *str);
extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits);
@ -447,18 +582,20 @@ extern int print_quoted_string(const char *, unsigned int, unsigned int);
/* a refers to the lower numbered u_arg,
* b refers to the higher numbered u_arg
*/
#if HAVE_LITTLE_ENDIAN_LONG_LONG
# define LONG_LONG(a,b) \
((long long)((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32)))
#else
#ifdef WORDS_BIGENDIAN
# define LONG_LONG(a,b) \
((long long)((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)))
#endif
extern int getllval(struct tcb *, unsigned long long *, int);
extern int printllval(struct tcb *, const char *, int)
__attribute__ ((format (printf, 2, 0)));
ATTRIBUTE_FORMAT((printf, 2, 0));
extern void printxval(const struct xlat *, const unsigned int, const char *);
extern void printaddr(long);
extern void printxvals(const unsigned int, const char *, const struct xlat *, ...);
#define printxval(xlat, val, dflt) printxvals(val, dflt, xlat, NULL)
extern int printargs(struct tcb *);
extern int printargs_lu(struct tcb *);
extern int printargs_ld(struct tcb *);
@ -472,32 +609,58 @@ extern void dumpiov_in_mmsghdr(struct tcb *, long);
extern void dumpiov(struct tcb *, int, long);
extern void dumpstr(struct tcb *, long, int);
extern void printstr(struct tcb *, long, long);
extern void printnum_int(struct tcb *, long, const char *)
__attribute__ ((format (printf, 3, 0)));
extern void printnum_long(struct tcb *, long, const char *)
__attribute__ ((format (printf, 3, 0)));
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));
#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 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(long)*3 * 2 + sizeof("{%u, %u}"))
#define TIMEVAL_TEXT_BUFSIZE TIMESPEC_TEXT_BUFSIZE
extern void printtv_bitness(struct tcb *, long, enum bitness_t, int);
#define printtv(tcp, addr) \
printtv_bitness((tcp), (addr), BITNESS_CURRENT, 0)
#define printtv_special(tcp, addr) \
printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1)
extern char *sprinttv(char *, struct tcb *, long, enum bitness_t, int special);
extern void print_timespec(struct tcb *, long);
extern void sprint_timespec(char *, struct tcb *, long);
extern void printsiginfo(const siginfo_t *, int);
extern void printsiginfo_at(struct tcb *tcp, long addr);
#define TIMESPEC_TEXT_BUFSIZE \
(sizeof(intmax_t)*3 * 2 + sizeof("{tv_sec=%jd, tv_nsec=%jd}"))
extern void printfd(struct tcb *, int);
extern bool print_sockaddr_by_inode(const unsigned long, const char *);
extern void print_dirfd(struct tcb *, int);
extern void printsock(struct tcb *, long, int);
extern void print_sock_optmgmt(struct tcb *, long, int);
extern void printrusage(struct tcb *, long);
#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 void printuid(const char *, const unsigned int);
extern void print_sigset_addr_len(struct tcb *, long, long);
@ -509,14 +672,8 @@ extern void tprint_iov(struct tcb *, unsigned long, unsigned long, int decode_io
extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned long, int decode_iov, unsigned long);
extern void tprint_open_modes(int);
extern const char *sprint_open_modes(int);
extern void print_loff_t(struct tcb *, long);
extern void print_seccomp_filter(struct tcb *tcp, unsigned long);
extern const struct_ioctlent *ioctl_lookup(const unsigned int);
extern const struct_ioctlent *ioctl_next_match(const struct_ioctlent *);
extern void ioctl_print_code(const unsigned int);
extern int ioctl_decode(struct tcb *, const unsigned int, long);
extern int ioctl_decode_command_number(const unsigned int);
extern int block_ioctl(struct tcb *, const unsigned int, long);
extern int evdev_ioctl(struct tcb *, const unsigned int, long);
extern int loop_ioctl(struct tcb *, const unsigned int, long);
@ -567,7 +724,7 @@ extern struct tcb *printing_tcp;
extern void printleader(struct tcb *);
extern void line_ended(void);
extern void tabto(void);
extern void tprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
extern void tprintf(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
extern void tprints(const char *str);
#if SUPPORTED_PERSONALITIES > 1
@ -604,6 +761,7 @@ 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;
extern const char *const *errnoent;
@ -615,12 +773,19 @@ extern const struct_ioctlent *ioctlent;
# define signalent signalent0
# define ioctlent ioctlent0
#endif
extern unsigned nsyscalls;
extern unsigned nerrnos;
extern unsigned nsignals;
extern unsigned nioctlents;
extern unsigned num_quals;
#if SUPPORTED_PERSONALITIES > 1
# include "printers.h"
#else
# include "native_printer_decls.h"
#endif
/*
* If you need non-NULL sysent[scno].sys_func and sysent[scno].sys_name
*/
@ -630,3 +795,13 @@ extern unsigned num_quals;
/* Only ensures that sysent[scno] isn't out of range */
#define SCNO_IN_RANGE(scno) \
((unsigned long)(scno) < nsyscalls)
#define MPERS_FUNC_NAME__(prefix, name) prefix ## name
#define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name)
#define MPERS_FUNC_NAME(name) MPERS_FUNC_NAME_(MPERS_PREFIX, name)
#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(syscall_name)
#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp)
#define MPERS_PRINTER_DECL(type, name) type MPERS_FUNC_NAME(name)

560
desc.c
View File

@ -29,288 +29,56 @@
*/
#include "defs.h"
#include <fcntl.h>
#include <sys/file.h>
#ifdef HAVE_SYS_EPOLL_H
# include <sys/epoll.h>
#endif
#ifdef HAVE_LINUX_PERF_EVENT_H
# include <linux/perf_event.h>
#endif
#include "xlat/fcntlcmds.h"
#include "xlat/fdflags.h"
#include "xlat/flockcmds.h"
#include "xlat/lockfcmds.h"
#include "xlat/notifyflags.h"
#include "xlat/perf_event_open_flags.h"
/*
* Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined
* or not defined altogether.
*/
#if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK
# define USE_PRINTFLOCK64 1
#else
# define USE_PRINTFLOCK64 0
#endif
#if USE_PRINTFLOCK64
# ifndef HAVE_STRUCT_FLOCK64
struct flock64 {
short int l_type, l_whence;
int64_t l_start, l_len;
int l_pid;
};
# endif
static void
printflock64(struct tcb *tcp, long addr, int getlk)
SYS_FUNC(close)
{
struct flock64 fl;
printfd(tcp, tcp->u_arg[0]);
if (umove(tcp, addr, &fl) < 0) {
tprints("{...}");
return;
}
tprints("{type=");
printxval(lockfcmds, fl.l_type, "F_???");
tprints(", whence=");
printxval(whence_codes, fl.l_whence, "SEEK_???");
tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len);
if (getlk)
tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
else
tprints("}");
}
#endif /* USE_PRINTFLOCK64 */
static void
printflock(struct tcb *tcp, long addr, int getlk)
{
struct flock fl;
int r;
#if SUPPORTED_PERSONALITIES > 1
if (
# if SIZEOF_OFF_T > SIZEOF_LONG
current_personality > 0 &&
#endif
current_wordsize != sizeof(fl.l_start)) {
if (current_wordsize == 4) {
/* 32-bit x86 app on x86_64 and similar cases */
struct {
short int l_type;
short int l_whence;
int32_t l_start; /* off_t */
int32_t l_len; /* off_t */
int32_t l_pid; /* pid_t */
} fl32;
r = umove(tcp, addr, &fl32);
if (r >= 0) {
fl.l_type = fl32.l_type;
fl.l_whence = fl32.l_whence;
fl.l_start = fl32.l_start;
fl.l_len = fl32.l_len;
fl.l_pid = fl32.l_pid;
}
} else {
/* let people know we have a problem here */
tprintf("<decode error: unsupported wordsize %d>",
current_wordsize);
return;
}
} else
#endif
{
r = umove(tcp, addr, &fl);
}
if (r < 0) {
tprints("{...}");
return;
}
tprints("{type=");
printxval(lockfcmds, fl.l_type, "F_???");
tprints(", whence=");
printxval(whence_codes, fl.l_whence, "SEEK_???");
#if SIZEOF_OFF_T > SIZEOF_LONG
tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len);
#else
tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
#endif
if (getlk)
tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
else
tprints("}");
return RVAL_DECODED;
}
int
sys_fcntl(struct tcb *tcp)
SYS_FUNC(dup)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printxval(fcntlcmds, tcp->u_arg[1], "F_???");
switch (tcp->u_arg[1]) {
case F_SETFD:
tprints(", ");
printflags(fdflags, tcp->u_arg[2], "FD_???");
break;
case F_SETOWN: case F_DUPFD:
#ifdef F_DUPFD_CLOEXEC
case F_DUPFD_CLOEXEC:
#endif
tprintf(", %ld", tcp->u_arg[2]);
break;
case F_SETFL:
tprints(", ");
tprint_open_modes(tcp->u_arg[2]);
break;
case F_SETLK: case F_SETLKW:
tprints(", ");
printflock(tcp, tcp->u_arg[2], 0);
break;
#if USE_PRINTFLOCK64
case F_SETLK64: case F_SETLKW64:
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 0);
break;
#endif /* USE_PRINTFLOCK64 */
#ifdef F_NOTIFY
case F_NOTIFY:
tprints(", ");
printflags(notifyflags, tcp->u_arg[2], "DN_???");
break;
#endif
#ifdef F_SETLEASE
case F_SETLEASE:
tprints(", ");
printxval(lockfcmds, tcp->u_arg[2], "F_???");
break;
#endif
}
}
else {
switch (tcp->u_arg[1]) {
case F_DUPFD:
#ifdef F_DUPFD_CLOEXEC
case F_DUPFD_CLOEXEC:
#endif
case F_SETFD: case F_SETFL:
case F_SETLK: case F_SETLKW:
case F_SETOWN: case F_GETOWN:
#ifdef F_NOTIFY
case F_NOTIFY:
#endif
#ifdef F_SETLEASE
case F_SETLEASE:
#endif
break;
case F_GETFD:
if (syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = sprintflags("flags ", fdflags, tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETFL:
if (syserror(tcp))
return 0;
tcp->auxstr = sprint_open_modes(tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETLK:
tprints(", ");
printflock(tcp, tcp->u_arg[2], 1);
break;
#if USE_PRINTFLOCK64
case F_GETLK64:
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 1);
break;
#endif
#ifdef F_GETLEASE
case F_GETLEASE:
if (syserror(tcp))
return 0;
tcp->auxstr = xlookup(lockfcmds, tcp->u_rval);
return RVAL_HEX|RVAL_STR;
#endif
default:
tprintf(", %#lx", tcp->u_arg[2]);
break;
}
}
return 0;
}
printfd(tcp, tcp->u_arg[0]);
#ifdef LOCK_SH
int
sys_flock(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(flockcmds, tcp->u_arg[1], "LOCK_???");
}
return 0;
}
#endif /* LOCK_SH */
int
sys_close(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
}
return 0;
}
int
sys_dup(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
}
return RVAL_FD;
return RVAL_DECODED | RVAL_FD;
}
static int
do_dup2(struct tcb *tcp, int flags_arg)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printfd(tcp, tcp->u_arg[1]);
if (flags_arg >= 0) {
tprints(", ");
printfd(tcp, tcp->u_arg[1]);
if (flags_arg >= 0) {
tprints(", ");
printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
}
printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
}
return RVAL_FD;
return RVAL_DECODED | RVAL_FD;
}
int
sys_dup2(struct tcb *tcp)
SYS_FUNC(dup2)
{
return do_dup2(tcp, -1);
}
int
sys_dup3(struct tcb *tcp)
SYS_FUNC(dup3)
{
return do_dup2(tcp, 2);
}
#if defined(ALPHA)
int
sys_getdtablesize(struct tcb *tcp)
SYS_FUNC(getdtablesize)
{
return 0;
}
#endif
static int
decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
decode_select(struct tcb *tcp, long *args,
void (*print_tv_ts) (struct tcb *, const long),
const char * (*sprint_tv_ts) (struct tcb *, const long))
{
int i, j;
int nfds, fdsize;
@ -338,26 +106,18 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
if (entering(tcp)) {
tprintf("%d", (int) args[0]);
if (verbose(tcp) && fdsize > 0) {
if (verbose(tcp) && fdsize > 0)
fds = malloc(fdsize);
if (!fds)
die_out_of_memory();
}
for (i = 0; i < 3; i++) {
arg = args[i+1];
if (arg == 0) {
tprints(", NULL");
continue;
}
tprints(", ");
if (!fds) {
tprintf(", %#lx", arg);
printaddr(arg);
continue;
}
if (umoven(tcp, arg, fdsize, (char *) fds) < 0) {
tprints(", [?]");
if (umoven_or_printaddr(tcp, arg, fdsize, fds))
continue;
}
tprints(", [");
tprints("[");
for (j = 0, sep = "";; j++) {
j = next_set_bit(fds, j, nfds);
if (j < 0)
@ -370,9 +130,8 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
}
free(fds);
tprints(", ");
printtv_bitness(tcp, args[4], bitness, 0);
}
else {
print_tv_ts(tcp, args[4]);
} else {
static char outstr[1024];
char *outptr;
#define end_outstr (outstr + sizeof(outstr))
@ -388,8 +147,6 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
}
fds = malloc(fdsize);
if (!fds)
die_out_of_memory();
outptr = outstr;
sep = "";
@ -397,7 +154,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
int first = 1;
arg = args[i+1];
if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
if (!arg || !fds || umoven(tcp, arg, fdsize, fds) < 0)
continue;
for (j = 0;; j++) {
j = next_set_bit(fds, j, nfds);
@ -427,9 +184,9 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
free(fds);
/* This contains no useful information on SunOS. */
if (args[4]) {
if (outptr < end_outstr - (10 + TIMEVAL_TEXT_BUFSIZE)) {
outptr += sprintf(outptr, "%sleft ", sep);
outptr = sprinttv(outptr, tcp, args[4], bitness, /*special:*/ 0);
const char *str = sprint_tv_ts(tcp, args[4]);
if (outptr + sizeof("left ") + strlen(sep) + strlen(str) < end_outstr) {
outptr += sprintf(outptr, "%sleft %s", sep, str);
}
}
*outptr = '\0';
@ -440,225 +197,82 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
return 0;
}
int
sys_oldselect(struct tcb *tcp)
SYS_FUNC(oldselect)
{
long args[5];
long long_args[5];
#undef oldselect_args
#if SIZEOF_LONG == 4
# define oldselect_args long_args
#else
unsigned int oldselect_args[5];
unsigned int i;
#endif
if (umoven(tcp, tcp->u_arg[0], sizeof args, (char *) args) < 0) {
tprints("[...]");
if (umove(tcp, tcp->u_arg[0], &oldselect_args) < 0) {
printaddr(tcp->u_arg[0]);
return 0;
}
return decode_select(tcp, args, BITNESS_CURRENT);
#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
}
#ifdef ALPHA
int
sys_osf_select(struct tcb *tcp)
SYS_FUNC(osf_select)
{
long *args = tcp->u_arg;
return decode_select(tcp, args, BITNESS_32);
return decode_select(tcp, tcp->u_arg, print_timeval32, sprint_timeval32);
}
#endif
#include "xlat/epollctls.h"
#include "xlat/epollevents.h"
#include "xlat/epollflags.h"
/* Not aliased to printargs_ld: we want it to have a distinct address */
int
sys_epoll_create(struct tcb *tcp)
SYS_FUNC(select)
{
return printargs_ld(tcp);
return decode_select(tcp, tcp->u_arg, print_timeval, sprint_timeval);
}
int
sys_epoll_create1(struct tcb *tcp)
{
if (entering(tcp))
printflags(epollflags, tcp->u_arg[0], "EPOLL_???");
return 0;
}
#ifdef HAVE_SYS_EPOLL_H
static void
print_epoll_event(struct epoll_event *ev)
{
tprints("{");
printflags(epollevents, ev->events, "EPOLL???");
/* We cannot know what format the program uses, so print u32 and u64
which will cover every value. */
tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
ev->data.u32, ev->data.u64);
}
#endif
int
sys_epoll_ctl(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
tprints(", ");
printfd(tcp, tcp->u_arg[2]);
tprints(", ");
if (tcp->u_arg[3] == 0)
tprints("NULL");
else {
#ifdef HAVE_SYS_EPOLL_H
struct epoll_event ev;
if (
#ifdef EPOLL_CTL_DEL
(tcp->u_arg[1] != EPOLL_CTL_DEL) &&
#endif
umove(tcp, tcp->u_arg[3], &ev) == 0)
print_epoll_event(&ev);
else
#endif
tprintf("%lx", tcp->u_arg[3]);
}
}
return 0;
}
static void
epoll_wait_common(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp))
tprintf("%lx", tcp->u_arg[1]);
else if (tcp->u_rval == 0)
tprints("{}");
else {
#ifdef HAVE_SYS_EPOLL_H
struct epoll_event ev, *start, *cur, *end;
int failed = 0;
tprints("{");
start = (struct epoll_event *) tcp->u_arg[1];
end = start + tcp->u_rval;
for (cur = start; cur < end; ++cur) {
if (cur > start)
tprints(", ");
if (umove(tcp, (long) cur, &ev) == 0)
print_epoll_event(&ev);
else {
tprints("?");
failed = 1;
break;
}
}
tprints("}");
if (failed)
tprintf(" %#lx", (long) start);
#else
tprints("{...}");
#endif
}
tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
}
}
int
sys_epoll_wait(struct tcb *tcp)
{
epoll_wait_common(tcp);
return 0;
}
int
sys_epoll_pwait(struct tcb *tcp)
{
epoll_wait_common(tcp);
if (exiting(tcp)) {
tprints(", ");
/* NB: kernel requires arg[5] == NSIG / 8 */
print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
tprintf(", %lu", tcp->u_arg[5]);
}
return 0;
}
int
sys_select(struct tcb *tcp)
{
return decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
}
int
sys_pselect6(struct tcb *tcp)
{
int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
if (entering(tcp)) {
long r;
struct {
unsigned long ptr;
unsigned long len;
} data;
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
if (current_wordsize == 4) {
struct {
uint32_t ptr;
uint32_t len;
} data32;
r = umove(tcp, tcp->u_arg[5], &data32);
data.ptr = data32.ptr;
data.len = data32.len;
} else
#endif
r = umove(tcp, tcp->u_arg[5], &data);
if (r < 0)
tprintf(", %#lx", tcp->u_arg[5]);
else {
tprints(", {");
/* NB: kernel requires data.len == NSIG / 8 */
print_sigset_addr_len(tcp, data.ptr, data.len);
tprintf(", %lu}", data.len);
}
}
return rc;
}
#include "kernel_types.h"
static int
do_eventfd(struct tcb *tcp, int flags_arg)
umove_kulong_array_or_printaddr(struct tcb *tcp, const long addr,
kernel_ulong_t *ptr, size_t n)
{
#if defined X86_64 || defined X32
if (current_personality == 1) {
#else
if (current_wordsize < sizeof(*ptr)) {
#endif
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];
}
return r;
}
return umoven_or_printaddr(tcp, addr, n * sizeof(*ptr), ptr);
}
SYS_FUNC(pselect6)
{
int rc = decode_select(tcp, tcp->u_arg, print_timespec, sprint_timespec);
if (entering(tcp)) {
tprintf("%lu", tcp->u_arg[0]);
if (flags_arg >= 0) {
tprints(", ");
printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
kernel_ulong_t data[2];
tprints(", ");
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]);
}
}
return 0;
}
int
sys_eventfd(struct tcb *tcp)
{
return do_eventfd(tcp, -1);
}
int
sys_eventfd2(struct tcb *tcp)
{
return do_eventfd(tcp, 1);
}
int
sys_perf_event_open(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%#lx, %d, %d, %d, ",
tcp->u_arg[0],
(int) tcp->u_arg[1],
(int) tcp->u_arg[2],
(int) tcp->u_arg[3]);
printflags(perf_event_open_flags, tcp->u_arg[4],
"PERF_FLAG_???");
}
return 0;
return rc;
}

203
dirent.c
View File

@ -1,52 +1,69 @@
/*
* 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) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2005-2015 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.
*/
#include "defs.h"
#include <dirent.h>
#include DEF_MPERS_TYPE(kernel_dirent)
#include "kernel_types.h"
#include MPERS_DEFS
#define D_NAME_LEN_MAX 256
struct kernel_dirent {
unsigned long d_ino;
unsigned long d_off;
unsigned short d_reclen;
char d_name[1];
};
static void
print_old_dirent(struct tcb *tcp, long addr)
{
#ifdef SH64
typedef struct kernel_dirent old_dirent_t;
#else
typedef struct {
uint32_t d_ino;
uint32_t d_off;
unsigned short d_reclen;
char d_name[1];
} old_dirent_t;
#endif
old_dirent_t d;
kernel_dirent d;
if (!verbose(tcp) || umove(tcp, addr, &d) < 0) {
tprintf("%#lx", addr);
if (umove_or_printaddr(tcp, addr, &d))
return;
}
tprintf("{d_ino=%lu, d_off=%lu, d_reclen=%u, d_name=",
(unsigned long) d.d_ino, (unsigned long) d.d_off, d.d_reclen);
tprintf("{d_ino=%llu, d_off=%llu, d_reclen=%u, d_name=",
(unsigned long long) d.d_ino,
(unsigned long long) d.d_off, d.d_reclen);
if (d.d_reclen > D_NAME_LEN_MAX)
d.d_reclen = D_NAME_LEN_MAX;
printpathn(tcp, addr + offsetof(old_dirent_t, d_name), d.d_reclen);
printpathn(tcp, addr + offsetof(kernel_dirent, d_name), d.d_reclen);
tprints("}");
}
int
sys_readdir(struct tcb *tcp)
SYS_FUNC(readdir)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
tprintf("%#lx", tcp->u_arg[1]);
if (tcp->u_rval == 0)
printaddr(tcp->u_arg[1]);
else
print_old_dirent(tcp, tcp->u_arg[1]);
/* Not much point in printing this out, it is always 1. */
@ -56,10 +73,7 @@ sys_readdir(struct tcb *tcp)
return 0;
}
#include "xlat/direnttypes.h"
int
sys_getdents(struct tcb *tcp)
SYS_FUNC(getdents)
{
unsigned int i, len, dents = 0;
char *buf;
@ -70,24 +84,24 @@ sys_getdents(struct tcb *tcp)
return 0;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
printaddr(tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[2]);
return 0;
}
/* Beware of insanely large or too small values in tcp->u_rval */
if (tcp->u_rval > 1024*1024)
len = 1024*1024;
else if (tcp->u_rval < (int) sizeof(struct kernel_dirent))
else if (tcp->u_rval < (int) sizeof(kernel_dirent))
len = 0;
else
len = tcp->u_rval;
if (len) {
buf = malloc(len);
if (!buf)
die_out_of_memory();
if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
if (!buf || umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
printaddr(tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[2]);
free(buf);
return 0;
}
@ -96,20 +110,22 @@ sys_getdents(struct tcb *tcp)
}
if (!abbrev(tcp))
tprints("{");
for (i = 0; len && i <= len - sizeof(struct kernel_dirent); ) {
struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
tprints("[");
for (i = 0; len && i <= len - sizeof(kernel_dirent); ) {
kernel_dirent *d = (kernel_dirent *) &buf[i];
if (!abbrev(tcp)) {
int oob = d->d_reclen < sizeof(struct kernel_dirent) ||
int oob = d->d_reclen < sizeof(kernel_dirent) ||
i + d->d_reclen - 1 >= len;
int d_name_len = oob ? len - i : d->d_reclen;
d_name_len -= offsetof(struct kernel_dirent, d_name) + 1;
d_name_len -= offsetof(kernel_dirent, d_name) + 1;
if (d_name_len > D_NAME_LEN_MAX)
d_name_len = D_NAME_LEN_MAX;
tprintf("%s{d_ino=%lu, d_off=%lu, d_reclen=%u, d_name=",
i ? " " : "", d->d_ino, d->d_off, d->d_reclen);
tprintf("%s{d_ino=%llu, d_off=%llu, d_reclen=%u"
", d_name=", i ? ", " : "",
(unsigned long long) d->d_ino,
(unsigned long long) d->d_off, d->d_reclen);
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
@ -120,105 +136,18 @@ sys_getdents(struct tcb *tcp)
if (oob)
tprints("?");
else
printxval(direnttypes, buf[i + d->d_reclen - 1], "DT_???");
printxval(dirent_types, buf[i + d->d_reclen - 1], "DT_???");
tprints("}");
}
dents++;
if (d->d_reclen < sizeof(struct kernel_dirent)) {
tprints("/* d_reclen < sizeof(struct kernel_dirent) */");
if (d->d_reclen < sizeof(kernel_dirent)) {
tprints("/* d_reclen < sizeof(struct dirent) */");
break;
}
i += d->d_reclen;
}
if (!abbrev(tcp))
tprints("}");
else
tprintf("/* %u entries */", dents);
tprintf(", %lu", tcp->u_arg[2]);
free(buf);
return 0;
}
int
sys_getdents64(struct tcb *tcp)
{
/* the minimum size of a valid dirent64 structure */
const unsigned int d_name_offset = offsetof(struct dirent64, d_name);
unsigned int i, len, dents = 0;
char *buf;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
return 0;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
return 0;
}
/* Beware of insanely large or too small tcp->u_rval */
if (tcp->u_rval > 1024*1024)
len = 1024*1024;
else if (tcp->u_rval < (int) d_name_offset)
len = 0;
else
len = tcp->u_rval;
if (len) {
buf = malloc(len);
if (!buf)
die_out_of_memory();
if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
free(buf);
return 0;
}
} else {
buf = NULL;
}
if (!abbrev(tcp))
tprints("{");
for (i = 0; len && i <= len - d_name_offset; ) {
struct dirent64 *d = (struct dirent64 *) &buf[i];
if (!abbrev(tcp)) {
int d_name_len;
if (d->d_reclen >= d_name_offset
&& i + d->d_reclen <= len) {
d_name_len = d->d_reclen - d_name_offset;
} else {
d_name_len = len - i - d_name_offset;
}
if (d_name_len > D_NAME_LEN_MAX)
d_name_len = D_NAME_LEN_MAX;
tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64
", d_reclen=%u, d_type=",
i ? " " : "",
d->d_ino,
d->d_off,
d->d_reclen);
printxval(direnttypes, d->d_type, "DT_???");
tprints(", d_name=");
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
tprints("}");
}
if (d->d_reclen < d_name_offset) {
tprints("/* d_reclen < offsetof(struct dirent64, d_name) */");
break;
}
i += d->d_reclen;
dents++;
}
if (!abbrev(tcp))
tprints("}");
tprints("]");
else
tprintf("/* %u entries */", dents);
tprintf(", %lu", tcp->u_arg[2]);

123
dirent64.c Normal file
View File

@ -0,0 +1,123 @@
/*
* 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) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2005-2015 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.
*/
#include "defs.h"
#include <dirent.h>
#include "xlat/dirent_types.h"
#define D_NAME_LEN_MAX 256
SYS_FUNC(getdents64)
{
/* the minimum size of a valid dirent64 structure */
const unsigned int d_name_offset = offsetof(struct dirent64, d_name);
unsigned int i, len, dents = 0;
char *buf;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
return 0;
}
if (syserror(tcp) || !verbose(tcp)) {
printaddr(tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[2]);
return 0;
}
/* Beware of insanely large or too small values in tcp->u_rval */
if (tcp->u_rval > 1024*1024)
len = 1024*1024;
else if (tcp->u_rval < (int) d_name_offset)
len = 0;
else
len = tcp->u_rval;
if (len) {
buf = malloc(len);
if (!buf || umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
printaddr(tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[2]);
free(buf);
return 0;
}
} else {
buf = NULL;
}
if (!abbrev(tcp))
tprints("[");
for (i = 0; len && i <= len - d_name_offset; ) {
struct dirent64 *d = (struct dirent64 *) &buf[i];
if (!abbrev(tcp)) {
int d_name_len;
if (d->d_reclen >= d_name_offset
&& i + d->d_reclen <= len) {
d_name_len = d->d_reclen - d_name_offset;
} else {
d_name_len = len - i - d_name_offset;
}
if (d_name_len > D_NAME_LEN_MAX)
d_name_len = D_NAME_LEN_MAX;
tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64
", d_reclen=%u, d_type=",
i ? ", " : "",
d->d_ino,
d->d_off,
d->d_reclen);
printxval(dirent_types, d->d_type, "DT_???");
tprints(", d_name=");
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
tprints("}");
}
if (d->d_reclen < d_name_offset) {
tprints("/* d_reclen < offsetof(struct dirent64, d_name) */");
break;
}
i += d->d_reclen;
dents++;
}
if (!abbrev(tcp))
tprints("]");
else
tprintf("/* %u entries */", dents);
tprintf(", %lu", tcp->u_arg[2]);
free(buf);
return 0;
}

0
empty.h Normal file
View File

150
epoll.c Normal file
View File

@ -0,0 +1,150 @@
/*
* Copyright (c) 2004-2007 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2005-2015 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.
*/
#include "defs.h"
#include <fcntl.h>
#ifdef HAVE_SYS_EPOLL_H
# include <sys/epoll.h>
#endif
SYS_FUNC(epoll_create)
{
tprintf("%d", (int) tcp->u_arg[0]);
return RVAL_DECODED | RVAL_FD;
}
#include "xlat/epollflags.h"
SYS_FUNC(epoll_create1)
{
printflags(epollflags, tcp->u_arg[0], "EPOLL_???");
return RVAL_DECODED | RVAL_FD;
}
#ifdef HAVE_SYS_EPOLL_H
# include "xlat/epollevents.h"
static void
print_epoll_event(struct epoll_event *ev)
{
tprints("{");
printflags(epollevents, ev->events, "EPOLL???");
/* We cannot know what format the program uses, so print u32 and u64
which will cover every value. */
tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
ev->data.u32, ev->data.u64);
}
#endif
#include "xlat/epollctls.h"
SYS_FUNC(epoll_ctl)
{
struct epoll_event ev;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
tprints(", ");
printfd(tcp, tcp->u_arg[2]);
tprints(", ");
#ifdef HAVE_SYS_EPOLL_H
if (EPOLL_CTL_DEL == tcp->u_arg[1])
printaddr(tcp->u_arg[3]);
else if (!umove_or_printaddr(tcp, tcp->u_arg[3], &ev))
print_epoll_event(&ev);
#else
printaddr(tcp->u_arg[3]);
#endif
return RVAL_DECODED;
}
static void
print_epoll_event_array(struct tcb *tcp, const long addr, const long len)
{
#ifdef HAVE_SYS_EPOLL_H
struct epoll_event ev, *start, *cur, *end;
if (!len) {
tprints("[]");
return;
}
if (umove_or_printaddr(tcp, addr, &ev))
return;
tprints("[");
print_epoll_event(&ev);
start = (struct epoll_event *) addr;
end = start + len;
for (cur = start + 1; cur < end; ++cur) {
tprints(", ");
if (umove_or_printaddr(tcp, (long) cur, &ev))
break;
print_epoll_event(&ev);
}
tprints("]");
#else
printaddr(addr);
#endif
}
static void
epoll_wait_common(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
print_epoll_event_array(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
}
}
SYS_FUNC(epoll_wait)
{
epoll_wait_common(tcp);
return 0;
}
SYS_FUNC(epoll_pwait)
{
epoll_wait_common(tcp);
if (exiting(tcp)) {
tprints(", ");
/* NB: kernel requires arg[5] == NSIG / 8 */
print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
tprintf(", %lu", tcp->u_arg[5]);
}
return 0;
}

14
evdev.c
View File

@ -28,6 +28,8 @@
#include "defs.h"
#include <linux/ioctl.h>
#ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h>
#include "xlat/evdev_abs.h"
@ -295,19 +297,15 @@ mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
}
#endif /* EVIOCGMTSLOTS */
#ifdef EVIOCGREP
#if defined EVIOCGREP || defined EVIOCSREP
static int
repeat_ioctl(struct tcb *tcp, long arg)
{
unsigned int val[2];
if (!verbose(tcp) || umove(tcp, arg, &val) < 0)
return 0;
tprintf(", [%" PRIu32 " %" PRIu32 "]", val[0], val[1]);
tprints(", ");
printpair_int(tcp, arg, "%u");
return 1;
}
#endif /* EVIOCGREP */
#endif /* EVIOCGREP || EVIOCSREP */
static int
evdev_read_ioctl(struct tcb *tcp, const unsigned int code, long arg)

57
eventfd.c Normal file
View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2007 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2008-2015 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.
*/
#include "defs.h"
#include <fcntl.h>
#ifdef HAVE_SYS_EVENTFD_H
# include <sys/eventfd.h>
#endif
#include "xlat/efd_flags.h"
static int
do_eventfd(struct tcb *tcp, int flags_arg)
{
tprintf("%u", (unsigned int) tcp->u_arg[0]);
if (flags_arg >= 0) {
tprints(", ");
printflags(efd_flags, tcp->u_arg[flags_arg], "EFD_???");
}
return RVAL_DECODED | RVAL_FD;
}
SYS_FUNC(eventfd)
{
return do_eventfd(tcp, -1);
}
SYS_FUNC(eventfd2)
{
return do_eventfd(tcp, 1);
}

128
execve.c
View File

@ -1,3 +1,36 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2007 Roland McGrath <roland@redhat.com>
* Copyright (c) 2011-2012 Denys Vlasenko <vda.linux@googlemail.com>
* Copyright (c) 2010-2015 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.
*/
#include "defs.h"
static void
@ -10,14 +43,12 @@ printargv(struct tcb *tcp, long addr)
} cp;
const char *sep;
unsigned int n = 0;
unsigned wordsize = current_wordsize;
const unsigned wordsize = current_wordsize;
cp.p64 = 1;
for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) {
if (umoven(tcp, addr, wordsize, cp.data) < 0) {
tprintf("%#lx", addr);
if (umoven_or_printaddr(tcp, addr, wordsize, cp.data))
return;
}
if (wordsize == 4)
cp.p64 = cp.p32;
if (cp.p64 == 0)
@ -34,53 +65,70 @@ static void
printargc(const char *fmt, struct tcb *tcp, long addr)
{
int count;
char *cp;
char *cp = NULL;
for (count = 0; umove(tcp, addr, &cp) >= 0 && cp != NULL; count++) {
addr += sizeof(char *);
for (count = 0; !umoven(tcp, addr, current_wordsize, &cp) && cp; count++) {
addr += current_wordsize;
}
tprintf(fmt, count, count == 1 ? "" : "s");
}
int
sys_execve(struct tcb *tcp)
static void
decode_execve(struct tcb *tcp, const unsigned int index)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
if (!verbose(tcp))
tprintf(", %#lx", tcp->u_arg[1]);
else {
tprints(", [");
printargv(tcp, tcp->u_arg[1]);
tprints("]");
}
if (!verbose(tcp))
tprintf(", %#lx", tcp->u_arg[2]);
else if (abbrev(tcp))
printargc(", [/* %d var%s */]", tcp, tcp->u_arg[2]);
else {
tprints(", [");
printargv(tcp, tcp->u_arg[2]);
tprints("]");
}
printpath(tcp, tcp->u_arg[index + 0]);
tprints(", ");
if (!tcp->u_arg[index + 1] || !verbose(tcp))
printaddr(tcp->u_arg[index + 1]);
else {
tprints("[");
printargv(tcp, tcp->u_arg[index + 1]);
tprints("]");
}
return 0;
tprints(", ");
if (!tcp->u_arg[index + 2] || !verbose(tcp))
printaddr(tcp->u_arg[index + 2]);
else if (abbrev(tcp))
printargc("[/* %d var%s */]", tcp, tcp->u_arg[index + 2]);
else {
tprints("[");
printargv(tcp, tcp->u_arg[index + 2]);
tprints("]");
}
}
SYS_FUNC(execve)
{
decode_execve(tcp, 0);
return RVAL_DECODED;
}
SYS_FUNC(execveat)
{
print_dirfd(tcp, tcp->u_arg[0]);
decode_execve(tcp, 1);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
return RVAL_DECODED;
}
#if defined(SPARC) || defined(SPARC64)
int
sys_execv(struct tcb *tcp)
SYS_FUNC(execv)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
if (!verbose(tcp))
tprintf(", %#lx", tcp->u_arg[1]);
else {
tprints(", [");
printargv(tcp, tcp->u_arg[1]);
tprints("]");
}
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
if (!tcp->u_arg[1] || !verbose(tcp))
printaddr(tcp->u_arg[1]);
else {
tprints("[");
printargv(tcp, tcp->u_arg[1]);
tprints("]");
}
return 0;
return RVAL_DECODED;
}
#endif /* SPARC || SPARC64 */

5
exit.c
View File

@ -1,10 +1,9 @@
#include "defs.h"
int
sys_exit(struct tcb *tcp)
SYS_FUNC(exit)
{
if (exiting(tcp)) {
fprintf(stderr, "_exit returned!\n");
error_msg("_exit returned!");
return -1;
}
/* special case: we stop tracing this process, finish line now */

View File

@ -1,35 +1,65 @@
/*
* Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2007 Daniel Jacobowitz <dan@codesourcery.com>
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
* Copyright (c) 2009 Kirill A. Shutemov <kirill@shutemov.name>
* Copyright (c) 2011-2015 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.
*/
#include "defs.h"
#include <fcntl.h>
#include "xlat/advise.h"
int
sys_fadvise64(struct tcb *tcp)
SYS_FUNC(fadvise64)
{
if (entering(tcp)) {
int argn;
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld", 1);
tprintf(", %ld, ", tcp->u_arg[argn++]);
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
}
return 0;
int argn;
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld", 1);
tprintf(", %ld, ", tcp->u_arg[argn++]);
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
return RVAL_DECODED;
}
int
sys_fadvise64_64(struct tcb *tcp)
SYS_FUNC(fadvise64_64)
{
if (entering(tcp)) {
int argn;
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld, ", 1);
argn = printllval(tcp, "%lld, ", argn);
int argn;
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld, ", 1);
argn = printllval(tcp, "%lld, ", argn);
#if defined __ARM_EABI__ || defined AARCH64 || defined POWERPC || defined XTENSA
printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
#else
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
#endif
}
return 0;
return RVAL_DECODED;
}

View File

@ -6,25 +6,23 @@
#include "xlat/falloc_flags.h"
int
sys_fallocate(struct tcb *tcp)
SYS_FUNC(fallocate)
{
if (entering(tcp)) {
int argn;
int argn;
/* fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* mode */
printflags(falloc_flags, tcp->u_arg[1], "FALLOC_FL_???");
tprints(", ");
/* mode */
printflags(falloc_flags, tcp->u_arg[1], "FALLOC_FL_???");
tprints(", ");
/* offset */
argn = printllval(tcp, "%llu, ", 2);
/* offset */
argn = printllval(tcp, "%llu, ", 2);
/* len */
printllval(tcp, "%llu", argn);
}
return 0;
/* len */
printllval(tcp, "%llu", argn);
return RVAL_DECODED;
}

View File

@ -1,3 +1,30 @@
/*
* Copyright (c) 2014-2015 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.
*/
#include "defs.h"
#include "xlat/fan_classes.h"
@ -10,14 +37,10 @@
# define FAN_NOFD -1
#endif
int
sys_fanotify_init(struct tcb *tcp)
SYS_FUNC(fanotify_init)
{
unsigned flags;
if (exiting(tcp))
return 0;
flags = tcp->u_arg[0];
printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
flags &= ~FAN_ALL_CLASS_BITS;
@ -28,21 +51,17 @@ sys_fanotify_init(struct tcb *tcp)
tprints(", ");
tprint_open_modes((unsigned) tcp->u_arg[1]);
return 0;
return RVAL_DECODED | RVAL_FD;
}
#include "xlat/fan_mark_flags.h"
#include "xlat/fan_event_flags.h"
int
sys_fanotify_mark(struct tcb *tcp)
SYS_FUNC(fanotify_mark)
{
unsigned long long mask = 0;
int argn;
if (exiting(tcp))
return 0;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
@ -64,5 +83,5 @@ sys_fanotify_mark(struct tcb *tcp)
print_dirfd(tcp, tcp->u_arg[argn]);
printpath(tcp, tcp->u_arg[argn + 1]);
return 0;
return RVAL_DECODED;
}

View File

@ -1,15 +1,13 @@
#include "defs.h"
int
sys_fchownat(struct tcb *tcp)
SYS_FUNC(fchownat)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
printuid(", ", tcp->u_arg[2]);
printuid(", ", tcp->u_arg[3]);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
printuid(", ", tcp->u_arg[2]);
printuid(", ", tcp->u_arg[3]);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
return RVAL_DECODED;
}

236
fcntl.c Normal file
View File

@ -0,0 +1,236 @@
/*
* 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) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* 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"
#include "flock.h"
#include "xlat/f_owner_types.h"
#include "xlat/f_seals.h"
#include "xlat/fcntlcmds.h"
#include "xlat/fcntl64cmds.h"
#include "xlat/fdflags.h"
#include "xlat/lockfcmds.h"
#include "xlat/notifyflags.h"
static void
print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
{
tprints("{l_type=");
printxval(lockfcmds, fl->l_type, "F_???");
tprints(", l_whence=");
printxval(whence_codes, fl->l_whence, "SEEK_???");
tprintf(", l_start=%lld, l_len=%lld",
(long long) fl->l_start, (long long) 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)
{
struct_kernel_flock64 fl;
if (fetch_struct_flock64(tcp, addr, &fl))
print_struct_flock64(&fl, getlk);
}
static void
printflock(struct tcb *tcp, const long addr, const int getlk)
{
struct_kernel_flock64 fl;
if (fetch_struct_flock(tcp, addr, &fl))
print_struct_flock64(&fl, getlk);
}
static void
print_f_owner_ex(struct tcb *tcp, const long addr)
{
struct { int type, pid; } owner;
if (umove_or_printaddr(tcp, addr, &owner))
return;
tprints("{type=");
printxval(f_owner_types, owner.type, "F_OWNER_???");
tprintf(", pid=%d}", owner.pid);
}
static int
print_fcntl(struct tcb *tcp)
{
switch (tcp->u_arg[1]) {
case F_SETFD:
tprints(", ");
printflags(fdflags, tcp->u_arg[2], "FD_???");
break;
case F_SETOWN:
case F_SETPIPE_SZ:
tprintf(", %ld", tcp->u_arg[2]);
break;
case F_DUPFD:
case F_DUPFD_CLOEXEC:
tprintf(", %ld", tcp->u_arg[2]);
return RVAL_DECODED | RVAL_FD;
case F_SETFL:
tprints(", ");
tprint_open_modes(tcp->u_arg[2]);
break;
case F_SETLK:
case F_SETLKW:
tprints(", ");
printflock(tcp, tcp->u_arg[2], 0);
break;
case F_OFD_SETLK:
case F_OFD_SETLKW:
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 0);
break;
case F_SETOWN_EX:
tprints(", ");
print_f_owner_ex(tcp, tcp->u_arg[2]);
break;
case F_NOTIFY:
tprints(", ");
printflags(notifyflags, tcp->u_arg[2], "DN_???");
break;
case F_SETLEASE:
tprints(", ");
printxval(lockfcmds, tcp->u_arg[2], "F_???");
break;
case F_ADD_SEALS:
tprints(", ");
printflags(f_seals, tcp->u_arg[2], "F_SEAL_???");
break;
case F_SETSIG:
tprints(", ");
tprints(signame(tcp->u_arg[2]));
break;
case F_GETOWN:
case F_GETPIPE_SZ:
break;
case F_GETFD:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = sprintflags("flags ", fdflags, tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETFL:
if (entering(tcp) || syserror(tcp))
return 0;
tcp->auxstr = sprint_open_modes(tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETLK:
if (entering(tcp))
return 0;
tprints(", ");
printflock(tcp, tcp->u_arg[2], 1);
break;
case F_OFD_GETLK:
if (entering(tcp))
return 0;
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 1);
break;
case F_GETOWN_EX:
if (entering(tcp))
return 0;
tprints(", ");
print_f_owner_ex(tcp, tcp->u_arg[2]);
break;
case F_GETLEASE:
if (entering(tcp) || syserror(tcp))
return 0;
tcp->auxstr = xlookup(lockfcmds, 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, tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETSIG:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = signame(tcp->u_rval);
return RVAL_STR;
default:
tprintf(", %#lx", tcp->u_arg[2]);
break;
}
return RVAL_DECODED;
}
SYS_FUNC(fcntl)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
const char *str = xlookup(fcntlcmds, tcp->u_arg[1]);
if (str) {
tprints(str);
} else {
/*
* fcntl syscall does not recognize these
* constants, but we would like to show them
* for better debugging experience.
*/
printxval(fcntl64cmds, tcp->u_arg[1], "F_???");
}
}
return print_fcntl(tcp);
}
SYS_FUNC(fcntl64)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
const char *str = xlookup(fcntl64cmds, tcp->u_arg[1]);
if (str) {
tprints(str);
} else {
printxval(fcntlcmds, tcp->u_arg[1], "F_???");
}
}
switch (tcp->u_arg[1]) {
case F_SETLK64:
case F_SETLKW64:
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 0);
return RVAL_DECODED;
case F_GETLK64:
if (exiting(tcp)) {
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 1);
}
return 0;
}
return print_fcntl(tcp);
}

51
fetch_seccomp_fprog.c Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2015 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.
*/
#include "defs.h"
#include DEF_MPERS_TYPE(seccomp_fprog_t)
#include "seccomp_fprog.h"
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)
{
struct seccomp_fprog *pfp = p;
seccomp_fprog_t mfp;
if (sizeof(*pfp) == sizeof(mfp))
return !umove_or_printaddr(tcp, addr, pfp);
if (umove_or_printaddr(tcp, addr, &mfp))
return false;
pfp->len = mfp.len;
pfp->filter = mfp.filter;
return true;
}

90
fetch_struct_flock.c Normal file
View File

@ -0,0 +1,90 @@
/*
* Copyright (c) 2015 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.
*/
#include "defs.h"
#include DEF_MPERS_TYPE(struct_flock)
#include DEF_MPERS_TYPE(struct_flock64)
#include "flock.h"
typedef struct_kernel_flock struct_flock;
typedef struct_kernel_flock64 struct_flock64;
#include MPERS_DEFS
#define SIZEOF_MEMBER(type, member) \
sizeof(((type *) NULL)->member)
#define FLOCK_MEMBERS_EQ(type, member) \
(SIZEOF_MEMBER(struct_kernel_flock64, member) == SIZEOF_MEMBER(type, member) \
&& offsetof(struct_kernel_flock64, member) == offsetof(type, member))
#define FLOCK_STRUCTS_EQ(type) \
(sizeof(struct_kernel_flock64) == sizeof(type) \
&& FLOCK_MEMBERS_EQ(type, l_type) \
&& FLOCK_MEMBERS_EQ(type, l_whence) \
&& FLOCK_MEMBERS_EQ(type, l_start) \
&& 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)
{
struct_kernel_flock64 *pfl = p;
struct_flock mfl;
if (FLOCK_STRUCTS_EQ(struct_flock))
return !umove_or_printaddr(tcp, addr, pfl);
if (umove_or_printaddr(tcp, addr, &mfl))
return false;
pfl->l_type = mfl.l_type;
pfl->l_whence = mfl.l_whence;
pfl->l_start = mfl.l_start;
pfl->l_len = mfl.l_len;
pfl->l_pid = mfl.l_pid;
return true;
}
MPERS_PRINTER_DECL(bool, fetch_struct_flock64)(struct tcb *tcp, const long addr, void *p)
{
struct_kernel_flock64 *pfl = p;
struct_flock64 mfl;
if (FLOCK_STRUCTS_EQ(struct_flock64))
return !umove_or_printaddr(tcp, addr, pfl);
if (umove_or_printaddr(tcp, addr, &mfl))
return false;
pfl->l_type = mfl.l_type;
pfl->l_whence = mfl.l_whence;
pfl->l_start = mfl.l_start;
pfl->l_len = mfl.l_len;
pfl->l_pid = mfl.l_pid;
return true;
}

146
file.c
View File

@ -47,7 +47,7 @@
#define off_t __kernel_off_t
#define loff_t __kernel_loff_t
#include <asm/stat.h>
#include "asm_stat.h"
#undef dev_t
#undef ino_t
@ -87,6 +87,14 @@
#include "printstat.h"
/* all locally defined structures provide these fields */
#undef HAVE_STRUCT_STAT_ST_ATIME_NSEC
#define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1
#undef HAVE_STRUCT_STAT_ST_CTIME_NSEC
#define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1
#undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
#define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
#undef STAT32_PERSONALITY
#if SUPPORTED_PERSONALITIES > 1
# if defined AARCH64 || defined X86_64 || defined X32
@ -110,11 +118,7 @@ struct stat32 {
unsigned int __unused4;
unsigned int __unused5;
};
# ifdef AARCH64
# define STAT32_PERSONALITY 0
# else
# define STAT32_PERSONALITY 1
# endif
# define STAT32_PERSONALITY 1
# elif defined POWERPC64
struct stat32 {
unsigned int st_dev;
@ -174,19 +178,6 @@ struct stat32 {
# undef HAVE_STRUCT_STAT_ST_FSTYPE
# undef HAVE_STRUCT_STAT_ST_GEN
# include "printstat.h"
static void
printstat32(struct tcb *tcp, long addr)
{
struct stat32 statbuf;
if (umove(tcp, addr, &statbuf) < 0) {
tprints("{...}");
return;
}
do_printstat32(tcp, &statbuf);
}
#endif /* STAT32_PERSONALITY */
#if defined(SPARC) || defined(SPARC64)
@ -223,20 +214,6 @@ struct solstat {
# undef HAVE_STRUCT_STAT_ST_FSTYPE
# undef HAVE_STRUCT_STAT_ST_GEN
# include "printstat.h"
static void
printstatsol(struct tcb *tcp, long addr)
{
struct solstat statbuf;
if (umove(tcp, addr, &statbuf) < 0) {
tprints("{...}");
return;
}
do_printstat_sol(tcp, &statbuf);
}
#endif /* SPARC || SPARC64 */
static void
@ -244,39 +221,31 @@ printstat(struct tcb *tcp, long addr)
{
struct stat statbuf;
if (!addr) {
tprints("NULL");
return;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx", addr);
return;
}
#ifdef STAT32_PERSONALITY
if (current_personality == STAT32_PERSONALITY) {
printstat32(tcp, addr);
struct stat32 statbuf;
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat32(tcp, &statbuf);
return;
}
#endif
#if defined(SPARC) || defined(SPARC64)
if (current_personality == 1) {
printstatsol(tcp, addr);
struct solstat statbuf;
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat_sol(tcp, &statbuf);
return;
}
#endif /* SPARC || SPARC64 */
if (umove(tcp, addr, &statbuf) < 0) {
tprints("{...}");
return;
}
do_printstat(tcp, &statbuf);
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat(tcp, &statbuf);
}
int
sys_stat(struct tcb *tcp)
SYS_FUNC(stat)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
@ -287,8 +256,7 @@ sys_stat(struct tcb *tcp)
return 0;
}
int
sys_fstat(struct tcb *tcp)
SYS_FUNC(fstat)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
@ -305,7 +273,6 @@ sys_fstat(struct tcb *tcp)
* Linux x86_64 and x32 have unified `struct stat' but their i386 personality
* needs `struct stat64'.
* linux/arch/x86/include/uapi/asm/stat.h defines `struct stat64' only for i386.
* __GNUC__ is needed for the required __attribute__ below.
*
* Similarly, aarch64 has a unified `struct stat' but its arm personality
* needs `struct stat64' (unlike x86, it shouldn't be packed).
@ -332,7 +299,7 @@ struct stat64 {
unsigned long long st_ino;
}
# if defined X86_64 || defined X32
__attribute__((packed))
ATTRIBUTE_PACKED
# define STAT64_SIZE 96
# else
# define STAT64_SIZE 104
@ -362,15 +329,6 @@ printstat64(struct tcb *tcp, long addr)
(void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
# endif
if (!addr) {
tprints("NULL");
return;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx", addr);
return;
}
# ifdef STAT32_PERSONALITY
if (current_personality != STAT32_PERSONALITY) {
printstat(tcp, addr);
@ -378,16 +336,11 @@ printstat64(struct tcb *tcp, long addr)
}
# endif /* STAT32_PERSONALITY */
if (umove(tcp, addr, &statbuf) < 0) {
tprints("{...}");
return;
}
do_printstat64(tcp, &statbuf);
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat64(tcp, &statbuf);
}
int
sys_stat64(struct tcb *tcp)
SYS_FUNC(stat64)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
@ -398,8 +351,7 @@ sys_stat64(struct tcb *tcp)
return 0;
}
int
sys_fstat64(struct tcb *tcp)
SYS_FUNC(fstat64)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
@ -412,22 +364,19 @@ sys_fstat64(struct tcb *tcp)
#else
int
sys_stat64(struct tcb *tcp)
SYS_FUNC(stat64)
{
return sys_stat(tcp);
}
int
sys_fstat64(struct tcb *tcp)
SYS_FUNC(fstat64)
{
return sys_fstat(tcp);
}
#endif /* HAVE_STRUCT_STAT64 */
int
sys_newfstatat(struct tcb *tcp)
SYS_FUNC(newfstatat)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
@ -475,33 +424,23 @@ printoldstat(struct tcb *tcp, long addr)
struct __old_kernel_stat statbuf;
struct stat newstatbuf;
if (!addr) {
tprints("NULL");
return;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx", addr);
return;
}
# if defined(SPARC) || defined(SPARC64)
if (current_personality == 1) {
printstatsol(tcp, addr);
struct solstat statbuf;
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat_sol(tcp, &statbuf);
return;
}
# endif
if (umove(tcp, addr, &statbuf) < 0) {
tprints("{...}");
return;
if (!umove_or_printaddr(tcp, addr, &statbuf)) {
convertoldstat(&statbuf, &newstatbuf);
do_printstat(tcp, &newstatbuf);
}
convertoldstat(&statbuf, &newstatbuf);
do_printstat(tcp, &newstatbuf);
}
int
sys_oldstat(struct tcb *tcp)
SYS_FUNC(oldstat)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
@ -512,8 +451,7 @@ sys_oldstat(struct tcb *tcp)
return 0;
}
int
sys_oldfstat(struct tcb *tcp)
SYS_FUNC(oldfstat)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
@ -528,8 +466,7 @@ sys_oldfstat(struct tcb *tcp)
#if defined(SPARC) || defined(SPARC64)
int
sys_xstat(struct tcb *tcp)
SYS_FUNC(xstat)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
@ -541,8 +478,7 @@ sys_xstat(struct tcb *tcp)
return 0;
}
int
sys_fxstat(struct tcb *tcp)
SYS_FUNC(fxstat)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);

140
file_handle.c Normal file
View File

@ -0,0 +1,140 @@
/*
* Copyright (c) 2015 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.
*/
#include "defs.h"
#ifndef MAX_HANDLE_SZ
# define MAX_HANDLE_SZ 128
#endif
typedef struct {
unsigned int handle_bytes;
int handle_type;
} file_handle_header;
SYS_FUNC(name_to_handle_at)
{
file_handle_header h;
const long addr = tcp->u_arg[2];
if (entering(tcp)) {
/* dirfd */
print_dirfd(tcp, tcp->u_arg[0]);
/* pathname */
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
/* handle */
if (umove_or_printaddr(tcp, addr, &h)) {
tprints(", ");
/* mount_id */
printaddr(tcp->u_arg[3]);
tprints(", ");
/* flags */
printflags(at_flags, tcp->u_arg[4], "AT_???");
return RVAL_DECODED;
}
tprintf("{handle_bytes=%u", h.handle_bytes);
/*
* Abusing tcp->auxstr as a temporary storage.
* Will be used and cleared on syscall exit.
*/
tcp->auxstr = (void *) (unsigned long) h.handle_bytes;
return 0;
} else {
unsigned int i = (unsigned long) tcp->auxstr;
if ((!syserror(tcp) || EOVERFLOW == tcp->u_error)
&& !umove(tcp, addr, &h)) {
unsigned char f_handle[MAX_HANDLE_SZ];
if (i != h.handle_bytes)
tprintf(" => %u", h.handle_bytes);
if (!syserror(tcp)) {
tprintf(", handle_type=%d", h.handle_type);
if (h.handle_bytes > MAX_HANDLE_SZ)
h.handle_bytes = MAX_HANDLE_SZ;
if (!umoven(tcp, addr + sizeof(h), h.handle_bytes,
f_handle)) {
tprints(", f_handle=0x");
for (i = 0; i < h.handle_bytes; ++i)
tprintf("%02x", f_handle[i]);
}
}
}
tprints("}, ");
tcp->auxstr = NULL;
/* mount_id */
printnum_int(tcp, tcp->u_arg[3], "%d");
tprints(", ");
/* flags */
printflags(at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
}
SYS_FUNC(open_by_handle_at)
{
file_handle_header h;
const long addr = tcp->u_arg[1];
/* mount_fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* handle */
if (!umove_or_printaddr(tcp, addr, &h)) {
unsigned char f_handle[MAX_HANDLE_SZ];
tprintf("{handle_bytes=%u, handle_type=%d",
h.handle_bytes, h.handle_type);
if (h.handle_bytes > MAX_HANDLE_SZ)
h.handle_bytes = MAX_HANDLE_SZ;
if (!umoven(tcp, addr + sizeof(h), h.handle_bytes, &f_handle)) {
unsigned int i;
tprints(", f_handle=0x");
for (i = 0; i < h.handle_bytes; ++i)
tprintf("%02x", f_handle[i]);
}
tprints("}");
}
tprints(", ");
/* flags */
tprint_open_modes(tcp->u_arg[2]);
return RVAL_DECODED;
}

43
flock.c Normal file
View File

@ -0,0 +1,43 @@
/*
* 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) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* 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"
#include <sys/file.h>
#include "xlat/flockcmds.h"
SYS_FUNC(flock)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(flockcmds, tcp->u_arg[1], "LOCK_???");
return RVAL_DECODED;
}

44
flock.h Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2015 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.
*/
#include <linux/fcntl.h>
#if defined HAVE_STRUCT_FLOCK
typedef struct flock struct_kernel_flock;
#elif defined HAVE_STRUCT___KERNEL_FLOCK
typedef struct __kernel_flock struct_kernel_flock;
#else
# error struct flock definition not found in <linux/fcntl.h>
#endif
#if defined HAVE_STRUCT_FLOCK64
typedef struct flock64 struct_kernel_flock64;
#elif defined HAVE_STRUCT___KERNEL_FLOCK64
typedef struct __kernel_flock64 struct_kernel_flock64;
#else
# error struct flock64 definition not found in <linux/fcntl.h>
#endif

217
futex.c
View File

@ -1,139 +1,116 @@
/*
* Copyright (c) 2002-2003 Roland McGrath <roland@redhat.com>
* Copyright (c) 2007-2008 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
* Copyright (c) 2014-2015 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.
*/
#include "defs.h"
#ifdef HAVE_LINUX_FUTEX_H
# include <linux/futex.h>
#endif
#ifndef FUTEX_WAIT
# define FUTEX_WAIT 0
#endif
#ifndef FUTEX_WAKE
# define FUTEX_WAKE 1
#endif
#ifndef FUTEX_FD
# define FUTEX_FD 2
#endif
#ifndef FUTEX_REQUEUE
# define FUTEX_REQUEUE 3
#endif
#ifndef FUTEX_CMP_REQUEUE
# define FUTEX_CMP_REQUEUE 4
#endif
#ifndef FUTEX_WAKE_OP
# define FUTEX_WAKE_OP 5
#endif
#ifndef FUTEX_LOCK_PI
# define FUTEX_LOCK_PI 6
# define FUTEX_UNLOCK_PI 7
# define FUTEX_TRYLOCK_PI 8
#endif
#ifndef FUTEX_WAIT_BITSET
# define FUTEX_WAIT_BITSET 9
#endif
#ifndef FUTEX_WAKE_BITSET
# define FUTEX_WAKE_BITSET 10
#endif
#ifndef FUTEX_WAIT_REQUEUE_PI
# define FUTEX_WAIT_REQUEUE_PI 11
#endif
#ifndef FUTEX_CMP_REQUEUE_PI
# define FUTEX_CMP_REQUEUE_PI 12
#endif
#ifndef FUTEX_PRIVATE_FLAG
# define FUTEX_PRIVATE_FLAG 128
#endif
#ifndef FUTEX_CLOCK_REALTIME
# define FUTEX_CLOCK_REALTIME 256
#endif
#ifndef FUTEX_WAIT_PRIVATE
# define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAKE_PRIVATE
# define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_REQUEUE_PRIVATE
# define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_CMP_REQUEUE_PRIVATE
# define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAKE_OP_PRIVATE
# define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_LOCK_PI_PRIVATE
# define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_UNLOCK_PI_PRIVATE
# define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_TRYLOCK_PI_PRIVATE
# define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAIT_BITSET_PRIVATE
# define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAKE_BITSET_PRIVATE
# define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAIT_REQUEUE_PI_PRIVATE
# define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_CMP_REQUEUE_PI_PRIVATE
# define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | FUTEX_PRIVATE_FLAG)
#endif
#include "xlat/futexops.h"
#ifndef FUTEX_OP_SET
# define FUTEX_OP_SET 0
# define FUTEX_OP_ADD 1
# define FUTEX_OP_OR 2
# define FUTEX_OP_ANDN 3
# define FUTEX_OP_XOR 4
# define FUTEX_OP_CMP_EQ 0
# define FUTEX_OP_CMP_NE 1
# define FUTEX_OP_CMP_LT 2
# define FUTEX_OP_CMP_LE 3
# define FUTEX_OP_CMP_GT 4
# define FUTEX_OP_CMP_GE 5
#endif
#include "xlat/futexwakeops.h"
#include "xlat/futexwakecmps.h"
int
sys_futex(struct tcb *tcp)
SYS_FUNC(futex)
{
if (entering(tcp)) {
long int cmd = tcp->u_arg[1] & 127;
tprintf("%p, ", (void *) tcp->u_arg[0]);
printxval(futexops, tcp->u_arg[1], "FUTEX_???");
tprintf(", %ld", tcp->u_arg[2]);
if (cmd == FUTEX_WAKE_BITSET)
tprintf(", %lx", tcp->u_arg[5]);
else if (cmd == FUTEX_WAIT) {
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
} else if (cmd == FUTEX_WAIT_BITSET) {
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
tprintf(", %lx", tcp->u_arg[5]);
} else if (cmd == FUTEX_REQUEUE)
tprintf(", %ld, %p", tcp->u_arg[3], (void *) tcp->u_arg[4]);
else if (cmd == FUTEX_CMP_REQUEUE || cmd == FUTEX_CMP_REQUEUE_PI)
tprintf(", %ld, %p, %ld", tcp->u_arg[3], (void *) tcp->u_arg[4], tcp->u_arg[5]);
else if (cmd == FUTEX_WAKE_OP) {
tprintf(", %ld, %p, {", tcp->u_arg[3], (void *) tcp->u_arg[4]);
if ((tcp->u_arg[5] >> 28) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakeops, (tcp->u_arg[5] >> 28) & 0x7, "FUTEX_OP_???");
tprintf(", %ld, ", (tcp->u_arg[5] >> 12) & 0xfff);
if ((tcp->u_arg[5] >> 24) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakecmps, (tcp->u_arg[5] >> 24) & 0x7, "FUTEX_OP_CMP_???");
tprintf(", %ld}", tcp->u_arg[5] & 0xfff);
} else if (cmd == FUTEX_WAIT_REQUEUE_PI) {
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
tprintf(", %p", (void *) tcp->u_arg[4]);
}
const long 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 unsigned int val = tcp->u_arg[2];
const unsigned int val2 = tcp->u_arg[3];
const unsigned int val3 = tcp->u_arg[5];
printaddr(uaddr);
tprints(", ");
printxval(futexops, op, "FUTEX_???");
tprintf(", %u", val);
switch (cmd) {
case FUTEX_WAIT:
case FUTEX_LOCK_PI:
tprints(", ");
print_timespec(tcp, timeout);
break;
case FUTEX_WAIT_BITSET:
tprints(", ");
print_timespec(tcp, timeout);
tprintf(", %x", val3);
break;
case FUTEX_WAKE_BITSET:
tprintf(", %x", val3);
break;
case FUTEX_REQUEUE:
tprintf(", %u, ", val2);
printaddr(uaddr2);
break;
case FUTEX_CMP_REQUEUE:
case FUTEX_CMP_REQUEUE_PI:
tprintf(", %u, ", val2);
printaddr(uaddr2);
tprintf(", %u", val3);
break;
case FUTEX_WAKE_OP:
tprintf(", %u, ", val2);
printaddr(uaddr2);
tprints(", {");
if ((val3 >> 28) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakeops, (val3 >> 28) & 0x7, "FUTEX_OP_???");
tprintf(", %u, ", (val3 >> 12) & 0xfff);
if ((val3 >> 24) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakecmps, (val3 >> 24) & 0x7, "FUTEX_OP_CMP_???");
tprintf(", %u}", val3 & 0xfff);
break;
case FUTEX_WAIT_REQUEUE_PI:
tprints(", ");
print_timespec(tcp, timeout);
tprints(", ");
printaddr(uaddr2);
break;
case FUTEX_WAKE:
case FUTEX_UNLOCK_PI:
case FUTEX_TRYLOCK_PI:
break;
default:
tprintf(", %lx, %lx, %x", timeout, uaddr2, val3);
break;
}
return 0;
return RVAL_DECODED;
}

13
generate_mpers_am.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh -e
list="$(sed -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*\([[:alnum:]][^.]*\.c\)[[:space:]]*\\$/\1/p' Makefile.am |
xargs -r grep -lx '#[[:space:]]*include[[:space:]]\+MPERS_DEFS' |
tr '\n' ' ')"
cat > mpers.am <<EOF
# Generated by $0; do not edit.
mpers_source_files = $list
EOF
sed -n 's/^#[[:space:]]*include[[:space:]]*"xlat\/\([^."]\+\)\.h".*/extern const struct xlat \1[];/p' \
$list > mpers_xlat.h

8
generate_sen.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh -e
echo 'enum {'
echo 'SEN_printargs = 0,'
sed -n '/printargs/! s/.*SEN(\([^)]*\)).*/\1/p' |
sort -u |
sed 's/.*/SEN_&,/'
echo '};'

View File

@ -1,29 +1,40 @@
/*
* Copyright (c) 2012-2015 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.
*/
#include "defs.h"
int
sys_get_robust_list(struct tcb *tcp)
SYS_FUNC(get_robust_list)
{
if (entering(tcp)) {
tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
tprintf("%d, ", (int) tcp->u_arg[0]);
} else {
void *addr;
size_t len;
if (syserror(tcp) ||
!tcp->u_arg[1] ||
umove(tcp, tcp->u_arg[1], &addr) < 0) {
tprintf("%#lx, ", tcp->u_arg[1]);
} else {
tprintf("[%p], ", addr);
}
if (syserror(tcp) ||
!tcp->u_arg[2] ||
umove(tcp, tcp->u_arg[2], &len) < 0) {
tprintf("%#lx", tcp->u_arg[2]);
} else {
tprintf("[%lu]", (unsigned long) len);
}
printnum_ptr(tcp, tcp->u_arg[1]);
tprints(", ");
printnum_ulong(tcp, tcp->u_arg[2]);
}
return 0;
}

View File

@ -1,23 +1,13 @@
#include "defs.h"
int
sys_getcpu(struct tcb *tcp)
SYS_FUNC(getcpu)
{
if (exiting(tcp)) {
unsigned u;
if (tcp->u_arg[0] == 0)
tprints("NULL, ");
else if (umove(tcp, tcp->u_arg[0], &u) < 0)
tprintf("%#lx, ", tcp->u_arg[0]);
else
tprintf("[%u], ", u);
if (tcp->u_arg[1] == 0)
tprints("NULL, ");
else if (umove(tcp, tcp->u_arg[1], &u) < 0)
tprintf("%#lx, ", tcp->u_arg[1]);
else
tprintf("[%u], ", u);
tprintf("%#lx", tcp->u_arg[2]);
printnum_int(tcp, tcp->u_arg[0], "%u");
tprints(", ");
printnum_int(tcp, tcp->u_arg[1], "%u");
tprints(", ");
printaddr(tcp->u_arg[2]);
}
return 0;
}

View File

@ -1,11 +1,10 @@
#include "defs.h"
int
sys_getcwd(struct tcb *tcp)
SYS_FUNC(getcwd)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
printaddr(tcp->u_arg[0]);
else
printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
tprintf(", %lu", tcp->u_arg[1]);

View File

@ -1,12 +1,11 @@
#include "defs.h"
#include "xlat/getrandom_flags.h"
int
sys_getrandom(struct tcb *tcp)
SYS_FUNC(getrandom)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
printaddr(tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[1]);

View File

@ -1,22 +1,19 @@
#include "defs.h"
int
sys_sethostname(struct tcb *tcp)
SYS_FUNC(sethostname)
{
if (entering(tcp)) {
printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[1]);
return RVAL_DECODED;
}
#if defined(ALPHA)
int
sys_gethostname(struct tcb *tcp)
SYS_FUNC(gethostname)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
printaddr(tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], -1);
tprintf(", %lu", tcp->u_arg[1]);

View File

@ -1,41 +1,64 @@
/*
* Copyright (c) 2006 Bernhard Kaindl <bk@suse.de>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#include <fcntl.h>
#include "xlat/inotify_flags.h"
#include "xlat/inotify_init_flags.h"
int
sys_inotify_add_watch(struct tcb *tcp)
SYS_FUNC(inotify_add_watch)
{
if (entering(tcp)) {
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* pathname */
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
/* mask */
printflags(inotify_flags, tcp->u_arg[2], "IN_???");
}
return 0;
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* pathname */
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
/* mask */
printflags(inotify_flags, tcp->u_arg[2], "IN_???");
return RVAL_DECODED;
}
int
sys_inotify_rm_watch(struct tcb *tcp)
SYS_FUNC(inotify_rm_watch)
{
if (entering(tcp)) {
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
/* watch descriptor */
tprintf(", %d", (int) tcp->u_arg[1]);
}
return 0;
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
/* watch descriptor */
tprintf(", %d", (int) tcp->u_arg[1]);
return RVAL_DECODED;
}
int
sys_inotify_init1(struct tcb *tcp)
SYS_FUNC(inotify_init1)
{
if (entering(tcp))
printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
return 0;
printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
return RVAL_DECODED | RVAL_FD;
}

326
io.c
View File

@ -32,15 +32,14 @@
#include <fcntl.h>
#include <sys/uio.h>
int
sys_read(struct tcb *tcp)
SYS_FUNC(read)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[1]);
printaddr(tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu", tcp->u_arg[2]);
@ -48,16 +47,14 @@ sys_read(struct tcb *tcp)
return 0;
}
int
sys_write(struct tcb *tcp)
SYS_FUNC(write)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[2]);
}
return 0;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[2]);
return RVAL_DECODED;
}
/*
@ -67,25 +64,9 @@ sys_write(struct tcb *tcp)
void
tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int decode_iov, unsigned long data_size)
{
#if SUPPORTED_PERSONALITIES > 1
union {
struct { u_int32_t base; u_int32_t len; } iov32;
struct { u_int64_t base; u_int64_t len; } iov64;
} iov;
#define sizeof_iov \
(current_wordsize == 4 ? sizeof(iov.iov32) : sizeof(iov.iov64))
#define iov_iov_base \
(current_wordsize == 4 ? (uint64_t) iov.iov32.base : iov.iov64.base)
#define iov_iov_len \
(current_wordsize == 4 ? (uint64_t) iov.iov32.len : iov.iov64.len)
#else
struct iovec iov;
#define sizeof_iov sizeof(iov)
#define iov_iov_base iov.iov_base
#define iov_iov_len iov.iov_len
#endif
unsigned long iov[2];
unsigned long size, cur, end, abbrev_end;
int failed = 0;
const unsigned long sizeof_iov = current_wordsize * 2;
if (!len) {
tprints("[]");
@ -93,8 +74,9 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
}
size = len * sizeof_iov;
end = addr + size;
if (!verbose(tcp) || size / sizeof_iov != len || end < addr) {
tprintf("%#lx", addr);
if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
!addr || size / sizeof_iov != len || end < addr) {
printaddr(addr);
return;
}
if (abbrev(tcp)) {
@ -112,28 +94,21 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
tprints("...");
break;
}
if (umoven(tcp, cur, sizeof_iov, (char *) &iov) < 0) {
tprints("?");
failed = 1;
if (umove_ulong_array_or_printaddr(tcp, cur, iov,
ARRAY_SIZE(iov)))
break;
}
tprints("{");
if (decode_iov) {
unsigned long len = iov_iov_len;
unsigned long len = iov[1];
if (len > data_size)
len = data_size;
data_size -= len;
printstr(tcp, (long) iov_iov_base, len);
printstr(tcp, iov[0], len);
} else
tprintf("%#lx", (long) iov_iov_base);
tprintf(", %lu}", (unsigned long)iov_iov_len);
printaddr(iov[0]);
tprintf(", %lu}", iov[1]);
}
tprints("]");
if (failed)
tprintf(" %#lx", addr);
#undef sizeof_iov
#undef iov_iov_base
#undef iov_iov_len
}
void
@ -142,34 +117,26 @@ tprint_iov(struct tcb *tcp, unsigned long len, unsigned long addr, int decode_io
tprint_iov_upto(tcp, len, addr, decode_iov, (unsigned long) -1L);
}
int
sys_readv(struct tcb *tcp)
SYS_FUNC(readv)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp)) {
tprintf("%#lx, %lu",
tcp->u_arg[1], tcp->u_arg[2]);
return 0;
}
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu", tcp->u_arg[2]);
}
return 0;
}
int
sys_writev(struct tcb *tcp)
SYS_FUNC(writev)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu", tcp->u_arg[2]);
}
return 0;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu", tcp->u_arg[2]);
return RVAL_DECODED;
}
/* The SH4 ABI does allow long longs in odd-numbered registers, but
@ -183,15 +150,14 @@ sys_writev(struct tcb *tcp)
#define PREAD_OFFSET_ARG 3
#endif
int
sys_pread(struct tcb *tcp)
SYS_FUNC(pread)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[1]);
printaddr(tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[2]);
@ -200,17 +166,15 @@ sys_pread(struct tcb *tcp)
return 0;
}
int
sys_pwrite(struct tcb *tcp)
SYS_FUNC(pwrite)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, ", tcp->u_arg[2]);
printllval(tcp, "%llu", PREAD_OFFSET_ARG);
}
return 0;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, ", tcp->u_arg[2]);
printllval(tcp, "%llu", PREAD_OFFSET_ARG);
return RVAL_DECODED;
}
static void
@ -218,7 +182,11 @@ print_llu_from_low_high_val(struct tcb *tcp, int arg)
{
#if 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("%lu", (unsigned long) tcp->u_arg[arg]);
# if SUPPORTED_PERSONALITIES > 1
@ -239,17 +207,12 @@ print_llu_from_low_high_val(struct tcb *tcp, int arg)
#endif
}
int
sys_preadv(struct tcb *tcp)
SYS_FUNC(preadv)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp)) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
return 0;
}
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
print_llu_from_low_high_val(tcp, 3);
@ -257,172 +220,67 @@ sys_preadv(struct tcb *tcp)
return 0;
}
int
sys_pwritev(struct tcb *tcp)
SYS_FUNC(pwritev)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
print_llu_from_low_high_val(tcp, 3);
}
return 0;
}
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
print_llu_from_low_high_val(tcp, 3);
static void
print_off_t(struct tcb *tcp, long addr)
{
unsigned long offset;
if (!addr) {
tprints("NULL");
return;
}
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
if (current_wordsize == 4) {
uint32_t off;
if (umove(tcp, addr, &off) < 0)
tprintf("%#lx", addr);
else
tprintf("[%u]", off);
} else
#endif
if (umove(tcp, addr, &offset) < 0)
tprintf("%#lx", addr);
else
tprintf("[%lu]", offset);
}
int
sys_sendfile(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
print_off_t(tcp, tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[3]);
}
return 0;
}
void
print_loff_t(struct tcb *tcp, long addr)
{
loff_t offset;
if (!addr)
tprints("NULL");
else if (umove(tcp, addr, &offset) < 0)
tprintf("%#lx", addr);
else
tprintf("[%llu]", (unsigned long long int) offset);
}
int
sys_sendfile64(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
print_loff_t(tcp, tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[3]);
}
return 0;
return RVAL_DECODED;
}
#include "xlat/splice_flags.h"
int
sys_tee(struct tcb *tcp)
SYS_FUNC(tee)
{
if (entering(tcp)) {
/* int fd_in */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* int fd_out */
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
}
return 0;
/* int fd_in */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* int fd_out */
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
return RVAL_DECODED;
}
int
sys_splice(struct tcb *tcp)
SYS_FUNC(splice)
{
if (entering(tcp)) {
/* int fd_in */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* loff_t *off_in */
print_loff_t(tcp, tcp->u_arg[1]);
tprints(", ");
/* int fd_out */
printfd(tcp, tcp->u_arg[2]);
tprints(", ");
/* loff_t *off_out */
print_loff_t(tcp, tcp->u_arg[3]);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[4]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[5], "SPLICE_F_???");
}
return 0;
/* int fd_in */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* loff_t *off_in */
printnum_int64(tcp, tcp->u_arg[1], "%" PRIu64);
tprints(", ");
/* int fd_out */
printfd(tcp, tcp->u_arg[2]);
tprints(", ");
/* loff_t *off_out */
printnum_int64(tcp, tcp->u_arg[3], "%" PRIu64);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[4]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[5], "SPLICE_F_???");
return RVAL_DECODED;
}
int
sys_vmsplice(struct tcb *tcp)
SYS_FUNC(vmsplice)
{
if (entering(tcp)) {
/* int fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* const struct iovec *iov, unsigned long nr_segs */
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
}
return 0;
}
/* int fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* const struct iovec *iov, unsigned long nr_segs */
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
int
sys_ioctl(struct tcb *tcp)
{
const struct_ioctlent *iop;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
if (!ioctl_decode_command_number(tcp->u_arg[1])) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else {
ioctl_print_code(tcp->u_arg[1]);
}
}
ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
}
else {
int ret = ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
if (!ret)
tprintf(", %#lx", tcp->u_arg[2]);
else
return ret - 1;
}
return 0;
return RVAL_DECODED;
}

185
ioctl.c
View File

@ -29,7 +29,7 @@
*/
#include "defs.h"
#include <asm/ioctl.h>
#include <linux/ioctl.h>
#include "xlat/ioctl_dirs.h"
#ifdef HAVE_LINUX_INPUT_H
@ -47,7 +47,7 @@ compare(const void *a, const void *b)
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
const struct_ioctlent *
static const struct_ioctlent *
ioctl_lookup(const unsigned int code)
{
struct_ioctlent *iop;
@ -64,7 +64,7 @@ ioctl_lookup(const unsigned int code)
return iop;
}
const struct_ioctlent *
static const struct_ioctlent *
ioctl_next_match(const struct_ioctlent *iop)
{
const unsigned int code = iop->code;
@ -74,7 +74,7 @@ ioctl_next_match(const struct_ioctlent *iop)
return NULL;
}
void
static void
ioctl_print_code(const unsigned int code)
{
tprints("_IOC(");
@ -84,11 +84,11 @@ ioctl_print_code(const unsigned int code)
}
static int
evdev_decode_number(unsigned int arg)
evdev_decode_number(const unsigned int code)
{
unsigned int nr = _IOC_NR(arg);
const unsigned int nr = _IOC_NR(code);
if (_IOC_DIR(arg) == _IOC_WRITE) {
if (_IOC_DIR(code) == _IOC_WRITE) {
if (nr >= 0xc0 && nr <= 0xc0 + 0x3f) {
tprints("EVIOCSABS(");
printxval(evdev_abs, nr - 0xc0, "EV_???");
@ -97,13 +97,13 @@ evdev_decode_number(unsigned int arg)
}
}
if (_IOC_DIR(arg) != _IOC_READ)
if (_IOC_DIR(code) != _IOC_READ)
return 0;
if (nr >= 0x20 && nr <= 0x20 + 0x1f) {
tprints("EVIOCGBIT(");
printxval(evdev_ev, nr - 0x20, "EV_???");
tprintf(", %u)", _IOC_SIZE(arg));
tprintf(", %u)", _IOC_SIZE(code));
return 1;
} else if (nr >= 0x40 && nr <= 0x40 + 0x3f) {
tprints("EVIOCGABS(");
@ -114,31 +114,31 @@ evdev_decode_number(unsigned int arg)
switch (_IOC_NR(nr)) {
case 0x06:
tprintf("EVIOCGNAME(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGNAME(%u)", _IOC_SIZE(code));
return 1;
case 0x07:
tprintf("EVIOCGPHYS(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGPHYS(%u)", _IOC_SIZE(code));
return 1;
case 0x08:
tprintf("EVIOCGUNIQ(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGUNIQ(%u)", _IOC_SIZE(code));
return 1;
case 0x09:
tprintf("EVIOCGPROP(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGPROP(%u)", _IOC_SIZE(code));
return 1;
case 0x0a:
tprintf("EVIOCGMTSLOTS(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGMTSLOTS(%u)", _IOC_SIZE(code));
return 1;
case 0x18:
tprintf("EVIOCGKEY(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGKEY(%u)", _IOC_SIZE(code));
return 1;
case 0x19:
tprintf("EVIOCGLED(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGLED(%u)", _IOC_SIZE(code));
return 1;
case 0x1a:
tprintf("EVIOCGSND(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGSND(%u)", _IOC_SIZE(code));
return 1;
case 0x1b:
tprintf("EVIOCGSW(%u)", _IOC_SIZE(arg));
tprintf("EVIOCGSW(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
@ -146,32 +146,32 @@ evdev_decode_number(unsigned int arg)
}
static int
hiddev_decode_number(unsigned int arg)
hiddev_decode_number(const unsigned int code)
{
if (_IOC_DIR(arg) == _IOC_READ) {
switch (_IOC_NR(arg)) {
if (_IOC_DIR(code) == _IOC_READ) {
switch (_IOC_NR(code)) {
case 0x04:
tprintf("HIDIOCGRAWNAME(%u)", _IOC_SIZE(arg));
tprintf("HIDIOCGRAWNAME(%u)", _IOC_SIZE(code));
return 1;
case 0x05:
tprintf("HIDIOCGRAWPHYS(%u)", _IOC_SIZE(arg));
tprintf("HIDIOCGRAWPHYS(%u)", _IOC_SIZE(code));
return 1;
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(arg));
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(code));
return 1;
case 0x12:
tprintf("HIDIOCGPHYS(%u)", _IOC_SIZE(arg));
tprintf("HIDIOCGPHYS(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
}
} else if (_IOC_DIR(arg) == (_IOC_READ | _IOC_WRITE)) {
switch (_IOC_NR(arg)) {
} else if (_IOC_DIR(code) == (_IOC_READ | _IOC_WRITE)) {
switch (_IOC_NR(code)) {
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(arg));
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(code));
return 1;
case 0x07:
tprintf("HIDIOCGFEATURE(%u)", _IOC_SIZE(arg));
tprintf("HIDIOCGFEATURE(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
@ -181,38 +181,40 @@ hiddev_decode_number(unsigned int arg)
return 0;
}
int
ioctl_decode_command_number(unsigned int arg)
static int
ioctl_decode_command_number(struct tcb *tcp)
{
switch (_IOC_TYPE(arg)) {
const unsigned int code = tcp->u_arg[1];
switch (_IOC_TYPE(code)) {
case 'E':
return evdev_decode_number(arg);
return evdev_decode_number(code);
case 'H':
return hiddev_decode_number(arg);
return hiddev_decode_number(code);
case 'M':
if (_IOC_DIR(arg) == _IOC_WRITE) {
tprintf("MIXER_WRITE(%u)", _IOC_NR(arg));
if (_IOC_DIR(code) == _IOC_WRITE) {
tprintf("MIXER_WRITE(%u)", _IOC_NR(code));
return 1;
} else if (_IOC_DIR(arg) == _IOC_READ) {
tprintf("MIXER_READ(%u)", _IOC_NR(arg));
} else if (_IOC_DIR(code) == _IOC_READ) {
tprintf("MIXER_READ(%u)", _IOC_NR(code));
return 1;
}
return 0;
case 'U':
if (_IOC_DIR(arg) == _IOC_READ && _IOC_NR(arg) == 0x2c) {
tprintf("UI_GET_SYSNAME(%u)", _IOC_SIZE(arg));
if (_IOC_DIR(code) == _IOC_READ && _IOC_NR(code) == 0x2c) {
tprintf("UI_GET_SYSNAME(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case 'j':
if (_IOC_DIR(arg) == _IOC_READ && _IOC_NR(arg) == 0x13) {
tprintf("JSIOCGNAME(%u)", _IOC_SIZE(arg));
if (_IOC_DIR(code) == _IOC_READ && _IOC_NR(code) == 0x13) {
tprintf("JSIOCGNAME(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case 'k':
if (_IOC_DIR(arg) == _IOC_WRITE && _IOC_NR(arg) == 0) {
tprintf("SPI_IOC_MESSAGE(%u)", _IOC_SIZE(arg));
if (_IOC_DIR(code) == _IOC_WRITE && _IOC_NR(code) == 0) {
tprintf("SPI_IOC_MESSAGE(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
@ -221,9 +223,12 @@ ioctl_decode_command_number(unsigned int arg)
}
}
int
ioctl_decode(struct tcb *tcp, unsigned int code, long arg)
static int
ioctl_decode(struct tcb *tcp)
{
const unsigned int code = tcp->u_arg[1];
const long arg = tcp->u_arg[2];
switch (_IOC_TYPE(code)) {
#if defined(ALPHA) || defined(POWERPC)
case 'f': case 't': case 'T':
@ -264,51 +269,43 @@ ioctl_decode(struct tcb *tcp, unsigned int code, long arg)
return 0;
}
/*
* Registry of ioctl characters, culled from
* @(#)ioccom.h 1.7 89/06/16 SMI; from UCB ioctl.h 7.1 6/4/86
*
* char file where defined notes
* ---- ------------------ -----
* F sun/fbio.h
* G sun/gpio.h
* H vaxif/if_hy.h
* M sundev/mcpcmd.h *overlap*
* M sys/modem.h *overlap*
* S sys/stropts.h
* T sys/termio.h -no overlap-
* T sys/termios.h -no overlap-
* V sundev/mdreg.h
* a vaxuba/adreg.h
* d sun/dkio.h -no overlap with sys/des.h-
* d sys/des.h (possible overlap)
* d vax/dkio.h (possible overlap)
* d vaxuba/rxreg.h (possible overlap)
* f sys/filio.h
* g sunwindow/win_ioctl.h -no overlap-
* g sunwindowdev/winioctl.c !no manifest constant! -no overlap-
* h sundev/hrc_common.h
* i sys/sockio.h *overlap*
* i vaxuba/ikreg.h *overlap*
* k sundev/kbio.h
* m sundev/msio.h (possible overlap)
* m sundev/msreg.h (possible overlap)
* m sys/mtio.h (possible overlap)
* n sun/ndio.h
* p net/nit_buf.h (possible overlap)
* p net/nit_if.h (possible overlap)
* p net/nit_pf.h (possible overlap)
* p sundev/fpareg.h (possible overlap)
* p sys/sockio.h (possible overlap)
* p vaxuba/psreg.h (possible overlap)
* q sun/sqz.h
* r sys/sockio.h
* s sys/sockio.h
* t sys/ttold.h (possible overlap)
* t sys/ttycom.h (possible overlap)
* v sundev/vuid_event.h *overlap*
* v sys/vcmd.h *overlap*
* V linux/videodev2.h
*
* End of Registry
*/
SYS_FUNC(ioctl)
{
const struct_ioctlent *iop;
int ret;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
ret = ioctl_decode_command_number(tcp);
if (!(ret & IOCTL_NUMBER_STOP_LOOKUP)) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
if (ret)
tprints(" or ");
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else if (!ret) {
ioctl_print_code(tcp->u_arg[1]);
}
}
ret = ioctl_decode(tcp);
} else {
ret = ioctl_decode(tcp) | RVAL_DECODED;
}
if (ret & RVAL_DECODED) {
ret &= ~RVAL_DECODED;
if (ret)
--ret;
else
tprintf(", %#lx", tcp->u_arg[2]);
ret |= RVAL_DECODED;
} else {
if (ret)
--ret;
}
return ret;
}

View File

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

9
ioperm.c Normal file
View File

@ -0,0 +1,9 @@
#include "defs.h"
SYS_FUNC(ioperm)
{
tprintf("%#lx, %#lx, %d",
tcp->u_arg[0], tcp->u_arg[1], (int) tcp->u_arg[2]);
return RVAL_DECODED;
}

8
iopl.c Normal file
View File

@ -0,0 +1,8 @@
#include "defs.h"
SYS_FUNC(iopl)
{
tprintf("%d", (int) tcp->u_arg[0]);
return RVAL_DECODED;
}

View File

@ -1,3 +1,30 @@
/*
* Copyright (c) 2015 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.
*/
#include "defs.h"
enum {
@ -42,8 +69,7 @@ sprint_ioprio(int ioprio)
return outstr;
}
int
sys_ioprio_get(struct tcb *tcp)
SYS_FUNC(ioprio_get)
{
if (entering(tcp)) {
/* int which */
@ -60,16 +86,14 @@ sys_ioprio_get(struct tcb *tcp)
}
}
int
sys_ioprio_set(struct tcb *tcp)
SYS_FUNC(ioprio_set)
{
if (entering(tcp)) {
/* int which */
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
/* int who */
tprintf(", %d, ", (int) tcp->u_arg[1]);
/* int ioprio */
tprints(sprint_ioprio(tcp->u_arg[2]));
}
return 0;
/* int which */
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
/* int who */
tprintf(", %d, ", (int) tcp->u_arg[1]);
/* int ioprio */
tprints(sprint_ioprio(tcp->u_arg[2]));
return RVAL_DECODED;
}

455
ipc.c
View File

@ -1,455 +0,0 @@
/*
* Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* 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_MQUEUE_H
# include <mqueue.h>
#endif
#include <fcntl.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/msg.h>
#include <sys/shm.h>
#ifndef MSG_STAT
#define MSG_STAT 11
#endif
#ifndef MSG_INFO
#define MSG_INFO 12
#endif
#ifndef SHM_STAT
#define SHM_STAT 13
#endif
#ifndef SHM_INFO
#define SHM_INFO 14
#endif
#ifndef SEM_STAT
#define SEM_STAT 18
#endif
#ifndef SEM_INFO
#define SEM_INFO 19
#endif
#if !defined IPC_64
# define IPC_64 0x100
#endif
extern void printsigevent(struct tcb *tcp, long arg);
#include "xlat/msgctl_flags.h"
#include "xlat/semctl_flags.h"
#include "xlat/shmctl_flags.h"
#include "xlat/resource_flags.h"
#include "xlat/shm_resource_flags.h"
#include "xlat/shm_flags.h"
#include "xlat/ipc_msg_flags.h"
#include "xlat/semop_flags.h"
int sys_msgget(struct tcb *tcp)
{
if (entering(tcp)) {
if (tcp->u_arg[0])
tprintf("%#lx, ", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE, ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[1] & 0777);
}
return 0;
}
#ifdef IPC_64
# define PRINTCTL(flagset, arg, dflt) \
if ((arg) & IPC_64) tprints("IPC_64|"); \
printxval((flagset), (arg) &~ IPC_64, dflt)
#else
# define PRINTCTL printxval
#endif
static int
indirect_ipccall(struct tcb *tcp)
{
return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
}
int sys_msgctl(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
tprintf(", %#lx", tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2]);
}
return 0;
}
static void
tprint_msgsnd(struct tcb *tcp, long addr, unsigned long count,
unsigned long flags)
{
long mtype;
if (umove(tcp, addr, &mtype) < 0) {
tprintf("%#lx", addr);
} else {
tprintf("{%lu, ", mtype);
printstr(tcp, addr + sizeof(mtype), count);
tprints("}");
}
tprintf(", %lu, ", count);
printflags(ipc_msg_flags, flags, "MSG_???");
}
int sys_msgsnd(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%d, ", (int) tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_msgsnd(tcp, tcp->u_arg[3], tcp->u_arg[1],
tcp->u_arg[2]);
} else {
tprint_msgsnd(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3]);
}
}
return 0;
}
static void
tprint_msgrcv(struct tcb *tcp, long addr, unsigned long count, long msgtyp)
{
long mtype;
if (syserror(tcp) || umove(tcp, addr, &mtype) < 0) {
tprintf("%#lx", addr);
} else {
tprintf("{%lu, ", mtype);
printstr(tcp, addr + sizeof(mtype), count);
tprints("}");
}
tprintf(", %lu, %ld, ", count, msgtyp);
}
int sys_msgrcv(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%d, ", (int) tcp->u_arg[0]);
} else {
if (indirect_ipccall(tcp)) {
struct ipc_wrapper {
struct msgbuf *msgp;
long msgtyp;
} tmp;
if (umove(tcp, tcp->u_arg[3], &tmp) < 0) {
tprintf("%#lx, %lu, ",
tcp->u_arg[3], tcp->u_arg[1]);
} else {
tprint_msgrcv(tcp, (long) tmp.msgp,
tcp->u_arg[1], tmp.msgtyp);
}
printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
} else {
tprint_msgrcv(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
}
}
return 0;
}
static void
tprint_sembuf(struct tcb *tcp, long addr, unsigned long count)
{
unsigned long i, max_count;
if (abbrev(tcp))
max_count = (max_strlen < count) ? max_strlen : count;
else
max_count = count;
if (!max_count) {
tprintf("%#lx, %lu", addr, count);
return;
}
for (i = 0; i < max_count; ++i) {
struct sembuf sb;
if (i)
tprints(", ");
if (umove(tcp, addr + i * sizeof(struct sembuf), &sb) < 0) {
if (i) {
tprints("{???}");
break;
} else {
tprintf("%#lx, %lu", addr, count);
return;
}
} else {
if (!i)
tprints("{");
tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
printflags(semop_flags, sb.sem_flg, "SEM_???");
tprints("}");
}
}
if (i < max_count || max_count < count)
tprints(", ...");
tprintf("}, %lu", count);
}
int sys_semop(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
} else {
tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
}
}
return 0;
}
int sys_semtimedop(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
tprints(", ");
#if defined(S390) || defined(S390X)
printtv(tcp, tcp->u_arg[2]);
#else
printtv(tcp, tcp->u_arg[4]);
#endif
} else {
tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
}
}
return 0;
}
int sys_semget(struct tcb *tcp)
{
if (entering(tcp)) {
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
}
return 0;
}
int sys_semctl(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
tprintf(", %#lx", tcp->u_arg[3]);
}
return 0;
}
int sys_shmget(struct tcb *tcp)
{
if (entering(tcp)) {
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
}
return 0;
}
int sys_shmctl(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
if (indirect_ipccall(tcp)) {
tprintf(", %#lx", tcp->u_arg[3]);
} else {
tprintf(", %#lx", tcp->u_arg[2]);
}
}
return 0;
}
int sys_shmat(struct tcb *tcp)
{
if (exiting(tcp)) {
tprintf("%lu", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprintf(", %#lx, ", tcp->u_arg[3]);
printflags(shm_flags, tcp->u_arg[1], "SHM_???");
} else {
tprintf(", %#lx, ", tcp->u_arg[1]);
printflags(shm_flags, tcp->u_arg[2], "SHM_???");
}
if (syserror(tcp))
return 0;
if (indirect_ipccall(tcp)) {
unsigned long raddr;
if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
return RVAL_NONE;
tcp->u_rval = raddr;
}
return RVAL_HEX;
}
return 0;
}
int sys_shmdt(struct tcb *tcp)
{
if (entering(tcp)) {
if (indirect_ipccall(tcp)) {
tprintf("%#lx", tcp->u_arg[3]);
} else {
tprintf("%#lx", tcp->u_arg[0]);
}
}
return 0;
}
int
sys_mq_open(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
/* flags */
tprint_open_modes(tcp->u_arg[1]);
if (tcp->u_arg[1] & O_CREAT) {
# ifndef HAVE_MQUEUE_H
tprintf(", %lx", tcp->u_arg[2]);
# else
struct mq_attr attr;
/* mode */
tprintf(", %#lo, ", tcp->u_arg[2]);
if (umove(tcp, tcp->u_arg[3], &attr) < 0)
tprints("{???}");
else
tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
(long) attr.mq_maxmsg,
(long) attr.mq_msgsize);
# endif
}
}
return 0;
}
int
sys_mq_timedsend(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
printtv(tcp, tcp->u_arg[4]);
}
return 0;
}
int
sys_mq_timedreceive(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%ld, ", tcp->u_arg[0]);
else {
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, %ld, ", tcp->u_arg[2], tcp->u_arg[3]);
printtv(tcp, tcp->u_arg[4]);
}
return 0;
}
int
sys_mq_notify(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printsigevent(tcp, tcp->u_arg[1]);
}
return 0;
}
static void
printmqattr(struct tcb *tcp, long addr)
{
if (addr == 0)
tprints("NULL");
else {
# ifndef HAVE_MQUEUE_H
tprintf("%#lx", addr);
# else
struct mq_attr attr;
if (umove(tcp, addr, &attr) < 0) {
tprints("{...}");
return;
}
tprints("{mq_flags=");
tprint_open_modes(attr.mq_flags);
tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
(long) attr.mq_maxmsg, (long) attr.mq_msgsize,
(long) attr.mq_curmsgs);
# endif
}
}
int
sys_mq_getsetattr(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printmqattr(tcp, tcp->u_arg[1]);
tprints(", ");
} else
printmqattr(tcp, tcp->u_arg[2]);
return 0;
}
int
sys_ipc(struct tcb *tcp)
{
return printargs(tcp);
}

42
ipc_defs.h Normal file
View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2003 Roland McGrath <roland@redhat.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.
*/
#ifdef HAVE_SYS_IPC_H
# include <sys/ipc.h>
#elif defined HAVE_LINUX_IPC_H
# include <linux/ipc.h>
/* While glibc uses __key, the kernel uses key. */
# define __key key
#endif
#if !defined IPC_64
# define IPC_64 0x100
#endif
#define PRINTCTL(flagset, arg, dflt) \
if ((arg) & IPC_64) tprints("IPC_64|"); \
printxval((flagset), (arg) &~ IPC_64, dflt)

123
ipc_msg.c Normal file
View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#include "ipc_defs.h"
#ifdef HAVE_SYS_MSG_H
# include <sys/msg.h>
#elif defined HAVE_LINUX_MSG_H
# include <linux/msg.h>
#endif
#include "xlat/ipc_msg_flags.h"
#include "xlat/resource_flags.h"
SYS_FUNC(msgget)
{
if (tcp->u_arg[0])
tprintf("%#lx, ", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE, ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[1] & 0777);
return RVAL_DECODED;
}
static void
tprint_msgsnd(struct tcb *tcp, const long addr, const unsigned long count,
const unsigned long flags)
{
tprint_msgbuf(tcp, addr, count);
printflags(ipc_msg_flags, flags, "MSG_???");
}
SYS_FUNC(msgsnd)
{
tprintf("%d, ", (int) tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_msgsnd(tcp, tcp->u_arg[3], tcp->u_arg[1],
tcp->u_arg[2]);
} else {
tprint_msgsnd(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3]);
}
return RVAL_DECODED;
}
static void
tprint_msgrcv(struct tcb *tcp, const long addr, const unsigned long count,
const long msgtyp)
{
tprint_msgbuf(tcp, addr, count);
tprintf("%ld, ", msgtyp);
}
static int
fetch_msgrcv_args(struct tcb *tcp, const long addr, long *pair)
{
if (current_wordsize == sizeof(long)) {
if (umoven_or_printaddr(tcp, addr, 2 * sizeof(long), pair))
return -1;
} else {
unsigned int tmp[2];
if (umove_or_printaddr(tcp, addr, &tmp))
return -1;
pair[0] = tmp[0];
pair[1] = tmp[1];
}
return 0;
}
SYS_FUNC(msgrcv)
{
if (entering(tcp)) {
tprintf("%d, ", (int) tcp->u_arg[0]);
} else {
if (indirect_ipccall(tcp)) {
long pair[2];
if (fetch_msgrcv_args(tcp, tcp->u_arg[3], pair))
tprintf(", %lu, ", tcp->u_arg[1]);
else
tprint_msgrcv(tcp, pair[0], tcp->u_arg[1], pair[1]);
printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
} else {
tprint_msgrcv(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
}
}
return 0;
}

108
ipc_msgctl.c Normal file
View File

@ -0,0 +1,108 @@
/*
* Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#include DEF_MPERS_TYPE(msqid_ds_t)
#include "ipc_defs.h"
#ifdef HAVE_SYS_MSG_H
/* The C library generally exports the struct the current kernel expects. */
# include <sys/msg.h>
typedef struct msqid_ds msqid_ds_t;
#elif defined HAVE_LINUX_MSG_H
/* The linux header might provide the right struct. */
# include <linux/msg.h>
typedef struct msqid64_ds msqid_ds_t;
#endif
#include MPERS_DEFS
#include "xlat/msgctl_flags.h"
static void
print_msqid_ds(struct tcb *tcp, const long addr, int cmd)
{
/* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
cmd &= ~IPC_64;
msqid_ds_t msqid_ds;
switch (cmd) {
case IPC_SET:
case IPC_STAT:
if (umove_or_printaddr(tcp, addr, &msqid_ds))
return;
tprints("{msg_perm={");
printuid("uid=", msqid_ds.msg_perm.uid);
printuid(", gid=", msqid_ds.msg_perm.gid);
tprints(", mode=");
tprints(sprintmode(msqid_ds.msg_perm.mode));
if (cmd != IPC_STAT) {
tprints("}, ...}");
break;
}
tprintf(", key=%u", (unsigned) msqid_ds.msg_perm.__key);
printuid(", cuid=", msqid_ds.msg_perm.cuid);
printuid(", cgid=", msqid_ds.msg_perm.cgid);
tprints("}");
tprintf(", msg_stime=%u", (unsigned) msqid_ds.msg_stime);
tprintf(", msg_rtime=%u", (unsigned) msqid_ds.msg_rtime);
tprintf(", msg_ctime=%u", (unsigned) msqid_ds.msg_ctime);
tprintf(", msg_qnum=%u", (unsigned) msqid_ds.msg_qnum);
tprintf(", msg_qbytes=%u", (unsigned) msqid_ds.msg_qbytes);
tprintf(", msg_lspid=%u", (unsigned) msqid_ds.msg_lspid);
tprintf(", msg_lrpid=%u", (unsigned) msqid_ds.msg_lrpid);
tprints("}");
break;
default:
printaddr(addr);
break;
}
}
SYS_FUNC(msgctl)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
tprints(", ");
} else {
const long addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
print_msqid_ds(tcp, addr, tcp->u_arg[1]);
}
return 0;
}

148
ipc_sem.c Normal file
View File

@ -0,0 +1,148 @@
/*
* Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#include "ipc_defs.h"
#ifdef HAVE_SYS_SEM_H
# include <sys/sem.h>
#elif defined HAVE_LINUX_SEM_H
# include <linux/sem.h>
#endif
#include "xlat/semctl_flags.h"
#include "xlat/semop_flags.h"
#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
static void
tprint_sembuf(const struct sembuf *sb)
{
tprintf("{%u, %d, ", sb->sem_num, sb->sem_op);
printflags(semop_flags, sb->sem_flg, "SEM_???");
tprints("}");
}
#endif
static void
tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
{
#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
unsigned long max_count;
struct sembuf sb;
if (abbrev(tcp))
max_count = (max_strlen < count) ? max_strlen : count;
else
max_count = count;
if (!max_count)
printaddr(addr);
else if (!umove_or_printaddr(tcp, addr, &sb)) {
unsigned long i;
tprints("[");
tprint_sembuf(&sb);
for (i = 1; i < max_count; ++i) {
tprints(", ");
if (umove_or_printaddr(tcp, addr + i * sizeof(sb), &sb))
break;
else
tprint_sembuf(&sb);
}
if (i < max_count || max_count < count)
tprints(", ...");
tprints("]");
}
#else
printaddr(addr);
#endif
tprintf(", %lu", count);
}
SYS_FUNC(semop)
{
tprintf("%lu, ", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
} else {
tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
}
return RVAL_DECODED;
}
SYS_FUNC(semtimedop)
{
tprintf("%lu, ", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
tprints(", ");
#if defined(S390) || defined(S390X)
print_timespec(tcp, tcp->u_arg[2]);
#else
print_timespec(tcp, tcp->u_arg[4]);
#endif
} else {
tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprints(", ");
print_timespec(tcp, tcp->u_arg[3]);
}
return RVAL_DECODED;
}
SYS_FUNC(semget)
{
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
return RVAL_DECODED;
}
SYS_FUNC(semctl)
{
tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
tprints(", ");
if (indirect_ipccall(tcp)) {
printnum_ptr(tcp, tcp->u_arg[3]);
} else {
tprintf("%#lx", tcp->u_arg[3]);
}
return RVAL_DECODED;
}

88
ipc_shm.c Normal file
View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#ifdef HAVE_SYS_SHM_H
# include <sys/shm.h>
#elif defined HAVE_LINUX_SHM_H
# include <linux/shm.h>
#endif
#include "xlat/shm_resource_flags.h"
#include "xlat/shm_flags.h"
SYS_FUNC(shmget)
{
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
return RVAL_DECODED;
}
SYS_FUNC(shmat)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
printaddr(tcp->u_arg[3]);
tprints(", ");
printflags(shm_flags, tcp->u_arg[1], "SHM_???");
} else {
printaddr(tcp->u_arg[1]);
tprints(", ");
printflags(shm_flags, tcp->u_arg[2], "SHM_???");
}
return 0;
} else {
if (syserror(tcp))
return 0;
if (indirect_ipccall(tcp)) {
unsigned long raddr;
if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
return RVAL_NONE;
tcp->u_rval = raddr;
}
return RVAL_HEX;
}
}
SYS_FUNC(shmdt)
{
printaddr(tcp->u_arg[indirect_ipccall(tcp) ? 3 : 0]);
return RVAL_DECODED;
}

108
ipc_shmctl.c Normal file
View File

@ -0,0 +1,108 @@
/*
* Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#include DEF_MPERS_TYPE(shmid_ds_t)
#include "ipc_defs.h"
#ifdef HAVE_SYS_SHM_H
/* The C library generally exports the struct the current kernel expects. */
# include <sys/shm.h>
typedef struct shmid_ds shmid_ds_t;
#elif defined HAVE_LINUX_SHM_H
/* The linux header might provide the right struct. */
# include <linux/shm.h>
typedef struct shmid64_ds shmid_ds_t;
#endif
#include MPERS_DEFS
#include "xlat/shmctl_flags.h"
static void
print_shmid_ds(struct tcb *tcp, const long addr, int cmd)
{
/* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
cmd &= ~IPC_64;
shmid_ds_t shmid_ds;
switch (cmd) {
case IPC_SET:
case IPC_STAT:
if (umove_or_printaddr(tcp, addr, &shmid_ds))
return;
tprints("{shm_perm={");
printuid("uid=", shmid_ds.shm_perm.uid);
printuid(", gid=", shmid_ds.shm_perm.gid);
tprints(", mode=");
tprints(sprintmode(shmid_ds.shm_perm.mode));
if (cmd != IPC_STAT) {
tprints("}, ...}");
break;
}
tprintf(", key=%u", (unsigned) shmid_ds.shm_perm.__key);
printuid(", cuid=", shmid_ds.shm_perm.cuid);
printuid(", cgid=", shmid_ds.shm_perm.cgid);
tprints("}");
tprintf(", shm_segsz=%u", (unsigned) shmid_ds.shm_segsz);
tprintf(", shm_cpid=%u", (unsigned) shmid_ds.shm_cpid);
tprintf(", shm_lpid=%u", (unsigned) shmid_ds.shm_lpid);
tprintf(", shm_nattch=%u", (unsigned) shmid_ds.shm_nattch);
tprintf(", shm_atime=%u", (unsigned) shmid_ds.shm_atime);
tprintf(", shm_dtime=%u", (unsigned) shmid_ds.shm_dtime);
tprintf(", shm_ctime=%u", (unsigned) shmid_ds.shm_ctime);
tprints("}");
break;
default:
printaddr(addr);
break;
}
}
SYS_FUNC(shmctl)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
tprints(", ");
} else {
const long addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
print_shmid_ds(tcp, addr, tcp->u_arg[1]);
}
return 0;
}

58
kcmp.c Normal file
View File

@ -0,0 +1,58 @@
/*
* Copyright (c) 2015 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.
*/
#include "defs.h"
#include "xlat/kcmp_types.h"
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];
tprintf("%d, %d, ", pid1, pid2);
printxval(kcmp_types, type, "KCMP_???");
switch(type) {
case KCMP_FILE:
tprintf(", %u, %u", (unsigned) idx1, (unsigned) idx2);
break;
case KCMP_FILES:
case KCMP_FS:
case KCMP_IO:
case KCMP_SIGHAND:
case KCMP_SYSVSEM:
case KCMP_VM:
break;
default:
tprintf(", %#lx, %#lx", idx1, idx2);
}
return RVAL_DECODED;
}

58
kernel_types.h Normal file
View File

@ -0,0 +1,58 @@
/*
* Copyright (c) 2015 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.
*/
#ifndef STRACE_KERNEL_TYPES_H
# define STRACE_KERNEL_TYPES_H
# if defined HAVE___KERNEL_LONG_T && defined HAVE___KERNEL_ULONG_T
# include <asm/posix_types.h>
typedef __kernel_long_t kernel_long_t;
typedef __kernel_ulong_t kernel_ulong_t;
# elif defined __x86_64__ && defined __ILP32__
typedef long long kernel_long_t;
typedef unsigned long long kernel_ulong_t;
# else
typedef long kernel_long_t;
typedef unsigned long kernel_ulong_t;
# endif
typedef struct {
kernel_ulong_t d_ino;
kernel_ulong_t d_off;
unsigned short d_reclen;
char d_name[1];
} kernel_dirent;
#endif

132
kexec.c
View File

@ -1,3 +1,30 @@
/*
* Copyright (c) 2014-2015 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.
*/
#include "defs.h"
#include "xlat/kexec_load_flags.h"
@ -11,37 +38,22 @@
#endif
static void
print_kexec_segments(struct tcb *tcp, unsigned long addr, unsigned long len)
print_seg(const unsigned long *seg)
{
#if SUPPORTED_PERSONALITIES > 1
union {
struct { u_int32_t buf, bufsz, mem, memsz; } seg32;
struct { u_int64_t buf, bufsz, mem, memsz; } seg64;
} seg;
# define sizeof_seg \
(current_wordsize == 4 ? sizeof(seg.seg32) : sizeof(seg.seg64))
# define seg_buf \
(current_wordsize == 4 ? (uint64_t) seg.seg32.buf : seg.seg64.buf)
# define seg_bufsz \
(current_wordsize == 4 ? (uint64_t) seg.seg32.bufsz : seg.seg64.bufsz)
# define seg_mem \
(current_wordsize == 4 ? (uint64_t) seg.seg32.mem : seg.seg64.mem)
# define seg_memsz \
(current_wordsize == 4 ? (uint64_t) seg.seg32.memsz : seg.seg64.memsz)
#else
struct {
void *buf;
size_t bufsz;
void *mem;
size_t memsz;
} seg;
# define sizeof_seg sizeof(seg)
# define seg_buf seg.buf
# define seg_bufsz seg.bufsz
# define seg_mem seg.mem
# define seg_memsz seg.memsz
#endif
unsigned int i, failed;
tprints("{");
printaddr(seg[0]);
tprintf(", %lu, ", seg[1]);
printaddr(seg[2]);
tprintf(", %lu}", seg[3]);
}
static void
print_kexec_segments(struct tcb *tcp, const unsigned long addr,
const unsigned long len)
{
unsigned long seg[4];
const size_t sizeof_seg = ARRAY_SIZE(seg) * current_wordsize;
unsigned int i;
if (!len) {
tprints("[]");
@ -49,40 +61,35 @@ print_kexec_segments(struct tcb *tcp, unsigned long addr, unsigned long len)
}
if (len > KEXEC_SEGMENT_MAX) {
tprintf("%#lx", addr);
printaddr(addr);
return;
}
failed = 0;
if (umove_ulong_array_or_printaddr(tcp, addr, seg, ARRAY_SIZE(seg)))
return;
tprints("[");
for (i = 0; i < len; ++i) {
if (i)
tprints(", ");
if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg,
(char *) &seg) < 0) {
tprints("?");
failed = 1;
print_seg(seg);
for (i = 1; i < len; ++i) {
tprints(", ");
if (umove_ulong_array_or_printaddr(tcp,
addr + i * sizeof_seg,
seg, ARRAY_SIZE(seg)))
break;
}
tprintf("{%#lx, %lu, %#lx, %lu}",
(long) seg_buf, (unsigned long) seg_bufsz,
(long) seg_mem, (unsigned long) seg_memsz);
print_seg(seg);
}
tprints("]");
if (failed)
tprintf(" %#lx", addr);
}
int
sys_kexec_load(struct tcb *tcp)
SYS_FUNC(kexec_load)
{
unsigned long n;
if (exiting(tcp))
return 0;
/* entry, nr_segments */
tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
printaddr(tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
/* segments */
print_kexec_segments(tcp, tcp->u_arg[2], tcp->u_arg[1]);
@ -97,5 +104,26 @@ sys_kexec_load(struct tcb *tcp)
printflags(kexec_load_flags, n, "KEXEC_???");
}
return 0;
return RVAL_DECODED;
}
#include "xlat/kexec_file_load_flags.h"
SYS_FUNC(kexec_file_load)
{
/* kernel_fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* initrd_fd */
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* cmdline_len */
tprintf("%lu, ", tcp->u_arg[2]);
/* cmdline */
printstr(tcp, tcp->u_arg[3], tcp->u_arg[2]);
tprints(", ");
/* flags */
printflags(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
return RVAL_DECODED;
}

396
keyctl.c
View File

@ -1,3 +1,30 @@
/*
* Copyright (c) 2014-2015 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.
*/
#include "defs.h"
typedef int32_t key_serial_t;
@ -15,111 +42,74 @@ print_keyring_serial_number(key_serial_t id)
tprintf("%d", id);
}
int
sys_add_key(struct tcb *tcp)
SYS_FUNC(add_key)
{
if (entering(tcp)) {
/* type */
printstr(tcp, tcp->u_arg[0], -1);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
/* payload */
tprints(", ");
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
/* payload length */
tprintf(", %lu, ", tcp->u_arg[3]);
/* keyring serial number */
print_keyring_serial_number(tcp->u_arg[4]);
}
return 0;
/* type */
printstr(tcp, tcp->u_arg[0], -1);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
/* payload */
tprints(", ");
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
/* payload length */
tprintf(", %lu, ", tcp->u_arg[3]);
/* keyring serial number */
print_keyring_serial_number(tcp->u_arg[4]);
return RVAL_DECODED;
}
int
sys_request_key(struct tcb *tcp)
SYS_FUNC(request_key)
{
if (entering(tcp)) {
/* type */
printstr(tcp, tcp->u_arg[0], -1);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
/* callout_info */
tprints(", ");
printstr(tcp, tcp->u_arg[2], -1);
/* keyring serial number */
tprints(", ");
print_keyring_serial_number(tcp->u_arg[3]);
}
return 0;
/* type */
printstr(tcp, tcp->u_arg[0], -1);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
/* callout_info */
tprints(", ");
printstr(tcp, tcp->u_arg[2], -1);
/* keyring serial number */
tprints(", ");
print_keyring_serial_number(tcp->u_arg[3]);
return RVAL_DECODED;
}
static int
static void
keyctl_get_keyring_id(struct tcb *tcp, key_serial_t id, int create)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprintf(", %d", create);
}
return 0;
print_keyring_serial_number(id);
tprintf(", %d", create);
}
static int
keyctl_join_session_keyring(struct tcb *tcp, long addr)
{
if (entering(tcp)) {
tprints(", ");
printstr(tcp, addr, -1);
}
return 0;
}
static int
static void
keyctl_update_key(struct tcb *tcp, key_serial_t id, long addr, long len)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu", len);
}
return 0;
print_keyring_serial_number(id);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu", len);
}
static int
keyctl_handle_key(struct tcb *tcp, key_serial_t id)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
}
return 0;
}
static int
static void
keyctl_handle_key_key(struct tcb *tcp, key_serial_t id1, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
print_keyring_serial_number(id2);
}
return 0;
print_keyring_serial_number(id1);
tprints(", ");
print_keyring_serial_number(id2);
}
static int
static void
keyctl_read_key(struct tcb *tcp, key_serial_t id, long addr, long len)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprints(", ");
} else {
if (addr && syserror(tcp))
tprintf("%#lx", addr);
if (syserror(tcp))
printaddr(addr);
else {
long rval = tcp->u_rval > len ?
len : (tcp->u_rval ? -1 : 0);
@ -127,223 +117,193 @@ keyctl_read_key(struct tcb *tcp, key_serial_t id, long addr, long len)
}
tprintf(", %lu", len);
}
return 0;
}
static int
static void
keyctl_keyring_search(struct tcb *tcp, key_serial_t id1, long addr1,
long addr2, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr1, -1);
tprints(", ");
printstr(tcp, addr2, -1);
tprints(", ");
print_keyring_serial_number(id2);
}
return 0;
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr1, -1);
tprints(", ");
printstr(tcp, addr2, -1);
tprints(", ");
print_keyring_serial_number(id2);
}
static int
static void
keyctl_chown_key(struct tcb *tcp, key_serial_t id, int user, int group)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprintf(", %d, %d", user, group);
}
return 0;
print_keyring_serial_number(id);
tprintf(", %d, %d", user, group);
}
static int
static void
keyctl_instantiate_key(struct tcb *tcp, key_serial_t id1, long addr,
long len, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu, ", len);
print_keyring_serial_number(id2);
}
return 0;
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu, ", len);
print_keyring_serial_number(id2);
}
static int
static void
keyctl_instantiate_key_iov(struct tcb *tcp, key_serial_t id1,
long addr, long len, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
tprint_iov(tcp, len, addr, 1);
tprintf(", %lu, ", len);
print_keyring_serial_number(id2);
}
return 0;
print_keyring_serial_number(id1);
tprints(", ");
tprint_iov(tcp, len, addr, 1);
tprintf(", %lu, ", len);
print_keyring_serial_number(id2);
}
static int
static void
keyctl_negate_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprintf(", %u, ", timeout);
print_keyring_serial_number(id2);
}
return 0;
print_keyring_serial_number(id1);
tprintf(", %u, ", timeout);
print_keyring_serial_number(id2);
}
static int
static void
keyctl_reject_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
unsigned error, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprintf(", %u, %u, ", timeout, error);
print_keyring_serial_number(id2);
}
return 0;
print_keyring_serial_number(id1);
tprintf(", %u, %u, ", timeout, error);
print_keyring_serial_number(id2);
}
static int
static void
keyctl_set_timeout(struct tcb *tcp, key_serial_t id, unsigned timeout)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprintf(", %u", timeout);
}
return 0;
print_keyring_serial_number(id);
tprintf(", %u", timeout);
}
static int
static void
keyctl_get_persistent(struct tcb *tcp, int uid, key_serial_t id)
{
if (entering(tcp)) {
tprintf(", %d, ", uid);
print_keyring_serial_number(id);
}
return 0;
tprintf("%d, ", uid);
print_keyring_serial_number(id);
}
#include "xlat/key_perms.h"
static int
static void
keyctl_setperm_key(struct tcb *tcp, key_serial_t id, uint32_t perm)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprints(", ");
printflags(key_perms, perm, "KEY_???");
}
return 0;
print_keyring_serial_number(id);
tprints(", ");
printflags(key_perms, perm, "KEY_???");
}
#include "xlat/key_reqkeys.h"
static int
keyctl_set_reqkey_keyring(struct tcb *tcp, int reqkey)
{
if (entering(tcp)) {
tprints(", ");
printxval(key_reqkeys, reqkey, "KEY_REQKEY_DEFL_???");
}
return 0;
}
#include "xlat/keyctl_commands.h"
int
sys_keyctl(struct tcb *tcp)
SYS_FUNC(keyctl)
{
int cmd = tcp->u_arg[0];
if (entering(tcp))
if (entering(tcp)) {
printxval(keyctl_commands, cmd, "KEYCTL_???");
tprints(", ");
}
switch (cmd) {
case KEYCTL_GET_KEYRING_ID:
return keyctl_get_keyring_id(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_get_keyring_id(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break;
case KEYCTL_JOIN_SESSION_KEYRING:
return keyctl_join_session_keyring(tcp, tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[1], -1);
break;
case KEYCTL_UPDATE:
return keyctl_update_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
keyctl_update_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
break;
case KEYCTL_REVOKE:
case KEYCTL_CLEAR:
case KEYCTL_INVALIDATE:
case KEYCTL_ASSUME_AUTHORITY:
return keyctl_handle_key(tcp, tcp->u_arg[1]);
print_keyring_serial_number(tcp->u_arg[1]);
break;
case KEYCTL_LINK:
case KEYCTL_UNLINK:
return keyctl_handle_key_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_handle_key_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break;
case KEYCTL_DESCRIBE:
case KEYCTL_READ:
case KEYCTL_GET_SECURITY:
return keyctl_read_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_SEARCH:
return keyctl_keyring_search(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
case KEYCTL_CHOWN:
return keyctl_chown_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_SETPERM:
return keyctl_setperm_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
case KEYCTL_INSTANTIATE:
return keyctl_instantiate_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
case KEYCTL_NEGATE:
return keyctl_negate_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_SET_REQKEY_KEYRING:
return keyctl_set_reqkey_keyring(tcp, tcp->u_arg[1]);
case KEYCTL_SET_TIMEOUT:
return keyctl_set_timeout(tcp, tcp->u_arg[1], tcp->u_arg[2]);
case KEYCTL_SESSION_TO_PARENT:
keyctl_read_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
return 0;
case KEYCTL_SEARCH:
keyctl_keyring_search(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
break;
case KEYCTL_CHOWN:
keyctl_chown_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
break;
case KEYCTL_SETPERM:
keyctl_setperm_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break;
case KEYCTL_INSTANTIATE:
keyctl_instantiate_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
break;
case KEYCTL_NEGATE:
keyctl_negate_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
break;
case KEYCTL_SET_REQKEY_KEYRING:
printxval(key_reqkeys, tcp->u_arg[1], "KEY_REQKEY_DEFL_???");
break;
case KEYCTL_SET_TIMEOUT:
keyctl_set_timeout(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break;
case KEYCTL_SESSION_TO_PARENT:
break;
case KEYCTL_REJECT:
return keyctl_reject_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
keyctl_reject_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
break;
case KEYCTL_INSTANTIATE_IOV:
return keyctl_instantiate_key_iov(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3],
tcp->u_arg[4]);
keyctl_instantiate_key_iov(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3],
tcp->u_arg[4]);
break;
case KEYCTL_GET_PERSISTENT:
return keyctl_get_persistent(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_get_persistent(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break;
default:
if (entering(tcp))
tprintf(", %#lx, %#lx, %#lx, %#lx",
tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
tprintf("%#lx, %#lx, %#lx, %#lx",
tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
break;
}
return 0;
return RVAL_DECODED;
}

97
ldt.c
View File

@ -1,3 +1,36 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2002-2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2010 Andreas Schwab <schwab@linux-m68k.org>
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* 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"
#if defined I386 || defined X86_64 || defined X32
@ -5,19 +38,12 @@
# include <asm/ldt.h>
void
print_user_desc(struct tcb *tcp, long addr)
print_user_desc(struct tcb *tcp, const long addr)
{
struct user_desc desc;
if (umove(tcp, addr, &desc) < 0) {
tprintf("%lx", addr);
if (umove_or_printaddr(tcp, addr, &desc))
return;
}
if (!verbose(tcp)) {
tprintf("{entry_number:%d, ...}", desc.entry_number);
return;
}
tprintf("{entry_number:%d, "
"base_addr:%#08x, "
@ -39,31 +65,27 @@ print_user_desc(struct tcb *tcp, long addr)
desc.useable);
}
int
sys_modify_ldt(struct tcb *tcp)
SYS_FUNC(modify_ldt)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
if (tcp->u_arg[1] == 0
|| tcp->u_arg[2] != sizeof(struct user_desc)) {
tprintf("%lx", tcp->u_arg[1]);
} else {
print_user_desc(tcp, tcp->u_arg[1]);
}
tprintf(", %lu", tcp->u_arg[2]);
}
return 0;
tprintf("%ld, ", 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]);
return RVAL_DECODED;
}
int
sys_set_thread_area(struct tcb *tcp)
SYS_FUNC(set_thread_area)
{
if (entering(tcp)) {
print_user_desc(tcp, tcp->u_arg[0]);
} else {
struct user_desc desc;
if (syserror(tcp) || umove(tcp, tcp->u_arg[0], &desc) < 0) {
if (!verbose(tcp) || syserror(tcp) ||
umove(tcp, tcp->u_arg[0], &desc) < 0) {
/* returned entry_number is not available */
} else {
static char outstr[32];
@ -76,35 +98,28 @@ sys_set_thread_area(struct tcb *tcp)
return 0;
}
int
sys_get_thread_area(struct tcb *tcp)
SYS_FUNC(get_thread_area)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%lx", tcp->u_arg[0]);
else
print_user_desc(tcp, tcp->u_arg[0]);
}
if (exiting(tcp))
print_user_desc(tcp, tcp->u_arg[0]);
return 0;
}
#endif /* I386 || X86_64 || X32 */
#if defined(M68K) || defined(MIPS)
int
sys_set_thread_area(struct tcb *tcp)
SYS_FUNC(set_thread_area)
{
if (entering(tcp))
tprintf("%#lx", tcp->u_arg[0]);
return 0;
printaddr(tcp->u_arg[0]);
return RVAL_DECODED;
}
#endif
#if defined(M68K)
int
sys_get_thread_area(struct tcb *tcp)
SYS_FUNC(get_thread_area)
{
return RVAL_HEX;
return RVAL_DECODED | RVAL_HEX;
}
#endif

117
link.c
View File

@ -1,71 +1,80 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2006 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2006 Bernhard Kaindl <bk@suse.de>
* Copyright (c) 2006-2015 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.
*/
#include "defs.h"
#include <fcntl.h>
#ifndef AT_SYMLINK_NOFOLLOW
# define AT_SYMLINK_NOFOLLOW 0x100
#endif
#ifndef AT_REMOVEDIR
# define AT_REMOVEDIR 0x200
#endif
#ifndef AT_SYMLINK_FOLLOW
# define AT_SYMLINK_FOLLOW 0x400
#endif
#ifndef AT_NO_AUTOMOUNT
# define AT_NO_AUTOMOUNT 0x800
#endif
#ifndef AT_EMPTY_PATH
# define AT_EMPTY_PATH 0x1000
#endif
#include "xlat/at_flags.h"
int
sys_link(struct tcb *tcp)
SYS_FUNC(link)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
printpath(tcp, tcp->u_arg[1]);
}
return 0;
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
printpath(tcp, tcp->u_arg[1]);
return RVAL_DECODED;
}
int
sys_linkat(struct tcb *tcp)
SYS_FUNC(linkat)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[2]);
printpath(tcp, tcp->u_arg[3]);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[2]);
printpath(tcp, tcp->u_arg[3]);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
return RVAL_DECODED;
}
int
sys_unlinkat(struct tcb *tcp)
SYS_FUNC(unlinkat)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
printflags(at_flags, tcp->u_arg[2], "AT_???");
}
return 0;
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
printflags(at_flags, tcp->u_arg[2], "AT_???");
return RVAL_DECODED;
}
int
sys_symlinkat(struct tcb *tcp)
SYS_FUNC(symlinkat)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[1]);
printpath(tcp, tcp->u_arg[2]);
}
return 0;
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[1]);
printpath(tcp, tcp->u_arg[2]);
return RVAL_DECODED;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,277 +1,280 @@
#ifndef ARCH_sys_mmap
# define ARCH_sys_mmap sys_mmap
#ifndef ARCH_mmap
# define ARCH_mmap mmap
#endif
[ 0] = { 2, 0, sys_io_setup, "io_setup" },
[ 1] = { 1, 0, sys_io_destroy, "io_destroy" },
[ 2] = { 3, 0, sys_io_submit, "io_submit" },
[ 3] = { 3, 0, sys_io_cancel, "io_cancel" },
[ 4] = { 5, 0, sys_io_getevents, "io_getevents" },
[ 5] = { 5, TF, sys_setxattr, "setxattr" },
[ 6] = { 5, TF, sys_setxattr, "lsetxattr" },
[ 7] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[ 8] = { 4, TF, sys_getxattr, "getxattr" },
[ 9] = { 4, TF, sys_getxattr, "lgetxattr" },
[ 10] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[ 11] = { 3, TF, sys_listxattr, "listxattr" },
[ 12] = { 3, TF, sys_listxattr, "llistxattr" },
[ 13] = { 3, TD, sys_flistxattr, "flistxattr" },
[ 14] = { 2, TF, sys_removexattr, "removexattr" },
[ 15] = { 2, TF, sys_removexattr, "lremovexattr" },
[ 16] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[ 17] = { 2, TF, sys_getcwd, "getcwd" },
[ 18] = { 4, 0, sys_lookup_dcookie, "lookup_dcookie" },
[ 19] = { 2, TD, sys_eventfd2, "eventfd2" },
[ 20] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[ 21] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[ 22] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[ 23] = { 1, TD, sys_dup, "dup" },
[ 24] = { 3, TD, sys_dup3, "dup3" },
[ 25] = { 3, TD, sys_fcntl, "fcntl64" },
[ 26] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[ 27] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[ 28] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[ 29] = { 3, TD, sys_ioctl, "ioctl" },
[ 30] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[ 31] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[ 32] = { 2, TD, sys_flock, "flock" },
[ 33] = { 4, TD|TF, sys_mknodat, "mknodat" },
[ 34] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[ 35] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[ 36] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[ 37] = { 5, TD|TF, sys_linkat, "linkat" },
[ 38] = { 4, TD|TF, sys_renameat, "renameat" },
[ 39] = { 2, TF, sys_umount2, "umount2" },
[ 40] = { 5, TF, sys_mount, "mount" },
[ 41] = { 2, TF, sys_pivotroot, "pivot_root" },
[ 42] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[ 43] = { 3, TF, sys_statfs64, "statfs64" },
[ 44] = { 3, TD, sys_fstatfs64, "fstatfs64" },
[ 45] = { 3, TF, sys_truncate64, "truncate64" },
[ 46] = { 3, TD, sys_ftruncate64, "ftruncate64" },
[ 47] = { 6, TD, sys_fallocate, "fallocate" },
[ 48] = { 3, TD|TF, sys_faccessat, "faccessat" },
[ 49] = { 1, TF, sys_chdir, "chdir" },
[ 50] = { 1, TD, sys_fchdir, "fchdir" },
[ 51] = { 1, TF, sys_chroot, "chroot" },
[ 52] = { 2, TD, sys_fchmod, "fchmod" },
[ 53] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[ 54] = { 5, TD|TF, sys_fchownat, "fchownat" },
[ 55] = { 3, TD, sys_fchown, "fchown" },
[ 56] = { 4, TD|TF, sys_openat, "openat" },
[ 57] = { 1, TD, sys_close, "close" },
[ 58] = { 0, 0, sys_vhangup, "vhangup" },
[ 59] = { 2, TD, sys_pipe2, "pipe2" },
[ 60] = { 4, TF, sys_quotactl, "quotactl" },
[ 61] = { 3, TD, sys_getdents64, "getdents64" },
[ 62] = { 5, TD, sys_llseek, "_llseek" },
[ 63] = { 3, TD, sys_read, "read" },
[ 64] = { 3, TD, sys_write, "write" },
[ 65] = { 3, TD, sys_readv, "readv" },
[ 66] = { 3, TD, sys_writev, "writev" },
[ 67] = { 5, TD, sys_pread, "pread64" },
[ 68] = { 5, TD, sys_pwrite, "pwrite64" },
[ 69] = { 5, TD, sys_preadv, "preadv" },
[ 70] = { 5, TD, sys_pwritev, "pwritev" },
[ 71] = { 4, TD|TN, sys_sendfile64, "sendfile64" },
[ 72] = { 6, TD, sys_pselect6, "pselect6" },
[ 73] = { 5, TD, sys_ppoll, "ppoll" },
[ 74] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[ 75] = { 4, TD, sys_vmsplice, "vmsplice" },
[ 76] = { 6, TD, sys_splice, "splice" },
[ 77] = { 4, TD, sys_tee, "tee" },
[ 78] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[ 79] = { 4, TD|TF, sys_newfstatat, "fstatat64" },
[ 80] = { 2, TD, sys_fstat64, "fstat64" },
[ 81] = { 0, 0, sys_sync, "sync" },
[ 82] = { 1, TD, sys_fsync, "fsync" },
[ 83] = { 1, TD, sys_fdatasync, "fdatasync" },
[ 0] = { 2, 0, SEN(io_setup), "io_setup" },
[ 1] = { 1, 0, SEN(io_destroy), "io_destroy" },
[ 2] = { 3, 0, SEN(io_submit), "io_submit" },
[ 3] = { 3, 0, SEN(io_cancel), "io_cancel" },
[ 4] = { 5, 0, SEN(io_getevents), "io_getevents" },
[ 5] = { 5, TF, SEN(setxattr), "setxattr" },
[ 6] = { 5, TF, SEN(setxattr), "lsetxattr" },
[ 7] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
[ 8] = { 4, TF, SEN(getxattr), "getxattr" },
[ 9] = { 4, TF, SEN(getxattr), "lgetxattr" },
[ 10] = { 4, TD, SEN(fgetxattr), "fgetxattr" },
[ 11] = { 3, TF, SEN(listxattr), "listxattr" },
[ 12] = { 3, TF, SEN(listxattr), "llistxattr" },
[ 13] = { 3, TD, SEN(flistxattr), "flistxattr" },
[ 14] = { 2, TF, SEN(removexattr), "removexattr" },
[ 15] = { 2, TF, SEN(removexattr), "lremovexattr" },
[ 16] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
[ 17] = { 2, TF, SEN(getcwd), "getcwd" },
[ 18] = { 4, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[ 19] = { 2, TD, SEN(eventfd2), "eventfd2" },
[ 20] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[ 21] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[ 22] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[ 23] = { 1, TD, SEN(dup), "dup" },
[ 24] = { 3, TD, SEN(dup3), "dup3" },
[ 25] = { 3, TD, SEN(fcntl64), "fcntl64" },
[ 26] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[ 27] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[ 28] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[ 29] = { 3, TD, SEN(ioctl), "ioctl" },
[ 30] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[ 31] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[ 32] = { 2, TD, SEN(flock), "flock" },
[ 33] = { 4, TD|TF, SEN(mknodat), "mknodat" },
[ 34] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },
[ 35] = { 3, TD|TF, SEN(unlinkat), "unlinkat" },
[ 36] = { 3, TD|TF, SEN(symlinkat), "symlinkat" },
[ 37] = { 5, TD|TF, SEN(linkat), "linkat" },
[ 38] = { 4, TD|TF, SEN(renameat), "renameat" },
[ 39] = { 2, TF, SEN(umount2), "umount2" },
[ 40] = { 5, TF, SEN(mount), "mount" },
[ 41] = { 2, TF, SEN(pivotroot), "pivot_root" },
[ 42] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[ 43] = { 3, TF, SEN(statfs64), "statfs64" },
[ 44] = { 3, TD, SEN(fstatfs64), "fstatfs64" },
[ 45] = { 3, TF, SEN(truncate64), "truncate64" },
[ 46] = { 3, TD, SEN(ftruncate64), "ftruncate64" },
[ 47] = { 6, TD, SEN(fallocate), "fallocate" },
[ 48] = { 3, TD|TF, SEN(faccessat), "faccessat" },
[ 49] = { 1, TF, SEN(chdir), "chdir" },
[ 50] = { 1, TD, SEN(fchdir), "fchdir" },
[ 51] = { 1, TF, SEN(chroot), "chroot" },
[ 52] = { 2, TD, SEN(fchmod), "fchmod" },
[ 53] = { 3, TD|TF, SEN(fchmodat), "fchmodat" },
[ 54] = { 5, TD|TF, SEN(fchownat), "fchownat" },
[ 55] = { 3, TD, SEN(fchown), "fchown" },
[ 56] = { 4, TD|TF, SEN(openat), "openat" },
[ 57] = { 1, TD, SEN(close), "close" },
[ 58] = { 0, 0, SEN(vhangup), "vhangup" },
[ 59] = { 2, TD, SEN(pipe2), "pipe2" },
[ 60] = { 4, TF, SEN(quotactl), "quotactl" },
[ 61] = { 3, TD, SEN(getdents64), "getdents64" },
[ 62] = { 5, TD, SEN(llseek), "_llseek" },
[ 63] = { 3, TD, SEN(read), "read" },
[ 64] = { 3, TD, SEN(write), "write" },
[ 65] = { 3, TD, SEN(readv), "readv" },
[ 66] = { 3, TD, SEN(writev), "writev" },
[ 67] = { 5, TD, SEN(pread), "pread64" },
[ 68] = { 5, TD, SEN(pwrite), "pwrite64" },
[ 69] = { 5, TD, SEN(preadv), "preadv" },
[ 70] = { 5, TD, SEN(pwritev), "pwritev" },
[ 71] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
[ 72] = { 6, TD, SEN(pselect6), "pselect6" },
[ 73] = { 5, TD, SEN(ppoll), "ppoll" },
[ 74] = { 4, TD|TS, SEN(signalfd4), "signalfd4" },
[ 75] = { 4, TD, SEN(vmsplice), "vmsplice" },
[ 76] = { 6, TD, SEN(splice), "splice" },
[ 77] = { 4, TD, SEN(tee), "tee" },
[ 78] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[ 79] = { 4, TD|TF, SEN(newfstatat), "fstatat64" },
[ 80] = { 2, TD, SEN(fstat64), "fstat64" },
[ 81] = { 0, 0, SEN(sync), "sync" },
[ 82] = { 1, TD, SEN(fsync), "fsync" },
[ 83] = { 1, TD, SEN(fdatasync), "fdatasync" },
#ifdef ARCH_WANT_SYNC_FILE_RANGE2
[ 84] = { 6, TD, sys_sync_file_range2, "sync_file_range2" },
[ 84] = { 6, TD, SEN(sync_file_range2), "sync_file_range2" },
#else
[ 84] = { 6, TD, sys_sync_file_range, "sync_file_range" },
[ 84] = { 6, TD, SEN(sync_file_range), "sync_file_range" },
#endif
[ 85] = { 2, TD, sys_timerfd_create, "timerfd_create" },
[ 86] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[ 87] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[ 88] = { 4, TD|TF, sys_utimensat, "utimensat" },
[ 89] = { 1, TF, sys_acct, "acct" },
[ 90] = { 2, 0, sys_capget, "capget" },
[ 91] = { 2, 0, sys_capset, "capset" },
[ 92] = { 1, 0, sys_personality, "personality" },
[ 93] = { 1, TP|SE, sys_exit, "exit" },
[ 94] = { 1, TP|SE, sys_exit, "exit_group" },
[ 95] = { 5, TP, sys_waitid, "waitid" },
[ 96] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[ 97] = { 1, TP, sys_unshare, "unshare" },
[ 98] = { 6, 0, sys_futex, "futex" },
[ 99] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[100] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[101] = { 2, 0, sys_nanosleep, "nanosleep" },
[102] = { 2, 0, sys_getitimer, "getitimer" },
[103] = { 3, 0, sys_setitimer, "setitimer" },
[104] = { 4, 0, sys_kexec_load, "kexec_load" },
[105] = { 3, 0, sys_init_module, "init_module" },
[106] = { 2, 0, sys_delete_module, "delete_module" },
[107] = { 3, 0, sys_timer_create, "timer_create" },
[108] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[109] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[110] = { 4, 0, sys_timer_settime, "timer_settime" },
[111] = { 1, 0, sys_timer_delete, "timer_delete" },
[112] = { 2, 0, sys_clock_settime, "clock_settime" },
[113] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[114] = { 2, 0, sys_clock_getres, "clock_getres" },
[115] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[116] = { 3, 0, sys_syslog, "syslog" },
[117] = { 4, 0, sys_ptrace, "ptrace" },
[118] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[119] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[120] = { 1, 0, sys_sched_getscheduler, "sched_getscheduler" },
[121] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[122] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[123] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[124] = { 0, 0, sys_sched_yield, "sched_yield" },
[125] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[126] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[127] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[128] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[129] = { 2, TS, sys_kill, "kill" },
[130] = { 2, TS, sys_kill, "tkill" },
[131] = { 3, TS, sys_tgkill, "tgkill" },
[132] = { 2, TS, sys_sigaltstack, "sigaltstack" },
[133] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[134] = { 4, TS, sys_rt_sigaction, "rt_sigaction" },
[135] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[136] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[137] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[138] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[139] = { 0, TS, sys_rt_sigreturn, "rt_sigreturn" },
[140] = { 3, 0, sys_setpriority, "setpriority" },
[141] = { 2, 0, sys_getpriority, "getpriority" },
[142] = { 4, 0, sys_reboot, "reboot" },
[143] = { 2, 0, sys_setregid, "setregid" },
[144] = { 1, 0, sys_setgid, "setgid" },
[145] = { 2, 0, sys_setreuid, "setreuid" },
[146] = { 1, 0, sys_setuid, "setuid" },
[147] = { 3, 0, sys_setresuid, "setresuid" },
[148] = { 3, 0, sys_getresuid, "getresuid" },
[149] = { 3, 0, sys_setresgid, "setresgid" },
[150] = { 3, 0, sys_getresgid, "getresgid" },
[151] = { 1, NF, sys_setfsuid, "setfsuid" },
[152] = { 1, NF, sys_setfsgid, "setfsgid" },
[153] = { 1, 0, sys_times, "times" },
[154] = { 2, 0, sys_setpgid, "setpgid" },
[155] = { 1, 0, sys_getpgid, "getpgid" },
[156] = { 1, 0, sys_getsid, "getsid" },
[157] = { 0, 0, sys_setsid, "setsid" },
[158] = { 2, 0, sys_getgroups, "getgroups" },
[159] = { 2, 0, sys_setgroups, "setgroups" },
[160] = { 1, 0, sys_uname, "uname" },
[161] = { 2, 0, sys_sethostname, "sethostname" },
[162] = { 2, 0, sys_setdomainname, "setdomainname" },
[163] = { 2, 0, sys_getrlimit, "getrlimit" },
[164] = { 2, 0, sys_setrlimit, "setrlimit" },
[165] = { 2, 0, sys_getrusage, "getrusage" },
[166] = { 1, 0, sys_umask, "umask" },
[167] = { 5, 0, sys_prctl, "prctl" },
[168] = { 3, 0, sys_getcpu, "getcpu" },
[169] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[170] = { 2, 0, sys_settimeofday, "settimeofday" },
[171] = { 1, 0, sys_adjtimex, "adjtimex" },
[172] = { 0, 0, sys_getpid, "getpid" },
[173] = { 0, 0, sys_getppid, "getppid" },
[174] = { 0, NF, sys_getuid, "getuid" },
[175] = { 0, NF, sys_geteuid, "geteuid" },
[176] = { 0, NF, sys_getgid, "getgid" },
[177] = { 0, NF, sys_getegid, "getegid" },
[178] = { 0, 0, sys_gettid, "gettid" },
[179] = { 1, 0, sys_sysinfo, "sysinfo" },
[180] = { 4, 0, sys_mq_open, "mq_open" },
[181] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[182] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[183] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[184] = { 2, 0, sys_mq_notify, "mq_notify" },
[185] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[186] = { 2, TI, sys_msgget, "msgget" },
[187] = { 3, TI, sys_msgctl, "msgctl" },
[188] = { 5, TI, sys_msgrcv, "msgrcv" },
[189] = { 4, TI, sys_msgsnd, "msgsnd" },
[190] = { 3, TI, sys_semget, "semget" },
[191] = { 4, TI, sys_semctl, "semctl" },
[192] = { 4, TI, sys_semtimedop, "semtimedop" },
[193] = { 3, TI, sys_semop, "semop" },
[194] = { 3, TI, sys_shmget, "shmget" },
[195] = { 3, TI, sys_shmctl, "shmctl" },
[196] = { 3, TI|TM|SI, sys_shmat, "shmat" },
[197] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[198] = { 3, TN, sys_socket, "socket" },
[199] = { 4, TN, sys_socketpair, "socketpair" },
[200] = { 3, TN, sys_bind, "bind" },
[201] = { 2, TN, sys_listen, "listen" },
[202] = { 3, TN, sys_accept, "accept" },
[203] = { 3, TN, sys_connect, "connect" },
[204] = { 3, TN, sys_getsockname, "getsockname" },
[205] = { 3, TN, sys_getpeername, "getpeername" },
[206] = { 6, TN, sys_sendto, "sendto" },
[207] = { 6, TN, sys_recvfrom, "recvfrom" },
[208] = { 5, TN, sys_setsockopt, "setsockopt" },
[209] = { 5, TN, sys_getsockopt, "getsockopt" },
[210] = { 2, TN, sys_shutdown, "shutdown" },
[211] = { 3, TN, sys_sendmsg, "sendmsg" },
[212] = { 3, TN, sys_recvmsg, "recvmsg" },
[213] = { 4, TD, sys_readahead, "readahead" },
[214] = { 1, TM|SI, sys_brk, "brk" },
[215] = { 2, TM|SI, sys_munmap, "munmap" },
[216] = { 5, TM|SI, sys_mremap, "mremap" },
[217] = { 5, 0, sys_add_key, "add_key" },
[218] = { 4, 0, sys_request_key, "request_key" },
[219] = { 5, 0, sys_keyctl, "keyctl" },
[220] = { 5, TP, sys_clone, "clone" },
[221] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[222] = { 6, TD|TM|SI, ARCH_sys_mmap, "mmap2" },
[223] = { 6, TD, sys_fadvise64_64, "fadvise64_64" },
[224] = { 2, TF, sys_swapon, "swapon" },
[225] = { 1, TF, sys_swapoff, "swapoff" },
[226] = { 3, TM|SI, sys_mprotect, "mprotect" },
[227] = { 3, TM, sys_msync, "msync" },
[228] = { 2, TM, sys_mlock, "mlock" },
[229] = { 2, TM, sys_munlock, "munlock" },
[230] = { 1, TM, sys_mlockall, "mlockall" },
[231] = { 0, TM, sys_munlockall, "munlockall" },
[232] = { 3, TM, sys_mincore, "mincore" },
[233] = { 3, TM, sys_madvise, "madvise" },
[234] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[235] = { 6, TM, sys_mbind, "mbind" },
[236] = { 5, TM, sys_get_mempolicy, "get_mempolicy" },
[237] = { 3, TM, sys_set_mempolicy, "set_mempolicy" },
[238] = { 4, TM, sys_migrate_pages, "migrate_pages" },
[239] = { 6, TM, sys_move_pages, "move_pages" },
[240] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[241] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[242] = { 4, TN, sys_accept4, "accept4" },
[243] = { 5, TN, sys_recvmmsg, "recvmmsg" },
[ 85] = { 2, TD, SEN(timerfd_create), "timerfd_create" },
[ 86] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" },
[ 87] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" },
[ 88] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[ 89] = { 1, TF, SEN(acct), "acct" },
[ 90] = { 2, 0, SEN(capget), "capget" },
[ 91] = { 2, 0, SEN(capset), "capset" },
[ 92] = { 1, 0, SEN(personality), "personality" },
[ 93] = { 1, TP|SE, SEN(exit), "exit" },
[ 94] = { 1, TP|SE, SEN(exit), "exit_group" },
[ 95] = { 5, TP, SEN(waitid), "waitid" },
[ 96] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[ 97] = { 1, TP, SEN(unshare), "unshare" },
[ 98] = { 6, 0, SEN(futex), "futex" },
[ 99] = { 2, 0, SEN(set_robust_list), "set_robust_list" },
[100] = { 3, 0, SEN(get_robust_list), "get_robust_list" },
[101] = { 2, 0, SEN(nanosleep), "nanosleep" },
[102] = { 2, 0, SEN(getitimer), "getitimer" },
[103] = { 3, 0, SEN(setitimer), "setitimer" },
[104] = { 4, 0, SEN(kexec_load), "kexec_load" },
[105] = { 3, 0, SEN(init_module), "init_module" },
[106] = { 2, 0, SEN(delete_module), "delete_module" },
[107] = { 3, 0, SEN(timer_create), "timer_create" },
[108] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[109] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
[110] = { 4, 0, SEN(timer_settime), "timer_settime" },
[111] = { 1, 0, SEN(timer_delete), "timer_delete" },
[112] = { 2, 0, SEN(clock_settime), "clock_settime" },
[113] = { 2, 0, SEN(clock_gettime), "clock_gettime" },
[114] = { 2, 0, SEN(clock_getres), "clock_getres" },
[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" },
[128] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[129] = { 2, TS, SEN(kill), "kill" },
[130] = { 2, TS, SEN(kill), "tkill" },
[131] = { 3, TS, SEN(tgkill), "tgkill" },
[132] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[133] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[134] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" },
[135] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[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(rt_sigreturn), "rt_sigreturn" },
[140] = { 3, 0, SEN(setpriority), "setpriority" },
[141] = { 2, 0, SEN(getpriority), "getpriority" },
[142] = { 4, 0, SEN(reboot), "reboot" },
[143] = { 2, 0, SEN(setregid), "setregid" },
[144] = { 1, 0, SEN(setgid), "setgid" },
[145] = { 2, 0, SEN(setreuid), "setreuid" },
[146] = { 1, 0, SEN(setuid), "setuid" },
[147] = { 3, 0, SEN(setresuid), "setresuid" },
[148] = { 3, 0, SEN(getresuid), "getresuid" },
[149] = { 3, 0, SEN(setresgid), "setresgid" },
[150] = { 3, 0, SEN(getresgid), "getresgid" },
[151] = { 1, NF, SEN(setfsuid), "setfsuid" },
[152] = { 1, NF, SEN(setfsgid), "setfsgid" },
[153] = { 1, 0, SEN(times), "times" },
[154] = { 2, 0, SEN(setpgid), "setpgid" },
[155] = { 1, 0, SEN(getpgid), "getpgid" },
[156] = { 1, 0, SEN(getsid), "getsid" },
[157] = { 0, 0, SEN(setsid), "setsid" },
[158] = { 2, 0, SEN(getgroups), "getgroups" },
[159] = { 2, 0, SEN(setgroups), "setgroups" },
[160] = { 1, 0, SEN(uname), "uname" },
[161] = { 2, 0, SEN(sethostname), "sethostname" },
[162] = { 2, 0, SEN(setdomainname), "setdomainname" },
[163] = { 2, 0, SEN(getrlimit), "getrlimit" },
[164] = { 2, 0, SEN(setrlimit), "setrlimit" },
[165] = { 2, 0, SEN(getrusage), "getrusage" },
[166] = { 1, 0, SEN(umask), "umask" },
[167] = { 5, 0, SEN(prctl), "prctl" },
[168] = { 3, 0, SEN(getcpu), "getcpu" },
[169] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[170] = { 2, 0, SEN(settimeofday), "settimeofday" },
[171] = { 1, 0, SEN(adjtimex), "adjtimex" },
[172] = { 0, 0, SEN(getpid), "getpid" },
[173] = { 0, 0, SEN(getppid), "getppid" },
[174] = { 0, NF, SEN(getuid), "getuid" },
[175] = { 0, NF, SEN(geteuid), "geteuid" },
[176] = { 0, NF, SEN(getgid), "getgid" },
[177] = { 0, NF, SEN(getegid), "getegid" },
[178] = { 0, 0, SEN(gettid), "gettid" },
[179] = { 1, 0, SEN(sysinfo), "sysinfo" },
[180] = { 4, 0, SEN(mq_open), "mq_open" },
[181] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[182] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[183] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[184] = { 2, 0, SEN(mq_notify), "mq_notify" },
[185] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[186] = { 2, TI, SEN(msgget), "msgget" },
[187] = { 3, TI, SEN(msgctl), "msgctl" },
[188] = { 5, TI, SEN(msgrcv), "msgrcv" },
[189] = { 4, TI, SEN(msgsnd), "msgsnd" },
[190] = { 3, TI, SEN(semget), "semget" },
[191] = { 4, TI, SEN(semctl), "semctl" },
[192] = { 4, TI, SEN(semtimedop), "semtimedop" },
[193] = { 3, TI, SEN(semop), "semop" },
[194] = { 3, TI, SEN(shmget), "shmget" },
[195] = { 3, TI, SEN(shmctl), "shmctl" },
[196] = { 3, TI|TM|SI, SEN(shmat), "shmat" },
[197] = { 1, TI|TM|SI, SEN(shmdt), "shmdt" },
[198] = { 3, TN, SEN(socket), "socket" },
[199] = { 4, TN, SEN(socketpair), "socketpair" },
[200] = { 3, TN, SEN(bind), "bind" },
[201] = { 2, TN, SEN(listen), "listen" },
[202] = { 3, TN, SEN(accept), "accept" },
[203] = { 3, TN, SEN(connect), "connect" },
[204] = { 3, TN, SEN(getsockname), "getsockname" },
[205] = { 3, TN, SEN(getpeername), "getpeername" },
[206] = { 6, TN, SEN(sendto), "sendto" },
[207] = { 6, TN, SEN(recvfrom), "recvfrom" },
[208] = { 5, TN, SEN(setsockopt), "setsockopt" },
[209] = { 5, TN, SEN(getsockopt), "getsockopt" },
[210] = { 2, TN, SEN(shutdown), "shutdown" },
[211] = { 3, TN, SEN(sendmsg), "sendmsg" },
[212] = { 3, TN, SEN(recvmsg), "recvmsg" },
[213] = { 4, TD, SEN(readahead), "readahead" },
[214] = { 1, TM|SI, SEN(brk), "brk" },
[215] = { 2, TM|SI, SEN(munmap), "munmap" },
[216] = { 5, TM|SI, SEN(mremap), "mremap" },
[217] = { 5, 0, SEN(add_key), "add_key" },
[218] = { 4, 0, SEN(request_key), "request_key" },
[219] = { 5, 0, SEN(keyctl), "keyctl" },
[220] = { 5, TP, SEN(clone), "clone" },
[221] = { 3, TF|TP|SE|SI, SEN(execve), "execve" },
[222] = { 6, TD|TM|SI, SEN(ARCH_mmap), "mmap2" },
[223] = { 6, TD, SEN(fadvise64_64), "fadvise64_64" },
[224] = { 2, TF, SEN(swapon), "swapon" },
[225] = { 1, TF, SEN(swapoff), "swapoff" },
[226] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[227] = { 3, TM, SEN(msync), "msync" },
[228] = { 2, TM, SEN(mlock), "mlock" },
[229] = { 2, TM, SEN(munlock), "munlock" },
[230] = { 1, TM, SEN(mlockall), "mlockall" },
[231] = { 0, TM, SEN(munlockall), "munlockall" },
[232] = { 3, TM, SEN(mincore), "mincore" },
[233] = { 3, TM, SEN(madvise), "madvise" },
[234] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[235] = { 6, TM, SEN(mbind), "mbind" },
[236] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[237] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[238] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[239] = { 6, TM, SEN(move_pages), "move_pages" },
[240] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" },
[241] = { 5, TD, SEN(perf_event_open), "perf_event_open" },
[242] = { 4, TN, SEN(accept4), "accept4" },
[243] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
/* [244 ... 259] are arch specific */
[260] = { 4, TP, sys_wait4, "wait4" },
[261] = { 4, 0, sys_prlimit64, "prlimit64" },
[262] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[263] = { 6, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[264] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[265] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[266] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[267] = { 1, TD, sys_syncfs, "syncfs" },
[268] = { 2, TD, sys_setns, "setns" },
[269] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[270] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[271] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[272] = { 5, 0, sys_kcmp, "kcmp" },
[273] = { 3, TD, sys_finit_module, "finit_module" },
[274] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[275] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[276] = { 5, TD|TF, sys_renameat2, "renameat2" },
[277] = { 3, 0, sys_seccomp, "seccomp", },
[278] = { 3, 0, sys_getrandom, "getrandom", },
[279] = { 2, TD, sys_memfd_create, "memfd_create", },
[280] = { 3, TD, sys_bpf, "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, sys_execveat, "execveat", },
[260] = { 4, TP, SEN(wait4), "wait4" },
[261] = { 4, 0, SEN(prlimit64), "prlimit64" },
[262] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[263] = { 6, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[264] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" },
[265] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[266] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[267] = { 1, TD, SEN(syncfs), "syncfs" },
[268] = { 2, TD, SEN(setns), "setns" },
[269] = { 4, TN, SEN(sendmmsg), "sendmmsg" },
[270] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" },
[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" },
[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", },
[284] = { 3, TM, SEN(mlock2), "mlock2" },
#undef ARCH_sys_mmap
#undef ARCH_mmap
#undef ARCH_WANT_SYNC_FILE_RANGE2

View File

@ -1,267 +1,270 @@
[ 0] = { 2, 0, sys_io_setup, "io_setup" },
[ 1] = { 1, 0, sys_io_destroy, "io_destroy" },
[ 2] = { 3, 0, sys_io_submit, "io_submit" },
[ 3] = { 3, 0, sys_io_cancel, "io_cancel" },
[ 4] = { 5, 0, sys_io_getevents, "io_getevents" },
[ 5] = { 5, TF, sys_setxattr, "setxattr" },
[ 6] = { 5, TF, sys_setxattr, "lsetxattr" },
[ 7] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[ 8] = { 4, TF, sys_getxattr, "getxattr" },
[ 9] = { 4, TF, sys_getxattr, "lgetxattr" },
[ 10] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[ 11] = { 3, TF, sys_listxattr, "listxattr" },
[ 12] = { 3, TF, sys_listxattr, "llistxattr" },
[ 13] = { 3, TD, sys_flistxattr, "flistxattr" },
[ 14] = { 2, TF, sys_removexattr, "removexattr" },
[ 15] = { 2, TF, sys_removexattr, "lremovexattr" },
[ 16] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[ 17] = { 2, TF, sys_getcwd, "getcwd" },
[ 18] = { 3, 0, sys_lookup_dcookie, "lookup_dcookie" },
[ 19] = { 2, TD, sys_eventfd2, "eventfd2" },
[ 20] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[ 21] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[ 22] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[ 23] = { 1, TD, sys_dup, "dup" },
[ 24] = { 3, TD, sys_dup3, "dup3" },
[ 25] = { 3, TD, sys_fcntl, "fcntl" },
[ 26] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[ 27] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[ 28] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[ 29] = { 3, TD, sys_ioctl, "ioctl" },
[ 30] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[ 31] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[ 32] = { 2, TD, sys_flock, "flock" },
[ 33] = { 4, TD|TF, sys_mknodat, "mknodat" },
[ 34] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[ 35] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[ 36] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[ 37] = { 5, TD|TF, sys_linkat, "linkat" },
[ 38] = { 4, TD|TF, sys_renameat, "renameat" },
[ 39] = { 2, TF, sys_umount2, "umount2" },
[ 40] = { 5, TF, sys_mount, "mount" },
[ 41] = { 2, TF, sys_pivotroot, "pivot_root" },
[ 42] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[ 43] = { 2, TF, sys_statfs, "statfs" },
[ 44] = { 2, TD, sys_fstatfs, "fstatfs" },
[ 45] = { 2, TF, sys_truncate, "truncate" },
[ 46] = { 2, TD, sys_ftruncate, "ftruncate" },
[ 47] = { 4, TD, sys_fallocate, "fallocate" },
[ 48] = { 3, TD|TF, sys_faccessat, "faccessat" },
[ 49] = { 1, TF, sys_chdir, "chdir" },
[ 50] = { 1, TD, sys_fchdir, "fchdir" },
[ 51] = { 1, TF, sys_chroot, "chroot" },
[ 52] = { 2, TD, sys_fchmod, "fchmod" },
[ 53] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[ 54] = { 5, TD|TF, sys_fchownat, "fchownat" },
[ 55] = { 3, TD, sys_fchown, "fchown" },
[ 56] = { 4, TD|TF, sys_openat, "openat" },
[ 57] = { 1, TD, sys_close, "close" },
[ 58] = { 0, 0, sys_vhangup, "vhangup" },
[ 59] = { 2, TD, sys_pipe2, "pipe2" },
[ 60] = { 4, TF, sys_quotactl, "quotactl" },
[ 61] = { 3, TD, sys_getdents64, "getdents64" },
[ 62] = { 3, TD, sys_lseek, "lseek" },
[ 63] = { 3, TD, sys_read, "read" },
[ 64] = { 3, TD, sys_write, "write" },
[ 65] = { 3, TD, sys_readv, "readv" },
[ 66] = { 3, TD, sys_writev, "writev" },
[ 67] = { 4, TD, sys_pread, "pread64" },
[ 68] = { 4, TD, sys_pwrite, "pwrite64" },
[ 69] = { 4, TD, sys_preadv, "preadv" },
[ 70] = { 4, TD, sys_pwritev, "pwritev" },
[ 71] = { 4, TD|TN, sys_sendfile64, "sendfile" },
[ 72] = { 6, TD, sys_pselect6, "pselect6" },
[ 73] = { 5, TD, sys_ppoll, "ppoll" },
[ 74] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[ 75] = { 4, TD, sys_vmsplice, "vmsplice" },
[ 76] = { 6, TD, sys_splice, "splice" },
[ 77] = { 4, TD, sys_tee, "tee" },
[ 78] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[ 79] = { 4, TD|TF, sys_newfstatat, "newfstatat" },
[ 80] = { 2, TD, sys_fstat, "fstat" },
[ 81] = { 0, 0, sys_sync, "sync" },
[ 82] = { 1, TD, sys_fsync, "fsync" },
[ 83] = { 1, TD, sys_fdatasync, "fdatasync" },
[ 84] = { 4, TD, sys_sync_file_range, "sync_file_range" },
[ 85] = { 2, TD, sys_timerfd_create, "timerfd_create" },
[ 86] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[ 87] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[ 88] = { 4, TD|TF, sys_utimensat, "utimensat" },
[ 89] = { 1, TF, sys_acct, "acct" },
[ 90] = { 2, 0, sys_capget, "capget" },
[ 91] = { 2, 0, sys_capset, "capset" },
[ 92] = { 1, 0, sys_personality, "personality" },
[ 93] = { 1, TP|SE, sys_exit, "exit" },
[ 94] = { 1, TP|SE, sys_exit, "exit_group" },
[ 95] = { 5, TP, sys_waitid, "waitid" },
[ 96] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[ 97] = { 1, TP, sys_unshare, "unshare" },
[ 98] = { 6, 0, sys_futex, "futex" },
[ 99] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[100] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[101] = { 2, 0, sys_nanosleep, "nanosleep" },
[102] = { 2, 0, sys_getitimer, "getitimer" },
[103] = { 3, 0, sys_setitimer, "setitimer" },
[104] = { 4, 0, sys_kexec_load, "kexec_load" },
[105] = { 3, 0, sys_init_module, "init_module" },
[106] = { 2, 0, sys_delete_module, "delete_module" },
[107] = { 3, 0, sys_timer_create, "timer_create" },
[108] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[109] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[110] = { 4, 0, sys_timer_settime, "timer_settime" },
[111] = { 1, 0, sys_timer_delete, "timer_delete" },
[112] = { 2, 0, sys_clock_settime, "clock_settime" },
[113] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[114] = { 2, 0, sys_clock_getres, "clock_getres" },
[115] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[116] = { 3, 0, sys_syslog, "syslog" },
[117] = { 4, 0, sys_ptrace, "ptrace" },
[118] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[119] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[120] = { 1, 0, sys_sched_getscheduler, "sched_getscheduler" },
[121] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[122] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[123] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[124] = { 0, 0, sys_sched_yield, "sched_yield" },
[125] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[126] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[127] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[128] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[129] = { 2, TS, sys_kill, "kill" },
[130] = { 2, TS, sys_kill, "tkill" },
[131] = { 3, TS, sys_tgkill, "tgkill" },
[132] = { 2, TS, sys_sigaltstack, "sigaltstack" },
[133] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[134] = { 4, TS, sys_rt_sigaction, "rt_sigaction" },
[135] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[136] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[137] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[138] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[139] = { 0, TS, sys_sigreturn, "rt_sigreturn" },
[140] = { 3, 0, sys_setpriority, "setpriority" },
[141] = { 2, 0, sys_getpriority, "getpriority" },
[142] = { 4, 0, sys_reboot, "reboot" },
[143] = { 2, 0, sys_setregid, "setregid" },
[144] = { 1, 0, sys_setgid, "setgid" },
[145] = { 2, 0, sys_setreuid, "setreuid" },
[146] = { 1, 0, sys_setuid, "setuid" },
[147] = { 3, 0, sys_setresuid, "setresuid" },
[148] = { 3, 0, sys_getresuid, "getresuid" },
[149] = { 3, 0, sys_setresgid, "setresgid" },
[150] = { 3, 0, sys_getresgid, "getresgid" },
[151] = { 1, NF, sys_setfsuid, "setfsuid" },
[152] = { 1, NF, sys_setfsgid, "setfsgid" },
[153] = { 1, 0, sys_times, "times" },
[154] = { 2, 0, sys_setpgid, "setpgid" },
[155] = { 1, 0, sys_getpgid, "getpgid" },
[156] = { 1, 0, sys_getsid, "getsid" },
[157] = { 0, 0, sys_setsid, "setsid" },
[158] = { 2, 0, sys_getgroups, "getgroups" },
[159] = { 2, 0, sys_setgroups, "setgroups" },
[160] = { 1, 0, sys_uname, "uname" },
[161] = { 2, 0, sys_sethostname, "sethostname" },
[162] = { 2, 0, sys_setdomainname, "setdomainname" },
[163] = { 2, 0, sys_getrlimit, "getrlimit" },
[164] = { 2, 0, sys_setrlimit, "setrlimit" },
[165] = { 2, 0, sys_getrusage, "getrusage" },
[166] = { 1, 0, sys_umask, "umask" },
[167] = { 5, 0, sys_prctl, "prctl" },
[168] = { 3, 0, sys_getcpu, "getcpu" },
[169] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[170] = { 2, 0, sys_settimeofday, "settimeofday" },
[171] = { 1, 0, sys_adjtimex, "adjtimex" },
[172] = { 0, 0, sys_getpid, "getpid" },
[173] = { 0, 0, sys_getppid, "getppid" },
[174] = { 0, NF, sys_getuid, "getuid" },
[175] = { 0, NF, sys_geteuid, "geteuid" },
[176] = { 0, NF, sys_getgid, "getgid" },
[177] = { 0, NF, sys_getegid, "getegid" },
[178] = { 0, 0, sys_gettid, "gettid" },
[179] = { 1, 0, sys_sysinfo, "sysinfo" },
[180] = { 4, 0, sys_mq_open, "mq_open" },
[181] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[182] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[183] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[184] = { 2, 0, sys_mq_notify, "mq_notify" },
[185] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[186] = { 2, TI, sys_msgget, "msgget" },
[187] = { 3, TI, sys_msgctl, "msgctl" },
[188] = { 5, TI, sys_msgrcv, "msgrcv" },
[189] = { 4, TI, sys_msgsnd, "msgsnd" },
[190] = { 3, TI, sys_semget, "semget" },
[191] = { 4, TI, sys_semctl, "semctl" },
[192] = { 4, TI, sys_semtimedop, "semtimedop" },
[193] = { 3, TI, sys_semop, "semop" },
[194] = { 3, TI, sys_shmget, "shmget" },
[195] = { 3, TI, sys_shmctl, "shmctl" },
[196] = { 3, TI|TM|SI, sys_shmat, "shmat" },
[197] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[198] = { 3, TN, sys_socket, "socket" },
[199] = { 4, TN, sys_socketpair, "socketpair" },
[200] = { 3, TN, sys_bind, "bind" },
[201] = { 2, TN, sys_listen, "listen" },
[202] = { 3, TN, sys_accept, "accept" },
[203] = { 3, TN, sys_connect, "connect" },
[204] = { 3, TN, sys_getsockname, "getsockname" },
[205] = { 3, TN, sys_getpeername, "getpeername" },
[206] = { 6, TN, sys_sendto, "sendto" },
[207] = { 6, TN, sys_recvfrom, "recvfrom" },
[208] = { 5, TN, sys_setsockopt, "setsockopt" },
[209] = { 5, TN, sys_getsockopt, "getsockopt" },
[210] = { 2, TN, sys_shutdown, "shutdown" },
[211] = { 3, TN, sys_sendmsg, "sendmsg" },
[212] = { 3, TN, sys_recvmsg, "recvmsg" },
[213] = { 3, TD, sys_readahead, "readahead" },
[214] = { 1, TM|SI, sys_brk, "brk" },
[215] = { 2, TM|SI, sys_munmap, "munmap" },
[216] = { 5, TM|SI, sys_mremap, "mremap" },
[217] = { 5, 0, sys_add_key, "add_key" },
[218] = { 4, 0, sys_request_key, "request_key" },
[219] = { 5, 0, sys_keyctl, "keyctl" },
[220] = { 5, TP, sys_clone, "clone" },
[221] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[222] = { 6, TD|TM|SI, sys_mmap, "mmap" },
[223] = { 4, TD, sys_fadvise64, "fadvise64" },
[224] = { 2, TF, sys_swapon, "swapon" },
[225] = { 1, TF, sys_swapoff, "swapoff" },
[226] = { 3, TM|SI, sys_mprotect, "mprotect" },
[227] = { 3, TM, sys_msync, "msync" },
[228] = { 2, TM, sys_mlock, "mlock" },
[229] = { 2, TM, sys_munlock, "munlock" },
[230] = { 1, TM, sys_mlockall, "mlockall" },
[231] = { 0, TM, sys_munlockall, "munlockall" },
[232] = { 3, TM, sys_mincore, "mincore" },
[233] = { 3, TM, sys_madvise, "madvise" },
[234] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[235] = { 6, TM, sys_mbind, "mbind" },
[236] = { 5, TM, sys_get_mempolicy, "get_mempolicy" },
[237] = { 3, TM, sys_set_mempolicy, "set_mempolicy" },
[238] = { 4, TM, sys_migrate_pages, "migrate_pages" },
[239] = { 6, TM, sys_move_pages, "move_pages" },
[240] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[241] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[242] = { 4, TN, sys_accept4, "accept4" },
[243] = { 5, TN, sys_recvmmsg, "recvmmsg" },
[ 0] = { 2, 0, SEN(io_setup), "io_setup" },
[ 1] = { 1, 0, SEN(io_destroy), "io_destroy" },
[ 2] = { 3, 0, SEN(io_submit), "io_submit" },
[ 3] = { 3, 0, SEN(io_cancel), "io_cancel" },
[ 4] = { 5, 0, SEN(io_getevents), "io_getevents" },
[ 5] = { 5, TF, SEN(setxattr), "setxattr" },
[ 6] = { 5, TF, SEN(setxattr), "lsetxattr" },
[ 7] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
[ 8] = { 4, TF, SEN(getxattr), "getxattr" },
[ 9] = { 4, TF, SEN(getxattr), "lgetxattr" },
[ 10] = { 4, TD, SEN(fgetxattr), "fgetxattr" },
[ 11] = { 3, TF, SEN(listxattr), "listxattr" },
[ 12] = { 3, TF, SEN(listxattr), "llistxattr" },
[ 13] = { 3, TD, SEN(flistxattr), "flistxattr" },
[ 14] = { 2, TF, SEN(removexattr), "removexattr" },
[ 15] = { 2, TF, SEN(removexattr), "lremovexattr" },
[ 16] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
[ 17] = { 2, TF, SEN(getcwd), "getcwd" },
[ 18] = { 3, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[ 19] = { 2, TD, SEN(eventfd2), "eventfd2" },
[ 20] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[ 21] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[ 22] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[ 23] = { 1, TD, SEN(dup), "dup" },
[ 24] = { 3, TD, SEN(dup3), "dup3" },
[ 25] = { 3, TD, SEN(fcntl), "fcntl" },
[ 26] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[ 27] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[ 28] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[ 29] = { 3, TD, SEN(ioctl), "ioctl" },
[ 30] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[ 31] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[ 32] = { 2, TD, SEN(flock), "flock" },
[ 33] = { 4, TD|TF, SEN(mknodat), "mknodat" },
[ 34] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },
[ 35] = { 3, TD|TF, SEN(unlinkat), "unlinkat" },
[ 36] = { 3, TD|TF, SEN(symlinkat), "symlinkat" },
[ 37] = { 5, TD|TF, SEN(linkat), "linkat" },
[ 38] = { 4, TD|TF, SEN(renameat), "renameat" },
[ 39] = { 2, TF, SEN(umount2), "umount2" },
[ 40] = { 5, TF, SEN(mount), "mount" },
[ 41] = { 2, TF, SEN(pivotroot), "pivot_root" },
[ 42] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[ 43] = { 2, TF, SEN(statfs), "statfs" },
[ 44] = { 2, TD, SEN(fstatfs), "fstatfs" },
[ 45] = { 2, TF, SEN(truncate), "truncate" },
[ 46] = { 2, TD, SEN(ftruncate), "ftruncate" },
[ 47] = { 4, TD, SEN(fallocate), "fallocate" },
[ 48] = { 3, TD|TF, SEN(faccessat), "faccessat" },
[ 49] = { 1, TF, SEN(chdir), "chdir" },
[ 50] = { 1, TD, SEN(fchdir), "fchdir" },
[ 51] = { 1, TF, SEN(chroot), "chroot" },
[ 52] = { 2, TD, SEN(fchmod), "fchmod" },
[ 53] = { 3, TD|TF, SEN(fchmodat), "fchmodat" },
[ 54] = { 5, TD|TF, SEN(fchownat), "fchownat" },
[ 55] = { 3, TD, SEN(fchown), "fchown" },
[ 56] = { 4, TD|TF, SEN(openat), "openat" },
[ 57] = { 1, TD, SEN(close), "close" },
[ 58] = { 0, 0, SEN(vhangup), "vhangup" },
[ 59] = { 2, TD, SEN(pipe2), "pipe2" },
[ 60] = { 4, TF, SEN(quotactl), "quotactl" },
[ 61] = { 3, TD, SEN(getdents64), "getdents64" },
[ 62] = { 3, TD, SEN(lseek), "lseek" },
[ 63] = { 3, TD, SEN(read), "read" },
[ 64] = { 3, TD, SEN(write), "write" },
[ 65] = { 3, TD, SEN(readv), "readv" },
[ 66] = { 3, TD, SEN(writev), "writev" },
[ 67] = { 4, TD, SEN(pread), "pread64" },
[ 68] = { 4, TD, SEN(pwrite), "pwrite64" },
[ 69] = { 4, TD, SEN(preadv), "preadv" },
[ 70] = { 4, TD, SEN(pwritev), "pwritev" },
[ 71] = { 4, TD|TN, SEN(sendfile64), "sendfile" },
[ 72] = { 6, TD, SEN(pselect6), "pselect6" },
[ 73] = { 5, TD, SEN(ppoll), "ppoll" },
[ 74] = { 4, TD|TS, SEN(signalfd4), "signalfd4" },
[ 75] = { 4, TD, SEN(vmsplice), "vmsplice" },
[ 76] = { 6, TD, SEN(splice), "splice" },
[ 77] = { 4, TD, SEN(tee), "tee" },
[ 78] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[ 79] = { 4, TD|TF, SEN(newfstatat), "newfstatat" },
[ 80] = { 2, TD, SEN(fstat), "fstat" },
[ 81] = { 0, 0, SEN(sync), "sync" },
[ 82] = { 1, TD, SEN(fsync), "fsync" },
[ 83] = { 1, TD, SEN(fdatasync), "fdatasync" },
[ 84] = { 4, TD, SEN(sync_file_range), "sync_file_range" },
[ 85] = { 2, TD, SEN(timerfd_create), "timerfd_create" },
[ 86] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" },
[ 87] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" },
[ 88] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[ 89] = { 1, TF, SEN(acct), "acct" },
[ 90] = { 2, 0, SEN(capget), "capget" },
[ 91] = { 2, 0, SEN(capset), "capset" },
[ 92] = { 1, 0, SEN(personality), "personality" },
[ 93] = { 1, TP|SE, SEN(exit), "exit" },
[ 94] = { 1, TP|SE, SEN(exit), "exit_group" },
[ 95] = { 5, TP, SEN(waitid), "waitid" },
[ 96] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[ 97] = { 1, TP, SEN(unshare), "unshare" },
[ 98] = { 6, 0, SEN(futex), "futex" },
[ 99] = { 2, 0, SEN(set_robust_list), "set_robust_list" },
[100] = { 3, 0, SEN(get_robust_list), "get_robust_list" },
[101] = { 2, 0, SEN(nanosleep), "nanosleep" },
[102] = { 2, 0, SEN(getitimer), "getitimer" },
[103] = { 3, 0, SEN(setitimer), "setitimer" },
[104] = { 4, 0, SEN(kexec_load), "kexec_load" },
[105] = { 3, 0, SEN(init_module), "init_module" },
[106] = { 2, 0, SEN(delete_module), "delete_module" },
[107] = { 3, 0, SEN(timer_create), "timer_create" },
[108] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[109] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
[110] = { 4, 0, SEN(timer_settime), "timer_settime" },
[111] = { 1, 0, SEN(timer_delete), "timer_delete" },
[112] = { 2, 0, SEN(clock_settime), "clock_settime" },
[113] = { 2, 0, SEN(clock_gettime), "clock_gettime" },
[114] = { 2, 0, SEN(clock_getres), "clock_getres" },
[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" },
[128] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[129] = { 2, TS, SEN(kill), "kill" },
[130] = { 2, TS, SEN(kill), "tkill" },
[131] = { 3, TS, SEN(tgkill), "tgkill" },
[132] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[133] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[134] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" },
[135] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[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" },
[140] = { 3, 0, SEN(setpriority), "setpriority" },
[141] = { 2, 0, SEN(getpriority), "getpriority" },
[142] = { 4, 0, SEN(reboot), "reboot" },
[143] = { 2, 0, SEN(setregid), "setregid" },
[144] = { 1, 0, SEN(setgid), "setgid" },
[145] = { 2, 0, SEN(setreuid), "setreuid" },
[146] = { 1, 0, SEN(setuid), "setuid" },
[147] = { 3, 0, SEN(setresuid), "setresuid" },
[148] = { 3, 0, SEN(getresuid), "getresuid" },
[149] = { 3, 0, SEN(setresgid), "setresgid" },
[150] = { 3, 0, SEN(getresgid), "getresgid" },
[151] = { 1, NF, SEN(setfsuid), "setfsuid" },
[152] = { 1, NF, SEN(setfsgid), "setfsgid" },
[153] = { 1, 0, SEN(times), "times" },
[154] = { 2, 0, SEN(setpgid), "setpgid" },
[155] = { 1, 0, SEN(getpgid), "getpgid" },
[156] = { 1, 0, SEN(getsid), "getsid" },
[157] = { 0, 0, SEN(setsid), "setsid" },
[158] = { 2, 0, SEN(getgroups), "getgroups" },
[159] = { 2, 0, SEN(setgroups), "setgroups" },
[160] = { 1, 0, SEN(uname), "uname" },
[161] = { 2, 0, SEN(sethostname), "sethostname" },
[162] = { 2, 0, SEN(setdomainname), "setdomainname" },
[163] = { 2, 0, SEN(getrlimit), "getrlimit" },
[164] = { 2, 0, SEN(setrlimit), "setrlimit" },
[165] = { 2, 0, SEN(getrusage), "getrusage" },
[166] = { 1, 0, SEN(umask), "umask" },
[167] = { 5, 0, SEN(prctl), "prctl" },
[168] = { 3, 0, SEN(getcpu), "getcpu" },
[169] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[170] = { 2, 0, SEN(settimeofday), "settimeofday" },
[171] = { 1, 0, SEN(adjtimex), "adjtimex" },
[172] = { 0, 0, SEN(getpid), "getpid" },
[173] = { 0, 0, SEN(getppid), "getppid" },
[174] = { 0, NF, SEN(getuid), "getuid" },
[175] = { 0, NF, SEN(geteuid), "geteuid" },
[176] = { 0, NF, SEN(getgid), "getgid" },
[177] = { 0, NF, SEN(getegid), "getegid" },
[178] = { 0, 0, SEN(gettid), "gettid" },
[179] = { 1, 0, SEN(sysinfo), "sysinfo" },
[180] = { 4, 0, SEN(mq_open), "mq_open" },
[181] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[182] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[183] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[184] = { 2, 0, SEN(mq_notify), "mq_notify" },
[185] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[186] = { 2, TI, SEN(msgget), "msgget" },
[187] = { 3, TI, SEN(msgctl), "msgctl" },
[188] = { 5, TI, SEN(msgrcv), "msgrcv" },
[189] = { 4, TI, SEN(msgsnd), "msgsnd" },
[190] = { 3, TI, SEN(semget), "semget" },
[191] = { 4, TI, SEN(semctl), "semctl" },
[192] = { 4, TI, SEN(semtimedop), "semtimedop" },
[193] = { 3, TI, SEN(semop), "semop" },
[194] = { 3, TI, SEN(shmget), "shmget" },
[195] = { 3, TI, SEN(shmctl), "shmctl" },
[196] = { 3, TI|TM|SI, SEN(shmat), "shmat" },
[197] = { 1, TI|TM|SI, SEN(shmdt), "shmdt" },
[198] = { 3, TN, SEN(socket), "socket" },
[199] = { 4, TN, SEN(socketpair), "socketpair" },
[200] = { 3, TN, SEN(bind), "bind" },
[201] = { 2, TN, SEN(listen), "listen" },
[202] = { 3, TN, SEN(accept), "accept" },
[203] = { 3, TN, SEN(connect), "connect" },
[204] = { 3, TN, SEN(getsockname), "getsockname" },
[205] = { 3, TN, SEN(getpeername), "getpeername" },
[206] = { 6, TN, SEN(sendto), "sendto" },
[207] = { 6, TN, SEN(recvfrom), "recvfrom" },
[208] = { 5, TN, SEN(setsockopt), "setsockopt" },
[209] = { 5, TN, SEN(getsockopt), "getsockopt" },
[210] = { 2, TN, SEN(shutdown), "shutdown" },
[211] = { 3, TN, SEN(sendmsg), "sendmsg" },
[212] = { 3, TN, SEN(recvmsg), "recvmsg" },
[213] = { 3, TD, SEN(readahead), "readahead" },
[214] = { 1, TM|SI, SEN(brk), "brk" },
[215] = { 2, TM|SI, SEN(munmap), "munmap" },
[216] = { 5, TM|SI, SEN(mremap), "mremap" },
[217] = { 5, 0, SEN(add_key), "add_key" },
[218] = { 4, 0, SEN(request_key), "request_key" },
[219] = { 5, 0, SEN(keyctl), "keyctl" },
[220] = { 5, TP, SEN(clone), "clone" },
[221] = { 3, TF|TP|SE|SI, SEN(execve), "execve" },
[222] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[223] = { 4, TD, SEN(fadvise64), "fadvise64" },
[224] = { 2, TF, SEN(swapon), "swapon" },
[225] = { 1, TF, SEN(swapoff), "swapoff" },
[226] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[227] = { 3, TM, SEN(msync), "msync" },
[228] = { 2, TM, SEN(mlock), "mlock" },
[229] = { 2, TM, SEN(munlock), "munlock" },
[230] = { 1, TM, SEN(mlockall), "mlockall" },
[231] = { 0, TM, SEN(munlockall), "munlockall" },
[232] = { 3, TM, SEN(mincore), "mincore" },
[233] = { 3, TM, SEN(madvise), "madvise" },
[234] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[235] = { 6, TM, SEN(mbind), "mbind" },
[236] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[237] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[238] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[239] = { 6, TM, SEN(move_pages), "move_pages" },
[240] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" },
[241] = { 5, TD, SEN(perf_event_open), "perf_event_open" },
[242] = { 4, TN, SEN(accept4), "accept4" },
[243] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
/* [244 ... 259] are arch specific */
[260] = { 4, TP, sys_wait4, "wait4" },
[261] = { 4, 0, sys_prlimit64, "prlimit64" },
[262] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[263] = { 5, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[264] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[265] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[266] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[267] = { 1, TD, sys_syncfs, "syncfs" },
[268] = { 2, TD, sys_setns, "setns" },
[269] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[270] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[271] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[272] = { 5, 0, sys_kcmp, "kcmp" },
[273] = { 3, TD, sys_finit_module, "finit_module" },
[274] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[275] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[276] = { 5, TD|TF, sys_renameat2, "renameat2" },
[277] = { 3, 0, sys_seccomp, "seccomp", },
[278] = { 3, 0, sys_getrandom, "getrandom", },
[279] = { 2, TD, sys_memfd_create, "memfd_create", },
[280] = { 3, TD, sys_bpf, "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, sys_execveat, "execveat", },
[260] = { 4, TP, SEN(wait4), "wait4" },
[261] = { 4, 0, SEN(prlimit64), "prlimit64" },
[262] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[263] = { 5, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[264] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" },
[265] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[266] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[267] = { 1, TD, SEN(syncfs), "syncfs" },
[268] = { 2, TD, SEN(setns), "setns" },
[269] = { 4, TN, SEN(sendmmsg), "sendmmsg" },
[270] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" },
[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" },
[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", },
[284] = { 3, TM, SEN(mlock2), "mlock2" },

38
linux/aarch64/arch_regs.c Normal file
View File

@ -0,0 +1,38 @@
struct arm_pt_regs {
uint32_t uregs[18];
};
#define ARM_cpsr uregs[16]
#define ARM_pc uregs[15]
#define ARM_lr uregs[14]
#define ARM_sp uregs[13]
#define ARM_ip uregs[12]
#define ARM_fp uregs[11]
#define ARM_r10 uregs[10]
#define ARM_r9 uregs[9]
#define ARM_r8 uregs[8]
#define ARM_r7 uregs[7]
#define ARM_r6 uregs[6]
#define ARM_r5 uregs[5]
#define ARM_r4 uregs[4]
#define ARM_r3 uregs[3]
#define ARM_r2 uregs[2]
#define ARM_r1 uregs[1]
#define ARM_r0 uregs[0]
#define ARM_ORIG_r0 uregs[17]
static union {
struct user_pt_regs aarch64_r;
struct arm_pt_regs arm_r;
} arm_regs_union;
#define aarch64_regs arm_regs_union.aarch64_r
#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;
static struct iovec aarch64_io = {
.iov_base = &arm_regs_union
};
#define ARCH_REGS_FOR_GETREGSET arm_regs_union
#define ARCH_IOVEC_FOR_GETREGSET aarch64_io
#define ARCH_PC_REG ((aarch64_io.iov_len == sizeof(arm_regs)) ? arm_regs.ARM_pc : aarch64_regs.pc)

View File

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

View File

@ -1,2 +1,2 @@
/* Native AArch64 */
/* ARM personality */
#include "errnoent.h"

19
linux/aarch64/get_error.c Normal file
View File

@ -0,0 +1,19 @@
#define get_error arm_get_error
#include "arm/get_error.c"
#undef get_error
static void
get_error(struct tcb *tcp, const bool check_errno)
{
if (tcp->currpers == 1) {
arm_get_error(tcp, check_errno);
return;
}
if (check_errno && is_negated_errno(aarch64_regs.regs[0])) {
tcp->u_rval = -1;
tcp->u_error = -aarch64_regs.regs[0];
} else {
tcp->u_rval = aarch64_regs.regs[0];
}
}

24
linux/aarch64/get_scno.c Normal file
View File

@ -0,0 +1,24 @@
/* Return codes: 1 - ok, 0 - ignore, other - error. */
static int
arch_get_scno(struct tcb *tcp)
{
long scno = 0;
switch (aarch64_io.iov_len) {
case sizeof(aarch64_regs):
/* We are in 64-bit mode */
scno = aarch64_regs.regs[8];
update_personality(tcp, 0);
break;
case sizeof(arm_regs):
/* We are in 32-bit mode */
/* Note: we don't support OABI, unlike 32-bit ARM build */
scno = arm_regs.ARM_r7;
scno = shuffle_scno(scno);
update_personality(tcp, 1);
break;
}
tcp->scno = scno;
return 1;
}

View File

@ -0,0 +1,18 @@
#define get_syscall_args arm_get_syscall_args
#include "arm/get_syscall_args.c"
#undef get_syscall_args
/* Return -1 on error or 1 on success (never 0!). */
static int
get_syscall_args(struct tcb *tcp)
{
if (tcp->currpers == 1)
return arm_get_syscall_args(tcp);
tcp->u_arg[0] = aarch64_regs.regs[0];
tcp->u_arg[1] = aarch64_regs.regs[1];
tcp->u_arg[2] = aarch64_regs.regs[2];
tcp->u_arg[3] = aarch64_regs.regs[3];
tcp->u_arg[4] = aarch64_regs.regs[4];
tcp->u_arg[5] = aarch64_regs.regs[5];
return 1;
}

View File

@ -1 +1,71 @@
#include "../arm/syscallent.h"
#include "64/syscallent.h"
/* Arch-specific block, not used on AArch64 */
[244 ... 259] = { },
/* Quote from asm-generic/unistd.h:
*
* All syscalls below here should go away really,
* these are provided for both review and as a porting
* help for the C library version.
*
* Last chance: are any of these important enough to
* enable by default?
*/
[1024] = { 3, TD|TF, SEN(open), "open" },
[1025] = { 2, TF, SEN(link), "link" },
[1026] = { 1, TF, SEN(unlink), "unlink" },
[1027] = { 3, TF, SEN(mknod), "mknod" },
[1028] = { 2, TF, SEN(chmod), "chmod" },
[1029] = { 3, TF, SEN(chown), "chown" },
[1030] = { 2, TF, SEN(mkdir), "mkdir" },
[1031] = { 1, TF, SEN(rmdir), "rmdir" },
[1032] = { 3, TF, SEN(chown), "lchown" },
[1033] = { 2, TF, SEN(access), "access" },
[1034] = { 2, TF, SEN(rename), "rename" },
[1035] = { 3, TF, SEN(readlink), "readlink" },
[1036] = { 2, TF, SEN(symlink), "symlink" },
[1037] = { 2, TF, SEN(utimes), "utimes" },
[1038] = { 2, TF, SEN(stat), "stat" },
[1039] = { 2, TF, SEN(lstat), "lstat" },
[1040] = { 1, TD, SEN(pipe), "pipe" },
[1041] = { 2, TD, SEN(dup2), "dup2" },
[1042] = { 1, TD, SEN(epoll_create), "epoll_create" },
[1043] = { 0, TD, SEN(inotify_init), "inotify_init" },
[1044] = { 1, TD, SEN(eventfd), "eventfd" },
[1045] = { 3, TD|TS, SEN(signalfd), "signalfd" },
[1046] = { 4, TD|TN, SEN(sendfile64), "sendfile" },
[1047] = { 2, TD, SEN(ftruncate), "ftruncate" },
[1048] = { 2, TF, SEN(truncate), "truncate" },
[1049] = { 2, TF, SEN(stat), "stat" },
[1050] = { 2, TF, SEN(lstat), "lstat" },
[1051] = { 2, TD, SEN(fstat), "fstat" },
[1052] = { 3, TD, SEN(fcntl), "fcntl" },
[1053] = { 4, TD, SEN(fadvise64), "fadvise64" },
[1054] = { 4, TD|TF, SEN(newfstatat), "newfstatat" },
[1055] = { 2, TD, SEN(fstatfs), "fstatfs" },
[1056] = { 2, TF, SEN(statfs), "statfs" },
[1057] = { 3, TD, SEN(lseek), "lseek" },
[1058] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[1059] = { 1, 0, SEN(alarm), "alarm" },
[1060] = { 0, 0, SEN(getpgrp), "getpgrp" },
[1061] = { 0, TS, SEN(pause), "pause" },
[1062] = { 1, 0, SEN(time), "time" },
[1063] = { 2, TF, SEN(utime), "utime" },
[1064] = { 2, TD|TF, SEN(creat), "creat" },
[1065] = { 3, TD, SEN(getdents), "getdents" },
[1066] = { 3, TD|TF, SEN(futimesat), "futimesat" },
[1067] = { 5, TD, SEN(select), "select" },
[1068] = { 3, TD, SEN(poll), "poll" },
[1069] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[1070] = { 2, 0, SEN(ustat), "ustat" },
[1071] = { 0, TP, SEN(vfork), "vfork" },
[1072] = { 4, TP, SEN(wait4), "wait4" },
[1073] = { 6, TN, SEN(recv), "recv" },
[1074] = { 4, TN, SEN(send), "send" },
[1075] = { 2, 0, SEN(bdflush), "bdflush" },
[1076] = { 1, TF, SEN(umount), "umount" },
[1077] = { 1, TF, SEN(uselib), "uselib" },
[1078] = { 1, 0, SEN(sysctl), "sysctl" },
[1079] = { 0, TP, SEN(fork), "fork" },

View File

@ -1,74 +1 @@
#include "64/syscallent.h"
/* Arch-specific block, not used on AArch64 */
[244 ... 259] = { },
/* Blank down to 1023 */
[277 ... 1023] = { },
/* Quote from asm-generic/unistd.h:
*
* All syscalls below here should go away really,
* these are provided for both review and as a porting
* help for the C library version.
*
* Last chance: are any of these important enough to
* enable by default?
*/
[1024] = { 3, TD|TF, sys_open, "open" },
[1025] = { 2, TF, sys_link, "link" },
[1026] = { 1, TF, sys_unlink, "unlink" },
[1027] = { 3, TF, sys_mknod, "mknod" },
[1028] = { 2, TF, sys_chmod, "chmod" },
[1029] = { 3, TF, sys_chown, "chown" },
[1030] = { 2, TF, sys_mkdir, "mkdir" },
[1031] = { 1, TF, sys_rmdir, "rmdir" },
[1032] = { 3, TF, sys_chown, "lchown" },
[1033] = { 2, TF, sys_access, "access" },
[1034] = { 2, TF, sys_rename, "rename" },
[1035] = { 3, TF, sys_readlink, "readlink" },
[1036] = { 2, TF, sys_symlink, "symlink" },
[1037] = { 2, TF, sys_utimes, "utimes" },
[1038] = { 2, TF, sys_stat, "stat" },
[1039] = { 2, TF, sys_lstat, "lstat" },
[1040] = { 1, TD, sys_pipe, "pipe" },
[1041] = { 2, TD, sys_dup2, "dup2" },
[1042] = { 1, TD, sys_epoll_create, "epoll_create" },
[1043] = { 0, TD, sys_inotify_init, "inotify_init" },
[1044] = { 1, TD, sys_eventfd, "eventfd" },
[1045] = { 3, TD|TS, sys_signalfd, "signalfd" },
[1046] = { 4, TD|TN, sys_sendfile64, "sendfile" },
[1047] = { 2, TD, sys_ftruncate, "ftruncate" },
[1048] = { 2, TF, sys_truncate, "truncate" },
[1049] = { 2, TF, sys_stat, "stat" },
[1050] = { 2, TF, sys_lstat, "lstat" },
[1051] = { 2, TD, sys_fstat, "fstat" },
[1052] = { 3, TD, sys_fcntl, "fcntl" },
[1053] = { 4, TD, sys_fadvise64, "fadvise64" },
[1054] = { 4, TD|TF, sys_newfstatat, "newfstatat" },
[1055] = { 2, TD, sys_fstatfs, "fstatfs" },
[1056] = { 2, TF, sys_statfs, "statfs" },
[1057] = { 3, TD, sys_lseek, "lseek" },
[1058] = { 6, TD|TM|SI, sys_mmap, "mmap" },
[1059] = { 1, 0, sys_alarm, "alarm" },
[1060] = { 0, 0, sys_getpgrp, "getpgrp" },
[1061] = { 0, TS, sys_pause, "pause" },
[1062] = { 1, 0, sys_time, "time" },
[1063] = { 2, TF, sys_utime, "utime" },
[1064] = { 2, TD|TF, sys_creat, "creat" },
[1065] = { 3, TD, sys_getdents, "getdents" },
[1066] = { 3, TD|TF, sys_futimesat, "futimesat" },
[1067] = { 5, TD, sys_select, "select" },
[1068] = { 3, TD, sys_poll, "poll" },
[1069] = { 4, TD, sys_epoll_wait, "epoll_wait" },
[1070] = { 2, 0, sys_ustat, "ustat" },
[1071] = { 0, TP, sys_vfork, "vfork" },
[1072] = { 4, TP, sys_wait4, "wait4" },
[1073] = { 6, TN, sys_recv, "recv" },
[1074] = { 4, TN, sys_send, "send" },
[1075] = { 2, 0, sys_bdflush, "bdflush" },
[1076] = { 1, TF, sys_umount, "umount" },
[1077] = { 1, TF, sys_uselib, "uselib" },
[1078] = { 1, 0, sys_sysctl, "sysctl" },
[1079] = { 0, TP, sys_fork, "fork" },
#include "../arm/syscallent.h"

View File

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

3
linux/alpha/arch_regs.c Normal file
View File

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

View File

@ -0,0 +1,13 @@
static void
arch_sigreturn(struct tcb *tcp)
{
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);
tprints("}");
}

10
linux/alpha/get_error.c Normal file
View File

@ -0,0 +1,10 @@
static void
get_error(struct tcb *tcp, const bool check_errno)
{
if (check_errno && alpha_a3) {
tcp->u_rval = -1;
tcp->u_error = alpha_r0;
} else {
tcp->u_rval = alpha_r0;
}
}

26
linux/alpha/get_scno.c Normal file
View File

@ -0,0 +1,26 @@
/* Return codes: 1 - ok, 0 - ignore, other - error. */
static int
arch_get_scno(struct tcb *tcp)
{
long scno = 0;
if (upeek(tcp->pid, REG_A3, &alpha_a3) < 0)
return -1;
if (upeek(tcp->pid, REG_R0, &scno) < 0)
return -1;
/*
* 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 (debug_flag)
error_msg("stray syscall exit: r0 = %ld", scno);
return 0;
}
}
tcp->scno = scno;
return 1;
}

View File

@ -0,0 +1,11 @@
/* Return -1 on error or 1 on success (never 0!). */
static int
get_syscall_args(struct tcb *tcp)
{
unsigned int i;
for (i = 0; i < tcp->s_ent->nargs; ++i)
if (upeek(tcp->pid, REG_A0+i, &tcp->u_arg[i]) < 0)
return -1;
return 1;
}

View File

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

View File

@ -26,445 +26,453 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[ 0] = { 6, 0, printargs, "osf_syscall" }, /*not implemented */
[ 1] = { 1, TP|SE, sys_exit, "exit" },
[ 2] = { 0, TP, sys_fork, "fork" },
[ 3] = { 3, TD, sys_read, "read" },
[ 4] = { 3, TD, sys_write, "write" },
[ 5] = { 5, 0, printargs, "osf_old_open" }, /*not implemented */
[ 6] = { 1, TD, sys_close, "close" },
[ 7] = { 4, TP, sys_osf_wait4, "osf_wait4" },
[ 8] = { 5, 0, printargs, "osf_old_creat" }, /*not implemented */
[ 9] = { 2, TF, sys_link, "link" },
[ 10] = { 1, TF, sys_unlink, "unlink" },
[ 11] = { 5, 0, printargs, "osf_execve" }, /*not implemented */
[ 12] = { 1, TF, sys_chdir, "chdir" },
[ 13] = { 1, TD, sys_fchdir, "fchdir" },
[ 14] = { 3, TF, sys_mknod, "mknod" },
[ 15] = { 2, TF, sys_chmod, "chmod" },
[ 16] = { 3, TF, sys_chown, "chown" },
[ 17] = { 1, TM|SI, sys_brk, "brk" },
[ 18] = { 5, 0, printargs, "osf_getfsstat" }, /*not implemented */
[ 19] = { 3, TD, sys_lseek, "lseek" },
[ 20] = { 0, 0, sys_getpid, "getxpid" },
[ 21] = { 4, 0, printargs, "osf_mount" },
[ 22] = { 2, TF, sys_umount2, "umount" },
[ 23] = { 1, 0, sys_setuid, "setuid" },
[ 24] = { 0, NF, sys_getuid, "getxuid" },
[ 25] = { 5, 0, printargs, "exec_with_loader" }, /*not implemented */
[ 26] = { 4, 0, sys_ptrace, "ptrace" },
[ 27] = { 5, 0, printargs, "osf_nrecvmsg" }, /*not implemented */
[ 28] = { 5, 0, printargs, "osf_nsendmsg" }, /*not implemented */
[ 29] = { 5, 0, printargs, "osf_nrecvfrom" }, /*not implemented */
[ 30] = { 5, 0, printargs, "osf_naccept" }, /*not implemented */
[ 31] = { 5, 0, printargs, "osf_ngetpeername" }, /*not implemented */
[ 32] = { 5, 0, printargs, "osf_ngetsockname" }, /*not implemented */
[ 33] = { 2, TF, sys_access, "access" },
[ 34] = { 5, 0, printargs, "osf_chflags" }, /*not implemented */
[ 35] = { 5, 0, printargs, "osf_fchflags" }, /*not implemented */
[ 36] = { 0, 0, sys_sync, "sync" },
[ 37] = { 2, TS, sys_kill, "kill" },
[ 38] = { 5, 0, printargs, "osf_old_stat" }, /*not implemented */
[ 39] = { 2, 0, sys_setpgid, "setpgid" },
[ 40] = { 5, 0, printargs, "osf_old_lstat" }, /*not implemented */
[ 41] = { 1, TD, sys_dup, "dup" },
[ 42] = { 1, TD, sys_pipe, "pipe" },
[ 43] = { 5, 0, printargs, "osf_set_program_attributes" },
[ 44] = { 5, 0, printargs, "osf_profil" }, /*not implemented */
[ 45] = { 3, TD|TF, sys_open, "open" },
[ 46] = { 5, 0, printargs, "osf_old_sigaction" }, /*not implemented */
[ 47] = { 1, NF, sys_getgid, "getxgid" },
[ 48] = { 2, TS, sys_sigprocmask, "osf_sigprocmask" },
[ 49] = { 5, 0, printargs, "osf_getlogin" }, /*not implemented */
[ 50] = { 5, 0, printargs, "osf_setlogin" }, /*not implemented */
[ 51] = { 1, TF, sys_acct, "acct" },
[ 52] = { 1, TS, sys_sigpending, "sigpending" },
[ 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 */
[ 6] = { 1, TD, SEN(close), "close" },
[ 7] = { 4, TP, SEN(osf_wait4), "osf_wait4" },
[ 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 */
[ 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 */
[ 19] = { 3, TD, SEN(lseek), "lseek" },
[ 20] = { 0, 0, SEN(getpid), "getxpid" },
[ 21] = { 4, 0, SEN(printargs), "osf_mount" },
[ 22] = { 2, TF, SEN(umount2), "umount" },
[ 23] = { 1, 0, SEN(setuid), "setuid" },
[ 24] = { 0, NF, SEN(getuid), "getxuid" },
[ 25] = { 5, 0, SEN(printargs), "exec_with_loader" }, /*not implemented */
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 5, 0, SEN(printargs), "osf_nrecvmsg" }, /*not implemented */
[ 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 */
[ 36] = { 0, 0, SEN(sync), "sync" },
[ 37] = { 2, TS, SEN(kill), "kill" },
[ 38] = { 5, 0, SEN(printargs), "osf_old_stat" }, /*not implemented */
[ 39] = { 2, 0, SEN(setpgid), "setpgid" },
[ 40] = { 5, 0, SEN(printargs), "osf_old_lstat" }, /*not implemented */
[ 41] = { 1, TD, SEN(dup), "dup" },
[ 42] = { 1, TD, SEN(pipe), "pipe" },
[ 43] = { 4, 0, SEN(printargs), "osf_set_program_attributes" },
[ 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(getgid), "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 */
[ 51] = { 1, TF, SEN(acct), "acct" },
[ 52] = { 1, TS, SEN(sigpending), "sigpending" },
[ 53] = { },
[ 54] = { 3, TD, sys_ioctl, "ioctl" },
[ 55] = { 5, 0, printargs, "osf_reboot" }, /*not implemented */
[ 56] = { 5, 0, printargs, "osf_revoke" }, /*not implemented */
[ 57] = { 2, TF, sys_symlink, "symlink" },
[ 58] = { 3, TF, sys_readlink, "readlink" },
[ 59] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[ 60] = { 1, 0, sys_umask, "umask" },
[ 61] = { 1, TF, sys_chroot, "chroot" },
[ 62] = { 5, 0, printargs, "osf_old_fstat" }, /*not implemented */
[ 63] = { 0, 0, sys_getpgrp, "getpgrp" },
[ 64] = { 0, 0, sys_getpagesize, "getpagesize" },
[ 65] = { 5, TM, printargs, "osf_mremap" }, /*not implemented */
[ 66] = { 0, TP, sys_vfork, "vfork" },
[ 67] = { 2, TF, sys_stat, "stat" },
[ 68] = { 2, TF, sys_lstat, "lstat" },
[ 69] = { 5, TM, printargs, "osf_sbrk" }, /*not implemented */
[ 70] = { 5, 0, printargs, "osf_sstk" }, /*not implemented */
[ 71] = { 6, TD|TM|SI, sys_mmap, "mmap" },
[ 72] = { 5, 0, printargs, "osf_old_vadvise" }, /*not implemented */
[ 73] = { 2, TM|SI, sys_munmap, "munmap" },
[ 74] = { 3, TM|SI, sys_mprotect, "mprotect" },
[ 75] = { 3, TM, sys_madvise, "madvise" },
[ 76] = { 0, 0, sys_vhangup, "vhangup" },
[ 77] = { 5, 0, printargs, "osf_kmodcall" }, /*not implemented */
[ 78] = { 5, TM, printargs, "osf_mincore" }, /*not implemented */
[ 79] = { 2, 0, sys_getgroups, "getgroups" },
[ 80] = { 2, 0, sys_setgroups, "setgroups" },
[ 81] = { 5, 0, printargs, "osf_old_getpgrp" }, /*not implemented */
[ 82] = { 2, 0, sys_setpgrp, "setpgrp" },
[ 83] = { 3, 0, sys_osf_setitimer, "osf_setitimer" },
[ 84] = { 5, 0, printargs, "osf_old_wait" }, /*not implemented */
[ 85] = { 5, 0, printargs, "osf_table" }, /*not implemented */
[ 86] = { 2, 0, sys_osf_getitimer, "osf_getitimer" },
[ 87] = { 2, 0, sys_gethostname, "gethostname" },
[ 88] = { 2, 0, sys_sethostname, "sethostname" },
[ 89] = { 0, 0, sys_getdtablesize, "getdtablesize" },
[ 90] = { 2, TD, sys_dup2, "dup2" },
[ 91] = { 2, TD, sys_fstat, "fstat" },
[ 92] = { 3, TD, sys_fcntl, "fcntl" },
[ 93] = { 5, 0, sys_osf_select, "osf_select" },
[ 94] = { 3, TD, sys_poll, "poll" },
[ 95] = { 1, TD, sys_fsync, "fsync" },
[ 96] = { 3, 0, sys_setpriority, "setpriority" },
[ 97] = { 3, TN, sys_socket, "socket" },
[ 98] = { 3, TN, sys_connect, "connect" },
[ 99] = { 3, TN, sys_accept, "accept" },
[100] = { 2, 0, sys_getpriority, "osf_getpriority" },
[101] = { 4, TN, sys_send, "send" },
[102] = { 4, TN, sys_recv, "recv" },
[103] = { 0, TS, sys_sigreturn, "sigreturn" },
[104] = { 3, TN, sys_bind, "bind" },
[105] = { 5, TN, sys_setsockopt, "setsockopt" },
[106] = { 2, TN, sys_listen, "listen" },
[107] = { 5, 0, printargs, "osf_plock" }, /*not implemented */
[108] = { 5, 0, printargs, "osf_old_sigvec" }, /*not implemented */
[109] = { 5, 0, printargs, "osf_old_sigblock" }, /*not implemented */
[110] = { 5, 0, printargs, "osf_old_sigsetmask" }, /*not implemented */
[111] = { 3, TS, sys_sigsuspend, "sigsuspend" },
[112] = { 5, 0, printargs, "sigstack" },
[113] = { 3, TN, sys_recvmsg, "recvmsg" },
[114] = { 3, TN, sys_sendmsg, "sendmsg" },
[115] = { 5, 0, printargs, "osf_old_vtrace" }, /*not implemented */
[116] = { 2, 0, sys_osf_gettimeofday, "osf_gettimeofday" },
[117] = { 2, 0, sys_osf_getrusage, "osf_getrusage" },
[118] = { 5, TN, sys_getsockopt, "getsockopt" },
[ 54] = { 3, TD, SEN(ioctl), "ioctl" },
[ 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, 0, SEN(umask), "umask" },
[ 61] = { 1, TF, SEN(chroot), "chroot" },
[ 62] = { 5, 0, 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 */
[ 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 */
[ 71] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[ 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 */
[ 79] = { 2, 0, SEN(getgroups), "getgroups" },
[ 80] = { 2, 0, SEN(setgroups), "setgroups" },
[ 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 */
[ 86] = { 2, 0, SEN(osf_getitimer), "osf_getitimer" },
[ 87] = { 2, 0, SEN(gethostname), "gethostname" },
[ 88] = { 2, 0, SEN(sethostname), "sethostname" },
[ 89] = { 0, 0, SEN(getdtablesize), "getdtablesize" },
[ 90] = { 2, TD, SEN(dup2), "dup2" },
[ 91] = { 2, TD, SEN(fstat), "fstat" },
[ 92] = { 3, TD, SEN(fcntl), "fcntl" },
[ 93] = { 5, 0, SEN(osf_select), "osf_select" },
[ 94] = { 3, TD, SEN(poll), "poll" },
[ 95] = { 1, TD, SEN(fsync), "fsync" },
[ 96] = { 3, 0, SEN(setpriority), "setpriority" },
[ 97] = { 3, TN, SEN(socket), "socket" },
[ 98] = { 3, TN, SEN(connect), "connect" },
[ 99] = { 3, TN, SEN(accept), "accept" },
[100] = { 2, 0, SEN(getpriority), "getpriority" },
[101] = { 4, TN, SEN(send), "send" },
[102] = { 4, TN, SEN(recv), "recv" },
[103] = { 0, TS, SEN(sigreturn), "sigreturn" },
[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 */
[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 */
[116] = { 2, 0, SEN(osf_gettimeofday), "osf_gettimeofday" },
[117] = { 2, 0, SEN(osf_getrusage), "osf_getrusage" },
[118] = { 5, TN, SEN(getsockopt), "getsockopt" },
[119] = { },
[120] = { 3, TD, sys_readv, "readv" },
[121] = { 3, TD, sys_writev, "writev" },
[122] = { 2, 0, sys_osf_settimeofday, "osf_settimeofday" },
[123] = { 3, TD, sys_fchown, "fchown" },
[124] = { 2, TD, sys_fchmod, "fchmod" },
[125] = { 6, TN, sys_recvfrom, "recvfrom" },
[126] = { 2, 0, sys_setreuid, "setreuid" },
[127] = { 2, 0, sys_setregid, "setregid" },
[128] = { 2, TF, sys_rename, "rename" },
[129] = { 2, TF, sys_truncate, "truncate" },
[130] = { 2, TD, sys_ftruncate, "ftruncate" },
[131] = { 2, TD, sys_flock, "flock" },
[132] = { 1, 0, sys_setgid, "setgid" },
[133] = { 6, TN, sys_sendto, "sendto" },
[134] = { 2, TN, sys_shutdown, "shutdown" },
[135] = { 4, TN, sys_socketpair, "socketpair" },
[136] = { 2, TF, sys_mkdir, "mkdir" },
[137] = { 1, TF, sys_rmdir, "rmdir" },
[138] = { 2, 0, sys_osf_utimes, "osf_utimes" },
[139] = { 5, 0, printargs, "osf_old_sigreturn" },
[140] = { 5, 0, printargs, "osf_adjtime" }, /*not implemented */
[141] = { 3, TN, sys_getpeername, "getpeername" },
[142] = { 5, 0, printargs, "osf_gethostid" }, /*not implemented */
[143] = { 5, 0, printargs, "osf_sethostid" }, /*not implemented */
[144] = { 2, 0, sys_getrlimit, "getrlimit" },
[145] = { 2, 0, sys_setrlimit, "setrlimit" },
[146] = { 5, 0, printargs, "osf_old_killpg" }, /*not implemented */
[147] = { 0, 0, sys_setsid, "setsid" },
[148] = { 4, TF, sys_quotactl, "quotactl" },
[149] = { 5, 0, printargs, "osf_oldquota" }, /*not implemented */
[150] = { 3, TN, sys_getsockname, "getsockname" },
[120] = { 3, TD, SEN(readv), "readv" },
[121] = { 3, TD, SEN(writev), "writev" },
[122] = { 2, 0, SEN(osf_settimeofday), "osf_settimeofday" },
[123] = { 3, TD, SEN(fchown), "fchown" },
[124] = { 2, TD, SEN(fchmod), "fchmod" },
[125] = { 6, TN, SEN(recvfrom), "recvfrom" },
[126] = { 2, 0, SEN(setreuid), "setreuid" },
[127] = { 2, 0, SEN(setregid), "setregid" },
[128] = { 2, TF, SEN(rename), "rename" },
[129] = { 2, TF, SEN(truncate), "truncate" },
[130] = { 2, TD, SEN(ftruncate), "ftruncate" },
[131] = { 2, TD, SEN(flock), "flock" },
[132] = { 1, 0, SEN(setgid), "setgid" },
[133] = { 6, TN, SEN(sendto), "sendto" },
[134] = { 2, TN, SEN(shutdown), "shutdown" },
[135] = { 4, TN, SEN(socketpair), "socketpair" },
[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 */
[141] = { 3, TN, SEN(getpeername), "getpeername" },
[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 */
[147] = { 0, 0, SEN(setsid), "setsid" },
[148] = { 4, TF, SEN(quotactl), "quotactl" },
[149] = { 5, 0, SEN(printargs), "osf_oldquota" }, /*not implemented */
[150] = { 3, TN, SEN(getsockname), "getsockname" },
[151 ... 152] = { },
[153] = { 5, 0, printargs, "osf_pid_block" }, /*not implemented */
[154] = { 5, 0, 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, sys_sigaction, "sigaction" },
[157] = { 5, 0, printargs, "osf_sigwaitprim" }, /*not implemented */
[158] = { 5, 0, printargs, "osf_nfssvc" }, /*not implemented */
[159] = { 4, 0, printargs, "osf_getdirentries" },
[160] = { 3, 0, osf_statfs, "osf_statfs" },
[161] = { 3, 0, osf_fstatfs, "osf_fstatfs" },
[156] = { 3, TS, SEN(sigaction), "sigaction" },
[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" },
[162] = { },
[163] = { 5, 0, printargs, "osf_asynch_daemon" }, /*not implemented */
[164] = { 5, 0, printargs, "osf_getfh" }, /*not implemented */
[165] = { 2, 0, printargs, "osf_getdomainname" },
[166] = { 2, 0, sys_setdomainname, "setdomainname" },
[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, printargs, "osf_exportfs" }, /*not implemented */
[169] = { 5, 0, SEN(printargs), "osf_exportfs" }, /*not implemented */
[170 ... 180] = { },
[181] = { 5, 0, printargs, "osf_alt_plock" }, /*not implemented */
[181] = { 5, 0, SEN(printargs), "osf_alt_plock" }, /*not implemented */
[182 ... 183] = { },
[184] = { 5, 0, printargs, "osf_getmnt" }, /*not implemented */
[184] = { 5, 0, SEN(printargs), "osf_getmnt" }, /*not implemented */
[185 ... 186] = { },
[187] = { 5, 0, printargs, "osf_alt_sigpending" }, /*not implemented */
[188] = { 5, 0, 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, printargs, "osf_swapon" },
[200] = { 3, TI, sys_msgctl, "msgctl" },
[201] = { 2, TI, sys_msgget, "msgget" },
[202] = { 5, TI, sys_msgrcv, "msgrcv" },
[203] = { 4, TI, sys_msgsnd, "msgsnd" },
[204] = { 4, TI, sys_semctl, "semctl" },
[205] = { 3, TI, sys_semget, "semget" },
[206] = { 4, TI, printargs, "semop" },
[207] = { 1, 0, printargs, "osf_utsname" },
[208] = { 3, TF, sys_chown, "lchown" },
[209] = { 3, TI|TM, printargs, "osf_shmat" },
[210] = { 3, TI, sys_shmctl, "shmctl" },
[211] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[212] = { 3, TI, sys_shmget, "shmget" },
[213] = { 5, 0, printargs, "osf_mvalid" }, /*not implemented */
[214] = { 5, 0, printargs, "osf_getaddressconf" }, /*not implemented */
[215] = { 5, 0, printargs, "osf_msleep" }, /*not implemented */
[216] = { 5, 0, printargs, "osf_mwakeup" }, /*not implemented */
[217] = { 3, TM, sys_msync, "msync" },
[218] = { 5, 0, printargs, "osf_signal" }, /*not implemented */
[219] = { 5, 0, printargs, "osf_utc_gettime" }, /*not implemented */
[220] = { 5, 0, printargs, "osf_utc_adjtime" }, /*not implemented */
[199] = { 4, 0, SEN(printargs), "osf_swapon" },
[200] = { 3, TI, SEN(msgctl), "msgctl" },
[201] = { 2, TI, SEN(msgget), "msgget" },
[202] = { 5, TI, SEN(msgrcv), "msgrcv" },
[203] = { 4, TI, SEN(msgsnd), "msgsnd" },
[204] = { 4, TI, SEN(semctl), "semctl" },
[205] = { 3, TI, SEN(semget), "semget" },
[206] = { 3, TI, SEN(semop), "semop" },
[207] = { 1, 0, SEN(printargs), "osf_utsname" },
[208] = { 3, TF, SEN(chown), "lchown" },
[209] = { 3, TI|TM, SEN(printargs), "osf_shmat" },
[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 */
[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 */
[221] = { },
[222] = { 5, 0, printargs, "osf_security" }, /*not implemented */
[223] = { 5, 0, printargs, "osf_kloadcall" }, /*not implemented */
[224 ... 232] = { },
[233] = { 1, 0, sys_getpgid, "getpgid" },
[234] = { 1, 0, sys_getsid, "getsid" },
[235] = { 5, TS, sys_sigaltstack, "sigaltstack" },
[236] = { 5, 0, printargs, "osf_waitid" }, /*not implemented */
[237] = { 5, 0, printargs, "osf_priocntlset" }, /*not implemented */
[238] = { 5, 0, printargs, "osf_sigsendset" }, /*not implemented */
[239] = { 5, 0, printargs, "osf_set_speculative" }, /*not implemented */
[240] = { 5, 0, printargs, "osf_msfs_syscall" }, /*not implemented */
[241] = { 5, 0, printargs, "osf_sysinfo" },
[242] = { 5, 0, printargs, "osf_uadmin" }, /*not implemented */
[243] = { 5, 0, printargs, "osf_fuser" }, /*not implemented */
[244] = { 2, 0, printargs, "osf_proplist_syscall" },
[245] = { 5, 0, printargs, "osf_ntp_adjtime" }, /*not implemented */
[246] = { 5, 0, printargs, "osf_ntp_gettime" }, /*not implemented */
[247] = { 5, 0, printargs, "osf_pathconf" }, /*not implemented */
[248] = { 5, 0, printargs, "osf_fpathconf" }, /*not implemented */
[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] = { 5, 0, SEN(printargs), "osf_statfs64" }, /*not implemented */
[228] = { 5, 0, SEN(printargs), "osf_fstatfs64" }, /*not implemented */
[229 ... 232] = { },
[233] = { 1, 0, SEN(getpgid), "getpgid" },
[234] = { 1, 0, SEN(getsid), "getsid" },
[235] = { 5, 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 */
[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 */
[249] = { },
[250] = { 5, 0, printargs, "osf_uswitch" }, /*not implemented */
[251] = { 2, 0, printargs, "osf_usleep_thread" },
[252] = { 5, 0, printargs, "osf_audcntl" }, /*not implemented */
[253] = { 5, 0, printargs, "osf_audgen" }, /*not implemented */
[254] = { 5, 0, sys_sysfs, "sysfs" },
[255] = { 5, 0, printargs, "osf_subsysinfo" }, /*not implemented */
[256] = { 5, 0, printargs, "osf_getsysinfo" },
[257] = { 5, 0, printargs, "osf_setsysinfo" },
[258] = { 5, 0, printargs, "osf_afs_syscall" }, /*not implemented */
[259] = { 5, 0, printargs, "osf_swapctl" }, /*not implemented */
[260] = { 5, 0, printargs, "osf_memcntl" }, /*not implemented */
[261] = { 5, 0, printargs, "osf_fdatasync" }, /*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 */
[254] = { 3, 0, SEN(sysfs), "sysfs" },
[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 */
[262 ... 299] = { },
[300] = { 0, 0, sys_bdflush, "bdflush" },
[301] = { 3, 0, printargs, "sethae" },
[302] = { 5, TF, sys_mount, "mount" },
[303] = { 1, 0, sys_adjtimex, "adjtimex32" },
[304] = { 1, TF, sys_swapoff, "swapoff" },
[305] = { 3, TD, sys_getdents, "getdents" },
[306] = { 2, 0, sys_create_module, "create_module" },
[307] = { 4, 0, sys_init_module, "init_module" },
[308] = { 2, 0, sys_delete_module, "delete_module" },
[309] = { 1, 0, sys_get_kernel_syms, "get_kernel_syms" },
[310] = { 3, 0, sys_syslog, "syslog" },
[311] = { 4, 0, sys_reboot, "reboot" },
[312] = { 5, TP, sys_clone, "clone" },
[313] = { 1, TF, sys_uselib, "uselib" },
[314] = { 2, TM, sys_mlock, "mlock" },
[315] = { 2, TM, sys_munlock, "munlock" },
[316] = { 1, TM, sys_mlockall, "mlockall" },
[317] = { 0, TM, sys_munlockall, "munlockall" },
[318] = { 1, 0, sys_sysinfo, "sysinfo" },
[319] = { 1, 0, sys_sysctl, "sysctl" },
[320] = { 0, 0, sys_idle, "idle" },
[321] = { 1, TF, sys_umount, "oldumount" },
[322] = { 2, TF, sys_swapon, "swapon" },
[323] = { 1, 0, sys_times, "times" },
[324] = { 1, 0, sys_personality, "personality" },
[325] = { 1, NF, sys_setfsuid, "setfsuid" },
[326] = { 1, NF, sys_setfsgid, "setfsgid" },
[327] = { 2, 0, sys_ustat, "ustat" },
[328] = { 2, TF, sys_statfs, "statfs" },
[329] = { 2, TD, sys_fstatfs, "fstatfs" },
[330] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[331] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[332] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[333] = { 2, 0, sys_sched_getscheduler, "sched_getscheduler" },
[334] = { 0, 0, sys_sched_yield, "sched_yield" },
[335] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[336] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[337] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[338] = { 5, 0, sys_afs_syscall, "afs_syscall" },
[339] = { 1, 0, sys_uname, "uname" },
[340] = { 2, 0, sys_nanosleep, "nanosleep" },
[341] = { 5, TM|SI, sys_mremap, "mremap" },
[342] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[343] = { 3, 0, sys_setresuid, "setresuid" },
[344] = { 3, 0, sys_getresuid, "getresuid" },
[345] = { 5, 0, printargs, "pciconfig_read" },
[346] = { 5, 0, printargs, "pciconfig_write" },
[347] = { 5, 0, sys_query_module, "query_module" },
[348] = { 5, 0, sys_prctl, "prctl" },
[349] = { 4, TD, sys_pread, "pread" },
[350] = { 4, TD, sys_pwrite, "pwrite" },
[351] = { 0, TS, sys_rt_sigreturn, "rt_sigreturn" },
[352] = { 5, TS, sys_rt_sigaction, "rt_sigaction" },
[353] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[354] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[355] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[356] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[357] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[358] = { 5, TD, sys_select, "select" },
[359] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[360] = { 3, 0, sys_settimeofday, "settimeofday" },
[361] = { 2, 0, sys_getitimer, "getitimer" },
[362] = { 3, 0, sys_setitimer, "setitimer" },
[363] = { 2, TF, sys_utimes, "utimes" },
[364] = { 2, 0, sys_getrusage, "getrusage" },
[365] = { 4, TP, sys_wait4, "wait4" },
[366] = { 1, 0, sys_adjtimex, "adjtimex" },
[367] = { 2, TF, sys_getcwd, "getcwd" },
[368] = { 2, 0, sys_capget, "capget" },
[369] = { 2, 0, sys_capset, "capset" },
[370] = { 4, TD|TN, sys_sendfile, "sendfile" },
[371] = { 3, 0, sys_setresgid, "setresgid" },
[372] = { 3, 0, sys_getresgid, "getresgid" },
[373] = { 4, 0, printargs, "dipc" }, /*not implemented */
[374] = { 2, TF, sys_pivotroot, "pivot_root" },
[375] = { 3, TM, sys_mincore, "mincore" },
[376] = { 3, 0, printargs, "pciconfig_iobase" },
[377] = { 3, TD, sys_getdents64, "getdents64" },
[378] = { 0, 0, sys_gettid, "gettid" },
[379] = { 3, TD, sys_readahead, "readahead" },
[300] = { 2, 0, SEN(bdflush), "bdflush" },
[301] = { 3, 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" },
[307] = { 4, 0, SEN(init_module), "init_module" },
[308] = { 2, 0, SEN(delete_module), "delete_module" },
[309] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" },
[310] = { 3, 0, SEN(syslog), "syslog" },
[311] = { 4, 0, SEN(reboot), "reboot" },
[312] = { 5, TP, SEN(clone), "clone" },
[313] = { 1, TF, SEN(uselib), "uselib" },
[314] = { 2, TM, SEN(mlock), "mlock" },
[315] = { 2, TM, SEN(munlock), "munlock" },
[316] = { 1, TM, SEN(mlockall), "mlockall" },
[317] = { 0, TM, SEN(munlockall), "munlockall" },
[318] = { 1, 0, SEN(sysinfo), "sysinfo" },
[319] = { 1, 0, SEN(sysctl), "_sysctl" },
[320] = { },
[321] = { 1, TF, SEN(umount), "oldumount" },
[322] = { 2, TF, SEN(swapon), "swapon" },
[323] = { 1, 0, SEN(times), "times" },
[324] = { 1, 0, SEN(personality), "personality" },
[325] = { 1, NF, SEN(setfsuid), "setfsuid" },
[326] = { 1, NF, SEN(setfsgid), "setfsgid" },
[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] = { 2, 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" },
[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" },
[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" },
[348] = { 5, 0, SEN(prctl), "prctl" },
[349] = { 4, TD, SEN(pread), "pread64" },
[350] = { 4, TD, SEN(pwrite), "pwrite64" },
[351] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
[352] = { 5, TS, SEN(rt_sigaction), "rt_sigaction" },
[353] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[354] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" },
[355] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" },
[356] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" },
[357] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[358] = { 5, TD, SEN(select), "select" },
[359] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[360] = { 3, 0, SEN(settimeofday), "settimeofday" },
[361] = { 2, 0, SEN(getitimer), "getitimer" },
[362] = { 3, 0, SEN(setitimer), "setitimer" },
[363] = { 2, TF, SEN(utimes), "utimes" },
[364] = { 2, 0, SEN(getrusage), "getrusage" },
[365] = { 4, TP, SEN(wait4), "wait4" },
[366] = { 1, 0, SEN(adjtimex), "adjtimex" },
[367] = { 2, TF, SEN(getcwd), "getcwd" },
[368] = { 2, 0, SEN(capget), "capget" },
[369] = { 2, 0, SEN(capset), "capset" },
[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 */
[374] = { 2, TF, SEN(pivotroot), "pivot_root" },
[375] = { 3, TM, SEN(mincore), "mincore" },
[376] = { 3, 0, SEN(printargs), "pciconfig_iobase" },
[377] = { 3, TD, SEN(getdents64), "getdents64" },
[378] = { 0, 0, SEN(gettid), "gettid" },
[379] = { 3, TD, SEN(readahead), "readahead" },
[380] = { },
[381] = { 2, TS, sys_kill, "tkill" },
[382] = { 5, TF, sys_setxattr, "setxattr" },
[383] = { 5, TF, sys_setxattr, "lsetxattr" },
[384] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[385] = { 4, TF, sys_getxattr, "getxattr" },
[386] = { 4, TF, sys_getxattr, "lgetxattr" },
[387] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[388] = { 3, TF, sys_listxattr, "listxattr" },
[389] = { 3, TF, sys_listxattr, "llistxattr" },
[390] = { 3, TD, sys_flistxattr, "flistxattr" },
[391] = { 2, TF, sys_removexattr, "removexattr" },
[392] = { 2, TF, sys_removexattr, "lremovexattr" },
[393] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[394] = { 6, 0, sys_futex, "futex" },
[395] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[396] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[397] = { 5, 0, sys_tuxcall, "tuxcall" },
[398] = { 2, 0, sys_io_setup, "io_setup" },
[399] = { 1, 0, sys_io_destroy, "io_destroy" },
[400] = { 5, 0, sys_io_getevents, "io_getevents" },
[401] = { 3, 0, sys_io_submit, "io_submit" },
[402] = { 3, 0, sys_io_cancel, "io_cancel" },
[381] = { 2, TS, SEN(kill), "tkill" },
[382] = { 5, TF, SEN(setxattr), "setxattr" },
[383] = { 5, TF, SEN(setxattr), "lsetxattr" },
[384] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
[385] = { 4, TF, SEN(getxattr), "getxattr" },
[386] = { 4, TF, SEN(getxattr), "lgetxattr" },
[387] = { 4, TD, SEN(fgetxattr), "fgetxattr" },
[388] = { 3, TF, SEN(listxattr), "listxattr" },
[389] = { 3, TF, SEN(listxattr), "llistxattr" },
[390] = { 3, TD, SEN(flistxattr), "flistxattr" },
[391] = { 2, TF, SEN(removexattr), "removexattr" },
[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" },
[398] = { 2, 0, SEN(io_setup), "io_setup" },
[399] = { 1, 0, SEN(io_destroy), "io_destroy" },
[400] = { 5, 0, SEN(io_getevents), "io_getevents" },
[401] = { 3, 0, SEN(io_submit), "io_submit" },
[402] = { 3, 0, SEN(io_cancel), "io_cancel" },
[403 ... 404] = { },
[405] = { 1, TP|SE, sys_exit, "exit_group" },
[406] = { 3, 0, sys_lookup_dcookie, "lookup_dcookie" },
[407] = { 1, TD, sys_epoll_create, "epoll_create" },
[408] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[409] = { 4, TD, sys_epoll_wait, "epoll_wait" },
[410] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[411] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[412] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[413] = { 4, TD, sys_fadvise64, "fadvise64" },
[414] = { 3, 0, sys_timer_create, "timer_create" },
[415] = { 4, 0, sys_timer_settime, "timer_settime" },
[416] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[417] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[418] = { 1, 0, sys_timer_delete, "timer_delete" },
[419] = { 2, 0, sys_clock_settime, "clock_settime" },
[420] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[421] = { 2, 0, sys_clock_getres, "clock_getres" },
[422] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[423] = { 4, TI, sys_semtimedop, "semtimedop" },
[424] = { 3, TS, sys_tgkill, "tgkill" },
[425] = { 2, TF, sys_stat64, "stat64" },
[426] = { 2, TF, sys_lstat64, "lstat64" },
[427] = { 2, TD, sys_fstat64, "fstat64" },
[428] = { 5, 0, sys_vserver, "vserver" },
[429] = { 6, TM, sys_mbind, "mbind" },
[430] = { 5, TM, sys_get_mempolicy, "get_mempolicy" },
[431] = { 3, TM, sys_set_mempolicy, "set_mempolicy" },
[432] = { 4, 0, sys_mq_open, "mq_open" },
[433] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[434] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[435] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[436] = { 2, 0, sys_mq_notify, "mq_notify" },
[437] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[438] = { 5, TP, sys_waitid, "waitid" },
[439] = { 5, 0, sys_add_key, "add_key" },
[440] = { 4, 0, sys_request_key, "request_key" },
[441] = { 5, 0, sys_keyctl, "keyctl" },
[442] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[443] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[444] = { 0, TD, sys_inotify_init, "inotify_init" },
[445] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[446] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[447] = { 1, TD, sys_fdatasync, "fdatasync" },
[448] = { 4, 0, sys_kexec_load, "kexec_load" },
[449] = { 4, TM, sys_migrate_pages, "migrate_pages" },
[450] = { 4, TD|TF, sys_openat, "openat" },
[451] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[452] = { 4, TD|TF, sys_mknodat, "mknodat" },
[453] = { 5, TD|TF, sys_fchownat, "fchownat" },
[454] = { 3, TD|TF, sys_futimesat, "futimesat" },
[455] = { 4, TD|TF, sys_newfstatat, "newfstatat" },
[456] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[457] = { 4, TD|TF, sys_renameat, "renameat" },
[458] = { 5, TD|TF, sys_linkat, "linkat" },
[459] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[460] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[461] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[462] = { 3, TD|TF, sys_faccessat, "faccessat" },
[463] = { 6, TD, sys_pselect6, "pselect6" },
[464] = { 5, TD, sys_ppoll, "ppoll" },
[465] = { 1, TP, sys_unshare, "unshare" },
[466] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[467] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[468] = { 6, TD, sys_splice, "splice" },
[469] = { 4, TD, sys_sync_file_range, "sync_file_range" },
[470] = { 4, TD, sys_tee, "tee" },
[471] = { 4, TD, sys_vmsplice, "vmsplice" },
[472] = { 6, TM, sys_move_pages, "move_pages" },
[473] = { 3, 0, sys_getcpu, "getcpu" },
[474] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[475] = { 4, TD|TF, sys_utimensat, "utimensat" },
[476] = { 3, TD|TS, sys_signalfd, "signalfd" },
[477] = { 4, TD, sys_timerfd, "timerfd" },
[478] = { 1, TD, sys_eventfd, "eventfd" },
[479] = { 5, TN, sys_recvmmsg, "recvmmsg" },
[480] = { 4, TD, sys_fallocate, "fallocate" },
[481] = { 2, TD, sys_timerfd_create, "timerfd_create" },
[482] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[483] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[484] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[485] = { 2, TD, sys_eventfd2, "eventfd2" },
[486] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[487] = { 3, TD, sys_dup3, "dup3" },
[488] = { 2, TD, sys_pipe2, "pipe2" },
[489] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[490] = { 4, TD, sys_preadv, "preadv" },
[491] = { 4, TD, sys_pwritev, "pwritev" },
[492] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[493] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[494] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[495] = { 5, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[496] = { 4, 0, sys_prlimit64, "prlimit64" },
[497] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[498] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[499] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[500] = { 1, TD, sys_syncfs, "syncfs" },
[501] = { 2, TD, sys_setns, "setns" },
[502] = { 4, TN, sys_accept4, "accept4" },
[503] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[504] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[505] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[506] = { 5, 0, sys_kcmp, "kcmp" },
[507] = { 3, TD, sys_finit_module, "finit_module" },
[508] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[509] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[510] = { 5, TD|TF, sys_renameat2, "renameat2" },
[405] = { 1, TP|SE, SEN(exit), "exit_group" },
[406] = { 3, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[407] = { 1, TD, SEN(epoll_create), "epoll_create" },
[408] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[409] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[410] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[411] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[412] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[413] = { 4, TD, SEN(fadvise64), "fadvise64" },
[414] = { 3, 0, SEN(timer_create), "timer_create" },
[415] = { 4, 0, SEN(timer_settime), "timer_settime" },
[416] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[417] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
[418] = { 1, 0, SEN(timer_delete), "timer_delete" },
[419] = { 2, 0, SEN(clock_settime), "clock_settime" },
[420] = { 2, 0, SEN(clock_gettime), "clock_gettime" },
[421] = { 2, 0, SEN(clock_getres), "clock_getres" },
[422] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" },
[423] = { 4, TI, SEN(semtimedop), "semtimedop" },
[424] = { 3, TS, SEN(tgkill), "tgkill" },
[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" },
[432] = { 4, 0, SEN(mq_open), "mq_open" },
[433] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[434] = { 5, 0, SEN(mq_timedsend), "mq_timedsend" },
[435] = { 5, 0, SEN(mq_timedreceive), "mq_timedreceive" },
[436] = { 2, 0, SEN(mq_notify), "mq_notify" },
[437] = { 3, 0, SEN(mq_getsetattr), "mq_getsetattr" },
[438] = { 5, TP, SEN(waitid), "waitid" },
[439] = { 5, 0, SEN(add_key), "add_key" },
[440] = { 4, 0, SEN(request_key), "request_key" },
[441] = { 5, 0, SEN(keyctl), "keyctl" },
[442] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[443] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[444] = { 0, TD, SEN(inotify_init), "inotify_init" },
[445] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[446] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[447] = { 1, TD, SEN(fdatasync), "fdatasync" },
[448] = { 4, 0, SEN(kexec_load), "kexec_load" },
[449] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[450] = { 4, TD|TF, SEN(openat), "openat" },
[451] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },
[452] = { 4, TD|TF, SEN(mknodat), "mknodat" },
[453] = { 5, TD|TF, SEN(fchownat), "fchownat" },
[454] = { 3, TD|TF, SEN(futimesat), "futimesat" },
[455] = { 4, TD|TF, SEN(newfstatat), "fstatat64" },
[456] = { 3, TD|TF, SEN(unlinkat), "unlinkat" },
[457] = { 4, TD|TF, SEN(renameat), "renameat" },
[458] = { 5, TD|TF, SEN(linkat), "linkat" },
[459] = { 3, TD|TF, SEN(symlinkat), "symlinkat" },
[460] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[461] = { 3, TD|TF, SEN(fchmodat), "fchmodat" },
[462] = { 3, TD|TF, SEN(faccessat), "faccessat" },
[463] = { 6, TD, SEN(pselect6), "pselect6" },
[464] = { 5, TD, SEN(ppoll), "ppoll" },
[465] = { 1, TP, SEN(unshare), "unshare" },
[466] = { 2, 0, SEN(set_robust_list), "set_robust_list" },
[467] = { 3, 0, SEN(get_robust_list), "get_robust_list" },
[468] = { 6, TD, SEN(splice), "splice" },
[469] = { 4, TD, SEN(sync_file_range), "sync_file_range" },
[470] = { 4, TD, SEN(tee), "tee" },
[471] = { 4, TD, SEN(vmsplice), "vmsplice" },
[472] = { 6, TM, SEN(move_pages), "move_pages" },
[473] = { 3, 0, SEN(getcpu), "getcpu" },
[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" },
[478] = { 1, TD, SEN(eventfd), "eventfd" },
[479] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
[480] = { 4, TD, SEN(fallocate), "fallocate" },
[481] = { 2, TD, SEN(timerfd_create), "timerfd_create" },
[482] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" },
[483] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" },
[484] = { 4, TD|TS, SEN(signalfd4), "signalfd4" },
[485] = { 2, TD, SEN(eventfd2), "eventfd2" },
[486] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[487] = { 3, TD, SEN(dup3), "dup3" },
[488] = { 2, TD, SEN(pipe2), "pipe2" },
[489] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[490] = { 4, TD, SEN(preadv), "preadv" },
[491] = { 4, TD, SEN(pwritev), "pwritev" },
[492] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" },
[493] = { 5, TD, SEN(perf_event_open), "perf_event_open" },
[494] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[495] = { 5, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[496] = { 4, 0, SEN(prlimit64), "prlimit64" },
[497] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" },
[498] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[499] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[500] = { 1, TD, SEN(syncfs), "syncfs" },
[501] = { 2, TD, SEN(setns), "setns" },
[502] = { 4, TN, SEN(accept4), "accept4" },
[503] = { 4, TN, SEN(sendmmsg), "sendmmsg" },
[504] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" },
[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" },
[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", },

3
linux/arc/arch_regs.c Normal file
View File

@ -0,0 +1,3 @@
static struct user_regs_struct arc_regs;
#define ARCH_REGS_FOR_GETREGSET arc_regs
#define ARCH_PC_REG arc_regs.efa

10
linux/arc/get_error.c Normal file
View File

@ -0,0 +1,10 @@
static void
get_error(struct tcb *tcp, const bool check_errno)
{
if (check_errno && is_negated_errno(arc_regs.scratch.r0)) {
tcp->u_rval = -1;
tcp->u_error = -arc_regs.scratch.r0;
} else {
tcp->u_rval = arc_regs.scratch.r0;
}
}

7
linux/arc/get_scno.c Normal file
View File

@ -0,0 +1,7 @@
/* Return codes: 1 - ok, 0 - ignore, other - error. */
static int
arch_get_scno(struct tcb *tcp)
{
tcp->scno = arc_regs.scratch.r8;
return 1;
}

View File

@ -0,0 +1,11 @@
/* Return -1 on error or 1 on success (never 0!). */
static int
get_syscall_args(struct tcb *tcp)
{
long *arc_args = &arc_regs.scratch.r0;
unsigned int i;
for (i = 0; i < MAX_ARGS; ++i)
tcp->u_arg[i] = *arc_args--;
return 1;
}

View File

@ -1,6 +1,6 @@
#define ARCH_sys_mmap sys_mmap_pgoff
#define ARCH_mmap mmap_pgoff
#include "32/syscallent.h"
[244] = { 3, 0, printargs, "arc_cacheflush"},
[245] = { 1, 0, printargs, "arc_settls" },
[246] = { 0, 0, printargs, "arc_gettls" },
[244] = { 3, 0, SEN(printargs), "arc_cacheflush"},
[245] = { 1, 0, SEN(printargs), "arc_settls" },
[246] = { 0, 0, SEN(printargs), "arc_gettls" },
[247 ... 259] = { },

6
linux/arch_sigreturn.c Normal file
View File

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

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