Commit Graph

5090 Commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* defs.h (printflags_long): Remove.
* fcntl.c (print_fcntl): Replace printflags_long with printflags64.
* numa.c (SYS_FUNC(get_mempolicy)): Likewise.
* perf.c (SYS_FUNC(perf_event_open)): Likewise.
* sram_alloc.c [BFIN] (SYS_FUNC(sram_alloc)): Likewise.
2016-12-25 21:55:01 +00:00
0eda4a0a4b upeek, upoke: change argument types from long to unsigned long
* defs.h (upeek, upoke): Change offset argument type from long
to unsigned long.  Change res argument type from long to kernel_ureg_t.
* upeek.c (upeek): Likewise.
* upoke.c (upoke.c): Likewise.
* syscall.c (print_pc) [ARCH_PC_PEEK_ADDR]: Change pc type from long
to kernel_ureg_t.
* linux/aarch64/arch_regs.c (arm_sp_ptr): Remove redundant cast.
* linux/metag/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/sh64/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/powerpc/getregs_old.c (getregs_old): Remove redundant casts.
* linux/alpha/arch_getrval2.c (getrval2): Change r20 type from long
to unsigned long.
* linux/alpha/arch_regs.c (alpha_r0, alpha_a3): Change type from long
to unsigned long.
* linux/bfin/arch_regs.c (bfin_r0): Likewise.
* linux/crisv10/arch_regs.c (cris_r10): Likewise.
* linux/hppa/arch_regs.c (hppa_r28): Likewise.
* linux/ia64/arch_regs.c (IA64_PSR_IS): Likewise.
* linux/microblaze/arch_regs.c (microblaze_r3): Likewise.
* linux/sh/arch_regs.c (sh_r0): Likewise.
* linux/sh64/arch_regs.c (sh64_r9): Likewise.
* linux/xtensa/arch_regs.c (xtensa_a2): Likewise.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Change addr type
from long to unsigned long.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/alpha/get_scno.c (arch_get_scno): Update for the change
of signedness.
* linux/arc/get_syscall_args.c (get_syscall_args): Change arc_args type
from pointer to long to pointer to unsigned long.
* linux/arm/arch_regs.c (arm_sp_ptr): Change type from pointer to long
to pointer to unsigned long.
* linux/arm/arch_regs.h (arm_sp_ptr): Likewise.
* linux/i386/arch_regs.c (i386_esp_ptr): Likewise.
* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
* linux/m68k/arch_regs.c (m68k_usp_ptr): Likewise.
* linux/m68k/arch_regs.h (m68k_usp_ptr): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Use umove
instead of umoven.
* linux/sh/arch_getrval2.c (getrval2): Change val type from long
to unsigned long.
2016-12-25 20:14:12 +00:00
44cb9c8356 arch_sigreturn: change tracee address type from long to unsigned long
* linux/arm/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to unsigned long.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Change the type
of addr and regs variables from long to unsigned long.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to kernel_ureg_t.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Change the type
of offset and addr variables from long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00