7238 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
36837ede63 xlat/loop_crypt_type_options: provide fallback values
* xlat/loop_crypt_type_options.in: Provide fallback values, add #sorted.
2018-10-20 06:18:56 +02:00
Eugene Syromyatnikov
369afb0506 xlat: sort kexec_arch_values
* xlat/kexec_arch_values.in: Sort, add #sorted.
2018-10-20 06:17:14 +02:00
Eugene Syromyatnikov
90337bbfe8 xlat/netlink_states: decode TCP_CLOSE
* xlat/netlink_states.in: Decode state 7 as TCP_CLOSE, since that's what
net core sets socket's initial state to.
2018-10-20 06:16:05 +02:00
Eugene Syromyatnikov
dd0b8073d6 xlat: provide fallback values to lockfcmds
* xlat/lockfcmds.in: Provide fallback values.
2018-10-20 06:15:19 +02:00
Eugene Syromyatnikov
616d4ed93c sock: switch to table handler dispatching 2018-10-20 06:14:49 +02:00
Eugene Syromyatnikov
6b583ed1b3 fixup! sock: provide socket ioctl command ID definitions 2018-10-20 06:14:07 +02:00
Eugene Syromyatnikov
d8e5ff352a fixup! sock: move specific ioctl decoding code into functions 2018-10-20 04:18:12 +02:00
Eugene Syromyatnikov
231658be6b sock: provide socket ioctl command ID definitions
* xlat/sock_ioctls.in: New file.
* sock.c: Include "xlat/sock_ioctls.h". Remove #ifdef conditions for
ioctl commands.
2018-10-20 04:13:20 +02:00
Eugene Syromyatnikov
016178ec9b sock: move specific ioctl decoding code into functions
* sock.c (decode_set_ifreq, decode_get_ifreq, decode_route_ioc): New
functions.
(decode_ifconf): Add "fd" and "code" arguments.
(sock_ioctl): Remove "ifr" local variable, call handlers instead of
open-coding ioctl handling.
2018-10-20 04:11:03 +02:00
Eugene Syromyatnikov
66aea8089d sock.c: add missing comma 2018-10-20 03:39:15 +02:00
Eugene Syromyatnikov
ed3e7e751d socketutils: pass 0 to dyxlat_alloc
As it is backed by xgrowarray that has a heuristic for the case
*nmemb == 0, we don't have to pass a hard-coded initial size anymore.

* socketutils.c (genl_get_family_name): Pass 0 to dyxlat_alloc.
2018-10-20 01:55:37 +02:00
Eugene Syromyatnikov
da97767c05 Add macros for glibc version checks
Add GLIBC_PREREQ and GLIBC_OLDER macros that enable easy checks aginst
glibc vershions known to expose various quirks.

* glibc_compat.h: New file.
* tests/ipc_msg.c: Use GLIBC_OLDER for glibc version checking.
* tests/readahead.c: Likewise.
2018-10-20 01:21:37 +02:00
Eugene Syromyatnikov
a8778adef2 xlat: provide fallback definitions to dirent_types
* xlat/dirent_types.in: Provide fallback definitions.
2018-10-15 17:59:36 +02:00
Eugene Syromyatnikov
e3068c9791 xlat: provide fallback definitions to ptrace_events
* xlat/ptrace_events.in: Provide fallback definitions, define
PTRACE_EVENT_MIGRATE only on tile.
2018-10-15 17:58:18 +02:00
Eugene Syromyatnikov
400c83337d xlat: sort and add fallback definitions to setsock_ip_options
* xlat/setsock_ip_options.in: Add fallback definitions, sort, add
"#sorted".
2018-10-15 17:57:32 +02:00
Eugene Syromyatnikov
ab353ade4e xlat: add fallback definitions to setsock_ipv6_options
* xlat/setsock_ipv6_options.in: Add fallback definitions.
2018-10-15 17:56:42 +02:00
Eugene Syromyatnikov
8d3ee7033f linux/dummy.h: remove unused sys_phys definition
* linux/dummy.h (sys_phys): Remove.
2018-10-15 17:55:56 +02:00
Eugene Syromyatnikov
5bccbbe42b xlat: update sigact_flags
* xlat/sigact_flags.in: Add fallback definitions.
2018-10-15 17:53:22 +02:00
Eugene Syromyatnikov
6888b56c80 xlat: update siginfo_codes
* xlat/siginfo_codes.in (SI_LWP): Remove, as it is not presen on Linux.
(SI_NOINFO): Define only on SPARC, provide fallback value.
2018-10-15 17:47:01 +02:00
Eugene Syromyatnikov
fd02c5ea81 xlat: add fallback values to sock_ip_options
* xlat/sock_ip_options.in: Add fallback values, remove IP_RECVOPTIONS,
IP_RECVRETOPTS, IP_RECVDSTADDR, IP_RECVIFINDEX, IP_BROADCAST_IF that are
not present in Linux, remove IP_RECVORIGDSTADDR as it is synonymous to
IP_ORIGDSTADDR, add "#value_indexed".
2018-10-15 17:43:54 +02:00
Eugene Syromyatnikov
cd733e0454 xlat: add fallback values to sock_ipv6_options
* xlat/sock_ipv6_options.in: Add fallback values, remove
IPV6_RECVORIGDSTADDR as it is a synonym to IPV6_ORIGDSTADDR, add
"#value_indexed".
2018-10-15 17:36:07 +02:00
Eugene Syromyatnikov
21cc88963f xlat: add SOL_CAN_* to socketlayers
* xlat/socketlayers.in (SOL_CAN_BASE): New constant, introduced by Linux
commit v2.6.25-rc1~1162^2~1414.
(SOL_CAN_RAW): New constant, introduced by Linux commit
v2.6.25-rc1~1162^2~1413.
2018-10-15 17:32:01 +02:00
Eugene Syromyatnikov
7138dcec9e xlat: add fallback values to sock_packet_options
* xlat/sock_packet_options.in: Add fallback values, mark xclat as value
indexed.
2018-10-15 17:31:18 +02:00
Eugene Syromyatnikov
ff18af2bb4 fixup! strace: always define WCOREDUMP 2018-10-15 17:30:16 +02:00
Eugene Syromyatnikov
a475336863 arm: wire up io_pgetevents
Linux commit v4.19-rc7~24^2~1.

* linux/arm/syscallent.h ([399]): Add io_pgetevents.
2018-10-11 03:51:31 +02:00
Eugene Syromyatnikov
be048f54c5 printmode: update print_symbolic_mode_t decoder
* printmode.c (print_symbolic_mode_t): Rewrite.
* xlat/modetypes.in: Add fallback values.
* xlat/modeflags.in: New file.
2018-10-07 14:31:00 +02:00
Eugene Syromyatnikov
2a905d1b00 xlat: add XLAT_STYLE_FMT_O for octal output
* xlat.h (enum xlat_style): Add XLAT_STYLE_FMT_O.
* xlat.c (sprint_xlat_val): Handle XLAT_STYLE_FMT_O, reorder switch
branches in accordance with enum constant order.
2018-10-07 14:13:20 +02:00
Eugene Syromyatnikov
6a44f46c7c print_dev_t: add support for xlat styles
* print_dev_t.c (print_dev_t): Print in accordance with current xlat
style setting.
2018-10-07 12:28:27 +02:00
Eugene Syromyatnikov
9baa6bcc88 Print ISO 8601 time for wall clock time values
Add an argument to print_time* routines that signalises, whether
the time value is wall clock time or not.

* aio.c (print_io_getevents): Add an argument to print_timespec call.
* defs.h (print_timeval32_t, print_timeval32, print_itimerval32): Add
"bool rtc" argument.
* desc.c (decode_select): Add bool argument to print_tv_ts callback
function argument.
* futex.c (SYS_FUNC(futex)) <case FUTEX_WAIT>: Call print_timespec with
rtc=false, as the timestamp is always relative.
<case FUTEX_LOCK_PI>: Call print_timespec with rtc=true, as the timeout
is always absolute.
<case FUTEX_WAIT_BITSET, case FUTEX_WAIT_REQUEUE_PI>: Call
print_timespec with rtc set to true when op has FUTEX_CLOCK_REALTIME
flag.
* ipc_sem.c (SYS_FUNC(semtimedop)): Call print_timespec with rtc=false,
as timeout is always relative.
* linux/dummy.h (sys_clock_getres, sys_stime): Remove.
* mmsghdr.c (SYS_FUNC(recvmmsg)): Call print_timespec with rtc=false, as
timeout is relative.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Call
print_timespec with rtc=true, as timeout is absolute.
* msghdr.c (print_scm_timestamp, print_scm_timestampns,
print_scm_timestamping): Call print_struct_timeval_data_size,
print_struct_timespec_data_size, print_struct_timespec_array_data_size
with rtc=true as timestamps presumed absolute.
* poll.c (SYS_FUNC(ppoll)): Call print_timespec with rtc=false, as
timeout is relative.
* print_time.c (print_time_t): New function.
(SYS_FUNC(time)): Use print_time_t for printing time.
(SYS_FUNC(stime)): New function.
* print_timespec.c (print_timespec_t, print_struct_timespec_data_size,
print_struct_timespec_array_data_size, print_timespec): Add rtc argument,
handle it.
(print_timespec_t_utime): Call print_timespec_t with rtc=false when
xlat_style is not abbreviated, call print_timespec_t with rtc=true
instead of manual time stamp printing.
(print_itimerspec): Call print_timespec_t with rtc=false.
* print_timeval.c (print_timeval_t, print_struct_timeval_data_size,
print_timeval, print_itimerval, print_timeval32_t, print_timeval32):
Add rtc argument, handle it.
(print_timeval_t_utime, print_timeval32_t_utime): Remove.
(print_struct_timeval): New function.
(print_timeval_utimes): Use print_struct_timeval instead of
print_timeval_t_utime.
* print_timex.c (print_timex): Add rtc argument, handle it.
* printrusage.c (printrusage): Call print_struct_timeval with rtc=false.
* sched.c (sched_rr_get_interval): Call print_timespec with rtc=false.
* signal.c (rt_sigtimedwait): Call print_timespec with rtc=false.
* time.c: Include "xlat/clocknames.h" under XLAT_MACROS_ONLY.
(gettimeofday, settimeofday): Call print_timeval with rtc=true.
(osf_gettimeofday, osf_settimeofday): Call print_timeval32 with rtc=true.
(nanosleep): Call print_timespec with rtc=false.
(getitimer, setitimer): Call print_itimerval with rtc=false.
(osf_getitimer, osf_setitimer): Call print_itimerval32 wirh rtc=false.
(do_adjtimex): Add rtc argument, handle it.
(is_rtcid): New function.
(clock_settime, clock_gettime): Call print_timespec with rtc=true if 0th
argument is a real-time clock (as indicated by is_rtcid).
(SYS_FUNC(clock_getres)): New syscall decoder.
(SYS_FUNC(clock_nanosleep)): Call print_timespec with rtc=true if clock
is realtime (as indicated by is_rtcid) and TIMER_ABSTIME is set in flags.
(SYS_FUNC(clock_adjtime)): Call do_adjtimex with rtc=true if clock is
realtime.
* tests/adjtimex.c: Update expected output.
* tests/clock_nanosleep.c: Likewise.
2018-10-07 06:00:36 +02:00
Eugene Syromyatnikov
3a94852d43 Add support for alternative error/signal names
There are some error and signal constants that are defined as a synonyms
for other errors/sugnals. Let's support their qualification.

* filter_qualify.c (struct alt_name): New type definition.
(alt_signames, alt_errnames): New variables.
(sigstr_to_uint): Check alt_signames for possible alternative signal
name usage.
(find_errno_by_name): Check alt_errnames for possible alternative error
name usage.
* linux/alpha/alt_errnoent.h: New file.
* linux/alpha/alt_signalent.h: Likewise.
* linux/alt_errnoent.h: Likewise.
* linux/alt_signalent.h: Likewise.
* linux/hppa/alt_errnoent.h: Likewise.
* linux/mips/alt_errnoent.h: Likewise.
* linux/mips/alt_signalent.h: Likewise.
* linux/powerpc/alt_errnoent.h: Likewise.
* linux/powerpc64/alt_errnoent.h: Likewise.
* linux/sparc/alt_errnoent.h: Likewise.
* linux/sparc/alt_signalent.h: Likewise.
* linux/sparc64/alt_signalent.h: Likewise.
* tests/qual_signal.test: Add some checks for alternative signal names.
2018-10-07 05:34:36 +02:00
Eugene Syromyatnikov
323c689701 ioprio: print "who" argument according to its type
So far there's only UID that has a specific routine.

* ioprio.c (print_ioprio_who): New function.
(SYS_FUNC(ioprio_get), SYS_FUNC(ioprio_set)): Use it.
2018-10-07 05:31:12 +02:00
Eugene Syromyatnikov
638b5c99b6 signal: return NULL is signal number has no string representation
* signal.c (signame): Return NULL if signal name hasn't been found.
2018-10-07 05:25:33 +02:00
Eugene Syromyatnikov
d9a5b26067 strace: use sprintsignal for converting signal number to string
As signame is being converted to xlookup-like function, a separate
routine is needed in order to get string representation of signal.

* strace.c (sprintsignal): New function.
(print_debug_info, print_signalled, print_stopped): Use sprintsignal
instead of signame.
2018-10-07 05:23:09 +02:00
Eugene Syromyatnikov
f6964715e3 Do not parse SIG_0
Signal 0 is not a valid signal number, so there's no reason to treat it
like it is.

* filter_qualify.c: Start iteration from 1.
* signal.c: Likewise.
2018-10-07 05:20:25 +02:00
Eugene Syromyatnikov
2fc6a3647a Use printsignal instead of signame
As the former respects xlat styles.

* clone.c (SYS_FUNC(clone)): Use printflags for printing termination
signal in printflags.
* fcntl.c (print_fcntl) <case F_SETSIG>: Use printsignal.
* prctl.c (SYS_FUNC(prctl)) <case PR_GET_PDEATHSIG,
case PR_SET_PDEATHSIG>: Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* s390.c (s390_runtime_instr): Likewise.
* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Likewise.
2018-10-07 05:12:42 +02:00
Eugene Syromyatnikov
4ebabbed7c signal.c: make printisgnal honor xlat style
* signal.c (printsignal): Respect current xlat style.
2018-10-07 05:09:09 +02:00
Eugene Syromyatnikov
b43aae36d9 basic_filters: add %net as a possible designation for network syscalls
* basic_filters (lookup_class) <syscall_class>: Add "%net" as a possible
alias for TRACE_NETWORK.
2018-10-07 05:05:44 +02:00
Eugene Syromyatnikov
81c9974f11 strace: always define WCOREDUMP
wait.c does it already.

* strace.c: Remove <sys/wait.h> include, add "wait.h" include.
[!WCOREDUMP]: Remove.
* wait.c: Remove <sys/wait.h> include, add "wait.h" include.
[!WCOREFLAG] (WCOREFLAG), [!WCOREDUMP] (WCOREDUMP): Move to wait.h,
rework.
[!W_STOPCODE] (W_STOPCODE), [!W_EXITCODE] (W_EXITCODE),
[!W_CONTINUED] (W_CONTINUED): Move to wait.h.
2018-10-03 10:31:30 +02:00
Eugene Syromyatnikov
0e58b178e5 filter_qualify.c: refactor sigstr_to_uint
* filter_qualify.c (signame_eq): New function.
(sigstr_to_uint): Use signame_eq for comparing signame.
2018-09-27 08:00:34 +02:00
Eugene Syromyatnikov
bca1b70f6b Use nsig instead of arbitrary numbers
* filter_qualify.c (sigstr_to_uint): Use nsig.
* prctl.c (SYS_FUNC(prctl)) <case PR_SET_PDEATHSIG>: Use nsig.
2018-09-27 07:56:25 +02:00
Eugene Syromyatnikov
6d024c6336 signal: provide nsig constant
* defs.h (nsig): New declaration.
* signal.c (nsig): New constant.
2018-09-27 07:48:43 +02:00
Eugene Syromyatnikov
1525464331 Replace direct usage of err_name/errnoent with print_err
* keyctl.c (keyctl_reject_key): Use print_err for printing error
argument.
* netlink.c (decode_nlmsgerr): Use print_err for printing errno field.
* numa.c (print_status): Use print_err for printing errno.
2018-09-27 07:42:50 +02:00
Eugene Syromyatnikov
0fa594e3e8 fixup! syscall: track syscall system time a bit more explicitly 2018-09-27 07:41:33 +02:00
Eugene Syromyatnikov
4ed4a2ffcc syscall: reset auxstr
Otherwise RVAL_STR may print auxstr remained from a previous syscall.

* syscall.c (syscall_entering_trace); Set tcp->auxstr to NULL.
2018-09-27 07:39:07 +02:00
Eugene Syromyatnikov
07c1744c02 syscall: dump write buffer regardless of fd value
For the same reason, as with syserror(tcp).

* syscall.c (dumpio): Move "fd < 0" check after write I/O buffer
printing.
2018-09-27 07:37:35 +02:00
Eugene Syromyatnikov
53ac73b04e syscall: add print_err function
Prints error number, respecting current xlat verbosity setting.

* defs.h (print_err): New declaration.
* print_fields.h (PRINT_FIELD_ERR): New macro.
* syscall.c (print_err): New function.
2018-09-27 07:35:32 +02:00
Eugene Syromyatnikov
c2cc305c66 numa: use standard print_int32_array_member callback
* numa.c (print_int): Remove.
(SYS_FUNC(move_pages)): Use print_int32_array_member instead of
print_int.
2018-09-27 07:31:23 +02:00
Eugene Syromyatnikov
061d0e133e fixup! syslog: do not print bufp and len for commands that ignore them 2018-09-27 07:28:37 +02:00
Eugene Syromyatnikov
cfc3e07033 tests: add syslog-success test
* tests/.gitignore: Add syslog-success
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add syslog-success.test.
* tests/syslog-success.c: New file.
* tests/syslog-success.test: New test.
* tests/syslog.c: Add support for running under syscall retval
injection, add checks.
2018-09-27 07:24:03 +02:00
Eugene Syromyatnikov
a26ad5c9ad syslog: decode log level in SYSLOG_ACTION_CONSOLE_LEVEL command
* xlat/syslog_console_levels.in: New file.
* syslog.c: Include "xlat/syslog_console_levels.h".
(SYS_FUNC(syslog)): Add SYSLOG_ACTION_CONSOLE_LEVEL case.
* tests/syslog.c: Add checks.
2018-09-27 07:21:10 +02:00