Commit Graph

20 Commits

Author SHA1 Message Date
326b98927a defs.h: stop including <asm/unistd.h>
Limit the number of files where <asm/unistd.h> is included
to only those few that need it.

* defs.h: Do not include <asm/unistd.h>.
* clone.c: Include <asm/unistd.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2016-12-31 22:12:08 +00:00
50b50e78f6 Remove getarg_klu
After transition from long to kernel_ulong_t we no longer need
tcp->ext_arg, and therefore a function to access it is also no longer
needed.

* defs.h (getarg_klu): Remove prototype.
* util.c (getarg_klu): Remove.
(printargs): Access tcp->u_arg directly
* bjm.c (SYS_FUNC(init_module)): Likewise.
* clone.c (SYS_FUNC(unshare)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Likewise.
* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mem.c (do_mprotect): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Likewise.
2016-12-26 10:43:35 +00:00
89636759d7 Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.

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

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

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

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
1d5bb61c49 Print kernel_ureg_t and kernel_scno_t using dedicated format strings
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.

* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 10:43:04 +00:00
276839aec6 clone: print clone flags without truncation
The flags argument is defined in kernel as unsigned long,
so change its decoding to avoid truncation.

* clone.c (SYS_FUNC(clone)): Change flags type from unsigned long
to kernel_ureg_t, print it using printflags64 instead of printflags.
2016-12-25 22:17:38 +00:00
c6d15a9b0d Rework ifdefery around print_user_desc
* configure.ac (AC_CHECK_TYPES): Check for struct user_desc
in <asm/ldt.h>.
* clone.c (print_tls_arg): New function.
(SYS_FUNC(clone)): Use it.
(print_user_desc): Move prototype ...
* defs.h [HAVE_STRUCT_USER_DESC]: ... here.
* ldt.c: Check for HAVE_STRUCT_USER_DESC instead of architectures.
* linux/dummy.h: Likewise.
2016-12-21 23:35:27 +00:00
a2485b86e7 Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t.  All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t.  All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:58:16 +00:00
Eugene Syromyatnikov
0cffca31df clone: use kernel_ulong_t as type of flags parameter of unshare call
Kernel declares flags parameter as long and looks like x32 and n32
implement no compat for this call.

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

* xlat/unshare_flags.in: New file.
* clone.c (SYS_FUNC(unshare)): Use unshare_flags for printing flags
parameter.
2016-10-29 02:54:01 +03:00
Eugene Syromyatnikov
7b0ae21f5c clone: use separate xlat for nstype parameter of setns syscall
nstype is not flag set but specific type value against which it is
compared in kernel (see kernel/nsproxy.c, SYSCALL_DEFINE2(setns, ...)).

* xlat/setns_types.in: New file.
* clone.c: Use printxval and setns_types for nstype parameter.
2016-10-29 02:54:01 +03:00
Richard W.M. Jones
d8f673568b Add RISC-V architecture support
The original port of strace was done by Palmer Dabbelt
(eecs.berkeley.edu), based on strace 4.9.

* configure.ac: Define RISCV for riscv*.
* clone.c [RISCV]: Define ARG_* macros as for OR1K.
* defs.h [RISCV] (SUPPORTED_PERSONALITIES): Define to 2.
[RISCV] (NEED_UID16_PARSERS): Define to 1.
* linux/riscv/arch_regs.c: New file.
* linux/riscv/errnoent1.h: Likewise.
* linux/riscv/get_error.c: Likewise.
* linux/riscv/get_scno.c: Likewise.
* linux/riscv/get_syscall_args.c: Likewise.
* linux/riscv/ioctls_arch0.h: Likewise.
* linux/riscv/ioctls_arch1.h: Likewise.
* linux/riscv/ioctls_inc0.h: Likewise.
* linux/riscv/ioctls_inc1.h: Likewise.
* linux/riscv/signalent1.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/riscv/syscallent.h: Likewise.
* linux/riscv/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2016-08-21 22:03:05 +00:00
38d854e425 ia64: replace SYS_clone2 with __NR_clone2
Migrate to __NR_* the last user of SYS_* macros provided
by <sys/syscall.h>.

* clone.c [IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Replace
SYS_clone2 with __NR_clone2.
2016-08-09 14:35:06 +00:00
484326dbd8 Consistently use printaddr for printing addresses
* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.

Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
2016-06-11 09:26:49 +00:00
d06fa28b0e Fix printing of invalid flags argument of unshare syscall
* clone.c (SYS_FUNC(unshare)): Print 1st argument using printflags_long.
2016-05-16 22:49:54 +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
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
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
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
265903a416 process.c: move clone, setns, unshare, and fork parsers to a separate file
* clone.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_clone, sys_setns, sys_unshare, sys_fork, and
related code to clone.c.
2014-12-11 22:52:03 +00:00