Commit Graph

198 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
10922d3112 prctl: implement decoding of PR_SET_FP_MODE and PR_GET_FP_MODE options
* xlat/pr_fp_mode.in: New file.
* prctl.c: Include "xlat/pr_fp_mode.h".
(SYS_FUNC(prctl)): Add handling for PR_SET_FP_MODE and PR_GET_FP_MODE
options.
2016-11-20 11:32:34 +00:00
Eugene Syromyatnikov
2c9464c5a3 xlat: add values to new ARCH_* constants
Since UAPI header declares them under CONFIG_CHECKPOINT_RESTORE
and they would never be defined in user space.

* xlat/archvals.in: Add numeric values to ARCH_MAP_VDSO_* constants.
2016-11-20 02:41:30 +00:00
6931903807 Update prctl ARCH_* constants
* xlat/archvals.in: Add ARCH_MAP_VDSO_X32, ARCH_MAP_VDSO_32, and
ARCH_MAP_VDSO_64 introduced by linux kernel commit v4.9-rc1~155^2~6.
2016-11-18 15:23:35 +00:00
76b57d67f0 Update V4L2_* constants
* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_TOUCH introduced
by linux kernel commit v4.9-rc4~7^2~422.
* xlat/v4l2_input_types.in: Add V4L2_CAP_TOUCH introduced
by linux kernel commit v4.9-rc4~7^2~422.
2016-11-18 15:23:35 +00:00
841744c4c9 Update fs *_MAGIC constants
* xlat/fsmagic.in: Add DAXFS_MAGIC introduced by linux kernel commit
v4.9-rc1~45^2^2~5.
2016-11-18 15:23:35 +00:00
2a914e6c1f Update MS_* constants
* xlat/mount_flags.in: Add MS_NOREMOTELOCK introduced
by linux kernel commit v4.9-rc1~57^2~1^2~7.
2016-11-18 15:23:35 +00:00
c4e428bd22 Update FALLOC_* constants
* xlat/falloc_flags.in: Add FALLOC_FL_UNSHARE_RANGE introduced
by linux kernel commit v4.9-rc1~31^2~69.
2016-11-18 15:23:35 +00:00
75cfe3346b Update BTRFS_* constants
* xlat/btrfs_features_compat_ro.in: Add
BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID introduced
by linux kernel commit v4.9-rc1~7^2^2~4.
2016-11-18 15:23:35 +00:00
a082fe833e Update BPF_* constants
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_PERF_EVENT introduced
by linux kernel commit v4.9-rc1~127^2~302^2~4.
2016-11-18 15:23:35 +00:00
Eugene Syromyatnikov
98a93b46fd Add support for pkey_mprotect, pkey_alloc, pkey_free syscalls
* linux/32/syscallent.h: Add syscall entries for pkey_* calls.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* mem.c (do_mprotect): New function, common handler for mprotect and
pkey_mprotect.
(SYS_FUNC(mprotect)): Convert to wrapper around do_mprotect.
(SYS_FUNC(pkey_mprotect)): New function.
* xlat/pkey_access.in: New file.
* pkeys.c: New file containing implementation of pkey_alloc and
pkey_free.
* Makefile.am: Add it.
* NEWS: Mention this enhancement.
* tests/.gitignore: Add pkey_alloc, pkey_free, and pkey_mprotect.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pkey_alloc.test, pkey_free.test, and
pkey_mprotect.test.
* tests/pkey_alloc.c: New file.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/pkey_alloc.test: New test.
* tests/pkey_free.test: Likewise.
* tests/pkey_mprotect.test: Likewise.
2016-11-13 21:41:58 +00:00
Mikulas Patocka
a507a0bb77 Add support for decoding of DM_* ioctl commands
* dm.c: New file.
* xlat/dm_flags.in: Likewise.
* Makefile.am (strace_SOURCES): Add dm.c.
* configure.ac (AC_CHECK_HEADERS): Add linux/dm-ioctl.h.
* defs.h (dm_ioctl): New prototype.
* ioctl.c (ioctl_decode) [HAVE_LINUX_DM_IOCTL_H]: Call dm_ioctl
for 0xfd ioctl type.
* tests/ioctl_dm.c: New file.
* tests/ioctl_dm-v.c: Likewise.
* tests/ioctl_dm.test: New test.
* tests/ioctl_dm-v.test: Likewise.
* tests/.gitignore: Add ioctl_dm and ioctl_dm-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_dm.test and ioctl_dm-v.test.

Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2016-11-10 22:44:49 +03:00
Eugene Syromyatnikov
6ed2a84aab Implement decoding of perf_event_attr structure in perf_event_open syscall
* linux/perf_event_struct.h: New file, definition of struct perf_event_attr
from Linux 4.8
* Makefile.am (strace_SOURCES): Add it.
* xlat/hw_breakpoint_len.in: New file.
* xlat/hw_breakpoint_type.in: Likewise.
* xlat/perf_attr_size.in: Likewise.
* xlat/perf_branch_sample_type.in: Likewise.
* xlat/perf_event_read_format.in: Likewise.
* xlat/perf_event_sample_format.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.
* perf.c [HAVE_LINUX_PERF_EVENT_H]: Remove inclusion of
<linux/perf_event.h>.
(PRINT_XLAT): New macro for simplifying printing values from
sorted xlat.
(printxlat_search): New function, wrapper for xlat_search with behaviour
similar to printval.
(print_perf_event_attr): New print_event_attr structure fetching and
printing function.
(SYS_FUNC(perf_event_open)): Use print_perf_event_attr for displaying
attr argument contents.
* tests/perf_event_open.c: Renamed to
tests/perf_event_open_nonverbose.c.
* tests/perf_event_open.test: add -e verbose=none in order to preserve
output format being checked (in case verbose output is enabled,
contents of attr arguments are shown now); rename to
tests/perf_event_open_nonverbose.test; add -e trace=perf_event_open.
2016-10-31 04:59:10 +03:00
Eugene Syromyatnikov
3e22464ec7 mq: Properly print mq_flags field
mq_flags field of struct mq_attr can contain only O_NONBLOCK flag (other
flags are treated as invalid by mq_getsetattr). Moreover, this field is
ignored by mq_open at all (O_NONBLOCK is set via oflag, not via attr
attribute).

* xlat/mq_attr_flags.in: New file.
* print_mq_attr.c: Include xlat/mq_attr_flags.h.
(printmqattr): New parameter, bool decode_flags; cast members of struct
mq_attr to long long type; use mq_attr_flags xlat for printing mq_flags;
print mq_flags as flags only in case decode_flags parameter is set
to true.
* mq.c (SYS_FUNC(mq_open)): Specify value of false for decode_flags
parameter of printmqattr call.
(SYS_FUNC(mq_getsetattr)): Specify value of true for decode_flags
parameter of printmqattr call.
* tests/mq.expected: Update expected output.
2016-10-29 02:54:02 +03:00
Eugene Syromyatnikov
8e1f1e7a92 file_handle: use separate xlat for name_ta_handle_at flags
Since the only two flags supported are AT_SYMLINK_FOLLOW and
AT_EMPTY_PATH.

* xlat/name_to_handle_at_flags.in: New file.
* file_handle.c (SYS_FUNC(name_to_handle_at)): Use name_to_handle_at_flags
for printing flags parameter.
2016-10-29 02:54:01 +03:00
Eugene Syromyatnikov
951f1b1163 clone: use separate flag list for unshare
Not all clone flags could be passed to unshare (see check_unshare_flags
function in kernel/fork.c).

* xlat/unshare_flags.in: New file.
* clone.c (SYS_FUNC(unshare)): Use unshare_flags for printing flags
parameter.
2016-10-29 02:54:01 +03:00
Eugene Syromyatnikov
7b0ae21f5c clone: use separate xlat for nstype parameter of setns syscall
nstype is not flag set but specific type value against which it is
compared in kernel (see kernel/nsproxy.c, SYSCALL_DEFINE2(setns, ...)).

* xlat/setns_types.in: New file.
* clone.c: Use printxval and setns_types for nstype parameter.
2016-10-29 02:54:01 +03:00
Eugene Syromyatnikov
73acaec01e xlat: add values for MODULE_INIT_* constants
* bjm.c (MODULE_INIT_IGNORE_MODVERSIONS, MODULE_INIT_IGNORE_VERMAGIC):
Remove.
* xlat/module_init_flags.in: Add values for
MODULE_INIT_IGNORE_MODVERSIONS and MODULE_INIT_IGNORE_VERMAGIC records.
2016-10-29 02:54:01 +03:00
Eugene Syromyatnikov
3f86e786f1 xlat: use IN_* prefix for inotify_init1 flag constants
* xlat/inotify_init_flags.in: Replace O_* prefix with IN_* prefix for
O_NONBLOCK and O_CLOEXEC constants, provide fallback definitions.
2016-10-27 23:31:44 +00:00
Eugene Syromyatnikov
79fb93a7c6 xlat: provide fallback definitions for CLOCK_* constants
Since new values have been added gradually over various kernel versions,
it's better to define them explicitly in order to avoid situations when
strace built with older kernel headers cannot decode some recently
defined values.

* xlat/clocknames.in: Add values for constants.
2016-10-26 01:06:09 +00:00
Eugene Syromyatnikov
e32f7eeefc xlat: add default values for falloc_flags constants
In order to avoid dependence of declared constants to headers available
on build system.

* xlat/falloc_flags.in: Add default values for constants.
2016-09-27 18:01:36 +00:00
38ce2658cd Add more fs magic constants
Add *_MAGIC constants defined for some relatively widespread
non-mainline filesystems.

* xlat/fsmagic.in: Add AUFS_SUPER_MAGIC, GPFS_SUPER_MAGIC,
VZFS_SUPER_MAGIC, and ZFS_SUPER_MAGIC constants.
2016-09-19 19:51:30 +00:00
eb5b530be3 Add more fs magic constants
Add *_MAGIC constants defined inside linux fs but not explicitly
exported via linux uapi.

* xlat/fsmagic.in: Add HFS_SUPER_MAGIC, HFSPLUS_SUPER_MAGIC,
EXOFS_SUPER_MAGIC, CEPH_SUPER_MAGIC, UBIFS_SUPER_MAGIC, JFS_SUPER_MAGIC,
BEFS_SUPER_MAGIC, NTFS_SB_MAGIC, XFS_SB_MAGIC, CONFIGFS_MAGIC,
FUSE_CTL_SUPER_MAGIC, FUSE_SUPER_MAGIC, AFS_FS_MAGIC, OCFS2_SUPER_MAGIC,
VXFS_SUPER_MAGIC, LOGFS_MAGIC, SMB2_MAGIC_NUMBER, and CIFS_MAGIC_NUMBER
constants.
2016-09-14 23:52:36 +00:00
6cb1ced84f Update fs *_MAGIC constants
Add fs *_MAGIC constants exported by linux uapi.

* xlat/fsmagic.in: Add BFS_MAGIC, GFS2_MAGIC, and ROMFS_MAGIC constants
defined in linux/bfs_fs.h, linux/gfs2_ondisk.h, and linux/romfs_fs.h,
respectively.
2016-09-14 23:41:19 +00:00
Eugene Syromiatnikov
2909c7c1d8 Refactor common sa_handler printing code
* xlat/sa_handler_values.in: New file.
* signal.c: Include "xlat/sa_handler_values.h".
(get_sa_handler_str, print_sa_handler): New functions.
(SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them.
2016-08-31 15:41:41 +00:00
e31e2c0e57 Update TCP* constants
* xlat/socktcpoptions.in: Add TCP_REPAIR_WINDOW introduced by linux
kernel commit v4.8-rc1~140^2~226.
2016-08-31 08:49:31 +00:00
80b49fb4dc Update SCTP_* constants
* xlat/socksctpoptions.in: Add SCTP_PR_SUPPORTED, SCTP_DEFAULT_PRINFO,
and SCTP_PR_ASSOC_STATUS introduced by linux kernel commits
v4.8-rc1~140^2~148^2~5, v4.8-rc1~140^2~148^2~4, and
v4.8-rc1~140^2~148^2~3, respectively.
2016-08-30 18:22:41 +00:00
9c3f5daa16 Update fs *_MAGIC constants
* xlat/fsmagic.in: Add BALLOON_KVM_MAGIC and ZSMALLOC_MAGIC introduced
by linux kernel commits v4.8-rc1~147^2~82 and v4.8-rc1~147^2~74,
respectively.
2016-08-30 18:19:16 +00:00
6d68e0d4dd Update KEXEC_ARCH_* constants
* xlat/kexec_arch_values.in: Add KEXEC_ARCH_AARCH64 introduced by linux
kernel commit v4.8-rc1~16^2~41.
2016-08-30 18:13:38 +00:00
788e5f37d3 Update ETH_P_* constants
* xlat/ethernet_protocols.in: Add ETH_P_NCSI introduced by linux kernel
commit v4.8-rc1~140^2~65^2~8.
2016-08-30 18:11:13 +00:00
3b9e6a34b8 Update BPF_* constants
* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_CGROUP_ARRAY introduced
by linux kernel commit v4.8-rc1~140^2~212^2~2.
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_XDP introduced
by linux kernel commit v4.8-rc1~140^2~64^2~10.
2016-08-30 18:01:50 +00:00
Eugene Syromyatnikov
606d4b2d54 xlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set
* xlat/futexops.in: Add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and
FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME values supported by linux kernel
since commit v4.5-rc1~172^2.
2016-08-30 17:26:58 +00:00
4b69c4736c Add sparc64 specific ptrace constants
* xlat/ptrace_cmds.in: Add PTRACE_GETREGS64, PTRACE_SETREGS64,
PTRACE_GETFPREGS64, and PTRACE_SETFPREGS64.
2016-08-16 09:15:44 +00:00
469fd109cd Consistently use extended regular expressions where appropriate
When grep or sed is used with basic regular expressions containing
'(', ')', '{', '}', '|', '?', and '+' special characters, convert them
to extended regular expressions for better portability and readability.

* generate_mpers_am.sh: Convert grep and sed BREs to EREs.
* Makefile.am (ioctl_redefs%.h, m%_type_defs.h, m%_funcs.h,
mpers_printer_decl_pattern, printers.h, %_printer_decls.h,
%_printer_defs.h): Convert sed BREs to EREs.
* generate_sen.sh: Likewise.
* linux/mips/genstub.sh: Likewise.
* make-dsc: Likewise.
* mpers.sh: Likewise.
* xlat/gen.sh: Likewise.
* tests/Makefile.am (ksysent.h): Likewise.
* tests/ksysent.sed: Likewise.
* tests/pc.test: Likewise.
* tests/strace-S.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-k.test: Likewise.
2016-07-28 18:32:18 +00:00
b412d75f74 Fix corner cases of ipc syscall decoding
* xlat/ipccalls.in: New file.
* ipc.c: New file.
* Makefile.am (libstrace_a_SOURCES): Add it.
* linux/dummy.h (sys_ipc): Remove stub alias.
* syscall.c (decode_ipc_subcall): Treat 1st argument of ipc syscall
as "unsigned int".
[S390 || S390X]: Skip ipc cubcalls that have non-zero version.
[SPARC64]: Likewise, for the native personality.
Save ipc cubcall version for later use by specific ipc parsers.
* ipc_msg.c (SYS_FUNC(msgrcv)): Handle non-zero ipc subcall version.
[SPARC64]: Handle non-ipc_kludge case for the native personality.
* linux/subcall.h (msgrcv): Change nargs from 4 to 5.
* linux/s390/syscallent.h (ipc): Change nargs from 6 to 5.
* linux/s390x/syscallent.h (ipc): Likewise.
2016-07-22 19:28:06 +00:00
e0a0d89bc5 Fix corner cases of socketcall syscall
* xlat/socketcalls.in: New file.
* socketcall.c: New file.
* Makefile.am (libstrace_a_SOURCES): Add it.
* linux/dummy.h (sys_socketcall): Remove stub alias.
* syscall.c (decode_socket_subcall): Treat 1st argument of socketcall
as "int".  Do not substitute syscall until all socketcall arguments
have been fetched successfully.
2016-07-20 11:16:14 +00:00
838306234f xlat/shutdown_modes.in: convert to modern syntax
* xlat/shutdown_modes.in: Replace open-coded xlat table with a list
of constants.
2016-07-19 17:46:33 +00:00
Fabien Siron
2850f745ca Add a general netlink socket parser
Introduce a general socket netlink parser which prints the header and
a string for the remaining part of the buffer.  It doesn't handle all
the netlink flags and types yet because the parser needs more
information, this will be implemented later.

* net.c (decode_sockbuf): New function.
(SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)):
Use it instead of printstr.
* msghdr.c (print_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto()
for netlink sockets.
* netlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink, getfdproto): New prototypes.
(iov_decode): Add IOV_DECODER_NETLINK.
* io.c (print_iovec): Use decode_netlink().
* util.c (getfdproto): Remove static keyword.
* xlat/netlink_flags.in: New file.
* xlat/netlink_types.in: New file.
2016-07-07 09:46:51 +00:00
7499ce0244 Update sigaltstack SS_* constants
* xlat/sigaltstack_flags.in: Add SS_AUTODISARM introduced
by linux kernel commit v4.7-rc1~195^2.
2016-07-07 09:39:49 +00:00
fdedff6e7e Update fs *_MAGIC constants
* xlat/fsmagic.in: Add NSFS_MAGIC, TRACEFS_MAGIC, BPF_FS_MAGIC,
and UDF_SUPER_MAGIC introduced by linux kernel commits
v3.19-rc1~53^2~7^2~1, v4.1-rc1~147^2~4, v4.4-rc1~141^2~17^2~1,
and v4.7-rc1~161^2, respectively.
2016-07-07 09:39:37 +00:00
ccd915a7ee Update KEYCTL_* constants
* xlat/keyctl_commands.in: Add KEYCTL_DH_COMPUTE introduced
by linux kernel commit v4.7-rc1~124^2~2^2~2^2.
2016-07-05 22:39:09 +00:00
c77c43406f Update input event constants
* xlat/evdev_keycode.in: Add KEY_* constants introduced
by linux kernel commit v4.7-rc6~32^2~6^2.
2016-07-05 21:59:36 +00:00
5e2437567c Update RWF_* constants
* xlat/rwf_flags.in: Add RWF_DSYNC and RWF_SYNC introduced
by linux kernel commit v4.7-rc1~158^2~1.
2016-07-04 22:37:38 +00:00
021f2f365f Update BPF_MAP_TYPE_* constants
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_TRACEPOINT introduced
by linux kernel commit v4.7-rc1~154^2~332^2~6.
2016-07-07 09:01:29 +00:00
45ae937ced net.c: fix printing AF_PACKET socket addresses
* defs.h (print_ifindex, print_sockaddr_data_ll): New prototypes.
* net.c: Stop including "xlat/af_packet_types.h".
(print_ifindex): Remove static keyword.
(print_sockaddr_data_l): Remove.
* sockaddr_ll.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/arp_hardware_types.in: New file.
* xlat/ethernet_protocols.in: Likewise.
2016-06-24 17:43:52 +00:00
324f68d439 net.c: fix printing AF_BLUETOOTH socket addresses
* xlat/hci_channels.in: New file.
* net.c (print_sockaddr_data_raw): New function.
(print_sockaddr): Use it.
[HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/hci_channels.h".
[HAVE_BLUETOOTH_BLUETOOTH_H] (print_sockaddr_data_bt): Fix printing
sockaddr_hci, sockaddr_sco, sockaddr_rc, and sockaddr_l2 structures.
2016-06-24 15:49:31 +00:00
72fd77a483 xlat/addrfams.in: provide fallback definitions
* xlat/addrfams.in: add fallback definitions for constants.
2016-06-21 16:45:29 +00:00
b01b384871 Update AF_* constants
* xlat/addrfams.in: Add AF_QIPCRTR.
2016-06-21 16:45:22 +00:00
e139cbe969 Consistently use AF_UNIX over AF_LOCAL
As these constants have the same value 1, let's use and print only one
of them, e.g. AF_UNIX.

* xlat/addrfams.in (AF_LOCAL): Remove.
* tests/net-accept-connect.c (main): Replace AF_LOCAL with AF_UNIX.
* tests/net-y-unix.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
2016-06-20 22:52:49 +00:00
900503c90d Do not check for old sysctl enums
Assume that sysctl enums defined since linux v2.6 are always defined,
with a signle exception: check for CTL_PROC which definition was removed
in v2.6.18 and restored later in v2.6.23.

* configure.ac (AC_CHECK_DECLS): Remove old constants.
* xlat/sysctl_kern.in: Mark constants older than KERN_PRINTK_RATELIMIT
as unconditional.
* xlat/sysctl_net.in: Mark constants older than NET_LLC
as unconditional.
* xlat/sysctl_net_core.in: Mark constants older than NET_CORE_BUDGET
as unconditional.
* xlat/sysctl_net_ipv4.in: Mark constants older than
NET_IPV4_IGMP_MAX_MSF as unconditional.
* xlat/sysctl_net_ipv4_conf.in: Mark constants older than
NET_IPV4_CONF_FORCE_IGMP_VERSION as unconditional.
* xlat/sysctl_net_ipv4_route.in: Mark constants older than
NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS as unconditional.
* xlat/sysctl_net_ipv6.in: Mark constants older than
NET_IPV6_MLD_MAX_MSF as unconditional.
* xlat/sysctl_net_ipv6_route.in: Mark constants older than
NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS as unconditional.
* xlat/sysctl_net_unix.in: Mark all constants as unconditional.
* xlat/sysctl_root.in: Mark constants older than CTL_ARLAN
as unconditional.
* xlat/sysctl_vm.in: Mark constants older than VM_MAX_MAP_COUNT
as unconditional.
2016-06-06 18:07:04 +00:00
0e2c5e226b xlat: extend syntax
* xlat/gen.sh: Implement #conditional directive that turns on
preprocessor checks turned off earlier by #unconditional directive.
2016-06-06 18:07:04 +00:00