Compare commits

...

248 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
b083940210 kvm: avoid bogus vcpu_info assignment in vcpu_register
Also reformat code a bit to make nesting a bit clearer.

Reported by Clang.

* kvm.c (vcpu_register): Do not assign vcpu_alloc result to vcpu_info
as this value is not used afterwards in the function.
2018-12-18 05:37:30 +01:00
Eugene Syromyatnikov
9319e0a49c rtnl_addr: decode IFA_RT_PRIORITY netlink attribute
* rtnl_addr.c (ifaddrmsg_nla_decoders): Decode IFA_RT_PRIORITY as u32.
2018-12-14 19:55:40 +01:00
Eugene Syromyatnikov
eaea61a93b fixup! xlat/rtnl_addr_attrs: add IFA_TARGET_NETNSID 2018-12-14 19:53:25 +01:00
Eugene Syromyatnikov
e2b7a15518 xlat: add PR_SPEC_INDIRECT_BRANCH to pr_spec_cmds
* xlat/pr_spec_cmds.in (PR_SPEC_INDIRECT_BRANCH): New constant,
introduced by Linux commit v4.20-rc5~4^2~3.
* prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL, case
PR_SET_SPECULATION_CTRL>: Add PR_SPEC_INDIRECT_BRANCH handling.
* tests/prctl-spec-inject.c: Add PR_SPEC_INDIRECT_BRANCH decoding
checks, update expected output.
2018-12-14 17:35:44 +01:00
Eugene Syromyatnikov
4e854fee20 xlat: update audit_arch
* xlat/audit_arch.in: Add fallback values.
(AUDIT_ARCH_H8300, AUDIT_ARCH_TILEGX, AUDIT_ARCH_TILEGX32,
AUDIT_ARCH_TILEPRO, AUDIT_ARCH_V850): New constants.
2018-11-25 16:51:14 +01:00
Eugene Syromyatnikov
ca28f1d4e7 v4l2: improve buffer flag decoding
* xlat/v4l2_buf_flags.in: Add fallback values.
* xlat/v4l2_buf_flags_masks.in: New file.
* xlat/v4l2_buf_flags_ts_src.in: Likewise.
* xlat/v4l2_buf_flags_ts_type.in: Likewise.
* v4l2.c: Include xlat/v4l2_buf_flags_ts_type.h,
xlat/v4l2_buf_flags_ts_src.h, xlat/v4l2_buf_flags_masks.h.
(print_v4l2_buffer_flags): New function.
(print_v4l2_buffer): Call print_v4l2_buffer_flags for printing flags field.
2018-11-25 16:14:11 +01:00
Eugene Syromyatnikov
aa720f7306 fixup! Print ISO 8601 time for wall clock time values 2018-11-25 16:12:11 +01:00
Eugene Syromyatnikov
f49fc80253 v4l: add constants introduced by Linux v4.20-rc1~51^2~4
* xlat/v4l2_control_ids.in (,V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS,
V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION): New constants, introduced by
Linux commit v4.20-rc1~51^2~4.
* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_MPEG2_SLICE): Likewise.
2018-11-25 15:53:17 +01:00
Eugene Syromyatnikov
f5b54b38ee fixup! Add support for alternative error/signal names 2018-11-25 15:43:13 +01:00
Eugene Syromyatnikov
997ce1ad8e xlat: tidy whitespace in fan_mark_flags
* xlat/fan_mark_flags.in: Align fallback values with additional
whitespace.
2018-11-25 14:29:05 +01:00
Eugene Syromyatnikov
420b631687 printsiginfo: decode IA-64-specific siginfo_t fields
* xlat/ia64_siginfo_si_flags.in: New file.
* printsiginfo.c [IA64]: Include xlat/ia64_siginfo_si_flags.h.
[IA64] (print_si_info): Decode si_imm, si_flags, and si_isr fields
for fault signals.
2018-11-25 14:11:54 +01:00
Eugene Syromyatnikov
a6ace08dbc printsiginfo: decode si_trapno
* xlat/alpha_gentrap.in: New file.
* configure.ac (AC_CHECK_MEMBERS): Add check for siginfo_t.si_trapno.
* printsiginfo.c [ALPHA]: Include <asm/gentrap.h>, "xlat/alpha_gentrap.h".
(print_si_info): Add SIGTRAP to the SIGILL/SIGFPE/SIGSEGV/SIGBUS/SIGEMT
case.
[HAVE_SIGINFO_T_SI_TRAPNO] (print_si_info) <case SIGTRAP>: Decode
si_trapno field.
2018-11-25 13:38:31 +01:00
Eugene Syromyatnikov
e44ae68ae4 printsiginfo: decode SIGEMT the same way as SIG{ILL,FPE,SEGV,BUS}
* printsiginfo.c (print_si_info) [SIGEMT] <case SIGEMT>: Add
to the SIGILL/SIGFPE/SIGSEGV/SIGBUS case.
2018-11-25 13:25:47 +01:00
Eugene Syromyatnikov
5338aecfa9 printsiginfo: use print_err for error number printing
* printsiginfo.c (print_si_info): use print_err instead of open-coding
error constant printing.
2018-11-25 12:51:23 +01:00
Eugene Syromyatnikov
05de794953 fixup! printsiginfo: decode FASYNC (O_ASYNC) signals 2018-11-25 11:05:56 +01:00
Eugene Syromyatnikov
9c26fb26e3 fixup! strace: use sprintsignal for converting signal number to string 2018-11-25 11:04:47 +01:00
Eugene Syromyatnikov
ce76cd330d printsiginfo: decode FASYNC (O_ASYNC) signals
* printsiginfo.c (print_fasync_info): New function.
(print_si_info): Add tcp argument.
(print_si_info) <case SI_SIGIO, case SIGPOLL>: Call print_fasync_info.
(printsiginfo): Add tcp argument, pass it to the print_si_info call.
(printsiginfo_at, print_siginfo_t): Pass tcp argument to printsiginfo
calls.
* printsiginfo.h (printsiginfo): Update declaration.
2018-11-25 11:02:13 +01:00
Eugene Syromyatnikov
b53717e034 printsiginfo: factor out syscall constant name printing
* printsiginfo.c (print_scconst); New function.
(print_si_info) <case SIGSYS>: Call print_scconst for si_syscall
printing.
2018-11-25 10:48:33 +01:00
Eugene Syromyatnikov
7bfd2375ff printsiginfo: dispatch signal code names using an array
* printsiginfo.c (print_si_code): Consolidate xlat pointers into an
array, dispatch over it using si_code.
2018-11-25 10:40:47 +01:00
Eugene Syromyatnikov
57098d88c2 xlat: add audit_arch_flags
For now, it's just a source for audit_flags fallback values.

* xlat/audit_arch_flags.in: New file.
* printsiginfo.c: Include xlat/audit_arch_flags.h.
2018-11-22 18:05:54 +01:00
Eugene Syromyatnikov
ce9d5044c8 xlat: add elf_em.in
For now, it's a source of fallback values for AUDIT_ARCH_* constants.

* xlat/elf_em.in: New file.
* printsiginfo.c: Include "xlat/elf_em.h"
2018-11-22 10:45:02 +01:00
Eugene Syromyatnikov
7657246b59 xlat/sock_ipv6_options: add IPV6_MULTICAST_ALL
* xlat/sock_ipv6_options.in (IPV6_MULTICAST_ALL): New constant,
introduced by Linux commit v4.19-rc3-454-g15033f0457dc.
2018-11-21 14:38:14 +01:00
Eugene Syromyatnikov
76eea4699e xlat/v4l2_control_types: add V4L2_CTRL_TYPE_MPEG2_*
* xlat/v4l2_control_types.in (V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS,
V4L2_CTRL_TYPE_MPEG2_QUANTIZATION): New constants, introduced by Linux
commit v4.19-rc1-74-gc27bb30e7b6d.
2018-11-21 14:38:14 +01:00
Eugene Syromyatnikov
a1d541c26a xlat/v4l2_control_types: add fallback values, #sorted
* xlat/v4l2_control_types.in: Add fallback values and "#sorted".
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
4ef7513055 xlat/v4l2_pix_fmts: add V4L2_PIX_FMT_SUNXI_TILED_NV12
* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_SUNXI_TILED_NV12): New constant,
introduced by Linux commit v4.19-rc1-75-g36cf35b78640.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
91ab71f387 xlat/evdev_abs: add ABS_RESERVED
* xlat/evdev_abs.in (ABS_RESERVED): New constant, introduced by Linux
commit v4.18-10855-gd9ca1c990a7f.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
9e9071d615 xlat/evdev_relative_axes: add REL_RESERVED and REL_WHEEL_HI_RES
* xlat/evdev_relative_axes.in (REL_RESERVED): New constant, introduced
by Linux commit v4.18-10855-gd9ca1c990a7f.
(REL_WHEEL_HI_RES): New constant, introduced by Linux commit
v4.18-10849-gaaf9978c3c02 and updated by Linux commit
v4.18-10855-gd9ca1c990a7f.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
d6d103b4fa xlat/fan_init_flags: add FAN_REPORT_TID
* xlat/fan_init_flags.in (FAN_REPORT_TID): New constant, introduced
by Linux commit v4.19-rc2-16-gd0a6a87e40da.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
776043f4cc xlat/fan_init_flags: whitespace
* xlat/fan_init_flags.in: Replace spaces with tabs.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
e7b9424cac xlat: update kvm_cap
* xlat/kvm_cap.in (KVM_CAP_PPC_NESTED_HV): New constant, introduced
by Linux commit v4.19-rc4-286-gaa069a996951.
(KVM_CAP_HYPERV_SEND_IPI): New constant, introduced by Linux commit
v4.19-rc4-328-g214ff83d4473.
KVM_CAP_COALESCED_PIO): New constant, introduced by Linux commit
v4.19-rc4-369-g0804c849f1df.
(KVM_CAP_HYPERV_ENLIGHTENED_VMCS): New constant, introduced by Linux
commit v4.19-rc4-375-g57b119da3594.
(KVM_CAP_EXCEPTION_PAYLOAD): New constant, introduced by Linux commit
v4.19-rc4-392-gc4f55198c7c2.
(KVM_CAP_ARM_VM_IPA_SIZE): New constant, introduced by Linux commit
v4.19-rc5-18-g233a7cb23531 and updated by Linux commit
v4.19-rc5-215-ge42b4a507efa.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
d20c0c7804 xlat/sock_packet_options: add PACKET_IGNORE_OUTGOING
* xlat/sock_packet_options.in (PACKET_IGNORE_OUTGOING): New constant,
introduced by Linux commit v4.19-rc2-323-gfa788d986a3a.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
b84f967d27 xlat/rtnl_addr_attrs: add IFA_TARGET_NETNSID
* xlat/rtnl_addr_attrs.in (IFA_TARGET_NETNSID): New constant, introduced
by Linux commit v4.19-rc2-337-g9f3c057c146f.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
ad40a98f06 xlat: update neighbor_cache_entry_flags
* xlat/neighbor_cache_entry_flags.in (NTF_OFFLOADED): New constant,
introduced by Linux commit v4.13-rc1~157^2~252^2~13.
(NTF_STICKY): New constant, introduced by Linux commit
v4.19-rc2-432-g435f2e7cc0b7.
(NTF_USE, NTF_SELF, NTF_MASTER, NTF_PROXY, NTF_EXT_LEARNED, NTF_ROUTER):
Add fallback value.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
8a268ad962 xlat: add flow dissector bpf program type constants
Introduced by Linux commit v4.19-rc2-341-gd58e468b1112.

* xlat/bpf_attach_type.in (BPF_FLOW_DISSECTOR): New constant.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_FLOW_DISSECTOR): Likewise.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
161121a3d2 rtnl_tc: add TCA_STATS_BASIC_HW
* xlat/rtnl_tca_stats_attrs.in (TCA_STATS_BASIC_HW): New constant,
introduced by v4.19-rc4-670-g5e111210a443.
* rtnl_tc.c (tca_stats_nla_decoders): Add TCA_STATS_BASIC_HW.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
6141608483 xlat/sock_netlink_options: add NETLINK_DUMP_STRICT_CHK
* xlat/sock_netlink_options.in (NETLINK_DUMP_STRICT_CHK): New constant,
introduced by Linux commit v4.19-rc6-1866-g89d35528d17d.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
74d0cad5dd xlat/rtnl_ifla_info_data_bridge_attrs: add IFLA_BR_VLAN_STATS_PER_PORT
* xlat/rtnl_ifla_info_data_bridge_attrs.in
(IFLA_BR_VLAN_STATS_PER_PORT): New constant, introduced by Linux commit
v4.19-rc6-2094-g9163a0fc1f0c.
* rtnl_link.c (ifla_info_data_bridge_nla_decoders): Add
IFLA_BR_VLAN_STATS_PER_PORT.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
504b43651c xlat/fsmagic: rename XFS_SB_MAGIC to XFS_SUPER_MAGIC
Per Linux commit v4.19-rc1-28-gdddde68b8f06.

* xlat/fsmagic.in (XFS_SUPER_MAGIC): Rename from XFS_SB_MAGIC.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
b45562e897 xlat: convert fsmagic to a regular form
As xlat/gen.sh supports fallback definitions and sorted xlats now,
there's no need for raw definitions in fsmagic xlat.

* xlat/fsmagic.in: convert to a regular form.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
e6e005f70c Decode UID/GID in -y mode
* defs.h (RVAL_UID, RVAL_GID): New macro constants.
(printgid): New function declaration.
* ipc_msgctl.c (print_msqid_ds, print_msqid_ds): Use printgid for
printing GID.
* ipc_shmctl.c (print_shmid_ds, print_shmid_ds): Likewise.
* keyctl.c (keyctl_chown_key): Likewise.
* nlattr.c (decode_nla_gid): Likewise.
* linux/dummy.h (sys_getgid, sys_getgid16, sys_getresgid,
sys_getresgid16, sys_setfsgid, sys_setfsgid16, sys_setgid, sys_setgid16,
sys_setregid, sys_setregid16, sys_setresgid, sys_setresgid16): Remove
macros.
(sys_getegid): Define to sys_getgid instead of sys_getuid.
(sys_getegid16): Define to sys_getgid16 instead of sys_geteuid16.
* linux/syscall.h (getresgid16, getgid16, setfsgid16, setresgid16,
setregid16, setgid16): New external SYS_FUNC declarations.
* msghdr.c (print_scm_creds); Use PRINT_FIELD_GID for printing GID.
* net.c (print_get_ucred): Likewise.
* netlink_inet_diag.c (decode_inet_diag_msg): Likewise.
* netlink_smc_diag.c (decode_smc_diag_msg): Likewise.
* print_fields.h (PRINT_FIELD_UID); Use printuid for printing UID.
(PRINT_FIELD_GID): New macro.
* print_struct_stat.c (print_struct_stat): Use printuid for printing
UID, printgid for printing GID.
* printsiginfo.c (printsigsource): Use printuid for printing UID.
* resource.c (print_priority_who): New function.
(SYS_FUNC(getpriority), SYS_FUNC(setpriority)): Use print_priority_who
for printing the second argument.
* statx.c (SYS_FUNC(statx)): Use PRINT_FIELD_UID for printing UID,
PRINT_FIELD_GID for printing GID.
* syscall.c (syscall_exiting_trace): Handle RVAL_UID and RVAL_GID.
* tests/overflowuid.c: Include stdio.h.
(printuid): New function.
* tests/setfsugid.c (printugid): Rename from printuid, update call
sites.
* tests/setgroups.c: Likewise.
* tests/setugid.c: Likewise.
* tests/tests.h (printuid): New declaration.
* uid.c (printgid, sys_getresgid, sys_getgid, sys_setfsgid,
sys_setresgid, sys_setregid, sys_setgid): Add SIZEIFY wrappers.
(gid_t, gid_t_, gid_t__): Define similarly to uid_t, uid_t_, uid_t__.
Include grp.h, pwd.h, sys/types.h.
(enum id_type): New enumeration.
(SYS_FUNC(getuid), SYS_FUNC(setfsuid), ): Return RVAL_UID flag.
(SYS_FUNC(getgid), SYS_FUNC(setfsgid), SYS_FUNC(setgid),
SYS_FUNC(getresgid), SYS_FUNC(setregid), SYS_FUNC(setresgid)): New
functions.
(get_print_id): Rename from get_print_uid, add idt argument, call
printuid or printgid depending on it. Update call sites.
(SYS_FUNC(chown), SYS_FUNC(fchown), print_gid): Use printgid
for printing GID.
(ID_CACHE_SIZE): New macro constant.
(print_id): New function.
(printuid): Implement using print_id.
(printgid): New function.
* xlat/priorities.in: Provide fallback values.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
ce366255c5 loop: use XLAT_MACROS_ONLY instead of #stop
As the former allows controlling presence of xlat definitions
during the inclusion and not header generation.

* xlat/loop_cmds.in: remove #stop.
* loop.c: Wrap "xlat/loop_cmds.h" inclusion in XLAT_MACROS_ONLY.
* tests/ioctl_loop.c: Likewise.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
826306c987 linux/mips/get_syscall_args.c: print an error message on fetch error
Instead of failing silently.

* linux/mips/get_syscall_args.c (get_syscall_args): Print an error message
when umoven fails.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
2f46f33384 linux/hppa/syscallent.h: add a comment about old name of syscall 102
Also, remove empty definition.

* linux/hppa/syscallent.h ([102]): Remove (empty) definition, add
a comment that it was socketcall.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
1d46db4207 linux/mips/syscallent-o32.h: entry 4221 is actually called "reserved221" 2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
12f618552a fixup! ptp: update decoder 2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
606a8f39e8 fcntl: decode F_GETOWNER_UIDS
* fcntl.c (print_owner_uids): New function.
(print_fcntl) <case F_GETOWNER_UIDS>: Decode command using
print_owner_uids.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
7908a872ba netlink_inet_diag: implement INET_DIAG_MD5SIG attribute decoding
* linux/inet_diag.h (INET_DIAG_MD5SIG): New enum entity.
(TCP_MD5SIG_MAXKEYLEN): New macro.
(struct tcp_diag_md5sig): New type definition.
* netlink_inet_diag.c (decode_tcp_md5sig): New function.
(inet_diag_msg_nla_decoders) <[INET_DIAG_MD5SIG]>: New attribute,
decoded by decode_tcp_md5sig.
* xlat/inet_diag_attrs.in (INET_DIAG_MD5SIG): New constant.
* xlat/inet_diag_extended_flags.in (1<<(INET_DIAG_MD5SIG-1)): New flag.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
d1f4b528cb fcntl: decode read/write hints commands
Introduced by Linux commit v4.13-rc1~212^2~51.

* xlat/fcntl_rw_hints.in: New file.
* fcntl.c: Include "xlat/fcntl_rw_hints.h".
(print_rwhint): New function.
(print_fcntl) <case F_SET_RW_HINT, case F_SET_FILE_RW_HINT, case
F_GET_RW_HINT, case F_GET_FILE_RW_HINT>: New fcntl command handlers.
* xlat/fcntlcmds.in (F_GET_RW_HINT, F_SET_RW_HINT, F_GET_FILE_RW_HINT,
F_SET_FILE_RW_HINT): New constants.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
48a84accf6 fixup! Check PTP API fields 2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
4a602e8962 ptp: update decoder
* xlat/ptp_ioctl_cmds.in: New file.
* xlat/ptp_pin_funcs.in: Likewise.
* xlat/ptp_flags_options.in: Add fallback values.
* ptp.c [HAVE_STRUCT_PTP_SYS_OFFSET]: Remove #ifdef.
Include "ptp_clock.h" instead of <linux/ptp_clock.h>.
Include "xlat/ptp_ioctl_cmds.h" undef XLAT_MACROS_ONLY.
Include "xlat/ptp_pin_funcs.h".
(print_ptp_clock_time): New function.
(PRINT_FIELD_PTP_CLOCK_TIME, PRINT_FIELD_RSV): New macros.
(ptp_ioctl) <case PTP_EXTTS_REQUEST>: Use struct
strace_ptp_extts_request instead of struct ptp_extts_request; print
index field as unsined, print rsv field using PRINT_FIELD_RSV.
(ptp_ioctl) <case PTP_PEROUT_REQUEST>: Use struct
strace_ptp_perout_request instead of struct ptp_perout_request; print
start and period fields using PRINT_FIELD_PTP_CLOCK_TIME; print rsv
field using PRINT_FIELD_RSV.
(ptp_ioctl) <case PTP_ENABLE_PPS>: Print arg as unsigned.
(ptp_ioctl) <case PTP_SYS_OFFSET>: Use struct strace_ptp_sys_offset
instead of struct ptp_sys_offset; print rsv field using PRINT_FIELD_RSV;
print time stamps using print_ptp_clock_time.
(ptp_ioctl) <case PTP_CLOCK_GETCAPS>: Use struct strace_ptp_clock_caps
instead of struct ptp_clock_caps; print n_pins, cross_timestamping, and
rsv fields.
(ptp_ioctl) <case PTP_SYS_OFFSET_PRECISE, case PTP_PIN_GETFUNC, case
PTP_PIN_SETFUNC>: Handle new commands.
2018-11-21 14:38:13 +01:00
Eugene Syromyatnikov
8ff46440ff configure.ac: do not hard-code list of arches that have m32/mx32
As of now, it can be derived from SUPPORTED_PERSONALITIES, and this
information is provided in arch_defs.

* configure.ac: Use AC_COMPILE_IFELSE in order to call st_MPERS based
on SUPPORTED_PERSONALITIES value set for a n architecture.
2018-11-21 14:38:12 +01:00
Eugene Syromyatnikov
d998972eb5 Check PTP API fields
Similarly to bpf_attr fields checks.

* ptp_clock.h: New file.
* Makefile.am (strace_SOURCES): Add it.
(strace_SOURCES_check, BUILT_SOURCES, CLEANFILES): Add ptp_clock_check.c.
(EXTRA_DIST): Add gen_ptp_clock_check.sh.
(ptp_clock_check.c): New rule.
* configure.ac (AC_CHECK_HEADERS([linux/ptp_clock.h])): Call
st_PTP_CLOCK.
* gen_ptp_clock_check.sh: New file.
* m4/gen_ptp_clock_m4.awk: Likewise.
* m4/gen_ptp_clock_m4.sh: Likewise.
2018-11-21 14:38:12 +01:00
Eugene Syromyatnikov
2d2edb4654 xlat: add fallback values for notifyflags
* xlat/notifyflags.in: Add fallback values.
2018-11-21 14:38:12 +01:00
Eugene Syromyatnikov
3cfdc5da72 xlat: provide fallback values to getsock_ip*_options
* xlat/getsock_ip_options.in: Provide fallback values.
* xlat/getsock_ipv6_options.in: Likewise.

Closes: https://github.com/strace/strace/issues/87
2018-11-21 14:38:03 +01:00
Eugene Syromyatnikov
8cfc98ca99 sync_file_range2: remove unneeded argn assignment
clang complains about it:

         argn = printllval(tcp, "%lld", argn);
         ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sync_file_range2.c:43:2: note: Value stored to 'argn' is never read

* sync_file_range2.c (SYS_FUNC(sync_file_range2)): Do not assign
printllval result to argn second time.
2018-10-20 06:42:20 +02:00
Eugene Syromyatnikov
e963559c13 linux/smc_diag.h: update struct smc_diag_req definition
In accordance with Linux commit v4.19-rc8~22^2~17^2.

* linux/smc_diag.h (struct smc_diag_req): Use a union for
diag_fallback/diag_mode.
2018-10-20 06:35:44 +02:00
Eugene Syromyatnikov
cae7ddf0a3 fixup! futex: print uaddr value 2018-10-20 06:31:41 +02:00
Eugene Syromyatnikov
3c068f860e net: decode SOL_CAN_RAW socket options
* xlat/sock_can_raw_options.in: New file.
* net.c: Include "xlat/sock_can_raw_options.h".
(print_sockopt_fd_level_name) <case SOL_CAN_RAW>: Print socket option
name using sock_can_raw_options xlat.
2018-10-20 06:25:22 +02:00
Eugene Syromyatnikov
53bc64c795 xlat/clockflags: provide fallback values
* xlat/clockflags.in: Provide fallback values.
2018-10-20 06:20:07 +02:00
Eugene Syromyatnikov
079776b9bd xlat/fdflags: provide fallback values
* xlat/fdflags.in: Provide fallback values.
2018-10-20 06:19:42 +02:00
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
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
Eugene Syromyatnikov
8783cd8119 ioctl: print ioctl code in accordance with xlat verbosity
* ioctl.c (ioctl_print_code): Format in accrordance with xlat verbosity
setting.
2018-09-24 00:06:08 +02:00
Eugene Syromyatnikov
aeb343b726 Implement sysfs syscall decoding
* Makefile.am (strace_SOURCES): New file.
* linux/dummy.h (sys_sysfs): Remove macro definition.
* sysfs.c: New file.
* tests/gen_tests.in: Add sysfs test definition.
* tests/.gitignore: add sysfs.
* tests/pure_executables.list: Add sysfs.
* tests/sysfs.c: New file.
2018-09-23 12:35:53 +02:00
Eugene Syromyatnikov
8a7ba35d04 msghdr: decode IP_RECVFRAGSIZE control message
Added in v4.10-rc1~202^2~340^2~2.

* xlat/ip_cmsg_types.in (SCM_SECURITY): Provide fallback message,
reorder.
(IP_RECVFRAGSIZE): New constant.
* msghdr.c (print_cmsg_int): New function.
(cmsg_ip_printers) <IP_RECVFRAGSIZE>: New printer.
2018-09-19 23:00:30 +02:00
Eugene Syromyatnikov
156777f967 Fix old_getrlimit handling
On some historic 32-bit platforms (and 64-bit SuperH), __NR_getrlimit
corresponds to a non-SuS-compatible version that uses a hardcoded value
of 0x7fffffff as infinity. Moreover, in order to provide a backwards
compatibility with that behaviour, some architectures (mips, sparc, and
alpha, with latter being especially peculiar in its ways) just defined
RLIM_INFINITY to that value (with alpha defining RLIM_INFINITY to 2^63-1)
instead of employing sys_old_getrlimit syscall and providing
__NR_ugetrlimit with proper implementation, as other arches did.

Overall, that led to conclusion that printing "RLIM_INFINITY" is never
enough and the actial value should be printed as well.

* linux/i386/syscallent.h ([76]): Changing decoder to old_getrlimit.
* linux/m68k/syscallent.h ([76]): Likewise.
* linux/microblaze/syscallent.h ([76]): Likewise.
* linux/powerpc/syscallent.h ([76]): Likewise.
* linux/s390/syscallent.h ([76]): Likewise.
* linux/sh/syscallent.h ([76]): Likewise.
* linux/sh64/syscallent.h ([76]): Likewise.
* resource.c (sprint_rlim64, sprint_rlim32, print_rlimit64,
print_rlimit32): Remove.
(STRACE_RLIM_INFINITY, STRACE_M32_RLIM_INFINITY,
STRACE_RLIM64_INFINITY, OLD_GETLIMIT_INFINITY): New macro constants.
(enum rlimit_decode_mode): New enumeration.
(struct rlimit_64): Move type definition out of print_rlimit64.
(print_rlim_t): New function, printer of an rlimit value, in accordance
with rlimit decode mode and xlat verbosity mode.
(print_rlimit): Printer of a fetched rlimit_64 structure.
(decode_rlimit): Fetches struct rlimit/rlimit64 in accordance with
current mode and personality, uses print_rlimit for printing.
(do_getrlimit): New function, decodes old_getrlimit/getrlimit syscalls.
(SYS_FUNC(getrlimit)): Call do_getrlimit with RDM_NORMAL mode.
(SYS_FUNC(old_getrlimit)): New function, calls do_getrlimit with
RDM_OLD_GETRLIMIT mode.
(SYS_FUNC(setrlimit)): Call decode_rlimit with RDM_NORMAL mode.
(SYS_FUNC(prlimit64)): Call decode_rlimit with RDM_PRLIMIT64 mode
instead of print_rlimit64.
* tests/xgetrlimit.c (sprint_rlim): Rename to...
(print_rlim): ...this, print to terminal instead of string buffer in
accordance with the output format expected.
(main): Accomodate sprint_rlim -> print_rlim change, use sprintrc.
* tests/getrlimit.c (INFINITY, INFINITY_STR): New macros.
* tests/setrlimit.c: Likewise.
* tests/ugetrlimit.c: Likewise.
2018-09-17 20:12:02 +02:00
Eugene Syromyatnikov
719d1f8986 linux/ia64: use shuffle_scno, since syscallent table starts from 1024
* linux/ia64/shuffle_scno.c: New file
* Makefile.am (EXTRA_DIST): Add it.
* linux/ia64/arch_regs.h (IA64_SCNO_BASE): New macro.
* linux/ia64/syscallent.h: Decrease all indices by IA64_SCNO_BASE.
2018-09-17 02:59:15 +02:00
Eugene Syromyatnikov
2d89ff7096 xlat: add generation of flags-related fields
Generate known flags mask and maximum string length.

* xlat.h (struct xlat): Add fields flags_strsz and flags_mask.
* xlat/gen.sh (print_xlat, print_xlat_pair): Add generation of
XLAT_VAL_n and XLAT_STR_n macros.
(gen_header): Generate flags_strsz and flags_mask fields' values using
the generated XLAT_VAL_n and XLAT_STR_n macros, undefine them
afterwards.
2018-09-17 02:49:00 +02:00
Eugene Syromyatnikov
06bb2018c7 uname: decode olduname and oldolduname syscalls
* linux/dummy.h (sys_oldolduname, sys_olduname): Remove.
* tests/.gitignore: Add oldolduname, oldolduname-v, olduname,
olduname-v.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (oldolduname, oldolduname-v, olduname,
olduname-v): New tests.
* tests/oldolduname-v.c: New file.
* tests/oldolduname.c: Likewise.
* tests/olduname-v.c: Likewise.
* tests/olduname.c: Likewise.
* uname.c: Include <linux/uname.h> instead of <sys/uname.h>.
(DECODE_UTSNAME_COMMON): New macro.
(SYS_FUNC(oldolduname), SYS_FUNC(olduname)): New decoders.
(SYS_FUNC(uname)): Rewrite using DECODE_UTSNAME_COMMON.
2018-09-11 20:00:20 +02:00
Eugene Syromyatnikov
1abb9c7b21 get_rboust_list: update get_robust_list and set_robust_list decoders
Decode struct robust_list_head.

* linux/dummy.h (sys_set_robust_list): Remove.
* get_robust_list.c (DEF_MPERS_TYPE(struct_robust_list_head)): Add mpers
type definition.
Include <linux/futex.h>.
(struct_robust_list_head): New type definition.
Include MPERS_DEFS, "print_fields.h".
(decode_robust_list): New function.
(SYS_FUNC(set_robust_list)): New decoder.
(SYS_FUNC(get_robust_list)): Decode second argument.
* tests/xet_robust_list.c: Include <string.h>, <linux/futex.h>.
(sprintaddr): Remove.
(print_rlh): New function.
(main): Add get_robust_list/set_robust_list checks.
2018-09-11 19:45:10 +02:00
Eugene Syromyatnikov
9f7da75206 Print signal name strace killed with
As of now, there's no visible indication that strace itself
has been signalled: it exits with exit code 0 and without any messages.
Let's add a message, at least.

* gcc_compat.h (CMPXCHG): New macro
* strace.c (interrupt): set interrupted signal only once.
(print_signalled): Add support for calling with tcp == NULL.
(terminate): Call print_signalled is qflag is not set and strace
has been interrupted.
2018-09-11 16:52:52 +02:00
Eugene Syromyatnikov
895a68db41 socketutils: add fallback inode protocol cache
For the cases when we hit a race between sock_diag request for a socket
and its addition to the socket list. It collects information about
sockets that created via socket(2) syscall and is used when not protocol
information data is available via normal means.

* defs.h (set_netlink_family_cache_entry,
get_netlink_family_cache_entry, invalidate_netlink_family_cache_entry):
New delcarations.
* desc.c (SYS_FUNC(call)): Call invalidate_netlink_family_cache_entry
for inode being closed.
* net.c (SYS_FUNC(socket)): Call set_netlink_family_cache_entry for
AF_NETLINK sockets, do not return RVAL_DECODED on entering for them.
* socketutils.c: New enumeration for cache-related constants.
(NLF_CACHE_KEY_MASK): Cache key mask constant.
(netlink_cache): Fallback cache for netlink protocol numbers.
(set_netlink_family_cache_entry, get_netlink_family_cache_entry,
invalidate_netlink_family_cache_entry): New functions.
(netlink_get): Request protocol via get_netlink_family_cache_entry if
not information has been obtained.
2018-09-11 07:51:46 +02:00
Eugene Syromyatnikov
399a2d8849 userfaultfd: enhance UFFDIO_API ioctl decoder
It may return API and features even with errno set to EINVAL.

* userfaultfd.c (print_uffdio_api_start): New function.
(uffdio_ioctl): Decode api and features fields on exiting if errno
is EINVAL.
2018-09-11 06:05:08 +02:00
Eugene Syromyatnikov
22ec7c5edb ioctl: sort entries in ioctl_decode switch statement
* ioctl.c (ioctl_decode): Sort case branches in the switch statement.
2018-09-11 02:01:21 +02:00
Eugene Syromyatnikov
1ef81b4b74 fixup! Avoid mixing error messages and trace output 2018-09-11 01:46:49 +02:00
Eugene Syromyatnikov
b7d8794dbf xlat: add FAN_ENABLE_AUDIT to fan_init_flags xlat
* xlat/fan_init_flags.in (FAN_ENABLE_AUDIT): New constant, introduced by
Linux commit v4.15-rc1~130^2^2~11.
* tests/fanotify_init.c: Update expected output.
2018-09-11 01:45:30 +02:00
Eugene Syromyatnikov
4544b3f554 Avoid mixing error messages and trace output
Handle error_msg output similarly to the output from another tcb.

* Makefile.am (strace_CPPFLAGS): Add -DHAVE_DEFS_H.
* error_prints.c [HAVE_DEFS_H]: Include "defs.h" instead of "config.h".
(verror_msg): Call finish_line before fflush().
* error_prints.h (finish_line): New declaration.
* strace.c (finish_line): New function.
2018-09-11 01:32:52 +02:00
Eugene Syromyatnikov
2df7898efb Makefile.am: provide MPERS_WORDSIZE and MPERS_KLONGSIZE definitions
* Makefile.am (strace_CFLAGS, $(mpers_m32_targets): mpers_CC_FLAGS,
$(mpers_mx32_targets): mpers_CC_FLAGS): Add -DMPERS_WORDSIZE and
-DMPERS_KLONGSIZE.
2018-09-10 21:38:06 +02:00
Eugene Syromyatnikov
00c56292a1 Makefile.am: quote mpers_CC_FLAGS in mpers.sh call
Otherwise additional flags are recognised as file names.

* Makefile.am (mpers-m%.stamp): Quote mpers.sh arguments.
2018-09-10 21:37:42 +02:00
Eugene Syromyatnikov
25f71c5488 ioctl: fix indentation in switch clauses
* ioctl.c: Fix indentation in switch clauses, no code changes.
2018-09-06 20:00:00 +02:00
Eugene Syromyatnikov
33ea6a9bb0 xlat: provide fallback values for schedulers
* xlat/schedulers.in: Provide fallback values, add #value_indexed.
(SCHED_ISO): Comment out, not currently used in Linux.
2018-09-06 19:58:27 +02:00
Eugene Syromyatnikov
f4e7b1e740 Revert "netlink_diag: move constant definitions to xlats"
This reverts commit bfbdf336ec301578fe5ab80b3271f8f6ade71466.
2018-09-06 11:24:58 +02:00
Eugene Syromyatnikov
bfbdf336ec netlink_diag: move constant definitions to xlats
In order to avoid duplication.

* linux/netlink_diag.h (NETLINK_DIAG_MEMINFO, NETLINK_DIAG_GROUPS,
NETLINK_DIAG_RX_RING, NETLINK_DIAG_TX_RING, NETLINK_DIAG_FLAGS,
NDIAG_SHOW_MEMINFO, NDIAG_SHOW_GROUPS, NDIAG_SHOW_RING_CFG,
NDIAG_SHOW_FLAGS, NDIAG_FLAG_CB_RUNNING, NDIAG_FLAG_PKTINFO,
NDIAG_FLAG_BROADCAST_ERROR, NDIAG_FLAG_NO_ENOBUFS,
NDIAG_FLAG_LISTEN_ALL_NSID, NDIAG_FLAG_CAP_ACK): Remove.
* xlat/netlink_diag_attrs.in: Add fallback values.
* xlat/netlink_diag_show.in: Likewise.
* xlat/netlink_socket_flags.in: Likewise.
2018-09-05 00:45:35 +02:00
Eugene Syromyatnikov
08c045c3ac Work around possible post-execve-SIGTRAP when PTRACE_ATTACH is used 2018-09-04 22:14:03 +02:00
Eugene Syromyatnikov
68d33a311a fixup! syscall: track syscall system time a bit more explicitly 2018-09-04 22:12:13 +02:00
Eugene Syromyatnikov
d055196eb4 count: add information about minimum and maximum call duration
* count.c (struct call_counts): Add time_min, time_max fields.
(max_ts): New constant.
(enum count_summary_columns): Add CSC_TIME_MIN, CSC_TIME_MAX.
(count_syscall): Fill time_min field with max_ts in counts
initialisation, update time_min and time_max.
(min_time_cmp, max_time_cmp): New functions.
(set_sortby): Add keys for them.
(set_count_summary_columns): Add support for time_min and time_max
fields printing.
* strace.1.in (.SH OPTIONS) <-S, -U>: Document it.

Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=240945
Closes: https://github.com/strace/strace/issues/32
2018-09-04 20:36:08 +02:00
Eugene Syromyatnikov
dd1061290f strace.1.in: variaous fixes 2018-09-04 20:30:56 +02:00
Eugene Syromyatnikov
1cf06bb8df strace.1.in: consistently use CTRL-combinations 2018-09-04 20:30:30 +02:00
Eugene Syromyatnikov
33e9a736b1 strace.1: more bold 2018-09-04 20:29:34 +02:00
Eugene Syromyatnikov
e369424a58 count: add ability to select columnt being shown
* count.c (set_count_summary_columns): New function.
* defs.h (set_count_summary_columns): New declaration.
* strace.c (init) <-U>: Pass option argument to
set_count_summary_columns.
* strace.1.in (.SH OPTIONS): Document it.
2018-09-04 20:28:38 +02:00
Eugene Syromyatnikov
cd6e2d27f8 strace.1: more fixes 2018-09-04 19:54:09 +02:00
Eugene Syromyatnikov
90320f4ce4 fixup! strace.1.in: print names of entities in bold, provide man page sections 2018-09-04 19:53:51 +02:00
Eugene Syromyatnikov
3ef3477891 count: add ability to sort on avg_time and errors fields
For completeness.

* count.c (avg_time_cmp, error_cmp): New functions.
(set_sortby): Add sort keys for the new fields.
* strace.1.in (.SH OPTIONS) <-S>: Document it.
2018-09-04 19:48:11 +02:00
Eugene Syromyatnikov
f0865403a2 count: refactor statistics calculation/output
In preparation to extension.

* count.c (enum count_summary_columns): New enumeration type.
(struct call_counts): Add time_avg field.
(DEF_COLUMNS): New macro.
(columns, visible): New variables.
(num_chars): New function.
(call_summary_pers): Calculate aggregate data first, then output table
based on columns configuration.
* tests/count-f.expected: Update expected output.
* tests/strace-C.expected: Likewise.
* tests/strace-S.test: Likewise.
2018-09-04 19:18:48 +02:00
Eugene Syromyatnikov
69d148d233 strace.1.in: assorted updates 2018-09-04 16:56:54 +02:00
Eugene Syromyatnikov
059568a665 strace.1.in: print names of entities in bold, provide man page sections
* strace.1.in (.SH DESCRIPTION): add man page section numbber to open,
lstat, getpwuid, id mentions.
(.SH OPTIONS): make strace mentions bold.
(.SH NOTES): It was meant setrlimit(3), not setrlimit(2).
2018-09-04 16:45:04 +02:00
Eugene Syromyatnikov
71404212b8 dist/README: add some additional links
* dist/README: Mention README-hacking, add links to repositories and
mailing list arhcive.

Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
2018-09-04 16:32:25 +02:00
Eugene Syromyatnikov
86899822ba README.md: add link to new contributors guide.
* README.md: Add a link to the Guide of new contributors.

Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
2018-09-04 15:54:30 +02:00
Eugene Syromyatnikov
05ae538c90 mmap_cache: simplify API
* mmap_cache.h (mmap_cache_rebuild_if_invalid_): rename from
mmap_cache_rebuild_if_invalid.
(mmap_cache_rebuild_if_invalid): New macro, a wrapper for
mmap_cache_rebuild_if_invalid_ that supplies __func__ to it.
(mmap_cache_free_): New declaration.
(mmap_cache_free): New macro, a wrapper for mmap_cache_free_ that
supplies __func__ to it.
* mmap_cache.c (mmap_cache_rebuild_if_invalid_): Rename from
mmap_cache_rebuild_if_invalid.
(mmap_cache_free_): New function.
* unwind-libunwind.c (tcb_walk): Remove __func__ argument from the
mmap_cache_rebuild_if_invalid call.
* kvm.c (vcpu_get_info): Likewise.
* strace.c (droptcb): Call mmap_cache_free.
2018-09-04 15:41:47 +02:00
Eugene Syromyatnikov
3305550ccc syscall.c: unify error printing a bit
As of now, when -e raw is set, ERESTART* return code descriptions
are not printed (generic "-1 ERESTART_RESTARTBLOCK (Unknown error 516)"
is printed instead).

* syscall.c (err_desc): New function.
(print_err_ret): Print return code if it is not a ERESTART* error.
(syscall_exiting_trace): Use print_err_ret for normal error return
string printing.
2018-09-04 15:19:20 +02:00
Eugene Syromyatnikov
57a2b0fbdd syscall.c: avoid infinite loop in subcalls parsing
clang complains about it, so it might be a good reason to refactor it
into something more linear.

* syscall.c (syscall_entering_decode): put syscall subcall decoding
before ipc/socket subcall decoding, remove loop.
2018-09-04 14:48:13 +02:00
Eugene Syromyatnikov
f71663b233 count: rewrite sort function selection using a table.
And provide some alternative names for the sorting options, as some
might be easier to remember than others.

* count.c (set_sortby): Replace nested if's with iteration over a table;
add aliases for the existing sorting options.
* strace.1.in (.SH OPTIONS) <-S>: Document new aliases.
2018-09-04 13:27:29 +02:00
Eugene Syromyatnikov
2b70434e3e strace.spec: use xz instead of gzip
As the source tarball is in xz format already, there is high chance
that xz is already required for the build environment.

* strace.spec.in (BuildRequires): Replace gzip with xz.
(%build): Comparess change logs with xz.
(%files): s/gz/xz.
2018-09-04 01:50:29 +02:00
Eugene Syromyatnikov
0685a353bf syscall: track syscall system time a bit more explicitly
Before, it relied on implicit assumptions that syscall-exit event is
right the next one after syscall-enter.  Also, there's some additional
debugging output that may be might help someone someday.

* count.c (count_syscall): Calculate system time as difference of tcp's
stime and ltime.
* defs.h (struct tcb): Add ltime, atime fields, remove dtime.
* strace.c (droptcb): Print total system time spent by a tcb.
(startup_tcb): Store initial system time in atime.
(next_event): Update stime directly.
* syscall.c (syscall_entering_finish): Store current system time in
tcb's ltime field.
(syscall_exiting_finish): Likewise.
2018-09-03 04:57:13 +02:00
Eugene Syromyatnikov
beece1ab43 fixup! delay: use parse_ts for parsing delay value 2018-09-03 00:41:41 +02:00
Eugene Syromyatnikov
8b2355f55f count: fix types in sorting comparison callbacks
* count.c (time_cmp. syscall_cmp): Change arguments type
to "const void *", Change indices cast type to "unsigned int *".
(count cmp): Likewise. Change count variables type to unsigned int.
(sortfun): Provide types of arguments.
2018-09-02 23:05:27 +02:00
Eugene Syromyatnikov
d58f4c7ee8 fixup! util.c: add parse_ts 2018-09-02 22:20:03 +02:00
Eugene Syromyatnikov
e30f3c2558 count: substract overhead per call
* count.c (zero_ts): New variable.
(count_syscall): Calculate the spent time in the wts variable, then add
it to cc->time.
(call_summary_pers): Do not perform overhead correction.
2018-09-02 22:07:07 +02:00
Eugene Syromyatnikov
0a21612184 count: use parse_ts for parsing overhead value
* count.c (set_overhead): Change argument type to const char *, call
parse_ts to parse it and set to overhead.
* defs.h (set_overhead): Update declaration.
* strace.c: (init) <case 'O'>: do not parse argument, pass optarg to
set_overhead call.
* tests/count.test (GENERIC, WALLCLOCK, HALFCLOCK): New variables with
expected patterns.
Add checks for the new -O syntax.
2018-09-02 21:56:47 +02:00
Eugene Syromyatnikov
1a28b6dba2 delay: use parse_ts for parsing delay value
* delay.c (fill_delay_data): Change intval argument to struct timespec
*val, assign val to ts.
* delay.h (fill_delay_data): Update function declaration.
* filter_qualify.c (parse_delay_token): Parse input with parse_ts,
supply the resulting struct timespec to fill_delay_data.
* tests/delay.c (check_): New function for providing diagnostic in case
of check failure.
(check_delay): Use it.
* tests/delay.test: Check new delay syntax.
2018-09-02 21:28:41 +02:00
Eugene Syromyatnikov
32e987b87a util.c: add parse_ts
* defs.h (parse_ts): New declaration.
* util.c (parse_ts): New function.
2018-09-02 20:04:27 +02:00
Eugene Syromyatnikov
7c7705fbc9 util: add ts_min and ts_max
* defs.h (ts_min, ts_max): New declarations.
* util.c (ts_min, ts_max): New functions.
2018-09-02 20:03:27 +02:00
Eugene Syromyatnikov
f73d6361c1 fixup! sockaddr: decode AX.25 socket addresses 2018-09-02 18:16:22 +02:00
Eugene Syromyatnikov
53faa8304c macros: add ROUNDUP macro
* macros.h (ROUNDUP): New macro.
2018-09-02 18:16:22 +02:00
Eugene Syromyatnikov
11c4fc6d99 linux: add arch definition for unaligned access support
* linux/arch_defs_.h [HAVE_ARCH_UNALIGNED_ACCESS]
(HAVE_ARCH_UNALIGNED_ACCESS): New macro constant, defined to 1.
* linux/alpha/arch_defs_.h (HAVE_ARCH_UNALIGNED_ACCESS): New macro
constant, defined to 0.
* linux/arm/arch_defs_.h: Likewise.
* linux/powerpc/arch_defs_.h: Likewise.
* linux/powerpc64/arch_defs_.h: Likewise.
* linux/sparc/arch_defs_.h: Likewise.
2018-09-01 23:41:34 +02:00
Eugene Syromyatnikov
8b58aa17fb tests: check stack unwinding for signals
* tests/stack-fcall-3.c: Call etpid or kill depending on argument,
store getpid result.
* tests/stack-fcall.c: Call f0(0) and f0(1).
* tests/strace-k-demangle.expected: Updat eexpected output.
* tests/strace-k.expected: Likewise.
* tests/strace-k.test: Update matching code.
2018-09-01 00:14:26 +02:00
Eugene Syromyatnikov
861f9fd7d8 Add xlat description structure.
Rename struct xlat to struct xlat_data and make struct  xlat an xlat descriptor
that contains various information about xlat. So far, it's type and number
of items.

As a result, xlookup/printxval now have enought information for handling
xlat depending on its type, so no *index/*_search APIs are needed.

* xlat.h (struct xlat_data): Rename from struct xlat.
(struct xlat): New type definition.
* xlat.c (xlat_search, printxval_sized, printxval_searchn_ex, xlat_idx,
printxval_indexn_ex, printxval_dispatch_ex, ): Remove.
(xlookup): Handle xlat_data based on xlat type.
(xlookup_le): New function, replaces xlat_search_eq_or_less and supports
all xlat types.
(sprintflags_ex, printflags_ex): Update.
* xlat/gen.sh (gen_header): Add handling for #sorted, generate new
struct xlat descriptor.
* defs.h (arp_hardware_types_size, ethernet_protocols_size,
inet_protocols_size, evdev_abs_size, xlat_search,
xlat_search_eq_or_less, xlat_idx, printxval_searchn_ex,
printxval_searchn, printxval_search, printxval_search_ex,
printxval_indexn_ex, printxval_indexn, printxval_index,
printxval_index_ex, printxval_dispatch_ex, printxval_dispatch): Remove.
(enum xlat_style_private_flag_bits): Remove PAF_INDEX_XLAT_SORTED_BIT
and PAF_INDEX_XLAT_VALUE_INDEXED_BIT.
(enum xlat_style_private_flag): Remove PAF_INDEX_XLAT_SORTED and
PAF_INDEX_XLAT_VALUE_INDEXED.
(print_array_ex): Remove index_xlat_size argument.
(xlookup_le): New declaration.
(printxval_ex): New macro.
* dyxlat.c (struct dyxlat): Remove used field (use xlat.size instead),
embed struct xlat, add pointer to struct xlat_data.
(MARK_END): Remove.
(dyxlat_alloc, dyxlat_free, dyxlat_get, dyxlat_add_pair): Update in
accordance with the structure changes.
* evdev.c (evdev_abs_size): Remove.
(keycode_ioctl): Use printxval instead of printxval_index.
(decode_bitset): Remove.
(decode_bitset_): Rename to decode_bitset, remove decode_nr_size and xt
arguments, call printxval instead of printxval_dispatch.
(bit_ioctl, evdev_read_ioctl): Do not pass xlat type to decode_bitset.
* print_fields.h (PRINT_FIELD_XVAL_SORTED_SIZED,
PRINT_FIELD_XVAL_INDEX): Remove.
* nlattr.h (struct decode_nla_xlat_opts): Remove xlat_size and xt
fields.
* nlattr.c (decode_nla_meminfo): do not pass
PAF_INDEX_XLAT_VALUE_INDEXED flag and netlink_sk_meminfo_indices size
in a print_array_ex call.
(decode_nla_xval): Call printxval_ex instead of printxval_dispatch_ex.
(decode_nla_ether_proto, decode_nla_ip_proto): Do not pass xlat_size and
xt fields in opts.
(decode_nla_flags): Remove XT_INDEXED unsupported warning.
* process.c (struct_user_offsets_data): Rename from
struct_user_offsets, change type to struct xlat_data[], remove XLAT_END.
(struct_user_offsets): New xlat description.
(print_user_offset_addr): Rewrite using xlookup_le.
* util.c (print_array_ex): Remove index_xlat_size argument, simply call
printxval_ex for index printing.
* aio.c (tprint_lio_opcode): Use printxval_ex instead of
printxval_indexn_ex.
* bpf.c: Use printxval instead of printxval_index; use PRINT_FIELD_XVAL
instead of PRINT_FIELD_XVAL_INDEX.
* bpf_filter.c (print_bpf_filter_code): Use printxval instead of
printxval_index.
* ioctl.c (evdev_decode_number): Use printxval instead of
printxval_indexn.
* kvm.c (kvm_ioctl_decode_check_extension): Use printxval instead of
printxval_index.
(kvm_ioctl_run_attach_auxstr): Use xlookup instead of xlat_idx.
* net.c: Use printxval instead of printxval_search/printxval_index, use
printxval_ex instead of printxval_searchn_ex.
* netlink_packet_diag.c (decode_packet_diag_msg): Use PRINT_FIELD_XVAL
instead of PRINT_FIELD_XVAL_SORTED_SIZED.
* netlink_smc_diag.c (decode_smc_diag_shutdown): Remove ARRSZ_PAIR
wrapper.
(decode_smc_diag_fallback): Use printxval_ex instead of
printxval_search_ex.
(decode_smc_diag_msg): Use PRINT_FIELD_XVAL instead of
PRINT_FIELD_XVAL_INDEX.
* print_statfs.c (print_statfs_type): Use printxval instead of
printxval_search.
* rtnl_cachereport.c (decode_nla_ipmra_msg_type,
decode_nla_ip6mra_msg_type): Remove ARRSZ_PAIR wrappers, xt fields.
* rtnl_link.c (decode_ifla_inet6_flags, decode_ifla_inet6_agm):
Likewise.
(decode_nla_tun_type, decode_ifla_xdp_attached): Remove xlat_size,
xt fields.
(decode_ifla_inet_conf, decode_ifla_inet6_conf, decode_ifla_inet6_stats,
decode_ifla_inet6_icmp6_stats): Remove PAF_INDEX_XLAT_VALUE_INDEXED flag
and ARRSZ_PAIR wrapper in print_array_ex calls.
(decode_ifinfomsg): Use PRINT_FIELD_XVAL instead of
PRINT_FIELD_XVAL_SORTED_SIZED.
* rtnl_route.c (decode_nla_rt_proto): Use printxval instead of
printxval_search.
* sock.c (print_ifreq): Use PRINT_FIELD_XVAL instead of
PRINT_FIELD_XVAL_SORTED_SIZED.
* sockaddr.c (print_sockaddr_data_ll, print_sockaddr_data_bt,
print_sockaddr): Use printxval instead of printxval_search and
printxval_index.
* time.c (getitimer, osf_getitimer, setitimer, printclockname): Use
printxval instead of printxval_index.
(do_adjtimex): Use xlookup instead of xlat_idx.
* v4l2.c (print_v4l2_cid): Use xlookup instead of xlat_search.
(print_v4l2_cid): Use xlookup_le instead of xlat_search_eq_or_less.
* tests/btrfs.c: Update xlat handling, use struct xlat_data instead of
struct xlat for XLAT() arrays.
* tests/ioctl_block.c: Likewise.
* tests/ioctl_rtc.c: Likewise.
* tests/printflags.c: Likewise.
* tests/printxval.c: Likewise.
* tests/prlimit64.c: Likewise.
* tests/setrlimit.c: Likewise.
* tests/socketcall.c: Likewise.
* tests/xgetrlimit.c: Likewise.
* tests/xstatfsx.c: Likewise.
* xlat/af_packet_versions.in: Add #value_indexed.
* xlat/arp_hardware_types.in: Add #sorted.
* xlat/ax25_protocols.in: Likewise.
* xlat/bluetooth_l2_cid.in: Likewise.
* xlat/bluetooth_l2_psm.in: Likewise.
* xlat/ethernet_protocols.in: Likewise.
* xlat/evdev_ff_types.in: Likewise.
* xlat/fsmagic.in: Likewise.
* xlat/hw_breakpoint_type.in: Likewise.
* xlat/iffflags.in: Likewise.
* xlat/inet6_if_flags.in: Likewise.
* xlat/inet_protocols.in: Likewise.
* xlat/msgctl_flags.in: Likewise.
* xlat/perf_hw_cache_id.in: Likewise.
* xlat/perf_hw_cache_op_id.in: Likewise.
* xlat/perf_hw_cache_op_result_id.in: Likewise.
* xlat/perf_hw_id.in: Likewise.
* xlat/perf_sw_ids.in: Likewise.
* xlat/perf_type_id.in: Likewise.
* xlat/routing_protocols.in: Likewise.
* xlat/semctl_flags.in: Likewise.
* xlat/shmctl_flags.in: Likewise.
* xlat/smc_decl_codes.in: Likewise.
* xlat/sock_ax25_options.in: Likewise.
* xlat/sock_bluetooth_options.in: Likewise.
* xlat/sock_dccp_options.in: Likewise.
* xlat/sock_tipc_options.in: Likewise.
* xlat/socketlayers.in: Likewise.
* xlat/v4l2_control_classes.in: Likewise.
* xlat/v4l2_pix_fmts.in: Likewise.
* xlat/v4l2_sdr_fmts.in: Likewise.
2018-08-31 23:05:03 +02:00
Eugene Syromyatnikov
dea7b2d055 xlat: provide fallback definitions for open_access_modes constants
* xlat/open_access_modes.in: Add fallback values.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
b3766e3e01 process: honor xlat style in print_user_offset_addr
* process.c (print_user_offset_addr): Print in accordance with xlat
verbosity setting.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
6ee33f6452 time: add xlat styles support to printclockname
* time.c (printclockname): Respectl xlat_verbosity.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
e8f456d4e1 open: implement sprint_open_modes using sprintflags_ex
* defs.h (sprintflags_ex): Add "sep" argument.
(sprintflags): Pass '\0' in "sep" argument.
* open.c (sprint_open_modes): Use sprintflags_ex for printing
open_mode_flags.
* xlat.c (sprintflags_ex): Add "sep" argument, use it as initial
separator (if not nul).
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
15090ba907 rtnl_link.c: decode hardware addresses
* rtnl_link.c (decode_nla_hwaddr): New function.
(ifinfomsg_nla_decoders) <IFLA_ADDRESS, IFLA_BROADCAST>: Use
decode_nla_hwaddr.
* decode_ifinfomsg: Pass ifinfo as opaque data.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
aaab15665e perf: rewrite print_perf_event_attr using PRINT_FIELD_* macros
* perf.c: Include "print_fields.h".
(print_perf_event_attr): Use PRINT_FIELD_* macros.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
398c49b48a Generalise hardware address printing
* defs.h [!MAX_ADDR_LEN] (MAX_ADDR_LEN): New macro.
(sprint_hwaddr): New declaration.
(print_hwaddr): New inline function, a wrapper for sprint_hwaddr.
* print_fields.h (PRINT_FIELD_HWADDR_SZ): New macro.
* print_mac.c: Include "xlat/arp_hardware_types.h" under
XLAT_MACROS_ONLY.
[!MAX_ADDR_LEN] (MAX_ADDR_LEN): Remove.
(sprint_hwaddr): New function.
* sock.c (print_ifreq) <SIOCSIFHWADDR, SIOCGIFHWADDR>: Print hardware
address using PRINT_FIELD_HWADDR_SZ.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
2e9d851346 netlink: avoid parsing data that has been just retrieved
get_fd_nl_family did a weird thing: it parsed netlink socket address in
order to get netlink proto, but the address itself is constructed based
on the netlink proto number in the first place. Avoid doing so by
stashing information about netlink protocol right after nul byte of the
sockaddress and providing it on request.

* socketutils.c (cache_entry): Add has_data field.
(cache_inode_details): Add data argument, store it in has_data field.
(get_sockdata_by_inode_cached): New function.
(inet_parse_response, unix_parse_response, packet_parse_response):
Pass false in data argument of cache_inode_details call.
(netlink_parse_response): Append ndiag_protocol value to details string,
pass true to cache_inode_details call.
(unix_get, inet_get, packet_get): Add data argument, return NULL
if called with data == true.
(netlink_get): Add data argument, call get_sockdata_by_inode_cached
instead of get_sockaddr_by_inode_cached if called with data == true.
(protocols): Add data arguments to the type definition of the get field.
(get_sockaddr_by_inode_uncached): Add data argument, pass
it to protocols->get.
(print_sockaddr_by_inode_uncached): Call get_sockaddr_by_inode_uncached
with data == false.
(get_sockaddr_by_inode): Call get_sockaddr_by_inode_uncached with
data == false;
(get_sockdata_by_inode): New function.
* defs.h (get_sockdata_by_inode): New declaration.
* netlink.c (get_fd_nl_family): Use get_sockdata_by_inode.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
653abe7a9d xlat: update resources
* xlat/resources.in: declare as #value indexed. Provide fallback values.
(RLIMIT_VMEM): Remove.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
b821526643 futex: recoginise FUTEX_BITSET_MATCH_ANY bitmask
* xlat/futexbitset.in: New file.
* futex.c: Include "xlat/futexbitset.h".
(futex) <FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET>: Decode val3 using
futexbitset xlat.
* tests/futex.c: Add checks for 0xffffffff bitset mask printing.

Closes: Linux commit v4.16-rc1~166^2^2~2
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
a010a633cd Print stack traces on signals
I don't know why it hasn't been done earlier.

* strace.c [ENABLE_STACKTRACE] (print_stopped): Call unwind_tcb_print
if stack trace printing is enabled.
2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
3960fea7f1 [wip] NFNL_SUBSYS_CTNETLINK subsystem decoding support 2018-08-31 21:11:42 +02:00
Eugene Syromyatnikov
8de3d10e71 nlattr: ignore nla_type flags when selecting nlattre decoder
* nlattr.c (decode_nlattr_with_data): Apply NLA_TYPE_MASK to nla_type
before decoder selection.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
13263abd4f aio: assorted iocb decoder updates
* xlat/aio_iocb_flags.in: New file.
* defs.h (pollflags, rwf_flags): New declarations.
* configure.ac: Check for the presence of aio_rw_flags field of the
struct iocb.
* aio.c: Include "xlat/aio_iocb_flags.h".
(AIO_RW_FLAGS_FIELD): New macro definition, defined based on the
presence of HAVE_STRUCT_IOCB_AIO_RW_FLAGS macro.
(iocb_sub): Add SUB_POLL.
(tprint_lio_opcode): Change IOCB_CMD_POLL subtype to SUB_POLL.
[!IOCB_FLAG_RESFD] (print_common_flags): Remove IOCB_FLAG_RESFD presence
check, as it is now provided via xlat.
(print_common_flags): Print aio_flags using aio_iocb_flags xlat.
(print_iocb_header): Always print aio_data. Print aio_rw_flags if it is
non-zero. Print aio_reqprio based on the presence of IOCB_FLAG_IOPRIO
flag in aio_flags (us print_ioprio if it set and print as a signed
integer otherwise).
(print_iocb): Decode SUB_POLL subtype.
* tests/aio.c: Update expected output.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
ef560cb5d7 ioprio: add print_ioprio function
That respects xlat style settings.

* ioprio.c (print_ioprio): New function.
* defs.h (print_ioprio): New declaration.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
ea3b724cf0 netlink_packet_diag: assorted decoding fixes
* xlat/af_packet_versions.in: New file.
* netlink_packet_diag.c: Include "xlat/af_packet_versions.h".
(decode_packet_diag_req): sdiag_protocol shouldn't be decoded as a protocol,
it's currently should be set to 0.
(decode_packet_diag_info): Decode pdi_version field using af_packet_versions
xlat; decode pdi_index field as an interface index.
(packet_diag_msg_nla_decoders) <PACKET_DIAG_UID>: Decode using
decode_nla_uid.
(decode_packet_diag_msg): Decode pdiag_num as an low-level protocol.
* tests/netlink_sock_diag.c: Update expected output.
* tests/nlattr_packet_diag_msg.c: Likewise.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
d961fb6936 ioprio: move constant definitions to xlat
* xlat/ioprio_class.in: Add fallback values.
* xlat/ioprio_who.in: Likewise.
* ioprio.c: Remove IOPRIO_WHO_* and IOPRIO_CLASS_* enums.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
e901b0cd05 xlat: provide fallback definitions for epollevents
* xlat/epollevents.in: Provide fallback definitions, add EPOLLNVAL
constant (introduced by Linux commit v4.16-rc1~3^2~3).
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
6d4d8e4241 xlat: provide fallback definitions to pollflags
* xlat/pollflags.in: Add fallback definitions for POLLWRNORM,
POLLWRBAND, POLLMSG, POLLREMOVE, and POLLRDHUP.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
fa5d35f8f3 socketutils: provide socket information for AF_PACKET sockets
* socketutils.c: Include <linux/packet_diag.h>,
"xlat/ethernet_protocols.h", "xlat/socktypes.h".
(struct packet_cb_data): New type definition.
(packet_send_query, packet_parse_response, packet_get): New function.
(protocols) <SOCK_PROTO_PACKET>: Use packet_get for obtaining socket
information.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
9964dc7dc4 net: decode AF_PACKET protocols in socket syscall
* net.c (SYS_FUNC(socket)) <AF_PACKET>: Decode using ethernet_protocols
xlat.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
849d1ea8ac print_ifindex: add public get_ifname method
In order to be able to obtain sanitised device name internally.

* defs.h (geT_ifname): New declaration.
* print_ifindex.c (get_ifname): Refactor, leaving out addition of
if_nametoindex("") part.
(sprint_ifname): New function, adds if_nametoindex("") to
get_ifname's output.
(print_ifindex): Use sprint_ifname instead of get_ifname.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
d573499dfc xlat: provide fallback values for socktypes
* xlat/socktypes.in: Provide fallback values.
2018-08-31 19:33:29 +02:00
Eugene Syromyatnikov
7f232e50af sock: decode SIOCADDRT and SIOCDELRT commands
Those are a bit tricky, as their arguments depends on socket's address
family. So far, it's implemented for AF_INET, AF_AX25, AF_APPLETALK,
AF_NETROM, AF_X25, AF_INET6, AF_ROSE, and AF_PACKET.

* xlat/inet6_route_metrics.in: New file.
* xlat/inet6_router_pref.in: Likewise.
* xlat/netrom_route_types.in: Likewise.
* xlat/route_flags.in: Likewise.
* defs.h (route_nexthop_flags): New xlat declaration.
(sock_proto): Add SOCK_PROTO_AX25, SOCK_PROTO_DDP, SOCK_PROTO_NETROM,
SOCK_PROTO_PACKET, SOCK_PROTO_ROSE, SOCK_PROTO_X25.
* print_fields.h (PRINT_FIELD_INET6_ADDR): New macro.
* sock.c: Include <linux/ax25.h>, <linux/in_route.h>,
<linux/ipv6_route.h>, <linux/netrom.h>, <linux/rose.h>, <linux/route.h>,
<linux/x25.h>, "xlat/inet6_route_metrics.h", "xlat/inet6_router_pref.h",
"xlat/netrom_route_types.h", "xlat/route_flags.h",
"xlat/route_flags_inet6.h", "xlat/route_nexthop_flags.h",
"xlat/routing_types.h".
(decode_rtentry, print_digipeaters, decode_ax25_routes_struct,
decode_nr_route_struct, decode_x25_route_struct, print_inet6_route_pref,
decode_in6_rtmsg, decode_rose_route_struct): New function.
(sock_ioctl): Handle SIOCADDRT and SIOCDELRT.
* socketutils.c (protocols): Add address family information for
SOCK_PROTO_AX25, SOCK_PROTO_DDP, SOCK_PROTO_NETROM, SOCK_PROTO_PACKET,
SOCK_PROTO_ROSE, and SOCK_PROTO_X25.

Co-Authored-by; Olga Feiermann <charmik@users.sourceforge.net>
Closes: https://github.com/strace/strace/issues/41
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
43d076b53d socketutils: introduce get_family_by_proto.
Add a helper function that provides address family based on the internal
notion of the socket protocol (using protocols table).

* defs.h (get_family_by_proto): New declaration.
* socketutils.c (get_family_by_proto): New function.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
c15ae06098 socketutils: add more IP/IPv6 transport protocols
* defs.h (ock_proto: Add SOCK_PROTO_UDPLITE, SOCK_PROTO_DCCP,
SOCK_PROTO_SCTP, SOCK_PROTO_L2TP_IP, SOCK_PROTO_PING, SOCK_PROTO_RAW,
SOCK_PROTO_UDPLITEv6, SOCK_PROTO_DCCPv6, SOCK_PROTO_L2TP_IPv6,
SOCK_PROTO_SCTPv6, SOCK_PROTO_PINGv6, SOCK_PROTO_RAWv6.
* socketutils.c: Include "xlat/inet_protocols.h".
(protocols): Add protocol descriptions for them.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
977d5aed13 socketutils: store more information in protocols table
This also allows getting rid of all these *_v[46]_get calls.

* socketutils.c (unix_get, inet_get, netlink_gen): Add family, protocol,
proto_name paramteres, use them where appropriate.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Remove.
(protocols): Add family and proto fields to the structure, call inet_get
for IP/IPv6 protocols.
(get_sockaddr_by_inode_uncached): Update protocols->get calls.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
5a22df3304 sockaddr: decode ROSE socket addresses
* defs.h (print_rose_addr): New declaration.
* print_fields.h (PRINT_FIELD_ROSE_ADDR): New macro.
* sockaddr.c (print_rose_addr, print_sockaddr_data_rose): New function.
(sa_printers) <[AF_ROSE]>: New printer.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
624d03085c xlat: provide fallback values to route_nexthop_flags
* xlat/route_nexthop_flags.in: Add fallback values.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
98bfc2f997 sockaddr: add X.25 socket address decoding support
* sockaddr.c: Include <linux/x25.h>.
(print_sockaddr_data_x25): New function.
(sa_printers) <[AF_X25]>: New socket address handler.
* tests/net-sockaddr.c (check_x25): New function.
(main): Call check_x25 in order to check X.25 socket address decoding.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
fc9b2b76e3 net: add support for AX.25 protocols and socket option names decoding
* xlat/ax25_protocols.in: New file.
* xlat/sock_ax25_options.in: Likewise.
* net.c: Include "xlat/ax25_protocols.h", "xlat/sock_ax25_options.h".
* (SYS_FUNC(socket)): <[AF_AX25]>: Print protocol name using
ax25_protocols xlat.
(print_sockopt_fd_level_name) <[SOL_AX25]>: Print socket option name
using sock_ax25_options xlat.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
f12b03a7c5 sockaddr.c: whitespace cleanup, typo
* sockaddr.c (print_sockaddr_data_bt): Fix typo, remove excess
indentation from the switch statement.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
4d575e0243 sockaddr: decode AX.25 socket addresses
* sockaddr.c: Include <linux/ax25.h>
(check_ax25_address, ax25_addr2str, print_ax25_addr_raw,
print_ax25_addr, print_sockaddr_data_ax25): New function.
(sa_printers) <[AF_AX25]>: New printer.
* tests/net-sockaddr.c (AX25_ADDR): New macro.
(check_ax25): New function.
(main): Call check_ax25 in order to check AX.25 socket address decoding.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
6fa6d63bd1 tests: add utimensat test variants with different xlat verbosity levels
* tests/utimensat-Xabbrev.c: New file.
* tests/utimensat-Xraw.c: Likewise.
* tests/utimensat-Xverbose.c: Likewise.
* tests/utimensat.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/pure_executables.list: Add utimensat-Xabbrev, utimensat-Xraw,
and utimensat-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (utimensat-Xabbrev, utimensat-Xraw, utimensat-Xverbose): New
tests.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
cba303088d print_timespec: make print_timespec_t_utime respect xlat style setting
* print_timespec.c (print_timespec_t_utime): Print raw timespec value
in accordance with xlat style setting.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
ff4b53baa8 netlink: honor custom xlat style setting during nlmsg flags printing
Commit v4.23~343 introduced xlat style argument to printflags_ex, but
XLAT_STYLE_DEFAULT was introduced only in the next commit v4.23~342,
which led to missing out fixing the sole external user of this
peculiar extended interface.

* netlink.c (decode_nlmsg_flags): Use XLAT_STYLE_DEFAULT instead of
XLAT_STYLE_ABBREV in printflags_ex call.

Fixes: v4.23~342 "Introduce XLAT_STYLE_DEFAULT"
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
741b34b3d1 netlink_netfilter: use xlat styles for res_id workaround printing
* netlink_netfilter.c (decode_netlink_netfilter): Call print_xlat_ex
in order to respect xlat style setting.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
da228c39ad ubi: decode flags field of struct ubi_mkvol_req
Introduced by Linux commit v4.19-rc1~13^2~6.

* configure.ac (AC_CHECK_MEMBERS): Add check for struct
ubi_mkvol_req.flags field.
* ubi.c: Include "xlat/ubi_mkvol_req_flags.h".
(UBI_MKVOL_REQ_FLAGS_FIELD): New macro definition.
(ubi_ioctl): Decode the flags field of struct ubi_mkvol_req.
* xlat/ubi_mkvol_req_flags.in: New file.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
044c1560f2 block: move fallback definitions for ioctl commands to xlat
* xlat/block_ioctl_cmds.in: New file.
* block.c: Include "xlat/block_ioctl_cmds.h".
(BLKPG, BLKTRACESETUP, BLKTRACESTART, BLKTRACESTOP, BLKTRACETEARDOWN,
BLKDISCARD, BLKIOMIN, BLKIOOPT, BLKALIGNOFF, BLKPBSZGET,
BLKDISCARDZEROES, BLKSECDISCARD, BLKROTATIONAL, BLKZEROOUT): Remove
fallback definitions as those are porvided by block_ioctl_cmds xlat now.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
7e632b44d2 Remove BLKGETSIZE64 configure check, decode it unconditionally
It is available on all supported kernel versions.

* configure.ac: Remove BLKGETSIZE64 check.
* block.c (block_ioctl): Remove #ifdef HAVE_BLKGETSIZE64.
2018-08-31 19:33:28 +02:00
Eugene Syromyatnikov
02ad183786 netlink_netfilter: decode netfilter netlink attribute names
* xlat/nf_acct_attr_names.in: New file.
* xlat/nf_cthelper_attr_names.in: Likewise.
* xlat/nf_ctnetlink_attr_names.in: Likewise.
* xlat/nf_ctnetlink_exp_attr_names.in: Likewise.
* xlat/nf_ctnetlink_to_attr_names.in: Likewise.
* xlat/nf_ipset_attr_names.in: Likewise.
* xlat/nf_nft_compat_attr_names.in: Likewise.
* xlat/nf_nftables_msg_types.in: Likewise.
* xlat/nf_osf_attr_names.in: Likewise.
* xlat/nf_queue_attr_names.in: Likewise.
* xlat/nf_ulog_attr_names.in: Likewise.
* xlat/nft_chain_attr_names.in: Likewise.
* xlat/nft_flow_attr_names.in: Likewise.
* xlat/nft_gen_attr_names.in: Likewise.
* xlat/nft_obj_attr_names.in: Likewise.
* xlat/nft_rule_attr_names.in: Likewise.
* xlat/nft_set_attr_names.in: Likewise.
* xlat/nft_setelem_attr_names.in: Likewise.
* xlat/nft_table_attr_names.in: Likewise.
* xlat/nft_trace_attr_names.in: Likewise.
* netlink_netfilter.c (struct nfnl_decoder): New type definition.
(nft_subsystem_decoders, nfnl_subsystems): New static constants.
(decode_netlink_netfilter): Select xlat for attribute names based
on message subsystem.
* tests/netlink_netfilter.c: Update expected output.
2018-08-31 19:33:24 +02:00
Eugene Syromyatnikov
4087e34e87 strace.spec.in: fix for old distros that do not support xz 2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
c31ced973c tests/init.sh: check for successful run under strace in run_prog
In some environments it's possible that syscalls behave differently when
the process is being ptrace'd.

* tests/init.sh (run_prog): Move down, rewrite using try_run_prog, add
a check for successful execution of the program under strace in the
"medicinal mode" (-qq -enone -esignal=none -o /dev/null).
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
0484e396f2 v4l2: improve control ID printing
Control ID space is hierarchical, so, higher bits provide information
about control class.

* v4l2.c (print_v4l2_cid): New function.
(print_v4l2_control): Use print_v4l2_cid for printing control ID field.
* tests/ioctl_v4l2.c: Add checks for control ID printing.
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
871c1af6c3 xlat: introduce xlat_search_eq_or_less
For the cases when it is preferable to print something like
"BASE_VAL+increment".

* defs.h (xlat_search_eq_or_less): New declaration.
* xlat.c (xlat_search_eq_or_less): New function.
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
39a77ad205 xlat: add ability to provide default string to print_xlat_ex
In order to avoid dealing with xlat verbosity styles outside xlat code
as much as possible.

* defs.h (xlat_style_private_flag_bits): Rename from
print_array_flag_bits, add PXF_DEFAULT_STR_BIT.
(xlat_style_private_flags): Rename from print_array_flags, add
FLAG_(PXF_DEFAULT_STR).
* xlat.c (print_xlat_ex): Handle PXF_DEFAULT_STR by interpreting str
as a default value (print both value and str in XLAT_STYLE_ABBREV).
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
9f25e7a911 xlat/gen.sh: generate <name>_size variable for xlats in mpers
Otherwise they are nearly unusable.

* xlat/gen.sh (gen_header): Add ${name}_size declaration and definition
if in_mpers is set.
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
f676bc701d netlink_route: implement RTM_{NEW,DEL,GET}CHAIN commands
* xlat/nl_route_types.in (RTM_NEWCHAIN, RTM_DELCHAIN, RTM_GETCHAIN): New
constant, introduced by Linux commit v4.19-rc1~140^2~279^2~9.
* netlink_route.c (route_decoders) <[RTM_NEWCHAIN - RTM_BASE],
[RTM_DELCHAIN - RTM_BASE], [RTM_GETCHAIN - RTM_BASE]>: New decoder,
calls decode_tcmsg.
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
e6c00226f4 netlink_route: implement RTM_NEWCACHEREPORT message decoding
* xlat/rtnl_family.in: New file.
* xlat/rtnl_ip6mra_creport_attr.in: Likewise.
* xlat/rtnl_ip6mra_msg_types.in: Likewise.
* xlat/rtnl_ipmra_creport_attr.in: Likewise.
* xlat/rtnl_ipmra_msg_types.in: Likewise.
* rtnl_cachereport.c: Likewise.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.c (route_decoders) <[RTM_NEWCACHEREPORT - RTM_BASE]>:
New decoder, call decode_cachereport.
* netlink_route.h (decode_cachereport): New declaration.
* xlat/nl_route_types.in (RTM_NEWCACHEREPORT): New constant, introduced
by Linux commit v4.13-rc1~157^2~129^2~3.
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
0ab4f638cd nlattr: provide common AF_INET{,6} address decoders
* nlattr.c (decode_nla_in_addr, decode_nla_in6_addr): New function.
* nlattr.h (DECL_NLA(in_addr), DECL_NLA(in6_addr)): New declaration.
* rtnl_link.c (decode_ifla_inet6_token): Remove.
(ifla_inet6_nla_decoders) <[IFLA_INET6_TOKEN]>: Use decode_nla_in6_addr.
2018-08-28 13:44:50 +02:00
Eugene Syromyatnikov
d5f960204c netlink_route: implement RTM_NEWSTATS, RTM_GETSTATS message decoding
* xlat/ifstats_attr.in: New file.
* xlat/ifstats_attr_mask.in: Likewise.
* xlat/ifstats_offload_attr.in: Likewise.
* xlat/ifstats_xstats_type_attr.in: Likewise.
* xlat/nl_bridge_vlan_flags.in: Likewise.
* rtnl_stats.c: Likewise.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac: Add struct if_stats_msg type check.
* netlink_route.c (route_decoders) <[RTM_NEWSTATS - RTM_BASE],
[RTM_GETSTATS - RTM_BASE]>: New decoder, call decode_ifstatsmsg.
* netlink_route.h (decode_ifstatsmsg): New declaration.
* nlattr.h (DECL_NLA(ifla_af_spec), DECL_NLA(rtnl_link_stats64)): New
declaration.
* rtnl_link.c (decode_nla_rtnl_link_stats64): Rename from
decode_rtnl_link_stats64.
(decode_nla_ifla_af_spec): Rename from decode_ifla_af_spec.
(ifinfomsg_nla_decoders) <[IFLA_STATS64], [IFLA_AF_SPEC]>: Use new
decoder function names.
2018-08-28 13:44:50 +02:00
387 changed files with 9884 additions and 3387 deletions

View File

@ -61,8 +61,9 @@ AM_CPPFLAGS_FOR_BUILD = $(AM_CPPFLAGS)
include xlat/Makemodule.am
strace_CPPFLAGS = $(AM_CPPFLAGS)
strace_CFLAGS = $(AM_CFLAGS)
strace_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_DEFS_H
strace_CFLAGS = $(AM_CFLAGS) -DMPERS_WORDSIZE=PERSONALITY0_WORDSIZE \
-DMPERS_KLONGSIZE=PERSONALITY0_KLONGSIZE
strace_LDFLAGS =
strace_LDADD = libstrace.a $(clock_LIBS) $(timer_LIBS)
noinst_LIBRARIES = libstrace.a
@ -264,6 +265,7 @@ strace_SOURCES = \
process.c \
process_vm.c \
ptp.c \
ptp_clock.h \
ptrace.h \
quota.c \
readahead.c \
@ -280,6 +282,7 @@ strace_SOURCES = \
rtc.c \
rtnl_addr.c \
rtnl_addrlabel.c \
rtnl_cachereport.c \
rtnl_dcb.c \
rtnl_link.c \
rtnl_mdb.c \
@ -289,6 +292,7 @@ strace_SOURCES = \
rtnl_nsid.c \
rtnl_route.c \
rtnl_rule.c \
rtnl_stats.c \
rtnl_tc.c \
rtnl_tc_action.c \
s390.c \
@ -326,6 +330,7 @@ strace_SOURCES = \
sysent.h \
sysent_shorthand_defs.h \
sysent_shorthand_undefs.h \
sysfs.c \
sysinfo.c \
syslog.c \
sysmips.c \
@ -348,6 +353,7 @@ strace_SOURCES = \
utimes.c \
v4l2.c \
wait.c \
wait.h \
xattr.c \
xfs_quota_stat.h \
xlat.c \
@ -358,7 +364,10 @@ strace_SOURCES = \
$(strace_SOURCES_check) \
# end of strace_SOURCES
strace_SOURCES_check = bpf_attr_check.c
strace_SOURCES_check = \
bpf_attr_check.c \
ptp_clock_check.c \
# end of strace_SOURCES_check
if ENABLE_STACKTRACE
strace_SOURCES += unwind.c unwind.h
@ -417,6 +426,7 @@ EXTRA_DIST = \
debian/strace64.manpages \
debian/watch \
gen_bpf_attr_check.sh \
gen_ptp_clock_check.sh \
generate_sen.sh \
ioctl_iocdef.c \
ioctlsort.c \
@ -578,6 +588,7 @@ EXTRA_DIST = \
linux/ia64/rt_sigframe.h \
linux/ia64/set_error.c \
linux/ia64/set_scno.c \
linux/ia64/shuffle_scno.c \
linux/ia64/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
@ -960,6 +971,9 @@ $(srcdir)/.version:
bpf_attr_check.c: $(srcdir)/bpf_attr.h $(srcdir)/gen_bpf_attr_check.sh
$(srcdir)/gen_bpf_attr_check.sh $< > $@-t && mv $@-t $@
ptp_clock_check.c: $(srcdir)/ptp_clock.h $(srcdir)/gen_ptp_clock_check.sh
$(srcdir)/gen_ptp_clock_check.sh $< > $@-t && mv $@-t $@
strace_SOURCES_c = \
$(filter %.c,$(strace_SOURCES)) $(filter %.c,$(libstrace_a_SOURCES))
@ -1039,11 +1053,11 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioc
BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
bpf_attr_check.c native_printer_decls.h native_printer_defs.h \
printers.h sen.h sys_func.h .version
printers.h ptp_clock_check.c sen.h sys_func.h .version
CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
ioctl_iocdef.h ioctl_iocdef.i \
bpf_attr_check.c native_printer_decls.h native_printer_defs.h \
printers.h sen.h sys_func.h
printers.h ptp_clock_check.c sen.h sys_func.h
DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h linux/linux/signal.h
include scno.am
@ -1073,7 +1087,7 @@ mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
CFLAGS="$(mpers_sh_opts) -DMPERS_IS_$(mpers_NAME)" \
CPP="$(CPP)" \
CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \
$(srcdir)/mpers.sh $(mpers_NAME) $(mpers_CC_FLAGS) $$f || exit; \
$(srcdir)/mpers.sh "$(mpers_NAME)" "$(mpers_CC_FLAGS)" "$$f" || exit; \
done
> $@
@ -1144,7 +1158,9 @@ BUILT_SOURCES += $(mpers_m32_targets)
CLEANFILES += $(mpers_m32_targets)
$(mpers_m32_targets): mpers_NAME = m32
$(mpers_m32_targets): mpers_CC_FLAGS = @cc_flags_m32@
$(mpers_m32_targets): mpers_CC_FLAGS = @cc_flags_m32@ \
-DMPERS_WORDSIZE=PERSONALITY1_WORDSIZE \
-DMPERS_KLONGSIZE=PERSONALITY1_KLONGSIZE
endif # HAVE_M32_MPERS
@ -1161,7 +1177,9 @@ BUILT_SOURCES += $(mpers_mx32_targets)
CLEANFILES += $(mpers_mx32_targets)
$(mpers_mx32_targets): mpers_NAME = mx32
$(mpers_mx32_targets): mpers_CC_FLAGS = @cc_flags_mx32@
$(mpers_mx32_targets): mpers_CC_FLAGS = @cc_flags_mx32@ \
-DMPERS_WORDSIZE=PERSONALITY2_WORDSIZE \
-DMPERS_KLONGSIZE=PERSONALITY2_KLONGSIZE
endif # HAVE_MX32_MPERS

View File

@ -9,6 +9,8 @@ See the file [NEWS](NEWS) for information on what has changed in recent versions
Please read the file [INSTALL-git](INSTALL-git.md) for installation instructions.
Please take a look at [the guide for new contributors](https://strace.io/wiki/NewContributorGuide) if you want to get involved in strace development.
The user discussion and development of strace take place on [the strace mailing list](https://lists.strace.io/mailman/listinfo/strace-devel) -- everyone is welcome to post bug reports, feature requests, comments and patches to strace-devel@lists.strace.io. The mailing list archives are available at https://lists.strace.io/pipermail/strace-devel/ and other archival sites.
The GIT repository of strace is available at [GitHub](https://github.com/strace/strace/) and [GitLab](https://gitlab.com/strace/strace/).

57
aio.c
View File

@ -34,6 +34,13 @@
#include <linux/aio_abi.h>
#include "xlat/aio_cmds.h"
#include "xlat/aio_iocb_flags.h"
#ifdef HAVE_STRUCT_IOCB_AIO_RW_FLAGS
# define AIO_RW_FLAGS_FIELD aio_rw_flags
#else
# define AIO_RW_FLAGS_FIELD aio_reserved1
#endif
SYS_FUNC(io_setup)
{
@ -52,7 +59,7 @@ SYS_FUNC(io_destroy)
}
enum iocb_sub {
SUB_NONE, SUB_COMMON, SUB_VECTOR
SUB_NONE, SUB_COMMON, SUB_VECTOR, SUB_POLL
};
static enum iocb_sub
@ -64,14 +71,13 @@ tprint_lio_opcode(unsigned int cmd)
[IOCB_CMD_FSYNC] = SUB_NONE,
[IOCB_CMD_FDSYNC] = SUB_NONE,
[IOCB_CMD_PREADX] = SUB_NONE,
[IOCB_CMD_POLL] = SUB_NONE,
[IOCB_CMD_POLL] = SUB_POLL,
[IOCB_CMD_NOOP] = SUB_NONE,
[IOCB_CMD_PREADV] = SUB_VECTOR,
[IOCB_CMD_PWRITEV] = SUB_VECTOR,
};
printxval_indexn_ex(ARRSZ_PAIR(aio_cmds), cmd, "IOCB_CMD_???",
XLAT_STYLE_FMT_U);
printxval_ex(aio_cmds, cmd, "IOCB_CMD_???", XLAT_STYLE_FMT_U);
return cmd < ARRAY_SIZE(subs) ? subs[cmd] : SUB_NONE;
}
@ -79,14 +85,14 @@ tprint_lio_opcode(unsigned int cmd)
static void
print_common_flags(struct tcb *tcp, const struct iocb *cb)
{
/* IOCB_FLAG_RESFD is available since v2.6.22-rc1~47 */
#ifdef IOCB_FLAG_RESFD
if (cb->aio_flags)
PRINT_FIELD_FLAGS(", ", *cb, aio_flags, aio_iocb_flags,
"IOCB_FLAG_???");
if (cb->aio_flags & IOCB_FLAG_RESFD)
PRINT_FIELD_FD(", ", *cb, aio_resfd, tcp);
if (cb->aio_flags & ~IOCB_FLAG_RESFD)
PRINT_FIELD_X(", ", *cb, aio_flags);
#endif
else if (cb->aio_resfd)
PRINT_FIELD_X(", ", *cb, aio_resfd);
}
static bool
@ -102,20 +108,25 @@ print_iocb_header(struct tcb *tcp, const struct iocb *cb)
{
enum iocb_sub sub;
if (cb->aio_data){
PRINT_FIELD_X("", *cb, aio_data);
tprints(", ");
PRINT_FIELD_X("", *cb, aio_data);
if (cb->aio_key)
PRINT_FIELD_U(", ", *cb, aio_key);
if (cb->AIO_RW_FLAGS_FIELD) {
tprints(", aio_rw_flags=");
printflags(rwf_flags, cb->AIO_RW_FLAGS_FIELD, "RWF_???");
}
if (cb->aio_key) {
PRINT_FIELD_U("", *cb, aio_key);
tprints(", ");
}
tprints("aio_lio_opcode=");
tprints(", aio_lio_opcode=");
sub = tprint_lio_opcode(cb->aio_lio_opcode);
if (cb->aio_reqprio)
if (cb->aio_flags & IOCB_FLAG_IOPRIO) {
tprints(", aio_reqprio=");
print_ioprio(zero_extend_signed_to_ull(cb->aio_reqprio));
} else if (cb->aio_reqprio) {
PRINT_FIELD_D(", ", *cb, aio_reqprio);
}
PRINT_FIELD_FD(", ", *cb, aio_fildes, tcp);
@ -155,6 +166,10 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
PRINT_FIELD_D(", ", *cb, aio_offset);
print_common_flags(tcp, cb);
break;
case SUB_POLL:
PRINT_FIELD_FLAGS(", ", *cb, aio_buf, pollflags, "POLL???");
print_common_flags(tcp, cb);
break;
case SUB_NONE:
break;
}
@ -255,7 +270,7 @@ print_io_getevents(struct tcb *tcp, bool has_usig)
* whether the syscall has failed or not.
*/
temporarily_clear_syserror(tcp);
print_timespec(tcp, tcp->u_arg[4]);
print_timespec(tcp, tcp->u_arg[4], false);
if (has_usig) {
tprints(", ");
print_aio_sigset(tcp, tcp->u_arg[5]);

View File

@ -174,6 +174,7 @@ lookup_class(const char *s)
{ "%process", TRACE_PROCESS },
{ "%signal", TRACE_SIGNAL },
{ "%ipc", TRACE_IPC },
{ "%net", TRACE_NETWORK },
{ "%network", TRACE_NETWORK },
{ "%stat", TRACE_STAT },
{ "%lstat", TRACE_LSTAT },

57
block.c
View File

@ -65,60 +65,15 @@ typedef struct blk_user_trace_setup {
uint32_t pid;
} struct_blk_user_trace_setup;
/* Provide fall-back definitions for BLK* ioctls */
#define XLAT_MACROS_ONLY
# include "xlat/block_ioctl_cmds.h"
#undef XLAT_MACROS_ONLY
#include MPERS_DEFS
#include "print_fields.h"
#ifndef BLKPG
# define BLKPG _IO(0x12, 105)
#endif
/*
* ioctl numbers <= 114 are present in Linux 2.4. The following ones have been
* added since then and headers containing them may not be available on every
* system.
*/
#ifndef BLKTRACESETUP
# define BLKTRACESETUP _IOWR(0x12, 115, struct_blk_user_trace_setup)
#endif
#ifndef BLKTRACESTART
# define BLKTRACESTART _IO(0x12, 116)
#endif
#ifndef BLKTRACESTOP
# define BLKTRACESTOP _IO(0x12, 117)
#endif
#ifndef BLKTRACETEARDOWN
# define BLKTRACETEARDOWN _IO(0x12, 118)
#endif
#ifndef BLKDISCARD
# define BLKDISCARD _IO(0x12, 119)
#endif
#ifndef BLKIOMIN
# define BLKIOMIN _IO(0x12, 120)
#endif
#ifndef BLKIOOPT
# define BLKIOOPT _IO(0x12, 121)
#endif
#ifndef BLKALIGNOFF
# define BLKALIGNOFF _IO(0x12, 122)
#endif
#ifndef BLKPBSZGET
# define BLKPBSZGET _IO(0x12, 123)
#endif
#ifndef BLKDISCARDZEROES
# define BLKDISCARDZEROES _IO(0x12, 124)
#endif
#ifndef BLKSECDISCARD
# define BLKSECDISCARD _IO(0x12, 125)
#endif
#ifndef BLKROTATIONAL
# define BLKROTATIONAL _IO(0x12, 126)
#endif
#ifndef BLKZEROOUT
# define BLKZEROOUT _IO(0x12, 127)
#endif
#include "xlat/blkpg_ops.h"
static void
@ -204,7 +159,6 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
printnum_ulong(tcp, arg);
break;
#ifdef HAVE_BLKGETSIZE64
/* returns an uint64_t */
case BLKGETSIZE64:
if (entering(tcp))
@ -212,7 +166,6 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
tprints(", ");
printnum_int64(tcp, arg, "%" PRIu64);
break;
#endif
/* takes a pair of uint64_t */
case BLKDISCARD:

View File

@ -1,6 +1,9 @@
#!/bin/sh -eu
export LANG=C
./m4/gen_bpf_attr_m4.sh
./m4/gen_ptp_clock_m4.sh
./generate_mpers_am.sh
./xlat/gen.sh
./tests/gen_pure_executables.sh

28
bpf.c
View File

@ -150,9 +150,9 @@ print_ebpf_insn(struct tcb * const tcp, void * const elem_buf,
/* We can't use PRINT_FIELD_XVAL on bit fields */
tprints(", dst_reg=");
printxval_index(ebpf_regs, insn->dst_reg, "BPF_REG_???");
printxval(ebpf_regs, insn->dst_reg, "BPF_REG_???");
tprints(", src_reg=");
printxval_index(ebpf_regs, insn->src_reg, "BPF_REG_???");
printxval(ebpf_regs, insn->src_reg, "BPF_REG_???");
PRINT_FIELD_D(", ", *insn, off);
PRINT_FIELD_X(", ", *insn, imm);
@ -178,8 +178,8 @@ print_ebpf_prog(struct tcb *const tcp, const uint64_t addr, const uint32_t len)
BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)
{
PRINT_FIELD_XVAL_INDEX("{", attr, map_type, bpf_map_types,
"BPF_MAP_TYPE_???");
PRINT_FIELD_XVAL("{", attr, map_type, bpf_map_types,
"BPF_MAP_TYPE_???");
PRINT_FIELD_U(", ", attr, key_size);
PRINT_FIELD_U(", ", attr, value_size);
PRINT_FIELD_U(", ", attr, max_entries);
@ -248,8 +248,8 @@ BEGIN_BPF_CMD_DECODER(BPF_MAP_UPDATE_ELEM)
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_ADDR64(", ", attr, key);
PRINT_FIELD_ADDR64(", ", attr, value);
PRINT_FIELD_XVAL_INDEX(", ", attr, flags, bpf_map_update_elem_flags,
"BPF_???");
PRINT_FIELD_XVAL(", ", attr, flags, bpf_map_update_elem_flags,
"BPF_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
@ -270,8 +270,8 @@ END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)
{
PRINT_FIELD_XVAL_INDEX("{", attr, prog_type, bpf_prog_types,
"BPF_PROG_TYPE_???");
PRINT_FIELD_XVAL("{", attr, prog_type, bpf_prog_types,
"BPF_PROG_TYPE_???");
PRINT_FIELD_U(", ", attr, insn_cnt);
tprints(", insns=");
print_ebpf_prog(tcp, attr.insns, attr.insn_cnt);
@ -352,8 +352,7 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_ATTACH)
{
PRINT_FIELD_FD("{", attr, target_fd, tcp);
PRINT_FIELD_FD(", ", attr, attach_bpf_fd, tcp);
PRINT_FIELD_XVAL_INDEX(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
PRINT_FIELD_XVAL(", ", attr, attach_type, bpf_attach_type, "BPF_???");
PRINT_FIELD_FLAGS(", ", attr, attach_flags, bpf_attach_flags,
"BPF_F_???");
}
@ -362,8 +361,7 @@ END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_PROG_DETACH)
{
PRINT_FIELD_FD("{", attr, target_fd, tcp);
PRINT_FIELD_XVAL_INDEX(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
PRINT_FIELD_XVAL(", ", attr, attach_type, bpf_attach_type, "BPF_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
@ -665,8 +663,8 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)
if (entering(tcp)) {
PRINT_FIELD_FD("{query={", attr, target_fd, tcp);
PRINT_FIELD_XVAL_INDEX(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
PRINT_FIELD_XVAL(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
PRINT_FIELD_FLAGS(", ", attr, query_flags, bpf_query_flags,
"BPF_F_QUERY_???");
PRINT_FIELD_FLAGS(", ", attr, attach_flags, bpf_attach_flags,
@ -736,7 +734,7 @@ SYS_FUNC(bpf)
int rc = RVAL_DECODED;
if (entering(tcp)) {
printxval_index(bpf_commands, cmd, "BPF_???");
printxval(bpf_commands, cmd, "BPF_???");
tprints(", ");
}

View File

@ -56,10 +56,8 @@ print_bpf_filter_code(const uint16_t code, bool extended)
const struct xlat *mode = extended ? ebpf_mode : bpf_mode;
uint16_t i = code & ~BPF_CLASS(code);
if (extended)
printxval_index(ebpf_class, BPF_CLASS(code), "BPF_???");
else
printxval_index(bpf_class, BPF_CLASS(code), "BPF_???");
printxval(extended ? ebpf_class : bpf_class, BPF_CLASS(code),
"BPF_???");
switch (BPF_CLASS(code)) {
case BPF_ST:
case BPF_STX:

View File

@ -111,8 +111,10 @@ SYS_FUNC(clone)
tprints("flags=");
if (!printflags64(clone_flags, flags & ~CSIGNAL, NULL))
sep = "";
if ((flags & CSIGNAL) != 0)
tprintf("%s%s", sep, signame(flags & CSIGNAL));
if ((flags & CSIGNAL) != 0) {
tprints(sep);
printsignal(flags & CSIGNAL);
}
if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
|CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
return 0;

View File

@ -355,7 +355,8 @@ AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS(m4_normalize([
siginfo_t.si_syscall,
siginfo_t.si_timerid,
siginfo_t.si_overrun
siginfo_t.si_overrun,
siginfo_t.si_trapno
]),,, [#include <signal.h>])
AC_CHECK_MEMBERS(m4_normalize([
@ -397,7 +398,6 @@ AC_CHECK_HEADERS(m4_normalize([
linux/falloc.h
linux/fib_rules.h
linux/fiemap.h
linux/genetlink.h
linux/hiddev.h
linux/if_addr.h
linux/if_link.h
@ -477,6 +477,10 @@ AC_CHECK_HEADERS([linux/bpf.h], [
st_BPF_ATTR
])
AC_CHECK_HEADERS([linux/ptp_clock.h], [
st_PTP_CLOCK
])
AC_CHECK_HEADERS([bluetooth/bluetooth.h], [
AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,,
[#include <bluetooth/bluetooth.h>
@ -494,6 +498,7 @@ AC_CHECK_MEMBERS(m4_normalize([
AC_CHECK_TYPES([struct dcbmsg],,, [#include <linux/dcbnl.h>])
AC_CHECK_TYPES([struct ifaddrlblmsg],,, [#include <linux/if_addrlabel.h>])
AC_CHECK_TYPES([struct if_stats_msg],,, [#include <linux/if_link.h>])
AC_CHECK_TYPES([struct netconfmsg],,, [#include <linux/netconf.h>])
AC_CHECK_TYPES(m4_normalize([
@ -571,11 +576,10 @@ AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>
AC_CHECK_TYPES([struct mtd_write_req],,, [#include <mtd/mtd-abi.h>])
AC_CHECK_MEMBERS([struct ubi_attach_req.max_beb_per1024],,, [#include <mtd/ubi-user.h>])
AC_CHECK_TYPES(m4_normalize([
struct ptp_sys_offset
]),,, [#include <linux/ptp_clock.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct ubi_attach_req.max_beb_per1024
struct ubi_mkvol_req.flags
]),,, [#include <mtd/ubi-user.h>])
AC_CHECK_TYPES(m4_normalize([
struct kvm_cpuid2,
@ -601,6 +605,8 @@ fi
AC_CHECK_TYPES([struct __aio_sigset],,, [#include <linux/aio_abi.h>])
AC_CHECK_MEMBERS([struct iocb.aio_rw_flags],,, [#include <linux/aio_abi.h>])
CPPFLAGS="$saved_CPPFLAGS"
AC_CHECK_HEADERS([linux/btrfs.h], [
@ -788,15 +794,6 @@ AC_CHECK_MEMBERS(m4_normalize([
#include <linux/types.h>
#include <linux/videodev2.h>])
AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
#include <linux/fs.h>], [return !BLKGETSIZE64;])],
[ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
if test $ac_cv_have_blkgetsize64 = yes; then
AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
fi)
AC_CHECK_SIZEOF([long])
SIZEOF_LONG="$ac_cv_sizeof_long"
AC_SUBST(SIZEOF_LONG)
@ -938,8 +935,16 @@ AC_ARG_ENABLE([mpers],
esac],
[enable_mpers=yes])
st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(, [[#include "linux/]]$arch[[/arch_defs_.h"
#include "linux/arch_defs_.h"
int i[SUPPORTED_PERSONALITIES > 1 ? 1 : -1];]])],
[st_MPERS([m32], ["$arch"])])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(, [[#include "linux/]]$arch[[/arch_defs_.h"
#include "linux/arch_defs_.h"
int i[SUPPORTED_PERSONALITIES > 2 ? 1 : -1];]])],
[st_MPERS([mx32], ["$arch"])])
AX_VALGRIND_DFLT([sgcheck], [off])
AX_VALGRIND_CHECK

442
count.c
View File

@ -36,155 +36,441 @@
#include "defs.h"
#include <stdarg.h>
/* Per-syscall stats structure */
struct call_counts {
/* time may be total latency or system time */
struct timespec time;
struct timespec time_min;
struct timespec time_max;
double time_avg;
unsigned int calls, errors;
};
static struct call_counts *countv[SUPPORTED_PERSONALITIES];
#define counts (countv[current_personality])
static const struct timespec zero_ts;
static const struct timespec max_ts = {
(time_t) (long long) (zero_extend_signed_to_ull(~(((time_t) 0))) >> 1),
LONG_MAX };
static struct timespec overhead;
enum count_summary_columns {
CSC_NONE,
CSC_TIME_100S,
CSC_TIME_TOTAL,
CSC_TIME_MIN,
CSC_TIME_MAX,
CSC_TIME_AVG,
CSC_CALLS,
CSC_ERRORS,
CSC_SC_NAME,
CSC_MAX,
};
#define DEF_COLUMNS \
_(CSC_TIME_100S), \
_(CSC_TIME_TOTAL), \
_(CSC_TIME_AVG), \
_(CSC_CALLS), \
_(CSC_ERRORS), \
_(CSC_SC_NAME), \
/* End of DEF_COLUMNS definition */
#define _(x) x
static uint8_t columns[CSC_MAX] = { DEF_COLUMNS };
#undef _
#define _(x) [x] = 1
static uint8_t visible[CSC_MAX] = { DEF_COLUMNS };
#undef _
void
count_syscall(struct tcb *tcp, const struct timespec *syscall_exiting_ts)
{
if (!scno_in_range(tcp->scno))
return;
if (!counts)
if (!counts) {
counts = xcalloc(nsyscalls, sizeof(*counts));
for (size_t i = 0; i < nsyscalls; i++)
counts[i].time_min = max_ts;
}
struct call_counts *cc = &counts[tcp->scno];
cc->calls++;
if (syserror(tcp))
cc->errors++;
struct timespec wts;
if (count_wallclock) {
/* wall clock time spent while in syscall */
struct timespec wts;
ts_sub(&wts, syscall_exiting_ts, &tcp->etime);
ts_add(&cc->time, &cc->time, &wts);
} else {
/* system CPU time spent while in syscall */
ts_add(&cc->time, &cc->time, &tcp->dtime);
ts_sub(&wts, &tcp->stime, &tcp->ltime);
}
ts_sub(&wts, &wts, &overhead);
ts_max(&wts, &wts, &zero_ts);
if (ts_cmp(&wts, &cc->time_min) < 0)
cc->time_min = wts;
if (ts_cmp(&wts, &cc->time_max) > 0)
cc->time_max = wts;
ts_add(&cc->time, &cc->time, &wts);
}
static int
time_cmp(void *a, void *b)
time_cmp(const void *a, const void *b)
{
return -ts_cmp(&counts[*((int *) a)].time,
&counts[*((int *) b)].time);
return -ts_cmp(&counts[*((unsigned int *) a)].time,
&counts[*((unsigned int *) b)].time);
}
static int
syscall_cmp(void *a, void *b)
min_time_cmp(const void *a, const void *b)
{
const char *a_name = sysent[*((int *) a)].sys_name;
const char *b_name = sysent[*((int *) b)].sys_name;
return strcmp(a_name ? a_name : "", b_name ? b_name : "");
return -ts_cmp(&counts[*((unsigned int *) a)].time_min,
&counts[*((unsigned int *) b)].time_min);
}
static int
count_cmp(void *a, void *b)
max_time_cmp(const void *a, const void *b)
{
int m = counts[*((int *) a)].calls;
int n = counts[*((int *) b)].calls;
return -ts_cmp(&counts[*((unsigned int *) a)].time_max,
&counts[*((unsigned int *) b)].time_max);
}
static int
avg_time_cmp(const void *a, const void *b)
{
double m = counts[*((unsigned int *) a)].time_avg;
double n = counts[*((unsigned int *) b)].time_avg;
return (m < n) ? 1 : (m > n) ? -1 : 0;
}
static int (*sortfun)();
static int
syscall_cmp(const void *a, const void *b)
{
const char *a_name = sysent[*((unsigned int *) a)].sys_name;
const char *b_name = sysent[*((unsigned int *) b)].sys_name;
return strcmp(a_name ? a_name : "", b_name ? b_name : "");
}
static int
count_cmp(const void *a, const void *b)
{
unsigned int m = counts[*((unsigned int *) a)].calls;
unsigned int n = counts[*((unsigned int *) b)].calls;
return (m < n) ? 1 : (m > n) ? -1 : 0;
}
static int
error_cmp(const void *a, const void *b)
{
unsigned int m = counts[*((unsigned int *) a)].errors;
unsigned int n = counts[*((unsigned int *) b)].errors;
return (m < n) ? 1 : (m > n) ? -1 : 0;
}
static int (*sortfun)(const void *a, const void *b);
void
set_sortby(const char *sortby)
{
if (strcmp(sortby, "time") == 0)
sortfun = time_cmp;
else if (strcmp(sortby, "calls") == 0)
sortfun = count_cmp;
else if (strcmp(sortby, "name") == 0)
sortfun = syscall_cmp;
else if (strcmp(sortby, "nothing") == 0)
sortfun = NULL;
else {
error_msg_and_help("invalid sortby: '%s'", sortby);
static const struct {
int (*fn)(const void *a, const void *b);
const char *name;
} sort_fns[] = {
{ time_cmp, "time" },
{ time_cmp, "time_total" },
{ time_cmp, "total_time" },
{ min_time_cmp, "min_time" },
{ min_time_cmp, "time_min" },
{ max_time_cmp, "max_time" },
{ max_time_cmp, "time_max" },
{ avg_time_cmp, "avg_time" },
{ avg_time_cmp, "time_avg" },
{ count_cmp, "count" },
{ count_cmp, "calls" },
{ error_cmp, "errors" },
{ error_cmp, "error" },
{ syscall_cmp, "name" },
{ syscall_cmp, "syscall_name" },
{ syscall_cmp, "syscall" },
{ NULL, "nothing" },
{ NULL, "none" },
};
for (size_t i = 0; i < ARRAY_SIZE(sort_fns); i++) {
if (strcmp(sort_fns[i].name, sortby))
continue;
sortfun = sort_fns[i].fn;
return;
}
error_msg_and_help("invalid sortby: '%s'", sortby);
}
void set_overhead(int n)
void
set_count_summary_columns(const char *s)
{
overhead.tv_sec = n / 1000000;
overhead.tv_nsec = n % 1000000 * 1000;
static const char *cnames[] = {
[CSC_TIME_100S] = "time_percent",
[CSC_TIME_TOTAL] = "total_time",
[CSC_TIME_MIN] = "min_time",
[CSC_TIME_MAX] = "max_time",
[CSC_TIME_AVG] = "avg_time",
[CSC_CALLS] = "calls",
[CSC_ERRORS] = "errors",
[CSC_SC_NAME] = "syscall",
};
const char *pos = s;
const char *prev = s;
size_t cur = 0;
memset(columns, 0, sizeof(columns));
memset(visible, 0, sizeof(visible));
do {
bool found = false;
pos = strchr(prev, ',');
for (size_t i = 0; i < ARRAY_SIZE(cnames); i++) {
if (!cnames[i] || (pos
? ((size_t) (pos - prev) != strlen(cnames[i]))
|| strncmp(prev, cnames[i], pos - prev)
: strcmp(prev, cnames[i]))) {
continue;
}
if (visible[i])
error_msg_and_help("call summary column "
"has been provided more "
"than once: '%s' (-U option "
"residual: '%s')",
cnames[i], prev);
columns[cur++] = i;
visible[i] = 1;
found = true;
break;
}
if (!found)
error_msg_and_help("unknown column name: '%.*s'",
(int) (pos ? pos - prev : INT_MAX),
prev);
prev = pos + 1;
} while (pos);
}
void
set_overhead(const char *str)
{
if (parse_ts(str, &overhead) < 0)
error_msg_and_help("invalid -O argument: '%s'", str);
}
static size_t ATTRIBUTE_FORMAT((printf, 1, 2))
num_chars(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
int ret = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
return (unsigned int) MAX(ret, 0);
}
static void
call_summary_pers(FILE *outf)
{
static const char dashes[] = "----------------";
static const char header[] = "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n";
static const char data[] = "%6.2f %11.6f %11lu %9u %9.u %s\n";
static const char summary[] = "%6.6s %11.6f %11.11s %9u %9.u %s\n";
enum column_flags {
CF_L = 1 << 0, /* Left-aligned column */
};
static const struct {
const char *s;
size_t sz;
const char *fmt;
uint32_t flags;
} cdesc[] = {
[CSC_TIME_100S] = { ARRSZ_PAIR("% time"), "%*.2f" },
[CSC_TIME_TOTAL] = { ARRSZ_PAIR("seconds"), "%*.6f" },
[CSC_TIME_MIN] = { ARRSZ_PAIR("shortest"), "%*.6f" },
[CSC_TIME_MAX] = { ARRSZ_PAIR("longest"), "%*.6f" },
[CSC_TIME_AVG] = { ARRSZ_PAIR("usecs/call"), "%*lu" },
[CSC_CALLS] = { ARRSZ_PAIR("calls"), "%*" PRIu64 },
[CSC_ERRORS] = { ARRSZ_PAIR("errors"), "%*" PRIu64 },
[CSC_SC_NAME] = { ARRSZ_PAIR("syscall"), "%-*s", CF_L },
};
unsigned int i;
unsigned int call_cum, error_cum;
struct timespec tv_cum, dtv;
double float_tv_cum;
double percent;
unsigned int *sorted_count;
unsigned int *indices;
fprintf(outf, header,
"% time", "seconds", "usecs/call",
"calls", "errors", "syscall");
fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes);
struct timespec tv_cum = zero_ts;
struct timespec tv_min = max_ts;
struct timespec tv_max = zero_ts;
uint64_t call_cum = 0;
uint64_t error_cum = 0;
sorted_count = xcalloc(sizeof(sorted_count[0]), nsyscalls);
call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_nsec = 0;
for (i = 0; i < nsyscalls; i++) {
sorted_count[i] = i;
if (counts == NULL || counts[i].calls == 0)
double float_tv_cum;
double percent;
double ts_avg_max = 0;
size_t sc_name_max = 0;
/* sort, calculate statistics */
indices = xcalloc(sizeof(indices[0]), nsyscalls);
for (size_t i = 0; i < nsyscalls; i++) {
struct timespec dtv;
indices[i] = i;
if (counts[i].calls == 0)
continue;
ts_mul(&dtv, &overhead, counts[i].calls);
ts_sub(&counts[i].time, &counts[i].time, &dtv);
if (counts[i].time.tv_sec < 0 || counts[i].time.tv_nsec < 0)
counts[i].time.tv_sec = counts[i].time.tv_nsec = 0;
ts_add(&tv_cum, &tv_cum, &counts[i].time);
ts_min(&tv_min, &tv_min, &counts[i].time_min);
ts_max(&tv_max, &tv_max, &counts[i].time_max);
call_cum += counts[i].calls;
error_cum += counts[i].errors;
ts_add(&tv_cum, &tv_cum, &counts[i].time);
ts_div(&dtv, &counts[i].time, counts[i].calls);
counts[i].time_avg = ts_float(&dtv);
ts_avg_max = MAX(ts_avg_max, counts[i].time_avg);
sc_name_max = MAX(sc_name_max, strlen(sysent[i].sys_name));
}
float_tv_cum = ts_float(&tv_cum);
if (counts) {
if (sortfun)
qsort((void *) sorted_count, nsyscalls,
sizeof(sorted_count[0]), sortfun);
for (i = 0; i < nsyscalls; i++) {
double float_syscall_time;
unsigned int idx = sorted_count[i];
struct call_counts *cc = &counts[idx];
if (cc->calls == 0)
continue;
ts_div(&dtv, &cc->time, cc->calls);
float_syscall_time = ts_float(&cc->time);
percent = (100.0 * float_syscall_time);
if (percent != 0.0)
percent /= float_tv_cum;
/* else: float_tv_cum can be 0.0 too and we get 0/0 = NAN */
fprintf(outf, data,
percent, float_syscall_time,
(long) (1000000 * dtv.tv_sec + dtv.tv_nsec / 1000),
cc->calls, cc->errors, sysent[idx].sys_name);
if (sortfun)
qsort((void *) indices, nsyscalls, sizeof(indices[0]), sortfun);
/* calculate column widths */
#define W_(c_, v_) [c_] = MAX((cdesc[c_].sz - 1), (v_))
unsigned int cwidths[CSC_MAX] = {
W_(CSC_TIME_100S, sizeof("100.00") - 1),
W_(CSC_TIME_TOTAL, num_chars("%.6f", float_tv_cum)),
W_(CSC_TIME_MIN, num_chars("%ld.000000", tv_min.tv_sec)),
W_(CSC_TIME_MAX, num_chars("%ld.000000", tv_max.tv_sec)),
W_(CSC_TIME_AVG, num_chars("%lu", (unsigned long)
(ts_avg_max * 1e6))),
W_(CSC_CALLS, num_chars("%" PRIu64, call_cum)),
W_(CSC_ERRORS, num_chars("%" PRIu64, error_cum)),
W_(CSC_SC_NAME, sc_name_max + 1),
};
#undef W_
/* header */
for (size_t i = 0; columns[i] && i < ARRAY_SIZE(columns); i++) {
const char *fmt = cdesc[columns[i]].flags & CF_L
? "%s%-*s" : "%s%*s";
fprintf(outf, fmt, i ? " " : "", cwidths[columns[i]],
cdesc[columns[i]].s);
}
fputc('\n', outf);
for (size_t i = 0; columns[i] && i < ARRAY_SIZE(columns); i++) {
if (i)
fputc(' ', outf);
for (size_t j = 0; j < cwidths[columns[i]]; j++)
fputc('-', outf);
}
fputc('\n', outf);
/* data output */
for (size_t i = 0; i < nsyscalls; i++) {
unsigned int idx = indices[i];
struct call_counts *cc = &counts[idx];
double float_syscall_time;
if (cc->calls == 0)
continue;
float_syscall_time = ts_float(&cc->time);
percent = (100.0 * float_syscall_time);
/* else: float_tv_cum can be 0.0 too and we get 0/0 = NAN */
if (percent != 0.0)
percent /= float_tv_cum;
for (size_t i = 0; columns[i] && i < ARRAY_SIZE(columns); i++) {
const size_t c = columns[i];
if (i)
fputc(' ', outf);
#define PC_(c_, val_) \
case (c_): fprintf(outf, cdesc[c].fmt, cwidths[c], (val_)); break;
switch (c) {
PC_(CSC_TIME_100S, percent)
PC_(CSC_TIME_TOTAL, float_syscall_time)
PC_(CSC_TIME_MIN, ts_float(&cc->time_min))
PC_(CSC_TIME_MAX, ts_float(&cc->time_max))
PC_(CSC_TIME_AVG, (long) (cc->time_avg * 1e6))
PC_(CSC_CALLS, cc->calls)
case CSC_ERRORS:
if (cc->errors)
fprintf(outf, cdesc[c].fmt,
cwidths[c], cc->errors);
else
fprintf(outf, "%*s", cwidths[c], "");
break;
PC_(CSC_SC_NAME, sysent[idx].sys_name)
}
}
fputc('\n', outf);
}
free(indices);
/* footer */
for (size_t i = 0; columns[i] && i < ARRAY_SIZE(columns); i++) {
if (i)
fputc(' ', outf);
for (size_t j = 0; j < cwidths[columns[i]]; j++)
fputc('-', outf);
}
fputc('\n', outf);
/* totals */
for (size_t i = 0; columns[i] && i < ARRAY_SIZE(columns); i++) {
const size_t c = columns[i];
if (i)
fputc(' ', outf);
switch (c) {
PC_(CSC_TIME_100S, 100.0)
PC_(CSC_TIME_TOTAL, float_tv_cum)
PC_(CSC_TIME_MIN, ts_float(&tv_min))
PC_(CSC_TIME_MAX, ts_float(&tv_max))
PC_(CSC_TIME_AVG,
(unsigned long) (float_tv_cum / call_cum * 1e6))
PC_(CSC_CALLS, call_cum)
PC_(CSC_ERRORS, error_cum)
PC_(CSC_SC_NAME, "total")
}
}
free(sorted_count);
fputc('\n', outf);
fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes);
fprintf(outf, summary,
"100.00", float_tv_cum, "",
call_cum, error_cum, "total");
#undef PC_
}
void

224
defs.h
View File

@ -53,6 +53,8 @@
#include <time.h>
#include <sys/time.h>
#define HAVE_FINISH_LINE
#include "arch_defs.h"
#include "error_prints.h"
#include "gcc_compat.h"
@ -230,8 +232,9 @@ struct tcb {
const struct_sysent *s_prev_ent; /* for "resuming interrupted SYSCALL" msg */
struct inject_opts *inject_vec[SUPPORTED_PERSONALITIES];
struct timespec stime; /* System time usage as of last process wait */
struct timespec dtime; /* Delta for system time usage */
struct timespec etime; /* Syscall entry time */
struct timespec ltime; /* System time usage as of last syscall entry */
struct timespec atime; /* System time right after attach */
struct timespec etime; /* Syscall entry time (CLOCK_MONOTONIC) */
struct timespec delay_expiration_time; /* When does the delay end */
struct mmap_cache_t *mmap_cache;
@ -277,6 +280,8 @@ struct tcb {
#define TCB_DELAYED 0x1000 /* Current syscall has been delayed */
#define TCB_TAMPERED_NO_FAIL 0x2000 /* We tamper tcb with syscall
that should not fail. */
#define TCB_PTRACEOPTS_APPLIED 0x40000 /* Our PTRACE_SETOPTIONS have taken
their effect. */
/* qualifier flags */
#define QUAL_TRACE 0x001 /* this system call should be traced */
@ -302,34 +307,18 @@ struct tcb {
#define inject_delay_exit(tcp) ((tcp)->flags & TCB_INJECT_DELAY_EXIT)
#define syscall_delayed(tcp) ((tcp)->flags & TCB_DELAYED)
#define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL)
#define ptraceopts_applied(tcp) ((tcp)->flags & TCB_PTRACEOPTS_APPLIED)
#include "xlat.h"
extern const struct xlat addrfams[];
/** Protocol hardware identifiers array, sorted, defined in sockaddr.c. */
extern const struct xlat arp_hardware_types[];
/** Protocol hardware identifiers array size without terminating record. */
extern const size_t arp_hardware_types_size;
extern const struct xlat at_flags[];
extern const struct xlat clocknames[];
extern const struct xlat dirent_types[];
/** Ethernet protocols list, sorted, defined in sockaddr.c. */
extern const struct xlat ethernet_protocols[];
/** Ethernet protocols array size without terminating record. */
extern const size_t ethernet_protocols_size;
/** IP protocols list, sorted, defined in net.c. */
extern const struct xlat inet_protocols[];
/** IP protocols array size without terminating record. */
extern const size_t inet_protocols_size;
extern const struct xlat evdev_abs[];
/** Number of elements in evdev_abs array without the terminating record. */
extern const size_t evdev_abs_size;
extern const struct xlat evdev_ev[];
extern const struct xlat iffflags[];
extern const struct xlat ip_type_of_services[];
@ -340,10 +329,13 @@ extern const struct xlat nl_netfilter_msg_types[];
extern const struct xlat nl_route_types[];
extern const struct xlat open_access_modes[];
extern const struct xlat open_mode_flags[];
extern const struct xlat pollflags[];
extern const struct xlat resource_flags[];
extern const struct xlat route_nexthop_flags[];
extern const struct xlat routing_scopes[];
extern const struct xlat routing_table_ids[];
extern const struct xlat routing_types[];
extern const struct xlat rwf_flags[];
extern const struct xlat seccomp_filter_flags[];
extern const struct xlat seccomp_ret_action[];
extern const struct xlat setns_types[];
@ -359,6 +351,8 @@ extern const struct xlat whence_codes[];
#define RVAL_HEX 001 /* hex format */
#define RVAL_OCTAL 002 /* octal format */
#define RVAL_FD 010 /* file descriptor */
#define RVAL_UID 011 /* UID */
#define RVAL_GID 012 /* GID */
#define RVAL_MASK 013 /* mask for these values */
#define RVAL_STR 020 /* Print `auxstr' field after return val */
@ -374,16 +368,61 @@ extern const struct xlat whence_codes[];
#define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL)
extern void socket_exiting_cb(struct tcb *tcp);
extern void set_netlink_family_cache_entry(uint64_t inode, uint8_t family);
extern int get_netlink_family_cache_entry(uint64_t inode);
extern void invalidate_netlink_family_cache_entry(uint64_t inode);
enum sock_proto {
SOCK_PROTO_UNKNOWN,
SOCK_PROTO_UNIX,
SOCK_PROTO_TCP,
SOCK_PROTO_UDP,
SOCK_PROTO_UDPLITE,
SOCK_PROTO_DCCP,
SOCK_PROTO_SCTP,
SOCK_PROTO_L2TP_IP,
SOCK_PROTO_PING,
SOCK_PROTO_RAW,
SOCK_PROTO_TCPv6,
SOCK_PROTO_UDPv6,
SOCK_PROTO_NETLINK
SOCK_PROTO_UDPLITEv6,
SOCK_PROTO_DCCPv6,
SOCK_PROTO_L2TP_IPv6,
SOCK_PROTO_SCTPv6,
SOCK_PROTO_PINGv6,
SOCK_PROTO_RAWv6,
SOCK_PROTO_NETLINK,
SOCK_PROTO_AX25,
SOCK_PROTO_DDP,
SOCK_PROTO_NETROM,
SOCK_PROTO_PACKET,
SOCK_PROTO_ROSE,
SOCK_PROTO_X25,
};
extern enum sock_proto get_proto_by_name(const char *);
extern int get_family_by_proto(enum sock_proto proto);
enum fileops {
FILEOP_READ,
FILEOP_WRITE,
};
typedef bool (*filebuf_decoder_fn)(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen);
extern bool decode_fanotify_read(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen);
extern bool decode_fanotify_write(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen);
extern bool decode_inotify_read(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen);
enum iov_decode {
IOV_DECODE_ADDR,
@ -425,7 +464,8 @@ extern unsigned os_release;
extern int read_int_from_file(struct tcb *, const char *, int *);
extern void set_sortby(const char *);
extern void set_overhead(int);
extern void set_overhead(const char *);
extern void set_count_summary_columns(const char *columns);
extern void print_pc(struct tcb *);
extern int syscall_entering_decode(struct tcb *);
@ -441,6 +481,7 @@ extern void call_summary(FILE *);
extern void clear_regs(struct tcb *tcp);
extern int get_scno(struct tcb *);
extern int get_syscall_result(struct tcb *, bool);
extern kernel_ulong_t get_rt_sigframe_addr(struct tcb *);
/**
@ -471,6 +512,14 @@ extern kernel_long_t scno_by_name(const char *s, unsigned p,
*/
extern kernel_ulong_t shuffle_scno(kernel_ulong_t scno);
extern const char *err_name(unsigned long err);
/**
* Print error name in accordance with current xlat style setting.
*
* @param err Error value.
* @param negated If set to true, negative values of the err parameter indicate
* error condition, otherwise positive.
*/
extern void print_err(long err, bool negated);
extern bool is_erestart(struct tcb *);
extern void temporarily_clear_syserror(struct tcb *);
@ -600,8 +649,7 @@ extern unsigned long getfdinode(struct tcb *, int);
extern enum sock_proto getfdproto(struct tcb *, int);
extern const char *xlookup(const struct xlat *, const uint64_t);
extern const char *xlat_search(const struct xlat *, const size_t, const uint64_t);
extern const char *xlat_idx(const struct xlat *xlat, size_t nmemb, uint64_t val);
extern const char *xlookup_le(const struct xlat *, uint64_t *);
struct dyxlat;
struct dyxlat *dyxlat_alloc(size_t nmemb);
@ -609,7 +657,7 @@ void dyxlat_free(struct dyxlat *);
const struct xlat *dyxlat_get(const struct dyxlat *);
void dyxlat_add_pair(struct dyxlat *, uint64_t val, const char *str, size_t len);
const struct xlat *genl_families_xlat(struct tcb *tcp);
const char *genl_get_family_name(struct tcb *tcp, uint16_t id);
extern unsigned long get_pagesize(void);
extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits);
@ -673,46 +721,8 @@ extern int printxvals_ex(uint64_t val, const char *dflt,
ATTRIBUTE_SENTINEL;
#define printxvals(val_, dflt_, ...) \
printxvals_ex((val_), (dflt_), XLAT_STYLE_DEFAULT, __VA_ARGS__)
extern int printxval_searchn_ex(const struct xlat *, size_t xlat_size,
uint64_t val, const char *dflt,
enum xlat_style);
static inline int
printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
const char *dflt)
{
return printxval_searchn_ex(xlat, xlat_size, val, dflt,
XLAT_STYLE_DEFAULT);
}
/**
* Wrapper around printxval_searchn that passes ARRAY_SIZE - 1
* as the array size, as all arrays are XLAT_END-terminated and
* printxval_searchn expects a size without the terminating record.
*/
#define printxval_search(xlat__, val__, dflt__) \
printxval_searchn(xlat__, ARRAY_SIZE(xlat__) - 1, val__, dflt__)
#define printxval_search_ex(xlat__, val__, dflt__, style__) \
printxval_searchn_ex((xlat__), ARRAY_SIZE(xlat__) - 1, (val__), \
(dflt__), (style__))
extern int printxval_indexn_ex(const struct xlat *, size_t xlat_size,
uint64_t val, const char *dflt, enum xlat_style);
static inline int
printxval_indexn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
const char *dflt)
{
return printxval_indexn_ex(xlat, xlat_size, val, dflt,
XLAT_STYLE_DEFAULT);
}
#define printxval_index(xlat__, val__, dflt__) \
printxval_indexn(xlat__, ARRAY_SIZE(xlat__) - 1, val__, dflt__)
#define printxval_index_ex(xlat__, val__, dflt__) \
printxval_indexn_ex((xlat__), ARRAY_SIZE(xlat__) - 1, (val__), \
(dflt__), XLAT_STYLE_DEFAULT)
#define printxval_ex(xlat_, val_, dflt_, style_) \
printxvals_ex((val_), (dflt_), (style_), (xlat_), NULL)
extern int sprintxval_ex(char *buf, size_t size, const struct xlat *,
unsigned int val, const char *dflt, enum xlat_style);
@ -724,16 +734,25 @@ sprintxval(char *buf, size_t size, const struct xlat *xlat, unsigned int val,
return sprintxval_ex(buf, size, xlat, val, dflt, XLAT_STYLE_DEFAULT);
}
extern void printxval_dispatch_ex(const struct xlat *, size_t xlat_size,
uint64_t val, const char *dflt,
enum xlat_type, enum xlat_style);
static inline void
printxval_dispatch(const struct xlat *xlat, size_t xlat_size, uint64_t val,
const char *dflt, enum xlat_type xt)
{
return printxval_dispatch_ex(xlat, xlat_size, val, dflt, xt,
XLAT_STYLE_DEFAULT);
}
enum xlat_style_private_flag_bits {
/* print_array */
PAF_PRINT_INDICES_BIT = XLAT_STYLE_SPEC_BITS + 1,
/* print_xlat */
PXF_DEFAULT_STR_BIT,
};
#define FLAG_(name_) name_ = 1 << name_##_BIT
enum xlat_style_private_flags {
/* print_array */
FLAG_(PAF_PRINT_INDICES),
/* print_xlat */
FLAG_(PXF_DEFAULT_STR),
};
#undef FLAG_
/** Print a value in accordance with xlat formatting settings. */
extern void print_xlat_ex(uint64_t val, const char *str, enum xlat_style style);
@ -754,25 +773,32 @@ extern int printflags_ex(uint64_t flags, const char *dflt,
enum xlat_style, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
extern const char *sprintflags_ex(const char *prefix, const struct xlat *,
uint64_t flags, enum xlat_style);
uint64_t flags, char sep, enum xlat_style);
static inline const char *
sprintflags(const char *prefix, const struct xlat *xlat, uint64_t flags)
{
return sprintflags_ex(prefix, xlat, flags, XLAT_STYLE_DEFAULT);
return sprintflags_ex(prefix, xlat, flags, '\0', XLAT_STYLE_DEFAULT);
}
extern const char *sprinttime(long long sec);
extern const char *sprinttime_nsec(long long sec, unsigned long long nsec);
extern const char *sprinttime_usec(long long sec, unsigned long long usec);
#ifndef MAX_ADDR_LEN
# define MAX_ADDR_LEN 32
#endif
extern const char *sprint_mac_addr(const uint8_t addr[], size_t size);
extern const char *sprint_hwaddr(const uint8_t addr[], size_t size,
uint32_t devtype);
extern void print_symbolic_mode_t(unsigned int);
extern void print_numeric_umode_t(unsigned short);
extern void print_numeric_long_umask(unsigned long);
extern void print_dev_t(unsigned long long dev);
extern void print_abnormal_hi(kernel_ulong_t);
extern void print_ioprio(unsigned int ioprio);
extern bool print_int32_array_member(struct tcb *, void *elem_buf,
size_t elem_size, void *data);
@ -786,21 +812,6 @@ typedef bool (*tfetch_mem_fn)(struct tcb *, kernel_ulong_t addr,
typedef bool (*print_fn)(struct tcb *, void *elem_buf,
size_t elem_size, void *opaque_data);
enum print_array_flag_bits {
PAF_PRINT_INDICES_BIT = XLAT_STYLE_SPEC_BITS + 1,
PAF_INDEX_XLAT_SORTED_BIT,
PAF_INDEX_XLAT_VALUE_INDEXED_BIT,
};
#define FLAG_(name_) name_ = 1 << name_##_BIT
enum print_array_flags {
FLAG_(PAF_PRINT_INDICES),
FLAG_(PAF_INDEX_XLAT_SORTED),
FLAG_(PAF_INDEX_XLAT_VALUE_INDEXED),
};
#undef FLAG_
/**
* @param flags Combination of xlat style settings and additional flags from
@ -817,7 +828,6 @@ print_array_ex(struct tcb *,
void *opaque_data,
unsigned int flags,
const struct xlat *index_xlat,
size_t index_xlat_size,
const char *index_dflt);
static inline bool
@ -832,7 +842,7 @@ print_array(struct tcb *const tcp,
{
return print_array_ex(tcp, start_addr, nmemb, elem_buf, elem_size,
tfetch_mem_func, print_func, opaque_data,
0, NULL, 0, NULL);
0, NULL, NULL);
}
extern kernel_ulong_t *
@ -869,7 +879,11 @@ print_inet_addr(int af, const void *addr, unsigned int len, const char *var_name
extern bool
decode_inet_addr(struct tcb *, kernel_ulong_t addr,
unsigned int len, int family, const char *var_name);
extern void print_ax25_addr(const void /* ax25_address */ *addr);
extern void print_x25_addr(const void /* struct x25_address */ *addr);
extern void print_rose_addr(const void /* rose_address */ *addr);
extern const char *get_sockaddr_by_inode(struct tcb *, int fd, unsigned long inode);
extern const char *get_sockdata_by_inode(struct tcb *, int fd, unsigned long inode);
extern bool print_sockaddr_by_inode(struct tcb *, int fd, unsigned long inode);
extern void print_dirfd(struct tcb *, int);
@ -877,6 +891,7 @@ extern int
decode_sockaddr(struct tcb *, kernel_ulong_t addr, int addrlen);
extern void printuid(const char *, const unsigned int);
extern void printgid(const char *, const unsigned int);
extern void
print_sigset_addr_len(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len);
@ -927,6 +942,7 @@ fetch_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr);
extern void
print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr);
extern const char *get_ifname(const unsigned int ifindex);
extern void print_ifindex(unsigned int);
extern void print_bpf_filter_code(const uint16_t code, bool extended);
@ -984,6 +1000,9 @@ extern void ts_add(struct timespec *, const struct timespec *, const struct time
extern void ts_sub(struct timespec *, const struct timespec *, const struct timespec *);
extern void ts_mul(struct timespec *, const struct timespec *, int);
extern void ts_div(struct timespec *, const struct timespec *, int);
extern void ts_min(struct timespec *, const struct timespec *, const struct timespec *);
extern void ts_max(struct timespec *, const struct timespec *, const struct timespec *);
extern int parse_ts(const char *s, struct timespec *t);
#ifdef ENABLE_STACKTRACE
extern void unwind_init(void);
@ -1070,12 +1089,12 @@ typedef struct {
int tv_sec, tv_usec;
} timeval32_t;
extern void print_timeval32_t(const timeval32_t *);
extern void print_timeval32_t(const timeval32_t *, bool rtc);
extern void printrusage32(struct tcb *, kernel_ulong_t);
extern const char *sprint_timeval32(struct tcb *, kernel_ulong_t addr);
extern void print_timeval32(struct tcb *, kernel_ulong_t addr);
extern void print_timeval32(struct tcb *, kernel_ulong_t addr, bool rtc);
extern void print_timeval32_utimes(struct tcb *, kernel_ulong_t addr);
extern void print_itimerval32(struct tcb *, kernel_ulong_t addr);
extern void print_itimerval32(struct tcb *, kernel_ulong_t addr, bool rtc);
#endif
#ifdef HAVE_STRUCT_USER_DESC
@ -1135,6 +1154,14 @@ print_mac_addr(const char *prefix, const uint8_t addr[], size_t size)
tprints(sprint_mac_addr(addr, size));
}
static inline void
print_hwaddr(const char *prefix, const uint8_t addr[], size_t size,
uint32_t devtype)
{
tprints(prefix);
tprints(sprint_hwaddr(addr, size, devtype));
}
#if SUPPORTED_PERSONALITIES > 1
extern void set_personality(unsigned int personality);
extern unsigned current_personality;
@ -1196,6 +1223,10 @@ print_big_u64_addr(const uint64_t addr)
#define DECL_PRINTNUM(name) \
extern bool \
printnum_ ## name ## _ex(struct tcb *, kernel_ulong_t addr, \
bool addr_cmnt, const char *fmt) \
ATTRIBUTE_FORMAT((printf, 4, 0)); \
extern bool \
printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
ATTRIBUTE_FORMAT((printf, 3, 0)) \
/* End of DECL_PRINTNUM definition. */
@ -1375,6 +1406,7 @@ extern const char *const errnoent[];
extern const char *const signalent[];
extern const unsigned int nerrnos;
extern const unsigned int nsignals;
extern const unsigned int nsig;
extern const struct_sysent sysent0[];
extern const struct_ioctlent ioctlent0[];

View File

@ -66,7 +66,7 @@ alloc_delay_data(void)
}
void
fill_delay_data(uint16_t delay_idx, int intval, bool isenter)
fill_delay_data(uint16_t delay_idx, struct timespec *val, bool isenter)
{
if (delay_idx >= delay_data_vec_size)
error_func_msg_and_die("delay_idx >= delay_data_vec_size");
@ -77,8 +77,7 @@ fill_delay_data(uint16_t delay_idx, int intval, bool isenter)
else
ts = &(delay_data_vec[delay_idx].ts_exit);
ts->tv_sec = intval / 1000000;
ts->tv_nsec = intval % 1000000 * 1000;
*ts = *val;
}
static bool

View File

@ -29,7 +29,7 @@
#define STRACE_DELAY_H
uint16_t alloc_delay_data(void);
void fill_delay_data(uint16_t delay_idx, int intval, bool isenter);
void fill_delay_data(uint16_t delay_idx, struct timespec *val, bool isenter);
bool is_delay_timer_armed(void);
void delay_timer_expired(void);
void arm_delay_timer(const struct tcb *);

7
desc.c
View File

@ -36,6 +36,9 @@ SYS_FUNC(close)
{
printfd(tcp, tcp->u_arg[0]);
uint64_t inode = getfdinode(tcp, tcp->u_arg[0]);
invalidate_netlink_family_cache_entry(inode);
return RVAL_DECODED;
}
@ -72,7 +75,7 @@ SYS_FUNC(dup3)
static int
decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
void (*const print_tv_ts) (struct tcb *, kernel_ulong_t),
void (*const print_tv_ts) (struct tcb *, kernel_ulong_t, bool),
const char * (*const sprint_tv_ts) (struct tcb *, kernel_ulong_t))
{
int i, j;
@ -125,7 +128,7 @@ decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
}
free(fds);
tprints(", ");
print_tv_ts(tcp, args[4]);
print_tv_ts(tcp, args[4], false);
} else {
static char outstr[1024];
char *outptr;

8
dist/README vendored
View File

@ -10,13 +10,21 @@ of Paul Kranenburg; see the file COPYING for details.
See the file CREDITS for a list of authors and other contributors.
See the file INSTALL for compilation and installation instructions.
See the file NEWS for information on what has changed in recent versions.
See the file README-hacking for information related to strace development.
The project's homepage is at
https://strace.io
The GIT repository of strace is available at
https://github.com/strace/strace/ and https://gitlab.com/strace/strace/
strace has a mailing list:
strace-devel@lists.strace.io
Everyone is welcome to post bug reports, feature requests, comments
and patches to the list. The mailing list archives are available at
https://lists.strace.io/pipermail/strace-devel/
System requirements:
* Linux kernel >= 2.6.18 is recommended. Older versions might still work
but they haven't been thoroughly tested with this release.

View File

@ -27,26 +27,21 @@
#include "defs.h"
struct dyxlat {
size_t used;
size_t allocated;
struct xlat *xlat;
struct xlat xlat;
struct xlat_data *data;
};
#define MARK_END(xlat) \
do { \
(xlat).val = 0; \
(xlat).str = 0; \
} while (0)
struct dyxlat *
dyxlat_alloc(const size_t nmemb)
{
struct dyxlat *const dyxlat = xmalloc(sizeof(*dyxlat));
dyxlat->used = 1;
dyxlat->xlat.type = XT_NORMAL;
dyxlat->xlat.size = 0;
dyxlat->allocated = nmemb;
dyxlat->xlat = xgrowarray(NULL, &dyxlat->allocated, sizeof(struct xlat));
MARK_END(dyxlat->xlat[0]);
dyxlat->xlat.data = dyxlat->data = xgrowarray(NULL, &dyxlat->allocated,
sizeof(struct xlat_data));
return dyxlat;
}
@ -56,20 +51,20 @@ dyxlat_free(struct dyxlat *const dyxlat)
{
size_t i;
for (i = 0; i < dyxlat->used - 1; ++i) {
free((void *) dyxlat->xlat[i].str);
dyxlat->xlat[i].str = NULL;
for (i = 0; i < dyxlat->xlat.size; ++i) {
free((void *) dyxlat->data[i].str);
dyxlat->data[i].str = NULL;
}
free(dyxlat->xlat);
dyxlat->xlat = NULL;
free(dyxlat->data);
dyxlat->xlat.data = NULL;
free(dyxlat);
}
const struct xlat *
dyxlat_get(const struct dyxlat *const dyxlat)
{
return dyxlat->xlat;
return &dyxlat->xlat;
}
void
@ -78,24 +73,24 @@ dyxlat_add_pair(struct dyxlat *const dyxlat, const uint64_t val,
{
size_t i;
for (i = 0; i < dyxlat->used - 1; ++i) {
if (dyxlat->xlat[i].val == val) {
if (strncmp(dyxlat->xlat[i].str, str, len) == 0
&& dyxlat->xlat[i].str[len] == '\0')
for (i = 0; i < dyxlat->xlat.size; ++i) {
if (dyxlat->data[i].val == val) {
if (strncmp(dyxlat->data[i].str, str, len) == 0
&& dyxlat->data[i].str[len] == '\0')
return;
free((void *) dyxlat->xlat[i].str);
dyxlat->xlat[i].str = xstrndup(str, len);
free((void *) dyxlat->data[i].str);
dyxlat->data[i].str = xstrndup(str, len);
return;
}
}
if (dyxlat->used >= dyxlat->allocated)
dyxlat->xlat = xgrowarray(dyxlat->xlat, &dyxlat->allocated,
sizeof(struct xlat));
if (dyxlat->xlat.size >= dyxlat->allocated)
dyxlat->xlat.data = dyxlat->data =
xgrowarray(dyxlat->data, &dyxlat->allocated,
sizeof(struct xlat_data));
dyxlat->xlat[dyxlat->used - 1].val = val;
dyxlat->xlat[dyxlat->used - 1].str = xstrndup(str, len);
MARK_END(dyxlat->xlat[dyxlat->used]);
dyxlat->used++;
dyxlat->data[dyxlat->xlat.size].val = val;
dyxlat->data[dyxlat->xlat.size].str = xstrndup(str, len);
dyxlat->xlat.size++;
}

View File

@ -25,7 +25,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#if defined(HAVE_DEFS_H)
# include "defs.h"
#elif defined(HAVE_CONFIG_H)
# include "config.h"
#endif
@ -46,6 +48,7 @@ verror_msg(int err_no, const char *fmt, va_list p)
{
char *msg;
finish_line();
fflush(NULL);
/* We want to print entire message with single fprintf to ensure

View File

@ -40,6 +40,11 @@
extern bool debug_flag;
void die(void) ATTRIBUTE_NORETURN;
#ifdef HAVE_FINISH_LINE
extern void finish_line(void);
#else
static inline void finish_line(void) {}
#endif
void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));

55
evdev.c
View File

@ -53,8 +53,6 @@
# define SYN_MAX 0xf
# endif
const size_t evdev_abs_size = ARRAY_SIZE(evdev_abs) - 1;
static int
abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
@ -98,7 +96,7 @@ keycode_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
if (!umove_or_printaddr(tcp, arg, &keycode)) {
tprintf("[%u, ", keycode[0]);
printxval_index(evdev_keycode, keycode[1], "KEY_???");
printxval(evdev_keycode, keycode[1], "KEY_???");
tprints("]");
}
@ -125,7 +123,7 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
unsigned int i;
tprintf("index=%" PRIu16 ", keycode=", ike.index);
printxval_index(evdev_keycode, ike.keycode, "KEY_???");
printxval(evdev_keycode, ike.keycode, "KEY_???");
tprints(", scancode=[");
for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
if (i > 0)
@ -164,9 +162,9 @@ getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
}
static int
decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
const struct xlat decode_nr[], const unsigned int max_nr,
const char *const dflt, size_t decode_nr_size, enum xlat_type xt)
decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
const struct xlat *decode_nr, const unsigned int max_nr,
const char *const dflt)
{
tprints(", ");
@ -187,7 +185,7 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
if (i < 0) {
tprints(" 0 ");
} else {
printxval_dispatch(decode_nr, decode_nr_size, i, dflt, xt);
printxval(decode_nr, i, dflt);
while ((i = next_set_bit(decoded_arg, i + 1, size)) > 0) {
if (abbrev(tcp) && bit_displayed >= 3) {
@ -195,8 +193,7 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
break;
}
tprints(", ");
printxval_dispatch(decode_nr, decode_nr_size, i, dflt,
xt);
printxval(decode_nr, i, dflt);
bit_displayed++;
}
}
@ -206,10 +203,6 @@ decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
return RVAL_IOCTL_DECODED;
}
#define decode_bitset(tcp_, arg_, decode_nr_, max_nr_, dflt_, xt_) \
decode_bitset_((tcp_), (arg_), (decode_nr_), (max_nr_), \
(dflt_), ARRAY_SIZE(decode_nr_), (xt_))
# ifdef EVIOCGMTSLOTS
static int
mtslots_ioctl(struct tcb *const tcp, const unsigned int code,
@ -260,42 +253,41 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
switch (ev_nr) {
case 0:
return decode_bitset(tcp, arg, evdev_ev,
EV_MAX, "EV_???", XT_SORTED);
EV_MAX, "EV_???");
case EV_KEY:
return decode_bitset(tcp, arg, evdev_keycode,
KEY_MAX, "KEY_???", XT_INDEXED);
KEY_MAX, "KEY_???");
case EV_REL:
return decode_bitset(tcp, arg, evdev_relative_axes,
REL_MAX, "REL_???", XT_INDEXED);
REL_MAX, "REL_???");
case EV_ABS:
return decode_bitset(tcp, arg, evdev_abs,
ABS_MAX, "ABS_???", XT_INDEXED);
ABS_MAX, "ABS_???");
case EV_MSC:
return decode_bitset(tcp, arg, evdev_misc,
MSC_MAX, "MSC_???", XT_INDEXED);
MSC_MAX, "MSC_???");
case EV_SW:
return decode_bitset(tcp, arg, evdev_switch,
SW_MAX, "SW_???", XT_INDEXED);
SW_MAX, "SW_???");
case EV_LED:
return decode_bitset(tcp, arg, evdev_leds,
LED_MAX, "LED_???", XT_INDEXED);
LED_MAX, "LED_???");
case EV_SND:
return decode_bitset(tcp, arg, evdev_snd,
SND_MAX, "SND_???", XT_INDEXED);
SND_MAX, "SND_???");
case EV_REP:
return decode_bitset(tcp, arg, evdev_autorepeat,
REP_MAX, "REP_???", XT_INDEXED);
REP_MAX, "REP_???");
case EV_FF:
return decode_bitset(tcp, arg, evdev_ff_types,
FF_MAX, "FF_???", XT_SORTED);
FF_MAX, "FF_???");
case EV_PWR:
tprints(", ");
printnum_int(tcp, arg, "%d");
return RVAL_IOCTL_DECODED;
case EV_FF_STATUS:
return decode_bitset(tcp, arg, evdev_ff_status,
FF_STATUS_MAX, "FF_STATUS_???",
XT_INDEXED);
FF_STATUS_MAX, "FF_STATUS_???");
default:
tprints(", ");
printaddr(arg);
@ -349,23 +341,22 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code,
# ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
return decode_bitset(tcp, arg, evdev_prop,
INPUT_PROP_MAX, "PROP_???",
XT_INDEXED);
INPUT_PROP_MAX, "PROP_???");
# endif
case _IOC_NR(EVIOCGSND(0)):
return decode_bitset(tcp, arg, evdev_snd,
SND_MAX, "SND_???", XT_INDEXED);
SND_MAX, "SND_???");
# ifdef EVIOCGSW
case _IOC_NR(EVIOCGSW(0)):
return decode_bitset(tcp, arg, evdev_switch,
SW_MAX, "SW_???", XT_INDEXED);
SW_MAX, "SW_???");
# endif
case _IOC_NR(EVIOCGKEY(0)):
return decode_bitset(tcp, arg, evdev_keycode,
KEY_MAX, "KEY_???", XT_INDEXED);
KEY_MAX, "KEY_???");
case _IOC_NR(EVIOCGLED(0)):
return decode_bitset(tcp, arg, evdev_leds,
LED_MAX, "LED_???", XT_INDEXED);
LED_MAX, "LED_???");
}
/* multi-number fixed-length commands */

View File

@ -27,6 +27,7 @@
*/
#include "defs.h"
#include "print_fields.h"
#include "xlat/fan_classes.h"
#include "xlat/fan_init_flags.h"
@ -37,6 +38,236 @@
#ifndef FAN_NOFD
# define FAN_NOFD -1
#endif
#ifndef FAN_AUDIT
# define FAN_AUDIT 0x10
#endif
#include "xlat/fan_mark_flags.h"
#include "xlat/fan_event_flags.h"
#include "xlat/fan_responses.h"
static void
print_fanfd(struct tcb *tcp, int fd)
{
if (fd == FAN_NOFD)
print_xlat_d(FAN_NOFD);
else
printfd(tcp, fd);
}
#define PRINT_FIELD_FANFD(prefix_, where_, field_, tcp_) \
do { \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
print_fanfd((tcp_), (where_).field_); \
} while (0)
bool
decode_fanotify_read(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen)
{
struct fev_hdr {
uint32_t event_len;
union {
struct {
uint8_t vers;
uint8_t reserved;
uint16_t metadata_len;
};
uint32_t vers_v2;
};
} fev_hdr;
uint32_t fev_ver = 0;
union fev_md {
struct fev_md_v2 {
uint64_t ATTRIBUTE_ALIGNED(8) mask;
int32_t fd;
int32_t pid;
} v2;
struct fev_md_v1 {
int32_t fd;
uint64_t ATTRIBUTE_ALIGNED(8) mask;
int64_t pid;
} ATTRIBUTE_PACKED v1;
} fev_md;
enum {
FEV_V1_SIZE = sizeof(struct fev_hdr) + sizeof(struct fev_md_v1),
FEV_V2_SIZE = sizeof(struct fev_hdr) + sizeof(struct fev_md_v2),
FEV_MIN_SIZE = MIN(FEV_V1_SIZE, FEV_V2_SIZE),
};
kernel_ulong_t pos = 0;
if (addrlen < sizeof(fev_hdr))
return false;
tprints("[");
do {
if (pos)
tprints(", ");
if (umove(tcp, addr + pos, &fev_hdr)) {
printaddr_comment(addr + pos);
break;
}
PRINT_FIELD_U("{", fev_hdr, event_len);
if (fev_hdr.event_len < FEV_MIN_SIZE) {
tprints(", ... /* invalid event_len */}");
if (!fev_hdr.event_len)
goto end_decoded;
goto end_fev_decoded;
}
switch (fev_hdr.vers) {
case 0: case 1: case 2:
switch (fev_hdr.vers_v2) {
case 1: case 2:
PRINT_FIELD_U(", ", fev_hdr, vers_v2);
fev_ver = fev_hdr.vers;
break;
default:
tprints("}");
pos += offsetof(struct fev_hdr, vers_v2);
goto end_decoded;
}
break;
case 3: default:
PRINT_FIELD_U(", ", fev_hdr, vers);
fev_ver = fev_hdr.vers;
if (fev_hdr.reserved)
PRINT_FIELD_U(", ", fev_hdr, reserved);
PRINT_FIELD_U(", ", fev_hdr, metadata_len);
if (fev_hdr.metadata_len < FEV_V2_SIZE) {
tprints(", ... /* invalid metadata_len */}");
goto end_fev_decoded;
}
}
if (fev_ver < 1 || fev_ver > 3) {
tprints(", ... /* invalid vers */}");
goto end_fev_decoded;
}
switch (fev_ver) {
case 1:
if (umove(tcp, addr + pos + sizeof(fev_hdr),
&fev_md.v1)) {
printf(", ...}");
pos += sizeof(fev_hdr);
goto end_decoded;
}
PRINT_FIELD_FANFD(", ", fev_md.v1, fd, tcp);
PRINT_FIELD_FLAGS(", ", fev_md.v1, mask,
fan_event_flags, "FAN_???");
PRINT_FIELD_D(", ", fev_md.v1, pid);
if (FEV_V1_SIZE < fev_hdr.event_len) {
tprints(", ");
printstrn(tcp, addr + pos,
fev_hdr.event_len - FEV_V1_SIZE);
}
break;
case 2: case 3:
if (umove(tcp, addr + pos + sizeof(fev_hdr),
&fev_md.v2)) {
printf(", ...}");
pos += sizeof(fev_hdr);
goto end_decoded;
}
PRINT_FIELD_FLAGS(", ", fev_md.v2, mask,
fan_event_flags, "FAN_???");
PRINT_FIELD_FANFD(", ", fev_md.v2, fd, tcp);
PRINT_FIELD_D(", ", fev_md.v2, pid);
if (FEV_V2_SIZE < fev_hdr.event_len) {
tprints(", ");
printstrn(tcp, addr + pos,
fev_hdr.event_len - FEV_V2_SIZE);
}
}
tprints("}");
end_fev_decoded:
pos += fev_hdr.event_len;
} while (pos <= addrlen - sizeof(fev_hdr));
end_decoded:
if (pos < addrlen) {
if (pos)
tprints(", ");
printstrn(tcp, addr + pos, addrlen - pos);
}
tprints("]");
return true;
}
bool
decode_fanotify_write(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen)
{
struct fresp {
int32_t fd;
uint32_t response;
} fresp;
kernel_ulong_t pos = 0;
if (addrlen < sizeof(fresp))
return false;
tprints("[");
do {
if (pos)
tprints(", ");
if (umove(tcp, addr + pos, &fresp)) {
printaddr_comment(addr + pos);
break;
}
PRINT_FIELD_FD("{", fresp, fd, tcp);
tprints(", response=");
if (fresp.response | FAN_AUDIT) {
print_xlat(FAN_AUDIT);
tprints("|");
}
printxval(fan_responses, fresp.response, "FAN_???");
tprints("}");
pos += sizeof(fresp);
} while (pos <= addrlen - sizeof(fresp));
if (pos < addrlen) {
if (pos)
tprints(", ");
printstrn(tcp, addr + pos, addrlen - pos);
}
tprints("]");
return true;
}
SYS_FUNC(fanotify_init)
{
@ -54,9 +285,6 @@ SYS_FUNC(fanotify_init)
return RVAL_DECODED | RVAL_FD;
}
#include "xlat/fan_mark_flags.h"
#include "xlat/fan_event_flags.h"
SYS_FUNC(fanotify_mark)
{
printfd(tcp, tcp->u_arg[0]);

49
fcntl.c
View File

@ -34,6 +34,7 @@
#include "xlat/f_owner_types.h"
#include "xlat/f_seals.h"
#include "xlat/fcntl_rw_hints.h"
#include "xlat/fcntlcmds.h"
#include "xlat/fdflags.h"
#include "xlat/lockfcmds.h"
@ -84,6 +85,32 @@ print_f_owner_ex(struct tcb *const tcp, const kernel_ulong_t addr)
tprintf(", pid=%d}", owner.pid);
}
static void
print_rwhint(struct tcb *const tcp, const kernel_ulong_t addr)
{
uint64_t hint;
if (umove_or_printaddr(tcp, addr, &hint))
return;
tprints("[");
printxval(fcntl_rw_hints, hint, "RWH_WRITE_LIFE_???");
tprints("]");
}
static void
print_owner_uids(struct tcb *const tcp, const kernel_ulong_t addr)
{
uint32_t uids[2];
if (umove_or_printaddr(tcp, addr, uids))
return;
printuid("[", uids[0]); /* Real */
printuid(", ", uids[1]); /* Effective */
tprints("]");
}
static int
print_fcntl(struct tcb *tcp)
{
@ -134,7 +161,12 @@ print_fcntl(struct tcb *tcp)
break;
case F_SETSIG:
tprints(", ");
tprints(signame(tcp->u_arg[2]));
printsignal(tcp->u_arg[2]);
break;
case F_SET_RW_HINT:
case F_SET_FILE_RW_HINT:
tprints(", ");
print_rwhint(tcp, tcp->u_arg[2]);
break;
case F_GETOWN:
case F_GETPIPE_SZ:
@ -179,11 +211,26 @@ print_fcntl(struct tcb *tcp)
tcp->auxstr = sprintflags("seals ", f_seals,
(kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GET_RW_HINT:
case F_GET_FILE_RW_HINT:
if (entering(tcp)) {
tprints(", ");
return 0;
}
print_rwhint(tcp, tcp->u_arg[2]);
break;
case F_GETSIG:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = signame(tcp->u_rval);
return RVAL_STR;
case F_GETOWNER_UIDS:
if (entering(tcp)) {
tprints(", ");
return 0;
}
print_owner_uids(tcp, tcp->u_arg[2]);
break;
default:
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
break;

View File

@ -48,27 +48,55 @@ struct inject_personality_data {
uint16_t scno;
};
struct alt_name {
const char *syn;
const char *orig;
};
#define _(a_, b_) { (a_), (b_) }
static const struct alt_name alt_signames[] = {
#include "linux/alt_signalent.h"
};
static const struct alt_name alt_errnames[] = {
#include "linux/alt_signalent.h"
};
#undef _
static bool
signame_eq(const char *needle, const char *straw)
{
if (strncasecmp(straw, "SIG", 3) != 0)
return false;
straw += 3;
if (strncasecmp(needle, "SIG", 3) == 0)
needle += 3;
return (strcasecmp(needle, straw) == 0);
}
static int
sigstr_to_uint(const char *s)
{
for (size_t i = 0; i < ARRAY_SIZE(alt_signames); i++) {
if (!signame_eq(s, alt_signames[i].syn)) {
error_msg("Signal name \"%s\" is selected instead of "
"synonymous \"%s\"",
alt_signames[i].orig, s);
s = alt_signames[i].orig;
break;
}
}
if (*s >= '0' && *s <= '9')
return string_to_uint_upto(s, 255);
return string_to_uint_upto(s, nsig);
if (strncasecmp(s, "SIG", 3) == 0)
s += 3;
for (int i = 0; i <= 255; ++i) {
const char *name = signame(i);
if (strncasecmp(name, "SIG", 3) != 0)
continue;
name += 3;
if (strcasecmp(name, s) != 0)
continue;
return i;
for (size_t i = 1; i <= nsig; i++) {
if (signame_eq(s, signame(i)))
return i;
}
return -1;
@ -77,6 +105,16 @@ sigstr_to_uint(const char *s)
static int
find_errno_by_name(const char *name)
{
for (unsigned int i = 0; i < ARRAY_SIZE(alt_errnames); ++i) {
if (!strcasecmp(name, alt_errnames[i].syn)) {
error_msg("Error name \"%s\" is selected instead of "
"synonymous \"%s\"",
alt_errnames[i].orig, name);
name = alt_errnames[i].orig;
break;
}
}
for (unsigned int i = 1; i < nerrnos; ++i) {
if (errnoent[i] && (strcasecmp(name, errnoent[i]) == 0))
return i;
@ -92,14 +130,15 @@ parse_delay_token(const char *input, struct inject_opts *fopts, bool isenter)
if (fopts->data.flags & flag) /* duplicate */
return false;
long long intval = string_to_ulonglong(input);
if (intval < 0) /* couldn't parse */
struct timespec tsval;
if (parse_ts(input, &tsval) < 0) /* couldn't parse */
return false;
if (fopts->data.delay_idx == (uint16_t) -1)
fopts->data.delay_idx = alloc_delay_data();
/* populate .ts_enter or .ts_exit */
fill_delay_data(fopts->data.delay_idx, intval, isenter);
fill_delay_data(fopts->data.delay_idx, &tsval, isenter);
fopts->data.flags |= flag;
return true;

66
futex.c
View File

@ -40,16 +40,45 @@
#ifndef FUTEX_OP_OPARG_SHIFT
# define FUTEX_OP_OPARG_SHIFT 8
#endif
#ifndef FUTEX_TID_MASK
# define FUTEX_TID_MASK 0x3fffffffU
#endif
#include "xlat/futexbitset.h"
#include "xlat/futexops.h"
#include "xlat/futexpiflags.h"
#include "xlat/futexwakeops.h"
#include "xlat/futexwakecmps.h"
static void
printaddrnum(struct tcb *tcp, kernel_ulong_t addr)
{
printnum_int_ex(tcp, addr, true, "%#x");
}
static void
printaddrpival(struct tcb *tcp, kernel_ulong_t addr)
{
uint32_t tid;
if (umove_or_printaddr(tcp, addr, &tid))
return;
tprints("[");
if (tid & ~FUTEX_TID_MASK) {
printflags(futexpiflags, tid & ~FUTEX_TID_MASK, NULL);
tprints("|");
}
tprintf("%u]", tid & FUTEX_TID_MASK);
printaddr_comment(addr);
}
SYS_FUNC(futex)
{
const kernel_ulong_t uaddr = tcp->u_arg[0];
const int op = tcp->u_arg[1];
const int cmd = op & 127;
const bool is_rt = op & FUTEX_CLOCK_REALTIME;
const kernel_ulong_t timeout = tcp->u_arg[3];
const kernel_ulong_t uaddr2 = tcp->u_arg[4];
const unsigned int val = tcp->u_arg[2];
@ -57,45 +86,58 @@ SYS_FUNC(futex)
const unsigned int val3 = tcp->u_arg[5];
const char *comment;
printaddr(uaddr);
switch (cmd) {
case FUTEX_LOCK_PI:
case FUTEX_UNLOCK_PI:
case FUTEX_TRYLOCK_PI:
printaddrpival(tcp, uaddr);
break;
default:
printaddrnum(tcp, uaddr);
}
tprints(", ");
printxval(futexops, op, "FUTEX_???");
switch (cmd) {
case FUTEX_WAIT:
tprintf(", %u", val);
tprints(", ");
print_timespec(tcp, timeout);
/* timeout in FUTEX_WAIT is relative, contrary to other ops */
print_timespec(tcp, timeout, false);
break;
case FUTEX_LOCK_PI:
tprints(", ");
print_timespec(tcp, timeout);
print_timespec(tcp, timeout, true);
break;
case FUTEX_WAIT_BITSET:
tprintf(", %u", val);
tprints(", ");
print_timespec(tcp, timeout);
tprintf(", %#x", val3);
print_timespec(tcp, timeout, is_rt);
tprints(", ");
printxval(futexbitset, val3, NULL);
break;
case FUTEX_WAKE_BITSET:
tprintf(", %u", val);
tprintf(", %#x", val3);
tprints(", ");
printxval(futexbitset, val3, NULL);
break;
case FUTEX_REQUEUE:
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
printaddrnum(tcp, uaddr2);
break;
case FUTEX_CMP_REQUEUE:
case FUTEX_CMP_REQUEUE_PI:
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
(cmd == FUTEX_CMP_REQUEUE ? printaddrnum
: printaddrpival)(tcp, uaddr2);
tprintf(", %u", val3);
break;
case FUTEX_WAKE_OP:
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
printaddrnum(tcp, uaddr2);
tprints(", ");
if ((val3 >> 28) & FUTEX_OP_OPARG_SHIFT) {
print_xlat(FUTEX_OP_OPARG_SHIFT);
@ -115,11 +157,13 @@ SYS_FUNC(futex)
case FUTEX_WAIT_REQUEUE_PI:
tprintf(", %u", val);
tprints(", ");
print_timespec(tcp, timeout);
print_timespec(tcp, timeout, is_rt);
tprints(", ");
printaddr(uaddr2);
printaddrpival(tcp, uaddr2);
break;
case FUTEX_FD:
tprintf(", %u", val);
return RVAL_DECODED | RVAL_FD;
case FUTEX_WAKE:
tprintf(", %u", val);
break;

View File

@ -87,6 +87,14 @@
# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_))
#endif
#if GNUC_PREREQ(4, 1)
# define CMPXCHG(val_, old_, new_) \
__sync_bool_compare_and_swap((val_), (old_), (new_))
#else
# define CMPXCHG(val_, old_, new_) \
((val_) == (old_) ? (val_) = (new_), true : false)
#endif
#if GNUC_PREREQ(4, 3)
# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
#else

82
gen_ptp_clock_check.sh Executable file
View File

@ -0,0 +1,82 @@
#!/bin/sh -efu
# Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
input="$1"
shift
cat <<EOF
/* Generated by $0 from $input; do not edit. */
#include "defs.h"
#ifdef HAVE_LINUX_PTP_CLOCK_H
# include <linux/ptp_clock.h>
# include "ptp_clock.h"
# include "static_assert.h"
# define SoM(type_, member_) (sizeof(((type_ *)0)->member_))
EOF
for struct in $(sed -n 's/^struct \(strace_ptp_[^[:space:]]\+\) .*/\1/p' < "$input"); do
type_name="struct ${struct#strace_}"
TYPE_NAME="$(printf %s "$type_name" |tr '[:lower:] ' '[:upper:]_')"
sed -n '/^'"struct $struct"' [^{]*{$/,/^};$/p' < "$input" |
sed -n 's/^[[:space:]]\+[^][;]*[[:space:]]\([^][[:space:];]\+\)\(\[[^;]*\]\)\?;$/\1/p' |
while read field; do
FIELD="$(printf %s "$field" |tr '[:lower:]' '[:upper:]')"
if [ "rsv" = "$field" ]; then
cat <<EOF
# ifdef HAVE_${TYPE_NAME}_$FIELD
static_assert(SoM(struct $struct, $field) <= SoM($type_name, $field),
"$struct.$field is bigger than in system headers");
# endif /* HAVE_${TYPE_NAME}_$FIELD */
EOF
continue;
fi
cat <<EOF
# ifdef HAVE_${TYPE_NAME}_$FIELD
static_assert(SoM(struct $struct, $field) == SoM($type_name, $field),
"$struct.$field size mismatch");
static_assert(offsetof(struct $struct, $field) == offsetof($type_name, $field),
"$struct.$field offset mismatch");
# endif /* HAVE_${TYPE_NAME}_$FIELD */
EOF
done
cat <<EOF
static_assert(${struct}_size == expected_${struct}_size,
"${struct}_size mismatch");
EOF
done
cat <<'EOF'
#endif /* HAVE_LINUX_BPF_H */
EOF

View File

@ -27,12 +27,63 @@
#include "defs.h"
#include DEF_MPERS_TYPE(struct_robust_list_head)
#include <linux/futex.h>
typedef struct robust_list_head struct_robust_list_head;
#include MPERS_DEFS
#include "print_fields.h"
static void
decode_robust_list(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len)
{
struct_robust_list_head rl;
if (len < sizeof(rl)) {
printaddr(addr);
return;
}
if (umove_or_printaddr(tcp, addr, &rl))
return;
PRINT_FIELD_PTR("{list={", rl.list, next);
PRINT_FIELD_D("}, ", rl, futex_offset);
PRINT_FIELD_PTR(", ", rl, list_op_pending);
if (len > sizeof(rl))
tprints(", /* ??? */");
tprints("}");
printaddr_comment(addr);
}
SYS_FUNC(set_robust_list)
{
decode_robust_list(tcp, tcp->u_arg[0], tcp->u_arg[1]);
tprintf(", %lu", (unsigned long) tcp->u_arg[1]);
return RVAL_DECODED;
}
SYS_FUNC(get_robust_list)
{
if (entering(tcp)) {
tprintf("%d, ", (int) tcp->u_arg[0]);
} else {
printnum_ptr(tcp, tcp->u_arg[1]);
mpers_ptr_t rl_ptr;
mpers_ptr_t len = 0;
if (!umove_or_printaddr(tcp, tcp->u_arg[1], &rl_ptr)) {
tprints("[");
if (!umove(tcp, tcp->u_arg[2], &len))
decode_robust_list(tcp, rl_ptr, len);
else
printaddr(tcp->u_arg[1]);
tprints("]");
}
tprints(", ");
printnum_ulong(tcp, tcp->u_arg[2]);
}

23
glibc_compat.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef STRACE_GLIBC_COMPAT_H
#define STRACE_GLIBC_COMPAT_H
#if defined __GLIBC__
# ifndef __GLIBC_MINOR__
# warning "__GLIBC__ is defined, but __GLIBC_MINOR__ isn't"
# define __GLIBC_MINOR__ 0
# endif /* __GLIBC_MINOR__ */
# ifdef __GLIBC_PREREQ
# define GLIBC_PREREQ __GLIBC_PREREQ
# else
# define GLIBC_PREREQ(maj, min) \
((((__GLIBC__) << 16) + (__GLIBC_MINOR__)) >= (((maj) << 16) + (min)))
# endif /* __GLIBC_PREREQ */
# define GLIBC_OLDER(maj, min) (!GLIBC_PREREQ((maj), (min)))
#else /* !__GLIBC__ */
# define GLIBC_PREREQ(maj, min) 0
# define GLIBC_OLDER(maj, min) 0
#endif
#endif /* STRACE_GLIBC_COMPAT_H */

View File

@ -29,9 +29,67 @@
#include "defs.h"
#include <fcntl.h>
#include "print_fields.h"
#include "xlat/inotify_flags.h"
#include "xlat/inotify_init_flags.h"
bool
decode_inotify_read(struct tcb *tcp, int fd, const char *fdpath,
enum fileops op, kernel_ulong_t addr,
kernel_ulong_t addrlen)
{
struct iev_hdr {
int32_t wd;
uint32_t mask;
uint32_t cookie;
uint32_t len;
} iev_hdr;
kernel_ulong_t pos = 0;
if (addrlen < sizeof(iev_hdr))
return false;
tprints("[");
do {
if (pos)
tprints(", ");
if (umove(tcp, addr + pos, &iev_hdr)) {
printaddr_comment(addr + pos);
break;
}
PRINT_FIELD_D("{", iev_hdr, wd);
PRINT_FIELD_FLAGS(", ", iev_hdr, mask, inotify_flags, "IN_???");
PRINT_FIELD_U(", ", iev_hdr, cookie);
PRINT_FIELD_U(", ", iev_hdr, len);
pos += sizeof(iev_hdr);
if (iev_hdr.len) {
tprints(", name=");
printstrn(tcp, addr + pos, iev_hdr.len);
pos += iev_hdr.len;
}
tprints("}");
} while (pos <= addrlen - sizeof(iev_hdr));
if (pos < addrlen) {
if (pos)
tprints(", ");
printstrn(tcp, addr + pos, addrlen - pos);
}
tprints("]");
return true;
}
SYS_FUNC(inotify_add_watch)
{
/* file descriptor */
@ -56,6 +114,11 @@ SYS_FUNC(inotify_rm_watch)
return RVAL_DECODED;
}
SYS_FUNC(inotify_init)
{
return RVAL_DECODED | RVAL_FD;
}
SYS_FUNC(inotify_init1)
{
printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");

70
io.c
View File

@ -30,9 +30,69 @@
*/
#include "defs.h"
#include <fcntl.h>
#include <fnmatch.h>
#include <sys/uio.h>
struct filebuf_decoder_desc {
const char *fname;
filebuf_decoder_fn decoder;
};
static void
decode_filebuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr,
const kernel_ulong_t addrlen,
const struct filebuf_decoder_desc *decoders, size_t decoders_cnt,
enum fileops op)
{
if (!verbose(tcp))
goto no_match;
char fdpath[PATH_MAX + 1];
if (getfdpath(tcp, fd, ARRSZ_PAIR(fdpath)) < 0)
goto no_match;
/* We don't support any "regular" files so far */
if (fdpath[0] == '/')
goto no_match;
for (size_t i = 0; i < decoders_cnt; i++) {
if (!fnmatch(decoders[i].fname, fdpath, 0) &&
decoders[i].decoder(tcp, fd, fdpath, op, addr, addrlen))
return;
}
no_match:
printstrn(tcp, addr, addrlen);
}
static void
decode_readbuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr,
const kernel_ulong_t addrlen)
{
static const struct filebuf_decoder_desc decoders[] = {
{ "anon_inode:\\[fanotify\\]", decode_fanotify_read },
{ "anon_inode:inotify", decode_inotify_read },
};
decode_filebuf(tcp, fd, addr, addrlen, ARRSZ_PAIR(decoders),
FILEOP_READ);
}
static void
decode_writebuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr,
const kernel_ulong_t addrlen)
{
static const struct filebuf_decoder_desc decoders[] = {
{ "anon_inode:\\[fanotify\\]", decode_fanotify_write },
};
decode_filebuf(tcp, fd, addr, addrlen, ARRSZ_PAIR(decoders),
FILEOP_WRITE);
}
SYS_FUNC(read)
{
if (entering(tcp)) {
@ -42,7 +102,8 @@ SYS_FUNC(read)
if (syserror(tcp))
printaddr(tcp->u_arg[1]);
else
printstrn(tcp, tcp->u_arg[1], tcp->u_rval);
decode_readbuf(tcp, tcp->u_arg[0], tcp->u_arg[1],
tcp->u_rval);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
@ -52,7 +113,7 @@ SYS_FUNC(write)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
decode_writebuf(tcp, tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
@ -159,7 +220,8 @@ SYS_FUNC(pread)
if (syserror(tcp))
printaddr(tcp->u_arg[1]);
else
printstrn(tcp, tcp->u_arg[1], tcp->u_rval);
decode_readbuf(tcp, tcp->u_arg[0], tcp->u_arg[1],
tcp->u_rval);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
printllval(tcp, "%lld", 3);
}
@ -170,7 +232,7 @@ SYS_FUNC(pwrite)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
decode_writebuf(tcp, tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
printllval(tcp, "%lld", 3);

317
ioctl.c
View File

@ -31,6 +31,7 @@
#include "defs.h"
#include <linux/ioctl.h>
#include "xlat/ioc_types.h"
#include "xlat/ioctl_dirs.h"
static int
@ -68,13 +69,39 @@ ioctl_next_match(const struct_ioctlent *iop)
return NULL;
}
static const char *
ioctl_type_str(uint8_t ioc_type)
{
static char buf[] = { '\'', '\\', '\'', '\'', '\0' };
const char *ret = xlookup(ioc_types, ioc_type);
if (ret)
return ret;
if (ioc_type == '\\' || ioc_type == '\'') {
buf[1] = '\\';
buf[2] = ioc_type;
return buf;
}
if (ioc_type >= ' ' && ioc_type < 0x7F) {
buf[1] = '\'';
buf[2] = ioc_type;
return buf + 1;
}
return NULL;
}
static void
ioctl_print_code(const unsigned int code)
{
tprints("_IOC(");
printflags(ioctl_dirs, _IOC_DIR(code), "_IOC_???");
tprintf(", %#x, %#x, %#x)",
_IOC_TYPE(code), _IOC_NR(code), _IOC_SIZE(code));
tprints(", ");
print_xlat_ex(_IOC_TYPE(code), ioctl_type_str(_IOC_TYPE(code)),
XLAT_STYLE_DEFAULT);
tprintf(", %#x, %#x)", _IOC_NR(code), _IOC_SIZE(code));
}
static int
@ -85,8 +112,7 @@ evdev_decode_number(const unsigned int code)
if (_IOC_DIR(code) == _IOC_WRITE) {
if (nr >= 0xc0 && nr <= 0xc0 + 0x3f) {
tprints("EVIOCSABS(");
printxval_indexn(evdev_abs, evdev_abs_size, nr - 0xc0,
"ABS_???");
printxval(evdev_abs, nr - 0xc0, "ABS_???");
tprints(")");
return 1;
}
@ -105,42 +131,41 @@ evdev_decode_number(const unsigned int code)
return 1;
} else if (nr >= 0x40 && nr <= 0x40 + 0x3f) {
tprints("EVIOCGABS(");
printxval_indexn(evdev_abs, evdev_abs_size, nr - 0x40,
"ABS_???");
printxval(evdev_abs, nr - 0x40, "ABS_???");
tprints(")");
return 1;
}
switch (_IOC_NR(nr)) {
case 0x06:
tprintf("EVIOCGNAME(%u)", _IOC_SIZE(code));
return 1;
case 0x07:
tprintf("EVIOCGPHYS(%u)", _IOC_SIZE(code));
return 1;
case 0x08:
tprintf("EVIOCGUNIQ(%u)", _IOC_SIZE(code));
return 1;
case 0x09:
tprintf("EVIOCGPROP(%u)", _IOC_SIZE(code));
return 1;
case 0x0a:
tprintf("EVIOCGMTSLOTS(%u)", _IOC_SIZE(code));
return 1;
case 0x18:
tprintf("EVIOCGKEY(%u)", _IOC_SIZE(code));
return 1;
case 0x19:
tprintf("EVIOCGLED(%u)", _IOC_SIZE(code));
return 1;
case 0x1a:
tprintf("EVIOCGSND(%u)", _IOC_SIZE(code));
return 1;
case 0x1b:
tprintf("EVIOCGSW(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
case 0x06:
tprintf("EVIOCGNAME(%u)", _IOC_SIZE(code));
return 1;
case 0x07:
tprintf("EVIOCGPHYS(%u)", _IOC_SIZE(code));
return 1;
case 0x08:
tprintf("EVIOCGUNIQ(%u)", _IOC_SIZE(code));
return 1;
case 0x09:
tprintf("EVIOCGPROP(%u)", _IOC_SIZE(code));
return 1;
case 0x0a:
tprintf("EVIOCGMTSLOTS(%u)", _IOC_SIZE(code));
return 1;
case 0x18:
tprintf("EVIOCGKEY(%u)", _IOC_SIZE(code));
return 1;
case 0x19:
tprintf("EVIOCGLED(%u)", _IOC_SIZE(code));
return 1;
case 0x1a:
tprintf("EVIOCGSND(%u)", _IOC_SIZE(code));
return 1;
case 0x1b:
tprintf("EVIOCGSW(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
}
}
@ -149,76 +174,105 @@ hiddev_decode_number(const unsigned int code)
{
if (_IOC_DIR(code) == _IOC_READ) {
switch (_IOC_NR(code)) {
case 0x04:
tprintf("HIDIOCGRAWNAME(%u)", _IOC_SIZE(code));
return 1;
case 0x05:
tprintf("HIDIOCGRAWPHYS(%u)", _IOC_SIZE(code));
return 1;
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(code));
return 1;
case 0x12:
tprintf("HIDIOCGPHYS(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
case 0x04:
tprintf("HIDIOCGRAWNAME(%u)", _IOC_SIZE(code));
return 1;
case 0x05:
tprintf("HIDIOCGRAWPHYS(%u)", _IOC_SIZE(code));
return 1;
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(code));
return 1;
case 0x12:
tprintf("HIDIOCGPHYS(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
}
} else if (_IOC_DIR(code) == (_IOC_READ | _IOC_WRITE)) {
switch (_IOC_NR(code)) {
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(code));
return 1;
case 0x07:
tprintf("HIDIOCGFEATURE(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(code));
return 1;
case 0x07:
tprintf("HIDIOCGFEATURE(%u)", _IOC_SIZE(code));
return 1;
default:
return 0;
}
}
return 0;
}
#ifndef SIOCPROTOPRIVATE
# define SIOCPROTOPRIVATE 0x89E0
#endif
#ifndef SIOCDEVPRIVATE
# define SIOCDEVPRIVATE 0x89F0
#endif
#ifndef SIOCIWFIRSTPRIV
# define SIOCIWFIRSTPRIV 0x8BE0
#endif
#ifndef SIOCIWLASTPRIV
# define SIOCIWLASTPRIV 0x8BFF
#endif
static int
ioctl_decode_command_number(struct tcb *tcp)
{
const unsigned int code = tcp->u_arg[1];
switch (_IOC_TYPE(code)) {
case 'E':
return evdev_decode_number(code);
case 'H':
return hiddev_decode_number(code);
case 'M':
if (_IOC_DIR(code) == _IOC_WRITE) {
tprintf("MIXER_WRITE(%u)", _IOC_NR(code));
return 1;
} else if (_IOC_DIR(code) == _IOC_READ) {
tprintf("MIXER_READ(%u)", _IOC_NR(code));
return 1;
}
return 0;
case 'U':
if (_IOC_DIR(code) == _IOC_READ && _IOC_NR(code) == 0x2c) {
tprintf("UI_GET_SYSNAME(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case 'j':
if (_IOC_DIR(code) == _IOC_READ && _IOC_NR(code) == 0x13) {
tprintf("JSIOCGNAME(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case 'k':
if (_IOC_DIR(code) == _IOC_WRITE && _IOC_NR(code) == 0) {
tprintf("SPI_IOC_MESSAGE(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
default:
return 0;
case 'E':
return evdev_decode_number(code);
case 'H':
return hiddev_decode_number(code);
case 'M':
if (_IOC_DIR(code) == _IOC_WRITE) {
tprintf("MIXER_WRITE(%u)", _IOC_NR(code));
return 1;
} else if (_IOC_DIR(code) == _IOC_READ) {
tprintf("MIXER_READ(%u)", _IOC_NR(code));
return 1;
}
return 0;
case 'U':
if (_IOC_DIR(code) == _IOC_READ && _IOC_NR(code) == 0x2c) {
tprintf("UI_GET_SYSNAME(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case 'j':
if (_IOC_DIR(code) == _IOC_READ && _IOC_NR(code) == 0x13) {
tprintf("JSIOCGNAME(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case 'k':
if (_IOC_DIR(code) == _IOC_WRITE && _IOC_NR(code) == 0) {
tprintf("SPI_IOC_MESSAGE(%u)", _IOC_SIZE(code));
return 1;
}
return 0;
case SOCK_IOC_TYPE:
if (code > SIOCPROTOPRIVATE && code <= SIOCPROTOPRIVATE + 15) {
tprintf("SIOCPROTOPRIVATE+%u", code - SIOCPROTOPRIVATE);
return 1;
}
if (code > SIOCDEVPRIVATE && code <= SIOCDEVPRIVATE + 15) {
tprintf("SIOCDEVPRIVATE+%u", code - SIOCDEVPRIVATE);
return 1;
}
return 0;
case 0x8B: /* 802.11 */
if (code > SIOCIWFIRSTPRIV && code < SIOCIWLASTPRIV) {
tprintf("SIOCIWFIRSTPRIV+%u", code - SIOCIWFIRSTPRIV);
return 1;
}
return 0;
default:
return 0;
}
}
@ -256,36 +310,22 @@ ioctl_decode(struct tcb *tcp)
const kernel_ulong_t arg = tcp->u_arg[2];
switch (_IOC_TYPE(code)) {
case '$':
return perf_ioctl(tcp, code, arg);
#if defined(ALPHA) || defined(POWERPC)
case 'f': {
int ret = file_ioctl(tcp, code, arg);
if (ret != RVAL_DECODED)
return ret;
ATTRIBUTE_FALLTHROUGH;
}
case 't':
case 'T':
return term_ioctl(tcp, code, arg);
#else /* !ALPHA */
case 'f':
return file_ioctl(tcp, code, arg);
case 0x54:
#endif /* !ALPHA */
return term_ioctl(tcp, code, arg);
case 0x89:
return sock_ioctl(tcp, code, arg);
case 'p':
return rtc_ioctl(tcp, code, arg);
case 0x03:
return hdio_ioctl(tcp, code, arg);
case 0x12:
return block_ioctl(tcp, code, arg);
case 'X':
return fs_x_ioctl(tcp, code, arg);
case 0x22:
case '"': /* 0x22 */
return scsi_ioctl(tcp, code, arg);
case '$': /* 0x24 */
return perf_ioctl(tcp, code, arg);
case '=': /* 0x3d */
return ptp_ioctl(tcp, code, arg);
#ifdef HAVE_LINUX_INPUT_H
case 'E':
return evdev_ioctl(tcp, code, arg);
#endif
case 'I':
return inotify_ioctl(tcp, code, arg);
case 'L':
return loop_ioctl(tcp, code, arg);
#ifdef HAVE_STRUCT_MTD_WRITE_REQ
@ -293,27 +333,48 @@ ioctl_decode(struct tcb *tcp)
return mtd_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024
case 'o':
case 'O':
return ubi_ioctl(tcp, code, arg);
#endif
case 'T':
return term_ioctl(tcp, code, arg);
case 'V':
return v4l2_ioctl(tcp, code, arg);
#ifdef HAVE_STRUCT_PTP_SYS_OFFSET
case '=':
return ptp_ioctl(tcp, code, arg);
case 'X':
return fs_x_ioctl(tcp, code, arg);
case 'f': {
#if defined(ALPHA) || defined(POWERPC)
int ret = file_ioctl(tcp, code, arg);
if (ret != RVAL_DECODED)
return ret;
return term_ioctl(tcp, code, arg);
#else /* !(ALPHA || POWERPC) */
return file_ioctl(tcp, code, arg);
#endif /* (ALPHA || POWERPC) */
}
#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024
case 'o':
return ubi_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_INPUT_H
case 'E':
return evdev_ioctl(tcp, code, arg);
case 'p':
return rtc_ioctl(tcp, code, arg);
#if defined(ALPHA) || defined(POWERPC)
case 't':
return term_ioctl(tcp, code, arg);
#endif /* !ALPHA */
case 0x89:
return sock_ioctl(tcp, code, arg);
#ifdef HAVE_LINUX_BTRFS_H
case 0x94:
return btrfs_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_USERFAULTFD_H
case 0xaa:
return uffdio_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_BTRFS_H
case 0x94:
return btrfs_ioctl(tcp, code, arg);
#ifdef HAVE_LINUX_KVM_H
case 0xae:
return kvm_ioctl(tcp, code, arg);
#endif
case 0xb7:
return nsfs_ioctl(tcp, code, arg);
@ -321,12 +382,6 @@ ioctl_decode(struct tcb *tcp)
case 0xfd:
return dm_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_KVM_H
case 0xae:
return kvm_ioctl(tcp, code, arg);
#endif
case 'I':
return inotify_ioctl(tcp, code, arg);
default:
break;
}

View File

@ -29,21 +29,7 @@
#include "defs.h"
#include "xstring.h"
enum {
IOPRIO_WHO_PROCESS = 1,
IOPRIO_WHO_PGRP,
IOPRIO_WHO_USER
};
#include "xlat/ioprio_who.h"
enum {
IOPRIO_CLASS_NONE,
IOPRIO_CLASS_RT,
IOPRIO_CLASS_BE,
IOPRIO_CLASS_IDLE
};
#include "xlat/ioprio_class.h"
#define IOPRIO_CLASS_SHIFT (13)
@ -68,13 +54,42 @@ sprint_ioprio(unsigned int ioprio)
return outstr;
}
void
print_ioprio(unsigned int ioprio)
{
if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
tprintf("%#x", ioprio);
if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
return;
const char *str = sprint_ioprio(ioprio);
(xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE
? tprints_comment : tprints)(str);
}
static void
print_ioprio_who(const char * prefix, int which, int who)
{
switch (which) {
case IOPRIO_WHO_USER:
printuid(prefix, who);
break;
case IOPRIO_WHO_PROCESS:
case IOPRIO_WHO_PGRP:
default:
tprintf("%s%d", prefix, who);
}
}
SYS_FUNC(ioprio_get)
{
if (entering(tcp)) {
/* int which */
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
/* int who */
tprintf(", %d", (int) tcp->u_arg[1]);
print_ioprio_who(", ", tcp->u_arg[0], tcp->u_arg[1]);
return 0;
} else {
if (syserror(tcp))
@ -90,8 +105,9 @@ SYS_FUNC(ioprio_set)
/* int which */
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
/* int who */
tprintf(", %d, ", (int) tcp->u_arg[1]);
print_ioprio_who(", ", tcp->u_arg[0], tcp->u_arg[1]);
/* int ioprio */
tprints(", ");
tprints(sprint_ioprio(tcp->u_arg[2]));
return RVAL_DECODED;

View File

@ -66,7 +66,7 @@ print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
tprints("{msg_perm={");
printuid("uid=", msqid_ds.msg_perm.uid);
printuid(", gid=", msqid_ds.msg_perm.gid);
printgid(", gid=", msqid_ds.msg_perm.gid);
tprints(", mode=");
print_numeric_umode_t(msqid_ds.msg_perm.mode);
@ -77,7 +77,7 @@ print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
tprintf(", key=%u", (unsigned) msqid_ds.msg_perm.__key);
printuid(", cuid=", msqid_ds.msg_perm.cuid);
printuid(", cgid=", msqid_ds.msg_perm.cgid);
printgid(", cgid=", msqid_ds.msg_perm.cgid);
tprints("}");
tprintf(", msg_stime=%u", (unsigned) msqid_ds.msg_stime);
tprintf(", msg_rtime=%u", (unsigned) msqid_ds.msg_rtime);

View File

@ -89,14 +89,14 @@ SYS_FUNC(semtimedop)
tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
tprints(", ");
#if defined(S390) || defined(S390X)
print_timespec(tcp, tcp->u_arg[2]);
print_timespec(tcp, tcp->u_arg[2], false);
#else
print_timespec(tcp, tcp->u_arg[4]);
print_timespec(tcp, tcp->u_arg[4], false);
#endif
} else {
tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprints(", ");
print_timespec(tcp, tcp->u_arg[3]);
print_timespec(tcp, tcp->u_arg[3], false);
}
return RVAL_DECODED;
}

View File

@ -66,7 +66,7 @@ print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
tprints("{shm_perm={");
printuid("uid=", shmid_ds.shm_perm.uid);
printuid(", gid=", shmid_ds.shm_perm.gid);
printgid(", gid=", shmid_ds.shm_perm.gid);
tprints(", mode=");
print_numeric_umode_t(shmid_ds.shm_perm.mode);
@ -77,7 +77,7 @@ print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
tprintf(", key=%u", (unsigned) shmid_ds.shm_perm.__key);
printuid(", cuid=", shmid_ds.shm_perm.cuid);
printuid(", cgid=", shmid_ds.shm_perm.cgid);
printgid(", cgid=", shmid_ds.shm_perm.cgid);
tprints("}");
tprintf(", shm_segsz=%u", (unsigned) shmid_ds.shm_segsz);
tprintf(", shm_cpid=%u", (unsigned) shmid_ds.shm_cpid);

View File

@ -147,7 +147,7 @@ keyctl_chown_key(struct tcb *tcp, key_serial_t id, unsigned user,
{
print_keyring_serial_number(id);
printuid(", ", user);
printuid(", ", group);
printgid(", ", group);
}
static void
@ -186,11 +186,9 @@ static void
keyctl_reject_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
unsigned error, key_serial_t id2)
{
const char *err_str = err_name(error);
print_keyring_serial_number(id1);
tprintf(", %u, ", timeout);
print_xlat_ex(error, err_str, XLAT_STYLE_FMT_U);
print_err(error, false);
tprints(", ");
print_keyring_serial_number(id2);
}

14
kvm.c
View File

@ -96,10 +96,9 @@ vcpu_register(struct tcb *const tcp, int fd, int cpuid)
struct vcpu_info *vcpu_info = vcpu_find(tcp, fd);
if (!vcpu_info)
vcpu_info = vcpu_alloc(tcp, fd, cpuid);
else if (vcpu_info->cpuid != cpuid)
{
if (!vcpu_info) {
vcpu_alloc(tcp, fd, cpuid);
} else if (vcpu_info->cpuid != cpuid) {
vcpu_info->cpuid = cpuid;
vcpu_info->resolved = false;
}
@ -137,7 +136,7 @@ vcpu_get_info(struct tcb *const tcp, int fd)
const char *cpuid_str;
enum mmap_cache_rebuild_result mc_stat =
mmap_cache_rebuild_if_invalid(tcp, __func__);
mmap_cache_rebuild_if_invalid(tcp);
if (mc_stat == MMAP_CACHE_REBUILD_NOCACHE)
return NULL;
@ -329,7 +328,7 @@ kvm_ioctl_decode_check_extension(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
tprints(", ");
printxval_index(kvm_cap, arg, "KVM_CAP_???");
printxval(kvm_cap, arg, "KVM_CAP_???");
return RVAL_IOCTL_DECODED;
}
@ -347,8 +346,7 @@ kvm_ioctl_run_attach_auxstr(struct tcb *const tcp,
if (umove(tcp, info->mmap_addr, &vcpu_run_struct) < 0)
return;
tcp->auxstr = xlat_idx(kvm_exit_reason, ARRAY_SIZE(kvm_exit_reason) - 1,
vcpu_run_struct.exit_reason);
tcp->auxstr = xlookup(kvm_exit_reason, vcpu_run_struct.exit_reason);
if (!tcp->auxstr)
tcp->auxstr = "KVM_EXIT_???";
}

View File

@ -0,0 +1,2 @@
_("EWOULDBLOCK", "EAGAIN"),
_("EDEADLOCK", "EDEADLK" ),

View File

@ -0,0 +1,4 @@
_("SIGPOLL", "SIGIO"),
_("SIGUNUSED", "31"),
_("SIGPWR", "SIGINFO"),
_("SIGIOT", "SIGABRT"),

View File

@ -1,2 +1,3 @@
#define HAVE_ARCH_GETRVAL2 1
#define HAVE_ARCH_DEDICATED_ERR_REG 1
#define HAVE_ARCH_UNALIGNED_ACCESS 0

3
linux/alt_errnoent.h Normal file
View File

@ -0,0 +1,3 @@
_("EWOULDBLOCK", "EAGAIN" ),
_("ENOTSUP", "EOPNOTSUPP"),
_("EDEADLOCK", "EDEADLK"),

4
linux/alt_signalent.h Normal file
View File

@ -0,0 +1,4 @@
_("SIGPOLL", "SIGIO"),
_("SIGUNUSED", "31"),
_("SIGINFO", "SIGPWR"),
_("SIGIOT", "SIGABRT"),

View File

@ -35,3 +35,7 @@
#ifndef CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL
# define CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL 0
#endif
#ifndef HAVE_ARCH_UNALIGNED_ACCESS
# define HAVE_ARCH_UNALIGNED_ACCESS 1
#endif

View File

@ -2,3 +2,4 @@
#define HAVE_ARCH_OLD_SELECT 1
#define HAVE_ARCH_UID16_SYSCALLS 1
#define CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL 1
#define HAVE_ARCH_UNALIGNED_ACCESS 0

View File

@ -249,7 +249,8 @@
[219] = { 3, TM, SEN(mincore), "mincore" },
[220] = { 3, TM, SEN(madvise), "madvise" },
[221] = { 3, TD, SEN(fcntl64), "fcntl64" },
[222 ... 223] = { },
/* [222] - tux */
/* [223] - unused */
[224] = { 0, PU|NF, SEN(gettid), "gettid" },
[225] = { 5, TD, SEN(readahead), "readahead" },
[226] = { 5, TF, SEN(setxattr), "setxattr" },
@ -280,7 +281,8 @@
[251] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[252] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[253] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[254 ... 255] = { },
/* [254] - set_thread_area */
/* [255] - get_thread_area */
[256] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[257] = { 3, 0, SEN(timer_create), "timer_create" },
[258] = { 4, 0, SEN(timer_settime), "timer_settime" },
@ -424,6 +426,7 @@
[396] = { 1, 0, SEN(pkey_free), "pkey_free" },
[397] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[398] = { 4, 0, SEN(rseq), "rseq" },
[399] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" },
#ifdef __ARM_EABI__
# define ARM_FIRST_SHUFFLED_SYSCALL 400
@ -437,6 +440,7 @@
* __ARM_NR_cmpxchg (0x000ffff0).
* Remapped by shuffle_scno() to be directly after ordinary syscalls
* in this table.
* Removed in v4.4-rc1~163^2^3~13
*/
[ARM_FIRST_SHUFFLED_SYSCALL ] = { 5, 0, SEN(printargs), "cmpxchg" },

View File

@ -60,20 +60,15 @@
/* like another call */
#define sys_acct sys_chdir
#define sys_chroot sys_chdir
#define sys_clock_getres sys_clock_gettime
#define sys_connect sys_bind
#define sys_fchdir sys_close
#define sys_fdatasync sys_close
#define sys_fsync sys_close
#define sys_getegid sys_getuid
#define sys_getegid16 sys_geteuid16
#define sys_getegid sys_getgid
#define sys_getegid16 sys_getgid16
#define sys_geteuid sys_getuid
#define sys_geteuid16 sys_getuid16
#define sys_getgid sys_getuid
#define sys_getgid16 sys_getuid16
#define sys_getpeername sys_getsockname
#define sys_getresgid sys_getresuid
#define sys_getresgid16 sys_getresuid16
#define sys_lstat sys_stat
#define sys_lstat64 sys_stat64
#define sys_mkdir sys_chmod
@ -86,17 +81,7 @@
#define sys_rename sys_link
#define sys_rmdir sys_chdir
#define sys_sched_get_priority_max sys_sched_get_priority_min
#define sys_set_robust_list sys_munmap
#define sys_setdomainname sys_sethostname
#define sys_setfsgid sys_setfsuid
#define sys_setfsgid16 sys_setfsuid16
#define sys_setgid sys_setuid
#define sys_setgid16 sys_setuid16
#define sys_setregid sys_setreuid
#define sys_setregid16 sys_setreuid16
#define sys_setresgid sys_setresuid
#define sys_setresgid16 sys_setresuid16
#define sys_stime sys_time
#define sys_swapoff sys_chdir
#define sys_symlink sys_link
#define sys_syncfs sys_close
@ -111,7 +96,6 @@
#define sys_getppid printargs
#define sys_gettid printargs
#define sys_idle printargs
#define sys_inotify_init printargs
#define sys_munlockall printargs
#define sys_pause printargs
#define sys_printargs printargs
@ -147,7 +131,6 @@
#define sys_lock printargs
#define sys_mpx printargs
#define sys_nfsservctl printargs
#define sys_phys printargs
#define sys_prof printargs
#define sys_profil printargs
#define sys_putpmsg printargs
@ -161,8 +144,5 @@
/* deprecated */
#define sys_bdflush printargs
#define sys_oldolduname printargs
#define sys_olduname printargs
#define sys_sysfs printargs
#endif /* !STRACE_LINUX_DUMMY_H */

View File

@ -0,0 +1,5 @@
_("EWOULDBLOCK", "EAGAIN"),
_("EDEADLOCK", "EDEADLK"),
_("EREFUSED", "ECONNREFUSED"),
_("ECANCELED", "ECANCELLED"),

View File

@ -105,7 +105,7 @@
[ 99] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" },
[100] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" },
[101] = { 2, TF|TST|TSTA, SEN(stat64), "stat64" },
[102] = { },
/* [102] - was socketcall */
[103] = { 3, 0, SEN(syslog), "syslog" },
[104] = { 3, 0, SEN(setitimer), "setitimer" },
[105] = { 2, 0, SEN(getitimer), "getitimer" },

View File

@ -103,7 +103,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -1,2 +1,4 @@
#include <asm/ptrace_offsets.h>
extern unsigned long *const ia64_frame_ptr;
#define IA64_SCNO_BASE (1 << 10)

11
linux/ia64/shuffle_scno.c Normal file
View File

@ -0,0 +1,11 @@
static_assert(!(IA64_SCNO_BASE & (IA64_SCNO_BASE - 1)),
"IA64_SCNO_BASE is not a power of 2 (or zero)");
static_assert(IA64_SCNO_BASE > nsyscalls0,
"syscall table is too big, shuffling will only make everything "
"worse");
kernel_ulong_t
shuffle_scno(kernel_ulong_t scno)
{
return scno ^ IA64_SCNO_BASE;
}

View File

@ -27,329 +27,329 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[1024] = { 0, 0, SEN(printargs), "ni_syscall" },
[1025] = { 1, TP|SE, SEN(exit), "exit" },
[1026] = { 3, TD, SEN(read), "read" },
[1027] = { 3, TD, SEN(write), "write" },
[1028] = { 3, TD|TF, SEN(open), "open" },
[1029] = { 1, TD, SEN(close), "close" },
[1030] = { 2, TD|TF, SEN(creat), "creat" },
[1031] = { 2, TF, SEN(link), "link" },
[1032] = { 1, TF, SEN(unlink), "unlink" },
[1033] = { 3, TF|TP|SE|SI, SEN(execve), "execve" },
[1034] = { 1, TF, SEN(chdir), "chdir" },
[1035] = { 1, TD, SEN(fchdir), "fchdir" },
[1036] = { 2, TF, SEN(utimes), "utimes" },
[1037] = { 3, TF, SEN(mknod), "mknod" },
[1038] = { 2, TF, SEN(chmod), "chmod" },
[1039] = { 3, TF, SEN(chown), "chown" },
[1040] = { 3, TD, SEN(lseek), "lseek" },
[1041] = { 0, PU|NF, SEN(getpid), "getpid" },
[1042] = { 0, PU|NF, SEN(getppid), "getppid" },
[1043] = { 5, TF, SEN(mount), "mount" },
[1044] = { 2, TF, SEN(umount2), "umount" },
[1045] = { 1, 0, SEN(setuid), "setuid" },
[1046] = { 0, PU|NF, SEN(getuid), "getuid" },
[1047] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[1048] = { 4, 0, SEN(ptrace), "ptrace" },
[1049] = { 2, TF, SEN(access), "access" },
[1050] = { 0, 0, SEN(sync), "sync" },
[1051] = { 1, TD, SEN(fsync), "fsync" },
[1052] = { 1, TD, SEN(fdatasync), "fdatasync" },
[1053] = { 2, TS, SEN(kill), "kill" },
[1054] = { 2, TF, SEN(rename), "rename" },
[1055] = { 2, TF, SEN(mkdir), "mkdir" },
[1056] = { 1, TF, SEN(rmdir), "rmdir" },
[1057] = { 1, TD, SEN(dup), "dup" },
[1058] = { 0, TD, SEN(pipe), "pipe" },
[1059] = { 1, 0, SEN(times), "times" },
[1060] = { 1, TM|SI, SEN(brk), "brk" },
[1061] = { 1, 0, SEN(setgid), "setgid" },
[1062] = { 0, PU|NF, SEN(getgid), "getgid" },
[1063] = { 0, PU|NF, SEN(getegid), "getegid" },
[1064] = { 1, TF, SEN(acct), "acct" },
[1065] = { 3, TD, SEN(ioctl), "ioctl" },
[1066] = { 3, TD, SEN(fcntl), "fcntl" },
[1067] = { 1, NF, SEN(umask), "umask" },
[1068] = { 1, TF, SEN(chroot), "chroot" },
[1069] = { 2, TSFA, SEN(ustat), "ustat" },
[1070] = { 2, TD, SEN(dup2), "dup2" },
[1071] = { 2, 0, SEN(setreuid), "setreuid" },
[1072] = { 2, 0, SEN(setregid), "setregid" },
[1073] = { 3, 0, SEN(getresuid), "getresuid" },
[1074] = { 3, 0, SEN(setresuid), "setresuid" },
[1075] = { 3, 0, SEN(getresgid), "getresgid" },
[1076] = { 3, 0, SEN(setresgid), "setresgid" },
[1077] = { 2, 0, SEN(getgroups), "getgroups" },
[1078] = { 2, 0, SEN(setgroups), "setgroups" },
[1079] = { 1, 0, SEN(getpgid), "getpgid" },
[1080] = { 2, 0, SEN(setpgid), "setpgid" },
[1081] = { 0, 0, SEN(setsid), "setsid" },
[1082] = { 1, 0, SEN(getsid), "getsid" },
[1083] = { 2, 0, SEN(sethostname), "sethostname" },
[1084] = { 2, 0, SEN(setrlimit), "setrlimit" },
[1085] = { 2, 0, SEN(getrlimit), "getrlimit" },
[1086] = { 2, 0, SEN(getrusage), "getrusage" },
[1087] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[1088] = { 2, 0, SEN(settimeofday), "settimeofday" },
[1089] = { 5, TD, SEN(select), "select" },
[1090] = { 3, TD, SEN(poll), "poll" },
[1091] = { 2, TF, SEN(symlink), "symlink" },
[1092] = { 3, TF, SEN(readlink), "readlink" },
[1093] = { 1, TF, SEN(uselib), "uselib" },
[1094] = { 2, TF, SEN(swapon), "swapon" },
[1095] = { 1, TF, SEN(swapoff), "swapoff" },
[1096] = { 4, 0, SEN(reboot), "reboot" },
[1097] = { 2, TF, SEN(truncate), "truncate" },
[1098] = { 2, TD, SEN(ftruncate), "ftruncate" },
[1099] = { 2, TD, SEN(fchmod), "fchmod" },
[1100] = { 3, TD, SEN(fchown), "fchown" },
[1101] = { 2, 0, SEN(getpriority), "getpriority" },
[1102] = { 3, 0, SEN(setpriority), "setpriority" },
[1103] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" },
[1104] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" },
[1105] = { 0, PU|NF, SEN(gettid), "gettid" },
[1106] = { 3, TI, SEN(semget), "semget" },
[1107] = { 3, TI, SEN(semop), "semop" },
[1108] = { 4, TI, SEN(semctl), "semctl" },
[1109] = { 2, TI, SEN(msgget), "msgget" },
[1110] = { 4, TI, SEN(msgsnd), "msgsnd" },
[1111] = { 5, TI, SEN(msgrcv), "msgrcv" },
[1112] = { 3, TI, SEN(msgctl), "msgctl" },
[1113] = { 3, TI, SEN(shmget), "shmget" },
[1114] = { 3, TI|TM|SI, SEN(shmat), "shmat" },
[1115] = { 1, TI|TM|SI, SEN(shmdt), "shmdt" },
[1116] = { 3, TI, SEN(shmctl), "shmctl" },
[1117] = { 3, 0, SEN(syslog), "syslog" },
[1118] = { 3, 0, SEN(setitimer), "setitimer" },
[1119] = { 2, 0, SEN(getitimer), "getitimer" },
[1120] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
[1121] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" },
[1122] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[1123] = { 0, 0, SEN(vhangup), "vhangup" },
[1124] = { 3, TF, SEN(chown), "lchown" },
[1125] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[1126] = { 4, TP, SEN(wait4), "wait4" },
[1127] = { 1, 0, SEN(sysinfo), "sysinfo" },
[1128] = { 5, TP, SEN(clone), "clone" },
[1129] = { 2, 0, SEN(setdomainname), "setdomainname" },
[1130] = { 1, 0, SEN(uname), "uname" },
[1131] = { 1, 0, SEN(adjtimex), "adjtimex" },
[1132] = { 2, 0, SEN(create_module), "create_module" },
[1133] = { 3, 0, SEN(init_module), "init_module" },
[1134] = { 2, 0, SEN(delete_module), "delete_module" },
[1135] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" },
[1136] = { 5, 0, SEN(query_module), "query_module" },
[1137] = { 4, TF, SEN(quotactl), "quotactl" },
[1138] = { 2, 0, SEN(bdflush), "bdflush" },
[1139] = { 3, 0, SEN(sysfs), "sysfs" },
[1140] = { 1, NF, SEN(personality), "personality" },
[1141] = { 5, 0, SEN(afs_syscall), "afs_syscall" },
[1142] = { 1, NF, SEN(setfsuid), "setfsuid" },
[1143] = { 1, NF, SEN(setfsgid), "setfsgid" },
[1144] = { 3, TD, SEN(getdents), "getdents" },
[1145] = { 2, TD, SEN(flock), "flock" },
[1146] = { 3, TD, SEN(readv), "readv" },
[1147] = { 3, TD, SEN(writev), "writev" },
[1148] = { 4, TD, SEN(pread), "pread64" },
[1149] = { 4, TD, SEN(pwrite), "pwrite64" },
[1150] = { 1, 0, SEN(printargs), "_sysctl" },
[1151] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[1152] = { 2, TM|SI, SEN(munmap), "munmap" },
[1153] = { 2, TM, SEN(mlock), "mlock" },
[1154] = { 1, TM, SEN(mlockall), "mlockall" },
[1155] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[1156] = { 5, TM|SI, SEN(mremap), "mremap" },
[1157] = { 3, TM, SEN(msync), "msync" },
[1158] = { 2, TM, SEN(munlock), "munlock" },
[1159] = { 0, TM, SEN(munlockall), "munlockall" },
[1160] = { 2, 0, SEN(sched_getparam), "sched_getparam" },
[1161] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
[1162] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" },
[1163] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" },
[1164] = { 0, 0, SEN(sched_yield), "sched_yield" },
[1165] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"},
[1166] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"},
[1167] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[1168] = { 2, 0, SEN(nanosleep), "nanosleep" },
[1169] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[1170] = { 5, 0, SEN(prctl), "prctl" },
[1171] = { 0, PU|NF, SEN(getpagesize), "getpagesize" },
[1172] = { 6, TD|TM|SI, SEN(mmap_pgoff), "mmap2" },
[1173] = { 5, 0, SEN(printargs), "pciconfig_read" },
[1174] = { 5, 0, SEN(printargs), "pciconfig_write" },
[1175] = { MA, 0, SEN(printargs), "perfmonctl" },
[1176] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[1177] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" },
[1178] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" },
[1179] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[1180] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" },
[1181] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
[1182] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[1183] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" },
[1184] = { 2, TF, SEN(getcwd), "getcwd" },
[1185] = { 2, 0, SEN(capget), "capget" },
[1186] = { 2, 0, SEN(capset), "capset" },
[1187] = { 4, TD|TN, SEN(sendfile), "sendfile" },
[1188] = { 5, TN, SEN(getpmsg), "getpmsg" },
[1189] = { 5, TN, SEN(putpmsg), "putpmsg" },
[1190] = { 3, TN, SEN(socket), "socket" },
[1191] = { 3, TN, SEN(bind), "bind" },
[1192] = { 3, TN, SEN(connect), "connect" },
[1193] = { 2, TN, SEN(listen), "listen" },
[1194] = { 3, TN, SEN(accept), "accept" },
[1195] = { 3, TN, SEN(getsockname), "getsockname" },
[1196] = { 3, TN, SEN(getpeername), "getpeername" },
[1197] = { 4, TN, SEN(socketpair), "socketpair" },
[1198] = { 4, TN, SEN(send), "send" },
[1199] = { 6, TN, SEN(sendto), "sendto" },
[1200] = { 4, TN, SEN(recv), "recv" },
[1201] = { 6, TN, SEN(recvfrom), "recvfrom" },
[1202] = { 2, TN, SEN(shutdown), "shutdown" },
[1203] = { 5, TN, SEN(setsockopt), "setsockopt" },
[1204] = { 5, TN, SEN(getsockopt), "getsockopt" },
[1205] = { 3, TN, SEN(sendmsg), "sendmsg" },
[1206] = { 3, TN, SEN(recvmsg), "recvmsg" },
[1207] = { 2, TF, SEN(pivotroot), "pivot_root" },
[1208] = { 3, TM, SEN(mincore), "mincore" },
[1209] = { 3, TM, SEN(madvise), "madvise" },
[1210] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
[1211] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" },
[1212] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[1213] = { 6, TP, SEN(clone), "clone2" },
[1214] = { 3, TD, SEN(getdents64), "getdents64" },
[1215] = { 2, 0, SEN(printargs), "getunwind" },
[1216] = { 3, TD, SEN(readahead), "readahead" },
[1217] = { 5, TF, SEN(setxattr), "setxattr" },
[1218] = { 5, TF, SEN(setxattr), "lsetxattr" },
[1219] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
[1220] = { 4, TF, SEN(getxattr), "getxattr" },
[1221] = { 4, TF, SEN(getxattr), "lgetxattr" },
[1222] = { 4, TD, SEN(fgetxattr), "fgetxattr" },
[1223] = { 3, TF, SEN(listxattr), "listxattr" },
[1224] = { 3, TF, SEN(listxattr), "llistxattr" },
[1225] = { 3, TD, SEN(flistxattr), "flistxattr" },
[1226] = { 2, TF, SEN(removexattr), "removexattr" },
[1227] = { 2, TF, SEN(removexattr), "lremovexattr" },
[1228] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
[1229] = { 2, TS, SEN(kill), "tkill" },
[1230] = { 6, 0, SEN(futex), "futex" },
[1231] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[1232] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[1233] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[1234] = { 4, TD, SEN(fadvise64), "fadvise64" },
[1235] = { 3, TS, SEN(tgkill), "tgkill" },
[1236] = { 1, TP|SE, SEN(exit), "exit_group" },
[1237] = { 3, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[1238] = { 2, TM, SEN(io_setup), "io_setup" },
[1239] = { 1, TM, SEN(io_destroy), "io_destroy" },
[1240] = { 5, 0, SEN(io_getevents), "io_getevents" },
[1241] = { 3, 0, SEN(io_submit), "io_submit" },
[1242] = { 3, 0, SEN(io_cancel), "io_cancel" },
[1243] = { 1, TD, SEN(epoll_create), "epoll_create" },
[1244] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[1245] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[1246] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[1247] = { 4, TI, SEN(semtimedop), "semtimedop" },
[1248] = { 3, 0, SEN(timer_create), "timer_create" },
[1249] = { 4, 0, SEN(timer_settime), "timer_settime" },
[1250] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[1251] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
[1252] = { 1, 0, SEN(timer_delete), "timer_delete" },
[1253] = { 2, 0, SEN(clock_settime), "clock_settime" },
[1254] = { 2, 0, SEN(clock_gettime), "clock_gettime" },
[1255] = { 2, 0, SEN(clock_getres), "clock_getres" },
[1256] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" },
[1257] = { 3, TD|TFSF|TSFA, SEN(fstatfs64), "fstatfs64" },
[1258] = { 3, TF|TSF|TSFA, SEN(statfs64), "statfs64" },
[1259] = { 6, TM, SEN(mbind), "mbind" },
[1260] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[1261] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[1262] = { 4, TD, SEN(mq_open), "mq_open" },
[1263] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[1264] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[1265] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[1266] = { 2, TD, SEN(mq_notify), "mq_notify" },
[1267] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[1268] = { 4, 0, SEN(kexec_load), "kexec_load" },
[1269] = { 5, 0, SEN(vserver), "vserver" },
[1270] = { 5, TP, SEN(waitid), "waitid" },
[1271] = { 5, 0, SEN(add_key), "add_key" },
[1272] = { 4, 0, SEN(request_key), "request_key" },
[1273] = { 5, 0, SEN(keyctl), "keyctl" },
[1274] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[1275] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[1276] = { 6, TM, SEN(move_pages), "move_pages" },
[1277] = { 0, TD, SEN(inotify_init), "inotify_init" },
[1278] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[1279] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[1280] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[1281] = { 4, TD|TF, SEN(openat), "openat" },
[1282] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },
[1283] = { 4, TD|TF, SEN(mknodat), "mknodat" },
[1284] = { 5, TD|TF, SEN(fchownat), "fchownat" },
[1285] = { 3, TD|TF, SEN(futimesat), "futimesat" },
[1286] = { 4, TD|TF|TFST|TSTA,SEN(newfstatat), "newfstatat" },
[1287] = { 3, TD|TF, SEN(unlinkat), "unlinkat" },
[1288] = { 4, TD|TF, SEN(renameat), "renameat" },
[1289] = { 5, TD|TF, SEN(linkat), "linkat" },
[1290] = { 3, TD|TF, SEN(symlinkat), "symlinkat" },
[1291] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[1292] = { 3, TD|TF, SEN(fchmodat), "fchmodat" },
[1293] = { 3, TD|TF, SEN(faccessat), "faccessat" },
[1294] = { 6, TD, SEN(pselect6), "pselect6" },
[1295] = { 5, TD, SEN(ppoll), "ppoll" },
[1296] = { 1, TP, SEN(unshare), "unshare" },
[1297] = { 6, TD, SEN(splice), "splice" },
[1298] = { 2, 0, SEN(set_robust_list), "set_robust_list" },
[1299] = { 3, 0, SEN(get_robust_list), "get_robust_list" },
[1300] = { 4, TD, SEN(sync_file_range), "sync_file_range" },
[1301] = { 4, TD, SEN(tee), "tee" },
[1302] = { 4, TD, SEN(vmsplice), "vmsplice" },
[1303] = { 4, TD, SEN(fallocate), "fallocate" },
[1304] = { 3, 0, SEN(getcpu), "getcpu" },
[1305] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[1306] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[1307] = { 3, TD|TS, SEN(signalfd), "signalfd" },
[1308] = { 4, TD, SEN(timerfd), "timerfd" },
[1309] = { 1, TD, SEN(eventfd), "eventfd" },
[1310] = { 2, TD, SEN(timerfd_create), "timerfd_create" },
[1311] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" },
[1312] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" },
[1313] = { 4, TD|TS, SEN(signalfd4), "signalfd4" },
[1314] = { 2, TD, SEN(eventfd2), "eventfd2" },
[1315] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[1316] = { 3, TD, SEN(dup3), "dup3" },
[1317] = { 2, TD, SEN(pipe2), "pipe2" },
[1318] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[1319] = { 4, TD, SEN(preadv), "preadv" },
[1320] = { 4, TD, SEN(pwritev), "pwritev" },
[1321] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" },
[1322] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
[1323] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[1324] = { 5, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[1325] = { 4, 0, SEN(prlimit64), "prlimit64" },
[1326] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" },
[1327] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[1328] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[1329] = { 1, TD, SEN(syncfs), "syncfs" },
[1330] = { 2, TD, SEN(setns), "setns" },
[1331] = { 4, TN, SEN(sendmmsg), "sendmmsg" },
[1332] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" },
[1333] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" },
[1334] = { 4, TN, SEN(accept4), "accept4" },
[1335] = { 3, TD, SEN(finit_module), "finit_module" },
[1336] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[1337] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[1338] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[1339] = { 3, 0, SEN(getrandom), "getrandom" },
[1340] = { 2, TD, SEN(memfd_create), "memfd_create" },
[1341] = { 3, TD, SEN(bpf), "bpf" },
[1342] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[1343] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[1344] = { 2, 0, SEN(membarrier), "membarrier" },
[1345] = { 5, 0, SEN(kcmp), "kcmp" },
[1346] = { 3, TM, SEN(mlock2), "mlock2" },
[1347] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[1348] = { 6, TD, SEN(preadv2), "preadv2" },
[1349] = { 6, TD, SEN(pwritev2), "pwritev2" },
[1024 - IA64_SCNO_BASE] = { 0, 0, SEN(printargs), "ni_syscall" },
[1025 - IA64_SCNO_BASE] = { 1, TP|SE, SEN(exit), "exit" },
[1026 - IA64_SCNO_BASE] = { 3, TD, SEN(read), "read" },
[1027 - IA64_SCNO_BASE] = { 3, TD, SEN(write), "write" },
[1028 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(open), "open" },
[1029 - IA64_SCNO_BASE] = { 1, TD, SEN(close), "close" },
[1030 - IA64_SCNO_BASE] = { 2, TD|TF, SEN(creat), "creat" },
[1031 - IA64_SCNO_BASE] = { 2, TF, SEN(link), "link" },
[1032 - IA64_SCNO_BASE] = { 1, TF, SEN(unlink), "unlink" },
[1033 - IA64_SCNO_BASE] = { 3, TF|TP|SE|SI, SEN(execve), "execve" },
[1034 - IA64_SCNO_BASE] = { 1, TF, SEN(chdir), "chdir" },
[1035 - IA64_SCNO_BASE] = { 1, TD, SEN(fchdir), "fchdir" },
[1036 - IA64_SCNO_BASE] = { 2, TF, SEN(utimes), "utimes" },
[1037 - IA64_SCNO_BASE] = { 3, TF, SEN(mknod), "mknod" },
[1038 - IA64_SCNO_BASE] = { 2, TF, SEN(chmod), "chmod" },
[1039 - IA64_SCNO_BASE] = { 3, TF, SEN(chown), "chown" },
[1040 - IA64_SCNO_BASE] = { 3, TD, SEN(lseek), "lseek" },
[1041 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(getpid), "getpid" },
[1042 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(getppid), "getppid" },
[1043 - IA64_SCNO_BASE] = { 5, TF, SEN(mount), "mount" },
[1044 - IA64_SCNO_BASE] = { 2, TF, SEN(umount2), "umount" },
[1045 - IA64_SCNO_BASE] = { 1, 0, SEN(setuid), "setuid" },
[1046 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(getuid), "getuid" },
[1047 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[1048 - IA64_SCNO_BASE] = { 4, 0, SEN(ptrace), "ptrace" },
[1049 - IA64_SCNO_BASE] = { 2, TF, SEN(access), "access" },
[1050 - IA64_SCNO_BASE] = { 0, 0, SEN(sync), "sync" },
[1051 - IA64_SCNO_BASE] = { 1, TD, SEN(fsync), "fsync" },
[1052 - IA64_SCNO_BASE] = { 1, TD, SEN(fdatasync), "fdatasync" },
[1053 - IA64_SCNO_BASE] = { 2, TS, SEN(kill), "kill" },
[1054 - IA64_SCNO_BASE] = { 2, TF, SEN(rename), "rename" },
[1055 - IA64_SCNO_BASE] = { 2, TF, SEN(mkdir), "mkdir" },
[1056 - IA64_SCNO_BASE] = { 1, TF, SEN(rmdir), "rmdir" },
[1057 - IA64_SCNO_BASE] = { 1, TD, SEN(dup), "dup" },
[1058 - IA64_SCNO_BASE] = { 0, TD, SEN(pipe), "pipe" },
[1059 - IA64_SCNO_BASE] = { 1, 0, SEN(times), "times" },
[1060 - IA64_SCNO_BASE] = { 1, TM|SI, SEN(brk), "brk" },
[1061 - IA64_SCNO_BASE] = { 1, 0, SEN(setgid), "setgid" },
[1062 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(getgid), "getgid" },
[1063 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(getegid), "getegid" },
[1064 - IA64_SCNO_BASE] = { 1, TF, SEN(acct), "acct" },
[1065 - IA64_SCNO_BASE] = { 3, TD, SEN(ioctl), "ioctl" },
[1066 - IA64_SCNO_BASE] = { 3, TD, SEN(fcntl), "fcntl" },
[1067 - IA64_SCNO_BASE] = { 1, NF, SEN(umask), "umask" },
[1068 - IA64_SCNO_BASE] = { 1, TF, SEN(chroot), "chroot" },
[1069 - IA64_SCNO_BASE] = { 2, TSFA, SEN(ustat), "ustat" },
[1070 - IA64_SCNO_BASE] = { 2, TD, SEN(dup2), "dup2" },
[1071 - IA64_SCNO_BASE] = { 2, 0, SEN(setreuid), "setreuid" },
[1072 - IA64_SCNO_BASE] = { 2, 0, SEN(setregid), "setregid" },
[1073 - IA64_SCNO_BASE] = { 3, 0, SEN(getresuid), "getresuid" },
[1074 - IA64_SCNO_BASE] = { 3, 0, SEN(setresuid), "setresuid" },
[1075 - IA64_SCNO_BASE] = { 3, 0, SEN(getresgid), "getresgid" },
[1076 - IA64_SCNO_BASE] = { 3, 0, SEN(setresgid), "setresgid" },
[1077 - IA64_SCNO_BASE] = { 2, 0, SEN(getgroups), "getgroups" },
[1078 - IA64_SCNO_BASE] = { 2, 0, SEN(setgroups), "setgroups" },
[1079 - IA64_SCNO_BASE] = { 1, 0, SEN(getpgid), "getpgid" },
[1080 - IA64_SCNO_BASE] = { 2, 0, SEN(setpgid), "setpgid" },
[1081 - IA64_SCNO_BASE] = { 0, 0, SEN(setsid), "setsid" },
[1082 - IA64_SCNO_BASE] = { 1, 0, SEN(getsid), "getsid" },
[1083 - IA64_SCNO_BASE] = { 2, 0, SEN(sethostname), "sethostname" },
[1084 - IA64_SCNO_BASE] = { 2, 0, SEN(setrlimit), "setrlimit" },
[1085 - IA64_SCNO_BASE] = { 2, 0, SEN(getrlimit), "getrlimit" },
[1086 - IA64_SCNO_BASE] = { 2, 0, SEN(getrusage), "getrusage" },
[1087 - IA64_SCNO_BASE] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[1088 - IA64_SCNO_BASE] = { 2, 0, SEN(settimeofday), "settimeofday" },
[1089 - IA64_SCNO_BASE] = { 5, TD, SEN(select), "select" },
[1090 - IA64_SCNO_BASE] = { 3, TD, SEN(poll), "poll" },
[1091 - IA64_SCNO_BASE] = { 2, TF, SEN(symlink), "symlink" },
[1092 - IA64_SCNO_BASE] = { 3, TF, SEN(readlink), "readlink" },
[1093 - IA64_SCNO_BASE] = { 1, TF, SEN(uselib), "uselib" },
[1094 - IA64_SCNO_BASE] = { 2, TF, SEN(swapon), "swapon" },
[1095 - IA64_SCNO_BASE] = { 1, TF, SEN(swapoff), "swapoff" },
[1096 - IA64_SCNO_BASE] = { 4, 0, SEN(reboot), "reboot" },
[1097 - IA64_SCNO_BASE] = { 2, TF, SEN(truncate), "truncate" },
[1098 - IA64_SCNO_BASE] = { 2, TD, SEN(ftruncate), "ftruncate" },
[1099 - IA64_SCNO_BASE] = { 2, TD, SEN(fchmod), "fchmod" },
[1100 - IA64_SCNO_BASE] = { 3, TD, SEN(fchown), "fchown" },
[1101 - IA64_SCNO_BASE] = { 2, 0, SEN(getpriority), "getpriority" },
[1102 - IA64_SCNO_BASE] = { 3, 0, SEN(setpriority), "setpriority" },
[1103 - IA64_SCNO_BASE] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" },
[1104 - IA64_SCNO_BASE] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" },
[1105 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(gettid), "gettid" },
[1106 - IA64_SCNO_BASE] = { 3, TI, SEN(semget), "semget" },
[1107 - IA64_SCNO_BASE] = { 3, TI, SEN(semop), "semop" },
[1108 - IA64_SCNO_BASE] = { 4, TI, SEN(semctl), "semctl" },
[1109 - IA64_SCNO_BASE] = { 2, TI, SEN(msgget), "msgget" },
[1110 - IA64_SCNO_BASE] = { 4, TI, SEN(msgsnd), "msgsnd" },
[1111 - IA64_SCNO_BASE] = { 5, TI, SEN(msgrcv), "msgrcv" },
[1112 - IA64_SCNO_BASE] = { 3, TI, SEN(msgctl), "msgctl" },
[1113 - IA64_SCNO_BASE] = { 3, TI, SEN(shmget), "shmget" },
[1114 - IA64_SCNO_BASE] = { 3, TI|TM|SI, SEN(shmat), "shmat" },
[1115 - IA64_SCNO_BASE] = { 1, TI|TM|SI, SEN(shmdt), "shmdt" },
[1116 - IA64_SCNO_BASE] = { 3, TI, SEN(shmctl), "shmctl" },
[1117 - IA64_SCNO_BASE] = { 3, 0, SEN(syslog), "syslog" },
[1118 - IA64_SCNO_BASE] = { 3, 0, SEN(setitimer), "setitimer" },
[1119 - IA64_SCNO_BASE] = { 2, 0, SEN(getitimer), "getitimer" },
[1120 - IA64_SCNO_BASE] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
[1121 - IA64_SCNO_BASE] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" },
[1122 - IA64_SCNO_BASE] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[1123 - IA64_SCNO_BASE] = { 0, 0, SEN(vhangup), "vhangup" },
[1124 - IA64_SCNO_BASE] = { 3, TF, SEN(chown), "lchown" },
[1125 - IA64_SCNO_BASE] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[1126 - IA64_SCNO_BASE] = { 4, TP, SEN(wait4), "wait4" },
[1127 - IA64_SCNO_BASE] = { 1, 0, SEN(sysinfo), "sysinfo" },
[1128 - IA64_SCNO_BASE] = { 5, TP, SEN(clone), "clone" },
[1129 - IA64_SCNO_BASE] = { 2, 0, SEN(setdomainname), "setdomainname" },
[1130 - IA64_SCNO_BASE] = { 1, 0, SEN(uname), "uname" },
[1131 - IA64_SCNO_BASE] = { 1, 0, SEN(adjtimex), "adjtimex" },
[1132 - IA64_SCNO_BASE] = { 2, 0, SEN(create_module), "create_module" },
[1133 - IA64_SCNO_BASE] = { 3, 0, SEN(init_module), "init_module" },
[1134 - IA64_SCNO_BASE] = { 2, 0, SEN(delete_module), "delete_module" },
[1135 - IA64_SCNO_BASE] = { 1, 0, SEN(get_kernel_syms), "get_kernel_syms" },
[1136 - IA64_SCNO_BASE] = { 5, 0, SEN(query_module), "query_module" },
[1137 - IA64_SCNO_BASE] = { 4, TF, SEN(quotactl), "quotactl" },
[1138 - IA64_SCNO_BASE] = { 2, 0, SEN(bdflush), "bdflush" },
[1139 - IA64_SCNO_BASE] = { 3, 0, SEN(sysfs), "sysfs" },
[1140 - IA64_SCNO_BASE] = { 1, NF, SEN(personality), "personality" },
[1141 - IA64_SCNO_BASE] = { 5, 0, SEN(afs_syscall), "afs_syscall" },
[1142 - IA64_SCNO_BASE] = { 1, NF, SEN(setfsuid), "setfsuid" },
[1143 - IA64_SCNO_BASE] = { 1, NF, SEN(setfsgid), "setfsgid" },
[1144 - IA64_SCNO_BASE] = { 3, TD, SEN(getdents), "getdents" },
[1145 - IA64_SCNO_BASE] = { 2, TD, SEN(flock), "flock" },
[1146 - IA64_SCNO_BASE] = { 3, TD, SEN(readv), "readv" },
[1147 - IA64_SCNO_BASE] = { 3, TD, SEN(writev), "writev" },
[1148 - IA64_SCNO_BASE] = { 4, TD, SEN(pread), "pread64" },
[1149 - IA64_SCNO_BASE] = { 4, TD, SEN(pwrite), "pwrite64" },
[1150 - IA64_SCNO_BASE] = { 1, 0, SEN(printargs), "_sysctl" },
[1151 - IA64_SCNO_BASE] = { 6, TD|TM|SI, SEN(mmap), "mmap" },
[1152 - IA64_SCNO_BASE] = { 2, TM|SI, SEN(munmap), "munmap" },
[1153 - IA64_SCNO_BASE] = { 2, TM, SEN(mlock), "mlock" },
[1154 - IA64_SCNO_BASE] = { 1, TM, SEN(mlockall), "mlockall" },
[1155 - IA64_SCNO_BASE] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[1156 - IA64_SCNO_BASE] = { 5, TM|SI, SEN(mremap), "mremap" },
[1157 - IA64_SCNO_BASE] = { 3, TM, SEN(msync), "msync" },
[1158 - IA64_SCNO_BASE] = { 2, TM, SEN(munlock), "munlock" },
[1159 - IA64_SCNO_BASE] = { 0, TM, SEN(munlockall), "munlockall" },
[1160 - IA64_SCNO_BASE] = { 2, 0, SEN(sched_getparam), "sched_getparam" },
[1161 - IA64_SCNO_BASE] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
[1162 - IA64_SCNO_BASE] = { 1, 0, SEN(sched_getscheduler), "sched_getscheduler" },
[1163 - IA64_SCNO_BASE] = { 3, 0, SEN(sched_setscheduler), "sched_setscheduler" },
[1164 - IA64_SCNO_BASE] = { 0, 0, SEN(sched_yield), "sched_yield" },
[1165 - IA64_SCNO_BASE] = { 1, 0, SEN(sched_get_priority_max), "sched_get_priority_max"},
[1166 - IA64_SCNO_BASE] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"},
[1167 - IA64_SCNO_BASE] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" },
[1168 - IA64_SCNO_BASE] = { 2, 0, SEN(nanosleep), "nanosleep" },
[1169 - IA64_SCNO_BASE] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[1170 - IA64_SCNO_BASE] = { 5, 0, SEN(prctl), "prctl" },
[1171 - IA64_SCNO_BASE] = { 0, PU|NF, SEN(getpagesize), "getpagesize" },
[1172 - IA64_SCNO_BASE] = { 6, TD|TM|SI, SEN(mmap_pgoff), "mmap2" },
[1173 - IA64_SCNO_BASE] = { 5, 0, SEN(printargs), "pciconfig_read" },
[1174 - IA64_SCNO_BASE] = { 5, 0, SEN(printargs), "pciconfig_write" },
[1175 - IA64_SCNO_BASE] = { MA, 0, SEN(printargs), "perfmonctl" },
[1176 - IA64_SCNO_BASE] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[1177 - IA64_SCNO_BASE] = { 4, TS, SEN(rt_sigaction), "rt_sigaction" },
[1178 - IA64_SCNO_BASE] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" },
[1179 - IA64_SCNO_BASE] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[1180 - IA64_SCNO_BASE] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" },
[1181 - IA64_SCNO_BASE] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
[1182 - IA64_SCNO_BASE] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[1183 - IA64_SCNO_BASE] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" },
[1184 - IA64_SCNO_BASE] = { 2, TF, SEN(getcwd), "getcwd" },
[1185 - IA64_SCNO_BASE] = { 2, 0, SEN(capget), "capget" },
[1186 - IA64_SCNO_BASE] = { 2, 0, SEN(capset), "capset" },
[1187 - IA64_SCNO_BASE] = { 4, TD|TN, SEN(sendfile), "sendfile" },
[1188 - IA64_SCNO_BASE] = { 5, TN, SEN(getpmsg), "getpmsg" },
[1189 - IA64_SCNO_BASE] = { 5, TN, SEN(putpmsg), "putpmsg" },
[1190 - IA64_SCNO_BASE] = { 3, TN, SEN(socket), "socket" },
[1191 - IA64_SCNO_BASE] = { 3, TN, SEN(bind), "bind" },
[1192 - IA64_SCNO_BASE] = { 3, TN, SEN(connect), "connect" },
[1193 - IA64_SCNO_BASE] = { 2, TN, SEN(listen), "listen" },
[1194 - IA64_SCNO_BASE] = { 3, TN, SEN(accept), "accept" },
[1195 - IA64_SCNO_BASE] = { 3, TN, SEN(getsockname), "getsockname" },
[1196 - IA64_SCNO_BASE] = { 3, TN, SEN(getpeername), "getpeername" },
[1197 - IA64_SCNO_BASE] = { 4, TN, SEN(socketpair), "socketpair" },
[1198 - IA64_SCNO_BASE] = { 4, TN, SEN(send), "send" },
[1199 - IA64_SCNO_BASE] = { 6, TN, SEN(sendto), "sendto" },
[1200 - IA64_SCNO_BASE] = { 4, TN, SEN(recv), "recv" },
[1201 - IA64_SCNO_BASE] = { 6, TN, SEN(recvfrom), "recvfrom" },
[1202 - IA64_SCNO_BASE] = { 2, TN, SEN(shutdown), "shutdown" },
[1203 - IA64_SCNO_BASE] = { 5, TN, SEN(setsockopt), "setsockopt" },
[1204 - IA64_SCNO_BASE] = { 5, TN, SEN(getsockopt), "getsockopt" },
[1205 - IA64_SCNO_BASE] = { 3, TN, SEN(sendmsg), "sendmsg" },
[1206 - IA64_SCNO_BASE] = { 3, TN, SEN(recvmsg), "recvmsg" },
[1207 - IA64_SCNO_BASE] = { 2, TF, SEN(pivotroot), "pivot_root" },
[1208 - IA64_SCNO_BASE] = { 3, TM, SEN(mincore), "mincore" },
[1209 - IA64_SCNO_BASE] = { 3, TM, SEN(madvise), "madvise" },
[1210 - IA64_SCNO_BASE] = { 2, TF|TST|TSTA, SEN(stat), "stat" },
[1211 - IA64_SCNO_BASE] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" },
[1212 - IA64_SCNO_BASE] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[1213 - IA64_SCNO_BASE] = { 6, TP, SEN(clone), "clone2" },
[1214 - IA64_SCNO_BASE] = { 3, TD, SEN(getdents64), "getdents64" },
[1215 - IA64_SCNO_BASE] = { 2, 0, SEN(printargs), "getunwind" },
[1216 - IA64_SCNO_BASE] = { 3, TD, SEN(readahead), "readahead" },
[1217 - IA64_SCNO_BASE] = { 5, TF, SEN(setxattr), "setxattr" },
[1218 - IA64_SCNO_BASE] = { 5, TF, SEN(setxattr), "lsetxattr" },
[1219 - IA64_SCNO_BASE] = { 5, TD, SEN(fsetxattr), "fsetxattr" },
[1220 - IA64_SCNO_BASE] = { 4, TF, SEN(getxattr), "getxattr" },
[1221 - IA64_SCNO_BASE] = { 4, TF, SEN(getxattr), "lgetxattr" },
[1222 - IA64_SCNO_BASE] = { 4, TD, SEN(fgetxattr), "fgetxattr" },
[1223 - IA64_SCNO_BASE] = { 3, TF, SEN(listxattr), "listxattr" },
[1224 - IA64_SCNO_BASE] = { 3, TF, SEN(listxattr), "llistxattr" },
[1225 - IA64_SCNO_BASE] = { 3, TD, SEN(flistxattr), "flistxattr" },
[1226 - IA64_SCNO_BASE] = { 2, TF, SEN(removexattr), "removexattr" },
[1227 - IA64_SCNO_BASE] = { 2, TF, SEN(removexattr), "lremovexattr" },
[1228 - IA64_SCNO_BASE] = { 2, TD, SEN(fremovexattr), "fremovexattr" },
[1229 - IA64_SCNO_BASE] = { 2, TS, SEN(kill), "tkill" },
[1230 - IA64_SCNO_BASE] = { 6, 0, SEN(futex), "futex" },
[1231 - IA64_SCNO_BASE] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[1232 - IA64_SCNO_BASE] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[1233 - IA64_SCNO_BASE] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[1234 - IA64_SCNO_BASE] = { 4, TD, SEN(fadvise64), "fadvise64" },
[1235 - IA64_SCNO_BASE] = { 3, TS, SEN(tgkill), "tgkill" },
[1236 - IA64_SCNO_BASE] = { 1, TP|SE, SEN(exit), "exit_group" },
[1237 - IA64_SCNO_BASE] = { 3, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[1238 - IA64_SCNO_BASE] = { 2, TM, SEN(io_setup), "io_setup" },
[1239 - IA64_SCNO_BASE] = { 1, TM, SEN(io_destroy), "io_destroy" },
[1240 - IA64_SCNO_BASE] = { 5, 0, SEN(io_getevents), "io_getevents" },
[1241 - IA64_SCNO_BASE] = { 3, 0, SEN(io_submit), "io_submit" },
[1242 - IA64_SCNO_BASE] = { 3, 0, SEN(io_cancel), "io_cancel" },
[1243 - IA64_SCNO_BASE] = { 1, TD, SEN(epoll_create), "epoll_create" },
[1244 - IA64_SCNO_BASE] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[1245 - IA64_SCNO_BASE] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[1246 - IA64_SCNO_BASE] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[1247 - IA64_SCNO_BASE] = { 4, TI, SEN(semtimedop), "semtimedop" },
[1248 - IA64_SCNO_BASE] = { 3, 0, SEN(timer_create), "timer_create" },
[1249 - IA64_SCNO_BASE] = { 4, 0, SEN(timer_settime), "timer_settime" },
[1250 - IA64_SCNO_BASE] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[1251 - IA64_SCNO_BASE] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
[1252 - IA64_SCNO_BASE] = { 1, 0, SEN(timer_delete), "timer_delete" },
[1253 - IA64_SCNO_BASE] = { 2, 0, SEN(clock_settime), "clock_settime" },
[1254 - IA64_SCNO_BASE] = { 2, 0, SEN(clock_gettime), "clock_gettime" },
[1255 - IA64_SCNO_BASE] = { 2, 0, SEN(clock_getres), "clock_getres" },
[1256 - IA64_SCNO_BASE] = { 4, 0, SEN(clock_nanosleep), "clock_nanosleep" },
[1257 - IA64_SCNO_BASE] = { 3, TD|TFSF|TSFA, SEN(fstatfs64), "fstatfs64" },
[1258 - IA64_SCNO_BASE] = { 3, TF|TSF|TSFA, SEN(statfs64), "statfs64" },
[1259 - IA64_SCNO_BASE] = { 6, TM, SEN(mbind), "mbind" },
[1260 - IA64_SCNO_BASE] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
[1261 - IA64_SCNO_BASE] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[1262 - IA64_SCNO_BASE] = { 4, TD, SEN(mq_open), "mq_open" },
[1263 - IA64_SCNO_BASE] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[1264 - IA64_SCNO_BASE] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[1265 - IA64_SCNO_BASE] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[1266 - IA64_SCNO_BASE] = { 2, TD, SEN(mq_notify), "mq_notify" },
[1267 - IA64_SCNO_BASE] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[1268 - IA64_SCNO_BASE] = { 4, 0, SEN(kexec_load), "kexec_load" },
[1269 - IA64_SCNO_BASE] = { 5, 0, SEN(vserver), "vserver" },
[1270 - IA64_SCNO_BASE] = { 5, TP, SEN(waitid), "waitid" },
[1271 - IA64_SCNO_BASE] = { 5, 0, SEN(add_key), "add_key" },
[1272 - IA64_SCNO_BASE] = { 4, 0, SEN(request_key), "request_key" },
[1273 - IA64_SCNO_BASE] = { 5, 0, SEN(keyctl), "keyctl" },
[1274 - IA64_SCNO_BASE] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[1275 - IA64_SCNO_BASE] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[1276 - IA64_SCNO_BASE] = { 6, TM, SEN(move_pages), "move_pages" },
[1277 - IA64_SCNO_BASE] = { 0, TD, SEN(inotify_init), "inotify_init" },
[1278 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[1279 - IA64_SCNO_BASE] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[1280 - IA64_SCNO_BASE] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[1281 - IA64_SCNO_BASE] = { 4, TD|TF, SEN(openat), "openat" },
[1282 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },
[1283 - IA64_SCNO_BASE] = { 4, TD|TF, SEN(mknodat), "mknodat" },
[1284 - IA64_SCNO_BASE] = { 5, TD|TF, SEN(fchownat), "fchownat" },
[1285 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(futimesat), "futimesat" },
[1286 - IA64_SCNO_BASE] = { 4, TD|TF|TFST|TSTA,SEN(newfstatat), "newfstatat" },
[1287 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(unlinkat), "unlinkat" },
[1288 - IA64_SCNO_BASE] = { 4, TD|TF, SEN(renameat), "renameat" },
[1289 - IA64_SCNO_BASE] = { 5, TD|TF, SEN(linkat), "linkat" },
[1290 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(symlinkat), "symlinkat" },
[1291 - IA64_SCNO_BASE] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[1292 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(fchmodat), "fchmodat" },
[1293 - IA64_SCNO_BASE] = { 3, TD|TF, SEN(faccessat), "faccessat" },
[1294 - IA64_SCNO_BASE] = { 6, TD, SEN(pselect6), "pselect6" },
[1295 - IA64_SCNO_BASE] = { 5, TD, SEN(ppoll), "ppoll" },
[1296 - IA64_SCNO_BASE] = { 1, TP, SEN(unshare), "unshare" },
[1297 - IA64_SCNO_BASE] = { 6, TD, SEN(splice), "splice" },
[1298 - IA64_SCNO_BASE] = { 2, 0, SEN(set_robust_list), "set_robust_list" },
[1299 - IA64_SCNO_BASE] = { 3, 0, SEN(get_robust_list), "get_robust_list" },
[1300 - IA64_SCNO_BASE] = { 4, TD, SEN(sync_file_range), "sync_file_range" },
[1301 - IA64_SCNO_BASE] = { 4, TD, SEN(tee), "tee" },
[1302 - IA64_SCNO_BASE] = { 4, TD, SEN(vmsplice), "vmsplice" },
[1303 - IA64_SCNO_BASE] = { 4, TD, SEN(fallocate), "fallocate" },
[1304 - IA64_SCNO_BASE] = { 3, 0, SEN(getcpu), "getcpu" },
[1305 - IA64_SCNO_BASE] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[1306 - IA64_SCNO_BASE] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[1307 - IA64_SCNO_BASE] = { 3, TD|TS, SEN(signalfd), "signalfd" },
[1308 - IA64_SCNO_BASE] = { 4, TD, SEN(timerfd), "timerfd" },
[1309 - IA64_SCNO_BASE] = { 1, TD, SEN(eventfd), "eventfd" },
[1310 - IA64_SCNO_BASE] = { 2, TD, SEN(timerfd_create), "timerfd_create" },
[1311 - IA64_SCNO_BASE] = { 4, TD, SEN(timerfd_settime), "timerfd_settime" },
[1312 - IA64_SCNO_BASE] = { 2, TD, SEN(timerfd_gettime), "timerfd_gettime" },
[1313 - IA64_SCNO_BASE] = { 4, TD|TS, SEN(signalfd4), "signalfd4" },
[1314 - IA64_SCNO_BASE] = { 2, TD, SEN(eventfd2), "eventfd2" },
[1315 - IA64_SCNO_BASE] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[1316 - IA64_SCNO_BASE] = { 3, TD, SEN(dup3), "dup3" },
[1317 - IA64_SCNO_BASE] = { 2, TD, SEN(pipe2), "pipe2" },
[1318 - IA64_SCNO_BASE] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[1319 - IA64_SCNO_BASE] = { 4, TD, SEN(preadv), "preadv" },
[1320 - IA64_SCNO_BASE] = { 4, TD, SEN(pwritev), "pwritev" },
[1321 - IA64_SCNO_BASE] = { 4, TP|TS, SEN(rt_tgsigqueueinfo), "rt_tgsigqueueinfo" },
[1322 - IA64_SCNO_BASE] = { 5, TN, SEN(recvmmsg), "recvmmsg" },
[1323 - IA64_SCNO_BASE] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[1324 - IA64_SCNO_BASE] = { 5, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[1325 - IA64_SCNO_BASE] = { 4, 0, SEN(prlimit64), "prlimit64" },
[1326 - IA64_SCNO_BASE] = { 5, TD|TF, SEN(name_to_handle_at), "name_to_handle_at" },
[1327 - IA64_SCNO_BASE] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[1328 - IA64_SCNO_BASE] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[1329 - IA64_SCNO_BASE] = { 1, TD, SEN(syncfs), "syncfs" },
[1330 - IA64_SCNO_BASE] = { 2, TD, SEN(setns), "setns" },
[1331 - IA64_SCNO_BASE] = { 4, TN, SEN(sendmmsg), "sendmmsg" },
[1332 - IA64_SCNO_BASE] = { 6, 0, SEN(process_vm_readv), "process_vm_readv" },
[1333 - IA64_SCNO_BASE] = { 6, 0, SEN(process_vm_writev), "process_vm_writev" },
[1334 - IA64_SCNO_BASE] = { 4, TN, SEN(accept4), "accept4" },
[1335 - IA64_SCNO_BASE] = { 3, TD, SEN(finit_module), "finit_module" },
[1336 - IA64_SCNO_BASE] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[1337 - IA64_SCNO_BASE] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[1338 - IA64_SCNO_BASE] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[1339 - IA64_SCNO_BASE] = { 3, 0, SEN(getrandom), "getrandom" },
[1340 - IA64_SCNO_BASE] = { 2, TD, SEN(memfd_create), "memfd_create" },
[1341 - IA64_SCNO_BASE] = { 3, TD, SEN(bpf), "bpf" },
[1342 - IA64_SCNO_BASE] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[1343 - IA64_SCNO_BASE] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[1344 - IA64_SCNO_BASE] = { 2, 0, SEN(membarrier), "membarrier" },
[1345 - IA64_SCNO_BASE] = { 5, 0, SEN(kcmp), "kcmp" },
[1346 - IA64_SCNO_BASE] = { 3, TM, SEN(mlock2), "mlock2" },
[1347 - IA64_SCNO_BASE] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[1348 - IA64_SCNO_BASE] = { 6, TD, SEN(preadv2), "preadv2" },
[1349 - IA64_SCNO_BASE] = { 6, TD, SEN(pwritev2), "pwritev2" },

View File

@ -109,6 +109,7 @@ enum {
INET_DIAG_MARK,
INET_DIAG_BBRINFO,
INET_DIAG_CLASS_ID,
INET_DIAG_MD5SIG,
};
/* INET_DIAG_MEM */
@ -145,4 +146,15 @@ struct tcp_bbr_info {
uint32_t bbr_cwnd_gain;
};
/* INET_DIAG_MD5SIG */
#define TCP_MD5SIG_MAXKEYLEN 80
struct tcp_diag_md5sig {
uint8_t tcpm_family;
uint8_t tcpm_prefixlen;
uint16_t tcpm_keylen;
uint32_t tcpm_addr[4]; /* big endian */
uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
};
#endif /* !STRACE_LINUX_INET_DIAG_H */

View File

@ -103,7 +103,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -103,7 +103,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -0,0 +1 @@
_("EWOULDBLOCK", "EAGAIN"),

View File

@ -0,0 +1,4 @@
_("SIGPOLL", "SIGIO"),
_("SIGUNUSED", "31"),
_("SIGINFO", "SIGPWR"),
_("SIGABRT, ""SIGIOT"),

View File

@ -18,6 +18,9 @@ get_syscall_args(struct tcb *tcp)
&& umoven(tcp, mips_REG_SP + 4 * sizeof(tcp->u_arg[0]),
(tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
&tcp->u_arg[4]) < 0) {
error_msg("pid %d: can't fetch syscall arguments 5 and 6 from "
"tracee's memory", tcp->pid);
/*
* Let's proceed with the first 4 arguments
* instead of reporting the failure.

View File

@ -222,7 +222,7 @@
[4218] = { 3, TM, SEN(madvise), "madvise" },
[4219] = { 3, TD, SEN(getdents64), "getdents64" },
[4220] = { 3, TD, SEN(fcntl64), "fcntl64" },
[4221] = { },
[4221] = { 0, 0, SEN(printargs), "reserved221" },
[4222] = { 0, PU|NF, SEN(gettid), "gettid" },
[4223] = { 5, TD, SEN(readahead), "readahead" },
[4224] = { 5, TF, SEN(setxattr), "setxattr" },

View File

@ -0,0 +1,2 @@
_("EWOULDBLOCK", "EAGAIN"),
_("ENOTSUP", "EOPNOTSUPP"),

View File

@ -1,3 +1,4 @@
#define HAVE_ARCH_OLD_SELECT 1
#define HAVE_ARCH_DEDICATED_ERR_REG 1
#define CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL 1
#define HAVE_ARCH_UNALIGNED_ACCESS 0

View File

@ -103,7 +103,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -0,0 +1 @@
#include "powerpc/alt_errnoent.h"

View File

@ -1,3 +1,4 @@
#define HAVE_ARCH_OLD_SELECT 1
#define SUPPORTED_PERSONALITIES 2
#define HAVE_ARCH_DEDICATED_ERR_REG 1
#define HAVE_ARCH_UNALIGNED_ACCESS 0

View File

@ -105,7 +105,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -105,7 +105,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -103,7 +103,7 @@
[ 73] = { 1, TS, SEN(sigpending), "sigpending" },
[ 74] = { 2, 0, SEN(sethostname), "sethostname" },
[ 75] = { 2, 0, SEN(setrlimit), "setrlimit" },
[ 76] = { 2, 0, SEN(getrlimit), "getrlimit" },
[ 76] = { 2, 0, SEN(old_getrlimit), "getrlimit" },
[ 77] = { 2, 0, SEN(getrusage), "getrusage" },
[ 78] = { 2, 0, SEN(gettimeofday), "gettimeofday" },
[ 79] = { 2, 0, SEN(settimeofday), "settimeofday" },

View File

@ -16,7 +16,10 @@ struct smc_diag_req {
struct smc_diag_msg {
uint8_t diag_family;
uint8_t diag_state;
uint8_t diag_fallback;
union {
uint8_t diag_fallback;
uint8_t diag_mode;
};
uint8_t diag_shutdown;
struct inet_diag_sockid id;

View File

@ -0,0 +1 @@
_("EWOULDBLOCK", "EAGAIN"),

View File

@ -0,0 +1,4 @@
_("SIGPOLL", "SIGIO"),
_("SIGUNUSED", "31"),
_("SIGPWR", "SIGLOST"),
_("SIGIOT", "SIGABRT"),

View File

@ -3,3 +3,4 @@
#define HAVE_ARCH_SA_RESTORER 1
#define HAVE_ARCH_DEDICATED_ERR_REG 1
#define CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL 1
#define HAVE_ARCH_UNALIGNED_ACCESS 0

View File

@ -0,0 +1 @@
#include "sparc/alt_signalent.h"

View File

@ -38,12 +38,18 @@
extern SYS_FUNC(chown16);
extern SYS_FUNC(fchown16);
extern SYS_FUNC(getgroups16);
extern SYS_FUNC(getresgid16);
extern SYS_FUNC(getresuid16);
extern SYS_FUNC(getgid16);
extern SYS_FUNC(getuid16);
extern SYS_FUNC(setfsgid16);
extern SYS_FUNC(setfsuid16);
extern SYS_FUNC(setgroups16);
extern SYS_FUNC(setresgid16);
extern SYS_FUNC(setresuid16);
extern SYS_FUNC(setregid16);
extern SYS_FUNC(setreuid16);
extern SYS_FUNC(setgid16);
extern SYS_FUNC(setuid16);
#endif /* HAVE_ARCH_UID16_SYSCALLS */

6
loop.c
View File

@ -37,7 +37,11 @@ typedef struct loop_info struct_loop_info;
#include MPERS_DEFS
#include "print_fields.h"
#include "xlat/loop_cmds.h"
#define XLAT_MACROS_ONLY
# include "xlat/loop_cmds.h"
#undef XLAT_MACROS_ONLY
#include "xlat/loop_flags_options.h"
#include "xlat/loop_crypt_type_options.h"

21
m4/gen_ptp_clock_m4.awk Normal file
View File

@ -0,0 +1,21 @@
/^struct (strace_ptp_[^[:space:]]+)[[:space:]]+{/ {
match($0, /^struct strace_(ptp_[^[:space:]]+)[[:space:]]+{/, a)
struct_name = a[1]
prefix = "struct " struct_name
in_struct = 1
next
}
/^};/ {
in_struct = 0
next
}
(in_struct == 1) {
if (match($0, /^[[:space:]]+([^;\[\]]+[[:space:]]+)+([^[:space:]\[\];]+)(\[[^;]*\])?;$/, a)) {
print "\t\t" prefix "." a[2] ","
}
}

43
m4/gen_ptp_clock_m4.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh -efu
# Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
input=ptp_clock.h
output="${0%/*}"/ptp_clock.m4
exec > "$output"
cat <<EOF
dnl Generated by $0 from $input; do not edit.
AC_DEFUN([st_PTP_CLOCK], [dnl
AC_CHECK_MEMBERS(m4_normalize([
EOF
gawk -f "${0%/*}"/gen_ptp_clock_m4.awk < "$input" | sort -u
cat <<'EOF'
struct ptp_clock_dummy.dummy
]),,, [#include <linux/ptp_clock.h>])
])
EOF

View File

@ -48,6 +48,10 @@
#endif
#define CLAMP(val, min, max) MIN(MAX(min, val), max)
#ifndef ROUNDUP
# define ROUNDUP(val_, div_) ((((val_) + (div_) - 1) / (div_)) * (div_))
#endif
#ifndef offsetofend
# define offsetofend(type_, member_) \
(offsetof(type_, member_) + sizeof(((type_ *)0)->member_))

View File

@ -129,7 +129,7 @@ while read name_ rest; do
printf '%s\n' "$name_ $rest"
continue ;;
esac
sed -rn 's/#define[[:space:]]+('"$name_"')[[:space:]]+([x[:xdigit:]]+).*$/\2\t\1/p' \
sed -rn 's/#[[:space:]]*define[[:space:]]+('"$name_"')[[:space:]]+([x[:xdigit:]]+).*$/\2\t\1/p' \
$LINUX_SRC/include/uapi/$COMMON_DEFS_GLOB_PATTERN |
sort -n | {
def=
@ -143,7 +143,7 @@ while read name_ rest; do
name="$name_"
fi
grep -oEH '#define[[:space:]]+'"$name"'[[:space:]]+(0x[[:xdigit:]]+|[[:digit:]]+)' \
grep -oEH '#[[:space:]]*define[[:space:]]+'"$name"'[[:space:]]+(0x[[:xdigit:]]+|[[:digit:]]+)' \
$LINUX_SRC/arch/*/include/uapi/$ARCH_DEFS_FILE |
sed -rn 's|^[^#]*/arch/([^/]+)/include/uapi/'"$ARCH_DEFS_FILE"':#define[[:space:]]+'"$name"'[[:space:]]+([^[:space:]]+)([[:space:]].*)?$|\1\t\2|p' |
sed s/parisc/hppa/ |

View File

@ -94,7 +94,7 @@ delete_mmap_cache(struct tcb *tcp, const char *caller)
* e.g. mmap, mprotect, munmap, execve.
*/
extern enum mmap_cache_rebuild_result
mmap_cache_rebuild_if_invalid(struct tcb *tcp, const char *caller)
mmap_cache_rebuild_if_invalid_(struct tcb *tcp, const char *caller)
{
if (tcp->mmap_cache
&& tcp->mmap_cache->generation != mmap_cache_generation)
@ -245,3 +245,18 @@ mmap_cache_search_custom(struct tcb *tcp, mmap_cache_search_fn fn, void *data)
}
return NULL;
}
void
mmap_cache_free_(struct tcb *tcp, const char *caller)
{
if (!tcp->mmap_cache)
return;
if (!tcp->mmap_cache->free_fn) {
error_func_msg("pid %d: mmap_cache has NULL free_fn "
"(called from %s)", tcp->pid, caller);
return;
}
tcp->mmap_cache->free_fn(tcp, caller);
}

View File

@ -79,7 +79,9 @@ extern void
mmap_cache_enable(void);
extern enum mmap_cache_rebuild_result
mmap_cache_rebuild_if_invalid(struct tcb *, const char *caller);
mmap_cache_rebuild_if_invalid_(struct tcb *, const char *caller);
#define mmap_cache_rebuild_if_invalid(tcp_) \
mmap_cache_rebuild_if_invalid_((tcp_), __func__)
extern struct mmap_cache_entry_t *
mmap_cache_search(struct tcb *, unsigned long ip);
@ -87,4 +89,8 @@ mmap_cache_search(struct tcb *, unsigned long ip);
extern struct mmap_cache_entry_t *
mmap_cache_search_custom(struct tcb *, mmap_cache_search_fn, void *);
extern void
mmap_cache_free_(struct tcb *tcp, const char *caller);
#define mmap_cache_free(tcp_) mmap_cache_free_((tcp_), __func__)
#endif /* !STRACE_MMAP_CACHE_H */

View File

@ -211,7 +211,7 @@ SYS_FUNC(recvmmsg)
/* flags */
printflags(msg_flags, tcp->u_arg[3], "MSG_???");
tprints(", ");
print_timespec(tcp, tcp->u_arg[4]);
print_timespec(tcp, tcp->u_arg[4], false);
}
return 0;
} else {

4
mq.c
View File

@ -53,7 +53,7 @@ SYS_FUNC(mq_timedsend)
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu ", %u, ", tcp->u_arg[2],
(unsigned int) tcp->u_arg[3]);
print_timespec(tcp, tcp->u_arg[4]);
print_timespec(tcp, tcp->u_arg[4], true);
return RVAL_DECODED;
}
@ -76,7 +76,7 @@ SYS_FUNC(mq_timedreceive)
* whether the syscall has failed or not.
*/
temporarily_clear_syserror(tcp);
print_timespec(tcp, tcp->u_arg[4]);
print_timespec(tcp, tcp->u_arg[4], true);
restore_cleared_syserror(tcp);
}
return 0;

View File

@ -88,7 +88,7 @@ print_scm_creds(struct tcb *tcp, const void *cmsg_data,
PRINT_FIELD_U("{", *uc, pid);
PRINT_FIELD_UID(", ", *uc, uid);
PRINT_FIELD_UID(", ", *uc, gid);
PRINT_FIELD_GID(", ", *uc, gid);
tprints("}");
}
@ -103,21 +103,21 @@ static void
print_scm_timestamp(struct tcb *tcp, const void *cmsg_data,
const unsigned int data_len)
{
print_struct_timeval_data_size(cmsg_data, data_len);
print_struct_timeval_data_size(cmsg_data, data_len, true);
}
static void
print_scm_timestampns(struct tcb *tcp, const void *cmsg_data,
const unsigned int data_len)
{
print_struct_timespec_data_size(cmsg_data, data_len);
print_struct_timespec_data_size(cmsg_data, data_len, true);
}
static void
print_scm_timestamping(struct tcb *tcp, const void *cmsg_data,
const unsigned int data_len)
{
print_struct_timespec_array_data_size(cmsg_data, 3, data_len);
print_struct_timespec_array_data_size(cmsg_data, 3, data_len, true);
}
static void
@ -132,6 +132,15 @@ print_cmsg_ip_pktinfo(struct tcb *tcp, const void *cmsg_data,
tprints("}");
}
static void
print_cmsg_int(struct tcb *tcp, const void *cmsg_data,
const unsigned int data_len)
{
const int *p = cmsg_data;
tprintf("[%d]", *p);
}
static void
print_cmsg_uint(struct tcb *tcp, const void *cmsg_data,
const unsigned int data_len)
@ -219,7 +228,8 @@ static const struct {
[SCM_SECURITY] = { print_scm_security, 1 },
[SCM_TIMESTAMP] = { print_scm_timestamp, 1 },
[SCM_TIMESTAMPNS] = { print_scm_timestampns, 1 },
[SCM_TIMESTAMPING] = { print_scm_timestamping, 1 }
[SCM_TIMESTAMPING] = { print_scm_timestamping, 1 },
[SO_RXQ_OVFL] = { print_cmsg_uint, sizeof(unsigned int) },
}, cmsg_ip_printers[] = {
[IP_PKTINFO] = { print_cmsg_ip_pktinfo, sizeof(struct in_pktinfo) },
[IP_TTL] = { print_cmsg_uint, sizeof(unsigned int) },
@ -229,6 +239,7 @@ static const struct {
[IP_RECVERR] = { print_cmsg_ip_recverr, sizeof(struct sock_ee) },
[IP_ORIGDSTADDR] = { print_cmsg_ip_origdstaddr, sizeof(struct sockaddr_in) },
[IP_CHECKSUM] = { print_cmsg_uint, sizeof(unsigned int) },
[IP_RECVFRAGSIZE] = { print_cmsg_int, sizeof(int) },
[SCM_SECURITY] = { print_scm_security, 1 }
};

92
net.c
View File

@ -86,7 +86,9 @@
#define XLAT_MACROS_ONLY
# include "xlat/addrfams.h"
# include "xlat/ethernet_protocols.h"
#undef XLAT_MACROS_ONLY
#include "xlat/ax25_protocols.h"
#include "xlat/irda_protocols.h"
#include "xlat/can_protocols.h"
#include "xlat/bt_protocols.h"
@ -132,6 +134,18 @@ tprint_sock_type(unsigned int flags)
printflags(sock_type_flags, flags, "SOCK_???");
}
void
socket_exiting_cb(struct tcb *tcp)
{
if (syserror(tcp) || syscall_tampered_nofail(tcp)
|| tcp->u_arg[0] != AF_NETLINK)
return;
uint64_t inode = getfdinode(tcp, tcp->u_rval);
set_netlink_family_cache_entry(inode, tcp->u_arg[2]);
}
SYS_FUNC(socket)
{
printxval(addrfams, tcp->u_arg[0], "AF_???");
@ -141,23 +155,36 @@ SYS_FUNC(socket)
switch (tcp->u_arg[0]) {
case AF_INET:
case AF_INET6:
printxval_search(inet_protocols, tcp->u_arg[2], "IPPROTO_???");
printxval(inet_protocols, tcp->u_arg[2], "IPPROTO_???");
break;
case AF_AX25:
/* Those are not available in a public header */
printxval_ex(ax25_protocols, tcp->u_arg[2], "AX25_P_???",
XLAT_STYLE_VERBOSE);
break;
case AF_NETLINK:
printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
break;
case AF_PACKET:
tprints("htons(");
printxval(ethernet_protocols, ntohs(tcp->u_arg[2]),
"ETH_P_???");
tprints(")");
break;
case AF_IRDA:
printxval_index(can_protocols, tcp->u_arg[2], "IRDAPROTO_???");
printxval(can_protocols, tcp->u_arg[2], "IRDAPROTO_???");
break;
case AF_CAN:
printxval_index(can_protocols, tcp->u_arg[2], "CAN_???");
printxval(can_protocols, tcp->u_arg[2], "CAN_???");
break;
case AF_BLUETOOTH:
printxval_index(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
printxval(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
break;
case AF_RXRPC:
@ -169,24 +196,23 @@ SYS_FUNC(socket)
break;
case AF_PHONET:
printxval_index(phonet_protocols, tcp->u_arg[2], "PN_PROTO_???");
printxval(phonet_protocols, tcp->u_arg[2], "PN_PROTO_???");
break;
case AF_CAIF:
printxval_index(caif_protocols, tcp->u_arg[2], "CAIFPROTO_???");
printxval(caif_protocols, tcp->u_arg[2], "CAIFPROTO_???");
break;
case AF_NFC:
printxval_index(nfc_protocols, tcp->u_arg[2],
"NFC_SOCKPROTO_???");
printxval(nfc_protocols, tcp->u_arg[2], "NFC_SOCKPROTO_???");
break;
case AF_KCM:
printxval_index(kcm_protocols, tcp->u_arg[2], "KCMPROTO_???");
printxval(kcm_protocols, tcp->u_arg[2], "KCMPROTO_???");
break;
case AF_SMC:
printxval_index(smc_protocols, tcp->u_arg[2], "SMCPROTO_???");
printxval(smc_protocols, tcp->u_arg[2], "SMCPROTO_???");
break;
default:
@ -437,12 +463,14 @@ SYS_FUNC(socketpair)
#include "xlat/getsock_ipv6_options.h"
#include "xlat/setsock_ipv6_options.h"
#include "xlat/sock_ipx_options.h"
#include "xlat/sock_ax25_options.h"
#include "xlat/sock_netlink_options.h"
#include "xlat/sock_packet_options.h"
#include "xlat/sock_raw_options.h"
#include "xlat/sock_sctp_options.h"
#include "xlat/sock_tcp_options.h"
#include "xlat/sock_udp_options.h"
#include "xlat/sock_can_raw_options.h"
#include "xlat/sock_irda_options.h"
#include "xlat/sock_llc_options.h"
#include "xlat/sock_dccp_options.h"
@ -466,7 +494,7 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level,
{
printfd(tcp, fd);
tprints(", ");
printxval_search(socketlayers, level, "SOL_??");
printxval(socketlayers, level, "SOL_??");
tprints(", ");
switch (level) {
@ -488,11 +516,17 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level,
case SOL_IPX:
printxval(sock_ipx_options, name, "IPX_???");
break;
case SOL_AX25:
printxval(sock_ax25_options, name, "AX25_???");
break;
case SOL_PACKET:
printxval(sock_packet_options, name, "PACKET_???");
break;
case SOL_TCP:
printxval_index(sock_tcp_options, name, "TCP_???");
printxval(sock_tcp_options, name, "TCP_???");
break;
case SOL_CAN_RAW:
printxval(sock_can_raw_options, name, "CAN_RAW_???");
break;
case SOL_SCTP:
printxval(sock_sctp_options, name, "SCTP_???");
@ -507,31 +541,31 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level,
printxval(sock_udp_options, name, "UDP_???");
break;
case SOL_IRDA:
printxval_index(sock_irda_options, name, "IRLMP_???");
printxval(sock_irda_options, name, "IRLMP_???");
break;
case SOL_LLC:
printxval_index(sock_llc_options, name, "LLC_OPT_???");
printxval(sock_llc_options, name, "LLC_OPT_???");
break;
case SOL_DCCP:
printxval_search(sock_dccp_options, name, "DCCP_SOCKOPT_???");
printxval(sock_dccp_options, name, "DCCP_SOCKOPT_???");
break;
case SOL_TIPC:
printxval_search(sock_tipc_options, name, "TIPC_???");
printxval(sock_tipc_options, name, "TIPC_???");
break;
case SOL_RXRPC:
printxval_index(sock_rxrpc_options, name, "RXRPC_???");
printxval(sock_rxrpc_options, name, "RXRPC_???");
break;
case SOL_PPPOL2TP:
printxval_index(sock_pppol2tp_options, name, "PPPOL2TP_SO_???");
printxval(sock_pppol2tp_options, name, "PPPOL2TP_SO_???");
break;
case SOL_BLUETOOTH:
printxval_search(sock_bluetooth_options, name, "BT_???");
printxval(sock_bluetooth_options, name, "BT_???");
break;
case SOL_PNPIPE:
printxval(sock_pnp_options, name, "PNPIPE_???");
break;
case SOL_RDS:
printxval_search(sock_rds_options, name, "RDS_???");
printxval(sock_rds_options, name, "RDS_???");
break;
case SOL_IUCV:
printxval(sock_iucv_options, name, "SO_???");
@ -540,10 +574,10 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level,
printxval(sock_caif_options, name, "CAIFSO_???");
break;
case SOL_ALG:
printxval_index(sock_alg_options, name, "ALG_???");
printxval(sock_alg_options, name, "ALG_???");
break;
case SOL_NFC:
printxval_index(sock_nfcllcp_options, name, "NFC_LLCP_???");
printxval(sock_nfcllcp_options, name, "NFC_LLCP_???");
break;
case SOL_KCM:
printxval(sock_kcm_options, name, "KCM_???");
@ -552,7 +586,7 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level,
printxval(sock_tls_options, name, "TLS_???");
break;
case SOL_XDP:
printxval_index(sock_xdp_options, name, "XDP_???");
printxval(sock_xdp_options, name, "XDP_???");
break;
/* Other SOL_* protocol levels still need work. */
@ -643,7 +677,7 @@ print_get_ucred(struct tcb *const tcp, const kernel_ulong_t addr,
len,
QUOTE_FORCE_HEX);
} else {
PRINT_FIELD_UID(", ", uc, gid);
PRINT_FIELD_GID(", ", uc, gid);
}
}
}
@ -729,14 +763,6 @@ print_icmp_filter(struct tcb *const tcp, const kernel_ulong_t addr, int len)
tprints(")");
}
static bool
print_uint32(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
tprintf("%u", *(uint32_t *) elem_buf);
return true;
}
static void
print_getsockopt(struct tcb *const tcp, const unsigned int level,
const unsigned int name, const kernel_ulong_t addr,
@ -802,7 +828,7 @@ print_getsockopt(struct tcb *const tcp, const unsigned int level,
uint32_t buf;
print_array(tcp, addr, MIN(ulen, rlen) / sizeof(buf),
&buf, sizeof(buf),
tfetch_mem, print_uint32, 0);
tfetch_mem, print_uint32_array_member, 0);
break;
}
default:

View File

@ -92,25 +92,11 @@ get_fd_nl_family(struct tcb *const tcp, const int fd)
if (!inode)
return -1;
const char *const details = get_sockaddr_by_inode(tcp, fd, inode);
if (!details)
const char *const data = get_sockdata_by_inode(tcp, fd, inode);
if (!data)
return -1;
const char *const nl_details = STR_STRIP_PREFIX(details, "NETLINK:[");
if (nl_details == details)
return -1;
const struct xlat *xlats = netlink_protocols;
for (; xlats->str; ++xlats) {
const char *name = STR_STRIP_PREFIX(xlats->str, "NETLINK_");
if (!strncmp(nl_details, name, strlen(name)))
return xlats->val;
}
if (*nl_details >= '0' && *nl_details <= '9')
return atoi(nl_details);
return -1;
return data[0];
}
static void
@ -126,7 +112,9 @@ decode_nlmsg_type_generic(struct tcb *tcp, const struct xlat *const xlat,
const uint16_t type,
const char *const dflt)
{
printxval(genl_families_xlat(tcp), type, dflt);
/* As genl family numbers are allocated dynamically */
print_xlat_ex(type, genl_get_family_name(tcp, type),
XLAT_STYLE_VERBOSE);
}
static const struct {
@ -438,7 +426,7 @@ decode_nlmsg_flags(const uint16_t flags, const uint16_t type,
} else if (family < ARRAY_SIZE(nlmsg_flags) && nlmsg_flags[family])
table = nlmsg_flags[family](type);
printflags_ex(flags, "NLM_F_???", XLAT_STYLE_ABBREV,
printflags_ex(flags, "NLM_F_???", XLAT_STYLE_DEFAULT,
netlink_flags, table, NULL);
}
@ -519,11 +507,7 @@ decode_nlmsgerr(struct tcb *const tcp,
return;
tprints("{error=");
if (err.error < 0 && (unsigned) -err.error < nerrnos) {
tprintf("-%s", errnoent[-err.error]);
} else {
tprintf("%d", err.error);
}
print_err(err.error, true);
addr += offsetof(struct nlmsgerr, msg);
len -= offsetof(struct nlmsgerr, msg);

View File

@ -370,6 +370,51 @@ decode_tcp_bbr_info(struct tcb *const tcp,
return true;
}
static bool
decode_tcp_md5sig(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
struct tcp_diag_md5sig sig;
if (len < sizeof(sig))
return false;
kernel_ulong_t l = len;
kernel_ulong_t a = addr;
for (; len >= sizeof(sig); l -= sizeof(sig), a += sizeof(sig)) {
if (a != addr)
tprints(", ");
if (umove(tcp, a, &sig)) {
tprints("/* ");
printaddr(a);
tprints(" */");
return true;
}
PRINT_FIELD_XVAL("{", sig, tcpm_family, addrfams, "AF_???");
PRINT_FIELD_U(", ", sig, tcpm_prefixlen);
PRINT_FIELD_U(", ", sig, tcpm_keylen);
PRINT_FIELD_INET_ADDR(", ", sig, tcpm_addr, sig.tcpm_family);
tprints(", ");
print_quoted_string((char *) sig.tcpm_key,
MIN(sizeof(sig.tcpm_key), sig.tcpm_keylen),
QUOTE_FORCE_HEX);
tprints("}");
}
if (l) {
tprints(",");
tprintf_comment("%" PRI_klu " bytes of unexpected data", l);
}
return true;
}
static const nla_decoder_t inet_diag_msg_nla_decoders[] = {
[INET_DIAG_MEMINFO] = decode_inet_diag_meminfo,
[INET_DIAG_INFO] = NULL, /* unimplemented */
@ -387,7 +432,8 @@ static const nla_decoder_t inet_diag_msg_nla_decoders[] = {
[INET_DIAG_PAD] = NULL,
[INET_DIAG_MARK] = decode_nla_u32,
[INET_DIAG_BBRINFO] = decode_tcp_bbr_info,
[INET_DIAG_CLASS_ID] = decode_nla_u32
[INET_DIAG_CLASS_ID] = decode_nla_u32,
[INET_DIAG_MD5SIG] = decode_tcp_md5sig,
};
DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg)
@ -411,7 +457,7 @@ DECL_NETLINK_DIAG_DECODER(decode_inet_diag_msg)
PRINT_FIELD_U(", ", msg, idiag_expires);
PRINT_FIELD_U(", ", msg, idiag_rqueue);
PRINT_FIELD_U(", ", msg, idiag_wqueue);
PRINT_FIELD_U(", ", msg, idiag_uid);
PRINT_FIELD_UID(", ", msg, idiag_uid);
PRINT_FIELD_U(", ", msg, idiag_inode);
decode_nla = true;
}

View File

@ -38,10 +38,501 @@
# include "netlink.h"
# include <linux/netfilter/nfnetlink.h>
# include "xlat/icmp_codes_redirect.h"
# include "xlat/icmp_codes_time_exceeded.h"
# include "xlat/icmp_codes_unreach.h"
# include "xlat/icmp_types.h"
# include "xlat/icmpv6_codes_parameter.h"
# include "xlat/icmpv6_codes_time_exceeded.h"
# include "xlat/icmpv6_codes_unreach.h"
# include "xlat/icmpv6_types.h"
# include "xlat/netfilter_versions.h"
# include "xlat/nf_acct_attr_names.h"
# include "xlat/nf_cthelper_attr_names.h"
# include "xlat/nf_ctnetlink_attr_names.h"
# include "xlat/nf_ctnetlink_exp_attr_names.h"
# include "xlat/nf_ctnetlink_to_attr_names.h"
# include "xlat/nf_ipset_attr_names.h"
# include "xlat/nf_nft_compat_attr_names.h"
# include "xlat/nf_osf_attr_names.h"
# include "xlat/nf_queue_attr_names.h"
# include "xlat/nf_ulog_attr_names.h"
# include "xlat/nfnl_ct_ip_attrs.h"
# include "xlat/nfnl_ct_proto_attrs.h"
# include "xlat/nfnl_ct_protoinfo_attrs.h"
# include "xlat/nfnl_ct_protoinfo_dccp_attrs.h"
# include "xlat/nfnl_ct_protoinfo_sctp_attrs.h"
# include "xlat/nfnl_ct_protoinfo_tcp_attrs.h"
# include "xlat/nfnl_ct_status.h"
# include "xlat/nfnl_ct_tcp_flags.h"
# include "xlat/nfnl_ct_tcp_states.h"
# include "xlat/nfnl_ct_tuple_attrs.h"
# include "xlat/nfnl_zones.h"
# include "xlat/nft_chain_attr_names.h"
# include "xlat/nft_flow_attr_names.h"
# include "xlat/nft_gen_attr_names.h"
# include "xlat/nft_obj_attr_names.h"
# include "xlat/nft_rule_attr_names.h"
# include "xlat/nft_set_attr_names.h"
# include "xlat/nft_setelem_attr_names.h"
# include "xlat/nft_table_attr_names.h"
# include "xlat/nft_trace_attr_names.h"
# include "xlat/nl_netfilter_msg_types.h"
# include "xlat/nl_netfilter_subsys_ids.h"
# define XLAT_MACROS_ONLY
# include "xlat/nl_netfilter_subsys_ids.h"
# include "xlat/nf_nftables_msg_types.h"
# undef XLAT_MACROS_ONLY
struct nfnl_decoder {
const struct xlat *name_xlat;
const char *dflt;
const nla_decoder_t *decoders;
size_t decoders_sz;
const struct nfnl_decoder *subdecoder;
size_t subdecoder_sz;
};
static const struct nfnl_decoder nft_subsystem_decoders[] = {
[NFT_MSG_NEWTABLE] =
{ nft_table_attr_names, "NFTA_TABLE_???", },
[NFT_MSG_GETTABLE] =
{ nft_table_attr_names, "NFTA_TABLE_???", },
[NFT_MSG_DELTABLE] =
{ nft_table_attr_names, "NFTA_TABLE_???", },
[NFT_MSG_NEWCHAIN] =
{ nft_chain_attr_names, "NFTA_CHAIN_???", },
[NFT_MSG_GETCHAIN] =
{ nft_chain_attr_names, "NFTA_CHAIN_???", },
[NFT_MSG_DELCHAIN] =
{ nft_chain_attr_names, "NFTA_CHAIN_???", },
[NFT_MSG_NEWRULE] =
{ nft_rule_attr_names, "NFTA_RULE_???", },
[NFT_MSG_GETRULE] =
{ nft_rule_attr_names, "NFTA_RULE_???", },
[NFT_MSG_DELRULE] =
{ nft_rule_attr_names, "NFTA_RULE_???", },
[NFT_MSG_NEWSET] =
{ nft_set_attr_names, "NFTA_SET_???", },
[NFT_MSG_GETSET] =
{ nft_set_attr_names, "NFTA_SET_???", },
[NFT_MSG_DELSET] =
{ nft_set_attr_names, "NFTA_SET_???", },
[NFT_MSG_NEWSETELEM] =
{ nft_setelem_attr_names, "NFTA_SET_ELEM_???", },
[NFT_MSG_GETSETELEM] =
{ nft_setelem_attr_names, "NFTA_SET_ELEM_???", },
[NFT_MSG_DELSETELEM] =
{ nft_setelem_attr_names, "NFTA_SET_ELEM_???", },
[NFT_MSG_NEWGEN] =
{ nft_gen_attr_names, "NFTA_GEN_???", },
[NFT_MSG_GETGEN] =
{ nft_gen_attr_names, "NFTA_GEN_???", },
[NFT_MSG_TRACE] =
{ nft_trace_attr_names, "NFTA_TRACE_???", },
[NFT_MSG_NEWOBJ] =
{ nft_obj_attr_names, "NFTA_OBJ_???", },
[NFT_MSG_GETOBJ] =
{ nft_obj_attr_names, "NFTA_OBJ_???", },
[NFT_MSG_DELOBJ] =
{ nft_obj_attr_names, "NFTA_OBJ_???", },
[NFT_MSG_GETOBJ_RESET] =
{ nft_obj_attr_names, "NFTA_OBJ_???", },
[NFT_MSG_NEWFLOWTABLE] =
{ nft_flow_attr_names, "NFTA_FLOW_???", },
[NFT_MSG_GETFLOWTABLE] =
{ nft_flow_attr_names, "NFTA_FLOW_???", },
[NFT_MSG_DELFLOWTABLE] =
{ nft_flow_attr_names, "NFTA_FLOW_???", },
};
static const nla_decoder_t nfnl_ct_ip_decoders[] = {
[CTA_IP_V4_SRC] = decode_nla_in_addr,
[CTA_IP_V4_DST] = decode_nla_in_addr,
[CTA_IP_V6_SRC] = decode_nla_in6_addr,
[CTA_IP_V6_DST] = decode_nla_in6_addr,
};
static bool
decode_cta_ip(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
decode_nlattr(tcp, addr, len, nfnl_ct_ip_attrs, "CTA_IP_???",
ARRSZ_PAIR(nfnl_ct_ip_decoders), opaque_data);
return true;
}
struct cta_proto_ctx {
uint8_t icmp_type_seen :1,
icmpv6_type_seen :1;
uint8_t icmp_type;
uint8_t icmpv6_type;
};
static bool
decode_cta_icmp_type(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
struct cta_proto_ctx *ctx = (void *) opaque_data;
uint8_t type;
if (len < sizeof(type))
return false;
if (!umove_or_printaddr(tcp, addr, &type))
printxval(icmp_types, type, "ICMP_???");
if (ctx) {
ctx->icmp_type_seen = 1;
ctx->icmp_type = type;
}
return true;
}
static bool
decode_cta_icmp_code(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
static const struct {
uint16_t type;
const struct xlat *xlat;
const char *dflt;
} codes[] = {
{ ICMP_DEST_UNREACH, icmp_codes_unreach,
"ICMP_???" },
{ ICMP_REDIRECT, icmp_codes_redirect,
"ICMP_REDIR_???" },
{ ICMP_TIME_EXCEEDED, icmp_codes_time_exceeded,
"ICMP_EXC_???" },
};
struct cta_proto_ctx *ctx = (void *) opaque_data;
uint8_t code;
if (len < sizeof(code))
return false;
if (umove_or_printaddr(tcp, addr, &code))
return true;
if (!ctx || !ctx->icmp_type_seen)
goto type_not_found;
for (size_t i = 0; i < ARRAY_SIZE(codes); i++) {
if (codes[i].type == ctx->icmp_type) {
printxval(codes[i].xlat, code, codes[i].dflt);
return true;
}
}
type_not_found:
tprintf("%#hhx", code);
return true;
}
static bool
decode_cta_icmpv6_type(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
struct cta_proto_ctx *ctx = (void *) opaque_data;
uint8_t type;
if (len < sizeof(type))
return false;
if (!umove_or_printaddr(tcp, addr, &type))
printxval(icmpv6_types, type, "ICMPV6_???");
if (ctx) {
ctx->icmpv6_type_seen = 1;
ctx->icmpv6_type = type;
}
return true;
}
static bool
decode_cta_icmpv6_code(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
static const struct code_data {
const struct xlat *xlat;
const char *dflt;
} codes[] = {
[ICMPV6_DEST_UNREACH] =
{ icmpv6_codes_unreach, "ICMPV6_???" },
[ICMPV6_TIME_EXCEED] =
{ icmpv6_codes_time_exceeded, "ICMPV6_EXC_???" },
[ICMPV6_PARAMPROB] =
{ icmpv6_codes_parameter, "ICMPV6_???" },
};
struct cta_proto_ctx *ctx = (void *) opaque_data;
uint8_t code;
if (len < sizeof(code))
return false;
if (umove_or_printaddr(tcp, addr, &code))
return true;
if (!ctx || !ctx->icmpv6_type_seen
|| ctx->icmpv6_type >= ARRAY_SIZE(codes)
|| !codes[ctx->icmpv6_type].xlat) {
tprintf("%#hhx", code);
return true;
}
const struct code_data *c = codes + ctx->icmpv6_type;
printxval(c->xlat, code, c->dflt);
return true;
}
static const nla_decoder_t nfnl_ct_proto_decoders[] = {
[CTA_PROTO_NUM] = decode_nla_ip_proto,
[CTA_PROTO_SRC_PORT] = decode_nla_be16,
[CTA_PROTO_DST_PORT] = decode_nla_be16,
[CTA_PROTO_ICMP_ID] = decode_nla_be16,
[CTA_PROTO_ICMP_TYPE] = decode_cta_icmp_type,
[CTA_PROTO_ICMP_CODE] = decode_cta_icmp_code,
[CTA_PROTO_ICMPV6_ID] = decode_nla_be16,
[CTA_PROTO_ICMPV6_TYPE] = decode_cta_icmpv6_type,
[CTA_PROTO_ICMPV6_CODE] = decode_cta_icmpv6_code,
};
static bool
decode_cta_proto(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
struct cta_proto_ctx ctx = { 0 };
decode_nlattr(tcp, addr, len, nfnl_ct_proto_attrs, "CTA_PROTO_???",
ARRSZ_PAIR(nfnl_ct_proto_decoders), &ctx);
return true;
}
static const nla_decoder_t nfnl_ct_tuple_decoders[] = {
[CTA_TUPLE_IP] = decode_cta_ip,
[CTA_TUPLE_PROTO] = decode_cta_proto,
[CTA_TUPLE_ZONE] = decode_nla_be16,
};
static bool
decode_cta_tuple(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
decode_nlattr(tcp, addr, len, nfnl_ct_tuple_attrs, "CTA_TUPLE_???",
ARRSZ_PAIR(nfnl_ct_tuple_decoders), opaque_data);
return true;
}
static bool
decode_cta_status(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
uint32_t status;
if (len < sizeof(status))
return false;
if (umove_or_printaddr(tcp, addr, &status))
return true;
status = ntohs(status);
tprints("htons(");
printflags(nfnl_ct_status, status, "IPS_???");
tprints(")");
return true;
}
static bool
decode_cta_tcp_state(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
uint32_t state;
if (len < sizeof(state))
return false;
if (!umove_or_printaddr(tcp, addr, &state))
printxval(nfnl_ct_tcp_states, state, "TCP_CONNTRACK_???");
return true;
}
static bool
decode_cta_tcp_flags(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
uint8_t flags[2];
if (len < sizeof(flags))
return false;
if (umove_or_printaddr(tcp, addr, &flags))
return true;
tprints("{flags=");
printflags(nfnl_ct_tcp_flags, flags[0], "IP_CT_???");
tprints(", mask=");
printflags(nfnl_ct_tcp_flags, flags[1], "IP_CT_???");
tprints("}");
return true;
}
static const nla_decoder_t nfnl_ct_protoinfo_tcp_decoders[] = {
[CTA_PROTOINFO_TCP_STATE] = decode_cta_tcp_state,
[CTA_PROTOINFO_TCP_WSCALE_ORIGINAL] = decode_nla_u8,
[CTA_PROTOINFO_TCP_WSCALE_REPLY] = decode_nla_u8,
[CTA_PROTOINFO_TCP_FLAGS_ORIGINAL] = decode_cta_tcp_flags,
[CTA_PROTOINFO_TCP_FLAGS_REPLY] = decode_cta_tcp_flags,
};
static bool
decode_cta_protoinfo_tcp(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
decode_nlattr(tcp, addr, len, nfnl_ct_protoinfo_tcp_attrs,
"CTA_PROTOINFO_TCP_???",
ARRSZ_PAIR(nfnl_ct_protoinfo_tcp_decoders), opaque_data);
return true;
}
static const nla_decoder_t nfnl_ct_protoinfo_dccp_decoders[] = {
};
static bool
decode_cta_protoinfo_dccp(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
decode_nlattr(tcp, addr, len, nfnl_ct_protoinfo_dccp_attrs,
"CTA_PROTOINFO_DCCP_???",
ARRSZ_PAIR(nfnl_ct_protoinfo_dccp_decoders), opaque_data);
return true;
}
static const nla_decoder_t nfnl_ct_protoinfo_sctp_decoders[] = {
};
static bool
decode_cta_protoinfo_sctp(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
decode_nlattr(tcp, addr, len, nfnl_ct_protoinfo_sctp_attrs,
"CTA_PROTOINFO_SCTP_???",
ARRSZ_PAIR(nfnl_ct_protoinfo_sctp_decoders), opaque_data);
return true;
}
static const nla_decoder_t nfnl_ct_protoinfo_decoders[] = {
[CTA_PROTOINFO_TCP] = decode_cta_protoinfo_tcp,
[CTA_PROTOINFO_DCCP] = decode_cta_protoinfo_dccp,
[CTA_PROTOINFO_SCTP] = decode_cta_protoinfo_sctp,
};
static bool
decode_cta_protoinfo(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
decode_nlattr(tcp, addr, len, nfnl_ct_protoinfo_attrs,
"CTA_PROTOINFO_???",
ARRSZ_PAIR(nfnl_ct_protoinfo_decoders), opaque_data);
return true;
}
static const nla_decoder_t nf_ctnetlink_decoders[] = {
[CTA_TUPLE_ORIG] = decode_cta_tuple,
[CTA_TUPLE_REPLY] = decode_cta_tuple,
[CTA_STATUS] = decode_cta_status,
[CTA_PROTOINFO] = decode_cta_protoinfo,
[CTA_HELP] = decode_nla_u32,
[CTA_NAT_SRC] = decode_nla_u32,
[CTA_TIMEOUT] = decode_nla_u32,
[CTA_MARK] = decode_nla_u32,
[CTA_COUNTERS_ORIG] = decode_nla_u32,
[CTA_COUNTERS_REPLY] = decode_nla_u32,
[CTA_USE] = decode_nla_u32,
[CTA_ID] = decode_nla_u32,
[CTA_NAT_DST] = decode_nla_u32,
[CTA_TUPLE_MASTER] = decode_nla_u32,
[CTA_SEQ_ADJ_ORIG] = decode_nla_u32,
[CTA_SEQ_ADJ_REPLY] = decode_nla_u32,
[CTA_SECMARK] = decode_nla_u32,
[CTA_ZONE] = decode_nla_u32,
[CTA_SECCTX] = decode_nla_u32,
[CTA_TIMESTAMP] = decode_nla_u32,
[CTA_MARK_MASK] = decode_nla_u32,
[CTA_LABELS] = decode_nla_u32,
[CTA_LABELS_MASK] = decode_nla_u32,
[CTA_SYNPROXY] = decode_nla_u32,
};
static const struct nfnl_decoder nfnl_subsystems[] = {
[NFNL_SUBSYS_CTNETLINK] =
{ nf_ctnetlink_attr_names, "CTA_???",
ARRSZ_PAIR(nf_ctnetlink_decoders) },
[NFNL_SUBSYS_CTNETLINK_EXP] =
{ nf_ctnetlink_exp_attr_names, "CTA_EXPECT_???", },
[NFNL_SUBSYS_QUEUE] =
{ nf_queue_attr_names, "NFQA_???", },
[NFNL_SUBSYS_ULOG] =
{ nf_ulog_attr_names, "NFULA_???", },
[NFNL_SUBSYS_OSF] =
{ nf_osf_attr_names, "OSF_???", },
[NFNL_SUBSYS_IPSET] =
{ nf_ipset_attr_names, "IPSET_ATTR_???", },
[NFNL_SUBSYS_ACCT] =
{ nf_acct_attr_names, "NFACCT_???", },
[NFNL_SUBSYS_CTNETLINK_TIMEOUT] =
{ nf_ctnetlink_to_attr_names, "CTA_TIMEOUT_???", },
[NFNL_SUBSYS_CTHELPER] =
{ nf_cthelper_attr_names, "NFCTH_???" },
[NFNL_SUBSYS_NFTABLES] =
{ NULL, "NFT_???", NULL, 0,
ARRSZ_PAIR(nft_subsystem_decoders) },
[NFNL_SUBSYS_NFT_COMPAT] =
{ nf_nft_compat_attr_names, "NFTA_COMPAT_???" },
};
bool
decode_netlink_netfilter(struct tcb *const tcp,
const struct nlmsghdr *const nlmsghdr,
@ -56,7 +547,8 @@ decode_netlink_netfilter(struct tcb *const tcp,
if (len < sizeof(nfmsg))
printstr_ex(tcp, addr, len, QUOTE_FORCE_HEX);
else if (!umove_or_printaddr(tcp, addr, &nfmsg)) {
const uint8_t subsys_id = (uint8_t) (nlmsghdr->nlmsg_type >> 8);
const uint8_t subsys_id = nlmsghdr->nlmsg_type >> 8;
const uint8_t msg_type = nlmsghdr->nlmsg_type;
uint16_t res_id = ntohs(nfmsg.res_id);
PRINT_FIELD_XVAL("{", nfmsg, nfgen_family, addrfams, "AF_???");
@ -70,10 +562,13 @@ decode_netlink_netfilter(struct tcb *const tcp,
tprints(", res_id=");
if (subsys_id == NFNL_SUBSYS_NFTABLES
&& res_id == NFNL_SUBSYS_NFTABLES) {
tprints("htons(NFNL_SUBSYS_NFTABLES)");
print_xlat_ex(nfmsg.res_id,
"htons(NFNL_SUBSYS_NFTABLES)",
XLAT_STYLE_DEFAULT);
} else if (subsys_id == NFNL_SUBSYS_NFTABLES
&& nfmsg.res_id == NFNL_SUBSYS_NFTABLES) {
tprints("NFNL_SUBSYS_NFTABLES");
print_xlat_ex(nfmsg.res_id, "NFNL_SUBSYS_NFTABLES",
XLAT_STYLE_DEFAULT);
} else {
tprintf("htons(%d)", res_id);
}
@ -83,12 +578,24 @@ decode_netlink_netfilter(struct tcb *const tcp,
tprints(", ");
if ((nlmsghdr->nlmsg_type >= NFNL_MSG_BATCH_BEGIN
&& nlmsghdr->nlmsg_type <= NFNL_MSG_BATCH_END)
|| nlmsghdr->nlmsg_type < NLMSG_MIN_TYPE)
|| nlmsghdr->nlmsg_type < NLMSG_MIN_TYPE) {
printstr_ex(tcp, addr + offset,
len - offset, QUOTE_FORCE_HEX);
else
} else {
static const struct nfnl_decoder def;
const struct nfnl_decoder *subsys = &def;
if (subsys_id < ARRAY_SIZE(nfnl_subsystems))
subsys = nfnl_subsystems + subsys_id;
if (subsys->subdecoder
&& (msg_type < subsys->subdecoder_sz))
subsys = subsys->subdecoder + msg_type;
decode_nlattr(tcp, addr + offset, len - offset,
NULL, NULL, NULL, 0, NULL);
subsys->name_xlat, subsys->dflt,
subsys->decoders,
subsys->decoders_sz, NULL);
}
}
}

View File

@ -37,6 +37,7 @@
#include <linux/sock_diag.h>
#include <linux/packet_diag.h>
#include "xlat/af_packet_versions.h"
#include "xlat/packet_diag_attrs.h"
#include "xlat/packet_diag_info_flags.h"
#include "xlat/packet_diag_show.h"
@ -52,10 +53,11 @@ DECL_NETLINK_DIAG_DECODER(decode_packet_diag_req)
if (!umoven_or_printaddr(tcp, addr + offset,
sizeof(req) - offset,
(char *) &req + offset)) {
tprints("sdiag_protocol=");
printxval_searchn(ethernet_protocols,
ethernet_protocols_size,
req.sdiag_protocol, "ETH_P_???");
/*
* AF_PACKET currently doesn't support protocol values
* other than 0.
*/
PRINT_FIELD_X("", req, sdiag_protocol);
PRINT_FIELD_U(", ", req, pdiag_ino);
PRINT_FIELD_FLAGS(", ", req, pdiag_show,
packet_diag_show, "PACKET_SHOW_???");
@ -79,8 +81,9 @@ decode_packet_diag_info(struct tcb *const tcp,
if (umove_or_printaddr(tcp, addr, &pinfo))
return true;
PRINT_FIELD_U("{", pinfo, pdi_index);
PRINT_FIELD_U(", ", pinfo, pdi_version);
PRINT_FIELD_IFINDEX("{", pinfo, pdi_index);
PRINT_FIELD_XVAL(", ", pinfo, pdi_version, af_packet_versions,
"TPACKET_???");
PRINT_FIELD_U(", ", pinfo, pdi_reserve);
PRINT_FIELD_U(", ", pinfo, pdi_copy_thresh);
PRINT_FIELD_U(", ", pinfo, pdi_tstamp);
@ -172,7 +175,7 @@ static const nla_decoder_t packet_diag_msg_nla_decoders[] = {
[PACKET_DIAG_RX_RING] = decode_packet_diag_ring,
[PACKET_DIAG_TX_RING] = decode_packet_diag_ring,
[PACKET_DIAG_FANOUT] = decode_nla_u32,
[PACKET_DIAG_UID] = decode_nla_u32,
[PACKET_DIAG_UID] = decode_nla_uid,
[PACKET_DIAG_MEMINFO] = decode_nla_meminfo,
[PACKET_DIAG_FILTER] = decode_packet_diag_filter
};
@ -191,7 +194,8 @@ DECL_NETLINK_DIAG_DECODER(decode_packet_diag_msg)
(char *) &msg + offset)) {
PRINT_FIELD_XVAL("", msg, pdiag_type,
socktypes, "SOCK_???");
PRINT_FIELD_U(", ", msg, pdiag_num);
PRINT_FIELD_XVAL(", ", msg, pdiag_num,
ethernet_protocols, "ETH_P_???");
PRINT_FIELD_U(", ", msg, pdiag_ino);
PRINT_FIELD_COOKIE(", ", msg, pdiag_cookie);
decode_nla = true;

View File

@ -118,7 +118,16 @@ static const netlink_route_decoder_t route_decoders[] = {
[RTM_DELNSID - RTM_BASE] = decode_rtgenmsg,
[RTM_GETNSID - RTM_BASE] = decode_rtgenmsg,
[RTM_NEWNSID - RTM_BASE] = decode_rtgenmsg
[RTM_NEWNSID - RTM_BASE] = decode_rtgenmsg,
[RTM_NEWSTATS - RTM_BASE] = decode_ifstatsmsg,
[RTM_GETSTATS - RTM_BASE] = decode_ifstatsmsg,
[RTM_NEWCACHEREPORT - RTM_BASE] = decode_cachereport,
[RTM_NEWCHAIN - RTM_BASE] = decode_tcmsg,
[RTM_DELCHAIN - RTM_BASE] = decode_tcmsg,
[RTM_GETCHAIN - RTM_BASE] = decode_tcmsg,
};
bool

View File

@ -40,11 +40,13 @@ route_decode_name(struct tcb *tcp, \
/* End of DECL_NETLINK_ROUTE_DECODER definition. */
extern DECL_NETLINK_ROUTE_DECODER(decode_br_port_msg);
extern DECL_NETLINK_ROUTE_DECODER(decode_cachereport);
extern DECL_NETLINK_ROUTE_DECODER(decode_dcbmsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_fib_rule_hdr);
extern DECL_NETLINK_ROUTE_DECODER(decode_ifaddrlblmsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_ifaddrmsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_ifstatsmsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_ndmsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_ndtmsg);
extern DECL_NETLINK_ROUTE_DECODER(decode_netconfmsg);

View File

@ -156,7 +156,7 @@ decode_smc_diag_shutdown(struct tcb *const tcp,
const void *const opaque_data)
{
const struct decode_nla_xlat_opts opts = {
ARRSZ_PAIR(sock_shutdown_flags), "???_SHUTDOWN",
sock_shutdown_flags, "???_SHUTDOWN",
.size = 1,
};
@ -203,11 +203,11 @@ decode_smc_diag_fallback(struct tcb *const tcp,
* net/smc/smc_clc.h
*/
tprints("{reason=");
printxval_search_ex(smc_decl_codes, fb.reason,
"SMC_CLC_DECL_???", XLAT_STYLE_VERBOSE);
printxval_ex(smc_decl_codes, fb.reason, "SMC_CLC_DECL_???",
XLAT_STYLE_VERBOSE);
tprints(", peer_diagnosis=");
printxval_search_ex(smc_decl_codes, fb.peer_diagnosis,
"SMC_CLC_DECL_???", XLAT_STYLE_VERBOSE);
printxval_ex(smc_decl_codes, fb.peer_diagnosis, "SMC_CLC_DECL_???",
XLAT_STYLE_VERBOSE);
tprints("}");
return true;
@ -235,16 +235,15 @@ DECL_NETLINK_DIAG_DECODER(decode_smc_diag_msg)
(void *) &msg + offset)) {
PRINT_FIELD_XVAL("", msg, diag_state,
smc_states, "SMC_???");
PRINT_FIELD_XVAL_INDEX(", ", msg, diag_fallback,
smc_diag_mode,
"SMC_DIAG_MODE_???");
PRINT_FIELD_XVAL(", ", msg, diag_fallback,
smc_diag_mode, "SMC_DIAG_MODE_???");
PRINT_FIELD_U(", ", msg, diag_shutdown);
/*
* AF_SMC protocol family socket handler
* keeping the AF_INET sock address.
*/
PRINT_FIELD_INET_DIAG_SOCKID(", ", msg, id, AF_INET);
PRINT_FIELD_U(", ", msg, diag_uid);
PRINT_FIELD_UID(", ", msg, diag_uid);
PRINT_FIELD_U(", ", msg, diag_inode);
decode_nla = true;
}

View File

@ -101,7 +101,8 @@ decode_nlattr_with_data(struct tcb *const tcp,
print_nlattr(nla, table, dflt);
if (nla_len > NLA_HDRLEN) {
const unsigned int idx = size ? nla->nla_type : 0;
const unsigned int idx =
size ? nla->nla_type & NLA_TYPE_MASK : 0;
tprints(", ");
if (!decoders
@ -215,10 +216,8 @@ decode_nla_meminfo(struct tcb *const tcp,
unsigned int count = 0;
print_array_ex(tcp, addr, nmemb, &mem, sizeof(mem),
tfetch_mem, print_uint32_array_member, &count,
PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
| XLAT_STYLE_FMT_U,
ARRSZ_PAIR(netlink_sk_meminfo_indices),
"SK_MEMINFO_???");
PAF_PRINT_INDICES | XLAT_STYLE_FMT_U,
netlink_sk_meminfo_indices, "SK_MEMINFO_???");
return true;
}
@ -261,7 +260,14 @@ decode_nla_gid(struct tcb *const tcp,
const unsigned int len,
const void *const opaque_data)
{
return decode_nla_uid(tcp, addr, len, opaque_data);
uint32_t gid;
if (len < sizeof(gid))
return false;
else if (!umove_or_printaddr(tcp, addr, &gid))
printgid("", gid);
return true;
}
bool
@ -305,8 +311,7 @@ decode_nla_xval(struct tcb *const tcp,
data.val = opts->process_fn(data.val);
if (opts->prefix)
tprints(opts->prefix);
printxval_dispatch_ex(opts->xlat, opts->xlat_size, data.val,
opts->dflt, opts->xt, opts->style);
printxval_ex(opts->xlat, data.val, opts->dflt, opts->style);
if (opts->suffix)
tprints(opts->suffix);
}
@ -326,11 +331,9 @@ decode_nla_ether_proto(struct tcb *const tcp,
const unsigned int len,
const void *const opaque_data)
{
const struct decode_nla_xlat_opts opts = {
static const struct decode_nla_xlat_opts opts = {
.xlat = ethernet_protocols,
.xlat_size = ethernet_protocols_size,
.dflt = "ETHER_P_???",
.xt = XT_SORTED,
.prefix = "htons(",
.suffix = ")",
.size = 2,
@ -346,10 +349,8 @@ decode_nla_ip_proto(struct tcb *const tcp,
const unsigned int len,
const void *const opaque_data)
{
const struct decode_nla_xlat_opts opts = {
static const struct decode_nla_xlat_opts opts = {
.xlat = inet_protocols,
.xlat_size = inet_protocols_size,
.xt = XT_SORTED,
.dflt = "IPPROTO_???",
.size = 1,
};
@ -357,6 +358,38 @@ decode_nla_ip_proto(struct tcb *const tcp,
return decode_nla_xval(tcp, addr, len, &opts);
}
bool
decode_nla_in_addr(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
struct in_addr in;
if (len < sizeof(in))
return false;
else if (!umove_or_printaddr(tcp, addr, &in))
print_inet_addr(AF_INET, &in, sizeof(in), NULL);
return true;
}
bool
decode_nla_in6_addr(struct tcb *const tcp,
const kernel_ulong_t addr,
const unsigned int len,
const void *const opaque_data)
{
struct in6_addr in6;
if (len < sizeof(in6))
return false;
else if (!umove_or_printaddr(tcp, addr, &in6))
print_inet_addr(AF_INET6, &in6, sizeof(in6), NULL);
return true;
}
bool
decode_nla_flags(struct tcb *const tcp,
const kernel_ulong_t addr,
@ -377,10 +410,6 @@ decode_nla_flags(struct tcb *const tcp,
const size_t bytes_offs = is_bigendian ? sizeof(data) - len : 0;
if (opts->xt == XT_INDEXED)
error_func_msg("indexed xlats are currently incompatible with "
"printflags");
if (!umoven_or_printaddr(tcp, addr, len, data.bytes + bytes_offs)) {
if (opts->process_fn)
data.flags = opts->process_fn(data.flags);

View File

@ -34,9 +34,7 @@
struct decode_nla_xlat_opts {
const struct xlat *xlat;
size_t xlat_size; /* is not needed for XT_NORMAL */
const char *dflt;
enum xlat_type xt;
enum xlat_style style;
const char *prefix;
const char *suffix;
@ -100,11 +98,15 @@ DECL_NLA(fd);
DECL_NLA(uid);
DECL_NLA(gid);
DECL_NLA(ifindex);
DECL_NLA(ifla_af_spec);
DECL_NLA(ether_proto);
DECL_NLA(ip_proto);
DECL_NLA(in_addr);
DECL_NLA(in6_addr);
DECL_NLA(meminfo);
DECL_NLA(rt_class);
DECL_NLA(rt_proto);
DECL_NLA(rtnl_link_stats64);
DECL_NLA(tc_stats);
#endif /* !STRACE_NLATTR_H */

15
numa.c
View File

@ -142,18 +142,7 @@ print_status(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
const int status = *(int *) elem_buf;
if (status < 0 && (unsigned) -status < nerrnos)
tprintf("-%s", errnoent[-status]);
else
tprintf("%d", status);
return true;
}
static bool
print_int(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
tprintf("%d", *(int *) elem_buf);
print_err(status, true);
return true;
}
@ -169,7 +158,7 @@ SYS_FUNC(move_pages)
tfetch_mem, print_addr, 0);
tprints(", ");
print_array(tcp, tcp->u_arg[3], npages, &buf, sizeof(int),
tfetch_mem, print_int, 0);
tfetch_mem, print_int32_array_member, 0);
tprints(", ");
} else {
print_array(tcp, tcp->u_arg[4], npages, &buf, sizeof(int),

20
open.c
View File

@ -76,11 +76,10 @@ print_dirfd(struct tcb *tcp, int fd)
const char *
sprint_open_modes(unsigned int flags)
{
static char outstr[(1 + ARRAY_SIZE(open_mode_flags)) * sizeof("O_LARGEFILE")];
static char outstr[sizeof("flags O_ACCMODE")];
char *p;
char sep;
const char *str;
const struct xlat *x;
sep = ' ';
p = stpcpy(outstr, "flags");
@ -93,21 +92,10 @@ sprint_open_modes(unsigned int flags)
return outstr;
sep = '|';
}
*p++ = '\0';
for (x = open_mode_flags; x->str; x++) {
if ((flags & x->val) == x->val) {
*p++ = sep;
p = stpcpy(p, x->str);
flags &= ~x->val;
if (!flags)
return outstr;
sep = '|';
}
}
/* flags is still nonzero */
*p++ = sep;
p = xappendstr(outstr, p, "%#x", flags);
return outstr;
return sprintflags_ex(outstr, open_mode_flags, flags, sep,
XLAT_STYLE_ABBREV) ?: outstr;
}
void

99
perf.c
View File

@ -31,6 +31,7 @@
#include "defs.h"
#include "perf_event_struct.h"
#include "print_fields.h"
#include "xlat/hw_breakpoint_len.h"
#include "xlat/hw_breakpoint_type.h"
@ -111,12 +112,6 @@ fetch_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
return 0;
}
#define PRINT_XLAT(prefix, xlat, x, dflt) \
do { \
tprints(prefix); \
printxval_search(xlat, x, dflt); \
} while (0)
void
print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
{
@ -159,9 +154,9 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
use_new_size = 1;
}
PRINT_XLAT("{type=", perf_type_id, attr->type, "PERF_TYPE_???");
tprints(", size=");
printxval(perf_attr_size, attr->size, "PERF_ATTR_SIZE_???");
PRINT_FIELD_XVAL("{", *attr, type, perf_type_id, "PERF_TYPE_???");
PRINT_FIELD_XVAL(", ", *attr, size, perf_attr_size,
"PERF_ATTR_SIZE_???");
if (use_new_size) {
tprints(" => ");
@ -175,12 +170,12 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
switch (attr->type) {
case PERF_TYPE_HARDWARE:
PRINT_XLAT(", config=", perf_hw_id, attr->config,
"PERF_COUNT_HW_???");
PRINT_FIELD_XVAL(", ", *attr, config, perf_hw_id,
"PERF_COUNT_HW_???");
break;
case PERF_TYPE_SOFTWARE:
PRINT_XLAT(", config=", perf_sw_ids, attr->config,
"PERF_COUNT_SW_???");
PRINT_FIELD_XVAL(", ", *attr, config, perf_sw_ids,
"PERF_COUNT_SW_???");
break;
case PERF_TYPE_TRACEPOINT:
/*
@ -188,17 +183,20 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
* debugfs tracing/events/../../id if ftrace is enabled
* in the kernel."
*/
tprintf(", config=%" PRIu64, attr->config);
PRINT_FIELD_U(", ", *attr, config);
break;
case PERF_TYPE_HW_CACHE:
/*
* (perf_hw_cache_id) | (perf_hw_cache_op_id << 8) |
* (perf_hw_cache_op_result_id << 16)
*/
PRINT_XLAT(", config=", perf_hw_cache_id, attr->config & 0xFF,
"PERF_COUNT_HW_CACHE_???");
PRINT_XLAT("|", perf_hw_cache_op_id, (attr->config >> 8) & 0xFF,
tprints(", config=");
printxval(perf_hw_cache_id, attr->config & 0xFF,
"PERF_COUNT_HW_CACHE_???");
tprints("|");
printxval(perf_hw_cache_op_id, (attr->config >> 8) & 0xFF,
"PERF_COUNT_HW_CACHE_OP_???");
tprints("<<8|");
/*
* Current code (see set_ext_hw_attr in arch/x86/events/core.c,
* tile_map_cache_event in arch/tile/kernel/perf_event.c,
@ -214,9 +212,9 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
* armpmu_map_cache_event in drivers/perf/arm_pmu.c) assumes
* that cache result is 8 bits in size.
*/
PRINT_XLAT("<<8|", perf_hw_cache_op_result_id,
(attr->config >> 16) & 0xFF,
"PERF_COUNT_HW_CACHE_RESULT_???");
printxval(perf_hw_cache_op_result_id,
(attr->config >> 16) & 0xFF,
"PERF_COUNT_HW_CACHE_RESULT_???");
tprints("<<16");
if (attr->config >> 24) {
tprintf("|%#" PRIx64 "<<24", attr->config >> 24);
@ -241,7 +239,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
* to zero. Its parameters are set in other places."
*/
default:
tprintf(", config=%#" PRIx64, attr->config);
PRINT_FIELD_X(", ", *attr, config);
break;
}
@ -249,17 +247,14 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
goto print_perf_event_attr_out;
if (attr->freq)
tprintf(", sample_freq=%" PRIu64, attr->sample_freq);
PRINT_FIELD_U(", ", *attr, sample_freq);
else
tprintf(", sample_period=%" PRIu64, attr->sample_period);
PRINT_FIELD_U(", ", *attr, sample_period);
tprints(", sample_type=");
printflags64(perf_event_sample_format, attr->sample_type,
"PERF_SAMPLE_???");
tprints(", read_format=");
printflags64(perf_event_read_format, attr->read_format,
"PERF_FORMAT_???");
PRINT_FIELD_FLAGS(", ", *attr, sample_type, perf_event_sample_format,
"PERF_SAMPLE_???");
PRINT_FIELD_FLAGS(", ", *attr, read_format, perf_event_read_format,
"PERF_FORMAT_???");
tprintf(", disabled=%u"
", inherit=%u"
@ -330,22 +325,22 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
}
if (attr->watermark)
tprintf(", wakeup_watermark=%u", attr->wakeup_watermark);
PRINT_FIELD_U(", ", *attr, wakeup_watermark);
else
tprintf(", wakeup_events=%u", attr->wakeup_events);
PRINT_FIELD_U(", ", *attr, wakeup_events);
if (attr->type == PERF_TYPE_BREAKPOINT)
/* Any combination of R/W with X is deemed invalid */
PRINT_XLAT(", bp_type=", hw_breakpoint_type, attr->bp_type,
(attr->bp_type <=
(HW_BREAKPOINT_X | HW_BREAKPOINT_RW)) ?
"HW_BREAKPOINT_INVALID" :
"HW_BREAKPOINT_???");
PRINT_FIELD_XVAL(", ", *attr, bp_type, hw_breakpoint_type,
(attr->bp_type <=
(HW_BREAKPOINT_X | HW_BREAKPOINT_RW))
? "HW_BREAKPOINT_INVALID"
: "HW_BREAKPOINT_???");
if (attr->type == PERF_TYPE_BREAKPOINT)
tprintf(", bp_addr=%#" PRIx64, attr->bp_addr);
PRINT_FIELD_X(", ", *attr, bp_addr);
else
tprintf(", config1=%#" PRIx64, attr->config1);
PRINT_FIELD_X(", ", *attr, config1);
/*
* Fields after bp_addr/config1 are optional and may not present; check
@ -354,15 +349,15 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
_PERF_CHECK_FIELD(bp_len);
if (attr->type == PERF_TYPE_BREAKPOINT)
tprintf(", bp_len=%" PRIu64, attr->bp_len);
PRINT_FIELD_U(", ", *attr, bp_len);
else
tprintf(", config2=%#" PRIx64, attr->config2);
PRINT_FIELD_X(", ", *attr, config2);
_PERF_CHECK_FIELD(branch_sample_type);
if (attr->sample_type & PERF_SAMPLE_BRANCH_STACK) {
tprints(", branch_sample_type=");
printflags64(perf_branch_sample_type, attr->branch_sample_type,
"PERF_SAMPLE_BRANCH_???");
PRINT_FIELD_FLAGS(", ", *attr, branch_sample_type,
perf_branch_sample_type,
"PERF_SAMPLE_BRANCH_???");
}
_PERF_CHECK_FIELD(sample_regs_user);
@ -372,7 +367,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
* described in the kernel header
* arch/ARCH/include/uapi/asm/perf_regs.h."
*/
tprintf(", sample_regs_user=%#" PRIx64, attr->sample_regs_user);
PRINT_FIELD_X(", ", *attr, sample_regs_user);
_PERF_CHECK_FIELD(sample_stack_user);
/*
@ -380,26 +375,24 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
* specified."
*/
if (attr->sample_type & PERF_SAMPLE_STACK_USER)
tprintf(", sample_stack_user=%#" PRIx32,
attr->sample_stack_user);
PRINT_FIELD_X(", ", *attr, sample_stack_user);
if (attr->use_clockid) {
_PERF_CHECK_FIELD(clockid);
tprints(", clockid=");
printxval(clocknames, attr->clockid, "CLOCK_???");
PRINT_FIELD_XVAL(", ", *attr, clockid, clocknames, "CLOCK_???");
}
_PERF_CHECK_FIELD(sample_regs_intr);
tprintf(", sample_regs_intr=%#" PRIx64, attr->sample_regs_intr);
PRINT_FIELD_X(", ", *attr, sample_regs_intr);
_PERF_CHECK_FIELD(aux_watermark);
tprintf(", aux_watermark=%" PRIu32, attr->aux_watermark);
PRINT_FIELD_U(", ", *attr, aux_watermark);
_PERF_CHECK_FIELD(sample_max_stack);
tprintf(", sample_max_stack=%" PRIu16, attr->sample_max_stack);
PRINT_FIELD_U(", ", *attr, sample_max_stack);
/* _PERF_CHECK_FIELD(__reserved_2);
tprintf(", __reserved2=%" PRIu16, attr->__reserved_2); */
PRINT_FIELD_U(", ", *attr, __reserved2); */
print_perf_event_attr_out:
if ((attr->size && (attr->size > size)) ||

2
poll.c
View File

@ -169,7 +169,7 @@ SYS_FUNC(ppoll)
if (entering(tcp)) {
decode_poll_entering(tcp);
print_timespec(tcp, tcp->u_arg[2]);
print_timespec(tcp, tcp->u_arg[2], false);
tprints(", ");
/* NB: kernel requires arg[4] == NSIG_BYTES */
print_sigset_addr_len(tcp, tcp->u_arg[3], tcp->u_arg[4]);

View File

@ -161,7 +161,7 @@ SYS_FUNC(prctl)
tprints(", ");
} else if (!umove_or_printaddr(tcp, arg2, &i)) {
tprints("[");
tprints(signame(i));
printsignal(i);
tprints("]");
}
break;
@ -241,6 +241,7 @@ SYS_FUNC(prctl)
switch (arg2) {
case PR_SPEC_STORE_BYPASS:
case PR_SPEC_INDIRECT_BRANCH:
tcp->auxstr = sprintflags("",
pr_spec_get_store_bypass_flags,
(kernel_ulong_t) tcp->u_rval);
@ -335,10 +336,10 @@ SYS_FUNC(prctl)
case PR_SET_PDEATHSIG:
tprints(", ");
if (arg2 > 128)
if (arg2 > nsig)
tprintf("%" PRI_klu, arg2);
else
tprints(signame(arg2));
printsignal(arg2);
return RVAL_DECODED;
case PR_SET_PTRACER:
@ -413,6 +414,7 @@ SYS_FUNC(prctl)
switch (arg2) {
case PR_SPEC_STORE_BYPASS:
case PR_SPEC_INDIRECT_BRANCH:
printxval64(pr_spec_set_store_bypass_flags, arg3,
"PR_SPEC_???");
break;

View File

@ -33,5 +33,12 @@
void
print_dev_t(const unsigned long long dev)
{
tprintf("makedev(%u, %u)", major(dev), minor(dev));
if (xlat_verbosity(xlat_verbose) != XLAT_STYLE_ABBREV)
tprintf("%llu", dev);
if (xlat_verbosity(xlat_verbose) != XLAT_STYLE_RAW)
return;
(xlat_verbosity(xlat_verbose) == XLAT_STYLE_ABBREV
? tprintf : tprintf_comment)("makedev(%u, %u)",
major(dev), minor(dev));
}

View File

@ -99,21 +99,10 @@
(xlat_), NULL); \
} while (0)
#define PRINT_FIELD_XVAL_SORTED_SIZED(prefix_, where_, field_, xlat_, \
xlat_size_, dflt_) \
#define PRINT_FIELD_ERR(prefix_, where_, field_, neg_) \
do { \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
printxval_searchn((xlat_), (xlat_size_), \
zero_extend_signed_to_ull((where_).field_), \
(dflt_)); \
} while (0)
#define PRINT_FIELD_XVAL_INDEX(prefix_, where_, field_, xlat_, dflt_) \
do { \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
printxval_index((xlat_), \
zero_extend_signed_to_ull((where_).field_), \
(dflt_)); \
print_err((where_).field_, (neg_)); \
} while (0)
/*
@ -129,7 +118,10 @@
zero_extend_signed_to_ull((where_).field_)); \
} while (0)
#define PRINT_FIELD_UID PRINT_FIELD_ID
#define PRINT_FIELD_UID(prefix_, where_, field_) \
printuid(prefix_ #field_ "=", (where_).field_)
#define PRINT_FIELD_GID(prefix_, where_, field_) \
printgid(prefix_ #field_ "=", (where_).field_)
#define PRINT_FIELD_U64(prefix_, where_, field_) \
do { \
@ -183,6 +175,27 @@
STRACE_PRINTF("%s%s=inet_addr(\"%s\")", (prefix_), #field_, \
inet_ntoa((where_).field_))
#define PRINT_FIELD_INET6_ADDR(prefix_, where_, field_) \
PRINT_FIELD_INET_ADDR((prefix_), (where_), field_, AF_INET6)
#define PRINT_FIELD_AX25_ADDR(prefix_, where_, field_) \
do { \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
print_ax25_addr(&(where_).field_); \
} while (0)
#define PRINT_FIELD_X25_ADDR(prefix_, where_, field_) \
do { \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
print_x25_addr(&(where_).field_); \
} while (0)
#define PRINT_FIELD_ROSE_ADDR(prefix_, where_, field_) \
do { \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
print_rose_addr(&(where_).field_); \
} while (0)
#define PRINT_FIELD_NET_PORT(prefix_, where_, field_) \
STRACE_PRINTF("%s%s=htons(%u)", (prefix_), #field_, \
ntohs((where_).field_))
@ -250,4 +263,13 @@
(size_)); \
} while (0)
#define PRINT_FIELD_HWADDR_SZ(prefix_, where_, field_, size_, hwtype_) \
do { \
static_assert(sizeof(((where_).field_)[0]) == 1, \
"hwaddress is not a byte array"); \
STRACE_PRINTF("%s%s=", (prefix_), #field_); \
print_hwaddr("", (const uint8_t *) ((where_).field_), \
(size_), (hwtype_)); \
} while (0)
#endif /* !STRACE_PRINT_FIELDS_H */

Some files were not shown because too many files have changed in this diff Show More