487 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
2d88ec9e39 xlat: fix typo in smc_protocols.in
* xlat/smc_protocols.in: s/^MCPROTO_SMC/SMCPROTO_SMC/.
2018-08-19 10:26:18 +00:00
Zhibin Li
5ee385e2eb evdev: fix decoding of EVIOCGBIT(0, ...)
There is a comment in drivers/input/evdev.c which says:
/* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */

That is, EVIOCGBIT(0, ...) should return a bit mask with supported
event types instead of SYN_* event codes.

* defs.h (evdev_ev): New prototype.
* evdev.c: Include "xlat/evdev_ev.h" and remove "xlat/evdev_sync.h".
(bit_ioctl) <case EV_SYN>: Replace EV_SYN with 0, use evdev_ev
with XT_SORTED in decode_bitset invocation instead.
* ioctl.c: Do not include "xlat/evdev_ev.h".
(evdev_decode_number): Print nr == 0x20 as "0" instead of "EV_SYN".
* tests/ioctl_evdev.c (main): Use 0 instead of EV_SYN in EVIOCGBIT
output.
* xlat/evdev_sync.in: Remove.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.10~89 "Add decoding for evdev ioctls"
2018-08-19 10:26:18 +00:00
Pierre Marsais
e38143b00e kvm: decode the argument of KVM_CHECK_EXTENSION
xlat/kvm_cap.in has been generated using the following command line:

grep '#define\s\+KVM_CAP' $linux/include/uapi/linux/kvm.h |
sed -E -e 's/^#define\s+([^ \t]+)\s*([0-9]+).*$/printf "%-40s%s\n" \1 \2/e' \
       -e 's/ {8}/\t/g; s/ +/\t/g'

* xlat/kvm_cap.in: New file.
* kvm.c: Include "xlat/kvm_cap.h".
(kvm_ioctl_decode_check_extension): New function.
(kvm_ioctl): Use it.
* tests/ioctl_kvm_run_common.c (main): Check decoding
of KVM_CHECK_EXTENSION command.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
2018-08-19 10:26:18 +00:00
0f09267db0 xlat: update V4L2_CID_USER_*_BASE constants
* xlat/v4l2_control_id_bases.in (V4L2_CID_USER_S2255_BASE,
V4L2_CID_USER_SI476X_BASE, V4L2_CID_USER_SAA7134_BASE,
V4L2_CID_USER_ADV7180_BASE, V4L2_CID_USER_TC358743_BASE,
V4L2_CID_USER_MAX217X_BASE): New constants.
2018-08-19 10:26:18 +00:00
b89a69dec2 xlat: workaround V4L2_CID_USER_IMX_BASE Linux kernel ABI breakage
Linux kernel commit v4.18-rc2-106-g421860b9d47053badce4b247576fa48df9ab4c48
has changed the value of V4L2_CID_USER_IMX_BASE constant introduced
by commit v4.13-rc1~141^2~121 because the old value was already used
by V4L2_CID_USER_MAX217X_BASE.

This is of course an ABI breakage that affects Linux kernels starting
with 4.13 and up to 4.18, as well as their LTS derivatives.

Since the imx driver didn't provide any public control ID definitions,
it looks like the best way to handle this situation is to pretend that
the old value of V4L2_CID_USER_IMX_BASE didn't exist.

* xlat/v4l2_control_id_bases.in (V4L2_CID_USER_IMX_BASE): Redefine.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-08-19 10:26:18 +00:00
f22adb0c7c xlat: regenerate sock_options.in
* xlat/sock_options.in: Regenerate using maint/gen_xlat_defs.sh script.
* xlat/sock_options.sh: Remove.
2018-08-05 18:57:25 +00:00
a6ab0251f0 xlat: add fallback definitions to open_mode_flags
* xlat/open_mode_flags.in: Regenerate using maint/gen_xlat_defs.sh script
to provide fallback definitions.  Implement a workaround for O_NDELAY.

Co-Authored-by: Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-08-05 18:57:25 +00:00
Eugene Syromyatnikov
c20a515b6d xlat: remove non-Linux flags from open_mode_flags
* xlat/open_mode_flags.in (O_PRIV, FNDELAY, FAPPEND, FMARK, FDEFER,
FSHLOCK, FEXLOCK, FCREAT, FTRUNC, FEXCL, FNBIO, FSYNC, FNOCTTY,
O_SHLOCK, O_EXLOCK): Remove flags that are not present in Linux.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-08-05 18:57:25 +00:00
22f0253f33 xlat: add fallback definitions to madvise_cmds
* xlat/madvise_cmds.in: Regenerate using maint/gen_xlat_defs.sh script
to provide fallback definitions.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-08-05 18:57:25 +00:00
d7da491c34 xlat: add fallback definitions to mmap_flags
* xlat/mmap_flags.in: Regenerate using maint/gen_xlat_defs.sh script
to provide fallback definitions.  Implement a workaround for MAP_RENAME.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-08-05 18:57:25 +00:00
e9e2dec950 xlat: update RTA_* constants
* xlat/rtnl_route_attrs.in: Add RTA_IP_PROTO, RTA_SPORT, and RTA_DPORT
* constants introduced by Linux kernel commit v4.18-rc1~114^2~165^2~2.
2018-08-04 11:45:20 +00:00
a72d6cdea0 xlat: update IFLA_BRPORT_* constants
* xlat/rtnl_ifla_brport_attrs.in: Add IFLA_BRPORT_GROUP_FWD_MASK
constant introduced by Linux kernel commit v4.15-rc1~84^2~607.
Add IFLA_BRPORT_NEIGH_SUPPRESS constant introduced by Linux kernel
commit v4.15-rc1~84^2~523^2~2.
Add IFLA_BRPORT_ISOLATED constant introduced by Linux kernel commit
v4.18-rc1~114^2~142.
2018-08-04 11:45:20 +00:00
90eee029a9 xlat: update IFA_* constants
* xlat/rtnl_addr_attrs.in: Add IFA_RT_PRIORITY constant introduced
by Linux kernel commit v4.18-rc1~114^2~108^2~3
2018-08-04 11:45:20 +00:00
3ecff1d391 xlat: update RTPROT_* constants
* xlat/routing_protocols.in: Add RTPROT_BGP, RTPROT_ISIS, RTPROT_OSPF,
RTPROT_RIP, and RTPROT_EIGRP constants introduced by Linux kernel commit
v4.18-rc1~114^2~90.
2018-08-04 11:45:20 +00:00
150197054f xlat: save the script used to generate xlat/sock_options.in
* xlat/sock_options.sh: New file from commit message of commit v4.23~199.
2018-08-01 14:57:16 +00:00
Eugene Syromyatnikov
7374607613 xlat: update bpf(2)-related constants
* xlat/bpf_attach_type.in (BPF_CGROUP_UDP4_SENDMSG,
BPF_CGROUP_UDP6_SENDMSG): New constant, introduced by Linux commit
v4.18-rc1~114^2~9^2~20^2~4.
(BPF_LIRC_MODE2): New constant, introduced by Linux commit
v4.18-rc1~114^2~9^2~15^2~1.
* xlat/bpf_commands.in (BPF_BTF_LOAD): New constant, introduced by Linux
commit v4.18-rc1~114^2~417^2~1^2~5.
(BPF_BTF_GET_FD_BY_ID): New constant, introduced by Linux commit
v4.18-rc1~114^2~223^2~21^2~4.
(BPF_TASK_FD_QUERY): New constant, introduced by Linux commit
v4.18-rc1~114^2~148^2~1^2~5.
* xlat/bpf_map_types.in (BPF_MAP_TYPE_XSKMAP): New constant, introduced
by Linux commit v4.18-rc1~114^2~304^2~4^2~8.
(BPF_MAP_TYPE_SOCKHASH): New constant, introduced by Linux commit
v4.18-rc1~114^2~223^2~5^2~2.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_LWT_SEG6LOCAL): New constant,
introduced by Linux commit v4.18-rc1~114^2~148^2~2^2~1.
(BPF_PROG_TYPE_LIRC_MODE2): New constant, introduced by Linux commit
v4.18-rc1~114^2~9^2~15^2~1.
* tests/bpf.c: Update expected output.
2018-07-11 00:00:57 +00:00
Masatake YAMATO
b7416438b8 kvm: attach the exit reason of vcpu as auxstr to KVM_RUN output
In KVM, a virtual machine implementation like Qemu can access a vcpu
via ioctl.  KVM_RUN is an ioctl command to enter vcpu.  The command
returns control for various reasons: needs of device emulation or
consuming time slices are the typical ones.  The vmi takes a different
action for the reason.

We, strace users, want to know the reason to understand kvm.  This
change prints the reason as auxstr if "-e kvm=vcpu" option is given,
and if strace runs on Linux 4.16.0 or higher, which includes commit
e46b469278a59781f9b25ff608af84892963821b, "kvm: embed vcpu id to dentry
of vcpu anon inode."

The way to get the reason is a bit complicated because the ioctl does
not return it to the userspace directly.  Instead, the vmi and kvm
communicate via an area of the process virtual memory where the fd of
vcpu is mmap'ed.  strace must peek the area to know the reason.

The change does three things: (1) recording the area for the given vcpu
when the target calls VCPU_CREATE to vcpu_info_list per tcb data field,
(2) verifying the data recorded in vcpu_info_list before doing (3), and
(3) decoding the exit reason field of the area.

The change is complicated because there is a case that strace
does not have a chance to do (1) if -p option is used.
In this case, vcpu_info data created in the step (2).

The area has more fields than "exit reason",
dumping them may be implemented in the future.

* defs.h (struct tcb) [HAVE_LINUX_KVM_H]: Add vcpu_info_list field.
[HAVE_LINUX_KVM_H]: (kvm_run_structure_decoder_init,
kvm_vcpu_info_free): New declarations.
* strace.c (usage): Add "kvm" as a new expression for -e option.
(droptcb): Call kvm_vcpu_info_free.
* filter_qualify.c (qualify_kvm): New function calling
kvm_run_structure_decoder_init to enable for attaching the exit
reason to auxstr.
(qual_options): Add "kvm" as an entry.
* xlat/kvm_exit_reason.in: New file.
* kvm.c: Include xmalloc.h and mmap_cache.h.
(dump_kvm_run_structure): New static variable.
(kvm_run_structure_decoder_init): New function.
(vcpu_info): New struct definition representing the 3-tuple: vcpu file
descriptor, id of the vcpu, and mmap'ed entry.
(vcpu_find, vcpu_alloc, vcpu_register, vcpu_getinfo,
kvm_vcpu_info_free): New functions to access tcb's vcpu_info_list
field and vcpu_info data type.
(is_map_for_file, map_len): New helper functions.
(kvm_ioclt_run_attach_auxstr, kvm_ioctl_decode_run): New functions
decoding vcpu exit reason and attaching the decoded data to auxstr
field of tcb.
(kvm_ioctl_create_vcpu): Call vcpu_register to make an entry mapping
a file descriptor and the vcpu id associated with the fd.
(kvm_ioctl): Call kvm_ioctl_decode_run.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-07-07 10:29:02 +00:00
Pierre Marsais
546181b267 kvm: decode the argument of KVM_SET_CPUID2 and KVM_GET_*_CPUID ioctl commands
* configure.ac (AC_CHECK_TYPES): Add struct kvm_cpuid2.
* xlat/kvm_cpuid_flags.in: New file.
* kvm.c [HAVE_STRUCT_KVM_CPUID2]: Include "xlat/kvm_cpuid_flags.h".
[HAVE_STRUCT_KVM_CPUID2] (print_kvm_cpuid_entry, kvm_ioctl_decode_cpuid2):
New functions.
(kvm_ioctl) [HAVE_STRUCT_KVM_CPUID2]: Use kvm_ioctl_decode_cpuid2.
* NEWS: Mention this improvement.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-07-07 10:29:02 +00:00
Eugene Syromyatnikov
a219217119 xlat: add AUDIT_INTEGRITY_EVM_XATTR to nl_audit_types
* xlat/nl_audit_types.in (AUDIT_INTEGRITY_EVM_XATTR): New constant,
introduced by Linux commit v4.18-rc1~100^2~9.
2018-06-18 18:58:01 +02:00
Eugene Syromyatnikov
14e385877d xlat: add UDP_SEGMENT to sock_udp_options
* xlat/sock_udp_options.in (UDP_SEGMENT): New constant, introduced by
Linux commit v4.18-rc1~114^2~377^2~8.
2018-06-18 18:58:01 +02:00
Eugene Syromyatnikov
b54134352a aio: print IOCB_CMD_* using xlat
* xlat/aio_cmds.in: New file.
* aio.c (tprint_lio_opcode): Change array of structs "cmds" to array of
enums "subs", use printxval_indexn_ex for printing cmd, return sub type
using subs array.
2018-06-18 01:02:13 +02:00
Eugene Syromyatnikov
59974bed26 xlat/sock_tcp_options.in: add #value_indexed
* xlat/sock_tcp_options.in: Add #value_indexed, provide fallback
definitions.
* net.c (print_sockopt_fd_level_name) <case SOL_TCP>: Use
printxval_index instead of printxval.
2018-06-18 01:02:13 +02:00
Eugene Syromyatnikov
af4146c06e xlat/sock_tcp_options.in: update
* xlat/sock_tcp_options.in (TCP_ZEROCOPY_RECEIVE): New constant,
introduced by Linux commit v4.18-rc1~114^2~351^2~1.
(TCP_INQ): New constant, introduced by Linux commit v4.18-rc1~114^2~330.
2018-06-18 01:02:13 +02:00
Eugene Syromyatnikov
a7e1c1a8ca xlat/sigtrap_codes.in: add TRAP_UNK
* xlat/sigtrap_codes.in (TRAP_UNK): New constant, introduced by Linux
commit v4.17-rc1-15-gdb78e6a.
2018-06-18 01:02:13 +02:00
Eugene Syromyatnikov
b6fec72d5e xlat: describe IPV4_DEVCONF_* weirdness
* xlat/inet_devconf_indices.in: Add a comment about fallback definitions.
2018-06-07 18:02:01 +00:00
Eugene Syromyatnikov
4eab3a43fd rtnl_link: implement IFLA_INFO_DATA for tun devices
* xlat/rtnl_ifla_info_data_tun_attrs.in: New file.
* xlat/tun_device_types.in: Likewise.
* rtnl_link.c: Include xlat/rtnl_ifla_info_data_tun_attrs.h and
xlat/tun_device_types.h.
(decode_nla_tun_type, decode_nla_linkinfo_data_tun): New functions.
(ifla_info_data_tun_nla_decoders): New decoder dispatcher table.
(decode_nla_linkinfo_data): Use decode_nla_linkinfo_data_tun if kind
is
"tun".
2018-06-06 15:10:37 +00:00
Eugene Syromyatnikov
1e6d5a84b8 rtnl_link: implement IFLA_INFO_DATA for bridges
* xlat/rtnl_ifla_info_data_bridge_attrs.in: New file.
* rtnl_link.c: Include xlat/rtnl_ifla_info_data_bridge_attrs.h.
(ifla_info_data_bridge_nla_decoders): New decoder dispatcher table.
(decode_nla_linkinfo_data_bridge, decode_nla_linkinfo_data): New
functions.
(ifla_linkinfo_nla_decoders) <IFLA_INFO_DATA>: Use
decode_nla_linkinfo_data as a decoder.
2018-06-06 15:10:37 +00:00
Eugene Syromyatnikov
97eb4367e4 rtnl_link: decode IFLA_AF_SPEC
* xlat/in6_addr_gen_mode.in: New file.
* xlat/inet6_devconf_indices.in: Likewise.
* xlat/inet6_if_flags.in: Likewise.
* xlat/inet_devconf_indices.in: Likewise.
* xlat/rtnl_ifla_af_spec_inet6_attrs.in: Likewise.
* xlat/rtnl_ifla_af_spec_inet_attrs.in: Likewise.
* xlat/snmp_icmp6_stats.in: Likewise.
* xlat/snmp_ip_stats.in: Likewise.
* rtnl_link.c: Include netinet/in.h, xlat/in6_addr_gen_mode.h,
xlat/inet_devconf_indices.h, xlat/inet6_devconf_indices.h,
xlat/inet6_if_flags.h, xlat/rtnl_ifla_af_spec_inet_attrs.h,
xlat/rtnl_ifla_af_spec_inet6_attrs.h, xlat/snmp_icmp6_stats.h,
and xlat/snmp_ip_stats.h.
(decode_ifla_inet_conf, decode_ifla_inet6_flags,
decode_ifla_inet6_conf, decode_ifla_inet6_stats,
decode_ifla_inet6_cacheinfo, decode_ifla_inet6_icmp6_stats,
decode_ifla_inet6_token, decode_ifla_inet6_agm, decode_ifla_af,
decode_ifla_af_spec): New functions.
(ifla_inet_nla_decoders, ifla_inet6_nla_decoders,
nla_decoder_table_desc): New static constant variables.
(ifinfomsg_nla_decoders) <[IFLA_AF_SPEC]>: Change value from NULL to
decode_ifla_af_spec.
2018-06-06 15:10:37 +00:00
41bfa3bf5f xlat: handle xlat constants that are not identifiers
Extend xlat generator to support such input lines as
	IPV4_DEVCONF_FORWARDING-1	0

This is going to be used later in IFLA_AF_SPEC decoding.

* xlat/gen.sh (cond_def): If the xlat value is not an identifier name,
extract an identifier name from the beginning of xlat value.
2018-06-05 11:04:09 +00:00
Eugene Syromyatnikov
0773735c9d xlat/evdev_keycode.in: remove constants with duplicating values
Those are used for describing input device category and not specific
button.

Reported by clang.

* xlat/evdev_keycode.in (BTN_MOUSE, BTN_JOYSTICK, BTN_GAMEPAD, BTN_DIGI,
BTN_WHEEL, BTN_TRIGGER_HAPPY): Remove.
2018-06-02 16:32:10 +00:00
Eugene Syromyatnikov
6c3f75ecfa rtnl_rule: decode new FRA_* attributes
* nlattr.h (DECL_NLA(ip_proto), DECL_NLA(rt_proto)): New declarations.
* nlattr.c (decode_nla_ip_proto): New function.
* rtnl_route.c (decode_nla_rt_proto): Likewise.
* rtnl_rule.c (decode_rule_port_rang): Likewise.
(fib_rule_hdr_nla_decoders) <[FRA_PROTOCOL]>: New attribute, introduced
by Linux commit v4.17-rc1~148^2~371.
(fib_rule_hdr_nla_decoders) <[FRA_IP_PROTO], [FRA_SPORT_RANGE],
[FRA_DPORT_RANGE]>: New attributes, introduced by Linux commit
v4.17-rc1~148^2~328^2~4.
* xlat/rtnl_rule_attrs.in (FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE,
FRA_DPORT_RANGE): New constants.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-30 20:50:29 +00:00
Eugene Syromyatnikov
540d70fcb6 nlattr: print index names in netlink meminfo array
* xlat/netlink_sk_meminfo_indices.in: New file.
* nlattr.c: Include xlat/netlink_sk_meminfo_indices.h.
(decode_nla_meminfo): Use print_array_ex, pass
netlink_sk_meminfo_indices as index xlat table.
* tests/nlattr_inet_diag_msg.c: Update expected output.
2018-05-30 10:13:06 +00:00
Eugene Syromyatnikov
d8dfba18be bpf: add support for instruction decoding
* xlat/ebpf_regs.in: New file.
* bpf.c (struct ebpf_insn, struct ebpf_insns_data): New type definitions.
(print_ebpf_insn, print_ebpf_prog): New functions.
(DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Use them.
2018-05-28 17:34:50 +00:00
Eugene Syromyatnikov
7adb5a2f9e Implement PERF_EVENT_IOC_* decoding
* perf.c (fetch_perf_event_attr, print_perf_event_attr): Remove "static"
qualifier.
* defs.h (fetch_perf_event_attr, print_perf_event_attr): New
declarations.
* perf_event_struct.h (struct perf_event_query_bpf): New type
definition.
* perf_ioctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/perf_ioctl_cmds.in: New file.
* xlat/perf_ioctl_flags.in: Likewise.
* ioctl.c (ioctl_decode) <case '$'>: Call perf_ioctl.
* tests/gen_tests.in (ioctl_perf): New test.
* tests/ioctl_perf.c: New file.
* tests/pure_executables.list: ioctl_perf.
* tests/.gitignore: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-28 17:34:50 +00:00
Eugene Syromyatnikov
e1d94ea918 xlat: update IPPROTO_* constants
* xlat/inet_protocols.in (IPPROTO_GGP, IPPROTO_HELLO, IPPROTO_ND):
Remove, not defined in Linux.
(IPPROTO_BEETPH): New constant, introduced by Linux commit
v2.6.19-rc1~33^2.
(IPPROTO_L2TP): New constant, introduced by Linux commit
v2.6.35-rc1~473^2~594.
(IPPROTO_MH): New constant, introduced by Linux commit
v2.6.19-rc1~1272^2~157.
Add default values to constants, sort the file.
2018-05-25 09:15:03 +00:00
Eugene Syromyatnikov
970eacfcdb xlat: add fallback definitions to RTPROT_* constants
* xlat/routing_protocols.in: Add default values to constants.
2018-05-25 09:15:03 +00:00
Eugene Syromyatnikov
5cf62f3e7a xlat: add SECCOMP_FILTER_FLAG_SPEC_ALLOW
* xlat/seccomp_filter_flags.in (SECCOMP_FILTER_FLAG_SPEC_ALLOW): New
constant, introduced by Linux commit v4.17-rc3-24-g00a02d0.
* tests/seccomp-filter.c: Update expected output.
* tests/seccomp-filter-v.c: Likewise.
2018-05-25 09:15:03 +00:00
Eugene Syromyatnikov
be0d6a847b prctl: add PR_GET_SPECULATION_CTRL/PR_SET_SPECULATION_CTRL decoding
* xlat/pr_spec_cmds.in: New fille.
* xlat/pr_spec_get_store_bypass_flags.in: Likewise.
* xlat/pr_spec_set_store_bypass_flags.in: Likewise.
* xlat/prctl_options.in (PR_GET_SPECULATION_CTRL,
PR_SET_SPECULATION_CTRL): New constants, introduced by Linux commit
v4.17-rc3-15-gb617cfc.
* prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL,
case PR_SET_SPECULATION_CTRL>: Implement decoding of new prctl options.
* tests/Makefile.am (check_PROGRAMS): Add prctl-spec-inject.
(DECODER_TESTS): Add prctl-spec-inject.test.
* tests/prctl-spec-inject.c: New file.
* tests/prctl-spec-inject.test: New test.
* tests/.gitignore: Add prctl-spec-inject.
2018-05-25 09:15:03 +00:00
Eugene Syromyatnikov
22aa768c1d keyctl: print KEYCTL_SET_REQKEY_KEYRING argument as an integer
* xlat/key_reqkeys.in: Add #val_type int.
* keyctl.c (SYS_FUNC(keyctl)) <case KEYCTL_SET_REQKEY_KEYRING>: Print
arg2 as an integer.
* tests/keyctl.c: Update expected output.
2018-05-25 09:15:03 +00:00
Eugene Syromyatnikov
03b50140c7 bpf: add support for BPF_RAW_TRACEPOINT_OPEN command decoding
* bpf_attr.h (struct BPF_RAW_TRACEPOINT_OPEN_struct): New type
definition.
(BPF_RAW_TRACEPOINT_OPEN_struct_size,
expected_BPF_RAW_TRACEPOINT_OPEN_struct_size): New macros.
* xlat/bpf_commands.in (BPF_RAW_TRACEPOINT_OPEN): New constant,
introduced by Linux commit v4.17-rc1~148^2~19^2~4^2~3.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_RAW_TRACEPOINT): Likewise.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_RAW_TRACEPOINT_OPEN)): New bpf
command decoder.
(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add
BPF_CMD_ENTRY(BPF_RAW_TRACEPOINT_OPEN).
* tests/bpf.c (union bpf_attr_data): Add
BPF_ATTR_DATA_FIELD(BPF_RAW_TRACEPOINT_OPEN).
(BPF_PROG_LOAD_checks): Update.
(init_BPF_RAW_TRACEPOINT_attr2): New function.
(BPF_RAW_TRACEPOINT_OPEN_checks): New checks array.
(main) <checks>: Add CHK(BPF_RAW_TRACEPOINT_OPEN).
2018-05-23 23:27:43 +00:00
Eugene Syromyatnikov
871a9107df xlat: add BPF_PROG_TYPE_SK_MSG
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_MSG): New constant,
introduced by Linux commit v4.17-rc1~148^2~156^2~1^2~13.
* tests/bpf.c (BPF_PROG_LOAD_checks): Update expected output.
2018-05-19 09:15:27 +00:00
Eugene Syromyatnikov
b532e92c6e xlat: update bpf_attach_type constants
* xlat/bpf_attach_type.in (BPF_SK_MSG_VERDICT): New constant,
introduced by Linux commit v4.17-rc1~148^2~156^2~1^2~13.
(BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND): New constants,
introduced by Linux commit v4.17-rc1~148^2~19^2^2~6.
(BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT): New constants,
introduced by Linux commit v4.17-rc1~148^2~19^2^2~3.
(BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND): New constants,
introduced by Linux commit v4.17-rc1~148^2~19^2^2~1.
* tests/bpf.c (BPF_PROG_QUERY_checks): Update expected output.
2018-05-19 09:15:27 +00:00
Eugene Syromyatnikov
2604ea997b xlat/sock_rds_options.in: make it sorted
Define SO_TIMESTAMP twice, for PA-RISC and all the other architectures.

* xlat/sock_rds_options.in [!__hppa__] (SO_TIMESTAMP): Define to 29.
[__hppa__] (SO_TIMESTAMP): Define to 0x4012.
* net.c (print_sockopt_fd_level_name) <case SOL_RDS>: Use
printxval_search instead of printxval.
2018-05-19 09:15:27 +00:00
cb3a15fe21 bpf: use indexed lookups where appropriate
* xlat/bpf_attach_type.in: Add "#value_indexed" directive.
* xlat/bpf_class.in: Likewise.
* xlat/bpf_map_types.in: Likewise.
* xlat/bpf_map_update_elem_flags.in: Likewise.
* xlat/bpf_prog_types.in: Likewise.
* xlat/ebpf_class.in: Likewise.
* bpf_filter.c (print_bpf_filter_code): Use printxval_index
instead of printxval for decoding bpf_class and ebpf_class.
* print_fields.h (PRINT_FIELD_XVAL_INDEX): New macro.
* bpf.c: Use it instead of PRINT_FIELD_XVAL for decoding bpf_attach_type,
bpf_map_types, bpf_map_update_elem_flags, and bpf_prog_types.
2018-05-16 10:58:32 +00:00
dbaa7ae9b4 bpf: use printxval_index lookup instead of printxval
* xlat/bpf_commands.in: Add "#value_indexed" directive.
* bpf.c (SYS_FUNC(bpf)): Use printxval_index instead of printxval.
2018-05-15 21:41:47 +00:00
4e0c0becf9 time: use indexed lookups
* defs.h (xlat_idx): New prototype.
* xlat.c (xlat_idx): Remove static qualifier.
* time.c (do_adjtimex): Use xlat_idx instead of xlookup.
(SYS_FUNC(getitimer), SYS_FUNC(setitimer)): Use printxval_index
instead of printxval.
[ALPHA] (SYS_FUNC(osf_getitimer), SYS_FUNC(osf_setitimer)): Likewise.
(printclockname) [CLOCKID_TO_FD]: Likewise.
* xlat/adjtimex_state.in: Add "#value_indexed" directive.
* xlat/clocknames.in: Likewise.
* xlat/cpuclocknames.in: Add "#value_indexed" directive, add default
values to constants.
* xlat/itimer_which.in: Likewise.
2018-05-15 21:41:47 +00:00
3ab43e0228 sockaddr: use printxval_index lookup instead of printxval
* xlat/addrfams.in: Add "#value_indexed" directive.
* xlat/af_packet_types.in: Likewise.
* xlat/hci_channels.in: Likewise.
* sockaddr.c (print_sockaddr_data_bt, print_sockaddr,
* print_sockaddr_data_ll): Use printxval_index instead of printxval.
2018-05-15 21:41:47 +00:00
Eugene Syromyatnikov
2d82c2c50a sockaddr: decode Bluetooth L2 CID values
* xlat/bluetooth_l2_cid.in: New file.
* sockaddr.c: Include xlat/bluetooth_l2_cid.h.
(print_bluetooth_l2_cid): New function.
(print_sockaddr_data_bt): Use it to decode struct sockaddr_l2.l2_cid
field.
* tests/net-sockaddr.c (check_l2): Update expected output.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-15 21:41:47 +00:00
Eugene Syromyatnikov
0e72230ef3 sockaddr: decode Bluetooth L2 PSM values
* xlat/bluetooth_l2_psm.in: New file.
* sockaddr.c: Include xlat/bluetooth_l2_psm.h.
(print_bluetooth_l2_psm): New function.
(print_sockaddr_data_bt): Use it to decode struct sockaddr_l2.l2_psm
field.
* tests/net-sockaddr.c (check_l2): Update expected output.
2018-05-15 21:41:47 +00:00
Eugene Syromyatnikov
9da6cfcc46 sockaddr: decode bluetooth address type names
* xlat/bdaddr_types.in: New file.
* sockaddr.c: Include xlat/bdaddr_types.h.
(print_sockaddr_data_bt): Decode struct sockaddr_l2.l2_bdaddr_type field
using constants from bdaddr_types xlat.
* tests/net-sockaddr.c (check_l2): Check decoding
of struct sockaddr_l2.l2_bdaddr_type field.
2018-05-15 21:41:47 +00:00