7156 Commits

Author SHA1 Message Date
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
Eugene Syromyatnikov
9ea764c377 syslog: fix argument printing
* syslog.c (SYS_FUNC(syslog)): Store conversion to int of tcp->u_arg[2]
in len; print address using printaddr64 (as syslog doesn't use compat
for x32), and third argument as int (as it has this type in the syscall
handler).
* tests/syslog.c: Add checks.
2018-09-27 07:15:30 +02:00
Eugene Syromyatnikov
a6e6d0aa1f syslog: do not print bufp and len for commands that ignore them
* syslog.c (SYS_FUNC(syslog)): Defer printing of comma after the first
argument to the specific command handlers, return RVAL_DECODED without
additional printing for SYSLOG_ACTION_CLOSE, SYSLOG_ACTION_OPEN,
SYSLOG_ACTION_CLEAR, SYSLOG_ACTION_CONSOLE_OFF,
SYSLOG_ACTION_CONSOLE_ON, SYSLOG_ACTION_SIZE_UNREAD,
SYSLOG_ACTION_SIZE_BUFFER.
* tests/syslog.c: Add checks.
2018-09-27 04:37:14 +02:00
Eugene Syromyatnikov
1324a28cc7 fixup! syslog: print syslog command with verbose style, as it is not in UAPI 2018-09-27 00:29:18 +02:00
Eugene Syromyatnikov
394ba90034 syslog: fix switch statement indentation
* syslog.c (SYS_FUNC(syslog)): Decrease indentation level of case
clauses in the switch statement.
2018-09-27 00:27:21 +02:00
Eugene Syromyatnikov
60b094103f syslog: print syslog command with verbose style, as it is not in UAPI
* syslog.c (SYS_FUNC(syslog)): Print syslog_action_type using
XLAT_STYLE_VERBOSE.
* tests/syslog.c: Update expected output.
2018-09-26 18:56:15 +02:00
Eugene Syromyatnikov
c35f9466a8 syslog: move constant definitions to xlat
* syslog.c (enmu): Remove
* xlat/syslog_action_type.in: Add fallback values.
2018-09-26 18:28:55 +02:00
Eugene Syromyatnikov
52981bfb48 fixup! futex: print uaddr value 2018-09-25 16:09:25 +02:00
Eugene Syromyatnikov
8015a74269 inotify: implement inotify fd I/O decoding support
* defs.h (decode_inotify_read): New declaration.
* inotify.c: Include "print_fields.h".
(decode_inotify_read): New function.
* io.c (decode_readbuf) <decoders>: Add decoder for anon_inode:inotify.
2018-09-25 12:18:23 +02:00
Eugene Syromyatnikov
78fd3aa2b8 fanotify: decode fanotify fd I/O
* xlat/fan_responses.in: New file.
* defs.h (decode_fanotify_read, decode_fanotify_write): New
declarations.
* fanotify.c: Include "print_fields.h".
[!FAN_AUDIT] (FAN_AUDIT): New macro definition.
Include "xlat/fan_responses.h".
(print_fanfd, decode_fanotify_read, decode_fanotify_write): New
functions.
* io.c (decode_readbuf): Add fanotify fd decoder using
decode_fanotify_read.
(decode_writebuf): Add fanotify fd decoder using decode_fanotify_write.
2018-09-25 03:17:33 +02:00
Eugene Syromyatnikov
4f72de66f4 io: add I/O buffer decoding infrastructure
* defs.h (enum fileops): New enumeration definition.
(filebuf_decoder_fn): New type definition.
* io.c: Include <fnmatch.h>
(struct filebuf_decoder_desc): New type definition.
(decode_filebuf, decode_readbuf, decode_writebuf): New functions.
(SYS_FUNC(read), SYS_FUNC(write), SYS_FUNC(pread), SYS_FUNC(pwrite)):
Call decode_readbuf/decode_writebuf instead of printing I/O buffer as a
string.
2018-09-25 01:57:22 +02:00
Eugene Syromyatnikov
ef330a84d9 msghdr: decode SO_RXQ_OVFL control packet
* xlat/scmvals.in (SO_RXQ_OVFL): New constant.
* msghdr.c (cmsg_socket_printers) <[SO_RXQ_OVFL]>: New socket option
decoder.
2018-09-24 20:53:16 +02:00
Eugene Syromyatnikov
1090f31204 xlat: use fallback definitions syntax in scmvals
* xlat/scmvals.in: Rewrite using fallback value definition syntax.
2018-09-24 20:51:15 +02:00
Eugene Syromyatnikov
1aca712d4a maint: add support for whitespace between # and define in gen_xlat_defs
* maint/gen_xlat_defs.sh: Change regular expressions for parsing common
and arch-specific files so they match macro definitions where whitespace
between "#" and "define" is present.
2018-09-24 20:39:01 +02:00
Eugene Syromyatnikov
bca69f9e39 linux/arm/syscallent.h: Add a comment that __ARM_NR_cmpxchg was removed in 4.4 2018-09-24 20:35:18 +02:00
Eugene Syromyatnikov
c3e1c57045 linux/arm/syscallents: replace empty definitions with comments
* linux/arm/syscallent.h ([222]): Remove definition, add a comment that
it was tux().
([223]): Remove definition, add comment that it was unused.
([254]): Remove definition, add comment that it was reserverd
for set_thread_area.
([255]): Remove definition, add comment that it was reserved
for get_thread_area.
2018-09-24 20:32:45 +02:00
Eugene Syromyatnikov
a4c8986bd7 net: use already existing array item printing function
* net.c (print_uint32): Remove.
(print_getsockopt): Use print_uint32_array_member instead of
print_uint32.
2018-09-24 20:30:27 +02:00
Eugene Syromyatnikov
c7436d45a8 fixup! socketutils: add fallback inode protocol cache 2018-09-24 20:29:43 +02:00
Eugene Syromyatnikov
f2f91dbe8b socketutils: dynamically request unknown genl families after init
This commits adds ability to request for unknown generic netlink
families after the initial xlat initialisation. It also changes
socketutils-level interface so it returns string and not xlat.

* defs.h (genl_families_xlat): Remove.
(genl_get_family_name): New declaration.
* netlink.c (decode_nlmsg_type_generic): Use genl_get_family_name
instead of genl_families_xlat.
* socketutils.c (genl_query_families): Rename from
genl_send_dump_families, add "id" parameter, perform dump if id == -1,
request specific ID otherwise.
(genl_get_family_name): Rename from genl_families_xlat, add "id"
parameter, return const char *; request specific genetlink family name
if it is not found in the already initialised xlat.
2018-09-24 20:16:32 +02:00
Eugene Syromyatnikov
49443a8c8c Remove HAVE_LINUX_GENETLINK_H ifdefs
<linux/netlink.h> is available since Linux 2.6.15 (commit
v2.6.15-rc1~53^2).

* configure.ac (AC_CHECK_HEADERS): Remove linux/genetlink.h.
* socketutils.c [!HAVE_LINUX_GENETLINK_H]: Remove
* tests/netlink_generic.c [!HAVE_LINUX_GENETLINK_H]: Likewise.
2018-09-24 19:56:08 +02:00
Eugene Syromyatnikov
7f3519e4d8 fixup! xlat: add generation of flags-related fields 2018-09-24 08:08:16 +02:00
Eugene Syromyatnikov
caac21a22b xlat: sort futexops
* xlat/futexops.in: Reorder, add #sorted.
2018-09-24 08:07:15 +02:00
Eugene Syromyatnikov
1d5a776f63 xlat: add fallback values for ioctl_dirs
* xlat/ioctl_dirs.in: Add fallback values.
2018-09-24 08:06:42 +02:00
Eugene Syromyatnikov
771a786157 inotify: decode file descriptor returned by inotify_init
* inotify.c (SYS_FUNC(inotify_init)): New function.
* linux/dummy.h (sys_inotify_init): Remove macro definition.
* tests/.gitignore: Add inotify_init, inotify_init-y, inotify_init1-y.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (inotify_init, inotify_init-y, inotify_init1-y):
New tests.
* tests/inotify_init-y.c: New file.
* tests/inotify_init.c: Likewise.
* tests/inotify_init1-y.c: Likewise.
* tests/inotify_init1.c [PRINT_PATHS]: Print inotify fd path.
2018-09-24 08:02:38 +02:00
Eugene Syromyatnikov
6d4b688d38 futex: print futex(FUTEX_FD) return value as FD
Since it used to be it.

* futex.c (SYS_FUNC(futex)) <case FUTEX_FD>: Return
RVAL_DECODED|RVAL_FD.
2018-09-24 07:35:18 +02:00
Eugene Syromyatnikov
342801a9dc futex: print uaddr value
As it might be of interest. Since uaddr itself is as important as the
containing value, it's alwais printed as comment.

* xlat/futexpiflags.in: New file.
* futex.c [!FUTEX_TID_MASK] (FUTEX_TID_MASK): New macro constant.
Include "xlat/futexpiflags.h".
(printaddrnum, printaddrpival): New functions.
(SYS_FUNC(futex)): Use printaddrpival/printaddrnum for printing uaddr
and uaddr2 values where appropriate.
* tests/futex.c: Update expected output.
2018-09-24 07:32:11 +02:00
Eugene Syromyatnikov
56c64c0f85 netlink: always print genetlink family ID
As those are allocated dynamically.

* netlink.c (decode_nlmsg_type_generic): Use XLAT_STYLE_VERBOSE.
* tests/netlink_generic.c: Update expected output.
2018-09-24 05:06:41 +02:00
Eugene Syromyatnikov
452bb1c4b9 fixup! ioctl: decode ioctl type 2018-09-24 03:58:51 +02:00
Eugene Syromyatnikov
c8dc2208eb ioctl: print private SIOC* ioctl commands
* ioctl.c [!SIOCPROTOPRIVATE] (SIOCPROTOPRIVATE): New macro constant.
[!SIOCDEVPRIVATE] (SIOCDEVPRIVATE): Likewise.
[!SIOCIWFIRSTPRIV] (SIOCIWFIRSTPRIV): Likewise.
[!SIOCIWLASTPRIV] (SIOCIWLASTPRIV): Likewise.
(ioctl_decode_command_number) <SOCK_IOC_TYPE>: Handle protocol-private
and device-private ioctl command numbers.
<0x8B>: Handle device-private ioctl comamnd numbers.
* tests/ioctl.c: Add checks.
2018-09-24 03:55:01 +02:00
Eugene Syromyatnikov
d7beb8d758 fixup! ioctl: decode ioctl type 2018-09-24 03:54:15 +02:00
Eugene Syromyatnikov
b4e5977fee revert ioctl xlat 2018-09-24 03:38:52 +02:00
Eugene Syromyatnikov
72ecb7691a xlat: update kvm_cap
* xlat/kvm_cap.in (KVM_CAP_NESTED_STATE): New constant, introduced
by Linux commit v4.19-rc1~87^2~62.
(KVM_CAP_ARM_INJECT_SERROR_ESR): New constant, introduced by Linux
commit v4.19-rc1~55^2~12^2~14, merged with its final value
in v4.19-rc1~55^2~12.
(KVM_CAP_MSR_PLATFORM_INFO): New constant, introduced by Linux commit
v4.19-rc5~8^2~2.
2018-09-24 00:43:52 +02:00
Eugene Syromyatnikov
fc2d593d3d ioctl: decode ioctl type
* xlat/ioc_types.in: New file
* ioctl.c: Include "xlat/ioc_types.h"
(ioctl_type_str): New function.
(ioctl_print_code): Use ioctl_type_str for decoding _IOC_TYPE(code).
2018-09-24 00:26:01 +02:00