2971 Commits

Author SHA1 Message Date
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
Elvira Khabirova
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
Elvira Khabirova
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
Elvira Khabirova
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