Compare commits

...

1206 Commits
v4.13 ... v4.18

Author SHA1 Message Date
c136e9e449 Prepare for 4.18 release
* NEWS: Update for 4.18 release.
2017-07-05 07:08:09 +00:00
bcc7daac6c tests: robustify create_nl_socket based tests against the race condition
There is a race condition between the moment a netlink socket is created
and the moment it is reported via SOCK_DIAG_BY_FAMILY interface.
Add one more operation on the socket created by create_nl_socket
to increase chances of winning the race.

* tests/create_nl_socket.c (create_nl_socket_ext): Add a getsockopt call
with the created socket.
2017-07-04 22:31:08 +00:00
e70dae5954 Update NEWS 2017-07-04 17:52:54 +00:00
f2a8b242be nios2: fix wrong access to "SP" register in user_pt_regs
Starting with linux commit v4.0-rc4~21^2, "SP" register
is available via regs[PTR_SP] member of struct user_pt_regs.

* linux/nios2/arch_regs.h (nios2_sp_ptr): Change type
to "unsigned int *".
* linux/nios2/arch_regs.c (nios2_sp_ptr): Likewise.
Replace .sp with .regs[PTR_SP].

Fixes: http://autobuild.buildroot.net/results/b9f/b9fc25b82f3280872fe1593ac252a8529ba83576
Fixes: v4.16-34-g6117728a ("nios2: export nios2_sp_ptr")
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-04 17:29:18 +00:00
da160ae8ed tests: add multi-process check to qual_fault.test
Check that syscall counters used for tampering are per-tcb.

* tests/qual_fault.c: Include <fcntl.h> for open(),
<sys/param.h> for PATH_MAX, and <sys/wait.h> for wait().
(expfd): Rename to exp_fd, remove const qualifier and initialization.
(gotfd): Rename to got_fd, remove const qualifier and initialization.
(out_fd): New variable, for the expected strace output.
(open_file): New helper function.
(main): Remove st, add num_procs, proc, exp_prefix, got_prefix,
out_prefix, pid_prefix.  Remove stat asserts, update argc assert.
Add num_procs, exp_prefix, got_prefix, out_prefix, pid_prefix
initialization.  Add per-process loop, open expfd, gotfd, out_fd, pidfd
in each one, print process's pid to pidfd, print exit message to out_fd.
Add wait() call for each forked process.
* tests/qual_fault.test (N): increase to 100 in order to check
concurrent process execution.
(check_fault_injection): Take additional argument for the process
count, pass it to qual_fault, add filename variables for expected strace
output and pid file, pass them to qual_fault.
Specify -ff parameter to strace invocation.
Compare write and strace output for the each process.
Update all check_fault_injection invocation with process count argument,
add an invocation with 4 concurrent processes.
* tests/init.sh (TIMEOUT_DURATION): Raise from 120 to 300.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-03 19:31:04 +00:00
dbd060526c tests: adjust TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects
* tests/test_nlattr.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY): Add
support for objects larger than DEFAULT_STRLEN.
* tests/nlattr_inet_diag_msg.c (main): Change pattern size
from DEFAULT_STRLEN to 4096.
* tests/nlattr_netlink_diag_msg.c: Likewise.
* tests/nlattr_unix_diag_msg.c: Likewise.

Reported-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-07-03 15:14:54 +00:00
005c67a900 tests: move DEFAULT_STRLEN macro to tests.h
* tests/tests.h [!DEFAULT_STRLEN] (DEFAULT_STRLEN): New macro.
* tests/mincore.c (DEFAULT_STRLEN): Remove.
* tests/mmsg_name.c: Likewise.
* tests/msg_control.c: Likewise.
* tests/netlink_protocol.c: Likewise.
* tests/nlattr.c: Likewise.
* tests/nlattr_inet_diag_msg.c: Likewise.
* tests/nlattr_netlink_diag_msg.c: Likewise.
* tests/nlattr_unix_diag_msg.c: Likewise.
* tests/printstr.c: Likewise.
* tests/xattr.c: Likewise.
* tests/execve.c: Likewise.
(main): Initialize str_a and str_b arrays at run time.
* tests/execveat.c: Likewise.

Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-07-03 15:14:54 +00:00
7d465949e4 tests: use unified diff in order to improve test log readability
* tests/init.sh (match_diff): Add -u option to the diff invocation.
2017-07-03 15:14:54 +00:00
373265e699 Fix error diagnostics in case of zero argc
* strace.c (init): Adjust argc along with argv,
check that adjusted argc is sane.
* tests/zeroargc.c: New file.
* tests/.gitignore: Add zeroargc.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/options-syntax.test: Check strace error diagnostics
in case of zero argc.
2017-07-02 10:01:22 +00:00
340b00aaa7 Use program_invocation_name instead of a local progname variable
Emulate program_invocation_name only if it is not provided by libc.

* configure.ac: Check for program_invocation_name variable.
* strace.c (progname): Remove.
[!HAVE_PROGRAM_INVOCATION_NAME] (program_invocation_name): New variable.
(verror_msg, error_msg_and_help): Use it instead of progname.
(init): Initialize program_invocation_name instead of progname.
2017-07-02 00:31:50 +00:00
eaa2f6e06d Introduce generic STRINGIFY and STRINGIFY_VAL macros
* macros.h (STRINGIFY, STRINGIFY_VAL): New macros.
* mpers_type.h: Include "macros.h".
[IN_MPERS] (STRINGIFY): Remove.
* tests/sockname.c (TEST_SYSCALL_STR__, TEST_SYSCALL_STR_): Remove.
(TEST_SYSCALL_STR): Use STRINGIFY_VAL.

Co-authored-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>
2017-07-02 00:11:31 +00:00
38198609df Introduce macros.h
Introduce a separate header file for generic macros shared between
strace and its tests.  Start this unification with ARRAY_SIZE macro.

* defs.h: Include "macros.h".
(ARRAY_SIZE): Move ...
* macros.h: ... to new file.
* Makefile.am (strace_SOURCES): Add it.
* tests/tests.h: Include "macros.h".
(ARRAY_SIZE): Remove.  All callers updated.
2017-07-02 00:11:31 +00:00
5f4842dee1 quota: use PRINT_FIELD_FLAGS
* quota.c (struct xfs_dqblk): Change d_flags field's type from int8_t
to uint8_t.
(decode_cmd_data): Use PRINT_FIELD_FLAGS.
2017-07-01 20:08:39 +00:00
26954f7753 Unify different generic PRINT_FIELD_* implementations
Create a new header print_fields.h and move generic PRINT_FIELD_*
macros there.

* print_fields.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_sock_diag.c: Include "print_fields.h".
(PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_COOKIE, PRINT_FIELD_FLAGS,
PRINT_FIELD_XVAL): Move to print_fields.h file.
* quota.c: Include "print_fields.h".
(PRINT_FIELD_D): Move to print_fields.h file.
(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* statx.c: Include "print_fields.h".
(PRINT_FIELD_U): Remove.
(SYS_FUNC(statx)): Update PRINT_FIELD_U callers.
* tests/quotactl.h: Include "print_fields.h".
* tests/quotactl-xfs.c: Update callers of PRINT_FIELD_* macros.
* tests/quotactl.c: Likewise.
(PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* tests/test_nlattr.h: Include "print_fields.h".
(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
* tests/xstatx.c: Include "print_fields.h".
(PRINT_FIELD_U): Remove.
(print_stat): Update PRINT_FIELD_U callers.
* tests/tests.h [!STRACE_PRINTF] (STRACE_PRINTF): Define to printf.
2017-07-01 13:14:49 +00:00
373ff8cc4f arc: fix wrong access to "sp" member in user_regs_struct
"sp" register is a member of "scratch" structure (which is nested
in user_regs_struct)

* linux/arc/arch_regs.c: Replace .sp with .scratch.sp .

Fixes: v4.16-31-g134042a5 ("arc: export arc_sp_ptr")
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-01 09:51:24 +00:00
293e98256a aarch64, tile: replace struct ucontext with ucontext_t
glibc >= 2.26 has dropped the tag struct ucontext from ucontext_t type.

* linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Replace
struct ucontext with ucontext_t.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-01 09:47:02 +00:00
1b7a74f3e0 tests: enhance nlattr_unix_diag_msg test
* tests/nlattr_unix_diag_msg.c: Include "test_nlattr.h".
(test_unix_diag_vfs, test_unix_diag_icons, test_unix_diag_rqlen):
Remove.
(init_unix_diag_msg): Add const qualifier to arguments and variables.
(print_unix_diag_msg, print_uint): New functions.
(main): Use them and macros from test_nlattr.h file.
2017-07-01 00:05:39 +00:00
d4b9472d5f tests: check decoding of netlink unix_diag_msg attributes
* tests/nlattr_unix_diag_msg.c: New file.
* tests/gen_tests.in (nlattr_unix_diag_msg): New entry.
* tests/pure_executables.list: Add nlattr_unix_diag_msg.
* tests/.gitignore: Likewise.
2017-07-01 00:05:39 +00:00
79b7b037f4 netlink_sock_diag: ensure that structure field names are printed properly
* netlink_sock_diag.c (decode_unix_diag_vfs, decode_unix_diag_rqlen):
Use PRINT_FIELD_U to print structure fields.
2017-07-01 00:05:39 +00:00
d5edba15aa netlink_sock_diag: add const qualifiers
Add const qualifiers to auto variables and function arguments.
This change does not affect the code generated by the compiler,
the purpose of these "const" qualifiers is to highlight the intent.

* netlink_sock_diag.c (decode_unix_diag_vfs, decode_unix_diag_inode,
decode_unix_diag_rqlen): Add const qualifier to tcp, addr, and len
arguments.
2017-07-01 00:05:39 +00:00
762bb69382 netlink: decode AF_UNIX unix_diag_msg attributes
* netlink_sock_diag.c (unix_diag_msg_nla_decoders): New array.
(decode_unix_diag_msg): Use it.
* linux/unix_diag.h (unix_diag_vfs, unix_diag_rqlen): New structures.
2017-07-01 00:05:39 +00:00
e4cfb43cd3 tests: enhance nlattr_netlink_diag_msg test
* tests/nlattr_netlink_diag_msg.c: Include "test_nlattr.h".
(test_netlink_diag_groups, test_netlink_diag_rx_ring,
test_netlink_diag_flags): Remove.
(init_netlink_diag_msg): Add const qualifier to arguments and variables.
(print_netlink_diag_msg, print_xlong): New functions.
(main): Use them and macros from test_nlattr.h file.
2017-07-01 00:05:39 +00:00
5f81d2df70 tests: check decoding of netlink_diag_msg attributes
* tests/nlattr_netlink_diag_msg.c: New file.
* tests/gen_tests.in (nlattr_netlink_diag_msg): New entry.
* tests/pure_executables.list: Add nlattr_netlink_diag_msg.
* tests/.gitignore: Likewise.
2017-07-01 00:05:39 +00:00
e95ea72a8a netlink_sock_diag: ensure that structure field names are printed properly
* netlink_sock_diag.c (decode_netlink_diag_ring): Use PRINT_FIELD_U
to print structure fields.
2017-07-01 00:05:39 +00:00
a6a03cefb5 netlink_sock_diag: add const qualifiers
Add const qualifiers to auto variables and function arguments.
This change does not affect the code generated by the compiler,
the purpose of these "const" qualifiers is to highlight the intent.

* netlink_sock_diag.c (print_group, decode_netlink_diag_groups,
decode_netlink_diag_ring, decode_netlink_diag_flags): Add const
qualifier to tcp, addr, and len arguments.
2017-07-01 00:05:39 +00:00
f731b6b1e6 netlink: decode AF_NETLINK netlink_diag_msg attributes
* linux/netlink_diag.h (netlink_diag_ring): New structure.
(NDIAG_FLAG_*): New macros.
* netlink_sock_diag.c: Include "xlat/netlink_socket_flags.h".
(print_group, decode_netlink_diag_groups, decode_netlink_diag_ring,
decode_netlink_diag_flags): New functions.
(netlink_diag_msg_nla_decoders): New array.
(decode_netlink_diag_msg): Use it.
* xlat/netlink_socket_flags.in: New file.
2017-07-01 00:05:39 +00:00
0c3ef7dffd netlink_sock_diag: print inet_diag_sockid.idiag_if as an interface index
* netlink_sock_diag.c (print_inet_diag_sockid): Print idiag_if field
using print_ifindex.
* tests/nlattr_inet_diag_msg.c: Include <net/if.h>.
(IFINDEX_LO): New macro.
(init_inet_diag_msg): Set inet_diag_sockid.idiag_if field.
(print_inet_diag_msg): Update expected output.
2017-07-01 00:05:39 +00:00
6c7c4e50b1 tests: check decoding of several standard netlink attributes
* tests/nlattr_inet_diag_msg.c (main): Check decoding of uint32_t,
uint8_t, and zero-terminated string attributes.

Co-authored-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-07-01 00:05:39 +00:00
aecff115c0 tests: enhance nlattr_inet_diag_msg test
* tests/test_nlattr.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/nlattr_inet_diag_msg.c: Include "test_nlattr.h".
(test_inet_diag_meminfo, test_inet_diag_vegasinfo,
test_inet_diag_dctcpinfo, test_inet_diag_bbrinfo): Remove.
(address): New variable.
(init_inet_diag_msg): Remove "address" argument, add const qualifier
to all remaining arguments.
(print_inet_diag_msg, print_uint): New functions.
(main): Use macros from test_nlattr.h file.
2017-06-30 21:38:49 +00:00
16ebda581e tests: check decoding of netlink inet_diag_msg attributes
* tests/nlattr_inet_diag_msg.c: New file.
* tests/gen_tests.in (nlattr_inet_diag_msg): New entry.
* tests/pure_executables.list: Add nlattr_inet_diag_msg.
* tests/.gitignore: Likewise.
2017-06-30 21:38:49 +00:00
1c2e012c22 netlink_sock_diag: ensure that structure field names are printed properly
* netlink_sock_diag.c (PRINT_FIELD_X): New macro.
(decode_inet_diag_meminfo, decode_tcpvegas_info, decode_tcp_dctcp_info,
decode_tcp_bbr_info): Use it and PRINT_FIELD_U to print structure
fields.
2017-06-30 21:38:49 +00:00
0522266f85 netlink_sock_diag: add const qualifiers
Add const qualifiers to auto variables and function arguments.
This change does not affect the code generated by the compiler,
the purpose of these "const" qualifiers is to highlight the intent.

* netlink_sock_diag.c (print_meminfo, decode_meminfo,
decode_inet_diag_meminfo, decode_tcpvegas_info, decode_tcp_dctcp_info,
decode_tcp_bbr_info): Add const qualifier to tcp, addr, and len
arguments.
2017-06-30 21:38:49 +00:00
09b5362f11 netlink: decode AF_INET inet_diag_msg attributes
* linux/inet_diag.h (inet_diag_meminfo, tcpvegas_info,
tcp_dctcp_info, tcp_bbr_info): New structures.
* linux/sock_diag.h (SK_MEMINFO_VARS): New macro.
* netlink_sock_diag.c: Include  <linux/sock_diag.h>.
(print_meminfo, decode_meminfo, decode_inet_diag_meminfo,
decode_tcpvegas_info, decode_tcp_dctcp_info, decode_tcp_bbr_info):
New functions.
(inet_diag_msg_nla_decoders): New array.
(decode_inet_diag_msg): Use it.
2017-06-30 21:38:49 +00:00
91b87e65ff nlattr: add const qualifiers to auto variables and function arguments
This change does not affect the code generated by the compiler,
the purpose of these "const" qualifiers is to highlight the intent.

* nlattr.c (decode_nlattr_with_data, decode_nla_str, decode_nla_strn,
decode_nla_##name): Add const qualifier to tcp, addr, and len arguments.
2017-06-30 21:38:49 +00:00
745ead6451 netlink: introduce nla_decoder_t to parse netlink attributes data
* nlattr.h (nla_decoder_t): New typedef.
(DECL_NLA): New macro.
(decode_nlattr): Add decoders, size and opaque_data argument.
* nlattr.c: (decode_nlattr_with_data): Likewise.
(decode_nla_*): New functions.
* netlink_sock_diag.c (decode_inet_diag_req_compat)
(decode_inet_diag_req_v2, decode_inet_diag_msg)
(decode_netlink_diag_msg, (decode_packet_diag_msg)
(decode_smc_diag_msg, decode_unix_diag_msg): Add decoders,
size and opaque_data arguments. All callers updated.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-30 21:38:49 +00:00
a07665e308 netlink: add a basic netlink attribute parser of AF_SMC diag
* netlink_sock_diag.c: Include "xlat/smc_diag_attrs.h".
(decode_smc_diag_msg): Use decode_nlattr.
* xlat/smc_diag_attrs.in: New file.
2017-06-30 21:38:49 +00:00
ab17493bb2 netlink: add a basic netlink attribute parser of AF_INET diag
* linux/inet_diag.h (INET_DIAG_REQ_*): New enum.
* netlink_sock_diag.c: Include "xlat/inet_diag_attrs.h"
and "xlat/inet_diag_req_attrs.h".
(decode_inet_diag_req_compat, decode_inet_diag_req_v2,
 decode_inet_diag_msg): Use decode_nlattr.
* xlat/inet_diag_attrs.in: New file.
* xlat/inet_diag_req_attrs.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-30 21:38:49 +00:00
6cc89c0314 netlink: add a basic netlink attribute parser of AF_PACKET diag
* linux/packet_diag.h (PACKET_DIAG_*): New enum.
* netlink_sock_diag.c: Include "xlat/packet_diag_attrs.h".
(decode_packet_diag_msg): Use decode_nlattr.
* xlat/packet_diag_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-30 21:38:49 +00:00
4c511a1c99 netlink: add a basic netlink attribute parser of AF_NETLINK diag
* linux/netlink_diag.h (NETLINK_DIAG_*): New enum.
* netlink_sock_diag.c: Include "xlat/netlink_diag_attrs.h".
(decode_netlink_diag_msg): Use decode_nlattr.
* xlat/netlink_diag_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-30 21:38:49 +00:00
4817a2925d netlink_sock_diag: ensure that structure field names are printed properly
* netlink_sock_diag.c (PRINT_FIELD_U, PRINT_FIELD_COOKIE,
PRINT_FIELD_FLAGS, PRINT_FIELD_XVAL): New macros.
(decode_unix_diag_req, decode_unix_diag_msg, decode_netlink_diag_req,
decode_netlink_diag_msg, decode_packet_diag_req, decode_packet_diag_msg,
print_inet_diag_sockid, decode_inet_diag_req_compat,
decode_inet_diag_req_v2, decode_inet_diag_msg, decode_smc_diag_req,
decode_smc_diag_msg): Use them to print structure fields.
2017-06-29 09:22:52 +00:00
89e2e64936 Update ioctl entries from linux v4.12-rc7
* linux/32/ioctls_inc_align16.h: Update from linux v4.12-rc7
(with f7a320ff commit applied on top) using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* NEWS: Mention this.
2017-06-29 09:20:36 +00:00
16f1b5ca72 maint: fix ioctls_sym.sh premature termination
When the list of headers do not fit into the command line, xargs splits
it into several lists and then passes them to grep.  If no headers from
a list match the grep pattern, grep exits with a non-zero status that
causes xargs to exit with a non-zero status, too.

* maint/ioctls_sym.sh: Use "find -exec +" instead of xargs,
ignore its exit status.
2017-06-29 09:17:18 +00:00
663b4f8273 tests: introduce NLMSG_ATTR macro
* tests/tests.h (NLMSG_ATTR): New macro.
* tests/nlattr.c (test_nlattr, test_nla_type): Use it.
2017-06-27 09:43:18 +00:00
54aed21036 netlink: pass NLMSG_DONE messages to family specific payload decoders
While many NLMSG_DONE messages indeed have payload containing
just one integer, there are exceptions. Handle this by passing
payloads of NLMSG_DONE messages to family specific netlink
payload decoders.

* netlink.c (print_nlmsghdr): Do not skip family detection
for nlmsg_type == NLMSG_DONE.
(decode_nlmsg_type): Skip family specific type decoders
for type == NLMSG_DONE.
(decode_nlmsg_flags): Skip family specific decoding of flags
for type == NLMSG_DONE.
(decode_netlink_sock_diag): Skip for nlmsg_type == NLMSG_DONE.
2017-06-27 09:37:09 +00:00
2698d1d060 Unexport die_out_of_memory
Print more specific error diagnostics than a generic "Out of memory"
when an error happens outside xmalloc.c.

* defs.h (die_out_of_memory): Remove prototype.
* strace.c (strace_popen, init): Call perror_msg_and_die instead
of die_out_of_memory.
* unwind.c (unwind_tcb_init): Likewise.
* xmalloc.c (die_out_of_memory): Add static qualifier.
2017-06-26 22:41:28 +00:00
11621507fb Check -s argument early
* util.c (printstr_ex): Move the check that -s argument
does not exceed -1U / 4 ...
* strace.c (init): ... here.
* tests/options-syntax.test: Check it.
2017-06-26 22:30:19 +00:00
4a2a9a7cb1 Include "netlink.h" instead of <linux/netlink.h>
* net.c: Include "netlink.h" instead of <linux/netlink.h>.
* sockaddr.c: Likewise.
* tests/create_nl_socket.c: Likewise.
* tests/net-sockaddr.c: Likewise.
* tests/netlink_audit.c: Likewise.
* tests/netlink_generic.c: Likewise.
* tests/netlink_inet_diag.c: Likewise.
* tests/netlink_netfilter.c: Likewise.
* tests/netlink_route.c: Likewise.
* tests/netlink_selinux.c: Likewise.
* tests/netlink_xfrm.c: Likewise.
* tests/net-yy-netlink.c: Include "netlink.h" instead
of <linux/netlink.h>, remove fallback definition of NETLINK_SOCK_DIAG.
* tests/netlink_netlink_diag.c: Likewise.
* tests/netlink_protocol.c: Likewise.
* tests/netlink_sock_diag.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
* tests/nlattr.c: Likewise.
2017-06-25 00:40:29 +00:00
fd68eabd59 netlink: provide a fallback definition of NETLINK_SOCK_DIAG
Add a fallback definition of NETLINK_SOCK_DIAG to netlink.h
instead of adding these fallback definitions to every file.

* netlink.h: Provide a fallback definition of NETLINK_SOCK_DIAG.
* socketutils.c: Include "netlink.h" instead of <linux/netlink.h>,
remove fallback definition of NETLINK_SOCK_DIAG.
2017-06-24 22:25:28 +00:00
4ec744efce Update prctl ARCH_* constants
* xlat/archvals.in: Add ARCH_GET_CPUID and ARCH_SET_CPUID
introduced by linux kernel commit v4.12-rc1~153^2~2.
2017-06-23 00:31:49 +00:00
586bf2605d Update V4L2_* constants
* xlat/v4l2_buf_types.in: Add V4L2_BUF_TYPE_META_CAPTURE introduced
by linux kernel commit v4.12-rc1~85^2~71.
* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_META_CAPTURE
introduced by the same commit.
* xlat/v4l2_control_flags.in: Add V4L2_CTRL_FLAG_HAS_PAYLOAD,
V4L2_CTRL_FLAG_EXECUTE_ON_WRITE, and V4L2_CTRL_FLAG_MODIFY_LAYOUT
introduced by linux kernel commits v3.17-rc1~112^2~363,
v4.1-rc1~59^2~1^2~63, and v4.12-rc1~85^2~62, respectively.
* xlat/v4l2_control_types.in: Add V4L2_CTRL_TYPE_U8, V4L2_CTRL_TYPE_U16,
and V4L2_CTRL_TYPE_U32 introduced by linux kernel commits
v3.17-rc1~112^2~343 and v3.17-rc1~112^2~112.
2017-06-22 21:48:00 +00:00
683f747adf Update SCTP_* constants
* xlat/socksctpoptions.in: Add SCTP_ENABLE_STREAM_RESET,
SCTP_RESET_STREAMS, SCTP_RESET_ASSOC, SCTP_ADD_STREAMS,
SCTP_RECONFIG_SUPPORTED, and SCTP_PR_STREAM_STATUS introduced
by linux kernel commits v4.11-rc1~124^2~387^2~1, v4.11-rc1~124^2~387^2,
v4.11-rc1~124^2~166^2~2, v4.11-rc1~124^2~166^2, v4.12-rc1~64^3~469^2,
and v4.12-rc1~64^3~276, respectively.
2017-06-22 21:42:00 +00:00
b3b6e66154 Update RTM_* constants
* xlat/nl_route_types.in: Add RTM_DELNETCONF introduced
by linux kernel commit v4.12-rc1~64^3~312^2~6.
2017-06-22 18:36:35 +00:00
88f4d1a528 Update NDIAG_SHOW_* constants
* linux/netlink_diag.h (NDIAG_SHOW_FLAGS): New constant introduced
by linux kernel commit v4.12-rc1~64^3~260.
* xlat/netlink_diag_show.in: Add it.
2017-06-22 18:31:49 +00:00
91d7f7b2b0 Update KEYCTL_* constants
* xlat/keyctl_commands.in: Add KEYCTL_RESTRICT_KEYRING introduced
by linux kernel commit v4.12-rc1~123^2~7^2~2^2~3.
2017-06-22 18:23:08 +00:00
56f95bbf60 Update ARPHRD_* constants
* xlat/arp_hardware_types.in: Add ARPHRD_VSOCKMON introduced
by linux kernel commit v4.12-rc1~129^2~118^2~2.
2017-06-22 18:18:05 +00:00
2337c8c734 Update SO_* constants
* xlat/sockoptions.in: Add SO_MEMINFO, SO_INCOMING_NAPI_ID,
and SO_COOKIE introduced by linux kernel commits v4.12-rc1~64^3~389,
v4.12-rc1~64^3~341^2, and v4.12-rc1~64^3~221^2~1, respectively.
2017-06-22 18:08:24 +00:00
012e650b08 tests: check more corner cases of nlattr decoding
* tests/nlattr.c (test_nlattr): Check decoding in case of invalid
struct nlattr.nla_len.
2017-06-21 16:36:33 +00:00
1794dea92e tests: check decoding of netlink attribute
* tests/nlattr.c: New file.
* tests/gen_tests.in (nlattr): New entry.
* tests/pure_executables.list: Add nlattr.
* tests/.gitignore: Likewise.
2017-06-21 16:36:33 +00:00
d851f5695d netlink: introduce a basic netlink attributes parser
* linux/unix_diag.h (UNIX_DIAG_*): New enum.
* nlattr.c: New file.
* nlattr.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* netlink_sock_diag.c: Include "nlattr.h" and "xlat/unix_diag_attrs.h".
(decode_unix_diag_msg): Use decode_nlattr.
* xlat/unix_diag_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-21 16:36:33 +00:00
72ecbdb9f3 netlink: introduce netlink.h
* netlink.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_sock_diag.c: Include "netlink.h",
remove <sys/socket.h> and <linux/netlink.h>.
* netlink.c: Likewise.
(NLMSG_HDRLEN): Move to netlink.h.
* tests/netlink_protocol.c: Replace <linux/netlink.h> with "netlink.h".
* tests/netlink_sock_diag.c: Likewise.
2017-06-21 16:31:04 +00:00
a726fa5c35 tests: add SET_STRUCT macro to tests.h
* tests/netlink_sock_diag.c (INIT_STRUCT): Rename to SET_STRUCT,
all callers updated.  Move ...
* tests/tests.h: ... here.
2017-06-20 17:41:59 +00:00
0fb4b6e0cb tests: fix potential unaligned access in netlink_sock_diag.test
Despite our efforts made to avoid unaligned access, gcc appears to be
generating instructions that might cause unaligned access when copying
structures to unaligned addresses.

Fix this issue by replacing copying of structures to unaligned addresses
with memcpy calls.

* tests/netlink_sock_diag.c (INIT_STRUCT): New macro.
(test_odd_family_req, test_odd_family_msg, test_unix_diag_req,
test_unix_diag_msg, test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg, test_inet_diag_sockid,
test_inet_diag_req, test_inet_diag_req_v2, test_inet_diag_msg,
test_smc_diag_req, test_smc_diag_msg): Use it to initialize potentially
unaligned struct nlmsghdr.  Do not access nlh->nlmsg_len.
2017-06-19 21:45:58 +00:00
c7f371df30 tests: check decoding of NETLINK_GENERIC message types
* tests/netlink_generic.c: New file.
* tests/gen_tests.in (netlink_generic): New entry.
* tests/pure_executables.list: Add netlink_generic.
* tests/.gitignore: Likewise.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
dc84eddc81 netlink: add decoding of NETLINK_GENERIC protocol families
NETLINK_GENERIC is a protocol stacked on netlink protocol.

When a NETLINK_GENERIC subsystem registers its "family" name in the
kernel at run time, an integer value associated with this name is
assigned by the kernel.  This integer value is specified in struct
nlmsghdr.nlmsg_type of subsequent communications with the
NETLINK_GENERIC subsystem.

This change implements decoding of NETLINK_GENERIC message types in
symbolic form, for example:

  $ ./strace -yy -e 'sendto' ip tcp_metrics > /dev/null
  sendto(4<NETLINK:[GENERIC:12345]>, {{len=20, type=tcp_metrics, ...
  +++ exited with 0 +++

Note that type= specifying the NETLINK_GENERIC protocol family
is decoded properly.

* netlink.c (decode_nlmsg_type_generic): New function.
(nlmsg_types): Add NETLINK_GENERIC entry.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
641f3ef7b6 socketutils: build a dynamic xlat table for NETLINK_GENERIC decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/genetlink.h.
* defs.h (genl_families_xlat): New prototype.
* socketutils.c [HAVE_LINUX_GENETLINK_H]: Include <linux/genetlink.h>.
[HAVE_LINUX_GENETLINK_H] (genl_send_dump_families,
genl_parse_families_response): New helper functions.
(genl_families_xlat): New function for building the xlat table
for NETLINK_GENERIC decoding.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
5dca1b261b dyxlat: new interface for building xlat tables dynamically
xlat tables are usually generated at build time.

printxval is suitable for printing struct nlmsghdr.nlmsg_type for
NETLINK_GENERIC protocol.  However, the corresponding xlat table
cannot be defined at build time because the values are registered
by the kernel at run time.

This change introduces dyxlat functions for building xlat tables
dynamically.  The primary use case is decoding nlmsg_type but this
interface can be used for other purposes.

* defs.h (struct dyxlat): New opaque data type.
(dyxlat_alloc, dyxlat_free, dyxlat_add_pair): New function declarations.
* dyxlat.c: New file.
* Makefile.am (strace_SOURCES): Add it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
d10d64820f Introduce xstrndup function
* configure.ac (AC_CHECK_FUNCS): Add strndup.
* defs.h (xstrndup): New prototype.
* xmalloc.c (xstrndup): New function.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
f639f90241 netlink: do not print extra braces around payloadless nlmsghdr
* netlink.c (decode_nlmsghdr_with_payload): Print braces before
print_nlmsghdr and after decode_payload iff decode_payload is invoked.
* tests/netlink_audit.c (test_nlmsg_type): Update expected output.
* tests/netlink_netfilter.c: Likewise.
* tests/netlink_selinux.c: Likewise.
* tests/netlink_protocol.c (send_query): Likewise.
* tests/netlink_route.c (test_nlmsg_type, test_nlmsg_flags): Likewise.
* tests/netlink_sock_diag.c: Likewise.
* tests/netlink_xfrm.c: Likewise.
2017-06-18 21:43:39 +00:00
08100cd774 Strip argument name of type "struct tcb *" from function prototypes
"struct tcb *" was used in most prototypes along with "struct tcb *tcp",
this change converts the latter form to the former for consistency.
2017-06-17 23:46:01 +00:00
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
e0433c5509 Strip redundant trailing semicolons
Strip trailing semicolons from macro definitions.
Strip extra semicolons from statements terminations.

Reported by kernel's checkpatch.pl script.
2017-06-17 22:50:41 +00:00
6c08f7d65c Fix macros encosure in a do/while loop
Enclose macros with multiple statements and macros starting
with "if" statement in a do/while loop.
Do not enclose single statement macros in a do/while loop.

Reported by kernel's checkpatch.pl script.
2017-06-17 21:51:48 +00:00
170281be5b Use __func__ instead of gcc specific __FUNCTION__
Reported by kernel's checkpatch.pl script.
2017-06-17 20:49:09 +00:00
3baf7ef953 Fix a few initialization style issues
Do not initialise statics and globals to 0, NULL, or false.

Reported by kernel's checkpatch.pl script.
2017-06-17 20:49:09 +00:00
86bce103a6 Fix function prototypes with unspecified arguments
Change functions declared as taking unspecified number of arguments
of unspecified type to functions that take no arguments.

Reported by kernel's checkpatch.pl script.
2017-06-17 20:49:09 +00:00
a74c084611 Fix a few sizeof style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 18:49:58 +00:00
7f2b636a22 Fix a few misspellings in comments
Reported by kernel's checkpatch.pl script.
2017-06-17 10:40:05 +00:00
3d42386923 print_mreq: remove superfluous print_quoted_string calls
The string returned by inet_ntoa(3) has IPv4 dotted-decimal notation,
no need to quote it.

* net.c (print_mreq): Remove print_quoted_string calls.
2017-06-16 00:00:42 +00:00
8384bf8067 tests: check decoding of incomplete SCM_TIMESTAMP* control messages
* tests/msg_control.c (test_scm_timestamp, test_scm_timestampns,
test_scm_timestamping): Check decoding of incomplete control messages.
2017-06-15 23:52:48 +00:00
c0a127d163 msghdr: print SCM_TIMESTAMP* control messages
Add support for printing control messages containing software and/or
hardware timestamps, which are typically enabled by NTP and PTP
implementations.

* print_timeval.c (print_struct_timeval_data_size): New mpers printer.
* print_timespec.c (print_struct_timespec_data_size,
print_struct_timespec_array_data_size): Likewise.
* msghdr.c (print_scm_timestamp, print_scm_timestampns,
print_scm_timestamping): New functions.
(cmsg_socket_printers): Add them.
* NEWS: Mention this change.
* tests/msg_control.c: Include "xlat.h" and "xlat/scmvals.h".
(test_scm_timestamp, test_scm_timestampns, test_scm_timestamping):
New functions.
(test_sol_socket): Use them.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-15 23:52:48 +00:00
97d771159b tests: check decoding of NETLINK_SOCK_DIAG AF_SMC messages
* tests/netlink_sock_diag.c: Include <linux/smc_diag.h>.
(SMC_ACTIVE): New macro.
(test_smc_diag_req, test_smc_diag_msg): New functions.
(main): Use them.
2017-06-15 23:52:48 +00:00
955cc50613 netlink: add a basic socket diag parser of AF_SMC messages
* linux/smc_diag.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* netlink_sock_diag.c: Include <linux/smc_diag.h>,
"xlat/smc_diag_extended_flags.h" and "xlat/smc_states.h".
(decode_smc_diag_req, decode_smc_diag_msg): New functions.
(diag_decoders): Add AF_SMC.
* xlat/smc_diag_extended_flags.in: New file.
* xlat/smc_states.in: Likewise.
2017-06-15 23:52:47 +00:00
c17150366c tests: check decoding of NETLINK_SOCK_DIAG AF_INET messages
* tests/netlink_sock_diag.c: Include <arpa/inet.h>
and <linux/inet_diag.h>.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg): New functions.
(mian): Use them.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-15 23:52:47 +00:00
6fbbf72dcd netlink: add a basic socket diag parser of AF_INET and AF_INET6 messages
* defs.h (inet_protocols): New xlat prototype.
* linux/inet_diag.h (inet_diag_req): New structure.
(INET_DIAG_*): New enum.
* netlink_sock_diag.c: Include <arpa/inet.h>, <linux/inet_diag.h>
and "xlat/inet_diag_extended_flags.h".
(print_inet_diag_sockid, decode_inet_diag_req_compat)
(decode_inet_diag_req_v2, decode_inet_diag_req)
(decode_inet_diag_msg): New functions.
(diag_decoders): Add AF_INET and AF_INET6;
* xlat/inet_diag_extended_flags.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-15 23:52:47 +00:00
bd70a9c411 Introduce print_inet_addr
* defs.h (print_inet_addr): New prototype.
* sockaddr.c (print_inet_addr): New function.
(print_sockaddr_data_in6): Use it.
* net.c (print_mreq6): Likewise.
* tests/ip_mreq.c (main): Update expected output.
2017-06-15 23:52:47 +00:00
a9345e97e2 tests: check decoding of NETLINK_SOCK_DIAG AF_PACKET messages
* tests/netlink_sock_diag.c: Include <linux/if_ether.h>
and <linux/packet_diag.h>.
(test_packet_diag_req, test_packet_diag_msg): New functions.
(main): Use them.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-15 22:44:04 +00:00
e822874c36 netlink: add a basic socket diag parser of AF_PACKET messages
* linux/packet_diag.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* defs.h (ethernet_protocols): New xlat prototype.
* netlink_sock_diag.c: Include <linux/packet_diag.h>
and "xlat/packet_diag_show.h".
(decode_packet_diag_req, decode_packet_diag_msg): New functions.
(diag_decoders): Add AF_PACKET.
* xlat/packet_diag_show.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-15 22:44:04 +00:00
2e8cfe367b tests: check decoding of NETLINK_SOCK_DIAG AF_NETLINK messages
* tests/netlink_sock_diag.c: Include <linux/netlink_diag.h>.
(test_netlink_diag_req, test_netlink_diag_msg): New functions.
(main): Use them.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-15 22:20:41 +00:00
cbb0308640 netlink: add a basic socket diag parser of AF_NETLINK messages
* linux/netlink_diag.h (NDIAG_SHOW_GROUPS, NDIAG_SHOW_RING_CFG):
New macros.
* netlink_sock_diag.c: Include <linux/netlink_diag.h>,
"xlat/netlink_diag_show.h" and "xlat/netlink_states.h".
(decode_netlink_diag_req, decode_netlink_diag_msg): New functions.
(diag_decoders): Add AF_NETLINK.
* xlat/netlink_diag_show.in: New file.
* xlat/netlink_states.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-15 22:20:41 +00:00
4a5b3b30e6 tests: check decoding of NETLINK_SOCK_DIAG AF_UNIX messages
* tests/netlink_sock_diag.c: Include <netinet/tcp.h>
and <linux/unix_diag.h>.
(test_odd_family_req, test_odd_family_msg, test_unix_diag_req,
test_unix_diag_msg): New functions.
(main): Use them.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
Co-authored-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-06-15 00:30:47 +00:00
8e9c9e4631 netlink: add a basic socket diag parser of AF_UNIX messages
* defs.h (socktypes): New xlat prototype.
* linux/unix_diag.h (UDIAG_SHOW_VFS, UDIAG_SHOW_ICONS, UDIAG_SHOW_RQLEN,
UDIAG_SHOW_MEMINFO): New macros.
* netlink_sock_diag.c: Include <sys/socket.h>, <linux/netlink.h>,
<linux/unix_diag.h>, "xlat/tcp_states.h", "xlat/tcp_state_flags.h",
and "xlat/unix_diag_show.h".
(decode_unix_diag_req, decode_unix_diag_msg): New functions.
(netlink_diag_decoder_t): New typedef.
(diag_decoders): New array.
(decode_netlink_sock_diag): Use it.
* xlat/tcp_state_flags.in: New file.
* xlat/tcp_states.in: Likewise.
* xlat/unix_diag_show.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
Co-authored-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-06-15 00:30:47 +00:00
09c4dac214 netlink: introduce family specific payload decoders
* defs.h (netlink_decoder_t): New typedef.
(DECL_NETLINK): New macro.
(decode_netlink_sock_diag): New prototype.
* netlink.c (netlink_decoders): New array.
(decode_payload): Use it to invoke netlink family specific decoders.
* netlink_sock_diag.c: New file.
* Makefile.am (strace_SOURCES): Add it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
Co-authored-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-06-15 00:30:47 +00:00
1637e8771e Update SCM_* constants
* xlat/scmvals.in: Add SCM_TIMESTAMP, SCM_TIMESTAMPNS, SCM_TIMESTAMPING,
SCM_WIFI_STATUS, and SCM_TIMESTAMPING_OPT_STATS.
2017-06-15 00:27:30 +00:00
44049f87ab netlink: refactor decode_nlmsg_type
* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_netfilter):
New functions.
(nlmsg_types_decoder_t): New typedef.
(nlmsg_types): Add decoder field.
(decode_nlmsg_type): Use it.
2017-06-14 23:32:45 +00:00
084d748015 tests: extend printstr test
* tests/printstr.c (main): Add a case for short read.
2017-06-14 04:38:13 +00:00
c2449486d6 v4l2: fix preprocessor checks
Fix checks for struct v4l2_window.global_alpha and struct
v4l2_sdr_format.buffersize.

* v4l2.c (print_v4l2_format_fmt): Do not assume that
HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA and
HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE are defined.
* tests/ioctl_v4l2.c (init_v4l2_format, dprint_ioctl_v4l2): Likewise.
2017-06-13 21:00:04 +00:00
88a34fa6da Move xlat related functions to a separate file
* util.c (xlookup, xlat_bsearch_compare, xlat_search, printxvals,
printxval_searchn, addflags, sprintflags, printflags_ex): Move ...
* xlat.c: ... to this new file.
* Makefile.am (strace_SOURCES): Add it.
2017-06-12 16:44:45 +00:00
3a33709f40 socketeutils: extend receive_responses further
This is the second patch in series of implementing NETLINK_GENERIC
protocol decoder.

This change allows passing of opaque user data to the callback function.

* socketutils.c (receive_responses): Change the type of proto_name
argument from "const char *" to "void *" to allow passing
of arbitrary data to the callback function.
Rename proto_name to opaque_data, make it the last argument.
Pass it to the callback function as the last argument.
(inet_parse_response, unix_parse_response, netlink_parse_response):
Change the type of proto_name argument from "const char *" to "void *",
rename it to opaque_data, make it the last argument.
Introduce a local variable proto_name to convert the type
of opaque_data argument from "void *" to "const char *".
(unix_get, inet_get, netlink_get): Cast the protocol name from
"const char *" to "void *" for passing to the callback function.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-12 16:44:45 +00:00
6c33d4628f socketeutils: extend receive_responses to handle other netlink types
This is the first patch in series of implementing NETLINK_GENERIC
protocol decoder.

receive_responses was written for decoding kernel responses of type
SOCK_DIAG_BY_FAMILY, other types were ignored.

This change makes the type of netlink response a parameter
so the function can be used for other types of communication.

* socketutils.c (receive_responses): add a new parameter
expected_msg_type to handle types other than SOCK_DIAG_BY_FAMILY.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-12 16:43:49 +00:00
1d2dddc73f tests: fix typo
* tests/dup3.c (SKIP_MAIN_UNDEFINED): Remove duplicated &&.
2017-06-12 15:47:39 +00:00
127962f217 Introduce printflags_ex function
Add printflags_ex extension over printflags64 that, similar
to printxvals, takes a NULL-terminated sequence of xlat pointers.

* defs.h (printflags_ex): New prototype.
(printflags64): Turn into a thin wrapper around printflags_ex.
* netlink.c (decode_nlmsg_flags): Use printflags_ex.
* util.c (printflags_ex): New function.
(printflags64): Remove.
* xlat/netlink_get_flags.in: Remove entries listed
in xlat/netlink_flags.in file.
* xlat/netlink_new_flags.in: Likewise.
2017-06-08 22:26:46 +00:00
427e30ef1c tests: add check for decoding netlink get and new flags
* tests/netlink_route.c (test_nlmsg_flags): New function, checks
decoding of NETLINK_ROUTE get and new flags.
(main): Use it.
* tests/netlink_sock_diag.c (test_nlmsg_flags): New function, checks
decoding of NETLINK_SOCK_DIAG get flags.
(main): Use it.
* tests/netlink_xfrm.c: (test_nlmsg_flags): New function, checks
decoding of NETLINK_XFRM get and new flags.
(main): Use it.
2017-06-08 22:26:46 +00:00
fe36545586 netlink: implement generic nlmsg_flags decoding
* netlink.c: Include "xlat/netlink_get_flags.h"
and "xlat/netlink_new_flags.h".
(decode_nlmsg_flags): New function.
(print_nlmsghdr): Use it.
* xlat/netlink_get_flags.in: New file.
* xlat/netlink_new_flags.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-08 22:26:46 +00:00
70b0e64fd0 xlat: provide fallback definitions for XFRM_MSG_* constants
Some of XFRM_MSG_* constants were introduced later than the header file
where they are defined.

* xlat/nl_xfrm_types.in: Add default values for constants.
2017-06-08 22:26:45 +00:00
f099124e84 syscall.c: split trace_syscall() into 6 functions
This change removes the trace_syscall function.  Now, the code that uses
syscall.c trace functions is expected to check whether it is a syscall
entry or exit (with entering(tcp)/exiting(tcp)) itself, and then make
an appropriate sequence of function calls.

* defs.h: Update comment on TCB_INSYSCALL.
(trace_syscall): Remove prototype.
(syscall_entering_decode, syscall_entering_trace,
syscall_entering_finish, syscall_exiting_decode, syscall_exiting_trace,
syscall_exiting_finish): New prototypes.
* strace.c (trace_syscall): New static replacement for old trace_syscall.
* syscall.c (trace_syscall): Remove.
(trace_syscall_entering): Split into ...
(syscall_entering_decode, syscall_entering_trace,
syscall_entering_finish): ... new functions.
(trace_syscall_exiting): Split into ...
(syscall_exiting_decode, syscall_exiting_trace,
syscall_exiting_finish): ... new functions.
2017-06-05 19:25:04 +00:00
909ffde2d6 tests: guard against missing linux/netfilter/nfnetlink.h
nfnetlink was introduced in linux by commit v2.6.14-rc1~1035^2~217,
add a guard for the case when system headers are not fresh enough.

* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/nfnetlink.h.
* tests/netlink_netfilter.c: Check for HAVE_LINUX_NETFILTER_NFNETLINK_H.
2017-06-05 14:57:29 +00:00
e2ba1126e7 tests: check decoding of NETLINK_XFRM message types
* tests/netlink_xfrm.c: New file.
* tests/gen_tests.in (netlink_xfrm): New entry.
* tests/pure_executables.list: Add netlink_xfrm.
* tests/.gitignore: Likewise.
2017-06-05 14:57:29 +00:00
692a6219a4 tests: check decoding of NETLINK_SELINUX message types
* tests/netlink_selinux.c: New file.
* tests/gen_tests.in (netlink_selinux): New entry.
* tests/pure_executables.list: Add netlink_selinux.
* tests/.gitignore: Likewise.
2017-06-05 14:57:29 +00:00
a5eb0a4311 tests: check decoding of NETLINK_NETFILTER message types
* tests/netlink_netfilter.c: New file.
* tests/gen_tests.in (netlink_netfilter): New entry.
* tests/pure_executables.list: Add netlink_netfilter.
* tests/.gitignore: Likewise.
2017-06-05 14:57:27 +00:00
f549c8f9e7 tests: check decoding of NETLINK_AUDIT message types
* tests/netlink_audit.c: New file.
* tests/gen_tests.in (netlink_audit): New entry.
* tests/pure_executables.list: Add netlink_audit.
* tests/.gitignore: Likewise.
2017-06-05 14:56:57 +00:00
f7ee6e17be tests: check decoding of NETLINK_ROUTE message types
* tests/netlink_route.c: New file.
* tests/gen_tests.in (netlink_route): New entry.
* tests/pure_executables.list: Add netlink_route.
* tests/.gitignore: Likewise.
2017-06-05 14:56:30 +00:00
a73c47710a tests: check decoding of NETLINK_SOCK_DIAG message types
* tests/netlink_sock_diag.c: New file.
* tests/netlink_sock_diag.test: New test.
* tests/pure_executables.list: Add netlink_sock_diag.
* tests/.gitignore: Likewise.
* tests/Makefile.am (DECODER_TESTS): Add netlink_sock_diag.test.
2017-06-05 14:56:09 +00:00
0d6d520521 tests: use create_nl_socket in netlink_protocol.test
* tests/netlink_protocol.c (main): Use create_nl_socket.
2017-06-05 14:56:09 +00:00
1274e27487 tests: change netlink_protocol.test to trace sendto syscalls only
* tests/gen_tests.in (netlink_protocol): Replace %network with sendto.
* tests/netlink_protocol.c (main): Update expected output.
2017-06-05 14:56:08 +00:00
5c8d11b682 tests: enhance create_nl_socket diagnostics messages
* tests/tests.h (create_nl_socket): Rename to create_nl_socket_ext,
add a string argument.
(create_nl_socket): New macro wrapper around create_nl_socket_ext.
* tests/create_nl_socket.c (create_nl_socket): Rename
to create_nl_socket_ext, add a string argument, include it
in diagnostic messages.
2017-06-05 14:51:26 +00:00
3245b58351 tests: use const and designated initializers in create_nl_socket.c
* tests/create_nl_socket.c: Stop including <string.h>.
(create_nl_socket): Use const and designated initializers.
2017-06-05 14:51:26 +00:00
7005bcd451 tests: add create_nl_socket function to libtests
* tests/create_nl_socket.c: New file.
* tests/tests.h (create_nl_socket): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add create_nl_socket.c.
2017-06-05 14:39:02 +00:00
6706343b2d netlink: add decoding of NETLINK_NETFILTER message types
* xlat/nl_netfilter_msg_types.in: New file.
* xlat/nl_netfilter_subsys_ids.in: Likewise.
* netlink.c: Include "xlat/nl_netfilter_msg_types.h"
and "xlat/nl_netfilter_subsys_ids.h".
(nlmsg_types): Add NETLINK_NETFILTER.
(decode_nlmsg_type): Handle NETLINK_NETFILTER.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-05 11:52:11 +00:00
d0231ef60b netlink: add decoding of NETLINK_XFRM message types
* xlat/nl_xfrm_types.in: New file.
* netlink.c: Include "xlat/nl_xfrm_types.h".
(nlmsg_types): Add NETLINK_XFRM.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-05 11:52:11 +00:00
c78de345e0 netlink: add decoding of NETLINK_SELINUX message types
* xlat/nl_selinux_types.in: New file.
* netlink.c: Include "xlat/nl_selinux_types.h".
(nlmsg_types): Add NETLINK_SELINUX.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-05 11:52:11 +00:00
d5435f74ed netlink: add decoding of NETLINK_ROUTE message types
* xlat/nl_route_types.in: New file.
* netlink.c: Include <linux/rtnetlink.h> and "xlat/nl_route_types.h".
(nlmsg_types): Add NETLINK_ROUTE.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-05 11:52:11 +00:00
c5db18d946 netlink: add decoding of NETLINK_AUDIT message types
* xlat/nl_audit_types.in: New file.
* netlink.c: Include <linux/audit.h> and "xlat/nl_audit_types.h".
(nlmsg_types): Add NETLINK_AUDIT.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-05 11:52:11 +00:00
8700030e48 netlink: implement generic nlmsg_type decoding
Implement a pluggable mechanism of nlmsg_type decoding.
Add decoding of NETLINK_SOCK_DIAG types.

* linux/sock_diag.h (SOCK_DESTROY): New macro.
* xlat/nl_sock_diag_types.in: New file.
* netlink.c: Include xlat/nl_sock_diag_types.h.
(get_fd_nl_family, decode_nlmsg_type): New functions.
(print_nlmsghdr): Use them for nlmsg_type decoding.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-05 11:52:11 +00:00
1b634252c7 netlink: add netlink family argument to printers and decoders
* netlink.c (NL_FAMILY_ERROR, NL_FAMILY_DEFAULT): New constants.
(print_nlmsghdr): Add netlink family argument, change return type
to int, return family.
(decode_nlmsghdr_with_payload, decode_nlmsgerr, decode_payload): Add
netlink family argument.  All callers updated.
2017-06-05 11:52:11 +00:00
8240e4e983 Add file descriptor argument to decode_netlink
* defs.h (decode_netlink): Add file descriptor argument.
* io.c (print_iovec): Specify file descriptor to decode_netlink.
* net.c (decode_sockbuf): Likewise.
* netlink.c (print_nlmsghdr, decode_nlmsghdr_with_payload,
decode_nlmsgerr, decode_payload, decode_nlmsghdr_with_payload,
decode_netlink): Likewise.
All callers updated.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-05 11:52:11 +00:00
f26c22d8b2 Introduce getfdinode to obtain inode from fd
* defs.h (getfdinode): New prototype.
* utils.c (getfdinode): New function.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-05 11:52:11 +00:00
e4c104ae51 Introduce get_sockaddr_by_inode
Add a way to get socket information without printing it.

* defs.h (get_sockaddr_by_inode): New prototype.
* socketutils.c (get_sockaddr_by_inode): New function.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-05 11:52:11 +00:00
f42a3a3a90 socketutils.c: introduce get_sockaddr_by_inode_uncached
* socketutils.c (get_sockaddr_by_inode_uncached): New function.
(print_sockaddr_by_inode_uncached): Use it.
2017-06-05 11:52:11 +00:00
dffa963b8b socketutils.c: use get_sockaddr_by_inode_cached
* socketutils.c (unix_print, inet_print, tcp_v4_print, tcp_v6_print,
udp_v4_print, udp_v6_print, netlink_print): Remove.
(unix_get, inet_get, tcp_v4_get, tcp_v6_get, udp_v4_get,
udp_v6_get, netlink_get): New functions.
(protocols): Update.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-05 11:52:11 +00:00
84555f5ff7 socketutils.c: move inet_print closer to its first use
* socketutils.c (inet_print): Move right before tcp_v4_print.
2017-06-05 11:52:11 +00:00
103744d271 socketutils.c: introduce cache_inode_details
cache_inode_details gives a way to obtain cache information without
printing it.

* socketutils.c (cache_and_print_inode_details): Rename
to cache_inode_details.  Do not print cached information.
(inet_parse_response, unix_parse_response, netlink_parse_response):
Use cache_inode_details instead of cache_and_print_inode_details.
(inet_print, unix_print, netlink_print): Call
print_sockaddr_by_inode_cached.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-05 11:52:11 +00:00
0a9d8bfd84 strace.c: move termination code to a separate function
This will be needed for the pull-style API.

* strace.c (terminate): New function.
(main): Use it.
2017-06-05 11:48:47 +00:00
e6cdfb6e84 tests: avoid hitting SO_SNDBUF limit in sendfile/sendfile64 tests
Do not assume that an executable is small enough and SO_SNDBUF is large
enough so that the executable could be sendfile'ed into a socket pair.

* tests/sendfile.c (main): Create a regular file of the right size
to avoid hitting SO_SNDBUF limit.
* tests/sendfile64.c: Likewise.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
2017-06-04 21:17:15 +00:00
c826fa0f71 Move netlink_protocols definition from net.c to netlink.c
The side effect of #include "xlat/netlink_protocols.h" is
NETLINK_* constants properly defined in that header file.
While net.c does not use these constants itself, netlink.c
is going to need them soon.

* net.c: Move inclusion of "xlat/netlink_protocols.h" ...
* netlink.c: ... here.
2017-06-04 17:03:44 +00:00
47a6e1ccff travis: switch from gcc-6 to gcc-7
* .travis.yml (matrix): Change gcc-6 to gcc-7.
2017-06-04 14:20:16 +00:00
8a3551abc8 tests: extend checking of NLMSG_DONE decoding
* tests/netlink_protocol.c (test_nlmsg_done):  Use designated
initializers.  Check decoding of messages with non-integer payload.
2017-06-04 13:40:17 +00:00
852046ce0e netlink: decode NLMSG_DONE messages
* netlink.c (decode_payload): Decode NLMSG_DONE messages.
* tests/netlink_protocol.c (test_nlmsg_done): New function
for checking decoding of NLMSG_DONE messages.
(main): Use it.
2017-06-04 13:17:06 +00:00
982d03464c socketutils.c: introduce get_sockaddr_by_inode_cached
* socketutils.c (get_sockaddr_by_inode_cached): New function.
(print_sockaddr_by_inode_cached): Use it.
2017-06-04 12:03:54 +00:00
e16bdb1bb9 Unexport print_sockaddr_by_inode_cached
Change print_sockaddr_by_inode to be the only function exposed,
hide print_sockaddr_by_inode_cached as a part of implementation.

* defs.h (print_sockaddr_by_inode_cached): Remove prototype.
(print_sockaddr_by_inode): Add struct tcb * and descriptor arguments.
* socketutils.c (print_sockaddr_by_inode_cached): Make static.
(print_sockaddr_by_inode): Rename to print_sockaddr_by_inode_uncached,
make static.
(print_sockaddr_by_inode): New function.
* util.c (printfd): Update to use new print_sockaddr_by_inode.
2017-06-03 17:52:24 +00:00
1459d07f94 Introduce str_strip_prefix_len function and STR_STRIP_PREFIX macro
Address proliferation of string prefix check implementations.

* defs.h (str_strip_prefix_len): New inline function.
(STR_STRIP_PREFIX): New macro.
* qualify.c (strip_prefix): Remove.
(parse_inject_token): Use STR_STRIP_PREFIX instead of strip_prefix.
(qualify): Use str_strip_prefix_len.
* socketutils.c (netlink_parse_response): Likewise.
* util.c (printfd): Likewise.
2017-06-03 16:55:12 +00:00
28e478a6eb netlink: move NLMSG_ERROR payload length check to nlmsgerr decoder
Move decoder specific check to the decoder.

* netlink.c (decode_payload): Move NLMSG_ERROR payload length check ...
(decode_nlmsgerr): ... here.
2017-06-02 22:22:22 +00:00
32cff9dc88 strace.c: handle PTRACE_EVENT_EXEC like other events
There is nothing unusual about PTRACE_EVENT_EXEC that would require
a special treatment.

* strace.c (next_event): Move PTRACE_EVENT_EXEC handling to the main
switch statement.
2017-06-02 21:49:02 +00:00
4a1a41cb7e strace.c: remove dead code
As strace does not use WCONTINUED flag, there is no need to handle
WIFCONTINUED status.

* strace.c (print_debug_info) [WIFCONTINUED]: Remove.
(next_event): Remove redundant !WIFSTOPPED check.
2017-06-02 20:08:39 +00:00
6b4efe9f01 strace.c: refactor trace into two functions
This change decouples waiting for next event from reacting to it.  This
makes the control flow easier to understand, and serves as a preparation
for implementing a pull-style API for LuaJIT.

* strace.c (enum trace_event): New enum.
(trace): Split into ...
(next_event, dispatch_event): ... new functions.
(main): Use them.
2017-06-02 14:20:09 +00:00
a25d7521ef scno.am: include config.h before syscallent.h
This fixes generation of syscallent.i and subsequent scno.h files
on mips where syscallent.h checks macros defined in config.h.

* scno.am (syscallent.i): Add $(top_builddir)/config.h
to prerequisites, include it.
* NEWS: Mention this fix.

Reported-by: David Robins <dbrobins@i4031.net>
2017-05-30 22:44:47 +00:00
0bcfa7b5cb tests: check decoding of sigaction syscall
* tests/sigaction.c: New file.
* tests/gen_tests.in (sigaction): New entry.
* tests/pure_executables.list: Add sigaction.
* tests/.gitignore: Likewise.
2017-05-28 17:13:29 +00:00
7830648b9f tests: rename sigaction.test to rt_sigaction.test
* tests/sigaction.awk: Rename to rt_sigaction.awk.
* tests/sigaction.c: Rename to tests/rt_sigaction.c.
* tests/sigaction.test: Rename to tests/rt_sigaction.test.
* tests/.gitignore: Replace sigaction with rt_sigaction.
* tests/pure_executables.list: Likewise.
* tests/Makefile.am (DECODER_TESTS): Replace sigaction.test
with rt_sigaction.test.
(EXTRA_DIST): Replace sigaction.awk with rt_sigaction.awk.
2017-05-28 17:13:29 +00:00
5f27295dfd sparc: enhance decoding of signal number argument of sigaction syscall
On sparc, unlike all other architectures, old sigaction syscall takes
a negated signal number.

* signal.c (SYS_FUNC(sigaction)) [SPARC || SPARC64]: Enhance printing
of negative signal number argument.
2017-05-28 17:13:29 +00:00
5061dfccc6 signal: enhance printing of old_sigaction.mask
* signal.c (decode_old_sigaction): Print old_sigaction.mask
using tprint_old_sigmask_val.
2017-05-28 17:13:29 +00:00
a9cdd9f54c signal: limit scope of struct old_sigaction32 definition
* signal.c (struct old_sigaction32): Define only if [!current_wordsize].
2017-05-28 17:13:29 +00:00
337d3a10ce signal: fix decoding of struct old_sigaction on some architectures
On alpha, struct old_sigaction.sa_flags has a 32-bit type.

On mips, only first word of old_sigaction.sa_mask is read.

On all architectures except alpha and mips that have old sigaction
syscall, struct old_sigaction has sa_restorer field that has to be
decoded.

* signal.c (struct old_sigaction) [ALPHA]: Change sa_flags type
to unsigned int, add ATTRIBUTE_PACKED.
[MIPS]: Dhrink sa_mask array to 1 element.
[!ALPHA && !MIPS]: Define sa_restorer field unconditionally.
(struct old_sigaction32): Likewise.
(decode_old_sigaction) [!current_wordsize]: Initialize sa_restorer field
from old_sigaction32.sa_restorer unconditionally.
[!ALPHA && !MIPS]: Print old_sigaction.sa_restorer if SA_RESTORER flag
is set.
* NEWS: Mention this change.
2017-05-28 17:13:29 +00:00
a560ac718e xlat: rename SA_STACK to SA_ONSTACK
SA_ONSTACK is the standard name while its alias SA_STACK is not even
defined on many platforms.

* xlat/sigact_flags.in (SA_STACK): Rename to SA_ONSTACK.
2017-05-28 17:13:29 +00:00
221da524ad tests: check decoding of sigpending syscall
* tests/sigpending.c: New file.
* tests/gen_tests.in (sigpending): New entry.
* tests/pure_executables.list: Add sigpending.
* tests/.gitignore: Likewise.
2017-05-28 00:09:52 +00:00
6715387c5c tests: check decoding of sigprocmask syscall
* tests/sigprocmask.c: New file.
* tests/gen_tests.in (sigprocmask): New entry.
* tests/pure_executables.list: Add sigprocmask.
* tests/.gitignore: Likewise.
2017-05-28 00:09:45 +00:00
1570421357 alpha: rename sys_sigprocmask to sys_osf_sigprocmask
Parsers of sigprocmask and osf_sigprocmask syscalls are different
anyway, so rename the function to match the syscall name.

* signal.c [ALPHA] (SYS_FUNC(sigprocmask)): Rename
to SYS_FUNC(osf_sigprocmask).
* linux/alpha/syscallent.h: Update sys_func.
2017-05-28 00:09:32 +00:00
556edf91e3 Enable coverage when strace is self terminated by signal
The data collected by -fprofile-arcs during program run is saved
on program exit.  When program is terminated by signal, the data
is not saved.  However, libgcov provides an interface to dump
the data at runtime.

* m4/ax_code_coverage.m4 (AX_CODE_COVERAGE): Add -DENABLE_COVERAGE_GCOV
to CODE_COVERAGE_CPPFLAGS.
* strace.c [ENABLE_COVERAGE_GCOV] (__gcov_flush): New prototype.
(main) [ENABLE_COVERAGE_GCOV]: Call __gcov_flush() before raise()
and sigprocmask() calls that might cause program termination.
2017-05-27 18:58:31 +00:00
ae1b07bc2a tests: check termination signal forwarding
* tests/run_expect_termsig.c: New file.
* tests/unblock_reset_raise.c: Likewise.
* tests/termsig.test: New test.
* tests/.gitignore: Add run_expect_termsig and unblock_reset_raise.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add termsig.test.
2017-05-27 17:59:44 +00:00
47b93f2a7a Fix termination signal forwarding
When traced command is terminated by a blocked signal, unblock
that signal to ensure strace termination with the same signal.

* strace.c (main): Unblock the signal raised for strace termination.
* NEWS: Mention this change.
2017-05-27 17:59:44 +00:00
e97a66faa1 Do not reset SIGCHLD handler in tracees to SIG_DFL
While strace resets SIGCHLD handler to the default action so that
waitpid definitely works without losing track of children, tracees
should not inherit this change.

* strace.c (struct exec_params): Add child_sa field.
(init): When setting SIGCHLD handler to SIG_DFL, save the old handler.
(exec_or_die): Restore SIGCHLD handler if it was different from SIG_DFL
at startup.
* NEWS: Mention this change.
2017-05-27 17:59:44 +00:00
e0fd7e7035 Refactor setting of signal handlers to reduce redundancy
* strace.c (set_sigaction): New function.
(init): Use it instead of sigaction with sigaddset.
2017-05-27 17:59:44 +00:00
2d2bc8fdc1 tests: check how signals are unblocked in interactive mode
* tests/block_reset_raise_run.c: New file.
* tests/interactive_block.test: New test.
* tests/.gitignore: Add block_reset_raise_run.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add interactive_block.test.
2017-05-27 10:00:43 +00:00
f83b49b03a Fix unblocking of signals in interactive mode
In interactive mode (-I2), those signals that were blocked at startup
will remain blocked for the whole period of strace execution.

* strace.c (empty_set): Rename to start_set.  All users changed.
(init): Initialize start_set and blocked_set to the set of currently
blocked signals.
(startup_attach, trace): Use SIG_SETMASK instead of SIG_BLOCK.
* NEWS: Mention this change.
2017-05-27 10:00:43 +00:00
ab2efa7a54 Cleanup interactive check
* strace.c (init): Check for INTR_WHILE_WAIT mode the same way
as in other places.
2017-05-26 23:16:57 +00:00
ea64209ef7 tests: check decoding of signal syscall
* tests/signal.c: New file.
* tests/gen_tests.in (signal): New entry.
* tests/pure_executables.list: Add signal.
* tests/.gitignore: Likewise.
2017-05-26 20:42:13 +00:00
d86b6bc773 Unify capitalisation of (c) in copyright notices 2017-05-26 19:43:11 +00:00
b77b04744a Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.17-1.
* strace.spec.in: Likewise.
2017-05-25 19:42:20 +00:00
23ed9034c8 Prepare for 4.17 release
* NEWS: Update for 4.17 release.
2017-05-24 16:17:18 +00:00
050f9003e3 powerpc64, sparc, sparc64: wire up statx syscall
* linux/powerpc64/syscallent.h [383]: Add statx entry.
* linux/sparc/syscallent.h [360]: Likewise.
* linux/sparc64/syscallent.h [360]: Likewise.
2017-05-24 16:17:18 +00:00
3b97ee486b Fix compat personality support for sgetmask syscall
* signal.c (SYS_FUNC(sgetmask)): Replace sprintsigmask_val
with sprint_old_sigmask_val.
* tests/sxetmask.c (main): Check decoding of signal mask containing
RT signals.
2017-05-23 23:20:18 +00:00
ba0bd3f1ec Fix decoding of sgetmask and ssetmask syscalls
Old ssetmask syscall takes an argument and returns a value of type int.
Old sgetmask syscall may return an error.

* signal.c (SYS_FUNC(ssetmask)): Explicitly convert the argument
and return value to unsigned int, print it using sprint_old_sigmask_val.
(SYS_FUNC(sgetmask)): Do not print the mask in case of syserror.
* tests/sxetmask.c: New file.
* tests/gen_tests.in (sxetmask): New entry.
* tests/pure_executables.list: Add sxetmask.
* tests/.gitignore: Likewise.
* NEWS: Mention this fix.
2017-05-22 17:33:51 +00:00
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
c2930b90ae Add scripts for automating copyright notices update
* maint/update_copyright_years.awk: New file.
* maint/update_copyright_years.sh: Likewise.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2017-05-22 19:30:30 +02:00
e83c44c28e Fix typos in copyright notices 2017-05-22 19:11:06 +02:00
032f0667ba unwind.c: remove non-ASCII character from comment 2017-05-22 19:11:06 +02:00
2a2347b5bd Rename sys_sig[gs]etmask to sys_s[gs]etmask to match syscall names
* signal.c (SYS_FUNC(sigsetmask)): Rename to SYS_FUNC(ssetmask).
(SYS_FUNC(siggetmask)): Rename to SYS_FUNC(sgetmask).
* linux/arm/syscallent.h (sgetmask, ssetmask): Update sys_func.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
2017-05-21 17:51:01 +00:00
95ccc828fe tests: enhance sigsuspend.test
* tests/sigsuspend.c (sigtxt): New variable.
(main): Change signal masks to contain all signals except USR1 and USR2.
2017-05-21 14:37:48 +00:00
eb446e3cd8 Fix compat personality support for old sigsuspend syscall
* signal.c (sprint_old_sigmask_val): New function.
(tprint_old_sigmask_val): New macro.
(SYS_FUNC(sigsuspend)): Use it.
2017-05-20 20:17:59 +00:00
d70a3112a0 Move errnoent.sh, signalent.sh, and syscallent.sh to maint subdirectory
Also do not include them into release tarballs.  These files are
intended for developers who are expected to use a git repository.

* errnoent.sh: Move to maint subdirectory.
* signalent.sh: Likewise.
* syscallent.sh: Likewise.
* HACKING-scripts: Update.
* Makefile.am (EXTRA_DIST): Remove errnoent.sh, signalent.sh,
and syscallent.sh.
2017-05-16 02:11:35 +00:00
30dc3ce6bc Do not include maint subdirectory into release tarballs
These files are intended for developers who are expected to use
a git repository.

* Makefile.am (EXTRA_DIST): Remove maint/ioctls_gen.sh,
maint/ioctls_hex.sh, maint/ioctls_sym.sh, and maint/print_ioctlent.c.
2017-05-16 02:11:35 +00:00
83435b8ab6 linux/ia64/syscallent.h: remove tabulation, add spaces in file comment 2017-05-01 19:19:10 +00:00
27710b7348 linux/mtd-abi.h: remove non-ASCII character from file comment 2017-05-01 19:19:09 +00:00
d852b31a8b alpha, cris, mips, ppc, sh, sparc: fix decoding of sigsuspend syscall
On some architectures old sigsuspend syscall takes the signal mask from
the 3rd argument, on some from the 1st.  And, if it wasn't peculiar
enough, the signal mask is passed by value on all architectures except
mips where it's passed by reference.

* signal.c (SYS_FUNC(sigsuspend)): Take the signal mask from the last
argument.
* linux/alpha/syscallent.h (sigsuspend): Set nargs to 1.
* linux/crisv10/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* tests/sigsuspend.c: New file.
* tests/gen_tests.in (sigsuspend): New entry.
* tests/pure_executables.list: Add sigsuspend.
* tests/.gitignore: Likewise.
* NEWS: Mention this fix.
2017-05-01 14:49:26 +00:00
d5959c52ab tests: raise default timeout for individual tests
Recently added tests based on pure_executables.list are quite slow
by their nature, the one minute default timeout is no longer enough
for some of not so fast architectures.

* tests/init.sh (TIMEOUT_DURATION): Raise from 60 to 120.
2017-05-01 14:49:26 +00:00
b0ef7be9a0 Update NEWS 2017-05-01 14:49:26 +00:00
eeca4bdd5d Update TCP_* constants
* xlat/socktcpoptions.in: Add TCP_FASTOPEN_CONNECT introduced
by linux kernel commit v4.11-rc1~124^2~321^2.
2017-04-29 00:37:07 +00:00
23790eef0c Update AF_* constants
* xlat/addrfams.in: Add AF_SMC introduced by linux kernel
commit v4.11-rc1~94^2~43^2~13.
2017-04-28 23:34:56 +00:00
ab25ab1f43 tests: enhance madvise decoder check
* tests/mmap.c (main): Remove madvise check.
* tests/madvise.c: New file.
* tests/gen_tests.in (madvise): New entry.
* tests/.gitignore: Add madvise.
* tests/pure_executables.list: Likewise.
2017-04-27 23:16:33 +00:00
bfcf14b7d1 tests: add -etrace=?... test
Check for some architecture-specific syscalls which are not present
on most architectures.

* gen_tests.in: Add trace_question test.
* tests/trace_question.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
2017-04-25 14:35:47 +00:00
df490b89d1 tests: add more information to generated header comments
* tests/gen_tests.sh: Update header comment with the source string
used for test generation.
2017-04-25 14:35:47 +00:00
b97ac5df12 tests: move generated common header comment into a variable
* tests/gen_tests.sh: Move generated file header comment
into a variable, use it in all cases.
2017-04-25 14:35:47 +00:00
e399ea2f7d tests: use TAIL_ALLOC_OBJECT_CONST_PTR in v4l2 test
* tests/ioctl_v4l2.c (main): Use TAIL_ALLOC_OBJECT_CONST_PTR.
2017-04-25 14:35:47 +00:00
bc8eab0142 tests: Check decoding of VIDIOC_G/S_TUNER's arg
* tests/ioctl_v4l2.c (main): Add checks for VIDIOC_G/S_TUNER's arg.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
2017-04-25 14:35:47 +00:00
99bade9917 v4l2: Add decoding for VIDIOC_G/S_TUNER's arg
* v4l2.c: Include "xlat/v4l2_tuner_types.h", "xlat/v4l2_tuner_capabilities.h",
"xlat/v4l2_tuner_rxsubchanses.h", and "xlat/v4l2_tuner_audmodes.h".
(print_v4l2_tuner): New function. Add decoding for VIDIOC_G/S_TUNER's arg.
(v4l2_ioctl): Add new cases for decoding VIDIOC_G/S_TUNER's arg.
* xlat/v4l2_tuner_types.in: Add V4L2_TUNER_RADIO and
V4L2_TUNER_ANALOG_TV introduced by linux kernel commit
2.5.46~39^2~23^2~4.
Add V4L2_TUNER_DIGITAL_TV introduced by linux kernel
commit v2.6.11-rc4~55^2~20.
Add V4L2_TUNER_ADC and V4L2_TUNER_RF introduced by linux kernel commit
v3.15-rc1~85^2~215.
Add V4L2_TUNER_SDR introduced by linux kernel commit v4.4-rc1~118^2~17
(as the replacement of V4L2_TUNER_ADC).
* xlat/v4l2_tuner_capabilities.in: Add V4L2_TUNER_CAP_LOW,
V4L2_TUNER_CAP_NORM, V4L2_TUNER_CAP_STEREO, V4L2_TUNER_CAP_LANG2,
V4L2_TUNER_CAP_SAP, and V4L2_TUNER_CAP_LANG1 introduced by linux kernel
commit 2.5.46~39^2~23^2~4.
Add V4L2_TUNER_CAP_HWSEEK_BOUNDED and V4L2_TUNER_CAP_HWSEEK_WRAP
introduced by linux kernel commit v3.6-rc1~28^2~306.
Add V4L2_TUNER_CAP_RDS introduced by linux commit v2.6.32-rc1~679^2~189.
Add V4L2_TUNER_CAP_RDS_BLOCK_IO and V4L2_TUNER_CAP_RDS_CONTROLS
introduced by linux kernel commit v2.6.37-rc1~64^2~110.
Add V4L2_TUNER_CAP_FREQ_BANDS introduced by linux kernel commit
v3.6-rc1~28^2~46.
Add V4L2_TUNER_CAP_HWSEEK_PROG_LIM introduced by linux kernel commit
v3.6-rc1~28^2~40.
Add V4L2_TUNER_CAP_1HZ introduced by linux kernel commit
v3.15-rc1~85^2~214.
* xlat/v4l2_tuner_audmodes.in: Add V4L2_TUNER_MODE_MONO,
V4L2_TUNER_MODE_STEREO, V4L2_TUNER_MODE_LANG2, V4L2_TUNER_MODE_SAP, and
V4L2_TUNER_MODE_LANG1 introduced by linux kernel commit
2.5.46~39^2~23^2~4.
Add V4L2_TUNER_MODE_LANG1_LANG2 introduced by linux kernel commit
v2.6.17-rc1~739^2~9.
* xlat/v4l2_tuner_rxsubchanses.in: Add V4L2_TUNER_SUB_MONO,
V4L2_TUNER_SUB_STEREO, V4L2_TUNER_SUB_LANG2, V4L2_TUNER_SUB_SAP, and
V4L2_TUNER_SUB_LANG1 introduced by linux kernel commit
2.5.46~39^2~23^2~4.
Add V4L2_TUNER_SUB_RDS introduced by linux kernel commit
v2.6.32-rc1~679^2~189.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
2017-04-25 14:35:47 +00:00
89390d356b tests: check decoding of invalid tv_sec and tv_usec values
* tests/futimesat.c (main): Check decoding of invalid tv_sec and tv_usec
values.
* tests/xetitimer.c (main): Likewise.
* tests/xettimeofday.c (main): Likewise.
* tests/xselect.c (main): Likewise.
* tests/xutimes.c (main): Likewise.
2017-04-24 23:14:57 +00:00
8b86137d56 tests: check decoding of invalid tv_sec and tv_nsec values
* tests/aio.c (main): Check decoding of invalid tv_sec and tv_nsec
values.
* tests/clock_nanosleep.c (main): Likewise.
* tests/clock_xettime.c (main): Likewise.
* tests/futex.c (main): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/ppoll.c (main): Likewise.
* tests/pselect6.c (main): Likewise.
* tests/recvmmsg-timeout.c (main): Likewise.
* tests/rt_sigtimedwait.c (main): Likewise.
* tests/semop.c (main): Likewise.
* tests/timer_xettime.c (main): Likewise.
* tests/timerfd_xettime.c (main): Likewise.
* tests/utimensat.c (main): Likewise.
2017-04-24 23:14:57 +00:00
4b8def02be Print time in ISO 8601 format in time syscall decoder
* print_time.c (SYS_FUNC(time)): Print timestamp stringification
(via sprinttime) for the value stored in the argument and return value
(return RVAL_STR in the latter case).
* tests/time.c (main): Update expected output.
2017-04-24 23:14:57 +00:00
fcd8b63210 Print string representation of timestamps in parsers of *utime* syscalls
* print_timespec.c (print_timespec_t_utime): Use sprinttime_nsec
to format a string representation of time, use tprints_comment
to print it as a comment.
* print_timeval.c (print_timeval_t_utime): New function.
(print_timeval_utimes): Use it instead of print_timeval_t.
[ALPHA] (print_timeval32_t_utime): New function.
[ALPHA] (print_timeval32_utimes): Use it instead of print_timeval32_t.
* tests/futimesat.c (print_tv): Update expected output.
* tests/utimensat.c (print_ts): Likewise.
* tests/xutimes.c (print_tv): Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-04-24 23:14:57 +00:00
a791580857 tests: add support for printing timestamp with microsecond precision
It will be needed later.

* tests/tests.h (print_time_t_usec): New prototype.
* tests/print_time.c (print_time_t_usec): New function, a thin wrapper
around print_time_t_ex.
2017-04-24 23:14:57 +00:00
9c8ec0a80f Print microseconds/nanoseconds as non-negative
Negative micro/nanoseconds values are treated as invalid by kernel
anyway, and in one case (timespec_valid in include/linux/time.h)
it is even checked by conversion to unsigned long.

* print_timespec.c (timespec_fmt): Change tv_sec format to %lld and
tv_nsec format to %llu.
(print_timespec_t): Cast tv_sec to long long and process tv_nsec with
zero_extend_signed_to_ull.
(sprint_timespec): Likewise.
* print_timeval.c (timeval_fmt): Change tv_sec format to %lld and
tv_usec format to %llu.
(print_timeval_t): Cast tv_sec to long long and process tv_nsec with
zero_extend_signed_to_ull.
(sprint_timeval, print_timeval32_t, sprint_timeval32): Likewise.
* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
* tests/adjtimex.c (main): Change tv_sec printing format to %lld, cast
it to long long; change tv_usec printing format to %llu, process it with
zero_extend_signed_to_ull.
* tests/clock_nanosleep.c (main): Change tv_sec printing format to %lld,
cast it to long long; change tv_nsec printing format to %llu, process it
with zero_extend_signed_to_ull.
* tests/clock_xettime.c (main): Likewise.
* tests/futex.c (main): Likewise.
* tests/futimesat.c (print_tv): Likewise.
* tests/getrusage.c (invoke_print): Likewise.
* tests/mq_sendrecv.c (do_send, do_recv, main): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/pselect6.c (main): Likewise.
* tests/restart_syscall.c (main): Likewise.
* tests/rt_sigtimedwait.c (iterate, main): Likewise.
* tests/sched_rr_get_interval.c (main): Likewise.
* tests/semop.c (main): Likewise.
* tests/timer_xettime.c (main): Likewise.
* tests/timerfd_xettime.c (main): Likewise.
* tests/waitid.c (main): Likewise.
* tests/xetitimer.c (main): Likewise.
* tests/xettimeofday.c (main): Likewise.
* tests/xselect.c (main): Likewise.
* tests/xutimes.c (print_tv): Likewise.
* tests/wait4.c (sprint_rusage): Likewise.
* tests/waitid.c (sprint_rusage): Likewise.
* tests/utimensat.c (print_ts): Likewise.
(main): Add check for higher bits of tv_sec/tv_nsec.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-04-24 23:14:57 +00:00
3277a2370a Always print raw values of time data fields
Refactor sprinttime: implement sprinttime_nsec and sprinttime_usec
that handle nanoseconds and microseconds, respectively.
Always print raw values of time data fields, format string
representations of time as comments.

* defs.h (sprinttime): Change argument type from time_t to long long.
(sprinttime_nsec, sprinttime_usec): New prototypes.
* util.c (sprinttime_ex, sprinttime_nsec, sprinttime_usec): New
functions.
(sprinttime): Turn into a thin wrapper around sprinttime_ex.
* stat.h (struct strace_stat): Add has_nsec field.
* fetch_struct_stat.c (HAVE_NSEC): New macro.
(fetch_struct_stat): Initialize has_nsec field with HAVE_NSEC.
* fetch_struct_stat64.c (HAVE_NSEC): New macro.
(fetch_struct_stat64): Initialize has_nsec field with HAVE_NSEC.
* print_struct_stat.c (print_struct_stat) <PRINT_ST_TIME>:
Print raw values of time fields, use sprinttime_nsec to format a string
representation of time, use tprints_comment to print it as a comment.
* statx.c (SYS_FUNC(statx)) <PRINT_FIELD_TIME>: Likewise.
* utime.c (SYS_FUNC(utime)): Print raw values of struct utimbuf.actime
and struct utimbuf.modtime fields, use sprinttime to format a string
representation of time, use tprints_comment to print it as a comment.
* tests/tests.h (print_time_t_nsec): Add int argument.
* tests/print_time.c (print_time_t_ex): New function.
(print_time_t_nsec): Add int argument, turn into a thin wrapper around
print_time_t_ex.
* tests/utime.c (main): Update expected output.
* tests/xstatx.c [!IS_STATX] (HAVE_NSEC): New macro.
[!IS_STATX] (PRINT_ST_TIME), [IS_STATX] (PRINT_FIELD_TIME): Update
expected output.
* NEWS: Mention this timestamps representation improvement.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-04-24 23:14:57 +00:00
c34952709d Introduce tprintf_comment and tprints_comment functions
* defs.h (tprintf_comment, tprints_comment): New prototypes.
* strace.c (tvprintf): New function.
(tprintf): Use it.
(tprintf_comment, tprints_comment): New functions.
* aio.c (tprint_lio_opcode): Use tprints_comment.
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Likewise.
* futex.c (SYS_FUNC(futex)): Likewise.
* perf.c (print_perf_event_attr): Likewise.
* seccomp.c (decode_bpf_code): Likewise.
* util.c (printxvals, printxval_searchn, printflags64): Likewise.
* btrfs.c (print_u64, btrfs_print_key_type, btrfs_print_objectid,
print_key_value_internal): Likewise.
(btrfs_ioctl): Use tprints_comment and tprintf_comment.
* dirent.c (SYS_FUNC(getdents)): Likewise.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* execve.c (printargc): Use tprintf_comment.
* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl,
btrfs_test_features_ioctls): Update expected output.
2017-04-24 19:31:54 +00:00
37fc8e673a Make output of execve/execveat syscall parsers more structured
* execve.c (printargc): Always print the address, format the number
of variables as a comment.
* tests/execve.c: Update expected output.
* tests/execveat.c: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/strace-r.expected: Likewise.
* tests/strace-t.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/threads-execve.c: Likewise.
* tests/threads-execve.test: Likewise.
2017-04-24 19:22:11 +00:00
b5304784b5 dm: fix diagnostics about misplaced parts of struct dm_ioctl
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Fix
diagnostics about various misplaced parts of struct dm_ioctl.
* tests/ioctl_dm.c: Update expected output.
2017-04-24 19:14:41 +00:00
d64aa38834 print_mq_attr: fix typo
* print_mq_attr.c (printmqattr): Fix the last argument of printflags64.
2017-04-24 14:14:07 +00:00
0399062e41 tests: add faulty pointer check to time test
* tests/time.c (main): Add check for an inaccessible pointer.
2017-04-23 23:48:22 +00:00
27a4fd6dbb tests: fix print_time_t_nsec usage in xstatx.c
* tests/xstatx.c (print_stat): Pass tv_nsec field through
zero_extend_signed_to_ull before feeding it to print_time_t_nsec.
2017-04-22 00:15:41 +00:00
d1cca88c80 tests: fix netlink_protocol on sparc
* tests/netlink_protocol.c (test_nlmsgerr): Do not access fields of an
unaligned structure, this makes architectures like sparc very unhappy.
2017-04-21 23:01:22 +00:00
0f07b184c8 util: return pointer to string literal directly in sprinttime
There is no sense to copy it to static buffer first.

* util.c (sprinttime): Just return "0", do not copy it to internal
buffer first.
2017-04-21 21:57:56 +00:00
39f5742468 tests: remove stat.sample creation from gen_tests.in
stat.sample is created by appropriate executables and never removed.

* tests/gen_tests.in (trace_fstat, trace_lstat, trace_stat,
trace_stat_like): Remove stat.sample creation.
2017-04-21 19:49:03 +00:00
51440aef4b tests: tabulate fstat.test
* tests/gen_tests.in (fstat): New entry.
(fstat64, oldfstat): Update.
* tests/fstat.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove fstat.test.
2017-04-21 19:49:03 +00:00
e15d00536b Implement -e trace=%stat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i '/statx/! s/TF|TSTA,/TF|TST|TSTA,/' linux/*/syscallent*.h

* sysent.h (TRACE_STAT): New macro.
* syscall.c: Alias LST to TRACE_STAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_STAT for "%stat".
* strace.1 (.SS Filtering): Add information about %stat syscall class.
* NEWS: Mention this change.
* linux/aarch64/syscallent.h (stat): Add TST flag.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (oldstat, stat, stat64): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/avr32/syscallent.h (stat, stat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h (oldstat, stat): Likewise.
* linux/alpha/syscallent.h (osf_old_stat, osf_stat, stat, stat64): Likewise.
* linux/mips/syscallent-compat.h (bsd43_oldstat, bsd43_stat, posix_stat,
svr4_stat, svr4_xstat, sysv_stat, sysv_xstat): Likewise.
* tests/gen_tests.in (trace_stat): New entry.
* tests/trace_stat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
9a36c8e55d Implement -e trace=%lstat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i '/TSTA,.*lx\?stat/ s/TSTA,/TLST|&/' linux/*/syscallent*.h

* sysent.h (TRACE_LSTAT): New macro.
* syscall.c: Alias TLST to TRACE_LSTAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_LSTAT for "%lstat".
* strace.1 (.SS Filtering): Add information about %lstat syscall class.
* NEWS: Mention this change.
* linux/aarch64/syscallent.h (lstat): Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (lstat, lstat64, oldlstat): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/avr32/syscallent.h (lstat, lstat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (lstat, lstat64, osf_lstat, osf_old_lstat): Likewise.
* linux/mips/syscallent-compat.h (bsd43_lstat, posix_lstat, svr4_lstat,
sysv_lstat): Likewise.
* tests/gen_tests.in (trace_lstat): New entry.
* tests/trace_lstat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TLST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
aad36c50dc Implement -e trace=%fstat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i -e '/TSTA.*fx\?stat/ s/TSTA,/TFST|&/' \
           -e 's/\(TD|TF|TFST|TSTA,\)[[:space:]]/\1/' linux/*/syscallent*.h

* sysent.h (TRACE_FSTAT): New macro.
* syscall.c: Alias TFST to TRACE_FSTAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_FSTAT for "%fstat".
* strace.1 (.SS Filtering): Add information about %fstat syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstat64, fstatat64): Add TFST flag.
* linux/64/syscallent.h (fstat, newfstatat): Likewise.
* linux/aarch64/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (fstat, fstat64, fstatat64, oldfstat): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/avr32/syscallent.h (fstat, fstat64, fstatat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, osf_fstat,
osf_old_fstat): Likewise.
* linux/powerpc64/syscallent.h (fstat, newfstatat, oldfstat): Likewise.
* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_oldfstat, posix_fstat,
svr4_fstat, sysv_fstat): Likewise.
* tests/gen_tests.in (trace_fstat): New entry.
* tests/trace_fstat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TFST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
ed84a97da5 Implement -e trace=%%stat option
linux/*/syscallent*.h part is updated automatically by:

    sed -i '/TSFA\|stat[iu]s/! s/,[[:space:]]\?\([[:space:]]*SEN(.*stat\)/|TSTA,\1/' \
        linux/*/syscallent*.h

* sysent.h (TRACE_STAT_LIKE): New macro.
* syscall.c: Alias TSTA to TRACE_STAT_LIKE around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_STAT_LIKE for "%%stat".
* strace.1 (.SS Filtering): Add information about %%stat syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstat64, fstatat64, statx): Add TSTA flag.
* linux/64/syscallent.h (fstat, newfstatat, statx): Likewise.
* linux/aarch64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
osf_fstat, osf_lstat, osf_old_fstat, osf_old_lstat, osf_old_stat, osf_stat,
stat, stat64): Likewise.
* linux/arm/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/avr32/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64): Likewise.
* linux/bfin/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/crisv10/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/hppa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64): Likewise.
* linux/i386/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/ia64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
* linux/m68k/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/microblaze/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_lstat, bsd43_oldfstat,
bsd43_oldstat, bsd43_stat, posix_fstat, posix_lstat, posix_stat, svr4_fstat,
svr4_fxstat, svr4_lstat, svr4_lxstat, svr4_stat, svr4_xstat, sysv_fstat,
sysv_fxstat, sysv_lstat, sysv_lxstat, sysv_stat, sysv_xstat): Likewise.
* linux/mips/syscallent-n32.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/mips/syscallent-n64.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/mips/syscallent-o32.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/powerpc64/syscallent.h (fstat, lstat, newfstatat, oldfstat, oldlstat,
oldstat, stat): Likewise.
* linux/powerpc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/s390/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64, statx): Likewise.
* linux/s390x/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/sh64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64): Likewise.
* linux/sh/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64): Likewise.
* linux/sparc64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldlstat, stat, stat64): Likewise.
* linux/sparc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldlstat, stat, stat64): Likewise.
* linux/x32/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/x86_64/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/xtensa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64, statx): Likewise.
* tests/gen_tests.in (trace_stat_like): New entry.
* tests/trace_stat_like.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TSTA): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
777626eb35 qualify: add syntax for optional non-matching syscall qualification
It may be useful in case syscall is not present on the target
architecture.

* qualify.c (qualify_syscall): Add ignore_fail flag, set it to true
in case syscall qualification is led by a question mark(s).
* strace.1 (.SS Filtering): Document ability to use question marks
in syscall qualification.
2017-04-21 19:49:03 +00:00
f002da7273 linux/alpha/syscallent.h: add TSFA flag to osf_getfsstat
In accordance with [1].

[1] https://www.freebsd.org/cgi/man.cgi?query=getfsstat&sektion=2

* linux/alpha/syscallent.h (osf_getfsstat): Add TSFA flag.
* strace.1 (.SS Filtering) <%%statfs>: Update equivalent regexp.
2017-04-21 19:49:03 +00:00
4fc98fa63d linux/mips/syscallent-compat.h: add some TD/TF flags for *stat* variants
*xstat syscalls are, according to [1], like their *stat counterparts,
but with additional argument with fixed value.

[1] http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf

* linux/mips/syscallent-compat.h (*_xstat, *_lxstat, bsd43_oldstat):
Add TF flag.
(*_fxstat, bsd43_oldfstat): Add TD flag.
2017-04-21 19:49:03 +00:00
c05b95334c Implement -e trace=%%statfs option
linux/*/syscallent*.h part is updated automatically by:

    sed -i 's/\(TSF\),[[:space:]]\?/\1|TSFA,/' linux/*/syscallent*.h
    sed -i 's/\(TFSF\),/\1|TSFA,/' linux/*/syscallent*.h
    sed -i 's/0\(,.*ustat\)/TSFA\1/' linux/*/syscallent*.h

* sysent.h (TRACE_STATFS_LIKE): New macro.
* syscall.c: Alias TSFA to TRACE_STATFS_LIKE around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS_LIKE for "%%statfs".
* strace.1 (.SS Filtering): Add information about %%statfs syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (statfs64, fstatfs64): Add TSFA flag.
* linux/64/syscallent.h (statfs, fstatfs): Likewise.
* linux/aarch64/syscallent.h (statfs, fstatfs, ustat): Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (statfs, statfs64, fstatfs, fstatfs64, ustat):
Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs,
ofs_fstatfs, osf_fstatfs64, ustat): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs, *_fstatfs): Likewise.
* tests/gen_tests.in (trace_statfs_like): New entry.
* tests/trace_statfs_like.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TSFA): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
b4aabcb16f Implement -e trace=%fstatfs option
linux/*/syscallent*.h part is updated automatically by:

    sed -i 's/TD,[[:space:]]\([[:space:]]*SEN.*[_"]fstatv\?fs\)/TD|TFSF,\1/' \
           linux/*/syscallent*.h

* sysent.h (TRACE_FSTATFS): New macro.
* syscall.c: Alias TFSF to TRACE_FSTATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_FSTATFS for "%fstatfs".
* strace.1 (.SS Filtering): Add information about %fstatfs syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstatfs64): Add TFSF flag.
* linux/64/syscallent.h (fstatfs): Likewise.
* linux/aarch64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (fstatfs, fstatfs64):
Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (ofs_fstatfs, osf_fstatfs64): Likewise.
* linux/mips/syscallent-compat.h (*_fstatfs, *_fstatvfs): Likewise.
* tests/gen_tests.in (trace_fstatfs): New entry.
* tests/trace_fstatfs.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TFSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-21 19:49:03 +00:00
a0851a70ef sysent.h: format syscall flag macros
Add some tabulation and leading zeroes to the values.
2017-04-21 19:49:03 +00:00
adf9387ae3 tests: tabulate sched.test
Rewrite sched.test using test_trace_expr().

* tests/gen_tests.in (sched): New entry.
* tests/sched.in: New file, derived from a set of tests in sched.test.
* tests/sched.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove sched.test.
(EXTRA_DIST): Add sched.in.
2017-04-21 19:49:03 +00:00
d293351841 tests: tabulate regex.test
Rewrite regex.test using test_trace_expr().

* tests/gen_tests.in (regex): New entry.
* tests/regex.in: New file, derived from a set of tests in regex.test.
* tests/regex.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove regex.test.
(EXTRA_DIST): Add regex.in.
2017-04-21 19:49:03 +00:00
3793ca5614 tests: tabulate clock.test
Rewrite clock.test using test_trace_expr().

* tests/gen_tests.in (clock): New entry.
* tests/clock.in: New file, derived from a set of tests in clock.test.
* tests/clock.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove clock.test.
(EXTRA_DIST): Add clock.in.
2017-04-21 19:49:03 +00:00
e0097ec21c tests: tabulate trace_statfs.test
Rewrite trace_statfs.test using test_trace_expr().

* tests/gen_tests.in (trace_statfs): New entry.
* tests/trace_statfs.in: New file, derived from a set of tests
in trace_statfs.test.
* tests/trace_statfs.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove trace_statfs.test.
(EXTRA_DIST): Add trace_statfs.in.
2017-04-21 19:49:03 +00:00
e9e99b01fb tests/init.sh: add helpers for running set of programs
This introduces three new helpers:
prog_set_subtract subtracts one program set from another,
test_pure_prog_set runs strace check on a set of programs,
test_trace_expr tests trace expressions.

* tests/init.sh (prog_set_subtract, test_pure_prog_set,
test_trace_expr): New functions.
2017-04-21 19:49:03 +00:00
55dcc7488f tests: extend gen_tests.sh further
* tests/gen_tests.sh: Extend support of arbitrary rules.
2017-04-20 18:11:35 +00:00
a1f9eabfd8 tests/xstat.c: do not remove sample file after test
As tests are executed in separate directories now, there is no need to
remove sample file.

* tests/xstat.c (main): Remove unlink calls.
2017-04-20 03:20:54 +02:00
b266f3e9eb tests: use fixed name for stat tests sample file
As tests are now run in separate directories.

* tests/xstatx.c: Use fixed "stat.sample" name for sample file.
* tests/fstat.test: Use it as an argument for -P option.
* tests/gen_tests.in (fstat64, lstat, lstat64, newfstatat, oldlstat,
oldstat, stat, stat64, statx): Likewise.
2017-04-20 02:52:34 +02:00
cd838da878 Derive copyright year from the git commit date
This solves problems like the need to update test suite on every
New Year's Eve.

* Makefile.am (dist-hook): Generate .year.
* copyright-year-gen: New file.
* configure.ac (copyright_year): New m4 variable, defined as the output
of copyright-year-gen script.
(AC_COPYRIGHT): Use it.
(COPYRIGHT_YEAR): New output variable and preprocessor macro.
* strace.c (print_version): Use COPYRIGHT_YEAR.
* strace.spec.in (%prep): Save the value of COPYRIGHT_YEAR autoconf
variable to .year file.
* tests/strace-V.test (config_year): New variable, derived from config.h.
Add sanity checks for $config_year and use it in expected output.

Reported-by: Andreas Schwab <schwab@suse.de>
2017-04-19 08:29:46 +00:00
c79792293b tests: move /proc/ checks from scripts to executables
Move most of /proc/self/task/ and /proc/self/fd/ checks from scripts
to xecutables.

* tests/attach-f-p.test: Move /proc/self/task/ check ...
* tests/attach-f-p-cmd.c (main): ... here.
* tests/fstat.test: Move /proc/self/fd/ check ...
* tests/xstatx.c (main): ... here.
* tests/net-y-unix.test: Move /proc/self/fd/ check ...
* tests/net-y-unix.c (main): ... here.
* tests/net-yy-inet.test: Move /proc/self/fd/ check ...
* tests/net-yy-inet.c (main): ... here.
* tests/net-yy-netlink.test: Move /proc/self/fd/ check ...
* tests/net-yy-netlink.c (main): ... here.
* tests/net-yy-unix.test: Move /proc/self/fd/ check ...
* tests/net-yy-unix.c (main): ... here.
2017-04-19 02:16:31 +00:00
db1f9c58e1 tests: tabulate pread64-pwrite64.test
* tests/gen_tests.in (pread64-pwrite64): New entry.
* tests/pread64-pwrite64.c: (main): Skip the test if /proc/self/fd/
is not available.
* tests/pread64-pwrite64.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove pread64-pwrite64.test.
2017-04-19 02:16:31 +00:00
12f6562f2b tests: tabulate read-write.test
* tests/gen_tests.in (read-write): New entry.
* tests/read-write.c: (main): Skip the test if /proc/self/fd/
is not available.
* tests/read-write.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove read-write.test.
2017-04-19 02:16:31 +00:00
9f93fd094f tests: add skip_if_unavailable function to libtests
* tests/skip_unavailable.c: New file.
* tests/tests.h (skip_if_unavailable): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add skip_unavailable.c.
2017-04-19 02:16:31 +00:00
d681cf249a tests: tabulate netlink_protocol.test
* tests/gen_tests.in (netlink_protocol): New entry.
* tests/netlink_protocol.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove netlink_protocol.test.
2017-04-19 00:55:21 +00:00
936b3824a0 tests: tabulate statfs.test
* tests/gen_tests.in (statfs): New entry.
(fstatfs, fstatfs64, statfs64): Update.
* tests/statfs.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove statfs.test.
2017-04-19 00:02:56 +00:00
af65eec08e tests: skip statfs related tests if their sample files are not available
* tests/xstatfsx.c (print_statfs): Skip the test if open failed.
2017-04-18 23:56:09 +00:00
94d3a0c488 tests: extend gen_tests.sh to support arbitrary test_* rules
* tests/gen_tests.sh: Add support of arbitrary test_* rules.
2017-04-18 23:31:19 +00:00
d12d631016 tests: change gen_tests.sh to read its input as raw input
* tests/gen_tests.sh: Specify -r option to read.
* tests/gen_tests.in (shmxt): Update.
2017-04-18 23:25:04 +00:00
3c2e2d4984 strace.1: s/regex expression/regular expression/ 2017-04-18 01:25:11 +00:00
11d1359f23 strace.1: enhance %statfs description
* strace.1 (.SS Filtering) <%statfs>: Fix the list of syscalls,
add an equivalent regex expression.
2017-04-17 20:14:07 +00:00
1be0e27b0b netlink: decode NLMSG_ERROR messages
* netlink.c (decode_nlmsgerr, decode_payload): New functions.
(decode_nlmsghdr_with_payload): Use decode_payload.
* tests/netlink_protocol.c (send_query): Check decoding
of NLMSG_ERROR messages.
* NEWS: Mention this change.
2017-04-17 04:37:41 +00:00
51929c017a netlink: avoid using unaligned sizeof(struct nlmsghdr) unnecessarily
* netlink.c (NLMSG_HDRLEN): Redefine.
(decode_nlmsghdr_with_payload, decode_netlink): Use it instead
of sizeof(struct nlmsghdr).
2017-04-17 04:37:29 +00:00
0653be4e01 Fix the length argument passed from print_iovec to decode_netlink
* io.c (print_iovec): Pass the actual length to decode_netlink
instead of the original length.
* NEWS: Mention this fix.
2017-04-17 04:37:11 +00:00
15d574a899 numa: fix printing of error values in move_pages status array
* numa.c (print_status): Do not lose a minus sign when printing
a symbolic error code.
* tests/move_pages.c (print_status_array): Update expected output.
2017-04-17 04:36:54 +00:00
25fa79bdb2 tests: generate pure_executables part of check_PROGRAMS automatically
* tests/gen_pure_executables.sh: New file.
* bootstrap: Invoke it.
* tests/Makefile.am: Include pure_executables.am.
(check_PROGRAMS): Add $(PURE_EXECUTABLES).  Remove everything listed
in pure_executables.list.
(EXTRA_DIST): Add gen_pure_executables.sh.
* tests/.gitignore: Add pure_executables.am.
2017-04-17 00:53:19 +00:00
8578ec6784 tests: make EXTRA_DIST sorted
* tests/Makefile.am (EXTRA_DIST): Sort.
2017-04-17 00:50:19 +00:00
cb8b94b7d5 tests: check decoding of alpha specific osf_utimes syscall
* tests/osf_utimes.c: New file.
* tests/gen_tests.in (osf_utimes): New entry.
* tests/Makefile.am (check_PROGRAMS): Add osf_utimes.
* tests/pure_executables.list: Likewise.
* tests/.gitignore: Likewise.
2017-04-17 00:29:58 +00:00
39fcedfd24 tests: parametrize utimes.c
* tests/xutimes.c: New file, based on utimes.c.
* tests/utimes.c [__NR_utimes] (TEST_SYSCALL_NR, TEST_SYSCALL_STR,
TEST_STRUCT): New macros.
[__NR_utimes]: Replace all the rest with include "xutimes.c".
* tests/Makefile.am (EXTRA_DIST): Add xutimes.c.
2017-04-17 00:17:00 +00:00
3d0939c56e alpha: fix tracing flags of osf_select and osf_utimes syscalls
* linux/alpha/syscallent.h (osf_select): Add TD flag.
(osf_utimes): Add TF flag.
* NEWS: Mention alpha specific fixes.
2017-04-16 23:37:13 +00:00
7ffc669fb5 alpha: rename print_timeval32_pair to print_timeval32_utimes
This follows the rename of print_timeval_item to print_timeval_utimes.

* defs.h [ALPHA] (print_timeval32_pair): Rename
to print_timeval32_utimes.
* print_timeval.c [ALPHA] (print_timeval32_pair): Likewise.
* utimes.c [ALPHA] (SYS_FUNC(osf_utimes)): Replace print_timeval32_pair
with print_timeval32_utimes.
2017-04-16 23:27:08 +00:00
5ba6c5a43a tests: do more rigorous testing of utimes syscall parser
* tests/utimes.c (errstr): New variable.
(print_ts, k_utimes): New functions.
(main): Use them to do more rigorous testing of utimes syscall parser.
* tests/gen_tests.in (utimes): Update -a option.
2017-04-16 18:47:29 +00:00
01fff8d56b tests: do more rigorous testing of futimesat syscall parser
* tests/futimesat.c (errstr): New variable.
(print_ts, k_futimesat): New functions.
(main): Use them to do more rigorous testing of futimesat syscall parser.
2017-04-16 18:47:29 +00:00
e5f236d341 Fix printing of inaccessible times argument of utimes and futimesat syscalls
When the whole pair of struct timeval structures cannot be fetched from
tracee's memory, print the address.  This behavior follows the kernel's
that uses copy_from_user for the whole pair, too.

* print_timeval.c (print_timeval_item): Remove.
(print_timeval_pair): Rename to print_timeval_utimes, all callers
updated.  Fetch the whole timeval_t array with a single
umove_or_printaddr call.
* tests/futimesat.c (main): Update expected output.
* tests/utimes.c (main): Likewise.
2017-04-16 18:13:27 +00:00
589cff6975 tests: rewrite utimensat.test without relying on libc utimensat wrapper
The new test also does more rigorous testing.

* tests/utimensat.c: Stop including <assert.h> and <errno.h>, include
<unistd.h> and <asm/unistd.h>, check __NR_utimensat instead
of HAVE_UTIMENSAT.
(errstr): New variable.
(k_utimensat): New function, a thin wrapper around
syscall(__NR_utimensat).
(main): Use them instead of utimensat.
* tests/gen_tests.in (utimensat): New entry.
* tests/utimensat.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove it.
2017-04-16 17:28:00 +00:00
27638f632e tests: use fixed timestamps in utime related tests
* tests/clock.test: Remove futimesat, utime, utimensat, and utimes tests
from the list of exceptions.
* tests/utime.c (main): Do not use time(), use fixed timestamp instead.
* tests/futimesat.c (main): Do not use gettimeofday(), use fixed
timestamps instead.
* tests/utimensat.c (main): Likewise.
* tests/utimes.c (main): Likewise.
2017-04-16 17:28:00 +00:00
df60f9954d xtensa: wire up new syscalls
* linux/xtensa/syscallent.h [348..350]: New pkey_* entries.

Reported-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>
2017-04-15 13:28:23 +00:00
f67d2ba565 Update statx parser and syscall entries lists to the upstream
* linux/32/syscallent.h [291]: Add statx entry.
* linux/64/syscallent.h [291]: Likewise.
* linux/arm/syscallent.h [397]: Likewise.
* linux/m68k/syscallent.h [379]: Likewise.
* linux/mips/syscallent-n32.h [6330]: Likewise.
* linux/mips/syscallent-n64.h [5326]: Likewise.
* linux/mips/syscallent-o32.h [4366]: Likewise.
* linux/powerpc/syscallent.h [383]: Likewise.
* linux/s390/syscallent.h [379]: Likewise.
* linux/s390x/syscallent.h [379]: Likewise.
* linux/xtensa/syscallent.h [351]: Likewise.
* statx.h (struct_statx): Update.
* statx.c (SYS_FUNC(statx)): Print struct_statx.stx_attributes_mask.
* tests/xstatx.c (print_stat, main): Update to test decoding
of struct_statx.stx_attributes_mask.
2017-04-15 13:25:57 +00:00
87607b9afc tests: add more regex match checks
* tests/qual_syscall.test: Add regex match checks.
2017-04-14 17:47:21 +00:00
d99a74da9b tests: make mq_sendrecv* test executables reenterable
* tests/mq_sendrecv.c (MQ_NAME): Remove.
(mq_name): New static variable.
(cleanup): Use it instead of MQ_NAME.
(main): Initialize it dynamically using the pid of process.  Use it
instead of MQ_NAME.
2017-04-14 16:43:18 +00:00
e49d055b5d tests: make mq test executable reenterable
* tests/mq.c (NAME): Remove.
(main): Replace the fixed message queue name with a dynamically
made name containing the pid of process.
* tests/gen_tests.in (mq): Update -a option.
2017-04-14 16:25:05 +00:00
106f57d11e tests: make net-yy-netlink test executable reenterable
* tests/net-yy-netlink.c (main): Use getpid() instead of a fixed
magic number.
2017-04-14 16:25:05 +00:00
7989f61426 tests: tabulate shmxt.test
* tests/gen_tests.in (shmxt): New entry.
* tests/shmxt.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove shmxt.test.
2017-04-14 15:35:21 +00:00
3330d4ad28 Revert "Implement -e trace=%sched option"
-e trace=%sched became redundant as -e trace=/sched does the same.

This reverts commit 811638e9c1.

* syscall.c (TSC): Remove.
* sysent.h (TRACE_SCHED): Remove.
* qualify.c (lookup_class): Remove %sched.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TSC flag from sched* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/sched.test: Replace trace=%sched with trace=/sched.
* tests/ksysent.c (TSC): Remove.
* tests/nsyscalls.c: Likewise.
2017-04-14 15:06:42 +00:00
676d2460b9 Revert "Implement -e trace=%clock option"
-e trace=%clock became redundant as -e trace=/clock does the same.

This reverts commit 0a13d2391c.

* syscall.c (TCL): Remove.
* sysent.h (TRACE_CLOCK): Remove.
* qualify.c (lookup_class): Remove %clock.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TCL flag from clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: Replace trace=%clock with trace=/clock.
* tests/ksysent.c (TCL): Remove.
* tests/nsyscalls.c: Likewise.
2017-04-14 15:06:42 +00:00
969f4a066b tests: robustify regex.test
* tests/regex.test: Use trace_statfs.test as a template instead
of clock.test and sched.test, not because of more interesting
regular expressions but to fix build on platforms where
clock.test and sched.test are not reenterable.
2017-04-14 14:53:35 +00:00
131c5c9c90 Implement -e trace=/regex option
* qualify.c: Include <regex.h>.
(qualify_syscall_regex): New function.
(qualify_syscall): Use it.
* strace.1: Document -e trace=/regex option.
* NEWS: Mention -e trace=/regex option.
* tests/regex.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/options-syntax.test: Add checks for invaild regexp
and for regexp that doesn't match a syscall.
2017-04-14 12:18:29 +00:00
05a9a86c23 tests: fix ioctl_nsfs.test on hppa
* tests/ioctl_nsfs.c (test_user_namespace): Specify an address
in the middle of a mapped page as child_stack address argument
of the clone call.
[IA64] (clone): Update.
2017-04-14 01:21:19 +00:00
d1a9966669 tests: fix ioctl_nsfs.test on ia64
glibc on ia64 provides no clone() function, but there is a __clone2
function instead.  It is documented but no prototype is provided by
glibc.

* tests/ioctl_nsfs.c [IA64] (__clone2): New prototype.
[IA64] (clone): New macro wrapper around __clone2.
2017-04-14 00:52:37 +00:00
3860effe9a tests: check decoding of the remaining V4L2_BUF_TYPE_* types
* tests/ioctl_v4l2.c (init_v4l2_format, print_ioctl_v4l2): New functions
to avoid code duplication in VIDIOC_S_FMT and VIDIOC_TRY_FMT tests.
(main) <VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT>: Use them.  Add
checks for remaining V4L2_BUF_TYPE_* types.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
2017-04-13 23:47:43 +00:00
a1c10a1e77 v4l2: Implement decoding of the remaining V4L2_BUF_TYPE_* types
* v4l2.c: Include "xlat/v4l2_vbi_flags.h" and "xlat/v4l2_sliced_flags.h".
(struct_v4l2_clip): New typedef.  Mpersify it.
(print_v4l2_clip): New function.
(print_v4l2_format_fmt): Use it.  Add struct tcb argument.  Implement
decoding of the remaining V4L2_BUF_TYPE_* types.
* xlat/v4l2_vbi_flags.in: Add V4L2_VBI_UNSYNC and V4L2_VBI_INTERLACED
introduced by linux kernel commit v2.5.46~39^2~23^2~4.
Add V4L2_VBI_ITU_525_F1_START, V4L2_VBI_ITU_525_F2_START,
V4L2_VBI_ITU_625_F1_START, and V4L2_VBI_ITU_625_F2_START introduced by
linux kernel commit v3.17-rc1~112^2~217.
* xlat/v4l2_sliced_flags.in: Add V4L2_SLICED_TELETEXT_B, V4L2_SLICED_VPS,
V4L2_SLICED_CAPTION_525, V4L2_SLICED_WSS_625, V4L2_SLICED_VBI_525, and
V4L2_SLICED_VBI_625 introduced by linux kernel commit v2.6.14-rc2~64.
* configure.ac (AC_CHECK_DECLS): Add V4L2_BUF_TYPE_SDR_CAPTURE and
V4L2_BUF_TYPE_SDR_OUTPUT.
(AC_CHECK_MEMBERS): Add struct v4l2_window.global_alpha and
struct v4l2_sdr_format.buffersize.
* NEWS: Mention this change.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
2017-04-13 23:47:43 +00:00
ce39a627f8 travis: use mainline kernel uapi headers for coverage
* .travis.yml (matrix) <CHECK=coverage>: Add KHEADERS=torvalds/linux.
* travis-build.sh: Handle $KHEADERS.
* travis-install.sh: Likewise.
2017-04-13 18:24:09 +00:00
8ecb171951 travis: switch from clang-3.6 to clang-3.8
* .travis.yml (matrix): Change clang-3.6 to clang-3.8.
2017-04-13 18:24:09 +00:00
2afd57decb Implement decoding of NS_* ioctl commands
* configure.ac (AC_CHECK_HEADERS): Add linux/nsfs.h.
* defs.h (DECL_IOCTL(nsfs)): New prototype.
(setns_types): Make global.
* ioctl.c (ioctl_decode): Call nsfs_ioctl for 0xb7 code.
* nsfs.c: New file.
* nsfs.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/ioctl_nsfs.c: New file.
* tests/ioctl_nsfs.test: Likewise.
* tests/.gitignore: Add ioctl_nsfs.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_nsfs.test.
* NEWS: Mention this change.
2017-04-13 15:46:49 +00:00
0a3bb911c7 travis: copy coverage test suite log to the travis log
* travis-build.sh (coverage): Print tests*/test-suite.log
and tests*/ksysent.log.
2017-04-13 04:43:46 +00:00
ffe3df1a4d travis: add gcc-6
* .travis.yml (matrix): Add gcc-6 entries.
* travis-build.sh: Handle gcc*.
* travis-install.sh: Handle gcc-*.
2017-04-12 03:06:32 +00:00
a5c73d296d tests: robustify gen_tests.sh against in-tree builds
* tests/gen_tests.sh: Use abs_srcdir instead of srcdir to construct
a path to gen_tests.sh in implicit make rules.
2017-04-11 06:55:51 +00:00
7df7bc1889 trace_syscall_exiting: do not call get_regs for filtered syscalls
This saves up to 25% of ptrace syscalls in case of trace filtering.

* syscall.c (trace_syscall_exiting): Do not call gettimeofday
and get_regs for filtered syscalls.
* NEWS: Mention this change.
* tests/get_regs.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2017-04-11 04:04:37 +00:00
cb46fea4d5 Delay get_regs invocation
strace used to call get_regs on every stop of a tracee, including cases
when the result is going to be discarded.  Prepare to change this lavish
practice by delaying get_regs invocation until its result is actually
needed.

* defs.h (get_regs): Remove.
* strace.c (trace): Do not call get_regs.
* syscall.c (get_regs): Add static qualifier.
(trace_syscall_exiting, print_pc, get_scno): Call get_regs.
2017-04-11 04:04:37 +00:00
8e3361d39c startup_tcb: move get_scno invocation to a more convenient place
* strace.c (trace): Move get_scno invocation ...
(startup_tcb): ... here.  This is a no-op change that slightly improves
readability.
2017-04-11 04:04:37 +00:00
13ffa22088 get_regs: guard against subsequent invocations
At this moment there is only one call to get_regs,
but there is going to be more of them, so a guard is needed.

This change also adds a clear_regs call before get_regs,
which essentially reverts commit v4.9-288-ge9bfff6.

* strace.c (trace): Call clear_regs before get_regs.
* syscall.c (get_regs): Skip if get_regs_error != -1.
2017-04-11 04:04:37 +00:00
83265998b8 syscall: move definitions of automatic variables closer to their use
* syscall.c (trace_syscall_entering, trace_syscall_exiting): Move
definitions of automatic variables closer to their first use.  This
change slightly improves readability.
2017-04-11 04:04:37 +00:00
d9e54d6e3e tests: check decoding of gettid syscall
* tests/gettid.c: New file.
* tests/.gitignore: Add gettid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (gettid): New entry.
2017-04-11 04:04:37 +00:00
c34e1c36ec tests: fix build on alpha
* tests/getpid.c: Skip if __NR_getpid is not defined.
* tests/getppid.c: Skip if __NR_getppid is not defined.

Fixes: fd1041f6 ("tests: add tests for getpid and getppid syscalls")
2017-04-11 04:04:37 +00:00
831c8106ca Fix build with old linux/netlink.h
* socketutils.c: Provide a fallback definition of NETLINK_SOCK_DIAG.

Fixes: 5c256356 ("Do not include xlat/netlink_protocols.h twice")
2017-04-11 04:04:37 +00:00
5c25635603 Do not include xlat/netlink_protocols.h twice
Make netlink_protocols a global xlat array defined in net.c file.

* defs.h (netlink_protocols): New prototype.
* socketutils.c: Stop including "xlat/netlink_protocols.h".
2017-04-10 00:20:34 +00:00
e7df09c76e Do not include xlat/clocknames.h twice
Make clocknames a global xlat array defined in time.c file.

* defs.h (clocknames): New prototype.
* perf.c: Stop including "xlat/clocknames.h".
2017-04-10 00:20:34 +00:00
da55527b3f Remove unused xlat/openmodessol.in
* xlat/openmodessol.in: Remove file unused since commit
v4.10-45-gdf4dd8b.
2017-04-10 00:20:34 +00:00
65fc72c2a5 Remove unused xlat/aclipc.in
* xlat/aclipc.in: Remove file unused since commit v4.9-46-g681452b.
2017-04-10 00:20:34 +00:00
7f6f12a829 tests: remove statfs.expected
statfs.expected is unused since commit v4.11-515-g67c2f67.

* tests/statfs.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2017-04-07 01:21:36 +00:00
fd1041f6ac tests: add tests for getpid and getppid syscalls
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>

[ldv: rewritten everything]

* tests/getpid.c: New file.
* tests/getppid.c: Likewise.
* tests/.gitignore: Add getpid and getppid.
* tests/pure_executables.list: Likewise.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (getpid, getppid): New entries.
2017-04-07 01:21:36 +00:00
3288b4fe77 Update V4L2_* constants
* xlat/v4l2_buf_flags.in: Add V4L2_BUF_FLAG_PREPARED,
V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, and V4L2_BUF_FLAG_NO_CACHE_CLEAN
introduced by linux kernel commit v3.2-rc1~63^2~55.
Add V4L2_BUF_FLAG_TIMESTAMP_MASK, V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,
and V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC introduced by linux kernel commit
v3.9-rc1~93^2~536.
Add V4L2_BUF_FLAG_TIMESTAMP_COPY introduced by linux kernel commit
v3.10-rc1~136^2~560.
Add V4L2_BUF_FLAG_TSTAMP_SRC_MASK, V4L2_BUF_FLAG_TSTAMP_SRC_EOF,
and V4L2_BUF_FLAG_TSTAMP_SRC_SOE introduced by linux kernel commit
v3.15-rc1~85^2~186.
Add V4L2_BUF_FLAG_LAST introduced by linux kernel commit
v4.2-rc1~107^2~389.
* xlat/v4l2_buf_types.in: Add V4L2_BUF_TYPE_SDR_CAPTURE
and V4L2_BUF_TYPE_SDR_OUTPUT introduced by linux kernel commits
v3.15-rc1~85^2~213 and v4.4-rc1~118^2~14, respectively.
* xlat/xlat/v4l2_colorspaces.in: Add V4L2_COLORSPACE_ADOBERGB
and V4L2_COLORSPACE_BT2020 introduced by linux kernel commit
v3.19-rc1~29^2~72.
Add V4L2_COLORSPACE_RAW and V4L2_COLORSPACE_DCI_P3 introduced by linux
kernel commits v4.2-rc1~107^2~182 and v4.4-rc1~118^2~120, respectively.
* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_SDR_CAPTURE,
V4L2_CAP_EXT_PIX_FORMAT, and V4L2_CAP_SDR_OUTPUT introduced by linux
kernel commits v3.15-rc1~85^2~210, v3.17-rc1~112^2~327,
and v4.4-rc1~118^2~14, respectively.
* xlat/v4l2_memories.in: Add V4L2_MEMORY_OVERLAY introduced
in linux 2.5.46.  Add V4L2_MEMORY_DMABUF introduced by linux kernel
commit v3.8-rc1~115^2^2~52.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
2017-04-07 01:21:36 +00:00
2fa95ae169 Implement -e trace=%statfs option
linux/*/syscallent*.h part is modified automatically by:

	sed -i 's/TF\(,[[:space:]]*SEN.*[_"]statv\?fs\)/TF|TSF\1/' \
		linux/*/syscallent*.h

[ldv: rewritten trace_statfs.test using sched.test as a template]

* sysent.h (TRACE_STATFS): New macro.
* syscall.c: Alias TSF to TRACE_STATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS for "%statfs".
* strace.1 (.SS Filtering): Add information about %statfs syscall class.
* NEWS: Mention this change.
* linux/64/syscallent.h (statfs): Add TSF flag.
* linux/aarch64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/32/syscallent.h (statfs64): Likewise.
* linux/arm/syscallent.h (statfs, statfs64): Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs): Likewise.
* tests/trace_statfs.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-07 01:21:36 +00:00
0a13d2391c Implement -e trace=%clock option
linux/*/syscallent.h part is modified automatically by
sed -i 's/0\(,[[:space:]]*SEN(clock_\)/TCL\1/' linux/*/syscallent*.h

[ldv: rewritten clock.test using sched.test as a template]

* sysent.h (TRACE_CLOCK): New macro.
* syscall.c: Alias TCL to TRACE_CLOCK around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_CLOCK for "%clock".
* strace.1 (.SS Filtering): Add information about %clock syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h: Add TCL flag for clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TCL): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.
2017-04-06 22:47:09 +00:00
c2014bccec tests: tabulate xattr.test
* tests/gen_tests.in (xattr): New entry.
* tests/xattr.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove xattr.test.
2017-04-06 22:22:50 +00:00
c352954786 tests: generalize scripts that check non-abbreviated decoding of ioctls
* tests/ioctl-v.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
(DECODER_TESTS): Remove ioctl_evdev-v.test, ioctl_loop-v.test,
and ioctl_rtc-v.test.
* tests/gen_tests.in (ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v):
New entries.
* tests/ioctl_evdev-v.test: Remove.
* tests/ioctl_loop-v.test: Ditto.
* tests/ioctl_rtc-v.test: Ditto.
2017-04-05 00:44:30 +00:00
0527093a7c tests: tabulate stereotypical test scripts
Convert test scripts that follow simple testing patterns to a table.
Generate all these scripts from gen_tests.in file using gen_tests.sh
script at bootstrap time.

The largest set of test scripts has been converted using
the following command:

grep -l ^run_strace_match_diff *.test |while read f; do
	n="${f%.test}"
	grep '^[^#]' "$f" |
	grep -Evq '^(\. "\${srcdir=\.}/init\.sh"|run_strace_match_diff)' ||
	sed -n 's/^run_strace_match_diff\(.*\)/'$n'\1/p' "$f"
done

The second largest set of test scripts has been converted using
the following command:

grep -l srcdir= *.test |while read f; do
	n="${f%.test}"
	grep '^[^#]' "$f" |
	grep -Fvq srcdir= ||
	sed -n 's/^. "\${srcdir=.}\/\([^"]\+\)".*/'$n'\t+\1/p' "$f"
done

* tests/gen_tests.in: New file.
* tests/gen_tests.sh: New file.
* bootstrap: Invoke it.
* tests/.gitignore: Add *.gen.test and gen_tests.am.
* tests/_newselect.test: Remove.
* tests/accept.test: Ditto.
* tests/accept4.test: Ditto.
* tests/access.test: Ditto.
* tests/acct.test: Ditto.
* tests/add_key.test: Ditto.
* tests/adjtimex.test: Ditto.
* tests/aio.test: Ditto.
* tests/alarm.test: Ditto.
* tests/bpf.test: Ditto.
* tests/btrfs.test: Ditto.
* tests/chmod.test: Ditto.
* tests/chown.test: Ditto.
* tests/chown32.test: Ditto.
* tests/chroot.test: Ditto.
* tests/clock_adjtime.test: Ditto.
* tests/clock_nanosleep.test: Ditto.
* tests/clock_xettime.test: Ditto.
* tests/copy_file_range.test: Ditto.
* tests/creat.test: Ditto.
* tests/delete_module.test: Ditto.
* tests/dup.test: Ditto.
* tests/dup2.test: Ditto.
* tests/dup3.test: Ditto.
* tests/epoll_create.test: Ditto.
* tests/epoll_create1.test: Ditto.
* tests/epoll_ctl.test: Ditto.
* tests/epoll_pwait.test: Ditto.
* tests/epoll_wait.test: Ditto.
* tests/erestartsys.test: Ditto.
* tests/execveat-v.test: Ditto.
* tests/execveat.test: Ditto.
* tests/faccessat.test: Ditto.
* tests/fadvise64_64.test: Ditto.
* tests/fallocate.test: Ditto.
* tests/fanotify_init.test: Ditto.
* tests/fanotify_mark.test: Ditto.
* tests/fchdir.test: Ditto.
* tests/fchmod.test: Ditto.
* tests/fchmodat.test: Ditto.
* tests/fchown.test: Ditto.
* tests/fchown32.test: Ditto.
* tests/fchownat.test: Ditto.
* tests/fcntl.test: Ditto.
* tests/fcntl64.test: Ditto.
* tests/fdatasync.test: Ditto.
* tests/file_handle.test: Ditto.
* tests/file_ioctl.test: Ditto.
* tests/finit_module.test: Ditto.
* tests/flock.test: Ditto.
* tests/fork-f.test: Ditto.
* tests/fstat64.test: Ditto.
* tests/fstatat64.test: Ditto.
* tests/fstatfs.test: Ditto.
* tests/fstatfs64.test: Ditto.
* tests/fsync.test: Ditto.
* tests/ftruncate.test: Ditto.
* tests/ftruncate64.test: Ditto.
* tests/futimesat.test: Ditto.
* tests/get_mempolicy.test: Ditto.
* tests/getcpu.test: Ditto.
* tests/getcwd.test: Ditto.
* tests/getdents.test: Ditto.
* tests/getdents64.test: Ditto.
* tests/getegid.test: Ditto.
* tests/getegid32.test: Ditto.
* tests/geteuid.test: Ditto.
* tests/geteuid32.test: Ditto.
* tests/getgid.test: Ditto.
* tests/getgid32.test: Ditto.
* tests/getgroups.test: Ditto.
* tests/getgroups32.test: Ditto.
* tests/getpeername.test: Ditto.
* tests/getpgrp.test: Ditto.
* tests/getrandom.test: Ditto.
* tests/getresgid.test: Ditto.
* tests/getresgid32.test: Ditto.
* tests/getresuid.test: Ditto.
* tests/getresuid32.test: Ditto.
* tests/getrlimit.test: Ditto.
* tests/getrusage.test: Ditto.
* tests/getsid.test: Ditto.
* tests/getsockname.test: Ditto.
* tests/getuid32.test: Ditto.
* tests/getxxid.test: Ditto.
* tests/inet-cmsg.test: Ditto.
* tests/init_module.test: Ditto.
* tests/inotify.test: Ditto.
* tests/inotify_init1.test: Ditto.
* tests/int_0x80.test: Ditto.
* tests/ioctl_block.test: Ditto.
* tests/ioctl_evdev.test: Ditto.
* tests/ioctl_loop.test: Ditto.
* tests/ioctl_mtd.test: Ditto.
* tests/ioctl_rtc.test: Ditto.
* tests/ioctl_scsi.test: Ditto.
* tests/ioctl_sg_io_v3.test: Ditto.
* tests/ioctl_sg_io_v4.test: Ditto.
* tests/ioctl_uffdio.test: Ditto.
* tests/ioctl_v4l2.test: Ditto.
* tests/ioperm.test: Ditto.
* tests/iopl.test: Ditto.
* tests/ioprio.test: Ditto.
* tests/ip_mreq.test: Ditto.
* tests/ipc.test: Ditto.
* tests/ipc_msg.test: Ditto.
* tests/ipc_sem.test: Ditto.
* tests/ipc_shm.test: Ditto.
* tests/kcmp.test: Ditto.
* tests/kexec_file_load.test: Ditto.
* tests/kexec_load.test: Ditto.
* tests/keyctl.test: Ditto.
* tests/kill.test: Ditto.
* tests/lchown.test: Ditto.
* tests/lchown32.test: Ditto.
* tests/link.test: Ditto.
* tests/linkat.test: Ditto.
* tests/lookup_dcookie.test: Ditto.
* tests/lstat.test: Ditto.
* tests/lstat64.test: Ditto.
* tests/mbind.test: Ditto.
* tests/membarrier.test: Ditto.
* tests/memfd_create.test: Ditto.
* tests/migrate_pages.test: Ditto.
* tests/mincore.test: Ditto.
* tests/mkdir.test: Ditto.
* tests/mkdirat.test: Ditto.
* tests/mknod.test: Ditto.
* tests/mknodat.test: Ditto.
* tests/mlock.test: Ditto.
* tests/mlock2.test: Ditto.
* tests/mlockall.test: Ditto.
* tests/mmap64.test: Ditto.
* tests/mmsg-silent.test: Ditto.
* tests/mmsg.test: Ditto.
* tests/mmsg_name-v.test: Ditto.
* tests/mmsg_name.test: Ditto.
* tests/mount.test: Ditto.
* tests/move_pages.test: Ditto.
* tests/mq.test: Ditto.
* tests/mq_sendrecv-read.test: Ditto.
* tests/mq_sendrecv-write.test: Ditto.
* tests/mq_sendrecv.test: Ditto.
* tests/msg_control-v.test: Ditto.
* tests/msg_control.test: Ditto.
* tests/msg_name.test: Ditto.
* tests/munlockall.test: Ditto.
* tests/nanosleep.test: Ditto.
* tests/net-icmp_filter.test: Ditto.
* tests/net-sockaddr.test: Ditto.
* tests/newfstatat.test: Ditto.
* tests/old_mmap.test: Ditto.
* tests/oldfstat.test: Ditto.
* tests/oldlstat.test: Ditto.
* tests/oldstat.test: Ditto.
* tests/open.test: Ditto.
* tests/openat.test: Ditto.
* tests/pause.test: Ditto.
* tests/perf_event_open.test: Ditto.
* tests/perf_event_open_nonverbose.test: Ditto.
* tests/perf_event_open_unabbrev.test: Ditto.
* tests/pipe2.test: Ditto.
* tests/pkey_alloc.test: Ditto.
* tests/pkey_free.test: Ditto.
* tests/pkey_mprotect.test: Ditto.
* tests/ppoll-v.test: Ditto.
* tests/ppoll.test: Ditto.
* tests/preadv-pwritev.test: Ditto.
* tests/preadv.test: Ditto.
* tests/preadv2-pwritev2.test: Ditto.
* tests/printstr.test: Ditto.
* tests/prlimit64.test: Ditto.
* tests/process_vm_readv.test: Ditto.
* tests/process_vm_writev.test: Ditto.
* tests/pselect6.test: Ditto.
* tests/ptrace.test: Ditto.
* tests/pwritev.test: Ditto.
* tests/quotactl-v.test: Ditto.
* tests/quotactl-xfs-v.test: Ditto.
* tests/quotactl-xfs.test: Ditto.
* tests/quotactl.test: Ditto.
* tests/readahead.test: Ditto.
* tests/readdir.test: Ditto.
* tests/readlink.test: Ditto.
* tests/readlinkat.test: Ditto.
* tests/reboot.test: Ditto.
* tests/recvfrom.test: Ditto.
* tests/recvmmsg-timeout.test: Ditto.
* tests/recvmsg.test: Ditto.
* tests/remap_file_pages.test: Ditto.
* tests/rename.test: Ditto.
* tests/renameat.test: Ditto.
* tests/renameat2.test: Ditto.
* tests/request_key.test: Ditto.
* tests/rmdir.test: Ditto.
* tests/rt_sigpending.test: Ditto.
* tests/rt_sigprocmask.test: Ditto.
* tests/rt_sigqueueinfo.test: Ditto.
* tests/rt_sigreturn.test: Ditto.
* tests/rt_sigsuspend.test: Ditto.
* tests/rt_sigtimedwait.test: Ditto.
* tests/rt_tgsigqueueinfo.test: Ditto.
* tests/sched_get_priority_mxx.test: Ditto.
* tests/sched_rr_get_interval.test: Ditto.
* tests/sched_xetaffinity.test: Ditto.
* tests/sched_xetattr.test: Ditto.
* tests/sched_xetparam.test: Ditto.
* tests/sched_xetscheduler.test: Ditto.
* tests/sched_yield.test: Ditto.
* tests/seccomp-filter-v.test: Ditto.
* tests/seccomp-filter.test: Ditto.
* tests/select.test: Ditto.
* tests/semop.test: Ditto.
* tests/sendfile.test: Ditto.
* tests/sendfile64.test: Ditto.
* tests/set_mempolicy.test: Ditto.
* tests/setdomainname.test: Ditto.
* tests/setfsgid.test: Ditto.
* tests/setfsgid32.test: Ditto.
* tests/setfsuid.test: Ditto.
* tests/setfsuid32.test: Ditto.
* tests/setgid.test: Ditto.
* tests/setgid32.test: Ditto.
* tests/setgroups.test: Ditto.
* tests/setgroups32.test: Ditto.
* tests/sethostname.test: Ditto.
* tests/setns.test: Ditto.
* tests/setregid.test: Ditto.
* tests/setregid32.test: Ditto.
* tests/setresgid.test: Ditto.
* tests/setresgid32.test: Ditto.
* tests/setresuid.test: Ditto.
* tests/setresuid32.test: Ditto.
* tests/setreuid.test: Ditto.
* tests/setreuid32.test: Ditto.
* tests/setrlimit.test: Ditto.
* tests/setuid.test: Ditto.
* tests/setuid32.test: Ditto.
* tests/shutdown.test: Ditto.
* tests/siginfo.test: Ditto.
* tests/signal_receive.test: Ditto.
* tests/signalfd4.test: Ditto.
* tests/sigreturn.test: Ditto.
* tests/socketcall.test: Ditto.
* tests/splice.test: Ditto.
* tests/stat.test: Ditto.
* tests/stat64.test: Ditto.
* tests/statfs64.test: Ditto.
* tests/statx.sh: Ditto.
* tests/statx.test: Ditto.
* tests/swap.test: Ditto.
* tests/symlink.test: Ditto.
* tests/symlinkat.test: Ditto.
* tests/sync.test: Ditto.
* tests/sync_file_range.test: Ditto.
* tests/sync_file_range2.test: Ditto.
* tests/sysinfo.test: Ditto.
* tests/syslog.test: Ditto.
* tests/tee.test: Ditto.
* tests/time.test: Ditto.
* tests/timer_create.test: Ditto.
* tests/timer_xettime.test: Ditto.
* tests/timerfd_xettime.test: Ditto.
* tests/times-fail.test: Ditto.
* tests/times.test: Ditto.
* tests/truncate.test: Ditto.
* tests/truncate64.test: Ditto.
* tests/ugetrlimit.test: Ditto.
* tests/umask.test: Ditto.
* tests/umoven-illptr.test: Ditto.
* tests/umovestr-illptr.test: Ditto.
* tests/umovestr3.test: Ditto.
* tests/unlink.test: Ditto.
* tests/unlinkat.test: Ditto.
* tests/unshare.test: Ditto.
* tests/userfaultfd.test: Ditto.
* tests/ustat.test: Ditto.
* tests/utime.test: Ditto.
* tests/utimes.test: Ditto.
* tests/vfork-f.test: Ditto.
* tests/vhangup.test: Ditto.
* tests/vmsplice.test: Ditto.
* tests/wait4-v.test: Ditto.
* tests/wait4.test: Ditto.
* tests/waitid-v.test: Ditto.
* tests/waitid.test: Ditto.
* tests/waitpid.test: Ditto.
* tests/xattr-strings.test: Ditto.
* tests/xet_robust_list.test: Ditto.
* tests/xetitimer.test: Ditto.
* tests/xetpgid.test: Ditto.
* tests/xetpriority.test: Ditto.
* tests/xettimeofday.test: Ditto.
* tests/Makefile.am (DECODER_TESTS, MISC_TESTS): Remove them.
Include gen_tests.am.
(TESTS): Add $(GEN_TESTS).
(XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Rename int_0x80.test
to int_0x80.gen.test.
(EXTRA_DIST): Add gen_tests.in and gen_tests.sh, remove statx.sh.
(clean-local-check): Remove $(GEN_TESTS:.gen.test=.dir).
2017-04-05 00:44:30 +00:00
713b138218 tests: handle test scripts with .gen.test suffix
* tests/init.sh: If script name ends with .gen.test,
set NAME variable with .gen.test suffix stripped.
2017-04-04 23:17:43 +00:00
490b1caa52 mpers.awk: add support for multidimensional arrays
* mpers.awk (update_upper_bound): New function, which maintains new "count"
property for storing total element count and updates "upper_bound"
property which now contains string with array dimensions.
(/^DW_AT_upper_bound/, /^DW_AT_count/): Use it.
(what_is) <case "array_type">: Use "count" property in order to calculate
returned_size, do not embody returned string in square brackets.
* mpers_test.sh: Add checks for multidimensional arrays.
2017-04-04 03:10:07 +00:00
a12c6a014b mpers.awk: prepare for adding support of multidimensional arrays
* mpers.awk (what_is) <case "structure_type", case "union_type">:
Move formatting of array upper_bound ...
<case "array_type">: ... here.
2017-04-04 02:42:26 +00:00
c446d22fc6 tests: cleanup temporary files removals
As every test now runs in its own subdirectory, there is no need
to remove leftover files manually by each test.

* tests/init.sh (run_strace_match_diff): Do not remove $EXP.
* tests/brk.test: Likewise.
* tests/options-syntax.test: Likewise.
* tests/qual_inject-retval.test (check_injection): Likewise.
* tests/qual_signal.test (test_one_sig): Likewise.
* tests/sched.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/threads-execve.test: Likewise.
* tests/attach-f-p.test: Use $EXP instead of $OUT, do not remove it.
* tests/personality.test: Likewise.
* tests/poll.test: Likewise.
* tests/fstat.test: Likewise.
* tests/ipc.sh: Likewise.
* tests/restart_syscall.test: Likewise.
* tests/utimensat.test: Likewise.
* tests/attach-p-cmd.test: Likewise.  Do not remove
attach-p-cmd.test-lock.
* tests/detach-running.test: Do not remove $LOG.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/redirect.test: Do not remove $OUT.
* tests/strace-S.test: Likewise.
* tests/getdents.test: Do not remove $LOG.dir.
* tests/getdents64.test: Likewise.
* tests/readdir.test: Likewise.
* tests/btrfs-v.test: Do not remove $EXP and $OUT.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/execve-v.test: Likewise.
* tests/execve.test: Likewise.
* tests/fadvise64.test: Likewise.
* tests/getuid.test: Likewise.
* tests/ioctl.test: Likewise.
* tests/ioctl_dm-v.test: Likewise.
* tests/ioctl_dm.test: Likewise.
* tests/ioctl_evdev-v.test: Likewise.
* tests/ioctl_loop-nv.test: Likewise.
* tests/ioctl_loop-v.test: Likewise.
* tests/ioctl_loop.test: Likewise.
* tests/ioctl_rtc-v.test: Likewise.
* tests/ioctl_sock_gifconf.test: Likewise.
* tests/llseek.test: Likewise.
* tests/lseek.test: Likewise.
* tests/mmap.test: Likewise.
* tests/net-y-unix.test: Likewise.
* tests/net-yy-inet.test: Likewise.
* tests/net-yy-netlink.test: Likewise.
* tests/net-yy-unix.test: Likewise.
* tests/opipe.test: Likewise.
* tests/prctl-arg2-intptr.test: Likewise.
* tests/prctl-dumpable.test: Likewise.
* tests/prctl-name.test: Likewise.
* tests/prctl-no-args.test: Likewise.
* tests/prctl-pdeathsig.test: Likewise.
* tests/prctl-seccomp-filter-v.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/prctl-securebits.test: Likewise.
* tests/prctl-tid_address.test: Likewise.
* tests/prctl-tsc.test: Likewise.
* tests/umovestr2.test: Likewise.
* tests/uname.test: Likewise.
* tests/pread64-pwrite64.test: Do nore remove pread64-pwrite64-tmpfile.
* tests/read-write.test: Do nore remove read-write-tmpfile.
* tests/qual_fault.test (check_fault_injection): Do not remove $EXP,
$outexp, and $outgot.
* tests/redirect-fds.test (check_fd): Reorder removal of work files.
* tests/pc.test: Use $EXP instead of $EXPECTED, do not remove it.
* tests/strace-t.test: Likewise.
* tests/scm_rights-fd.test: Likewise.  Use dir instead of $LOG.dir,
do not remove it.
* tests/strace-ff.test: Do not remove $OUT and $LOG.* files.
2017-04-03 16:24:28 +00:00
ca83b1242f tests: enhance sched.test negative check
* tests/sched.test: Test that trace=%sched doesn't match
anything besides sched_* syscalls by checking it against all test
executables without side effects listed in pure_executables.list
except sched_* and times.
2017-04-03 01:06:11 +00:00
fddf6820d2 tests: add a list of executables without side effects
These are executables that could be used by several different tests
simultaneously.

* tests/pure_executables.list: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
2017-04-03 01:06:11 +00:00
8d69a15d4f tests: use fixed socket address in net-yy-unix.test
This allows net-yy-unix invocation without arguments.

* tests/net-yy-unix.c (TEST_SOCKET): New macro.
(void): Use it instead of av[1].
* tests/net-yy-unix.test: Do not specify arguments for the test
executable.
2017-04-03 01:06:11 +00:00
7708f597d9 tests: use fixed socket address in net-y-unix.test
This allows net-y-unix invocation without arguments.

* tests/net-y-unix.c (TEST_SOCKET): New macro.
(void): Use it instead of av[1].
* tests/net-y-unix.test: Do not specify arguments for the test
executable.
2017-04-03 01:06:11 +00:00
160360306d tests: run every test except ksysent.test in its own subdirectory
Many test executables create temporary files in the current work
directory for the duration of their execution.
This level of test isolation allows more test executables to be invoked
several times simultaneously.

* tests/.gitignore: Add *.dir, remove *.log.*, *.tmp, *.tmp-*,
and *.tmp.* patterns.
* tests/Makefile.am (clean-local, clean-local-check): New rules.
(.PHONY): Add clean-local-check.
(CLEANFILES): Remove all but ksysent.h.
* tests/init.sh: Strip test-specific prefix from LOG, OUT, and EXP
variables.  When invoked from a test, create a new test-specific
directory, chdir into it, and add more ../ prefix to STRACE variable.
(run_prog): Replace "./" with "../".
* tests/attach-f-p.test: Replace "./" with "../".
* tests/attach-p-cmd.test: Likewise.
* tests/bexecve.test: Likewise.
* tests/btrfs-v.test: Likewise.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/count.test: Likewise.
* tests/detach-running.test: Likewise.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/mmap.test: Likewise.
* tests/net-y-unix.test: Likewise.
* tests/net-yy-inet.test: Likewise.
* tests/net-yy-netlink.test: Likewise.
* tests/net-yy-unix.test: Likewise.
* tests/net.test: Likewise.
* tests/opipe.test: Likewise.
* tests/poll.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/qual_fault-exit_group.test: Likewise.
* tests/qual_fault.test: Likewise.
* tests/qual_inject-error-signal.test: Likewise.
* tests/qual_inject-retval.test: Likewise.
* tests/qual_inject-signal.test: Likewise.
* tests/qual_signal.test: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/readv.test: Likewise.
* tests/redirect-fds.test: Likewise.
* tests/sched.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-C.test: Likewise.
* tests/strace-E.expected: Likewise.
* tests/strace-E.test: Likewise.
* tests/strace-S.test: Likewise.
* tests/strace-T.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-ff.test: Likewise.
* tests/strace-k.test: Likewise.
* tests/strace-r.expected: Likewise.
* tests/strace-r.test: Likewise.
* tests/strace-t.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/sun_path.test: Likewise.
* tests/uname.test: Likewise.
* tests/unix-pair-send-recv.test: Likewise.
* tests/unix-pair-sendto-recvfrom.test: Likewise.
2017-04-03 01:06:11 +00:00
3e15e018ef tests: make test executables invocable outside current work directory
Most of test executables were ready for the upcoming change,
this change prepares all the rest.

* tests/getdents.c (main): Use fixed name for the sample directory.
* tests/getdents64.c (main): Likewise.
* tests/readdir.c (main): Likewise.
* tests/mknod.c (sample): Change to a pointer.
(main): Use av[0] as a sample.
* tests/symlink.c (main): Use av[0] as a linkpath.
* tests/umode_t.c (sample): Change to a pointer.
(test_syscall): Fix expected output.
(main): Use av[0] as a sample.
2017-04-03 01:06:11 +00:00
c5c64110a8 tests: cleanup access.test
* tests/access.test: Use run_strace_match_diff.
* tests/access.c (main): Update expected output.
2017-03-31 23:25:32 +00:00
263dbc567c tests: cleanup oldfstat.test
* tests/oldfstat.test: Use fstat.test.
2017-03-30 23:29:24 +00:00
a8d2417e97 aarch64: workaround gcc+kernel bug
Due to a subtle gcc bug that leads to miscompiled aarch64 kernels,
the 3rd argument of sched_getattr syscall is not quite 32-bit
on aarch64 as on other architectures.  For more details see
https://sourceforge.net/p/strace/mailman/message/35721703/

* defs.h (print_abnormal_hi): New prototype.
* util.c (print_abnormal_hi): New function.
* sched.c (SYS_FUNC(sched_getattr)) [AARCH64]: Use it.
* tests/sched_xetattr.c (main) [__arm64__ || __aarch64__]: Test it.
2017-03-29 18:27:14 +00:00
5b7681cf05 alpha, mips: fix missing flags in stat related compatibility syscalls
Following commands do the fix:

Add TF flag, fixed by:
	git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
  		's/0\(,[[:space:]]*SEN(.*_l\?stat[^i]\)/TF\1/'

Add TD flag, fixed by:
	git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
	  's/0\(,[[:space:]]*SEN(.*_fstat\)/TD\1/'

* linux/alpha/syscallent.h: Add TF and TD flags to stat related
compat syscall entries.
* linux/mips/syscallent-compat.h: Likewise.
2017-03-29 00:35:54 +00:00
f3088e1253 alpha: fix the number of arguments in alpha specific syscalls
* linux/alpha/syscallent.h (getxgid, osf_stat, osf_lstat, osf_fstat,
osf_sysinfo, sethae): Set nargs according to arch/alpha/kernel/osf_sys.c
from linux v4.10.
2017-03-24 15:09:59 +00:00
f6389aa5ea alpha: update comments about not implemented syscalls
* linux/alpha/syscallent.h: Sync "not implemented" comments
with arch/alpha/kernel/systbls.S from linux v4.10.
2017-03-24 15:09:59 +00:00
90ddd42859 Update BPF_MAP_TYPE_* constants
* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_ARRAY_OF_MAPS
and BPF_MAP_TYPE_HASH_OF_MAPS constants.
2017-03-23 17:46:15 +00:00
a4441dfa8c Update ioctl entries from linux v4.11-rc3
* linux/32/ioctls_inc_align16.h: Update from linux v4.11-rc3 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.
2017-03-23 16:42:32 +00:00
4aa409b9e3 maint: update for linux 4.11
* maint/ioctls_sym.sh (ppc_list): Add KVM_PPC_GET_RMMU_INFO
and KVM_PPC_CONFIGURE_V3_MMU.
2017-03-23 16:42:32 +00:00
722c73af9a test: rename README to README.md
* test/README: Rename to README.md, turn ../tests reference into an URL.
2017-03-19 13:34:16 +00:00
f9390b96f4 test: update README
* test/README: Tell the reader what this directory is actually for.
2017-03-19 13:34:16 +00:00
ec5480453b test: rewrite skodic.c demo
* test/skodic.c: Rewrite this demo to simplify its use.
2017-03-19 13:34:16 +00:00
5e925d6d9c Implement decoding of statx syscall
* linux/i386/syscallent.h [383]: Add statx entry.
* linux/x32/syscallent.h [332]: Likewise.
* linux/x86_64/syscallent.h [332]: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_statx.
* statx.c: New file.
* statx.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/.gitignore: Add statx.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add statx.test.
* tests/statx.c: New file.
* tests/statx.test: Likewise.
* tests/xstatx.c: Modify to support statx.
* xlat/at_statx_sync_types.in: New file.
* xlat/statx_attrs.in: Likewise.
* xlat/statx_masks.in: Likewise.
* NEWS: Mention this change.
2017-03-18 22:14:16 +00:00
12781b7466 tests: check for out of bounds fetch in parsers of stat family syscalls
* tests/xstatx.c (main): Create STRUCT_STAT object using
TAIL_ALLOC_OBJECT_CONST_PTR.
2017-03-17 20:15:20 +00:00
f0da50397e tests: check unexpected syscall errors returned by stat family syscalls
* tests/xstatx.c (main) [!OLD_STAT]: Do not skip the test
in case of EOVERFLOW.
Treat errors other than ENOSYS and EOVERFLOW as fatal.
2017-03-17 20:15:20 +00:00
c465b2ee0e tests: move try_run_prog to init.sh
Looks like try_run_prog may be of general use by other syscall class
tests.

* tests/sched.test (try_run_prog): Move it...
* tests/init: ... here.
2017-03-17 21:06:06 +01:00
45cca0e9b5 tests/sched.test: rc should be a local variable in try_run_prog
* tests/sched.test (try_run_prog): Add local rc.
2017-03-17 21:06:06 +01:00
a8a29266d8 tests: check decoding of int 0x80 on x86_64, x32, and x86
* tests/int_0x80.c: New file.
* tests/int_0x80.test: New test.
* tests/.gitignore: Add int_0x80.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS, XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Add int_0x80.test.
(XFAIL_TESTS): Add $(XFAIL_TESTS_$(ARCH)).
(CLEANFILES): Add $(TESTS:=.tmp.out) and $(TESTS:=.tmp.exp).
2017-03-16 20:38:48 +00:00
49f099f9c0 strace-graph: handle pid looping
* strace-graph: On long running process or heavily forking one (like
compilation), it can happen that a parent get 2 different children with
the same pid.  By tracking the currently runnig pid and adding the start
timestamp to the pid, the graph can now handle that case.

Closes: https://github.com/strace/strace/pull/7
2017-03-16 14:45:18 +00:00
eabace12c4 tests: use TAIL_ALLOC_OBJECT_CONST_PTR
Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \
tests/*.c
2017-03-16 13:46:36 +00:00
c36875b170 tests: use TAIL_ALLOC_OBJECT_VAR_PTR
Automatically convert tests to use TAIL_ALLOC_OBJECT_VAR_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*([^ =]+) = tail_alloc\(sizeof\((\2|\*\5)\)\);/\1TAIL_ALLOC_OBJECT_VAR_PTR(\2, \5);/' \
tests/{move_pages,net-sockaddr,sendfile}.c
2017-03-16 13:46:36 +00:00
72b7cfb3bf tests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h
Introduce a new macros for the most widespread use of tail_alloc.

* tests/tests.h (TAIL_ALLOC_OBJECT_CONST_PTR,
TAIL_ALLOC_OBJECT_VAR_PTR): New macros.
2017-03-16 13:46:36 +00:00
9407d10e12 Decode RUSAGE_THREAD
* xlat/usagewho.in: Add values for existing entities, add
RUSAGE_THREAD.
* tests/getrusage.c: Test decoding of RUSAGE_THREAD.
2017-03-16 12:39:12 +00:00
b24254d34c tests/sched.test: use heredoc in order to avoid spawning of subprocess
Pipelined commands executed in subprocesses (some shells have special
provision for last command in the pipeline, but it is not guaranteed
and not POSIX), so exit codes of these subprocesses can be lost.
In order to avoid creating subprocesses, input for read commands
is better to supply via heredoc and not pipe.

* tests/sched.test: Move test cases to heredoc.
2017-03-15 01:10:51 +00:00
30c16384ef tests: do not skip sched.test if one of its subtests skips
* tests/sched.test (try_run_prog): New function.
Use it instead of run_prog.
2017-03-15 01:05:45 +00:00
245d6d20ce tests: do not check decoding of setitimer syscall outside xetitimer.test
xetitimer.test already implements a comprehensive test of setitimer
syscall parser, no need to duplicate its parts in other tests.

* tests/clock_nanosleep.c (main): Remove setitimer expected output.
* tests/nanosleep.c (main): Likewise.
* tests/clock_nanosleep.test: Remove setitimer from the trace set.
* tests/nanosleep.test: Likewise.
2017-03-15 00:00:29 +00:00
1e92920f81 tests: check decoding of getitimer and setitimer corner cases
* tests/sched_xetattr.c: Include <unistd.h> and <asm/unistd.h>.
(main): Check that pointer and integer arguments of getitimer
and setitimer syscalls are decoded properly.
* tests/xetitimer.test: Add -a option.
2017-03-14 22:35:13 +00:00
645eb6405b tests: rewrite sigreturn syscall decoding check from match_grep to match_diff
Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/sigreturn.c: Rewrite.
* tests/sigreturn.test: Likewise.
2017-03-13 15:22:51 +00:00
8e1ebd868f ia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls
As there is no sigreturn syscall on ia64, mips n32, mips n64, x32,
and x86_64, no longer used parsers could be safely removed.

* linux/ia64/arch_sigreturn.c: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Remove [!LINUX_MIPSO32].
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Remove.
2017-03-13 15:22:51 +00:00
a3d941a863 Move sigreturn parser to libstrace
All architectures have rt_sigreturn, but only old ones also have
sigreturn.  Since not all architectures need a parser of sigreturn
syscall, remove the warning and move the parser to libstrace.

* Makefile.am (strace_SOURCES): Move sigreturn.c ...
(libstrace_a_SOURCES): ... here.
* linux/arch_sigreturn.c: Remove warning.
2017-03-13 15:22:50 +00:00
5c6951e73e tests: check decoding of rt_sigreturn syscall
* tests/rt_sigreturn.c: New file.
* tests/rt_sigreturn.test: New test.
* tests/.gitignore: Add rt_sigreturn.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add rt_sigreturn.test.
2017-03-13 15:22:50 +00:00
31601155c4 Implement proper decoding of rt_sigreturn syscall
* rt_sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_rt_sigreturn): Remove.
* linux/64/syscallent.h (rt_sigreturn): Change sys_func to rt_sigreturn.
* linux/hppa/syscallent.h (rt_sigreturn): Likewise.
* linux/ia64/syscallent.h (rt_sigreturn): Likewise.
* linux/s390/syscallent.h (rt_sigreturn): Likewise.
* linux/s390x/syscallent.h (rt_sigreturn): Likewise.
* linux/x86_64/syscallent.h (rt_sigreturn): Likewise.
* linux/x32/syscallent.h (rt_sigreturn, 64:rt_sigreturn): Likewise.
* NEWS: Mention this change.
2017-03-13 15:22:50 +00:00
c57cf9acf5 Introduce get_rt_sigframe_addr function
Add get_rt_sigframe_addr function for all supported architectures.
It is going to be used in a parser of rt_sigreturn syscall.

* defs.h (get_rt_sigframe_addr): New function prototype.
* rt_sigframe.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/arch_rt_sigframe.c: New file.
* linux/alpha/arch_rt_sigframe.c: Likewise.
* linux/arc/arch_rt_sigframe.c: Likewise.
* linux/arm/arch_rt_sigframe.c: Likewise.
* linux/avr32/arch_rt_sigframe.c: Likewise.
* linux/bfin/arch_rt_sigframe.c: Likewise.
* linux/crisv10/arch_rt_sigframe.c: Likewise.
* linux/crisv32/arch_rt_sigframe.c: Likewise.
* linux/hppa/arch_rt_sigframe.c: Likewise.
* linux/i386/arch_rt_sigframe.c: Likewise.
* linux/ia64/arch_rt_sigframe.c: Likewise.
* linux/m68k/arch_rt_sigframe.c: Likewise.
* linux/metag/arch_rt_sigframe.c: Likewise.
* linux/microblaze/arch_rt_sigframe.c: Likewise.
* linux/mips/arch_rt_sigframe.c: Likewise.
* linux/nios2/arch_rt_sigframe.c: Likewise.
* linux/or1k/arch_rt_sigframe.c: Likewise.
* linux/powerpc/arch_rt_sigframe.c: Likewise.
* linux/powerpc64/arch_rt_sigframe.c: Likewise.
* linux/riscv/arch_rt_sigframe.c: Likewise.
* linux/s390/arch_rt_sigframe.c: Likewise.
* linux/s390x/arch_rt_sigframe.c: Likewise.
* linux/sh/arch_rt_sigframe.c: Likewise.
* linux/sh64/arch_rt_sigframe.c: Likewise.
* linux/sparc/arch_rt_sigframe.c: Likewise.
* linux/sparc64/arch_rt_sigframe.c: Likewise.
* linux/tile/arch_rt_sigframe.c: Likewise.
* linux/x32/arch_rt_sigframe.c: Likewise.
* linux/x86_64/arch_rt_sigframe.c: Likewise.
* linux/xtensa/arch_rt_sigframe.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2017-03-13 15:22:50 +00:00
23f2891d4c Introduce struct_rt_sigframe type
Add rt_sigframe.h files with definitions of struct_rt_sigframe type
for all supported architectures.
These definitions are going to be used in a parser of rt_sigreturn
syscall.

* linux/rt_sigframe.h: New file.
* linux/bfin/rt_sigframe.h: Likewise.
* linux/crisv10/rt_sigframe.h: Likewise.
* linux/crisv32/rt_sigframe.h: Likewise.
* linux/hppa/rt_sigframe.h: Likewise.
* linux/i386/rt_sigframe.h: Likewise.
* linux/ia64/rt_sigframe.h: Likewise.
* linux/m68k/rt_sigframe.h: Likewise.
* linux/mips/rt_sigframe.h: Likewise.
* linux/powerpc64/rt_sigframe.h: Likewise.
* linux/s390/rt_sigframe.h: Likewise.
* linux/s390x/rt_sigframe.h: Likewise.
* linux/sh64/rt_sigframe.h: Likewise.
* linux/sparc/rt_sigframe.h: Likewise.
* linux/sparc64/rt_sigframe.h: Likewise.
* linux/tile/rt_sigframe.h: Likewise.
* linux/x32/rt_sigframe.h: Likewise.
* linux/x86_64/rt_sigframe.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2017-03-13 15:22:50 +00:00
9d1250b39c unwind.c: fix a possible buffer overflow
Linux does not prevent a user from creating a lot of nested directories
with length of the absolute path of the deepest one exceeding PATH_MAX,
then chdir'ing into it, creating a file there and mmap'ing it. Since the
length of the prefix preceding the pathname in /proc/[pid]/maps is not
necessary 80 (it's 73 on my machine), an overflow is possible.

* unwind.c (build_mmap_cache): Fix a possible buffer overflow.
2017-03-13 15:19:22 +00:00
c9731a0dbe util.c: remove a wrong comment
4924dbd6d7 modified the return type, but
not the comment.
2017-03-13 15:19:22 +00:00
8ffa3fd109 riscv: export riscv_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/riscv/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/riscv/arch_regs.c (riscv_sp_ptr): New variable.
2017-03-10 20:06:58 +00:00
6d32a2ee93 or1k: export or1k_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/or1k/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/or1k/arch_regs.c (or1k_sp_ptr): New variable.
2017-03-10 19:52:11 +00:00
6117728aac nios2: export nios2_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/nios2/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/nios2/arch_regs.c (nios2_sp_ptr): New variable.
2017-03-10 19:45:06 +00:00
5610aacaad metag: export metag_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/metag/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/metag/arch_regs.c (metag_sp_ptr): New variable.
2017-03-10 19:26:54 +00:00
3403f14ece avr32: export avr32_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/avr32/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/avr32/arch_regs.c (avr32_sp_ptr): New variable.
2017-03-10 18:40:05 +00:00
134042a514 arc: export arc_sp_ptr
Export SP register for later use by get_rt_sigframe_addr.

* linux/arc/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/arc/arch_regs.c (arc_sp_ptr): New variable.
2017-03-10 18:34:46 +00:00
43b7c24994 Introduce print_sigset_addr function
As the definition of NSIG_BYTES is based on NSIG defined in <signal.h>,
NSIG_BYTES cannot be used in files that use kernel sigset_t.

Add another wrapper around print_sigset_addr_len_limit function that
takes one argument less than print_sigset_addr_len wrapper.  This new
wrapper is going to be used in cases when the length argument is equal
to NSIG_BYTES.

* defs.h (print_sigset_addr): New function prototype.
* signal.c (print_sigset_addr): New function.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Replace
print_sigset_addr_len with print_sigset_addr.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
2017-03-09 22:51:46 +00:00
a58fc3c950 README.md: rework guidelines about sending bug reports 2017-03-08 13:43:47 +00:00
efa36ac950 Update information on how to build strace from git repository
* INSTALL-git.md: Describe how to build strace from git repository.
* README.md: Add reference to INSTALL-git.md.
* README-hacking: Likewise.
2017-03-08 09:10:03 +00:00
db316ec7fb README.md: fix references to in-tree files
* README.md: Change references to COPYING and NEWS files from absolute
to relative.
2017-03-05 19:08:28 +00:00
8d50c350e5 INSTALL: regenerate from install.texi
Regenerate INSTALL from install.texi using the following command:
makeinfo --plaintext install.texi > INSTALL

* INSTALL: Regenerate from install.texi.
2017-03-05 16:29:41 +00:00
cdc18792b4 install.texi: remove irrelevant sections
Remove "Multiple Architectures" and "Particular Systems" sections using
the following filter script:

awk '/^@node (Multiple Architectures|Particular Systems)/{skip=1;next}
/^@node/{skip=0} {if(!skip)print}'

* install.texi (Multiple Architectures, Particular Systems): Remove.
2017-03-05 16:29:41 +00:00
65afd28152 install.texi: import from GNU Autoconf
install.texi from GNU Autoconf is the ultimate source of INSTALL file.
This edition of install.texi has been downloaded from
https://git.savannah.gnu.org/cgit/autoconf.git/plain/doc/install.texi?id=63f3c78cdb0ccc85751543e387ef2a7252d5f0a2

* install.texi: Import from GNU Autoconf.
2017-03-05 16:29:41 +00:00
811638e9c1 Implement -e trace=%sched option for tracing sched_* syscalls
Based on the patch by Md Haris Iqbal
(https://sourceforge.net/p/strace/mailman/message/35111320/)

linux/*/syscallent.h part is modified automatically by:

    git grep -Fl 'SEN(sched_' linux/ | xargs sed -i \
        's/0\(,[[:space:]]*SEN(sched_\)/TSC\1/'

* sysent.h (TRACE_SCHED): New definition.
* syscall.c: Alias TSC to TRACE_SCHED around syscallent.h inclusion.
* linux/32/syscallent.h: Add TSC flag for sched_* sycalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* qualify.c (lookup_class): Add TRACE_SCHED for "%sched".
* tests/ksysent.c: Define TSC to 0.
* tests/nsyscalls.c: Likewise.
* tests/sched.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add sched.test.
* strace.1 (.SS Filtering): Add information about %sched syscall class.
* NEWS: Mention this change.

Co-authored-by: Md Haris Iqbal <haris.phnx@gmail.com>
2017-03-05 01:11:13 +01:00
6477079361 Add "%" prefix for syscall classes in qualify
(as suggested in
https://www.mail-archive.com/strace-devel@lists.sourceforge.net/msg05147.html )

In order to move them to a different namespace than syscall names. This is
already a problem in case of ipc class which shadows ipc syscall.

Old behaviour is retained in order to preserve backwards compatibility.

* qualify.c (lookup_class) <syscall_class>: Add %-prefixed class definitions.
* strace.1 (.SS Filtering): Add information regarding %-prefixed class
syntax, declare legacy class syntax deprecated.
* tests/net.test: Update to use %-prefixed syscall class name.
* tests/netlink_protocol.test: Likewise.
* tests/qual_fault-exit_group.test: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/sigreturn.test: Likewise.
* tests/uio.test: Likewise.
* NEWS: Mention this change.
2017-03-05 00:32:18 +01:00
73a21f1a3f tests: simplify print_time_t
* tests/print_time.c (print_time_t): Treat localtime errors as fatal.
2017-02-28 01:21:15 +00:00
2bba131575 Update homepage URL
* README: Change homepage URL to https://strace.io
* debian/control: Likewise.
* strace.spec.in: Likewise.
2017-02-27 23:11:07 +00:00
bc41bcbb0b tests: transform print_time_t into print_time_t_nsec
* tests/print_time.c (print_time_t): Rename to print_time_t_nsec,
take second argument and print it.
* tests/tests.h (print_time_t): Rename to print_time_t_nsec,
add second argument.
* tests/utime.c (main): Use print_time_t_nsec instead of print_time_t.
* tests/xstatx.c (print_stat): Likewise.  Pass nanoseconds
to print_time_t_nsec instead of printing them.
2017-02-26 23:23:31 +00:00
0698ab728f tests: use print_time_t in utime.test
* tests/utime.c (print_tm): Remove.
(main): Use print_time_t instead of print_tm.
2017-02-26 22:57:37 +00:00
af10e6e751 tests: move print_time function to libtests
Rename print_time function to print_time_t and move it to libtests.

* tests/print_time.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (print_time_t): New prototype.
* tests/print_time.c (print_time): Remove.
(print_stat): Replace print_time with print_time_t.
2017-02-26 20:35:37 +00:00
b8a045fbf0 tests: macroize printing of atime, mtime, and ctime fields in xstatx.c
Introduce a macro for printing similar time related fields.

* print_struct_stat.c (PRINT_ST_TIME): New macro.
(print_stat): Use it.
2017-02-26 19:14:34 +00:00
889012d4b5 print_struct_stat.c: macroize printing of atime, mtime, and ctime fields
Introduce a macro for printing similar time related fields.

* print_struct_stat.c (PRINT_ST_TIME): New macro.
(print_struct_stat): Use it.
2017-02-26 19:14:34 +00:00
f7b9a6ac63 x32: fix decoding of flags argument of preadv2 and pwritev2 syscalls
x32 is the only linux architecture where preadv2 and pwritev2 syscalls
take 5 arguments instead of 6.

* io.c (PREADV2_PWRITEV2_FLAGS_ARG_NO): New macro.
(SYS_FUNC(preadv2), SYS_FUNC(pwritev2)): Use it.
* linux/x32/syscallent.h (preadv2, pwritev2): Change nargs to 5.
* NEWS: Mention this fix.
* tests/preadv2-pwritev2.c (main): Fix invocation of preadv2
and pwritev2 syscalls on x32.
2017-02-25 15:55:31 +00:00
7519e54937 tests: rewrite ppoll syscall decoding check from match_grep to match_diff
Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/ppoll-v.c: New file.
* tests/ppoll-v.test: New test.
* tests/ppoll.c: Rewrite.
* tests/ppoll.test: Likewise.
* tests/ppoll.expected: Remove.
* tests/ppoll-v.expected: Remove.
* tests/.gitignore: Add ppoll-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ppoll-v.test.
(EXTRA_DIST): Remove ppoll.expected and ppoll-v.expected.
2017-02-21 22:39:45 +00:00
667b764c41 tests: move get_sigset_size function to libtests
* tests/get_sigset_size.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (get_sigset_size): New prototype.
* tests/ptrace.c: Do not check for __NR_rt_sigprocmask.
(main): Use get_sigset_size.
* tests/signalfd4.c: Do not check for __NR_rt_sigprocmask.
(get_sigset_size): Remove.
2017-02-20 00:10:35 +00:00
556652be53 sched: enhance decoding of sched_setattr syscall
Implement read/write semantics of struct sched_attr.size argument
of sched_setattr syscall.  Do not print members of struct sched_attr
besides sched_attr.size when the specified structure size is less than
the minimal size allowed by the kernel.

* sched.c (print_sched_attr): Fetch struct sched_attr.size and use it
as the structure size.  Print struct sched_attr.size only when the
structure size is less than SCHED_ATTR_MIN_SIZE.
(SYS_FUNC(sched_setattr)): Call print_sched_attr with zero size
argument.  Print struct sched_attr.size returned by the kernel
on exiting syscall in case of E2BIG. Print the last syscall argument
on exiting syscall.
(SYS_FUNC(sched_getattr)): Do not call print_sched_attr with zero size
argument.
* NEWS: Mention it.
* tests/sched_xetattr.c (main): Check it.
2017-02-19 00:31:40 +00:00
f31755fda2 tests: check decoding of sched_[gs]etattr corner cases
* tests/sched_xetattr.c (main): Check that integer arguments
of sched_getattr and sched_setattr syscalls are decoded properly
by adding a few cases with filled higher 32 bits.
Check that pointer argument is decoded properly
on F8ILL_KULONG_SUPPORTED architectures.
2017-02-18 09:58:52 +00:00
3e80074350 Move definition of struct sched_attr to a separate header file
Avoid multiple defintions of struct sched_attr by creating a separate
header file with its definition and using it in other places.

* sched_attr.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* sched.c: Include it.
(print_sched_attr): Use it.
* tests/sched_xetattr.c: Include it.
(main): Use it.
2017-02-18 09:58:52 +00:00
6e9ad7be61 tests: rewrite sched_xetattr.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/adjtimex.c: Include "xlat.h" and "xlat/schedulers.h",
(sys_sched_getattr, sys_sched_setattr): New functions.
(main): Use them.  Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.
2017-02-18 09:58:52 +00:00
55d126a8d7 Use tprints instead of tprintf in a few more places
* bpf.c (bpf_obj_manage, bpf_prog_attach_detach): Replace tprintf
with tprints for printing strings without format specifiers.
* dm.c (dm_decode_dm_target_spec): Likewise.
* mq.c (SYS_FUNC(mq_timedreceive)): Likewise.
* perf.c (print_perf_event_attr): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
2017-02-17 23:19:58 +00:00
5b2e59a413 bpf: update BPF_PROG_ATTACH decoding
Implement decoding of BPF_F_ALLOW_OVERRIDE flag of BPF_PROG_ATTACH
command introduced by linux kernel commit v4.10-rc7-174-g7f67763.

* configure.ac: Check for union bpf_attr.attach_flags
instead of union bpf_attr.attach_type.
* xlat/bpf_attach_flags.in: New file.
* bpf.c: Include "xlat/bpf_attach_flags.h".
(bpf_prog_attach_detach): Rename print_attach_bpf_fd argument
to print_attach.  Add attach_flags field to the structure,
print it in case of BPF_PROG_ATTACH.
* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_ATTACH_FLAGS
instead of HAVE_UNION_BPF_ATTR_ATTACH_TYPE.
(prog_cgroup): Initialize attach_flags field.
(main): Update expected output.
2017-02-17 00:05:00 +00:00
f19251a808 tests: rewrite adjtimex.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/adjtimex.c: Include "xlat.h", "xlat/adjtimex_state.h",
and "xlat/adjtimex_status.h".
(main): Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.
2017-02-16 21:02:44 +00:00
18b582ec11 tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK
* tests/init_delete_module.h (bogus_zero): Remove.
* tests/delete_module.c (main): Replace bogus_zero and
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/finit_module.c (main): Replace bogus_zero
with F8ILL_KULONG_MASK.
* tests/init_module.c (main): Likewise.
* tests/pipe2.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Replace
(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
* tests/fanotify_init.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/fanotify_mark.c (main): Likewise.
* tests/file_handle.c (main): Likewise.
* tests/kexec_load.c (main): Likewise.
* tests/setfsugid.c (main): Likewise.
* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
with F8ILL_KULONG_MASK.
* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
2017-02-16 16:36:14 +00:00
1d5e810ce8 tests: fill higher bits of integer arguments of fcntl* syscalls
Check that integer arguments of fcntl and fcntl64 syscalls are decoded
properly by casting them to kernel_ulong_t and filling higher bits.

* tests/struct_flock.c (invoke_test_syscall): Cast "fd" and "cmd"
syscall arguments to kernel_ulong_t, fill their higher 32 bits.
2017-02-16 12:51:00 +00:00
ec75764697 tests: use sprintrc in tests of fcntl and fcntl64 syscalls
* tests/struct_flock.c (EINVAL_STR): Remove.
(test_flock_einval, test_flock): Use sprintrc instead of EINVAL_STR.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval, test_flock64): Likewise.
2017-02-16 12:51:00 +00:00
f954c48f4b Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.16-1.
* strace.spec.in: Likewise.
2017-02-15 22:59:59 +00:00
b13da8675c Prepare for 4.16 release
* NEWS: Update for 4.16 release.
2017-02-14 10:11:12 +00:00
2e2cd52e24 .mailmap: add addresses of JingPiao Chen
* .mailmap: Add both addresses of JingPiao Chen here to avoid
duplications in CREDITS file.
2017-02-13 21:08:41 +00:00
9ff5dbe36d tests: skip scno tampering tests on compat mips abi
* tests/scno_tampering.sh: In case of mips abi, skip the test
unless it is the native abi.
2017-02-13 17:30:00 +00:00
2063341fef Fix -Werror=duplicate-decl-specifier compilation issues
capability.c:82:28: error: duplicate "const" declaration specifier
capability.c:110:33: error: duplicate "const" declaration specifier
rt_tgsigqueueinfo.c:42:61: error: duplicate "const" declaration specifier
utime.c:66:23: error: duplicate "const" declaration specifier
waitid.c:147:20: error: duplicate "const" declaration specifier

* capability.c (cap_user_header_t, cap_user_data_t): Remove.
(get_cap_header): Change return type
to "const struct user_cap_header_struct *".
(print_cap_header, print_cap_data): Change the type of last argument
to "const struct user_cap_header_struct * const".
(SYS_FUNC(capget)): Change type of "h" variable
to "const struct user_cap_header_struct *".
(SYS_FUNC(capset)): Change type of "h" variable
to "const struct user_cap_header_struct * const".
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Change the type of last
argument to "const void *const".
* tests/utime.c (main): Change the type of "tail_u" variable
to "const struct utimbuf *const".
* tests/waitid.c (do_waitid): Change the type of 3rd argument
to "const siginfo_t *const".
2017-02-12 19:14:15 +00:00
c10dd66fb7 tests: rewrite pipe syscall decoding check from match_grep to match_diff
* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
instead of [!HAVE_PIPE2].
(main): Do not call pipe2.
* tests/pipe.test: Skip the test if libc pipe wrapper does not use
pipe syscall, rewrite from match_grep to match_diff.
* tests/pipe.expected: Update expected output.
2017-02-12 14:12:41 +00:00
3c5dbffe61 tests: rewrite pipe2 syscall decoding check from match_grep to match_diff
Unlike pipe.test that is based on match_grep, the new test
is based on match_diff and does more rigorous testing.

* tests/pipe2.c: New file.
* tests/pipe2.test: New test.
* tests/.gitignore: Add pipe2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pipe2.test.
2017-02-11 13:40:42 +00:00
649fe41781 tests: rewrite mq.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/mq.c: Include <stdio.h>.
(NAME): New macro.
(main): Use it.  Print expected output.
* tests/mq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
* tests/mq.test: Use run_strace_match_diff.
2017-02-10 00:14:45 +00:00
2ee98e5030 Simplify struct inject_opts.rval semantics
Drop use of INJECT_OPTS_RVAL_DISABLE special inject_opts.rval value,
INJECT_OPTS_RVAL_DEFAULT is enough.

* defs.h (INJECT_OPTS_RVAL_DISABLE): Remove.
* qualify.c (qualify_inject_common): Do not replace
INJECT_OPTS_RVAL_DEFAULT with INJECT_OPTS_RVAL_DISABLE
in inject_opts.rval.
* syscall.c (tamper_with_syscall_entering): Check
for INJECT_OPTS_RVAL_DEFAULT instead of INJECT_OPTS_RVAL_DISABLE.
2017-02-09 22:26:14 +00:00
98313939b3 tests: check signal injection along with fault injection
* tests/qual_inject-error-signal.c: New file.
* tests/qual_inject-error-signal.expected: Likewise.
* tests/qual_inject-error-signal.test: New test.
* tests/.gitignore: Add qual_inject-error-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-error-signal.test.
(EXTRA_DIST): Add qual_inject-error-signal.expected.
2017-02-09 22:26:14 +00:00
8b1f878809 tests: simplify qual_inject-signal.test
* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.
2017-02-09 22:26:14 +00:00
1124db4483 Make symbolic errno values match case-insensitive
Follow the example of case-insensitive symbolic signal values in signal
and inject expressions and make symbolic errno values in inject
expressions case-insensitive.

* qualify.c (find_errno_by_name): Use strcasecmp instead of strcmp
to match symbolic errno values.
* tests/qual_fault.c (main): Likewise.
* tests/qual_fault.test: Test case-insensitive symbolic errno match.
2017-02-09 14:38:08 +00:00
e2040dede4 tests: check case-insensitive symbolic signal match
* tests/qual_signal.test: Test case-insensitive symbolic signal match.
2017-02-09 14:38:08 +00:00
45365df082 Update NEWS 2017-02-09 13:48:04 +00:00
8663bfb907 Update NEWS 2017-02-08 17:22:02 +00:00
959dc8b32b strace.spec.in: fix dist version checks
* strace.spec.in: Fix libunwind availability check.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-02-08 16:36:57 +00:00
e0fc01c0ef tests: update ipc_sem.test for new glibc
Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
address to semctl like other libcs.

* tests/ipc_sem.c (main) [__GLIBC__]: Remove.
2017-02-08 15:54:35 +00:00
75c3844167 tests: fix typo in bpf.test
* tests/bpf.c (main): Add missing semicolon.

Fixes: ad427721 ("tests: rewrite bpf.test from match_grep to match_diff")
2017-02-08 15:12:40 +00:00
34878f17b9 tests: check signal injection
* tests/qual_inject-signal.c: New file.
* tests/qual_inject-signal.expected: Likewise.
* tests/qual_inject-signal.test: New test.
* tests/.gitignore: Add qual_inject-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-signal.test.
(EXTRA_DIST): Add qual_inject-signal.expected.
2017-02-08 13:51:33 +00:00
be73ca4bae Implement -e inject= option
Introduce -e inject= as a general injection option,
limit -e fault= option to syscall fault injection.

Change default return code of syscall fault injection to ENOSYS.

* qualify.c (parse_inject_token): Add fault_tokens_only argument,
do not accept retval= and signal= tokens when fault_tokens_only
is set to true.
(parse_inject_expression): Add fault_tokens_only argument,
forward it to parse_inject_token.
(qualify_inject_common): New function.
(qualify_fault): Use it.
(qualify_inject): New function.
(qual_options): New entry.
* strace.1: Describe -e inject= option.
* NEWS: Mention -e inject= option.
* tests/qual_fault-syntax.test: Test that -e fault= option does not
support retval=, signal=, and multiple error= tokens.
* tests/qual_fault.c (DEFAULT_ERRNO): Set to ENOSYS unconditionally.
* tests/qual_inject-retval.test: Replace -e fault= option
with -e inject= option.
* tests/qual_inject-syntax.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2017-02-08 09:28:38 +00:00
d1dfcc533e tests: prepare for introduction of -e inject= option
Rename files related to fault injection to avoid further confusion.

* tests/fault_injection-exit_group.expected: Rename
to tests/qual_fault-exit_group.expected.
* tests/fault_injection-exit_group.test: Rename
to tests/qual_fault-exit_group.test.
* tests/fault_syntax.test: Rename to tests/qual_fault-syntax.test.
* tests/fault_injection.c: Rename to tests/qual_fault.c.
* tests/fault_injection.test: Rename to tests/qual_fault.test.
* tests/fault_injection-retval.c: Rename to tests/qual_inject-retval.c.
* tests/fault_injection-retval.test: Rename
to tests/qual_inject-retval.test.
* tests/fault_injection.sh: Rename to tests/scno_tampering.sh.
* tests/.gitignore: Update.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Update.
2017-02-08 09:28:30 +00:00
d5152aae15 Prepare for introduction of -e inject= option
As -e fault= injection syntax has been extended to configure various
kinds of injections besides fault injection, the original option name
bacame too narrow.

This change renames internal constants, types, and functions from
"fault" to more generic inject/tamper ones.

* defs.h (fault_opts): Rename to inject_opts.
(FAULT_OPTS_RVAL_DEFAULT): Rename to INJECT_OPTS_RVAL_DEFAULT.
(FAULT_OPTS_RVAL_DISABLE): Rename to INJECT_OPTS_RVAL_DISABLE.
(struct tcb): Rename fault_vec field to inject_vec.
(TCB_FAULT_INJ): Rename to TCB_TAMPERED.
(QUAL_FAULT): Rename to QUAL_INJECT.
(fault_vec): Rename to inject_vec.
All users changed.
* qualify.c (fault_set): Rename to inject_set.
(parse_fault_token): Rename to parse_inject_token.
(parse_fault_expression): Rename to parse_inject_expression.
All callers changed.
* syscall.c (fault_vec): Rename to inject_vec.
(tcb_fault_opts): Rename to tcb_inject_opts.
(inject_syscall_fault_entering): Rename to tamper_with_syscall_entering.
(update_syscall_fault_exiting): Rename to tamper_with_syscall_exiting.
(syscall_fault_injected): Rename to syscall_tampered.
All callers changed.
2017-02-08 09:28:07 +00:00
779a28e117 tests: make Makefile.am lists sorted in C locale
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Make sorted in C locale.
2017-02-07 17:56:32 +00:00
86477a6228 tests: use ARG_STR in msg_control.test
Drop local VAL_STR macro in favour of ARG_STR macro from tests/tests.h.

* tests/msg_control.c (VAL_STR): Remove.
(test_sol_socket, test_sol_ip): Replace VAL_STR with ARG_STR.
2017-02-07 15:25:41 +00:00
cb93e85828 powerpc, powerpc64: wire up new syscalls
* linux/powerpc/syscallent.h [382]: Add kexec_file_load entry.
* linux/powerpc64/syscallent.h [382]: Likewise.
2017-02-07 14:58:30 +00:00
55be4cb0ed microblaze: wire up new syscalls
* linux/microblaze/syscallent.h [392..397]: New entries.
2017-02-07 14:58:30 +00:00
d4499fa508 avr32: wire up new syscalls
* linux/avr32/syscallent.h [328..330]: New entries.
2017-02-07 14:58:30 +00:00
d901c7c922 Update IPV6_* constants
* xlat/sockipv6options.in: Add IPV6_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~1.
2017-02-06 22:13:20 +00:00
3115a96587 Update IP_* constants
* xlat/sockipoptions.in: Add IP_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~2.
2017-02-06 22:13:20 +00:00
5a2a54591d or1k: fix build
This fixes a typo in the arch_set_success for the or1k architecture.

* linux/or1k/set_error.c (arch_setsuccess): Rename to arch_set_success.

Fixes: 41d647c ("Implement success injection")
Closes: https://github.com/strace/strace/pull/6
2017-02-06 17:20:00 +00:00
cdee133cfb Update ioctl entries from linux 4.10
* linux/32/ioctls_inc_align16.h: Update from linux v4.10 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* NEWS: Mention this.
2017-02-04 15:57:01 +00:00
ef3fc7ebb7 maint: update for linux 4.10
* maint/ioctls_sym.sh: Update workaround for linux/if_pppox.h file.
2017-02-04 15:57:01 +00:00
f7a65e0c7d maint: add workaround for m68k
* maint/ioctls_sym.sh: Skip asm/amigayle.h.
2017-02-04 15:57:01 +00:00
bf4e76e4e7 tests: check decoding of bpf corner cases
* tests/bpf.c (bogus_bpf): New function.
(BOGUS_BPF): New macro.
(main): Use them.
* tests/bpf.test: Add -a option.
2017-01-31 19:38:45 +00:00
ad4277214e tests: rewrite bpf.test from match_grep to match_diff
* tests/bpf.c (errstr): New variable.
(sys_bpf): New function.
(map_create, map_any, prog_load, obj_manage, prog_cgroup): Use it.
(main): Update expected output.
* tests/bpf.test: Use run_strace_match_diff.
2017-01-29 23:12:07 +00:00
3c356c40e4 bpf: move common code to a separate function
* bpf.c (bpf_prog_attach_detach): New function.
(bpf_prog_attach, bpf_prog_detach): Use it.
2017-01-29 23:54:54 +00:00
0a8dd6a68c Update bpf syscall decoding
Implement decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
and BPF_PROG_DETACH commands.

* bpf.c: Include "xlat/bpf_attach_type.h".
(bpf_obj_manage, bpf_prog_attach, bpf_prog_detach): New functions.
(SYS_FUNC(bpf)): Use them.
* configure.ac: Check for union bpf_attr.bpf_fd and union
bpf_attr.attach_type.
* xlat/bpf_attach_type.in: New file.
* xlat/bpf_commands.in: Update list of BPF_* command constants.
* xlat/bpf_map_types.in: Update list of BPF_MAP_TYPE_* constants.
* xlat/bpf_prog_types.in: Update list of BPF_PROG_TYPE_* constants.
* tests/bpf.c [HAVE_UNION_BPF_ATTR_BPF_FD] (obj_manage): New function.
[HAVE_UNION_BPF_ATTR_ATTACH_TYPE] (prog_cgroup): Likewise.
(main): Use them.
2017-01-29 21:54:43 +00:00
fe871501ff tests: check success injection
* tests/fault_injection-retval.c: New file.
* tests/fault_injection-retval.test: New test.
* tests/.gitignore: Add fault_injection-retval.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add fault_injection-retval.test.
2017-01-28 09:55:20 +00:00
41d647ce67 Implement success injection
This extends fault injection syntax with :retval= option.
When :retval=VALUE is specified, the syscall number is replaced by -1
and a bogus success VALUE is returned to the callee.

* defs.h (fault_opts): Remove err field, add rval field.
(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
New macros.
* qualify.c (parse_fault_token): Handle retval= token.
(qualify_fault): Update fault_opts initialization after the move
from struct fault_opts.err to struct fault_opts.rval.
* syscall.c (arch_set_success): New prototype.
(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
(update_syscall_fault_exiting): Implement retval injection.
* strace.1: Update the section on fault injection.
* NEWS: Mention retval= option.
* linux/aarch64/set_error.c (arch_set_success): New function.
* linux/alpha/set_error.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/xtensa/set_error.c: Likewise.

Closes: https://github.com/strace/strace/issues/3
2017-01-28 09:47:00 +00:00
a0795c594a mips: rewrite configure check without sgidefs.h
Use builtin macros provided by gcc >= 3.4 instead of sgidefs.h macros.

* configure.ac <mips>: Do not include <asm/sgidefs.h>, use _ABIO32
instead of _MIPS_SIM_ABI32, _ABIN32 instead of _MIPS_SIM_NABI32,
and _ABI64 instead of _MIPS_SIM_ABI64.
2017-01-26 23:57:17 +00:00
3fac547ab0 .gitignore: add missing files that should be ignored
* .gitignore: Add /ioctl_iocdef.[ih].

Fixes: 5679fad ("ioctlsort: get ioctl definitions from host, not build")
2017-01-20 18:30:11 +00:00
0a9cd4bf2e mips: use <asm/sgidefs.h>
Build fix for MIPS with musl libc.

The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
but not by musl. Regardless of the libc, the kernel headers provide
<asm/sgidefs.h> which provides the same definitions, so use that
instead.

* configure.ac: Replace <sgidefs.h> with <asm/sgidefs.h>.

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-01-20 18:30:11 +00:00
8b7be09c7b Implement decoding of ustat syscall
* configure.ac (AC_CHECK_HEADERS): Add ustat.h.
* ustat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h: Remove sys_ustat.
* tests/ustat.c: New file.
* tests/ustat.test: New test.
* tests/.gitignore: Add ustat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ustat.test.
2017-01-20 18:30:11 +00:00
76be950a1d Makefile.am: allow indented DEF_MPERS_TYPE includes
* Makefile.am (m%_type_defs.h): Change sed regular expression to allow
arbitrary number of whitespace characters between "#" symbol
and "include" directive.
2017-01-20 18:30:11 +00:00
9152bd86b5 strace.1: fix formatting
* strace.1: Remove misplaced .TP macros.
2017-01-20 18:30:11 +00:00
ca2bf7c9e9 tests: drop non-USE_ASM_STAT case support
With the switch of fstatat family tests to USE_ASM_STAT variant,
there are no non-USE_ASM_STAT users left.  Remove support of unused
non-USE_ASM_STAT case.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_mtim.tv_nsec.
* tests/fstatat.c (USE_ASM_STAT): Remove.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.
* tests/xstatx.c: Assume USE_ASM_STAT.
[!USE_ASM_STAT]: Remove.
2017-01-13 20:07:09 +00:00
e72b9262eb tests: call newfstatat and fstatat64 syscalls directly
Do not use glibc wrappers to call newfstatat and fstatat64.
These wrappers have various problems, e.g. they segfault on sparc64
and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
conversion of timestamps on mips64.

* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
directly.
(USE_ASM_STAT): Define.
* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.

Based on patch by James Cowgill <james410@cowgill.org.uk>.
2017-01-13 19:54:57 +00:00
3fb78d7305 tests: remove redundant SAMPLE_SIZE definitions
Remove all definitions of SAMPLE_SIZE that are identical to the fallback
definition in tests/xstatx.c.

* tests/fstat64.c (SAMPLE_SIZE): Remove.
* tests/lstat64.c (SAMPLE_SIZE): Remove.
* tests/stat64.c (SAMPLE_SIZE): Remove.
2017-01-13 19:39:18 +00:00
41e15ecd44 tests: change SAMPLE_SIZE type to libc_off_t
As ftruncate libc function and our create_sample function that calls
ftruncate both take size argument of type libc_off_t, change the type
of SAMPLE_SIZE constant to libc_off_t.

* tests/fstat.c (SAMPLE_SIZE): Cast to libc_off_t.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/oldfstat.c (SAMPLE_SIZE): Likewise.
* tests/oldlstat.c (SAMPLE_SIZE): Likewise.
* tests/oldstat.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/xstatx.c (SAMPLE_SIZE): Likewise.
2017-01-13 19:31:30 +00:00
5679fad7a0 ioctlsort: get ioctl definitions from host, not build
When cross-compiling, ioctlsort must obtain _IOC_* values from the
host, build's values may be incompatible.

* ioctl_iocdef.c: New file.
* Makefile.am (EXTRA_DIST): Add it.
(ioctl_iocdef.i, ioctl_iocdef.h): New rules.
(ioctlsort%.o): Depend on ioctl_iocdef.h.
(CLEANFILES): Add ioctl_iocdef.h and ioctl_iocdef.i.
* ioctlsort.c: Include "ioctl_iocdef.h" instead of <linux/ioctl.h>.

Signed-off-by: Alexey Neyman <stilor@att.net>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-01-13 03:17:37 +00:00
e64a2e8db5 tests: treat struct stat mismatch as an error
If the test detects struct stat mismatch, this is likely an error
in definitions of a stat structure that might affect strace as well.
Fail the test instead of skipping it to attract more attention.

* tests/xstatx.c (main): Return 1 instead of 77
in case of struct stat mismatch.
2017-01-13 01:14:51 +00:00
d57f262ce5 tests: rewrite diagnostics about struct stat mismatch
* tests/xstatx.c (LOG_STAT_OFFSETOF_SIZEOF): New macro.
(main): Use it to print struct stat mismatch details.
2017-01-12 23:03:20 +00:00
ada8aeb715 tests: fix typo in tests/xstatx.c
* tests/xstatx.c [!IS_FSTAT]: Define IS_FSTAT instead of IS_STAT.
2017-01-12 23:03:20 +00:00
e4863d412d tests: fix typo in mlock.c
* tests/mlock.c [!(__NR_mlock && __NR_munlock)]: Fix spelling
of SKIP_MAIN_UNDEFINED.
2017-01-12 22:46:28 +00:00
373220061a strace: move description of -k option to the appropriate place
Follow the example of strace.1 and put the description of -k option
into the  output format group.

* strace.c (usage): Move description of -k option to the output
format group.
2017-01-12 22:46:28 +00:00
791e45ec4f Remove redundant commas at the end of structure initializers
Automatically remove redundant commas using the following
sed expression:

git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'

* linux/32/syscallent.h: Remove redundant commas at the end of structure
initializers.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/microblaze/userent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/kexec_file_load.c: Likewise.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-11 23:48:41 +00:00
7c3e4edd3b tests: check decoding of scsi ioctl commands
* tests/ioctl_scsi.c: New file.
* tests/ioctl_scsi.test: New test.
* tests/.gitignore: Add ioctl_scsi.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_scsi.test.
2017-01-10 00:05:17 +00:00
4912e5b208 scsi: implement decoding of all SG_* ioctl commands
* print_sg_req_info.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/sg_scsi_reset.in: New file.
* scsi.c: Include "xlat/sg_scsi_reset.h".
(scsi_ioctl): Implement decoding of all SG_* ioctl commands.
2017-01-10 00:05:17 +00:00
6919e370f9 scsi: prepare for decoding of other SG_* ioctl commands
* scsi.c (scsi_ioctl): Introduce a switch statement.
2017-01-10 00:05:17 +00:00
6b39e463b6 tests: check decoding of ioctl SG_IO v3 commands
* tests/ioctl_sg_io_v3.c: New file.
* tests/ioctl_sg_io_v3.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v3.test.
2017-01-10 00:05:17 +00:00
3dd797830d tests: check decoding of ioctl SG_IO v4 commands
* tests/ioctl_sg_io_v4.c: New file.
* tests/ioctl_sg_io_v4.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v4.test.
2017-01-10 00:05:17 +00:00
ee7912c0ca scsi: add fallback definitions for SG_* ioctl command constants
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.

* xlat/scsi_sg_commands.in: New file.
* scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing
a fallback definition of SG_IO.
2017-01-10 00:05:17 +00:00
eac07b2bd6 xlat: provide fallback definitions for BSG_FLAG_* constants
BSG_FLAG_* constants were introduced later than the header file where
they are defined.

* xlat/bsg_flags.in: Add default values for constants.
2017-01-10 00:05:17 +00:00
36f594a305 xlat: provide fallback definitions for SG_FLAG_* constants
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.

* xlat/sg_io_flags.in: Add default values for constants.
2017-01-10 00:05:17 +00:00
ced31982a4 sg_io_v4: print din_resid and dout_resid fields as signed integers
* sg_io_v4.c (decode_response): Print din_resid and dout_resid fields
using %d format.
2017-01-10 00:05:17 +00:00
215b7bb38d sg_io: cleanup printing of sg_io buffers
Turn print_sg_io_buffer into a universal sg_io buffer printer.

* sg_io_v3.c (print_sg_io_buffer): Add iovec_count argument.
Call tprint_iov_upto when iovec_count is non-zero.
(decode_request, decode_response): Do not call tprint_iov_upto directly,
use print_sg_io_buffer instead.
* sg_io_v4.c: Likewise.
2017-01-10 00:05:17 +00:00
84ecd63651 sg_io: decode structures on exiting syscall in case of syserror
The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78,
translates its "struct request.errors" to ioctl errors after
filling in all the output members of the SG_IO header structure.

As there is no easy way to tell SCSI layer errors from other syscall
errors, decode the structure on exiting syscall in case of syserror,
too.

* scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use
get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io
unconditionally.
* sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
* sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
2017-01-10 00:05:17 +00:00
f18b0ae42c sg_io: reorder printing of fields to follow structure order
* sg_io_v4.c (decode_request): Print timeout, flags, and usr_ptr fields
after dout_xferp field.
2017-01-08 16:55:48 +00:00
e2de9acdbc sg_io_v3: print sg_io_hdr.duration field as unsigned integer
* sg_io_v3.c (decode_response): Print duration field using %u format.
2017-01-08 19:53:53 +03:00
16d336702f sg_io_v3: print msg_status field
* sg_io_v3.c (decode_response): Print msg_status field.
2017-01-08 19:52:05 +03:00
1538b9dff3 sg_io: print names of array fields and corresponding length fields
* sg_io_v3.c (decode_request): Print names of cmd_len, cmdp,
and dxferp fields.
(decode_response): Print names of dxferp, sb_len_wr, and sbp fields.
* sg_io_v4.c (decode_request): Print names of request_len, request,
dout_xfer_len, and dout_xferp fields.
(decode_response): Print names of response_len, response,
and din_xferp fields.
2017-01-08 16:00:01 +00:00
e257082643 sg_io_v3: print status fields using %#x format specifier
The formerly used format string %02x led to misleading output as there
was no clear indication sometimes whether the printed integer was
decimal or hexadecimal.

* sg_io_v3.c (decode_response): Print status and masked_status fields
using %#x format specifier instead of %02x.
2017-01-08 15:51:59 +00:00
90bcf10061 sg_io_v4: print status fields in a hexadecimal form
The tradition is to print scsi status codes in a hexadecimal form.

* sg_io_v4.c (decode_response): Print driver_status, transport_status,
and device_status fields using %#x format specifier instead of %u.
2017-01-08 15:51:59 +00:00
11defb56a4 sg_io_v4: print request_tag and generated_tag fields in hex
The tradition is to print scsi tags in a hexadecimal form.

* sg_io_v4.c (decode_request): Print request_tag field
using ("%#" PRI__x64) format string.
(decode_response): Print generated_tag field using ("%#" PRI__x64)
format string.
2017-01-08 15:51:58 +00:00
653b9a6f95 sg_io_v4: print usr_ptr field in a hexadecimal form
As the nature of this field is pointer-like, print it
in a hexadecimal form.

* sg_io_v4.c (decode_request): Print usr_ptr field
using ("%#" PRI__x64) format string.
2017-01-08 15:36:42 +00:00
fb39d06748 sg_io_v4: do not print spare_in and spare_out fields
As the kernel does not touch these fields, there is no use
to print them.

* sg_io_v4.c (decode_request): Do not print spare_in field.
(decode_response): Do not print spare_out field.
2017-01-08 15:33:30 +00:00
0503b69486 sg_io: decode struct sg_io_hdr.info and struct sg_io_v4.info
Print struct sg_io_hdr.info and struct sg_io_v4.info using printflags.

* xlat/sg_io_info.in: New file.
* defs.h (sg_io_info): New xlat prototype.
* sg_io_v3.c: Include "xlat/sg_io_info.h".
(decode_response): Print struct_sg_io_hdr.info using printflags.
* sg_io_v4.c: (decode_response): Print struct sg_io_v4.info
using printflags.
2017-01-08 03:30:23 +00:00
0f774151a4 sg_io: decode struct sg_io_hdr.flags and struct sg_io_v4.flags
Print struct sg_io_hdr.flags and struct sg_io_v4.flags using printflags.

* xlat/sg_io_flags.in: New file.
* sg_io_v3.c: Include "xlat/sg_io_flags.h".
(decode_request): Print struct_sg_io_hdr.flags using printflags.
* xlat/bsg_flags.in: New file.
* sg_io_v4.c: Include "xlat/bsg_flags.h".
(decode_request): Print struct sg_io_v4.flags using printflags.
2017-01-08 03:30:02 +00:00
d30a9bf779 Mpersify struct sg_io_hdr
struct sg_io_hdr contains pointers and therefore has to be mpersified.

* defs.h (decode_sg_io_v3): Remove prototype.
* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
Mpersify it.
(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.
2017-01-08 01:05:50 +00:00
768d7cb78f Split scsi.c
Move decoders of SG_IO v3 and v4 APIs into separate files,
compile generic SG_IO decoder unconditionally.

* sg_io_v3.c: New file.
* sg_io_v4.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes.
* ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition.
* scsi.c: (print_sg_io_res): Remove.
(print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req
with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4,
compile uncoditionally.
(scsi_ioctl): Replace print_sg_io_req and print_sg_io_res
with decode_sg_io, compile uncoditionally.
Move [HAVE_SCSI_SG_H] code to sg_io_v3.c.
Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.
2017-01-08 00:01:03 +00:00
cdd27d2088 scsi: detect and print changes of interface id
* scsi.c (print_sg_io_v3_res): Detect and print changes
of struct sg_io_hdr.interface_id field between entering and exiting
syscall.
(print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard
field between entering and exiting syscall.
2017-01-07 19:09:37 +00:00
ff96efe158 scsi: print field names of all fields being printed
* scsi.c (print_sg_io_v3_req): Always print the name
of struct sg_io_hdr.interface_id field.
(print_sg_io_v4_req): Always print the name of struct sg_io_v4.guard
field.
(print_sg_io_req): Print unknown interface id as an integer.
(scsi_ioctl): Save interface id on entering syscall and use it
on exiting syscall.
2017-01-07 22:01:27 +03:00
ce616808a6 scsi: print struct sg_io_hdr.dxfer_direction field name
* scsi.c (print_sg_io_v3_req): Print struct sg_io_hdr.dxfer_direction
field name.
2017-01-07 21:55:40 +03:00
e95caf5505 scsi: print "protocol" and "subprotocol" field names of struct sg_io_v4
* scsi.c (print_sg_io_v4_req): Print field names
of struct sg_io_v4.protocol and struct sg_io_v4.subprotocol.
2017-01-07 21:45:48 +03:00
600457fa9d Print hexadecimal integer in error diagnostics using %#x
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.

* aio.c (startup_child, test_ptrace_seize): Print status
using %#x format specifier instead of %x.
2017-01-07 16:44:44 +00:00
a286680b04 aio: print hexadecimal integer using %#x
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.

* aio.c (print_common_flags): Print struct iocb.aio_flags using %#x
format specifier instead of %x.
* tests/aio.c (main): Likewise.
2017-01-07 16:44:44 +00:00
601a324df2 scsi: rewrite print_sg_io_buffer using printstr_ex(QUOTE_FORCE_HEX)
As printstr_ex has got QUOTE_FORCE_HEX flag support, there is no need
to implement it manually any longer.

* scsi.c (print_uchar): Remove.
(print_sg_io_buffer): Rewrite using printstr_ex(QUOTE_FORCE_HEX).
2017-01-06 16:31:35 +00:00
c119a6da7c getrandom: print string as hex-escaped
Since there is no reason to interpret the value returned by getrandom as
ASCII string, it makes sense to always print it as a hex-escaped string.

* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
to force hex-escaped string formatting.
* tests/getrandom.test: Remove no longer needed -xx flag as the string
is always printed in hexadecimal format now.

Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-01-06 11:43:50 +00:00
34a920baad util: add support for forcing printing string as hex-escaped
This could be useful in cases when some binary data should not be
interpreted as an ASCII string, but rather as an array of byte values.

* defs.h (QUOTE_FORCE_HEX): New macro constant.
* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
in user_style parameter.
2017-01-06 11:39:54 +00:00
a8f0442fd7 term: do not abort decoding in case of non-verbose output
The case of unset verbose is handled by umoven_or_printaddr, moreover,
exiting at this point is plain wrong and leads to last argument not
being printed while it should be.

* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Do not check verbose flags explicitly and do not
exit early if it is not set.
2017-01-06 11:39:33 +00:00
ae663f17fe tests: skip fault injection tests on hppa if the kernel is too old
* tests/fault_injection.sh: Add the minimal kernel version for hppa.
2017-01-05 20:46:48 +00:00
e752ef61c3 tests: skip readahead.test on MIPS n64 when built with glibc < 2.25
Due to a bug in glibc readahead syscall wrapper on MIPS n64,
this wrapper cannot be used in readahead.test.

* tests/readahead.c [HAVE_READAHEAD && LINUX_MIPSN64 && glibc < 2.25]:
Undefine HAVE_READAHEAD.

Reported-by: James Cowgill <james410@cowgill.org.uk>
2017-01-05 18:20:57 +00:00
92ac6131a1 tests: replace init_magic with fill_memory
Use the same fill_memory/fill_memory_ex interface in all affected tests.

* tests/ioctl_block.c (init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_evdev.c: Likewise.
* tests/ioctl_v4l2.c: Likewise.
* tests/ioctl_mtd.c (magic, init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_rtc.c: Likewise.
2017-01-05 01:34:24 +00:00
ff9f61dce9 tests: rewrite ioctl_v4l2 test without reliance on init_magic
* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros.
(main): Use them.  Rewrite expected output without assumptions
on any particular magic data.
2017-01-05 01:34:24 +00:00
84e3de2018 tests: remove redundant casts in fill_memory{,_ex} invocations
* tests/ioctl_loop.c (main): Remove redundant casts of fill_memory
first argument.
* tests/kexec_load.c (main): Likewise.
* tests/perf_event_open.c (main): Likewise.
* tests/quotactl.c (main): Likewise.
* tests/mq_sendrecv.c (main): Remove redundant casts of fill_memory_ex
first argument.
* tests/quotactl-xfs.c (main): Likewise.
2017-01-04 22:17:26 +00:00
801d42d947 tests: change the type of fill_memory{,_ex} first argument to void *
As these functions behave like memset, it's more convenient to have
the first argument of type void * like memset.

* tests/fill_memory.c (fill_memory, fill_memory_ex): Change the type
of first argument from "char *" to "void *".
* tests/tests.h (fill_memory, fill_memory_ex): Likewise.
2017-01-04 22:08:32 +00:00
23287f11fe tests: check non-verbose decoding of LOOP_* ioctls
* tests/ioctl_loop-nv.c: New file.
* tests/ioctl_loop-nv.test: New test.
* tests/ioctl_loop.c [!ABBREV] (ABBREV): Define to 0.
(print_loop_info, print_loop_info64): Handle [ABBREV != 0] case.
* tests/.gitignore: Add ioctl_loop-nv.
* tests/Makefile.am (check_PROGRAMS): Likewise.
2017-01-04 22:00:38 +00:00
2acabfe47a tests: add more checks of LOOP_* ioctls decoding
* tests/ioctl_loop.c: Include <linux/ioctl.h>.
(magic, lmagic): Move static constants ...
(main): ... here.  Change types of magic constants to kernel_ulong_t.
Add more checks.
2017-01-04 21:53:00 +00:00
3127a6a275 tests: check decoding of LOOP_* ioctls
* tests/ioctl_loop.c: New file.
* tests/ioctl_loop-v.c: Likewise.
* tests/ioctl_loop.test: New test.
* tests/ioctl_loop-v.test: Likewise.
* tests/.gitignore: Add ioctl_loop and ioctl_loop-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_loop.test and ioctl_loop-v.test.

Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-04 19:59:27 +00:00
17a2ba8415 Drop vsprintf.c
Drop custom vfprintf implementation that was disabled by default.
Apparently nobody tests strace with this vfprintf enabled, otherwise
multiple uses of format specifiers not supported by this custom vfprintf
would not left unnoticed.

The GNU C library is not the only libc available, so those who want
faster implementations of libc functions are encouraged to try building
strace with other libc implementations.

* vsprintf.c: Remove.
* Makefile.am (strace_SOURCES): Remove vsprintf.c.
* defs.h (USE_CUSTOM_PRINTF, strace_vfprintf): Remove.
* strace.c (tprintf): Replace strace_vfprintf with vfprintf.
2017-01-04 13:22:19 +00:00
297f570c2d loop: remove unnecessary verbose check
The verbose flag is responsible for dereferencing of addresses, and it
is perfectly handled by umove_or_printaddr; moreover, this early exit
leads to incorrect formatting of last argument.

* loop.c (loop_ioctl): Do not check verbose flag explicitly and do not
exit early if it is not set.
2017-01-04 13:22:19 +00:00
0fbbe358ee loop: fix lo_encrypt_key field output
lo_encrypt_key is a sized string with its size specified by
lo_encrypt_key_size field, so take lo_encrypt_key_size into account.

* loop.c (decode_loop_info, decode_loop_info64): Use minimum of
LO_KEY_SIZE and lo_encrypt_key_size field value as lo_encrypt_key size.
2017-01-04 13:22:19 +00:00
426b63f3fa loop: print lo_encrypt_key_size field of struct loop_info as unsigned
It is converted to an unsigned value in kernel (see loop_info64_from_old
in drivers/block/loop.c), so let's print it that way despite its type.

* loop.c (decode_loop_info): Print lo_encrypt_key_size as an uint32_t
value.
2017-01-04 13:22:19 +00:00
1ccc55eed2 tests: add more checks of unknown ioctl command formatting
* tests/ioctl.c (main): Additional check for unknown ioctl command
decoding.
* tests/ioctl_evdev.c (main): Likewise.
* tests/ioctl_dm.c: Include <linux/ioctl.h> for _IOC_SIZE and _IOC_NR.
(main) <dummy_dm_ioctl1, dummy_dm_ioctl2, dummy_dm_arg>: New constants.
Add more checks for unknown command formatting.
2017-01-04 13:22:19 +00:00
b00f54e881 ioctl: do not print explicit 0x prefix and do not specify minimum width
Specifying output width for size argument is rather misleading - it can
be up to 14 bits in size.  The use of explicit "0x" prefix is
discouraged because 0x0 looks ugly.  Usage of width specification along
with alternate form flag leads to inconsistent output for 0.
Let's use just plain %#x qualifiers instead.

* ioctl.c (ioctl_print_code): Change printf qualifiers for ioctl command
type, number and size to "%#x".
* tests/ioctl.c (main): Update expected test output.
* tests/ioctl_dm.c (main): Likewise.
* tests/ioctl_evdev.c (main): Likewise.
2017-01-04 13:22:19 +00:00
7ba63db908 loop: fix printing of the reserved field array items
They are of char type, so "hh" length modifier should be used (otherwise
they are printed incorrectly as they are sign extended implicitly when
passed as printf arguments in case char is a signed type which is true
for most compilers).

* loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx"
in printing routine for array elements of the "reserved" field of
loop_info structure.
2017-01-04 13:22:19 +00:00
589e3285d5 tests: check ioctl(SIOCGIFCONF) decoding
* tests/ioctl_sock_gifconf.c: New file.
* tests/ioctl_sock_gifconf.test: New test.
* tests/.gitignore: Add ioctl_sock_gifconf.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sock_gifconf.test.
2017-01-04 11:48:11 +00:00
5882b169a0 dm.c: add copyright notice 2017-01-04 11:46:20 +00:00
71a69a36f8 Add scno.h and syscallent.i to .gitignore files
* .gitignore: Add /scno.h and /syscallent.i.
* tests/.gitignore: Add scno.h and syscallent.i.
2017-01-04 11:29:32 +00:00
f2d80518f7 tests/.gitignore: add generated files that should be ignored
* tests/.gitignore: Replace addkey with add_key, add attach-f-p-cmd.
2017-01-04 11:28:48 +00:00
b58f75c5d4 Remove checks of __NR_* availability from strace source code
* strace.c: Remove __NR_tkill checks, assume it is always defined.
* util.c: Remove __NR_process_vm_readv checks and fallback definitions,
assume it is always defined.
2017-01-03 13:46:26 +00:00
2dd365f912 Include "scno.h" in files that check __NR_* constants
* strace.c: Include "scno.h".
* util.c: Likewise.
2017-01-03 11:27:35 +00:00
d6ea0d0204 Generate scno.h for use during the build of strace itself
* Makefile.am: Include scno.am.
($(strace_OBJECTS)): New rule.
2017-01-03 11:27:35 +00:00
cae1252903 Generate scno.h without invoking a generated executable helper
Generate scno.h using only those tools that are available for cross
build.  This allows to use scno.h during the build of strace itself.

* scno.am: New file.
* scno.head: New file.
* Makefile.am (EXTRA_DIST): Add it.
* tests/generate_scno.c: Remove.
* tests/.gitignore: Remove generate_scno.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(CLEANFILES): Remove scno.h.
(scno.h, $(scno_dependants)): Remove rules.
(scno_dependants): Remove.
($(objects)): New rule.
Include ../scno.am.
2017-01-01 20:59:11 +00:00
9eeb033ea6 Update all publicly shown copyright year number ranges
* COPYING: Update copyright year number range.
* configure.ac: Likewise.
* strace.c: Likewise.
* tests/strace-V.test: Use the current year for the check.
2017-01-01 11:33:40 +00:00
326b98927a defs.h: stop including <asm/unistd.h>
Limit the number of files where <asm/unistd.h> is included
to only those few that need it.

* defs.h: Do not include <asm/unistd.h>.
* clone.c: Include <asm/unistd.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2016-12-31 22:12:08 +00:00
4580f749b7 tests: do not use BUILT_SOURCES
* tests/Makefile.am (ksysent.$(OBJEXT)): New rule.
(BUILT_SOURCES): Remove.
2016-12-30 11:16:56 +00:00
c4cf9213a8 Fix cross build
This fixes cross build regression introduced by commit
v4.15-39-g605a705a63d533dceb3c2d489468fcd3aed3963c.

* tests/Makefile.am (BUILT_SOURCES): Remove scno.h
(objects, scno_dependants): New variables.
($(scno_dependants)): New rule.

Reported-by: Joakim Bech <joakim.bech@linaro.org>
2016-12-30 10:10:09 +00:00
b0b3f55b3b tests: do not use defs.h and syscall.h
* tests/generate_scno.c: Include "tests.h", "sysent.h", <stdio.h>,
<string.h>, and <asm/unistd.h> instead of "defs.h" and "syscall.h".
* tests/ksysent.c: Likewise.
* tests/nsyscalls.c: Include "tests.h", "sysent.h", <errno.h>,
<stdio.h>, and <unistd.h> instead of "defs.h" and "syscall.h".
2016-12-30 09:55:04 +00:00
ab7c67df8d Move definition of struct sysent and trace flags to a separate file
* sysent.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Include it.
(struct sysent, TRACE_FILE, TRACE_IPC, TRACE_NETWORK, TRACE_PROCESS,
TRACE_SIGNAL, TRACE_DESC, TRACE_MEMORY, SYSCALL_NEVER_FAILS,
STACKTRACE_INVALIDATE_CACHE, STACKTRACE_CAPTURE_ON_ENTER,
TRACE_INDIRECT_SUBCALL, COMPAT_SYSCALL_TYPES): Remove.
2016-12-30 09:45:10 +00:00
f73c5cfd75 Mpersify SIOC* ioctls
struct ifreq and struct ifconf are ABI-dependent and should have been
mpersified.

* defs.h (sock_ioctl): Remove prototype.
* sock.c (struct_ifconf, struct_ifreq): New typedefs.
(DEF_MPERS_TYPE(struct_ifconf), DEF_MPERS_TYPE(struct_ifreq),
MPERS_DEFS): New includes.
(print_ifreq, print_ifc_len, print_ifconf_ifreq): Replace struct ifreq
with struct_ifreq.
(decode_ifconf): Replace struct ifconf with struct_ifconf, struct ifreq
with struct_fireq.
(sock_ioctl): Wrap into MPERS_PRINTER_DECL.
2016-12-29 02:54:49 +00:00
2ca8e63ed0 sock: rewrite decode_ifconf
* sock.c (decode_ifconf): Rewrite.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-29 02:20:19 +00:00
8cc252e1fc xlat: update LOOP_* ioctl flags constants
* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_USE_AOPS
and LO_FLAGS_DIRECT_IO.
* xlat/loop_flags_options.in: Likewise.  Add default values
for constants.
2016-12-29 02:07:34 +00:00
a4ef4a796e loop: add fallback definitions for LOOP_* ioctl command constants
Since these are architecture-independent and have been added over the
kernel's lifetime, it makes sense to have these definitions in strace
itself.

* xlat/loop_cmds.in: New file.
* loop.c: Include "xlat/loop_cmds.h".
(loop_ioctl): Eliminate conditional compilation based on availability
of LOOP_* constant definitions.
2016-12-29 00:36:05 +00:00
6e0b6a6665 xlat: extend syntax
* xlat/gen.sh: Implement #stop directive that stops preprocessor
at the line it has been encountered during the first pass.  This could
be used, for example, to provide fallback definitions for constants
without defining xlat tables.
2016-12-29 00:30:26 +00:00
f0026a3818 loop: mpersify struct loop_info and loop_ioctl function
struct loop_info contains fields of type long, so it definitely should
have been mpersified.

* defs.h (loop_ioctl): Remove prototype.
* loop.c (struct_loop_info): New typedef.
Include DEF_MPERS_TYPE(struct_loop_info) and MPERS_DEFS.
(decode_loop_info): Replace struct loop_info with struct_loop_info.
Cast lo_inode, lo_init[0], and lo_init[1] to kernel_ulong_t and print
them using appropriate format specifiers.
(loop_ioctl): Wrap into MPERS_PRINTER_DECL.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-29 00:11:30 +00:00
52e3c75a1c loop: print lo_device and lo_rdevice fields using print_dev_t
* loop.c (decode_loop_info, decode_loop_info64): Use print_dev_t
for printing lo_device and lo_rdevice fields.
2016-12-29 00:11:30 +00:00
32e813144c Move device number printing code into a separate routine
* print_dev_t.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (print_dev_t): New prototype.
* dm.c: Do not include <sys/sysmacros.h>.
(dm_decode_device, dm_print_dev, dm_decode_dm_name_list): Use
print_dev_t function for printing device numbers.
* mknod.c: Do not include <sys/sysmacros.h>.
(decode_mknod): Use print_dev_t function for printing device number.
* print_struct_stat.c: Do not include <sys/sysmacros.h>.
(print_struct_stat): Use print_dev_t function for printing device
numbers.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-29 00:11:24 +00:00
54f2397c84 tests: enhance invalid address decoding check in seccomp-strict.test
* tests/seccomp-strict.c (main): Change the type of addr variable
containg the invalid address from unsigned long to kernel_ulong_t,
print it using %#llx format.
2016-12-28 22:33:38 +00:00
2add5258ec tests: check decoding of prctl PR_GET_TID_ADDRESS operation
* tests/prctl-tid_address.c: New file.
* tests/prctl-tid_address.test: New test.
* tests/.gitignore: Add prctl-tid_address.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-tid_address.test.
2016-12-28 22:18:36 +00:00
232d8c6c12 Update the publicly shown copyright information
Set the publicly shown copyright holder to "The strace developers.".

* COPYING: Update copyright information.
* configure.ac: Add AC_COPYRIGHT.
* strace.c (print_version): New function.
(init): Use it.
* tests/strace-V.test: Update expected output.
2016-12-28 18:33:46 +00:00
038222965a configure: specify project URL
* configure.ac (AC_INIT): Add URL.
2016-12-28 18:33:38 +00:00
a91068aec4 Document signal injection
* strace.1: Describe :signal=SIG option of the fault injection syntax.
* NEWS: Mention signal injection.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-28 18:33:38 +00:00
a864a32a76 Implement signal injection
This extends the fault injection capability with :signal=SIG option
which injects a signal on entering each syscall from the specified set.

:signal and :error options are complementary, if they are both specified
the syscall will be fault injected as usual and the specified signal
will be delivered to the tracee.

* defs.h (struct fault_opts): Change the type of err field to int16_t,
add signo field.
(trace_syscall): Add a pointer argument.
* qualify.c: Include "nsig.h".
(parse_fault_token): Handle signal= option.
(qualify_fault): Update default fault_opts.
* strace.c (trace): Forward signal number from trace_syscall
to ptrace_restart(PTRACE_SYSCALL).
* syscall.c (inject_syscall_fault_entering): Add pointer argument,
save there the signal number specified by fault options.  Do not inject
a syscall fault unless instructed by fault options.
(update_syscall_fault_exiting): Update the error code injection check.
(trace_syscall_entering): Add pointer argument, forward it to
inject_syscall_fault_entering.
(trace_syscall): Add pointer argument, forward it to
trace_syscall_entering.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-28 18:33:28 +00:00
22894ccff6 Update README.md
* README.md: Update homepage URL, mention command-line interface
and tampering capabilities in the description.
2016-12-28 11:39:00 +00:00
a7aed4a57d tests: robustify prctl-arg2-intptr.test
Robustify prctl-arg2-intptr.test against unrelated prctl invocations.

* tests/prctl-arg2-intptr.test: Filter out unrelated PR_GET_*
and PR_SET_* prctl calls.
2016-12-28 01:24:31 +00:00
277fec6316 signal: remove redundant checks around NSIG
* signal.c (struct old_sigaction, struct new_sigaction,
struct new_sigaction32): Remove safety checks for NSIG >= sizeof(long).
2016-12-27 23:49:06 +00:00
e9c702f9ad Introduce NSIG_BYTES
* nsig.h (NSIG_BYTES): New macro.
* desc.c: Use it in comments instead of NSIG.
* epoll.c: Likewise.
* poll.c: Likewise.
* signalfd.c: Likewise.
* signal.c: Likewise.
(sprintsigmask_n, print_sigset_addr_len_limit): Use it instead of NSIG.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
* tests/pselect6.c (main): Likewise.
2016-12-27 23:32:44 +00:00
5a25466437 Move NSIG ifdefery to a separate header file
* nsig.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c: Include "nsig.h" instead of <signal.h>, remove
NSIG workarounds.
* sigreturn.c: Likewise.
* syscall.c: Likewise.
* tests/pselect6.c: Likewise.
2016-12-27 23:18:21 +00:00
f91679316b Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro
* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
(truncate_klong_to_current_wordsize,
truncate_kulong_to_current_wordsize): Use it.
* mem.c (SYS_FUNC(old_mmap)): Likewise.
* util.c (umoven, umovestr, dumpiov_upto): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
2016-12-27 01:08:58 +00:00
835fb3c5f2 Simplify personality checks in msghdr.c and signal.c
* msghdr.c: Check for [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
* signal.c: Likewise.
2016-12-27 01:08:58 +00:00
19de67d239 Replace widen_to_long with truncate_klong_to_current_wordsize
* defs.h (widen_to_long): Remove.
(truncate_klong_to_current_wordsize): New static inline function.
* aio.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents): Use it
instead of widen_to_long.
* linux/sparc64/get_syscall_args.c (get_syscall_args): Update comment.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
2016-12-26 17:55:59 +00:00
885a97ec42 Replace widen_to_ulong with truncate_kulong_to_current_wordsize
* defs.h (widen_to_ulong): Remove.
(truncate_kulong_to_current_wordsize): New static inline function.
* io.c (do_preadv, do_pwritev): Use it instead of widen_to_ulong.
2016-12-26 17:47:55 +00:00
8990b601c2 Simplify print_lld_from_low_high_val ifdefery
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
[SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long
instead of zero_extend_signed_to_ull.
2016-12-26 17:06:12 +00:00
4e29ada846 Simplify getllval ifdefery
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* util.c (getllval): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
2016-12-26 16:54:31 +00:00
b5db9917f3 prctl: print pointer returned by PR_GET_TID_ADDRESS as kernel long
Since there is no compat handler for x32/n32, kernel returns kernel's
long as a result of the call.

Interesting, does any callee out there actually care to have enough room
allocated for kernel long?

* prctl.c (SYS_FUNC(prctl)): Use printnum_kptr instead of printnum_ptr
to print the value stored at address pointed by addr2 argument
of PR_GET_TID_ADDRESS operation.
2016-12-26 16:43:40 +00:00
c9000d43bd Add functions for printing pointers of kernel_ulong_t size
In cases where no compat for x32/n32 is implemented, pointer is of
kernel's long size, so it should be printed appropriately.

* defs.h [!current_klongsize] (printnum_addr_klong_int): New prototype.
(printnum_kptr): New macro.
* util.c [!current_klongsize] (printnum_addr_klong_int): New function.
2016-12-26 15:32:48 +00:00
3b4612b3ac Print indirect pointers as pointers
Originally, printnum_long_int was used, but it prints NULL incorrectly.

* defs.h (DECL_PRINTNUM_ADDR): New macro.
(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
[!current_wordsize] (printnum_addr_long_int): New prototype.
[!current_wordsize] (printnum_ptr): Use it.
[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
* util.c (DEF_PRINTNUM_ADDR): New macro.
(DEF_PRINTNUM_ADDR(int, unsigned int),
DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
provide printnum_addr_int and printnum_addr_int64, accordingly.
[!current_wordsize] (printnum_addr_long_int): New function.
* xet_robust_list.c (sprintaddr): New function.
(main): Use it, update expected output.
* tests/ipc_sem.c (main): Update expected output.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-26 15:29:06 +00:00
762b155643 ipc_sem: print 4th argument of semctl syscall as an address
* ipc_sem.c (SYS_FUNC(semctl)): Print 4th argument using printaddr.
* tests/ipc_sem.c (cleanup): Update expected output.
2016-12-26 15:05:41 +00:00
3fb2f299d2 Do not define printnum_long_int on systems with constant current_wordsize
* defs.h: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to select
definitions of printnum_slong, printnum_ulong, and printnum_ptr.
* util.c: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to decide
whether to compile printnum_long_int.
2016-12-26 13:50:14 +00:00
825acc827e umoven: detect invalid addresses
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.

* util.c (umoven): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umoven-illptr.c: New file.
* tests/umoven-illptr.test: New test.
* tests/.gitignore: Add umoven-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umoven-illptr.test.
2016-12-26 13:18:00 +00:00
ac300dd2d9 umovestr: detect invalid addresses
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.

* util.c (umovestr): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umovestr-illptr.c: New file.
* tests/umovestr-illptr.test: New test.
* tests/.gitignore: Add umovestr-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr-illptr.test.
2016-12-26 12:16:38 +00:00
5477470e9c lseek: simplify _llseek syscall decoder
After transition from long to kernel_ulong_t the implementation
could be made a bit simpler.

* lseek.c (SYS_FUNC(llseek)): Use direct cast to long long instead
of zero_extend_signed_to_ull.
2016-12-26 11:19:18 +00:00
b6351bc2ce lseek: merge two different implementations of lseek syscall decoder
After transition from long to kernel_ulong_t there are no mo
complications that required to keep a separate implementation
for x32 and mips n32.

* lseek.c (SYS_FUNC(lseek)): Merge two different implementations
into a single one.
2016-12-26 11:10:41 +00:00
a1e94e9c7a Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval
After transition from long to kernel_ulong_t these fields
are no longer needed.

* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
(RVAL_MASK): Update.
* io.c (print_lld_from_low_high_val): Check
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
Use u_arg instead of ext_arg.
* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
Remove.
[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
* linux/x86_64/get_error.c (get_error) [X32]: Remove.
* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
instead of ext_arg.  Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
to print_mmap.
* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
of RVAL_LUDECIMAL.
* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].  Use u_arg instead of ext_arg.
2016-12-26 10:43:35 +00:00
50b50e78f6 Remove getarg_klu
After transition from long to kernel_ulong_t we no longer need
tcp->ext_arg, and therefore a function to access it is also no longer
needed.

* defs.h (getarg_klu): Remove prototype.
* util.c (getarg_klu): Remove.
(printargs): Access tcp->u_arg directly
* bjm.c (SYS_FUNC(init_module)): Likewise.
* clone.c (SYS_FUNC(unshare)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Likewise.
* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mem.c (do_mprotect): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Likewise.
2016-12-26 10:43:35 +00:00
8aab60e8d3 Remove printaddr_klu
After transition from long to kernel_ulong_t we no longer need
two versions of printaddr function.

* defs.h (printaddr): Remove.
(printaddr_klu): Rename to printaddr.
* util.c (printaddr_klu): Likewise.
* bjm.c (SYS_FUNC(init_module)): Replace printaddr_klu with printaddr.
* mem.c (do_mprotect): Likewise.
2016-12-26 10:43:35 +00:00
a2c0cbc0d6 tests: check decoding of a subset of prctl operations
Check decoding of prctl operations that take the second syscall argument
as a pointer to an integer.

* tests/prctl-arg2-intptr.c: New file.
* tests/prctl-arg2-intptr.test: New test.
* tests/.gitignore: Add prctl-arg2-intptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-arg2-intptr.test.
2016-12-26 10:43:34 +00:00
89636759d7 Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.

Automatically replace PRI_kr[dux] with PRI_kl[dux] using
$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'

* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.
2016-12-26 10:43:34 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
e625443bb5 Redirect kernel_ureg_t and kernel_scno_t from unsigned long to kernel_ulong_t
* defs.h (struct tcb): Change u_rval type from long to kernel_long_t.
(PRI_krd, PRI_kru, PRI_krx): Redirect to PRI_kld, PRI_klu, and PRI_klx.
* kernel_types.h (kernel_scno_t, kernel_ureg_t): Redirect
to kernel_ulong_t.
2016-12-26 10:43:34 +00:00
1d5bb61c49 Print kernel_ureg_t and kernel_scno_t using dedicated format strings
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.

* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 10:43:04 +00:00
11aa97bfba vm_read_mem: detect address truncation
When sizeof(kernel_ureg_t) > sizeof(long), the tracee address passed
to vm_read_mem could be silently truncated.  Detect this situation
and return EIO when the tracee address does not fit into unsigned long.

* util.c (vm_read_mem): Save raddr argument into a temporary variable
truncated_raddr of type unsigned long.  Set errno to EIO and return -1
when truncated_raddr does not equal to raddr.
2016-12-26 10:08:53 +00:00
9cd050573c trace_syscall_exiting: prepare personality check for u_rval type change
* syscall.c (trace_syscall_exiting): Check for sizeof(tcp->u_rval)
instead of sizeof(long) when deciding how to print tcp->u_rval.
2016-12-26 10:08:53 +00:00
9050affe7c Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
Direct casts to kernel_ureg_t will not work after the change
of kernel_ureg_t from unsigned long to kernel_ulong_t.

* defs.h (ptr_to_kulong): New macro.
* block.c (print_blkpg_req): Use it instead of explicit casts
to kernel_ureg_t.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
* sigaltstack.c (print_stack_t): Likewise.
* sock.c (decode_ifconf): Likewise.
* sysctl.c (SYS_FUNC(sysctl)): Likewise.
* util.c (dumpiov_upto): Likewise.
* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
print_v4l2_ext_controls): Likewise.
2016-12-26 01:59:08 +00:00
9cbb1861ec umove*: remove redundant casts
* util.c (umoven, umovestr): Remove casts from unsigned long to pointer.
2016-12-26 01:29:35 +00:00
248f17d57f upoke: remove redundant casts
* upoke.c (upoke): Remove casts from unsigned long to pointer.
2016-12-26 01:29:35 +00:00
79cef3f3ff signal: cleanup decoding of sa_handler and sa_restorer
Change type of sa_handler and sa_restorer fields from function pointers
to unsigned long.  This saves the code from a lot of casts between
pointers and integers.

Rename __sa_handler to sa_handler__ as names starting with underscore
symbol are reserved and should not be used.

* signal.c (old_sigaction): Rename __sa_handler to sa_handler__,
all users updated.  Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(old_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_old_sigaction): Remove now redundant casts from
old_sigaction32.sa_handler__ to old_sigaction.sa_handler__,
from old_sigaction32.sa_restorer to old_sigaction.sa_restorer,
and from old_sigaction.sa_handler__ to unsigned long.  Print
old_sigaction.sa_restorer using printaddr.
* signal.c (new_sigaction): Rename __sa_handler to sa_handler__,
all users updated.  Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(new_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_new_sigaction): Remove now redundant casts from
new_sigaction32.sa_handler__ to new_sigaction.sa_handler__,
from new_sigaction32.sa_restorer to new_sigaction.sa_restorer,
and from new_sigaction.sa_handler__ to unsigned long.  Print
new_sigaction.sa_restorer using printaddr.
2016-12-25 23:24:08 +00:00
b2d117f249 signal: change signal handler address type from unsigned long to kernel_ureg_t
* signal.c (get_sa_handler_str, print_sa_handler): Change handler type
from unsigned long to kernel_ureg_t.
2016-12-25 23:21:22 +00:00
b816b59203 quota: change address argument type from unsigned long to kernel_ureg_t
* quota.c (decode_cmd_data): Change the type of data argument
from unsigned long to kernel_ureg_t.
2016-12-25 22:56:21 +00:00
7e5cd0e72b execve: prepare for handling big pointers
* execve.c (printargv): Change cp.p64 type from unsigned long
to kernel_ulong_t so it could handle wordsize > sizeof(long) properly.
2016-12-25 22:27:33 +00:00
276839aec6 clone: print clone flags without truncation
The flags argument is defined in kernel as unsigned long,
so change its decoding to avoid truncation.

* clone.c (SYS_FUNC(clone)): Change flags type from unsigned long
to kernel_ureg_t, print it using printflags64 instead of printflags.
2016-12-25 22:17:38 +00:00
d69c27760c Use printxval64 instead of printxval_long
After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
to stop using printxval_long proxy and pass syscall arguments directly
to printxval64.

* defs.h (printxval_long): Remove.
* fcntl.c (print_fcntl): Replace printxval_long with printxval64.
* mtd.c (mtd_ioctl): Likewise.
* numa.c (SYS_FUNC(mbind)): Likewise.
* or1k_atomic.c [OR1K] (SYS_FUNC(or1k_atomic)): Likewise.
* sysmips.c [MIPS] (SYS_FUNC(sysmips)): Likewise.
* term.c (term_ioctl): Likewise.
2016-12-25 21:59:59 +00:00
9f8b29f1cd Use printflags64 instead of printflags_long
After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
to stop using printflags_long proxy and pass syscall arguments directly
to printflags64.

* defs.h (printflags_long): Remove.
* fcntl.c (print_fcntl): Replace printflags_long with printflags64.
* numa.c (SYS_FUNC(get_mempolicy)): Likewise.
* perf.c (SYS_FUNC(perf_event_open)): Likewise.
* sram_alloc.c [BFIN] (SYS_FUNC(sram_alloc)): Likewise.
2016-12-25 21:55:01 +00:00
0eda4a0a4b upeek, upoke: change argument types from long to unsigned long
* defs.h (upeek, upoke): Change offset argument type from long
to unsigned long.  Change res argument type from long to kernel_ureg_t.
* upeek.c (upeek): Likewise.
* upoke.c (upoke.c): Likewise.
* syscall.c (print_pc) [ARCH_PC_PEEK_ADDR]: Change pc type from long
to kernel_ureg_t.
* linux/aarch64/arch_regs.c (arm_sp_ptr): Remove redundant cast.
* linux/metag/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/sh64/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/powerpc/getregs_old.c (getregs_old): Remove redundant casts.
* linux/alpha/arch_getrval2.c (getrval2): Change r20 type from long
to unsigned long.
* linux/alpha/arch_regs.c (alpha_r0, alpha_a3): Change type from long
to unsigned long.
* linux/bfin/arch_regs.c (bfin_r0): Likewise.
* linux/crisv10/arch_regs.c (cris_r10): Likewise.
* linux/hppa/arch_regs.c (hppa_r28): Likewise.
* linux/ia64/arch_regs.c (IA64_PSR_IS): Likewise.
* linux/microblaze/arch_regs.c (microblaze_r3): Likewise.
* linux/sh/arch_regs.c (sh_r0): Likewise.
* linux/sh64/arch_regs.c (sh64_r9): Likewise.
* linux/xtensa/arch_regs.c (xtensa_a2): Likewise.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Change addr type
from long to unsigned long.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/alpha/get_scno.c (arch_get_scno): Update for the change
of signedness.
* linux/arc/get_syscall_args.c (get_syscall_args): Change arc_args type
from pointer to long to pointer to unsigned long.
* linux/arm/arch_regs.c (arm_sp_ptr): Change type from pointer to long
to pointer to unsigned long.
* linux/arm/arch_regs.h (arm_sp_ptr): Likewise.
* linux/i386/arch_regs.c (i386_esp_ptr): Likewise.
* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
* linux/m68k/arch_regs.c (m68k_usp_ptr): Likewise.
* linux/m68k/arch_regs.h (m68k_usp_ptr): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Use umove
instead of umoven.
* linux/sh/arch_getrval2.c (getrval2): Change val type from long
to unsigned long.
2016-12-25 20:14:12 +00:00
44cb9c8356 arch_sigreturn: change tracee address type from long to unsigned long
* linux/arm/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to unsigned long.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Change the type
of addr and regs variables from long to unsigned long.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to kernel_ureg_t.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Change the type
of offset and addr variables from long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
7372d4a900 kexec: change flags type from unsigned long to kernel_ureg_t
* kexec.c (SYS_FUNC(kexec_load)): Change n variable type
from unsigned long to kernel_ureg_t.  Use printxval64 instead
of printxval_long.  Use printflags64 instead of printflags_long.
2016-12-25 11:32:46 +00:00
bbb1fa0c5f kexec: change types of pointers and sizes to kernel_ureg_t
* kexec.c (print_seg): Change the type of *seg and seg_buf variables
from unsigned long to kernel_ureg_t.
(print_kexec_segments): Change len argument type from unsigned long
to kernel_ureg_t.  Change seg variable type from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
94f801f14d printsiginfo: change len argument type from unsigned long to kernel_ureg_t
* printsiginfo.c (print_siginfo_array): Change len argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
6666c28424 signal: change address argument type from unsigned long to kernel_ureg_t
* signal.c (print_sigqueueinfo): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
53ec9ab555 statfs64: change size argument type from unsigned long to kernel_ureg_t
* defs.h (print_struct_statfs64): Change size argument type
from unsigned long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs64): Likewise.
* fstatfs64.c (SYS_FUNC(fstatfs64)): Pass size argument directly
to print_struct_statfs64.
* statfs64.c (SYS_FUNC(statfs64)): Likewise.
2016-12-25 11:32:46 +00:00
db28c91159 Cast tcp->u_rval to kernel_ureg_t instead of unsigned long
* fcntl.c (print_fcntl): Cast tcp->u_rval to kernel_ureg_t instead
of unsigned long.
* membarrier.c (SYS_FUNC(membarrier)): Likewise.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
* time.c (do_adjtimex): Likewise.
2016-12-25 11:32:46 +00:00
26102a5a87 decode_sockbuf: change addrlen argument type from long to kernel_ureg_t
* net.c (decode_sockbuf): Change addrlen argument type from long
to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
b19829eaf4 netlink: change size types from unsigned long to kernel_ureg_t
* defs.h (decode_netlink): Change len argument type from unsigned long
to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr): Likewise.
(decode_nlmsghdr_with_payload): Likewise.  Change nlmsg_len variable
type from unsigned long to unsigned int.
(decode_netlink): Change the type of len argument and next_len variable
from unsigned long to kernel_ureg_t.  Change nlmsg_len variable type
from unsigned long to unsigned int.
2016-12-25 11:32:46 +00:00
4ee3e80cb1 ipc_msg: change size types from unsigned long to kernel_ureg_t
* ipc_msg.c (tprint_msgsnd): Change count argument type
from unsigned long to kernel_ureg_t.  Change flags argument type
from unsigned long to unsigned int.
(tprint_msgrcv): Change the type of count and msgtyp arguments
from unsigned long to kernel_ureg_t.
(fetch_msgrcv_args): Change *pair type from unsigned long
to kernel_ureg_t.
(SYS_FUNC(msgrcv)): Change pair type from unsigned long
to kernel_ureg_t.
* print_msgbuf.c (tprint_msgbuf): Change count argument type
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:46 +00:00
0601cf5939 dumpiov_upto: change size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_upto): Change data_size argument type
from unsigned long to kernel_ureg_t.
* util.c (dumpiov_upto): Change the type of data_size argument
and iov_len variable from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
27cc81d61f msghdr: change cmsghdr size types from size_t to unsigned int
As the kernel does not accept control messages longer than the value
of int sysctl_optmem_max kernel variable exported as
/proc/sys/net/core/optmem_max, we do not print them either.

Since unsigned int has enough room to contain any valid control message
size, change all internal cmsghdr size types from size_t
to unsigned int.

* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_uint8_t,
print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr,
cmsg_printer, print_cmsg_type_data): Change data_len argument type
from size_t to unsigned int.
(cmsg_socket_printers): Change min_len type from size_t to unsigned int.
(decode_msg_control): Change the type of in_control_len argument,
cmsg_len, and len variables from size_t to kernel_ureg_t.
Change the type of cmsg_size, control_len, and buf_len variables
from size_t to unsigned int.
2016-12-25 11:32:45 +00:00
121e148978 msghdr: change register based size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
* msghdr.h (print_struct_msghdr): Likewise.
* msghdr.c (print_struct_msghdr): Likewise.  Cast msghdr.msg_iovlen
and msghdr.msg_controllen to kernel_ureg_t instead of unsigned long.
(decode_msghdr, dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(sendmsg)): Pass -1 instead of -1UL as data_size argument
to decode_msghdr.
* mmsghdr.c (print_struct_mmsghdr): Pass (kernel_ureg_t) -1 instead
of -1UL as data_size argument to print_struct_msghdr.
(dumpiov_in_mmsghdr): Cast msghdr.msg_iovlen to kernel_ureg_t instead
of unsigned long.
* syscall.c (dumpio): Pass -1 instead of -1UL as data_size argument
to dumpiov_in_msghdr
2016-12-25 11:32:45 +00:00
1049a1dae9 mq: remove redundant u_rval check
* mq.c (SYS_FUNC(mq_timedreceive)): Do not check for tcp->u_rval < 0,
syserror(tcp) is enough, and printstrn can handle len < 0 anyway.
2016-12-25 11:32:45 +00:00
3ccde53d7f io: change size types from unsigned long to kernel_ureg_t
* defs.h (tprint_iov_upto): Change the type of len and data_size
arguments from unsigned long to kernel_ureg_t.
(tprint_iov): Change the type of len argument from unsigned long
to kernel_ureg_t.
* io.c (print_iovec_config): Change data_size type from unsigned long
to kernel_ureg_t.
(print_iovec): Change the type of *iov, iov_buf, and len variables
from unsigned long to kernel_ureg_t.
(tprint_iov_upto): Change the type of len and data_size arguments, and
the type of iov variable from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
570314dd90 mount: change flags type from unsigned long to kernel_ureg_t
* mount.c (SYS_FUNC(mount)): Change the type of flags from unsigned long
to kernel_ureg_t, use printflags64 instead of printflags_long
to print it.
2016-12-25 11:32:45 +00:00
697ca3e41f mem: change mmap arguments type from unsigned long to kernel_ureg_t
* mem.c (print_mmap): Change the type of len, prot, and flags
from unsigned long to kernel_ureg_t.  Use printflags64 instead
of printflags_long.  Use printxval64 instead of printxval_long.
(SYS_FUNC(old_mmap)): Check for current_klongsize instead
of [AARCH64 || X86_64] to take X32 into account.
(SYS_FUNC(mremap)): Use printflags64 instead of printflags_long.
(SYS_FUNC(remap_file_pages)): Change the type of size, prot, pgoff, and
flags from unsigned long to kernel_ureg_t.  Use printflags64 instead
of printflags_long.  Use printxval64 instead of printxval_long.
[POWERPC] (SYS_FUNC(subpage_prot)): Change the type of len and nmemb
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
f8b6389263 numa: change size arguments type from unsigned long to kernel_ureg_t
* numa.c (print_node, print_addr): Add kernel_ureg_t support.
(print_nodemask): Change type of maxnodes argument from unsigned long
to kernel_ureg_t.
(SYS_FUNC(move_pages)): Change npages type from unsigned long
to kernel_ureg_t.  Change buf type from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
a8bf674039 print_sigset_addr_len: change len argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len): Change len argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.
2016-12-25 11:32:45 +00:00
569dc792d5 process_vm: change size arguments type from unsigned long to kernel_ureg_t
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change the type of local_iovcnt,
remote_iovcnt, and flags from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
00785bf73a printstr*: change len argument type from long to kernel_ureg_t
* defs.h (printstr_ex, printstrn): Change len argument type from long
to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
2016-12-25 11:32:45 +00:00
9ec1fb02ef xattr: change size arguments type from unsigned long to kernel_ureg_t
* xattr.c (print_xattr_val): Change type of insize and size arguments
from unsigned long to kernel_ureg_t.
(print_xattr_list): Change type of size argument from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
a3c2e4e20b printstr_ex: fix decoding of non-NUL-terminated strings when len == -1
Do not treat len == -1 in any special way.  All users who need the
string to be handled as a NUL-terminated string set QUOTE_0_TERMINATED
bit in user_style flags already.

* util.c (printstr_ex): Remove (len == -1) check.
* tests/printstr.c: New file.
* tests/printstr.test: New test.
* tests/.gitignore: Add printstr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add printstr.test.
2016-12-25 11:32:45 +00:00
9af28a4d13 Fix decoding of sethostname syscall
The second argument of sethostname syscall is not an unsigned long but
unsigned int.  The kernel does not look at the string argument when
the length argument is too long.

* hostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(SYS_FUNC(sethostname)): Treat the second argument as unsigned int.
Print the first argument as a pointer when the second argument exceeds
__NEW_UTS_LEN.
* tests/sethostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(main): Use it.  Check that the second argument of sethostname
is handled as unsigned int.  Check that the first argument is printed
as a pointer when the second argument exceeds __NEW_UTS_LEN.
2016-12-25 11:32:45 +00:00
bd43e0954b tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h
* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
(f8ill_ptr_to_kulong): New static inline function.
2016-12-25 11:32:45 +00:00
a940d1a60f printstr: rename to printstrn, add printstr as a thin wrapper
As about half of all printstr uses cases are invocations with the last
argument set to -1, create a dedicated function for this use case.

* defs.h (printstr): Rename to printstrn.  All callers updated.
(printstr): New static inline function.  All callers updated.
2016-12-25 11:32:45 +00:00
1cb75579e1 process: change ptrace arguments type from unsigned long to kernel_ureg_t
(SYS_FUNC(ptrace)): Change type of request and data arguments
from unsigned long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
50cba466e5 process: change tracee address type from unsigned long to kernel_ureg_t
* process.c (print_user_offset_addr): Change address argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(ptrace)): Change addr variable type from unsigned long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
405279fa77 net: change address argument type from long to kernel_ureg_t
* net.c (decode_sockbuf, decode_pair_fd, print_linger, print_ucred,
print_tpacket_stats, print_icmp_filter, print_getsockopt, print_mreq,
print_mreq6, print_group_req, print_tpacket_req, print_packet_mreq,
print_setsockopt): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
aff8528b22 print_mq_attr: change address argument type from long to kernel_ureg_t
* print_mq_attr.c (printmqattr): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
91b63a91ae ipc_*: change address argument type from long to kernel_ureg_t
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv, fetch_msgrcv_args): Change
address argument type from long to kernel_ureg_t.
* ipc_msgctl.c (print_msqid_ds): Likewise.
* ipc_sem.c (tprint_sembuf_array): Likewise.
* ipc_shmctl.c (print_shmid_ds): Likewise.
2016-12-25 11:32:45 +00:00
fdcaa2fa42 print_msgbuf: change address argument type from long to kernel_ureg_t
* print_msgbuf.c (tprint_msgbuf): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
d4e4e873ee desc: change tracee address type from long to kernel_ureg_t
* desc.c (decode_select): Rename arg to addr, change its type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
fae76db73b uid: change address argument type from long to kernel_ureg_t
* uid.c (get_print_uid): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
93e2dfe0e5 time: change address argument type from long to kernel_ureg_t
* time.c (print_timezone, do_adjtimex): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
4f486f8207 sched: change address argument type from long to kernel_ureg_t
* sched.c (print_sched_attr): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
1575c3115a printsiginfo: change address argument type from long to kernel_ureg_t
* printsiginfo.c (printsiginfo_at): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
38392acb35 print_timex: change address argument type from long to kernel_ureg_t
* print_timex.c (print_timex): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7f83dba279 print_sigevent: change address argument type from long to kernel_ureg_t
* print_sigevent.c (print_sigevent): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
1c3c1ae44e poll: change address argument type from long to kernel_ureg_t
* poll.c (decode_poll_exiting): Change tracee address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
3f8d42d94f printrusage*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (printrusage32): Change address argument type
from long to kernel_ureg_t.
* printrusage.c (printrusage): Likewise.
[ALPHA] (printrusage32): Likewise.
* wait.c (printwaitn): Change the type of tracee address argument
of print_rusage from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
61b2e2199f print_time*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (sprint_timeval32, print_timeval32,
print_timeval32_pair, print_itimerval32): Change address argument type
from long to kernel_ureg_t.
* desc.c (decode_select): Change the type of tracee address argument
of print_tv_ts and sprint_tv_ts from long to kernel_ureg_t.
* print_timespec.c (print_timespec, sprint_timespec,
print_timespec_utime_pair, print_itimerspec): Change address argument
type from long to kernel_ureg_t.
* print_timeval.c (print_timeval, print_timeval_pair, sprint_timeval,
print_itimerval, print_timeval32, print_timeval32_pair,
print_itimerval32, sprint_timeval32): Likewise.
2016-12-25 11:32:44 +00:00
033c9cfc13 rtc: change type of ioctl 3rd argument from long to kernel_ureg_t
* rtc.c (decode_rtc_time, decode_rtc_wkalrm, decode_rtc_pll_info):
Change addr type from long to kernel_ureg_t.
(rtc_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
16300524f2 mtd: change type of ioctl 3rd argument from long to kernel_ureg_t
* mtd.c (decode_erase_info_user, decode_erase_info_user64,
decode_mtd_oob_buf, decode_mtd_oob_buf64, decode_otp_info,
decode_otp_select, decode_mtd_write_req, decode_mtd_info_user,
decode_nand_oobinfo, decode_nand_ecclayout_user, decode_mtd_ecc_stats):
Change addr type from long to kernel_ureg_t.
(mtd_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
e86ff37e3f hdio: change type of ioctl 3rd argument from long to kernel_ureg_t
* hdio.c (hdio_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
66834ea9a7 v4l2: change type of ioctl 3rd argument from long to kernel_ureg_t
* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc, print_v4l2_format,
print_v4l2_requestbuffers, print_v4l2_buffer, print_v4l2_framebuffer,
print_v4l2_buf_type, print_v4l2_streamparm, print_v4l2_standard,
print_v4l2_input, print_v4l2_control, print_v4l2_queryctrl,
print_v4l2_cropcap, print_v4l2_crop, print_v4l2_ext_controls,
print_v4l2_frmsizeenum, print_v4l2_frmivalenum,
print_v4l2_create_buffers, v4l2_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7f1742631f evdev: change type of ioctl 3rd argument from long to kernel_ureg_t
* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
7ac5286986 btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t
* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
c322fba197 block: change type of ioctl 3rd argument from long to kernel_ureg_t
* block.c (block_ioctl): Change arg type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
10350d5eb0 Change type of ioctl 3rd argument from long to kernel_ureg_t
* defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t.
* dm.c (dm_known_ioctl, dm_ioctl): Likewise.
* file_ioctl.c (file_ioctl): Likewise.
* fs_x_ioctl.c (fs_x_ioctl): Likewise.
* ioctl.c (ioctl_decode): Likewise.
* loop.c (decode_loop_info, decode_loop_info64): Change addr type
from long to kernel_ureg_t.
(loop_ioctl): Change arg type from long to kernel_ureg_t.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res, scsi_ioctl): Likewise.
* sock.c (print_ifreq, sock_ioctl): Likewise.
(decode_ifconf): Change addr type from long to kernel_ureg_t.
* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Likewise.
(term_ioctl): Change arg type from long to kernel_ureg_t.
* ubi.c (ubi_ioctl): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.
2016-12-25 11:32:44 +00:00
98f8b95b0f ldt: change address argument type from long to kernel_ureg_t
* defs.h [HAVE_STRUCT_USER_DESC] (print_user_desc): Change address
argument type from long to kernel_ureg_t.
* ldt.c [HAVE_STRUCT_USER_DESC] (print_user_desc): Likewise.
2016-12-25 11:32:44 +00:00
1007f7a276 fcntl: change address argument type from long to kernel_ureg_t
* fcntl.c (printflock64, printflock, print_f_owner_ex): Change
address argument type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
ef54d3d838 execve: change address argument type from long to kernel_ureg_t
* execve.c (printargv, printargc): Change address argument type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
96512c4d78 dirent: change address argument type from long to kernel_ureg_t
* dirent.c (print_old_dirent): Change address argument type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
c96d9f17b1 bpf: change address argument type from long to kernel_ureg_t
* bpf.c (bpf_map_create, bpf_map_update_elem, bpf_map_delete_elem,
bpf_map_io, bpf_prog_load, SYS_FUNC(bpf)): Change address argument
type from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
cdf05fb392 dump*: change address argument type from long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
Change address argument type from long to kernel_ureg_t.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
Likewise.
* util.c (dumpiov_upto, dumpstr): Likewise.
2016-12-25 11:32:44 +00:00
0aa9cf807e print_sigset_addr_len: change address argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len) Change address argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
decode_old_sigaction, decode_new_sigaction): Likewise.
2016-12-25 11:32:44 +00:00
3106adf4af decode_sockaddr: change address argument type from long to kernel_ureg_t
* defs.h (decode_sockaddr) Change tracee address argument type from long
to kernel_ureg_t.
* sockaddr.c (decode_sockaddr): Likewise.
2016-12-25 11:32:43 +00:00
4e80a2087d print_struct_statfs*: change address argument type from long to kernel_ureg_t
* defs.h (print_struct_statfs, print_struct_statfs64): Change address
argument type from long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs, print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs, fetch_struct_statfs64):
Likewise.
2016-12-25 11:32:43 +00:00
ce27e2acf4 fetch_struct_flock: change address argument type from long to kernel_ureg_t
* fetch_struct_flock.c (fetch_struct_flock, fetch_struct_flock64):
Change address argument type from long to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
0544f49daf fetch_seccomp_fprog: change address argument type from long to kernel_ureg_t
* fetch_seccomp_fprog.c (fetch_seccomp_fprog): Change address argument
type from long to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
bf20786de2 printnum_*, printpair_*: change address argument type from long to kernel_ureg_t
* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR, printnum_long_int): Change
address argument type from long to kernel_ureg_t.
* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
2016-12-25 11:32:43 +00:00
78b02c928a printpath*: change address argument type from long to kernel_ureg_t
* defs.h (printpath, printpathn): Change address argument type
from long to kernel_ureg_t.
* util.c (printpath, printpathn): Likewise.
2016-12-25 11:32:43 +00:00
5e4019c3bc printstr*: change address argument type from long to kernel_ureg_t
* defs.h (printstr_ex, printstr_ex): Change address argument type
from long to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
2016-12-25 11:32:43 +00:00
956e3a34a3 umove*: change tracee address argument type from long to kernel_ureg_t
* defs.h (umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* desc.c (umove_kulong_array_or_printaddr): Change tracee address
argument type from long to kernel_ureg_t.
* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise.
2016-12-25 11:32:43 +00:00
daa81a8612 futex: change address type from long to kernel_ureg_t
* futex.c (SYS_FUNC(futex)): Change address type from long
to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
cce907a428 file_handle: change address type from long to kernel_ureg_t
* file_handle.c (SYS_FUNC(name_to_handle_at),
SYS_FUNC(open_by_handle_at)): Change address type from long
to kernel_ureg_t.
2016-12-25 11:32:43 +00:00
fc543e0637 printsiginfo: cast pointers to kernel_ureg_t instead of unsigned long
* printsiginfo.c (printsigval): Cast siginfo.si_ptr pointer
to kernel_ureg_t instead of unsigned long.
(print_si_info): Cast siginfo.si_addr and siginfo.si_call_addr pointers
to kernel_ureg_t instead of unsigned long.
2016-12-25 11:32:43 +00:00
3b213e9074 sigaltstack: cast pointers and sizes to kernel_ureg_t instead of unsigned long
* sigaltstack.c (print_stack_t): Cast sigaltstack.ss_sp pointer
and sigaltstack.ss_size to kernel_ureg_t instead of unsigned long.
2016-12-25 11:32:43 +00:00
e0c3675c37 v4l2: cast pointers to kernel_ureg_t instead of long
* v4l2.c (print_v4l2_ext_control): Cast v4l2_ext_control.string pointer
to kernel_ureg_t instead of long.
2016-12-25 02:19:17 +00:00
1b7b6b9002 v4l2: cast pointers to kernel_ureg_t instead of unsigned long
* v4l2.c (print_v4l2_buffer): Remove redundant cast.
(print_v4l2_framebuffer): Cast v4l2_framebuffer.base pointer
to kernel_ureg_t instead of unsigned long.
(print_v4l2_ext_controls): Cast v4l2_ext_controls.controls pointer
to kernel_ureg_t instead of unsigned long.
2016-12-25 02:19:17 +00:00
17ec19d2a9 sysctl: cast pointers to kernel_ureg_t instead of size_t
* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldval and
__sysctl_args.newval pointers to kernel_ureg_t instead of size_t.
2016-12-24 14:58:42 +00:00
a8631ca4bc sysctl: cast pointers to kernel_ureg_t instead of long
* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldlenp pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:42 +00:00
4d5523527b block: cast pointers to kernel_ureg_t instead of long
* block.c (print_blkpg_req): Cast blkpg_ioctl_arg.data pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:42 +00:00
23cbf90c18 dumpiov_upto: cast pointers to kernel_ureg_t instead of long
* util.c  (dumpiov_upto): Cast iovec.iov_base pointer to kernel_ureg_t
instead of long.
2016-12-24 14:58:42 +00:00
aa350a2b97 msghdr: cast pointers to kernel_ureg_t instead of long
* msghdr.c (print_struct_msghdr): Cast msghdr.msg_name pointer
to kernel_ureg_t instead of long.
(dumpiov_in_msghdr): Cast msghdr.msg_iov pointer to kernel_ureg_t
instead of long.
2016-12-24 14:58:41 +00:00
4d9a785bfd mmsghdr: cast pointers to kernel_ureg_t instead of long
* mmsghdr.c (dumpiov_in_mmsghdr): Cast msghdr.msg_iov pointer
to kernel_ureg_t instead of long.
2016-12-24 14:58:41 +00:00
857398e779 Remove redundant casts of ptrace arguments
* strace.c (maybe_switch_tcbs, trace): Do not cast ptrace 4th argument
from pointer to long type.
2016-12-24 14:58:41 +00:00
0868093228 ptrace_restart: cleanup
* strace.c (ptrace_restart): Replace the sequence of "if" statements
with a "switch" statement.
2016-12-24 14:58:39 +00:00
5691f4e23a ptrace_restart: change types of integer arguments to unsigned
* strace.c (ptrace_restart): Change types of "op" and "sig"
from int to unsigned int.
2016-12-24 14:58:29 +00:00
5ff0633279 process: remove redundant syserror checks
* process.c (SYS_FUNC(ptrace)): Remove syserror checks as both
print_siginfo_array and print_seccomp_fprog do the right thing
by using umoven_or_printaddr.
2016-12-24 14:58:29 +00:00
2808523085 sparc64: remove redundant casts
* linux/sparc64/get_syscall_args.c (get_syscall_args): Remove
redundant casts from uint32_t to long.
2016-12-24 14:58:29 +00:00
ef0d6e4699 numa: change address argument type from unsigned long to kernel_ureg_t
* numa.c (print_nodemask): Change address argument type from
unsigned long to kernel_ureg_t.
2016-12-23 22:24:23 +00:00
d7f98585ef net: change address argument type from unsigned long to kernel_ureg_t
* net.c (fetch_socklen): Change address argument type from
unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
657ab73f3a mem: change tracee address type from unsigned long to kernel_ureg_t
* mem.c (print_mmap, SYS_FUNC(remap_file_pages),
SYS_FUNC(subpage_prot)): Change the type of variables containing tracee
addresses from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
aa5e08eac5 kexec: change address argument type from unsigned long to kernel_ureg_t
* kexec.c (print_kexec_segments): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
b89258dcdd poll: change counter type from unsigned long to unsigned int
* poll.c (decode_poll_exiting): Change the type of printed and
max_printed counters from unsigned long to unsigned int.
2016-12-23 19:26:58 +00:00
8dbcedef30 xattr: change address argument type from unsigned long to kernel_ureg_t
* xattr.c (print_xattr_val, print_xattr_list): Change address
argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
6f3abb076c uid: change address argument type from unsigned long to kernel_ureg_t
* uid.c (print_groups): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
c9e380bb6c stat64: change address argument type from unsigned long to kernel_ureg_t
* stat64.c (decode_struct_stat64): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
6f6d3e4c60 stat: change address argument type from unsigned long to kernel_ureg_t
* stat.c (decode_struct_stat): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
cc6ef2f922 sigaltstack: change address argument type from unsigned long to kernel_ureg_t
* sigaltstack.c (print_stack_t): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
831feaf212 resource: change address argument type from unsigned long to kernel_ureg_t
* resource.c (print_rlimit64, print_rlimit32, decode_rlimit): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
a011ab10af printsiginfo: change address argument type from unsigned long to kernel_ureg_t
* printsiginfo.c (print_siginfo_array): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
30d13975a4 poll: change tracee address type from unsigned long to kernel_ureg_t
* poll.c (decode_poll_entering, decode_poll_exiting): Change the type
all tracee address variables from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
c15071b535 perf: change address argument type from unsigned long to kernel_ureg_t
* perf.c (fetch_perf_event_attr, print_perf_event_attr): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
5d0e737d00 pathtrace: change tracee address type from unsigned long to kernel_ureg_t
* pathtrace.c (upathmatch): Change address argument type
from unsigned long to kernel_ureg_t.
(pathtrace_match): Change the type of all tracee address variables
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
4c7a353896 scsi: change address argument type from unsigned long to kernel_ureg_t
* scsi.c (print_sg_io_buffer): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
f070096094 dm: change address argument type from unsigned long to kernel_ureg_t
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
173164923e oldstat: change address argument type from unsigned long to kernel_ureg_t
* oldstat.c (print_old_kernel_stat): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
edfeca944a capability: change address argument type from unsigned long to kernel_ureg_t
* capability.c (get_cap_header, print_cap_header, print_cap_data):
Change address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:58 +00:00
5615c15036 btrfs: change address argument type from unsigned long to kernel_ureg_t
* btrfs.c (btrfs_print_qgroup_inherit): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
d4bb4510ba affinity: change address argument type from unsigned long to kernel_ureg_t
* affinity.c (print_affinitylist): Change address argument type from
unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
2b60571d86 aio: change address type from unsigned long to kernel_ureg_t
* aio.c (print_iocb): Remove casts to unsigned long.
(print_iocbp,  SYS_FUNC(io_submit)): Change address type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
8bb5c14488 mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* mmsghdr.c (save_mmsgvec_namelen, decode_mmsgvec): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
dc788de4e0 msghdr: change address argument type from unsigned long to kernel_ureg_t
* msghdr.c (decode_msg_control): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
50d25d1a60 fetch_struct_stat64: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_stat64.c (fetch_struct_stat64): Change address argument
type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
826dd22e46 fetch_struct_stat: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_stat.c (fetch_struct_stat): Change address argument
type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
5607a0e2b0 fetch_struct_msghdr: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_msghdr.c (fetch_struct_msghdr): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
f806439e29 fetch_struct_mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_mmsghdr.c (fetch_struct_mmsghdr): Change
address argument type from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
b6b3dc4361 decode_netlink: change address argument type from unsigned long to kernel_ureg_t
* defs.h (decode_netlink) Change address argument type
from unsigned long to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr, decode_nlmsghdr_with_payload,
decode_netlink): Likewise.
2016-12-23 19:26:57 +00:00
fde482b82e print_seccomp_*: change address argument type from unsigned long to kernel_ureg_t
* defs.h (print_seccomp_filter, print_seccomp_fprog): Change
address argument type from unsigned long to kernel_ureg_t.
* seccomp.c (print_seccomp_filter, print_seccomp_fprog,
decode_seccomp_set_mode_strict): Likewise.
2016-12-23 19:26:57 +00:00
5c252f970d tprint_iov*: change address argument type from unsigned long to kernel_ureg_t
* defs.h (tprint_iov, tprint_iov_upto): Change address argument type
from unsigned long to kernel_ureg_t.
* io.c (tprint_iov, tprint_iov_upto): Likewise.
2016-12-23 19:26:57 +00:00
399fceeb06 print_array: change tracee address type from unsigned long to kernel_ureg_t
* defs.h (print_array): Change start_addr type from unsigned long
to kernel_ureg_t.
* util.c (print_array): Likewise.  Change the type of all tracee
address variables from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
c239ebc31b Rename LONG_LONG to ULONG_LONG and change it to return unsigned long long
In all places where LONG_LONG is used the destination already has type
unsigned long long, so it is quite natural to change LONG_LONG as well.

* defs.h (LONG_LONG): Rename to ULONG_LONG, change return type
from long long to unsigned long long.  All callers updated.
2016-12-23 19:26:57 +00:00
6c9c122799 mem: remove redundant casts
* mem.c (SYS_FUNC(old_mmap)): Remove redundant cast
from kernel_ureg_t to unsigned long.
[S390] (SYS_FUNC(old_mmap_pgoff)): Remove redundant cast
from unsigned int to unsigned long.
2016-12-23 12:48:46 +00:00
274348cbac desc: remove redundant casts
* desc.c (umove_kulong_array_or_printaddr): Remove redundant cast
from uint32_t to kernel_ulong_t.
(SYS_FUNC(pselect6)): Remove redundant casts from kernel_ulong_t
to unsigned long.
2016-12-23 00:01:58 +00:00
89d8c578e7 print_sigevent: remove redundant cast
* print_sigevent.c (print_sigevent): Remove redundant cast from
struct_sigevent.sigev_value.sival_ptr to unsigned long as the former
is not a pointer but an unsigned integer.
2016-12-22 23:11:02 +00:00
d9d92cf220 tests: fix xattr.test for the case when listxattr returns a long list
* tests/xattr.c (DEFAULT_STRLEN): New macro.
(main): Use it to limit the length passed to print_quoted_memory.
Print ellipsis when the list returned by listxattr is too long.
2016-12-22 23:11:02 +00:00
2aa03c2af6 tests: test for correct ellipsis with -s in xattr
* tests/xattr-strings.c: New file.
* tests/xattr-strings.test: New test.
* tests/.gitignore: Add xattr-string.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add xattr-string.test.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
2016-12-22 23:11:02 +00:00
dd3548a691 xattr: use printstr_ex instead of print_quoted_string
This fixes the display when using `-s` to limit the string size
of the values displayed by {get,set}xattr.

* xattr.c (print_xattr_val): Remove static buffer.  Use printstr_ex
instead of print_quoted_string.

Reported-by: Марк Коренберг <socketpair@gmail.com>
Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
2016-12-22 23:11:02 +00:00
00265afe4a tests: use scno.h in finit_module, kcmp, renameat2 tests
* tests/finit_module.c: Include "scno.h".
* tests/kcmp.c: Likewise.
* tests/renameat2.c: Likewise.
2016-12-22 23:11:02 +00:00
fd4d4edd2b sock: cast pointers to kernel_ureg_t instead of unsigned long
* sock.c (decode_ifconf): Cast ifconf.ifc_buf pointer to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:29 +00:00
464566440a scsi: cast pointers to kernel_ureg_t instead of unsigned long
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Cast sg_io_hdr.cmdp,
sg_io_hdr.dxferp, and sg_io_hdr.sbp pointers to kernel_ureg_t instead
of unsigned long.
2016-12-21 23:35:29 +00:00
4b6d304c80 mtd: cast pointers to kernel_ureg_t instead of unsigned long
* mtd.c (decode_mtd_oob_buf): Cast mtd_oob_buf.ptr pointer
to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:29 +00:00
ac68c7db14 msghdr: cast pointers to kernel_ureg_t instead of unsigned long
* msghdr.c (print_struct_msghdr): Cast msghdr.msg_iov and
msghdr.msg_control pointers to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:29 +00:00
a06073fbbb evdev: cast tcp->u_rval to kernel_ureg_t instead of unsigned long
* evdev.c (decode_bitset): Cast tcp->u_rval to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:28 +00:00
fa66f3f700 evdev: cast pointers to kernel_ureg_t instead of unsigned long
* evdev.c (ff_effect_ioctl): Cast ff_periodic_effect.custom_data
pointer to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:28 +00:00
8afd294eb3 btrfs: cast pointers to kernel_ureg_t instead of unsigned long
* btrfs.c (btrfs_ioctl): Cast btrfs_ioctl_send_args.clone_sources
and btrfs_ioctl_vol_args_v2.qgroup_inherit pointers to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:28 +00:00
c6d15a9b0d Rework ifdefery around print_user_desc
* configure.ac (AC_CHECK_TYPES): Check for struct user_desc
in <asm/ldt.h>.
* clone.c (print_tls_arg): New function.
(SYS_FUNC(clone)): Use it.
(print_user_desc): Move prototype ...
* defs.h [HAVE_STRUCT_USER_DESC]: ... here.
* ldt.c: Check for HAVE_STRUCT_USER_DESC instead of architectures.
* linux/dummy.h: Likewise.
2016-12-21 23:35:27 +00:00
b0499e6d42 Introduce DECL_IOCTL macro to declare *_ioctl functions
* defs.h (DECL_IOCTL): New macro.
(dm_ioctl, file_ioctl, fs_x_ioctl, loop_ioctl, ptp_ioctl, scsi_ioctl,
sock_ioctl, term_ioctl, ubi_ioctl, uffdio_ioctl): Rewrite prototypes
using DECL_IOCTL.
2016-12-21 22:25:31 +00:00
2b5a0ea7db Introduce DECL_PRINT* macros to declare printnum_* and printpair_*
* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR): New macros.
(printnum_short, printnum_int, printnum_int64): Rewrite prototypes
using DECL_PRINTNUM.
(printpair_int, printpair_int64): Rewrite prototypes
using DECL_PRINTPAIR.
2016-12-21 22:25:30 +00:00
c30f689384 ioctl: use uintptr_t for casts between 32-bit integers and pointers
* ioctl.c (compare): Cast pointer to uintptr_t before assigning
it to an integer.
(ioctl_lookup): Cast integer to uintptr_t before passing it
as a pointer.
2016-12-21 22:25:30 +00:00
e68e2a84b0 scsi: use umove_or_printaddr
* scsi.c (scsi_ioctl): Use umove_or_printaddr.
2016-12-21 22:25:30 +00:00
73be1d7e2e Remove dumpiov wrapper
* defs.h (dumpiov): Remove.
* syscall.c (dumpio): Use dumpiov_upto instead of dumpiov.
2016-12-21 22:25:30 +00:00
4d7b7b18bd travis: fix enabling of gcc -Werror builds
* travis-build.sh: Use DISTCHECK_CONFIGURE_FLAGS instead
of CHECK_CONFIGURE_FLAGS and ENABLE_GCC_WERROR.
[$CC == gcc]: Add --enable-gcc-Werror to DISTCHECK_CONFIGURE_FLAGS
instead of ENABLE_GCC_WERROR.
[$CHECK == coverage]: Add --enable-code-coverage
to DISTCHECK_CONFIGURE_FLAGS instead of CHECK_CONFIGURE_FLAGS.
2016-12-21 22:25:30 +00:00
d51642053d printaddr: change argument type to kernel_ureg_t
* defs.h (printaddr): Change argument type from unsigned long
to kernel_ureg_t.
2016-12-21 03:03:08 +00:00
1eef9d28c7 tests: check decoding of unreadable ip_mreq and ipv6_mreq structures
* tests/ip_mreq.c (main): Check short read.
2016-12-21 03:03:08 +00:00
859c3074a6 tests: rewrite ip_mreq.c using arrays and iterators
* tests/ip_mreq.c (main): Create arrays of setsockopt arguments to test.
Iterate over these arrays invoking setsockopt and printing expected
output.
2016-12-21 03:03:08 +00:00
bb33a401ee tests: rewrite ip_mreq.c using tail_alloc
* tests/ip_mreq.c (main): Allocate objects of struct ip_mreq
and struct ipv6_mreq using tail_alloc instead of using stack.
2016-12-21 03:03:08 +00:00
f249e065a8 tests: rewrite ip_mreq.c without asserts
* tests/ip_mreq.c: Do not include <assert.h>.
(main): Do not use assert.  Use sprintrc instead of errno2name.
2016-12-21 03:03:04 +00:00
bf3a69ac75 Remove NEED_PTRACE_PROTOTYPE_WORKAROUND
Remove the workaround for broken ptrace prototypes
that seems to be unneeded for quite a long time.

* defs.h [NEED_PTRACE_PROTOTYPE_WORKAROUND]: Remove.
2016-12-20 14:58:57 +00:00
000fdc4b89 tests: use scno.h in tests of relatively new syscalls
* tests/add_key.c: Include "scno.h" after <asm/unistd.h>.
* tests/copy_file_range.c: Likewise.
* tests/execveat.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/membarrier.c: Likewise.
* tests/memfd_create.c: Likewise.
* tests/mlock2.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/userfaultfd.c: Likewise.
2016-12-20 05:10:21 +00:00
605a705a63 tests: generate scno.h from syscallent.h for use by other tests
Provide scno.h with fallback definitions of all __NR_* constants known
to strace for the personbality being tested.

Some tests need just __NR_* constants without any kernel support.
Such tests can include "scno.h" after <asm/unistd.h> to get definitions
of these constants when system headers are too old.

* tests/generate_scno.c: New file.
* tests/.gitignore: Add generate_scno.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(scno.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add scno.h.
2016-12-20 05:10:21 +00:00
c298e50d2a tests: fix potential errno clobbering in membarrier test
* tests/membarrier.c (main): Save errno.
2016-12-20 05:10:21 +00:00
552888b1ac Do not use widen_to_ulong in kexec.c and process_vm.c
Automatic argument truncation makes use of this function redundant.

* kexec.c (SYS_FUNC(kexec_load)): Do not invoke widen_to_ulong.
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Likewise.
2016-12-20 05:10:21 +00:00
6a360e2f3e x32: implement automatic argument truncation for compat syscalls
x32 syscalls starting with number 512 are compat syscalls that operate
on compat types.  Set COMPAT_SYSCALL_TYPES flag to these syscall entries
and make get_syscall_args truncate arguments of syscalls that have this
flag set, to avoid unpleasant alternative of adding multiple
widen_to_ulong invocations to individual syscall parsers.

preadv, pwritev, preadv2, and pwritev2 are exceptions: while these
syscalls operate on compat types, the offset argument has a regular
64-bit type, so the automatic argument truncation cannot be applied.

* defs.h (COMPAT_SYSCALL_TYPES): New macro.
* syscall.c (CST): New macro, defined to COMPAT_SYSCALL_TYPES.
* linux/ia64/syscallent.h: Do not include "../i386/syscallent.h"
unless [CST > 0].
* linux/x32/syscallent.h [512..533, 536..545]: Add CST flag.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Truncate arguments
of compat syscalls to 32-bit values.
* tests/ksysent.c (CST): New macro, defined to 0.
* tests/nsyscalls.c (CST): Likewise.
2016-12-20 05:10:21 +00:00
874caabc0f x32: fix decoding of mprotect and pkey_mprotect syscall arguments
As there are no compat versions of mprotect or pkey_mprotect syscalls
in x32 personality, "addr", "len", and "prot" syscall arguments have
kernel_ulong_t type and should be printed accordingly.

* mem.c (do_mprotect): Retrieve 1st, 2nd and 3rd arguments using
getarg_klu, print them using printaddr_klu, PRI_klu format,
and printflags64, correspondingly.
2016-12-20 05:09:13 +00:00
6caa97f543 Make tprint_iov function a static inline wrapper
* io.c (tprint_iov): Move ...
* defs.h: ... here, add static inline keywords.
2016-12-20 03:39:09 +00:00
0c6f755525 x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls
In x32 personality these syscalls use compat type for the 3rd argument,
therefore it has to be truncated there.

* io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using
widen_to_ulong.
2016-12-20 03:35:03 +00:00
5451e9ffa6 tests: fix preadv2-pwritev2 test on x32
On x32 p(read|write)v(|2) syscalls are implemented via compat, which
truncates len argument to unsigned int.

* tests/preadv2-pwritev2.c (main): Print vlen argument as unsigned long.
2016-12-20 00:32:40 +03:00
8e4c657a9d kexec: fix for the x32 ABI
There is no compat (and no 32-bit version, ever) for x32 ABI, so
kernel's long type should be used for arguments' values.

The only remaining thing is a pointer to cmdline string, but it is
currently broken on x32 anyway.

* kexec.c (SYS_FUNC(kexec_file_load)): Print the cmdline_len argument
as kernel long, retrieve it via getarg_klu; use printflags64 for
printing the flags argument, retrieve it via getarg_klu.
2016-12-20 00:13:27 +03:00
b3d82da686 Check for current_klongsize instead of current_personality where appropriate
current_klongsize checks are more universal, therefore they are usually
shorter and easier to comprehend.

* desc.c (umove_kulong_array_or_printaddr): Check for current_klongsize
instead of current_personality and current_wordsize.
* io.c (print_lld_from_low_high_val): Likewise.
* lseek.c (SYS_FUNC(lseek)): Likewise.
* resource.c (decode_rlimit): Likewise.
* syscall.c (is_negated_errno): Likewise.
* util.c (getllval, getarg_klu): Likewise.
2016-12-19 19:58:16 +00:00
a2485b86e7 Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t.  All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t.  All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:58:16 +00:00
e42dac4361 fcntl.c: print 64-bit fields of struct_kernel_flock64 using PRId64 format
* fcntl.c (print_struct_flock64): Print l_start and l_len fields
of struct_kernel_flock64 using PRId64 format.
2016-12-19 19:58:16 +00:00
42cbea6627 v4l2.c: print v4l2_ext_control.value64 using PRId64 format
* v4l2.c (print_v4l2_ext_control): Print value64 field
of struct_v4l2_ext_control using PRId64 format.
2016-12-19 19:58:16 +00:00
df5c46896b perf.c: print perf_event_attr.__reserved_1 using PRIx64 format
* perf.c (print_perf_event_attr): Print __reserved_1 field
of perf_event_attr using PRIx64 format.
2016-12-19 19:58:16 +00:00
cabcca717a btrfs.c: print 64-bit fields of btrfs_ioctl_vol_args_v2 using PRIu64 format
* block.c (btrfs_ioctl): Print size and transid fields
of struct_btrfs_ioctl_vol_args_v2 using PRIu64 format.
2016-12-19 19:58:16 +00:00
201fd3c185 block.c: change type of long long fileds to int64_t
* block.c (struct_blkpg_partition): Change type of start and length
fields from long long to int64_t.
(print_blkpg_req): Print them using PRId64 format.
2016-12-19 19:58:16 +00:00
1fe5d9bed5 Introduce current_klongsize in addition to current_wordsize
Subsequent commits are going to use current_klongsize
as the tracee's size of kernel_ulong_t type.

* defs.h (PERSONALITY0_KLONGSIZE): New macro.
[X86_64] (PERSONALITY2_KLONGSIZE): Likewise.
[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_KLONGSIZE): Likewise.
[SUPPORTED_PERSONALITIES == 1] (current_klongsize): Likewise.
[SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE ==
PERSONALITY1_KLONGSIZE] (current_klongsize): Likewise.
[SUPPORTED_PERSONALITIES != 1 && (SUPPORTED_PERSONALITIES != 2 ||
PERSONALITY0_KLONGSIZE != PERSONALITY1_KLONGSIZE)] (current_klongsize):
New variable prototype.
* syscall.c [!current_klongsize] (current_klongsize): New variable.
[!current_klongsize] (personality_klongsize): New array.
(set_personality) [!current_klongsize]: Update current_klongsize
with the appropriate value from personality_klongsize.
2016-12-19 14:39:48 +00:00
6452c4deeb configure: define SIZEOF_KERNEL_LONG_T macro
Provide SIZEOF_KERNEL_LONG_T macro in addition to SIZEOF_LONG and
SIZEOF_LONG_LONG for checking of kernel_long_t and kernel_ulong_t
types at the time of preprocessing.

* configure.ac (AC_CHECK_SIZEOF): Add kernel_long_t.
2016-12-19 14:37:59 +00:00
dfff7d5571 Remove getarg_ll
This function has never been used in the code, and in perspective
the whole ext_arg thing will go away.

* defs.h (getarg_ll): Remove prototype.
* util.c (getarg_ll): Remove.
2016-12-19 14:21:40 +00:00
fc346f1d91 struct tcb: make types of syscall arguments unsigned
This is the first step in the direction of revisiting current practice
of indiscriminate use of signed types for syscall arguments and memory
addresses.

* kernel_types.h (kernel_ureg_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of u_arg from long to kernel_ureg_t.
[HAVE_STRUCT_TCB_EXT_ARG]: Change type of ext_arg from long long
to unsigned long long.
* desc.c (decode_select): Change type of syscall arguments from long
to kernel_ureg_t.
(SYS_FUNC(oldselect)): Change type of select_args from long
to kernel_ureg_t.
* io.c (print_lld_from_low_high_val): Remove no longer needed cast
of syscall arguments to unsigned long.
* lseek.c (SYS_FUNC(lseek)): Cast syscall argument from unsigned long
to long.
* mem.c (print_mmap): Change type of syscall arguments from long
to kernel_ureg_t.
(SYS_FUNC(old_mmap), SYS_FUNC(old_mmap_pgoff)): Change type of u_arg
from long to kernel_ureg_t.
(SYS_FUNC(mmap), SYS_FUNC(mmap_pgoff), SYS_FUNC(mmap_pgoff)): Remove
no longer needed cast of syscall arguments to unsigned long.
* pathtrace.c (pathtrace_match): Change type of args and select_args
from long to kernel_ureg_t.
* util.c (getarg_ull): Remove no longer needed casts of syscall
arguments to unsigned types.
2016-12-19 12:38:29 +00:00
29107a40e9 s390: fix decoding of mmap2 syscall when arguments are not available
* mem.c [S390] (SYS_FUNC(old_mmap_pgoff)): Use umove_or_printaddr
instead of umoven to fetch mmap arguments, fix return value when this
fetch fails.
2016-12-19 12:34:51 +00:00
ed256d30ee Fix pathmatch of oldselect syscall on 64-bit architectures
* pathtrace.c (pathtrace_match): Fix fetching of 32-bit oldselect
arguments on 64-bit architectures.
2016-12-19 11:49:58 +00:00
4cb2d29f2f Cleanup oldselect
* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.
2016-12-19 11:40:43 +00:00
0547dc1ad5 Change scno type from long to unsigned long
Use an unsigned type for syscall numbers as they are not intended
for signed arithmetics.  Introduce kernel_scno_t as a typedef
to unsigned long, that could be changed later to kernel_ulong_t.

* kernel_types.h (kernel_scno_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of scno field from long
to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
(scno_in_range, scno_is_valid): Change argument type from unsigned long
to kernel_scno_t.
* linux/aarch64/set_scno.c (arch_set_scno): Change scno argument type
from long to kernel_scno_t.
* linux/alpha/set_scno.c (arch_set_scno): Likewise.
* linux/arc/set_scno.c (arch_set_scno): Likewise.
* linux/arm/set_scno.c (arch_set_scno): Likewise.
* linux/avr32/set_scno.c (arch_set_scno): Likewise.
* linux/bfin/set_scno.c (arch_set_scno): Likewise.
* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
* linux/hppa/set_scno.c (arch_set_scno): Likewise.
* linux/i386/set_scno.c (arch_set_scno): Likewise.
* linux/ia64/set_scno.c (arch_set_scno): Likewise.
* linux/m68k/set_scno.c (arch_set_scno): Likewise.
* linux/metag/set_scno.c (arch_set_scno): Likewise.
* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
* linux/mips/set_scno.c (arch_set_scno): Likewise.
* linux/nios2/set_scno.c (arch_set_scno): Likewise.
* linux/or1k/set_scno.c (arch_set_scno): Likewise.
* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
* linux/riscv/set_scno.c (arch_set_scno): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/sh/set_scno.c (arch_set_scno): Likewise.
* linux/sh64/set_scno.c (arch_set_scno): Likewise.
* linux/sparc/set_scno.c (arch_set_scno): Likewise.
* linux/tile/set_scno.c (arch_set_scno): Likewise.
* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
* linux/aarch64/get_scno.c (arch_get_scno): Change scno variable type
from long to kernel_scno_t.
* linux/alpha/get_scno.c (arch_get_scno): Likewise.
* linux/arm/get_scno.c (arch_get_scno): Likewise.
* linux/sh/get_scno.c (arch_get_scno): Likewise.
* linux/x86_64/get_scno.c (arch_get_scno): Likewise.
* syscall.c (arch_set_scno): Likewise.
(shuffle_scno): Change return type from long to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
2016-12-18 22:57:57 +00:00
ae39bba347 Lowercase SCNO_IN_RANGE and SCNO_IS_VALID
* defs.h (SCNO_IN_RANGE): Rename to scno_in_range.  All callers updated.
(SCNO_IS_VALID): Rename to scno_is_valid.  All callers updated.
2016-12-18 22:57:57 +00:00
832fd63fc4 Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions
* defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline
functions.
2016-12-18 22:57:57 +00:00
f73dcf3c21 count.c: use syserror instead of direct u_error access
* count.c (count_syscall): Use syserror instead of u_error.
2016-12-18 22:57:57 +00:00
f0ba3723f5 Replace "(unsigned long) -1L" with -1UL
* defs.h (dumpiov): Replace "(unsigned long) -1L" with -1UL.
* io.c (print_iovec, tprint_iov): Likewise.
* msghdr.c (SYS_FUNC(sendmsg)): Likewise.
* syscall.c (dumpio): Likewise.
* poll.c (decode_poll_exiting): Replace "(unsigned int) -1" with -1U.
2016-12-18 14:09:51 +00:00
ee75f4e926 Add toplevel recursive check-valgrind rule
* Makefile.am (.PHONY): Add check-valgrind-local.
(check-valgrind): New rule.
* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Add it.
2016-12-18 14:09:51 +00:00
0fcb3efcf3 m4: fix check-valgrind-* rules generated by AX_VALGRIND_CHECK
* m4/ax_valgrind_check.m4 (check-valgrind-$(1)): Depend
on $(BUILT_SOURCES), honor $(AM_MAKEFLAGS), build check-am
instead of check-TESTS.
2016-12-18 14:09:51 +00:00
c121227125 travis: do coverage using a dedicated build
* .travis.yml (after_success): Remove.
(matrix): Create an entry for the regular x86_64 target.
* travis-success.sh: Merge into ...
* travis-build.sh: ... this file.  Disable optimization
for coverage builds.
* travis-install.sh: Rename COVERAGE=true to CHECK=coverage.
2016-12-18 14:09:51 +00:00
faf03528c2 mips n32: provide fallback definitions of kernel_long_t/kernel_ulong_t
* kernel_types.h [!(HAVE___KERNEL_LONG_T && HAVE___KERNEL_ULONG_T) &&
LINUX_MIPSN32] (kernel_long_t, kernel_ulong_t): Define to long long types.
2016-12-17 12:06:24 +00:00
f958b3ce5b util: simplify definitions of bit mask constants in umovestr
* util.c (umovestr): Do not check for SIZEOF_LONG in definitions
of bit mask constants.
2016-12-17 12:06:24 +00:00
6f4ecb2add tests: check decoding of prctl operations without arguments
* tests/prctl-no-args.c: New file.
* tests/prctl-no-args.test: New test.
* tests/.gitignore: Add prctl-no-args.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-no-args.test.
2016-12-17 12:06:21 +00:00
2dd34a4da7 tests: check decoding of prctl PR_[GS]ET_SECUREBITS operations
* tests/prctl-securebits.c: New file.
* tests/prctl-securebits.test: New test.
* tests/.gitignore: Add prctl-securebits.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-securebits.test.
2016-12-17 12:06:07 +00:00
73e9623acf tests: check decoding of prctl PR_[GS]ET_DUMPABLE operations
* tests/prctl-dumpable.c: New file.
* tests/prctl-dumpable.test: New test.
* tests/.gitignore: Add prctl-dumpable.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-dumpable.test.
2016-12-17 12:02:07 +00:00
ea01cb0e5b prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE
* xlat/pr_dumpable.in: New file.
* prctl.c: Include "xlat/pr_dumpable.h".
(SYS_FUNC(prctl)): Decode returned value of PR_GET_DUMPABLE operation
and the second syscall argument of PR_SET_DUMPABLE operation
as SUID_DUMP_* constants.
2016-12-17 11:40:03 +00:00
f55ef46feb Include "kernel_types.h" in defs.h and tests/tests.h
As kernel_ulong_t type is going to be used in the definition
of struct tcb and in many function prototypes, make it readily
available for every source file by including "kernel_types.h"
in defs.h and tests/tests.h files.

* defs.h: Include "kernel_types.h".
* tests/tests.h: Likewise.
* desc.c: Do not include "kernel_types.h".
* dirent.c: Likewise.
* keyctl.c: Likewise.
* syscall.c: Likewise.
* linux/asm_stat.h: Likewise.
* tests/answer.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/fanotify_init.c: Likewise.
* tests/fanotify_mark.c: Likewise.
* tests/file_handle.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/getdents.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/inotify.c: Likewise.
* tests/inotify_init1.c: Likewise.
* tests/ioprio.c: Likewise.
* tests/ipc_msgbuf.c: Likewise.
* tests/kcmp.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/kexec_load.c: Likewise.
* tests/keyctl.c: Likewise.
* tests/lookup_dcookie.c: Likewise.
* tests/lseek.c: Likewise.
* tests/mq_sendrecv.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/prctl-pdeathsig.c: Likewise.
* tests/prctl-tsc.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/process_vm_readv_writev.c: Likewise.
* tests/read-write.c: Likewise.
* tests/setfsugid.c: Likewise.
* tests/setns.c: Likewise.
* tests/truncate.c: Likewise.
* tests/unshare.c: Likewise.
* tests/xgetrlimit.c: Likewise.
2016-12-16 12:01:44 +00:00
2fc39d0a4c Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.15-1.
* strace.spec.in: Likewise.
2016-12-15 00:08:06 +00:00
3a838cd31a xlat: provide fallback definitions for NETLINK_* constants
As new constants have been added gradually over kernel releases, define
all constant values to make newer constants decoded properly when strace
is built with older kernel headers.

* xlat/netlink_protocols.in: Add default values for constants.
* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]: Remove.
* socketutils.c: Likewise.
2016-12-14 08:09:10 +00:00
76d4eee640 tests: relax getaffinity return value check in tests/sched_xetaffinity.c
* tests/sched_xetaffinity.c (errstr): New variable.
(getaffinity, setaffinity): Initialize it.
(main): Use it.  Allow getaffinity return value to be less than
its cpusetsize argument.
2016-12-14 02:03:04 +00:00
a3f44329a5 tests: fix threads-execve.test for large pids
* tests/threads-execve.c (main): Fix expected output for large pids.
2016-12-14 01:02:03 +00:00
6dc96f5c75 Prepare for 4.15 release
* NEWS: Update for 4.15 release.
2016-12-13 20:21:22 +00:00
9b96cd97af .mailmap: add addresses of Thomas De Schampheleire
* .mailmap: Add both addresses of Thomas De Schampheleire here to avoid
duplications in CREDITS file.
2016-12-13 20:43:57 +00:00
8ed741fc59 Sync strace.spec and debian/ with packages
* debian/control: Add Vcs-* metadata from 4.13-0.1.
* debian/watch: Sync with 4.13-0.1.
* strace.spec.in: Sync with 4.14.0.100.622a-1.
2016-12-13 20:43:57 +00:00
3dac7272e8 tests: workaround a bug in GNU grep
Workaround a bug introduced in GNU grep 2.27, for details see
https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html

* tests/init.sh (grep_pid_status): New function.
* tests/detach-running.test: Use it instead of grep to search
in /proc/$pid/status.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
2016-12-13 20:21:22 +00:00
34283c2f82 tests: fix typo in comment inside prctl-tsc.c 2016-12-13 20:21:22 +00:00
54c7792bfd Fix libunwind segfault when -p is passed before -k
* strace.c (init) [USE_LIBUNWIND]: Call unwind_tcb_init after
unwind_init for all allocated tcb structures if stack trace is enabled.
* unwind.c (unwind_tcb_init): Skip if tcb is already initialized.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-13 20:21:22 +00:00
9555f21588 Update NEWS
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-13 20:10:44 +00:00
ab28d7f1e5 tests: skip fault injection tests on unsupported platforms
* tests/fault_injection.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/fault_injection-exit_group.test: Use it.
* tests/fault_injection.test: Likewise.
2016-12-07 19:46:13 +00:00
5aff0e3c6e tests: introduce require_min_kernel_version_or_skip function
* tests/init.sh (kernel_version_code,
require_min_kernel_version_or_skip): New functions.
* tests/threads-execve.test: Use require_min_kernel_version_or_skip.
2016-12-07 19:46:12 +00:00
d679dcd6aa tests: add descriptions to prctl-pdeathsig and prctl-tsc tests 2016-12-07 18:28:33 +00:00
a2633e4a59 tests: robustify prctl-pdeathsig.test and prctl-tsc.test
Rrobustify remaining prctl tests against unrelated prctl invocations

* tests/prctl-pdeathsig.test: Filter out unrelated PR_GET_* and PR_SET_*
prctl calls.
* tests/prctl-tsc.test: Likewise.
2016-12-07 16:22:50 +00:00
a3da3c32c1 Makefile.am: don't confuse CFLAGS and CFLAGS_FOR_BUILD
Commit dc427d50d9 enabled a number of extra
warning flags through configure.ac.  The configure script will determine
dynamically if CC supports these flags before adding them to WARN_CFLAGS.

ioctlsort is compiled with CC_FOR_BUILD, rather than CC.  Nevertheless,
the flags passed to this compilation also include WARN_CFLAGS (through
AM_CFLAGS).  This is incorrect: in a cross-compilation use case, CC
and CC_FOR_BUILD are not the same.  The former is the cross-compiler,
the latter is the host compiler.  Both may be of different versions
and support different warning flags.

In particular, this posed a problem when cross-compiling with a host
compiler gcc 4.1, which does not support all the new flags:

    /usr/bin/gcc -DHAVE_CONFIG_H   -I./linux/arm -I./linux/arm -I./linux
    -I./linux -I. -I. -I/host-sysroot/usr/include -Wall -Wempty-body
    -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op
    -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration
    -Wold-style-definition -Wsign-compare -Wtype-limits -Wwrite-strings -O2
    -I/host-sysroot/usr/include -DIOCTLSORT_INC=\"ioctls_all0.h\" -c -o
    ioctlsort0.o ./ioctlsort.c
    cc1: error: unrecognized command line option "-Wempty-body"
    cc1: error: unrecognized command line option "-Wignored-qualifiers"
    cc1: error: unrecognized command line option "-Wlogical-op"
    cc1: error: unrecognized command line option "-Wmissing-parameter-type"
    cc1: error: unrecognized command line option "-Wold-style-declaration"
    cc1: error: unrecognized command line option "-Wtype-limits"
    make[2]: *** [ioctlsort0.o] Error 1

* Makefile.am (AM_CFLAGS_FOR_BUILD, AM_CPPFLAGS_FOR_BUILD): New
variables.
(ioctlsort_CPPFLAGS): Use AM_CPPFLAGS_FOR_BUILD instead of AM_CPPFLAGS.
(ioctlsort_CFLAGS): Use AM_CFLAGS_FOR_BUILD instead of AM_CFLAGS.
(ioctlsort_LDFLAGS): Use AM_LDFLAGS_FOR_BUILD instead of AM_LDFLAGS.
* m4/ax_prog_cc_for_build.m4 (AX_PROG_CC_FOR_BUILD): Redirect
WARN_CFLAGS and gl_unknown_warnings_are_errors, call st_WARN_CFLAGS,
substitute WARN_CFLAGS_FOR_BUILD.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
2016-12-07 15:53:13 +00:00
f91def0384 m4: prepare gl_WARN_ADD for simultaneous use of multiple compilers
* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Change gl_Flags to use
_AC_LANG_PREFIX[]FLAGS in unquoted form.  Change gl_Warn to use gl_Flags
instead of _AC_LANG_ABBREV.  Change notification message to mention
the variable name of the compiler.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS): Do nothing if
gl_unknown_warnings_are_errors is set.
(gl_WARN_ADD): Change the use of gl_UNKNOWN_WARNINGS_ARE_ERRORS from
AC_REQUIRE to a regular call.
2016-12-07 15:53:13 +00:00
cdeb5dda0a AX_PROG_CC_FOR_BUILD: redirect more variables related to C compiler
Some of these variables cannot be redirected using traditional
pushdef/popdef mechanism because of complex constructions like
[ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu] employed by autoconf macros.
Use st_SAVE_VAR/st_RESTORE_VAR to workaround this issue.

* m4/ax_prog_cc_for_build.m4: Redirect ac_cv_prog_cc_stdc,
ac_cv_prog_cc_c11, ac_cv_prog_cc_c99, ac_cv_prog_cc_c89,
am_cv_prog_cc_c_o, and am_cv_CC_dependencies_compiler_type using
pushdef/popdef.
Redirect ac_c_decl_warn_flag, ac_c_preproc_warn_flag, ac_c_werror_flag,
ac_compile, ac_compiler_gnu, ac_cpp, ac_cv_c_compiler_gnu,
ac_cv_c_decl_report, and ac_link using st_SAVE_VAR/st_RESTORE_VAR.
2016-12-07 11:14:03 +00:00
9beaf2c3d3 Move all gl_WARN_ADD calls to a separate m4 macro
This is going to be needed for the upcoming AX_PROG_CC_FOR_BUILD
change.

* configure.ac: Call st_WARN_CFLAGS before AX_PROG_CC_FOR_BUILD.
Move all gl_WARN_ADD calls ...
* m4/st_warn_cflags.m4: ... here.
2016-12-07 10:59:52 +00:00
c26d031c1f m4: introduce st_SAVE_VAR and st_RESTORE_VAR macros
These new macros are going to be needed for the upcoming
AX_PROG_CC_FOR_BUILD change.

* m4/st_save_restore_var.m4: New file.
2016-12-07 10:58:24 +00:00
5c20f4aac4 tests: add valgrind support to "make check"
* m4/ax_valgrind_check.m4: Import from the autoconf-archive package.
* configure.ac: Invoke AX_VALGRIND_CHECK.
* valgrind.supp: Move to tests/strace.supp.
* Makefile.am (EXTRA_DIST): Remove valgrind.supp.
* tests/Makefile.am: Add @VALGRIND_CHECK_RULES@.
(VALGRIND_FLAGS, VALGRIND_SUPPRESSIONS_FILES): New variables.
(EXTRA_DIST): Add strace.supp.
* tests/init.sh: Add valgrind command prefix to $STRACE when appropriate.
2016-12-06 16:20:54 +00:00
427e7431ba tests: robustify threads-execve.test against race conditions
Due to probabilistic nature of the test, try it several times.

* tests/threads-execve.c (NUMBER_OF_ITERATIONS): Change to 1.
* tests/threads-execve.test: Iterate up to 10 times.
2016-12-06 16:20:51 +00:00
51694267bd tests: fix expected output in strace-ttt.test
If strace -ttt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.

* tests/strace-ttt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 15:27:21 +00:00
52fe35f262 tests: fix expected output in strace-tt.test
If strace -tt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.

* tests/strace-tt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 15:27:08 +00:00
a2002a648e tests: robustify redirect.test against race conditions
Introduce a synchronization mechanism between the tracee and its peer.

* tests/redirect.test: Change timeout file to $OUT.  Let the tracee
remove $LOG, wait for $LOG removal in its peer.
2016-12-06 13:16:42 +00:00
997f49f190 tests: robustify attach-f-p.test against race conditions
Introduce a synchronization mechanism between attach-f-p and strace.

* tests/attach-f-p-cmd.c: New file.
* tests/Makefile.am (check_PROGRAMS): Add attach-f-p-cmd.
* tests/attach-f-p.c: Include <sys/stat.h>.
(main): Write to stdout instead of descriptor 3.  Wait for the peer
writing to stdout.
* tests/attach-f-p.test: Assume that ./attach-f-p-cmd works.
Use $OUT for expected output.  Use attach-f-p-cmd for unlocking $OUT.
2016-12-06 09:09:18 +00:00
f91c9fe814 tests: robustify attach-p-cmd.test against race conditions
Introduce a synchronization mechanism between attach-p-cmd-p
and attach-p-cmd-cmd processes.

* tests/attach-p-cmd-cmd.c: Include <errno.h> and <sys/stat.h>.
(main): Wait for the lock directory creation by attach-p-cmd-p.
* tests/attach-p-cmd-p.c: Include <errno.h> and <sys/stat.h>.
(main): Create a lock directory and wait for its removal
by attach-p-cmd-cmd.
* tests/attach-p-cmd.test: Assume that test programs work.
2016-12-06 09:08:36 +00:00
45ed340016 Rewrite remaining qual_* parsers using bit sets
* defs.h (struct fault_opts): Replace forward declaration
with a definition.
(qualbits_t, qualify_read, qualify_write, qualify_signals): Remove.
(qual_flags): New function prototype.
(nsyscall_vec, sysent_vec, fault_vec): New variable prototypes.
* qualify.c (abbrev_set, fault_set, raw_set, trace_set, verbose_set):
New variables.
(qualify_read, qualify_write, qualify_signals): Add static qualifier.
(find_errno_by_name, lookup_class, parse_fault_expression,
parse_fault_token, qual_flags, qualify, qualify_abbrev, qualify_fault,
qualify_raw, qualify_syscall, qualify_syscall_class,
qualify_syscall_name, qualify_syscall_number, qualify_syscall_tokens,
qualify_trace, qualify_verbose, strip_prefix): New functions.
* syscall.c (nsyscall_vec, nsysent_vec): Remove static qualifier.
(MAX_NSYSCALLS1, MAX_NSYSCALLS2, MAX_NSYSCALLS, qual_vec, qual_flags,
qual_fault, qual_syscall, qual_options, fault_opts, qualify_one,
qualify_scno, lookup_class, qualify_syscall_class, qualify_syscall_name,
qual_syscall_ex, qual_syscall, strip_prefix, find_errno_by_name,
parse_fault_token, parse_fault_expression, qual_fault, qualify): Remove.
(decode_socket_subcall, decode_ipc_subcall, decode_mips_subcall,
get_scno): Update use of qual_flags.
(inject_syscall_fault_entering): Update per-personality allocation
of tcp->fault_vec.
* tests/fault_injection-exit_group.test: Check parsing of inversed
fault sets.
* tests/fault_injection.test: Check parsing of -efault=none.
* tests/options-syntax.test: Check parsing of invalid syscall numbers.
2016-12-05 20:49:59 +00:00
701792d70c Change qual_vec/qual_fault into static fixed size arrays
* defs.h (qual_vec, num_quals): Remove.
(qual_flags): Move ...
* syscall.c: ... here.
(num_quals, num_faults, MIN_QUALS, reallocate_vec, reallocate_qual,
reallocate_fault): Remove.
(qual_vec, qual_fault): Change into static fixed size arrays.
(qualify_one): Remove reallocate_qual and reallocate_fault calls.
(qualify): Likewise.  Replace num_quals and num_faults with
MAX_NSYSCALLS.
2016-12-05 20:49:59 +00:00
11abfb422a Rewrite qual_signal using bit sets
* defs.h (signal_set): New variable prototypes.
(qualify_signals): New function prototypes.
(QUAL_SIGNAL): Change to a value greater than 0xff.
(QUAL_FAULT): Change to a lower value.
* qualify.c (signal_set): New variable.
(sigstr_to_uint, qualify_signals): New functions.
* syscall.c (qual_signal): Remove.
(qual_options): Replace qual_signal with NULL.
(qualify): Use qualify_signals.
* strace.c (print_signalled, print_stopped): Use is_number_in_set
with signal_set argument.
2016-12-05 20:49:59 +00:00
05ac490cc7 Rewrite qual_desc using bit sets
As a side effect, this also fixes support of negated sets
of descriptors.

* defs.h (struct number_set): New forward declaration.
(read_set, write_set): New variable prototypes.
(is_number_in_set, qualify_read, qualify_write): New function
prototypes.
(QUAL_READ, QUAL_WRITE): Change to values greater than 0xff.
* qualify.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* syscall.c (qual_desc): Remove.
(qual_options): Replace qual_desc with NULL.
(qualify): Use qualify_read and qualify_write.
(dumpio): Use is_number_in_set.
* tests/options-syntax.test: Check invalid sets of descriptors.
* tests/readv.test: Check dumping of negated sets of descriptors.
2016-12-05 10:41:05 +00:00
1ac436f4c3 tests: skip redirect-fds.test when strace is wrapped with valgrind
valgrind is not as transparent as strace wrt standard descriptors,
so if strace is wrapped with valgrind, the test would check valgrind
transparency properties and fail imminently.

* tests/redirect-fds.test: Skip the test when $STRACE shows a presence
of valgrind.
2016-12-05 10:41:05 +00:00
ade6eef6dd Add valgrind.supp
As valgrind is not quite happy about the way how get_cpuset_size uses
sched_getaffinity, add a suppression file for this case.

* valgrind.supp: New file.
* Makefile.am (EXTRA_DIST): Add it.
2016-12-05 03:56:17 +00:00
58d8f96c25 affinity: pass 0 as a pid to sched_getaffinity
* affinity.c (get_cpuset_size): Pass 0 instead of getpid()
to sched_getaffinity.
2016-12-05 03:56:17 +00:00
cec2dc2ab5 affinity: document the method of finding out the cpuset size
* affinity.c (get_cpuset_size): Add a comment about sched_getaffinity.
2016-12-05 03:56:17 +00:00
8c9dc258e0 tests: make options-syntax.test tolerant of strace wrappers
Change the test to allow wrappers like STRACE="valgrind ./strace".

* tests/options-syntax.test: Strip all words but last from $STRACE
variable in all contexts where the name of strace executable is expected
in its output.
2016-12-05 03:56:17 +00:00
2ecb0a0467 Do not allocate memory for line buffered output
libc is perfectly capable of allocating memory for its buffers,
so let it do its job.

* strace.c (init): Do not allocate memory for setvbuf invocation.
2016-12-04 23:09:18 +00:00
6be0d91285 Update NEWS 2016-12-04 23:09:18 +00:00
5be0a95d8e tests: use kernel_ulong_t as argument type in setfsuid/setfsgid tests
* setfsugid.c: Include "kernel_types.h".
(main): Change type of entries of the "tests" array from long to
kernel_ulong_t.
2016-12-04 17:42:38 +00:00
6be94f1772 uid: print size as signed in setgroups/getgroups
As this is the type used in kernel.

* uid.c (SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Print size parameter
as "%d".
* tests/getgroups.c: Update expected output.
* tests/setgroups.c: Likewise.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-12-04 17:42:38 +00:00
3304d82108 uid: use printuid for printing UID/GID value
* uid.c (setfsuid, get_print_uid, print_gid): Use printuid.
* tests/setfsugid.c (printuid): New function.
(main): Use it to print UID/GID values.
* tests/setgroups.c: Likewise.
* tests/setugid.c (ugid2int): Remove.
(printuid): New function.
(main): Use it to print UID/GID values.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-12-04 17:42:38 +00:00
dcc9b9cdb2 tests: additional check for PTRACE_SETSIGINFO ptrace command
* tests/ptrace.c (main): Add an additional PTRACE_SETSIGINFO check.
2016-12-01 01:23:28 +00:00
3c8b673408 syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32
* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
Clear __X32_SYSCALL_BIT from scno on x32 personality.
2016-12-01 01:05:13 +00:00
9936b91d9f Print syscall names only for defined syscalls
The string literal "__NR_syscall_4294967295" is semantically incorrect
as there is no such constant defined.

* syscall.c (syscall_name): Return NULL if there is no syscall
corresponding to the given number.
* defs.h (syscall_name): Document this behaviour.
* printsiginfo.c (print_si_info): Print syscall name with "__NR_" prefix
only if there is a syscall corresponding to si_syscall number; print
a plain syscall number otherwise.
* tests/ptrace.c (main): Update expected output.
2016-12-01 00:08:39 +00:00
2432f78415 affinity: print cpu set as an array
* affinity.c: Add comma between elements of cpu set.
* tests/sched_xetaffinity.c (main): Update expected output.
2016-12-01 00:08:06 +00:00
635638feb3 statfs: fix printing format of f_fsid field
* print_statfs.c: Print f_fsid as a structure containing field "val"
which, in turn, is an array of two elements that used to be printed
as members of f_fsid structure.
* tests/statfs.expected: Update expected output.
* tests/xstatfsx.c (print_statfs): Likewise.
2016-12-01 00:06:39 +00:00
39c77d45d0 swap: always print priority value
* swapon.c (SYS_FUNC(swapon)): Do not check for non-zero the value
of the prio variable in order to print it.
* tests/swap.c (main): Update expected output.
2016-12-01 00:05:09 +00:00
3cfe169f37 tests: show pattern line number in match_grep
This makes debugging of failing test  a bit easier.

* tests/init.sh (match_grep): Add the cnt variable, increment it on every
pattern line read, print it as a prefix for non-matched pattern.
2016-12-01 00:02:07 +00:00
01e9ac81c4 futex: make output of the val3 argument of the FUTEX_WAKE_OP command more structured
It is a number which consists of several xlat values, not a structure.

* futex.c (SYS_FUNC(futex)): Modify output of the val3 argument
of the FUTEX_WAKE_OP futex syscall command.
* tests/futex.c (main): Update expected output.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-11-30 23:56:47 +00:00
d872902009 tests: additional checks for prctl-* tests
* tests/prctl-pdeathsig.c (main): Additional checks.
* tests/prctl-tsc.c (main): Likewise.
* tests/prctl-pdeathsig.test: Update value of -a argument.
* tests/prctl-tsc.test: Likewise.
2016-11-30 23:46:20 +00:00
d945e74377 tests: add prctl-pdeathsig.test and prctl-tsc.test
* tests/prctl-pdeathsig.c: New file.
* tests/prctl-tsc.c: Likewise.
* tests/prctl-pdeathsig.test: New test.
* tests/prctl-tsc.test: Likewise.
* tests/.gitignore: Add prctl-pdeathsig and prctl-tsc.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-pdeathsig.test and prctl-tsc.test.
2016-11-30 23:40:30 +00:00
ec8f783356 syscall: Simplify strip_prefix
* syscall.c (strip_prefix): Use strncmp instead of strlen+memcmp.
2016-11-30 16:52:28 +00:00
9f2980bd2c util: fix integer overflow check in string_to_uint_ex
* util.c (string_to_uint_ex): Fix the check for integer overflow
on systems where LONG_MAX == INT_MAX.
2016-11-30 16:52:05 +00:00
c422618120 Check dumping of io syscalls when descriptor arguments are sensibly large
* tests/tests.h (pipe_maxfd): New prototype.
* tests/pipe_maxfd.c: New file.
* tests/print_maxfd.c: Likewise.
* tests/.gitignore: Add print_maxfd.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(libtests_a_SOURCES): Add pipe_maxfd.c.
* tests/readv.c (main): Use pipe_maxfd() instead of pipe(),
fds[0] instead of 0, fds[1] instead of 1.
* tests/readv.test: Use print_maxfd to specify dump descriptor numbers.
2016-11-30 00:56:04 +00:00
1c599b4f3d dumpio: remove useless check
* syscall.c (dumpio): Remove SEN_printargs check.  Use tcp->s_ent->sen
directly.
2016-11-30 00:04:03 +00:00
07586a5b64 Fix dumping of io syscalls when descriptor argument has unused bits set
* syscall.c (dumpio): Explicitly cast the first argument of syscall
to "int", the same way as the kernel does.
* tests/read-write.c: Include <asm/unistd.h> and "kernel_types.h".
(k_read, k_write): New functions.
(test_dump, main): Use them.
2016-11-29 22:56:49 +00:00
54e164f630 x32: fix preadv2-pwritev2.test
* tests/preadv2-pwritev2.c: Include "kernel_types.h".
(main): Use kernel_ulong_t instead of unsigned long as types
of arguments of preadv2 and pwritev2 syscalls.
2016-11-29 19:51:15 +00:00
aad1e4a0bb x32: wire up preadv2 and pwritev2 syscalls
* linux/x32/syscallent.h [546]: Add preadv2 entry.
[547]: Add pwritev2 entry.
2016-11-29 10:05:16 +00:00
d454dac0dc signal: fix omission of field names in sigaction printers
* signal.c (decode_old_sigaction, decode_new_sigaction): Add printing
of the field names.
* tests/sigaction.awk: Update expected output.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2016-11-29 10:05:16 +00:00
ad53524377 Make date output format conform to ISO 8601
* util.c (sprinttime): Make date output conform to ISO 8601.
* tests/utime.c (print_tm): Update expected output.
* tests/xstatx.c (print_time): Likewise.
2016-11-29 10:05:16 +00:00
50e267c420 tests: rewrite utime.test without relying on libc utime wrapper
* tests/utime.c (k_utime): New function, a thin wrapper around
syscall(__NR_utime).
(main): Use it instead of utime.
* tests/utime.test: Update.
2016-11-29 04:08:47 +00:00
4399fa976a Fix meaning of negated sets in fault expressions
Change the parser of fault expression to follow the POLA:
-e fault=!SET
means that all syscalls except those from SET are subject to fault
injection;
-e fault=!SET1:error=ERRNO1, -e fault=!SET2:error=ERRNO2
means that all syscalls except those from SET2 are subject to fault
injection with error code ERRNO2, and all syscalls from SET2 that are
not in SET1 are subject to fault injection with error code ERRNO1.

* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
Handle negated QUAL_FAULT case differently.
* tests/fault_syntax.test: Add checks of negated sets.
2016-11-29 02:11:48 +00:00
c84536f975 print_sigevent: fix field names of sigev_value structure
* print_sigevent.c (print_sigevent): Change "int" to "sival_int", "ptr"
to "sival_ptr".
* tests/mq_sendrecv.c (main): Update expected output in accordance with
fixed field names.
* tests/timer_create.c (main): Likewise.
2016-11-29 00:33:01 +00:00
6602da1b90 tests: add more utime checks
* tests/utime.c: Include <unistd.h> and <asm/unistd.h>.
(main): Add checks for invalid pointers.
2016-11-29 00:27:51 +00:00
922712f8ff utime: fix omission of field names in utimbuf structure printing
* utime.c (SYS_FUNC(utime)): Print struct utimbuf as a structure,
not as an array (use curly brackets instead of square ones).
Add field names to the output.
* tests/utime.c (main): Update expected output.
2016-11-29 00:26:20 +00:00
d4d5aaa560 mem: print mincore output as an array
* mem.c (SYS_FUNC(minore)): Print commas between elements.
* tests/mincore.c (print_mincore): Update expected output in accordance
with syscall decoder formatting change.
2016-11-29 00:25:55 +00:00
a938b441d6 util: provide information whether xlat value has been found
This is necessary for the upcoming change in the output format
of the val3 argument of the FUTEX_WAKE_OP futex command.

* defs.h (printxvals, printxval_searchn): Change return type to int.
(printxval64, printxval, printxval_long): Likewise.  Forward the value
returned by printxvals call.
* util.c (printxvals, printxval_searchn): Change return type to int,
return 1 if xlat value has been found, 0 otherwise.
2016-11-29 00:23:13 +00:00
c1271b7341 util: check dflt argument for NULL in printxvals
This is necessary for the upcoming change in the output format
of the val3 argument of the FUTEX_WAKE_OP futex command.

* util.c (printxvals): Do not print dflt if it is NULL.
2016-11-29 00:22:05 +00:00
827b170b72 capability: fix omission of capability structure field names
* capability.c (print_cap_header, print_cap_data): Add field names
to the output.
* tests/caps.awk: Update test output.
2016-11-29 00:21:06 +00:00
447bdc55bf tests: fix "comparison between signed and unsigned" compilation warnings
* tests/readv.c (main): Cast r_len to int.
* tests/preadv2-pwritev2.c (dumpio): Likewise.
2016-11-28 20:55:10 +00:00
7b3b12b793 aarch64, arm, sparc: add comments on fault injection support in kernel
* linux/aarch64/set_scno.c: Note the kernel commit that introduced
NT_ARM_SYSTEM_CALL support.
* linux/arm/set_scno.c: Note the kernel commit that introduced
PTRACE_SET_SYSCALL support.
* linux/sparc/set_scno.c: Note the kernel commit that introduced
reloading from the syscall number register.
2016-11-28 19:46:50 +00:00
f3b5837608 tests: check -C option
* tests/strace-C.expected: New file.
* tests/strace-C.test: New test.
* tests/Makefile.am (MISC_TESTS): Add strace-C.test.
(EXTRA_DIST): Add strace-C.expected.
2016-11-28 16:57:30 +00:00
7e6f0b7b0c tests: check basic options syntax
* tests/options-syntax.test: New file.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-11-28 15:13:25 +00:00
0b98d8213e Fix -r option syntax
While -r option implies -t, it should not literally have the effect
of -t option, e.g. -rr should not increment tflag twice.

* strace.c (init): In the getopt loop, do not increment tflag for each
occurrence of -r option.  After the getopt loop, if rflag is set, set
tflag to 1.  Issue a warning that -tt has no effect with -r.
2016-11-28 15:13:25 +00:00
1aa0697738 Print timeval pair as an array of timeval entries
* print_timeval.c (print_timeval_item): New function.
(print_timeval_pair): Use it as a print_function in print_array call.
* tests/futimesat.c (main): Update to test new behaviour.
* tests/utimes.c (main): Likewise.
2016-11-28 04:38:42 +00:00
0bf550423c tests: treat tv_sec/tv_usec as signed types in futimesat and utimes tests
* tests/futimesat.c: Print tv_sec and tv_usec fields as signed types.
* tests/utimes.c: Likewise.
2016-11-28 04:26:35 +00:00
7491519823 alpha: print struct timeval32 consistently
* defs.h [ALPHA] (timeval32_t): New type.
[ALPHA] (print_timeval32_t): New prototype.
* print_timeval.c [ALPHA] (timeval32_t): Remove.
[ALPHA] (print_timeval32_t): Remove static keyword.
* printrusage.c [ALPHA] (printrusage32): Use timeval32_t instead
of local definition of struct timeval32.  Use print_timeval32_t.
2016-11-28 04:21:11 +00:00
70864ce6e0 Print struct timeval consistently
Use print_struct_timeval interface to print struct timeval.

* print_timeval.c (print_struct_timeval): New mpers printer.
* print_timex.c (print_timex): Use it.
* printrusage.c (printrusage): Likewise.
* v4l2.c (print_v4l2_buffer): Likewise.
* tests/getrusage.c (main): Print tv_sec and tv_usec fields as signed.
* tests/waitid.c (sprint_rusage): Likewise.

Suggested-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2016-11-28 04:07:37 +00:00
5f6a839d23 Split print_time.c
After commit v4.14-136-g151d1d1 that removed the last object common
for timespec and timeval parsers there is no need to keep them all
in a single file.

* print_timespec.c: New file.
* print_timeval.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* print_time.c: Move all timespec related code to print_timespec.c.
Move all timeval related code to print_timeval.c.
2016-11-28 02:45:13 +00:00
0aaa6976dd tests: check decoding of threads when a non-leader thread invokes execve
* tests/threads-execve.c: New file.
* tests/threads-execve.test: New test.
* tests/.gitignore: Add threads-execve.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(threads_execve_LDADD): New variable.
(MISC_TESTS): Add threads-execve.test.
2016-11-28 00:31:59 +00:00
f6c14637a3 tests: check decoding of fault injected exit_group syscall
* tests/answer.c: New file.
* tests/fault_injection-exit_group.expected: Likewise.
* tests/fault_injection-exit_group.test: New test.
* tests/.gitignore: Add answer.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fault_injection-exit_group.test.
(EXTRA_DIST): Add fault_injection-exit_group.expected.
2016-11-27 19:40:33 +00:00
2f948b9231 Set PTRACE_O_TRACEEXIT option and handle PTRACE_EVENT_EXIT events
Do not assume that some syscalls do not generate syscall-exit-stops.
When syscalls fail for any reason they may generate syscall-exit-stops.

The solution is to wait for an actual exit reported by PTRACE_EVENT_EXIT
and print the end of unfinished exiting syscall properly.

* exit.c: Remove.
* Makefile.am (strace_SOURCES): Remove exit.c.
* linux/dummy.h (sys_exit): Alias to printargs_d.
* strace.c (ptrace_setoptions): Add PTRACE_O_TRACEEXIT bit.
(print_event_exit): New function.
(trace): Use it in case of PTRACE_EVENT_EXIT.
* syscall.c (trace_syscall_entering): Remove special handling
of SEN_exit.
2016-11-27 14:22:58 +00:00
37c4d4bcfc Change printargs to return RVAL_DECODED
As printargs is invoked as a generic syscall decoder only and
it is not supposed to print anything on exiting, change printargs
to return RVAL_DECODED so it would not be called on exiting at all.

* util.c (printargs): Print args unconditionally, return RVAL_DECODED.
2016-11-27 14:22:58 +00:00
88017cbae8 Enhance error diagnostics of exit/exit_group decoder
* exit.c (SYS_FUNC(exit)): Print the name of syscall that has returned.
2016-11-26 20:54:31 +00:00
0c836eb060 Restrain from fault injection while the trace executes strace code
There is little use in injections of faults into syscalls made by strace.

* syscall.c (trace_syscall_entering): Clear QUAL_FAULT bit from
tcp->qual_flg when tcp->flags has TCB_HIDE_LOG bit set.
2016-11-26 20:54:01 +00:00
634a6a55e8 Move two global flags to tracee scope
A simultaneous use of -p option and tracing of a command available
since commit v4.11-183-gfa8c286 introduces a race condition because
the flags whether the first exec has happened are global.

Fix the race by moving hide_log_until_execve and hide_log_until_execve
global variables to TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
in struct tcb.flags, correspondingly.

* defs.h (TCB_HIDE_LOG, TCB_SKIP_DETACH_ON_FIRST_EXEC, hide_log):
New macros.
(hide_log_until_execve): Remove prototype.
* strace.c (skip_one_b_execve, hide_log_until_execve): Remove.
(startup_child): Set TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
in the allocated tcb structure.
(init): Remove initialization of hide_log_until_execve and
skip_one_b_execve.
(print_stopped): Use hide_log() instead of hide_log_until_execve.
(trace): Check and clear TCB_SKIP_DETACH_ON_FIRST_EXEC flag instead
of skip_one_b_execve.
* syscall.c (trace_syscall_entering): Clear TCB_HIDE_LOG flag instead of
hide_log_until_execve.
(trace_syscall_entering, trace_syscall_exiting): Check hide_log()
instead of hide_log_until_execve.
2016-11-26 19:47:38 +00:00
7910ac9638 Treat execveat as an execve family syscall
* syscall.c (trace_syscall_entering): Clear hide_log_until_execve flag
also when SEN_execveat is encountered.
2016-11-26 16:08:10 +00:00
d5b9c75d61 Change parser of fault expressions to conform the documentation
Make expressions like fault=SYSCALL1,SYSCALL2:error=EPERM work
as documented, i.e. fail both SYSCALL1 and SYSCALL2 with EPERM.

* syscall.c (parse_fault_expression): Remove const qualifier from
"name" and "token: variables, as well as from the return value.
(qual_fault): Remove const qualifier from "name" variables.
Split "name" into comma delimited tokens and pass each token
to individual qual_syscall_ex call.
(qualify): For QUAL_FAULT options, pass the whole option value
to their qualify methods without prior splitting into comma
delimited tokens.
* tests/fault_injection.test: Check it.
* tests/fault_syntax.test: Check empty syscall sets.
2016-11-25 23:47:32 +00:00
cba0d84def Simplify parse_fault_expression
* syscall.c (parse_fault_expression): Rewrite iterator over strtok_r
in a more concise way.
2016-11-24 21:35:05 +00:00
151d1d158c Fix omission of field names in printers of timeval structure
* print_time.c (time_fmt): Remove.
(timeval_fmt): New constant.
(print_timeval_t, sprint_timeval, print_timeval32_t, sprint_timeval32):
Use it instead of time_fmt.
* print_timex.c (print_timex): Print field names of the time field.
* printrusage.c (printrusage, printrusage32): Print field names
of ru_utime and ru_stime fields.
* tests/adjtimex.c (main): Add field names to expected output.
* tests/clock_nanosleep.c (main): Likewise.
* tests/futimesat.c (main): Likewise.
* tests/getrusage.c (main): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/oldselect.expected: Likewise.
* tests/utimes.c (main): Likewise.
* tests/wait4.c (sprint_rusage): Likewise.
* tests/waitid.c (sprint_rusage): Likewise.
* tests/xetitimer.c (main): Likewise.
* tests/xettimeofday.c (main): Likewise.
* tests/xselect.c (main): Likewise.
2016-11-26 00:40:53 +00:00
acdb08613e Fix omission of field names in printers of timespec structure
* print_time.c (timespec_fmt): New constant.
(print_timespec_t, sprint_timespec): Use it instead of time_fmt.
* tests/aio.c: Add field names to expected output.
* tests/clock_nanosleep.c (main): Likewise.
* tests/clock_xettime.c (main): Likewise.
* tests/futex.c (main): Likewise.
* tests/mq_sendrecv.c (do_send, do_recv): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/ppoll-v.expected: Likewise.
* tests/ppoll.expected: Likewise.
* tests/pselect6.c (main): Likewise.
* tests/recvmmsg-timeout.c (main): Likewise.
* tests/restart_syscall.c (main): Likewise.
* tests/rt_sigtimedwait.c (iterate, main): Likewise.
* tests/sched_rr_get_interval.c (main): Likewise.
* tests/semop.c (main): Likewise.
* tests/strace-T.expected: Likewise.
* tests/timer_xettime.c (main): Likewise.
* tests/timerfd_xettime.c (main): Likewise.
* tests/utimensat.c (print_ts): Likewise.
2016-11-26 00:40:53 +00:00
6daba2ec29 tests: robustify prctl-name.test against unrelated prctl invocations
* tests/prctl-name.test: Filter out unrelated PR_GET_* prctl calls.
2016-11-26 00:40:39 +00:00
994afa8b71 tests: cleanup prctl-name.c
* tests/prctl-name.c (main): Remove "len" variable, rename "len1"
to "len".  Remove "name1" variable, use "name" instead.
2016-11-22 01:46:07 +00:00
e4997ecb89 Move KVM_* ioctl entries from ioctls_inc*.h to ioctls_arch*.h
* linux/32/ioctls_inc_align32.h: Regenerate.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
2016-11-22 00:21:01 +00:00
5532ac185b maint: add more workarounds for alpha and powerpc
* maint/ioctls_sym.sh: Skip asm/core_*.h.  Filter out from
asm-generic/ioctls.h those macros that are defined using unavailable
struct termios2 on alpha and powerpc.
2016-11-22 00:21:01 +00:00
3317da7a3a Add ioctl definitions for 16-bit alignment
* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align16.h.
* linux/32/ioctls_inc_align16.h: New file.
* linux/32/ioctls_inc.h [M68K]: Include it.
2016-11-22 00:15:20 +00:00
702c5c29a1 maint: move KVM_* constants from ioctls_inc.h to ioctls_arch.h
* maint/ioctls_gen.sh: Place constants defined in linux/kvm.h
into ioctls_arch.h instead of ioctls_inc.h.
2016-11-22 00:15:20 +00:00
0bb5372ddd maint: harmonize use of ioctls_sym.sh
* maint/ioctls_gen.sh: Consistently specify INCLUDES for all
ioctls_sym.sh invocations.  Use $mydir to specify ioctls_sym.sh
location.
2016-11-21 22:34:05 +00:00
c06335cdd4 maint: rework workarounds for linux/kvm.h
* maint/ioctls_sym.sh: Remove pre-include linux/kvm.h workarounds.
Skip linux/kvm.h on those architectures that have no asm/kvm.h file.
Introduce post-process workarounds, add post-process workarounds
for linux/kvm.h.
2016-11-21 16:08:08 +00:00
e0bf512cfc Restructure strace.1
* strace.1 (OPTIONS): Add subsections.
(PROBLEMS): Rename to REPORTING BUGS.
(SEE ALSO): Move to the bottom.
2016-11-20 22:39:29 +00:00
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
c8af54e328 prctl: add braces for conditional blocks with else/else-if blocks having braces 2016-11-20 11:32:34 +00:00
6b7ad9947b prctl: cast arg2 to int in PR_SET_PTRACER handler
Kernel code does this when compares it with -1 (apart from comparing it with
PR_SET_PTRACER_ANY, which is also -1) in security/yama/yama_lsm.c.

* prctl.c (SYS_FUNC(prctl)) <PR_SET_PTRACER>: Cast arg2 to int before
comparing it with -1.
2016-11-20 11:32:34 +00:00
aeff861218 prctl: use getarg_ull for option value retrieval
The prctl syscall does not use compat on x32/n32, so argument types
are in fact kernel_ulong_t.

* prctl.c (print_prctl_args): Use getarg_ull, print as "%#llx" instead
of "%#lx".
(SYS_FUNC(prctl)): Use getarg_ull to store call arguments in arg2, arg3,
arg4, arg5 variables of type unsigned long long.  Use them in printing
routines.
(SYS_FUNC(arch_prctl)): Use getarg_ull to store call argument in addr
variable of type unsigned long long.  Print it as "%#llx" instead of
"%#lx".
2016-11-20 11:32:34 +00:00
1d82c0f8c0 block: add some definitions from <linux/blkpg.h>
This is done in order to fix build error on old distributions where
struct blkpg_ioctl_arg declaration is broken:

In file included from block.c:35:
/usr/include/linux/blkpg.h:36: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token
block.c: In function 'print_blkpg_req':
block.c:113: error: 'struct_blkpg_ioctl_arg' has no member named 'data'

(from SLE10)

* block.c: Include <linux/ioctl.h> instead of <linux/blkpg.h>.
(BLKPG, BLKPG_DEVNAMELTH, BLKPG_VOLNAMELTH): New macros.
(struct_blkpg_ioctl_arg, struct_blkpg_partition): New definitions,
copied from blkpg_ioctl_arg and blkpg_partition structures defined
in <linux/blkpg.h>.
2016-11-20 10:41:07 +00:00
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
9eb38322fb prctl: include <linux/prctl.h> instead of <sys/prctl.h>
There are no users of prctl function in prctl.c, and all the rest
is provided by <linux/prctl.h> anyway.

* prctl.c: Include <linux/prctl.h> instead of <sys/prctl.h>.
2016-11-20 02:00:35 +00:00
9e8b95977d tests: check decoding of prctl PR_GET_NAME/PR_SET_NAME operations
* tests/prctl-name.c: New file.
* tests/prctl-name.test: New test.
* tests/.gitignore: Add prctl-name.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-name.test.
2016-11-20 01:33:16 +00:00
43017ef466 prctl: fix printing of PR_SET_NAME's argument
* prctl.c (SYS_FUNC(prctl)): Use printstr_ex with QUOTE_0_TERMINATED
instead of printstr to print the argument of PR_SET_NAME and PR_GET_NAME
operations.
2016-11-20 01:33:16 +00:00
52b85c6fdf printstr_ex: fix handling of last byte when QUOTE_0_TERMINATED bit set
* util.c (printstr_ex): Simplify handling of size == 0 case.
Do not artificially decrement size when QUOTE_0_TERMINATED bit is set.
Ensure that str[size] byte is non-zero if it hasn't been fetched.
2016-11-20 00:29:46 +00:00
03d65a05b9 printstr_ex: handle QUOTE_0_TERMINATED bit consistently
When user_style has QUOTE_0_TERMINATED bit set, printstr_ex prints
the fetched string as a NUL-terminated.
After this change, the string is being fetched as a NUL-terminated, too.

* util.c (printstr_ex): Use umovestr instead of umoven
if QUOTE_0_TERMINATED bit is set.
2016-11-19 21:01:03 +00:00
ead746af18 Cleanup fetch part of printstr_ex
* util.c (printstr_ex): Initialize "style" early, unify error handling.
2016-11-19 16:33:37 +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
79dca294d1 make-dist: use HEAD for making distribution package
* make-dist: Use HEAD commit instead of master branch by default.
2016-11-18 12:57:02 +00:00
95308d89ce tests: fix btrfs build error on some old systems
Fix the following build error on SLE 11 SP4:

btrfs.c: In function 'btrfs_test_dev_replace_ioctl':
btrfs.c:1570: error: unknown field 'start' specified in initializer

* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Move initialization
of struct btrfs_ioctl_dev_replace_args.start.srcdevid out of the
designated initializer.
2016-11-18 00:51:37 +00:00
f860e8c3e0 tests: check decoding of ERESTARTSYS error code
* tests/erestartsys.c: New file.
* tests/erestartsys.test: New test.
* tests/.gitignore: Add erestartsys.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add erestartsys.test.
2016-11-18 00:28:29 +00:00
57506ae00f Fix signame usage in qual_signal
Do not assume that the string returned by signame starts with "SIG"
prefix, this is not always the case.

* syscall.c (qual_signal): Skip signame return value
when it does not have "SIG" prefix.
2016-11-18 00:11:39 +00:00
8f73dc556e tests: check -e signal=set syntax
* tests/qual_signal.c: New file.
* tests/qual_signal.test: New test.
* tests/.gitignore: Add qual_signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_signal.test.
2016-11-18 00:11:27 +00:00
1658e9d4c6 Make -e fault= expressions cumulative
Change the way how subsequent -e fault= expressions are interpreted
to implement a cumulative behavior.  For example,
-e fault=file:when=3+ -e fault=chdir
now specifies that all chdir syscalls and 3+ file related syscalls
except chdir are subject for fault injection.

* syscall.c (qualify): Do not reset qual_vec for QUAL_FAULT.
* tests/fault_injection.test: Check it.
2016-11-17 15:44:21 +00:00
622af42dc3 tests: check syscall fault injection
* tests/fault_injection.c: New file.
* tests/fault_injection.test: New test.
* tests/fault_syntax.test: Likewise.
* tests/.gitignore: Add fault_injection.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add fault_injection.test and fault_syntax.test.
2016-11-16 17:27:46 +00:00
9cb6e03d4f Implement syscall fault injection
Introduce new -e fault=EXPR syntax that can be used to specify a subset
of syscalls that are subject of syscall fault injection, an error code
that has to be injected, and a frequency of injection.

The expression specifying syscall fault injection has the following
format: SET[:error=ERRNO][:when=FIRST[+[STEP]]]
where only SET is a required part and all the rest is optional.

The method used to implement syscall fault injection is the following:
on entering syscall the syscall number is substituted by an invalid
syscall number -1, and on exiting syscall the error code returned by
the kernel is substituted with the error code specified in the fault
expression.

This implementaion is based on the prototype developed
by Nahim El Atmani as a part of his GSoC 2016 strace project.

* defs.h (struct fault_opts): New forward declaration.
(struct tcb): Add fault_vec field.
(TCB_FAULT_INJ, QUAL_FAULT): New macros.
* strace.1: Document -e fault expression syntax.
* strace.c (usage): Mention -e fault expression.
(droptcb): Deallocate fault_vec member.
* syscall.c (qual_fault, arch_set_scno, arch_set_error): New prototypes.
(qual_options): Add "fault" option.
(struct fault_opts): New structure.
(num_faults): New variable.
(fault_vec): New array.
(syscall_fault_injected, tcb_fault_opts, reallocate_fault,
find_errno_by_name, qual_syscall_ex, strip_prefix, parse_fault_token,
parse_fault_expression, qual_fault, inject_syscall_fault_entering,
update_syscall_fault_exiting): New functions.
(qual_syscall): Use qual_syscall_ex.
(qualify_one): Add argument: a pointer to struct fault_opts, all callers
changed.  Copy struct fault_opts from the pointer to fault_vec.
Use reallocate_fault.
(qualify_scno, qualify_syscall_class, qualify_syscall_name): Add
argument: a pointer to struct fault_opts.
(qualify): Use reallocate_fault.  Do not check "all" class for
QUAL_FAULT qualifier.
(lookup_class): Check for "all" class.
(trace_syscall_entering): Use inject_syscall_fault_entering.
(trace_syscall_exiting): Use update_syscall_fault_exiting.  Clear
TCB_FAULT_INJ flag along with TCB_INSYSCALL.  Print " (INJECTED)" suffix
when the syscall has been injected successfully.
[ARCH_REGS_FOR_GETREGSET && !HAVE_GETREGS_OLD]
(ptrace_setregset): New function.
(ptrace_setregset_or_setregs): Define to ptrace_setregset.
[ARCH_REGS_FOR_GETREGS && !HAVE_GETREGS_OLD]
(ptrace_setregs): New function.
(ptrace_setregset_or_setregs): Define to ptrace_setregs.
[ptrace_setregset_or_setregs] (set_regs): New function.
Include "set_scno.c" and "set_error.c"
* NEWS: Mention this enhancement.
2016-11-16 17:26:58 +00:00
f1d0729f17 Implement arch specific methods of changing syscall number and error code
This introduces arch_set_error and arch_set_scno functions for each
supported architecture, needed to implement syscall fault injection.

* linux/aarch64/set_error.c: New file.
* linux/aarch64/set_scno.c: Likewise.
* linux/alpha/set_error.c: Likewise.
* linux/alpha/set_scno.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arc/set_scno.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/arm/set_scno.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/avr32/set_scno.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/bfin/set_scno.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/crisv10/set_scno.c: Likewise.
* linux/crisv32/set_error.c: Likewise.
* linux/crisv32/set_scno.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/hppa/set_scno.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/i386/set_scno.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/ia64/set_scno.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/m68k/set_scno.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/metag/set_scno.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/microblaze/set_scno.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/mips/set_scno.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/nios2/set_scno.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/or1k/set_scno.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/powerpc/set_scno.c: Likewise.
* linux/powerpc64/set_error.c: Likewise.
* linux/powerpc64/set_scno.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/riscv/set_scno.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/s390/set_scno.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh/set_scno.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sh64/set_scno.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc/set_scno.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/sparc64/set_scno.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/tile/set_scno.c: Likewise.
* linux/x32/set_error.c: Likewise.
* linux/x32/set_scno.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/x86_64/set_scno.c: Likewise.
* linux/xtensa/set_error.c: Likewise.
* linux/xtensa/set_scno.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2016-11-16 02:33:13 +00:00
05a3b0b518 cris: add syscall tables
The incomplete CRIS support introduced by commit v4.5.18-77-gea0e6e8
should not have been merged because it lacks essential parts, e.g.
syscall tables.

This change adds missing syscall tables for crisv10 and crisv32.

* linux/crisv10/syscallent.h: New file.
* linux/crisv32/syscallent.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
2016-11-16 02:32:43 +00:00
081b2a821b Introduce string_to_uint_ex and string_to_uint_upto functions
* defs.h (string_to_uint_ex): New prototype.
(string_to_uint_upto): New function, a thin wrapper around
string_to_uint_ex.
* util.c (string_to_uint_ex): New function.
(string_to_uint): Change into a thin wrapper around string_to_uint_upto.
* strace.c (init): Use string_to_uint_upto.
* syscall.c (qualify_scno, qual_signal, qual_desc): Use
string_to_uint_upto instead of string_to_uint.
2016-11-16 01:41:51 +00:00
0323fa3217 Split qual_syscall into separate functions
Split qual_syscall into qualify_scno, qualify_syscall_class,
and qualify_syscall_name.
This might be needed later to implement syscall fault injection.

* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
New functions.
(qual_syscall): Use them.
2016-11-16 01:41:51 +00:00
b299b3e611 xtensa: wire up new syscalls
* linux/xtensa/syscallent.h [342..347]: New entries.
2016-11-15 01:09:51 +00:00
5df31f90ec arc: wire up new syscalls
* linux/arc/syscallent.h [247, 248]: New entries.
2016-11-14 01:07:59 +00:00
24eb02da83 tests: fix potential compilation warning in ioctl_block.c
ioctl_block.c:48: warning: 'init_magic' defined but not used

* tests/ioctl_block.c (init_magic): Define only for
[BLKTRACESETUP && HAVE_STRUCT_BLK_USER_TRACE_SETUP].
2016-11-13 22:29:30 +00:00
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
13c467bf69 tests: fix "constant is too large" compilation warnings
alarm.c: In function 'main':
alarm.c:41: warning: integer constant is too large for 'long' type
aio.c: In function 'main':
aio.c:162: warning: integer constant is too large for 'long' type
btrfs.c: In function 'btrfs_test_sync_ioctls':
btrfs.c:202: warning: integer constant is too large for 'long' type
btrfs.c: In function 'btrfs_test_subvol_ioctls':
btrfs.c:289: warning: integer constant is too large for 'long' type
btrfs.c:290: warning: integer constant is too large for 'long' type
dup2.c: In function 'main':
dup2.c:12: warning: integer constant is too large for 'long' type
dup2.c:13: warning: integer constant is too large for 'long' type
dup3.c: In function 'main':
dup3.c:13: warning: integer constant is too large for 'long' type
dup3.c:14: warning: integer constant is too large for 'long' type
epoll_create.c: In function 'main':
epoll_create.c:12: warning: integer constant is too large for 'long' type
epoll_ctl.c: In function 'invoke_syscall':
epoll_ctl.c:14: warning: integer constant is too large for 'long' type
faccessat.c: In function 'main':
faccessat.c:13: warning: integer constant is too large for 'long' type
fchdir.c: In function 'main':
fchdir.c:12: warning: integer constant is too large for 'long' type
struct_flock.c: In function 'invoke_test_syscall':
struct_flock.c:48: warning: integer constant is too large for 'long' type
struct_flock.c: In function 'test_flock_einval':
struct_flock.c:58: warning: integer constant is too large for 'long' type
struct_flock.c:59: warning: integer constant is too large for 'long' type
fcntl64.c: In function 'test_flock64_einval':
fcntl64.c:44: warning: integer constant is too large for 'long' type
fcntl64.c:45: warning: integer constant is too large for 'long' type
fcntl.c: In function 'test_flock64_einval':
fcntl.c:44: warning: integer constant is too large for 'long' type
fcntl.c:45: warning: integer constant is too large for 'long' type
fdatasync.c: In function 'main':
fdatasync.c:12: warning: integer constant is too large for 'long' type
flock.c: In function 'main':
flock.c:13: warning: integer constant is too large for 'long' type
xstatx.c: In function 'main':
xstatx.c:255: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatfsx.c: In function 'main':
xstatfsx.c:113: warning: integer constant is too large for 'long' type
fsync.c: In function 'main':
fsync.c:12: warning: integer constant is too large for 'long' type
ftruncate64.c: In function 'main':
ftruncate64.c:39: warning: integer constant is too large for 'long' type
futimesat.c: In function 'main':
futimesat.c:52: warning: integer constant is too large for 'long' type
futimesat.c:59: warning: integer constant is too large for 'long' type
get_mempolicy.c: In function 'main':
get_mempolicy.c:83: warning: integer constant is too large for 'long' type
get_mempolicy.c:84: warning: integer constant is too large for 'long' type
get_mempolicy.c:85: warning: integer constant is too large for 'long' type
get_mempolicy.c:86: warning: integer constant is too large for 'long' type
getdents.c: In function 'main':
getdents.c:109: warning: integer constant is too large for 'long' type
getdents.c:110: warning: integer constant is too large for 'long' type
getdents.c:114: warning: integer constant is too large for 'long' type
getdents64.c: In function 'main':
getdents64.c:114: warning: integer constant is too large for 'long' type
getdents64.c:115: warning: integer constant is too large for 'long' type
getdents64.c:119: warning: integer constant is too large for 'long' type
xgetrlimit.c: In function 'main':
xgetrlimit.c:71: warning: integer constant is too large for 'long' type
ioctl_block.c:44: warning: integer constant is too large for 'long' type
ioctl_block.c: In function 'main':
ioctl_block.c:136: warning: integer constant is too large for 'long' type
ioctl_block.c:137: warning: integer constant is too large for 'long' type
ioctl_block.c:161: warning: integer constant is too large for 'long' type
ioctl_block.c:170: warning: integer constant is too large for 'long' type
ioctl_block.c:171: warning: integer constant is too large for 'long' type
ioctl_evdev.c:42: warning: integer constant is too large for 'long' type
ioctl_mtd.c:46: warning: integer constant is too large for 'long' type
ioctl_rtc.c:40: warning: integer constant is too large for 'long' type
ioperm.c: In function 'main':
ioperm.c:12: warning: integer constant is too large for 'long' type
ioctl_v4l2.c: In function 'main':
ioctl_v4l2.c:409: warning: integer constant is too large for 'long' type
ipc.c: In function 'ipc_call':
ipc.c:52: warning: integer constant is too large for 'long' type
kill.c: In function 'main':
kill.c:59: warning: integer constant is too large for 'long' type
kill.c:62: warning: integer constant is too large for 'long' type
kill.c:63: warning: integer constant is too large for 'long' type
kill.c:68: warning: integer constant is too large for 'long' type
linkat.c: In function 'main':
linkat.c:14: warning: integer constant is too large for 'long' type
linkat.c:15: warning: integer constant is too large for 'long' type
mbind.c: In function 'main':
mbind.c:41: warning: integer constant is too large for 'long' type
mbind.c:43: warning: integer constant is too large for 'long' type
mbind.c:44: warning: integer constant is too large for 'long' type
migrate_pages.c: In function 'main':
migrate_pages.c:41: warning: integer constant is too large for 'long' type
In file included from mkdirat.c:10:
umode_t.c: In function 'test_syscall':
umode_t.c:47: warning: integer constant is too large for 'long' type
mknod.c: In function 'call_mknod':
mknod.c:16: warning: integer constant is too large for 'long' type
mknod.c: In function 'main':
mknod.c:23: warning: integer constant is too large for 'long' type
mknod.c:49: warning: integer constant is too large for 'long' type
mknod.c:56: warning: integer constant is too large for 'long' type
mknodat.c:12: warning: integer constant is too large for 'long' type
mknodat.c: In function 'call_mknodat':
mknodat.c:17: warning: integer constant is too large for 'long' type
mknodat.c: In function 'main':
mknodat.c:24: warning: integer constant is too large for 'long' type
mknodat.c:50: warning: integer constant is too large for 'long' type
mknodat.c:57: warning: integer constant is too large for 'long' type
mmap.c: In function 'main':
mmap.c:51: warning: integer constant is too large for 'long' type
move_pages.c: In function 'print_stat_pages':
move_pages.c:139: warning: integer constant is too large for 'long' type
move_pages.c: In function 'print_move_pages':
move_pages.c:166: warning: integer constant is too large for 'long' type
move_pages.c: In function 'main':
move_pages.c:188: warning: integer constant is too large for 'long' type
mq_sendrecv.c: In function 'main':
mq_sendrecv.c:238: warning: integer constant is too large for 'long' type
mq_sendrecv.c:401: warning: integer constant is too large for 'long' type
mq_sendrecv.c:403: warning: integer constant is too large for 'long' type
nsyscalls.c: In function 'test_syscall':
nsyscalls.c:64: warning: integer constant is too large for 'long' type
nsyscalls.c:65: warning: integer constant is too large for 'long' type
nsyscalls.c:66: warning: integer constant is too large for 'long' type
nsyscalls.c:67: warning: integer constant is too large for 'long' type
nsyscalls.c:68: warning: integer constant is too large for 'long' type
nsyscalls.c:69: warning: integer constant is too large for 'long' type
preadv-pwritev.c: In function 'main':
preadv-pwritev.c:162: warning: comparison between signed and unsigned
prlimit64.c: In function 'main':
prlimit64.c:65: warning: integer constant is too large for 'long' type
prlimit64.c:70: warning: integer constant is too large for 'long' type
remap_file_pages.c: In function 'main':
remap_file_pages.c:42: warning: integer constant is too large for 'long' type
remap_file_pages.c:43: warning: integer constant is too large for 'long' type
remap_file_pages.c:45: warning: integer constant is too large for 'long' type
renameat.c: In function 'main':
renameat.c:15: warning: integer constant is too large for 'long' type
renameat.c:16: warning: integer constant is too large for 'long' type
rt_sigqueueinfo.c: In function 'main':
rt_sigqueueinfo.c:41: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c: In function 'k_tgsigqueueinfo':
rt_tgsigqueueinfo.c:45: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c:46: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c:47: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c: In function 'main':
rt_tgsigqueueinfo.c:67: warning: integer constant is too large for 'long' type
sendfile.c: In function 'main':
sendfile.c:110: warning: integer constant is too large for 'long' type
sendfile64.c: In function 'main':
sendfile64.c💯 warning: integer constant is too large for 'long' type
set_mempolicy.c: In function 'main':
set_mempolicy.c:129: warning: integer constant is too large for 'long' type
set_mempolicy.c:130: warning: integer constant is too large for 'long' type
setrlimit.c: In function 'main':
setrlimit.c:44: warning: integer constant is too large for 'long' type
socketcall.c: In function 'test_socketcall':
socketcall.c:58: warning: integer constant is too large for 'long' type
splice.c: In function 'main':
splice.c:41: warning: integer constant is too large for 'long' type
splice.c:42: warning: integer constant is too large for 'long' type
splice.c:45: warning: integer constant is too large for 'long' type
splice.c:46: warning: integer constant is too large for 'long' type
symlinkat.c: In function 'main':
symlinkat.c:12: warning: integer constant is too large for 'long' type
sync_file_range.c: In function 'main':
sync_file_range.c:42: warning: integer constant is too large for 'long' type
sync_file_range.c:43: warning: integer constant is too large for 'long' type
syslog.c: In function 'main':
syslog.c:14: warning: integer constant is too large for 'long' type
tee.c: In function 'main':
tee.c:41: warning: integer constant is too large for 'long' type
tee.c:42: warning: integer constant is too large for 'long' type
timer_create.c: In function 'main':
timer_create.c:52: warning: integer constant is too large for 'long' type
timer_create.c:84: warning: integer constant is too large for 'long' type
timer_create.c:85: warning: integer constant is too large for 'long' type
truncate64.c: In function 'main':
truncate64.c:41: warning: integer constant is too large for 'long' type
xgetrlimit.c: In function 'main':
xgetrlimit.c:71: warning: integer constant is too large for 'long' type
umode_t.c: In function 'test_syscall':
umode_t.c:46: warning: integer constant is too large for 'long' type
unlinkat.c: In function 'main':
unlinkat.c:13: warning: integer constant is too large for 'long' type
waitpid.c: In function 'main':
waitpid.c:43: warning: integer constant is too large for 'long' type
waitid.c: In function 'poison':
waitid.c:141: warning: integer constant is too large for 'long' type
xetpriority.c: In function 'main':
xetpriority.c:15: warning: integer constant is too large for 'long' type
xetpriority.c:19: warning: integer constant is too large for 'long' type
xetpriority.c:20: warning: integer constant is too large for 'long' type
xetpgid.c: In function 'main':
xetpgid.c:43: warning: integer constant is too large for 'long' type
xetpgid.c:47: warning: integer constant is too large for 'long' type
xetpgid.c:48: warning: integer constant is too large for 'long' type

(SLES 11SP4, i386)

* tests/alarm.c (main): Add proper suffix to integer constant.
* tests/aio.c (main): Likewise.
* tests/btrfs.c (btrfs_test_sync_ioctls, btrfs_test_subvol_ioctls): Likewise.
* tests/dup2.c (main): Likewise.
* tests/dup3.c (main): Likewise.
* tests/epoll_create.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Likewise.
* tests/faccessat.c (main): Likewise.
* tests/fchdir.c (main): Likewise.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval): Likewise.
* tests/fdatasync.c (main): Likewise.
* tests/flock.c (main): Likewise.
* tests/fstat64.c (SAMPLE_SIZE): Likewise.
* tests/fstat.c (SAMPLE_SIZE): Likewise.
* tests/fsync.c (main): Likewise.
* tests/ftruncate64.c (main): Likewise.
* tests/futimesat.c (main): Likewise.
* tests/get_mempolicy.c (main): Likewise.
* tests/getdents.c (main): Likewise.
* tests/getdents64.c (main): Likewise.
* tests/ioctl_block.c (lmagic, main): Likewise.
* tests/ioctl_evdev.c (lmagic): Likewise.
* tests/ioctl_mtd.c (lmagic): Likewise.
* tests/ioctl_rtc.c (lmagic): Likewise.
* tests/ioctl_v4l2.c (main): Likewise.
* tests/ioperm.c (main): Likewise.
* tests/ipc.c (ipc_call): Likewise.
* tests/kill.c (main): Likewise.
* tests/linkat.c (main): Likewise.
* tests/lstat64.c (SAMPLE_SIZE): Likewise.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/mbind.c (main): Likewise.
* tests/migrate_pages.c (main): Likewise.
* tests/mkdirat.c (TEST_SYSCALL_PREFIX_ARGS): Likewise.
* tests/mknod.c (call_mknod, main): Likewise.
* tests/mknodat.c (fd, call_mknodat, main): Likewise.
* tests/mmap.c (main): Likewise.
* tests/move_pages.c (print_stat_pages, print_move_pages): Likewise.
* tests/mq_sendrecv.c (main): Likewise.
* tests/nsyscalls.c (test_syscall): Likewise.
* tests/prlimit64.c (main): Likewise.
* tests/remap_file_pages.c (main): Likewise.
* tests/renameat.c (main): Likewise.
* tests/rt_sigqueueinfo.c (main): Likewise.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo, main): Likewise.
* tests/sendfile.c (main): Likewise.
* tests/sendfile64.c (main): Likewise.
* tests/set_mempolicy.c (main): Likewise.
* tests/setrlimit.c (main): Likewise.
* tests/socketcall.c (test_socketcall): Likewise.
* tests/splice.c (main): Likewise.
* tests/stat64.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/struct_flock.c (invoke_test_syscall, test_flock_einval): Likewise.
* tests/symlinkat.c (main): Likewise.
* tests/sync_file_range.c (main): Likewise.
* tests/syslog.c (main): Likewise.
* tests/tee.c (main): Likewise.
* tests/timer_create.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/umode_t.c (test_syscall): Likewise.
* tests/unlinkat.c (main): Likewise.
* tests/waitid.c (main): Likewise.
* tests/waitpid.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
* tests/xgetrlimit.c (main): Likewise.
* tests/xstatfsx.c (main) [CHECK_ODD_SIZE]: Likewise.
* tests/xstatx.c (main): Likewise.
2016-11-13 21:36:58 +00:00
35126cda20 tests: fix "comparison between signed and unsigned" compilation warnings
preadv-pwritev.c: In function 'main':
preadv-pwritev.c:162: warning: comparison between signed and unsigned
readv.c: In function 'main':
readv.c:148: warning: comparison between signed and unsigned
recvmsg.c: In function 'main':
recvmsg.c:148: warning: comparison between signed and unsigned

* tests/preadv-pwritev.c (main): Cast r_len to int.
* tests/readv.c (main): Likewise.
* tests/recvmsg.c (main): Likewise.
2016-11-13 19:30:11 +00:00
695545a8b3 syscall.c: refactor getregs_old fallback in get_regs
This change moves remaining arch specific getregs_old code into
appropriate arch subdirectories and removes unnecessary code
duplication.

* linux/getregs_old.h: New file.
* linux/powerpc/getregs_old.h: Likewise.
* linux/powerpc64/getregs_old.h: Likewise.
* linux/x86_64/getregs_old.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* syscall.c: Include "getregs_old.h".
[X86_64 || POWERPC]: Remove.
[ARCH_REGS_FOR_GETREGSET] (ptrace_getregset_or_getregs): Define
to ptrace_getregset.
[ARCH_REGS_FOR_GETREGS] (ptrace_getregset_or_getregs): Define
to ptrace_getregs.
(get_regs): Check for ptrace_getregset_or_getregs instead
of ARCH_REGS_FOR_GETREGSET and ARCH_REGS_FOR_GETREGS.  Use
ptrace_getregset_or_getregs instead of ptrace_getregset and
ptrace_getregs.  Check for HAVE_GETREGS_OLD instead of X86_64
and POWERPC.  Use use_getregs_old instead of getregset_support
and old_kernel.
2016-11-13 11:16:15 +00:00
e061d67dff Rename BUILD_BUG_ON_ZERO macro
In order to avoid name clash on distributions which decide to include
kernel headers instead of UAPI ones.  For example, on SLES 11SP4:

gcc -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux -I. -Wall -O2 -c net.c
In file included from /usr/include/linux/sysctl.h:25:0,
                 from /usr/include/linux/netfilter.h:6,
                 from /usr/include/linux/netfilter_arp.h:8,
                 from /usr/include/linux/netfilter_arp/arp_tables.h:14,
                 from net.c:60:
net.c: In function 'print_packet_mreq':
gcc_compat.h:59:27: error: negative width in bit-field '<anonymous>'
 # define MUST_BE_ARRAY(a) BUILD_BUG_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
                           ^
defs.h:76:53: note: in expansion of macro 'MUST_BE_ARRAY'
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
                                                     ^
net.c:747:22: note: in expansion of macro 'ARRAY_SIZE'
   if (mreq.mr_alen > ARRAY_SIZE(mreq.mr_address))
                      ^
due to the fact BUILD_BUG_ON_ZERO is already defined in <linux/kernel.h>.

* gcc_compat.h (BUILD_BUG_ON_ZERO): Rename to FAIL_BUILD_ON_ZERO.
(MUST_BE_ARRAY): Update usage.
2016-11-13 11:04:49 +00:00
c93f39ca5b syscall.c: factor out ptrace_getregs from get_regs
Move the code that calls ptrace(PTRACE_GETREGS) to a separate function.

* syscall.c (ptrace_getregs): New function.
(get_regs): Use it.
2016-11-12 21:29:58 +00:00
1d886734c7 syscall.c: rename get_regset to ptrace_getregset
* syscall.c (get_regset): Rename to ptrace_getregset.
(get_regs): Rename get_regset to ptrace_getregset.
2016-11-12 21:29:58 +00:00
a00648aa2b m68k: switch to PTRACE_GETREGS
* Makefile.am (EXTRA_DIST): Add linux/m68k/arch_regs.h, remove
linux/m68k/get_syscall_result.c.
* linux/m68k/arch_regs.c (m68k_d0, ARCH_PC_PEEK_ADDR): Don't
define.
(m68k_regs, m68k_usp_ptr, ARCH_PC_REG, ARCH_REGS_FOR_GETREGS):
Define.
* linux/m68k/arch_regs.h: New file.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use m68k_usp_ptr.
* linux/m68k/get_error.c (get_error): Use m68k_regs.d0.
* linux/m68k/get_scno.c (arch_get_scno): Use m68k_regs.orig_d0.
* linux/m68k/get_syscall_args.c (get_syscall_args): Use m68k_regs.
* linux/m68k/get_syscall_result.c: Remove.
2016-11-12 21:29:58 +00:00
f8d3d18f39 tests: do not run old_mmap test on m68k
* tests/old_mmap.c: Skip test on m68k.
2016-11-12 21:29:58 +00:00
5e33997559 syscall.c: introduce reallocate_vec function
This might be needed later to implement syscall fault injection.

* syscall.c (reallocate_vec): New function.
(reallocate_qual): Use it.
2016-11-12 21:29:58 +00:00
5d2293dea6 Fix prototypes of qual_desc, qual_signal, and qual_syscall functions
* syscall.c (qual_desc, qual_signal, qual_syscall): Fix prototypes.
(struct qual_options): Fix type of "qualify" member.
2016-11-12 21:29:58 +00:00
f793bda073 linux/x32/syscallent.h: fix syscallent array initialisation on x32
Why gcc didn't complain about it? It is definitely an index clash.

* linux/x32/syscallent.h: Change initializer indices for empty records from
[327 ... 511] to [329 ... 511].
2016-11-12 21:03:55 +03:00
b5b750b289 Introduce upoke function
This will be needed to implement fault injection on those architectures
that lack PTRACE_SETREGSET/PTRACE_SETREGS support.

* defs.h (upoke): New prototype.
* upoke.c: New file.
* Makefile.am (libstrace_a_SOURCES): Add it.
2016-11-11 17:53:44 +00:00
d3fc04ebdf Update ioctl entries from linux 4.9
* linux/32/ioctls_inc_align32.h: Update from linux v4.9 using ioctls_gen.sh.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* NEWS: Mention this.
2016-11-11 17:53:28 +00:00
916b0c3594 Update NEWS 2016-11-10 22:44:49 +03:00
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
98b944bb66 Introduce ALIGNOF macro
* gcc_compat.h (ALIGNOF): New macro.
2016-11-10 22:44:49 +03:00
fdd97aac53 util: add support for QUOTE_0_TERMINATED in user_style to ptrintstr_ex
This enables printing size-limited (expectedly) ASCIZ strings.

This is done by increasing umoven size limit for sized strings by one
byte above max_strlen (enabling copying possible NUL byte in case len is
greater than max_strlen) and decreasing size after copying by one byte
in case QUOTE_0_TERMINATED is set (due to user_style or usage of len of
-1).  As a result, there is one excess byte for string_quote in case
QUOTE_0_TERMINATED is set so string_quote can check for NUL termination
of strings up to size bytes in size (which is len or max_strlen, whatever
is greater).

The catch here is that when string is not properly NUL-terminated and
QUOTE_0_TERMINATED is provided in user_style and len is less than
max_strlen then last non-NUL byte is not printed.  But ellipsis is
printed instead, being indication that string is not terminated
properly.  QUOTE_OMIT_TRAILING_0 should be used instead in case this
behaviour is not intended.

* util.c (printstr_ex): Copy one excess byte in case of non-negative len
provided and it is more than max_strlen; handle case of max_strlen of 0
in case QUOTE_0_TERMINATED is set separately; check for need of printing
ellipsis by checking resulting style against QUOTE_0_TERMINATED.
2016-11-10 22:44:18 +03:00
62218efa6c tests: check decoding of mq_{notify,open,timedreceive,timedsend,unlink}
* tests/mq_sendrecv.c: New file.
* tests/mq_sendrecv-read.c: Likewise.
* tests/mq_sendrecv-write.c: Likewise.
* tests/mq_sendrecv.test: New test.
* tests/mq_sendrecv-read.test: Likewise.
* tests/mq_sendrecv-write.test: Likewise.
* tests/.gitignore: Add mq_sendrecv, mq_sendrecv-read,
and mq_sendrecv-write.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(mq_sendrecv_LDADD, mq_sendrecv_read_LDADD, mq_sendrecv_write_LDADD):
New variables.
(DECODER_TESTS): Add mq_sendrecv.test, mq_sendrecv-read.test,
and mq_sendrecv-write.test.
2016-11-09 04:27:53 +03:00
64ac9ee785 tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work
* tests/times.c (main): Skip if clock_gettime consistenly returns zero
for CLOCK_PROCESS_CPUTIME_ID timer.
2016-11-08 15:32:47 +00:00
015aee943e tests: add tests for perf_event_attr structure decoding in perf_event_open
* configure.ac: Add checks for presence of various fields of struct
perf_event_attr defined in kernel headers.
* tests/perf_event_open.c: New file.
* tests/perf_event_open_unabbrev.c: Likewise.
* tests/perf_event_open.test: New test.
* tests/perf_event_open_unabbrev.test: Likewise.
* tests/.gitignore: Add perf_event_open, perf_event_open_unabbrev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add perf_event_open.test, perf_event_open_unabbrev.test.
2016-10-31 11:29:20 +03:00
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
48dd98ba81 tests: fix name spelling 2016-10-31 04:59:10 +03:00
fd992caa81 tests: fix name spelling 2016-10-30 22:54:27 +00:00
3d6436d7cb Update NEWS 2016-10-30 22:53:52 +00:00
06c8831cf4 Fix typo in comment in tests/quotactl.h 2016-10-31 01:32:45 +03:00
5ca0852f5f tests: fix invalid pointer checks in quotactl test
* tests/quotactl.h (bogus_special, bogus_addr): Move it...
* tests/quotactl.c (main): ... here; remove static and const qualifiers,
use memory after tail_alloc instead of magic numbers.
* tests/quotactl-xfs.c (main): Likewise.
2016-10-31 00:49:29 +03:00
3fb04c6aec tests: fix invalid pointer checks in getcpu test
* test/getcpu.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.
2016-10-31 00:49:29 +03:00
d6fd023b17 tests: fix invalid pointer checks in request_key test
* test/request_key.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.
2016-10-31 00:49:29 +03:00
64de69186e tests: fix invalid pointer checks in add_key test
* test/add_key.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.
2016-10-31 00:49:29 +03:00
c1c3fed7c9 statfs: use printxval_search
* print_statfs.c (print_statfs_type): Use printxval_search for printing
FS magic xlat value.
2016-10-31 00:49:28 +03:00
cdf0885fe0 util: add printing helper for sorted xlat arrays
* util.c (printxval_searchn): New function.
* defs.h (printxval_searchn): New prototype.
(printxval_search): New helper macro useful in conjunction with static
xlat arrays.
2016-10-31 00:49:28 +03:00
48252db2a2 defs: add check for argument being array to ARRAY_SIZE macro
* gcc_compat.h [GNUC_PREREQ(3, 0)] (BUILD_BUG_ON_ZERO): New macro.
(SAME_TYPE, MUST_BE_ARRAY): Likewise.
* defs.h (ARRAY_SIZE): Add MUST_BE_ARRAY for build-time type check.
2016-10-31 00:49:28 +03:00
a1a42e1f0d tests: check decoding of oldfstat, oldlstat, and oldstat syscalls
* tests/oldfstat.c: New file.
* tests/oldlstat.c: Likewise.
* tests/oldstat.c: Likewise.
* tests/oldfstat.test: New test.
* tests/oldlstat.test: Likewise.
* tests/oldstat.test: Likewise.
* tests/xstatx.c [!OLD_STAT]: define OLD_STAT to 0.
(print_stat) [OLD_STAT]: Print predefined values for
st_blksize/st_blocks.
(print_stat): Check for !OLD_STAT in nanosecond precision checks.
(main) [OLD_STAT]: Ignore EOVERFLOW.
(main): Test for successful rc in returned size value check;
print address only on non-successful rc.
* tests/.gitignore: Add oldfstat, oldlstat, and oldstat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add oldfstat.test, oldlstat.test, and oldstat.test.
2016-10-31 00:49:28 +03:00
7497b1c700 tests: additional tests of stat decoders
* tests/fstatx.c (IS_FSTAT): Define to 1.
* tests/fstatat64.c [__GLIBC__ && __sparc64__] (TEST_BOGUS_STRUCT_STAT):
Define to 0.
* tests/xstatx.c [!IS_STAT] (IS_STAT): Define to 0.
[!TEST_BOGUS_STRUCT_STAT] (TEST_BOGUS_STRUCT_STAT): Define to 1.
(main): Add a check for non-available pointer and a check
for block device file.
* tests/statx.sh: Add tracing of /dev/full file, specify alignment.
* tests/fstat.test: Specify alignment.
2016-10-31 00:49:28 +03:00
3815851894 tests: prepare for additional tests of stat decoders
PRINT_SYSCALL_HEADER/PRINT_SYSCALL_FOOTER now contain open/close brace
pair in order to save errno.  PRINT_SYSCALL_FOOTER now uses sprintrc for
printing rc/errno.

* tests/xstatx.c: Include <errno.h>.
(main): Update PRINT_SYSCALL_FOOTER call convention.
* tests/fstatat.c (PRINT_SYSCALL_HEADER): Add errno saving.
(PRINT_SYSCALL_FOOTER): Restore errno.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.
2016-10-31 00:49:28 +03:00
9c260b9e87 Provide a safe definition of O_ACCMODE
Some libcs e.g. musl are guilty of messing up with O_ACCMODE.

* open.c (O_ACCMODE): Redefine to 03.
2016-10-29 02:54:02 +03:00
0277a64986 Implement dumping of mq_timedsend and mq_timedreceive syscalls
* syscall.c (dumpio): Add SEN_mq_timedreceive and SEN_mq_timedsend.
2016-10-29 02:54:02 +03:00
2b50662498 mq: print msg_prio as a pointer, not as an immediate value
* mq.c (SYS_FUNC(mq_timedreceive)): Use printnum_int for printing
msg_prio argument.
2016-10-29 02:54:02 +03:00
26690859f6 mq: print msg payload only in case of successful mq_timedreceive call
Also, use u_rval for determining message size.

* mq.c (SYS_FUNC(mq_timedreceive)): Check for syserror and non-negative
u_rval before calling printstr on msg_ptr argument, or use printaddr otherwise;
provide u_rval as string size.
2016-10-29 02:54:02 +03:00
19bd947891 mq: Print msg_prio parameter as unsigned int in mq_timedsend
* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%ld"
to "%u", cast argument value to unsigned int.
2016-10-29 02:54:02 +03:00
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
0302a3186e mq: Print msg_len parameter as kernel_ulong_t
* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%lu"
to "%llu", use getarg_ull for obtaining msg_len parameter.
(SYS_FUNC(mq_timedreceive)): Likewise.
2016-10-29 02:54:02 +03:00
56b7651212 print_mq_attr: fix typo
* print_mq_attr.c (printmqattr): Print field name "mq_curmsgs"
instead of "mq_curmsg".
* tests/mq.expected: Update expected output.
2016-10-29 02:54:02 +03:00
34ccf12e07 mq: print mqdes parameter as int
It is defined as int in <linux/posix_types.h>.

* mq.c (SYS_FUNC(mq_timedsend)): Use "%d" conversion specifier instead
of "%ld" for printing mqdes (0th parameter), cast parameter value to
int.
(SYS_FUNC(mq_timedreceive)): Likewise.
(SYS_FUNC(mq_notify)): Likewise.
(SYS_FUNC(mq_getsetattr)): Likewise.
2016-10-29 02:54:02 +03:00
0a37603ef6 mq: curly brackets usage fix
Use curly brackets for denoting blocks in both of if branches if they
are already used in at least one branch.
2016-10-29 02:54:02 +03:00
9a4eb55465 tests: additional name_to_handle_at/open_by_handle_at checks
* tests/file_handle.c: Additional name_to_handle_at/open_by_handle_at
checks.
2016-10-29 02:54:02 +03:00
ad7f4354d5 tests: require only presence of __NR_* macros for file_handle test
* tests/file_handle.c: replace fcntl.h include with asm/unistd.h.
[MAX_HANDLE_SZ]: change to defined __NR_name_to_handle_at
&& defined __NR_open_by_handle_at, add fcntl.h include
[!MAX_HANDLE_SZ]: Add definition of MAX_HANDLE_SZ and struct
file_handle.
(main): Change name_to_handle_at and open_by_handle_at calls to syscall.
2016-10-29 02:54:01 +03:00
d6ee2bba25 tests: proper type conversion in keyctl test
* tests/keyctl.c (printarg): Add intermediate conversion of arg to uintptr_t
since kernel_ulong_t may be of different size.
2016-10-29 02:54:01 +03:00
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
88cac72e95 tests: check decoding of kexec_file_load and kexec_load syscalls
* tests/kexec_file_load.c: New file.
* tests/kexec_load.c: Likewise.
* tests/kexec_file_load.test: New test.
* tests/kexec_load.test: Likewise.
* tests/.gitignore: Add kexec_file_load and kexec_load.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kexec_file_load.test and kexec_load.test.
2016-10-29 02:54:01 +03:00
108d574c54 kexec: use widen_to_ulong since kexec_load has compat on x32/n32
Curiously, kexec_load uses compat on x32/n32, so its parameters should
be 4 bytes in size on these ABIs.

* kexec.c (SYS_FUNC(kexec_load)): Use widen_to_ulong for casting
parameters to proper size on x32/n32.
2016-10-29 02:54:01 +03:00
920b4d5114 kexec: fix zeroing of higher bits of flags parameter in kexec_load
* kexec.c (SYS_FUNC(kexec_load)): Perform type conversion before
negation in order to properly negate higher bits of KEXEC_ARCH_MASK.
2016-10-29 02:54:01 +03:00
41c468b26c kexec: add printing of struct kexec_segment field names
* kexec.c (print_seg): Print field names of the kexec_segment structure.
2016-10-29 02:54:01 +03:00
5732d38e1a tests: check decoding of unshare syscall
* tests/unshare.c: New file.
* tests/unshare.test: New test.
* tests/.gitignore: Add unshare.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unshare.test.
2016-10-29 02:54:01 +03:00
0cffca31df clone: use kernel_ulong_t as type of flags parameter of unshare call
Kernel declares flags parameter as long and looks like x32 and n32
implement no compat for this call.

* clone.c (SYS_FUNC(unshare)): Use getarg_ull and printflags64 for
obtaining and parsing flags parameter.
2016-10-29 02:54:01 +03:00
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
3fa672fa7a tests: check decoding of setns syscall
* tests/setns.c: New file.
* tests/setns.test: New test.
* tests/.gitignore: Add setns.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setns.test.
2016-10-29 02:54:01 +03:00
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
aece0f417f tests: check non-verbose capget/capset output
* tests/caps-abbrev.awk: New file.
* tests/caps-abbrev.c: Likewise.
* tests/caps-abbrev.test: New test.
* tests/.gitignore: Add caps-abbrev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add caps-abbrev.test.
(EXTRA_DIST): Add caps-abbrev.awk.
2016-10-29 02:54:01 +03:00
f84b99b353 tests: additional capset decoder checks
* tests/caps.awk: Add patterns for additional checks.
* tests/caps.c: Implement additional checks.
2016-10-29 02:54:01 +03:00
73d66c84d5 tests: check decoding of fanotify_init syscall
* tests/fanotify_init.c: New file.
* tests/fanotify_init.test: New test.
* tests/.gitignore: Add fanotify_init.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fanotify_init.test.
2016-10-29 02:54:01 +03:00
e3645be4d6 tests: some additional checks for fanotify_mark
* tests/fanotify_mark.c (do_call): New function.
(main): Use it.
2016-10-29 02:54:01 +03:00
f3a326c85b tests: use sprintrc in tests/fanotify_mark.c
* tests/fanotify.c (main): Use sprintrc.
2016-10-29 02:54:01 +03:00
3b31d33ada tests: check decoding of {init,finit,delete}_module syscalls
* tests/delete_module.c: New file.
* tests/finit_module.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/init_module.c: Likewise.
* tests/delete_module.test: New test.
* tests/finit_module.test: Likewise.
* tests/init_module.test: Likewise.
* tests/.gitignore: Add delete_nodule, finit_module, and init_module.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add delete_module.test, finit_module.test,
and init_module.test.
(EXTRA_DIST): Add init_delete_module.h.
2016-10-29 02:54:01 +03:00
dad07434a8 bjm: use getarg_ull for retrieving first two parameters of init_module syscall
As init_module has no compat wrapper, its first parameter is a pointer
and the second is length, they both have the same size as kernel_ulong_t
type.

* bjm.c (SYS_FUNC(init_module)): Obtain first two parameters using
getarg_ull, print address argument using printaddr_ull, print length
argument using "%llu" conversion specifier.
2016-10-29 02:54:01 +03:00
b61f3251c0 Add printaddr_ull, change printaddr into a thin wrapper around it
* defs.h (printaddr_ull): New prototype.
(printaddr): Change to a static inline wrapper around printaddr_ull.
* util.c (printaddr): Rename to printaddr_ull, change argument type
to unsigned long long, change print format to %#llx.
2016-10-29 02:54:01 +03:00
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
d71973c31f Remove parser of create_module syscall
Since create_module syscall is present only in kernels before Linux 2.6
and strace does not support those kernels, there is no use to keep this
parser any longer.

* bjm.c (SYS_FUNC(create_module)): Remove.
* linux/dummy.h (sys_create_module): Add stub alias.
2016-10-29 02:54:01 +03:00
6a1632c7e1 tests: check decoding of process_vm_readv and process_vm_writev syscalls
* tests/process_vm_readv.c: New file.
* tests/process_vm_readv_writev.c: Likewise.
* tests/process_vm_writev.c: Likewise.
* tests/process_vm_readv.test: New test.
* tests/process_vm_writev.test: Likewise.
* tests/.gitignore: Add process_vm_readv and process_vm_writev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add process_vm_readv.test and process_vm_writev.test.
(EXTRA_DIST): Add process_vm_readv_writev.c.
2016-10-29 02:54:00 +03:00
5fbb3d299d process_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Use widen_to_ulong for local_iovcnt,
renote_iovcnt, and flags parameters.
2016-10-28 18:40:11 +00:00
714d68127a defs: add widen_to_ulong macro
This is similar to widen_to_long, but for unsigned values.

* defs.h (widen_to_ulong): New macro.
2016-10-28 18:40:11 +00:00
d44a77ca58 process_vm: print pid argument as int
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change conversion specifier for pid
argument from "%ld" to "%d".
2016-10-28 18:40:11 +00:00
44ffbf0adc process_vm: remove syserror check for iovec printing
This check had been done by print_array inside tprint_iov anyway.

* process_vm.c (SYS_FUNC(process_vm_readv)): Use tprint_iov_upto for
printing local_iov; do not check for syserror, provide decode_iov
parameter to tprint_iov{,_upto} based on its value instead.
2016-10-28 18:40:11 +00:00
030b61c92f io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_upto
This enables printing of iovec arrays even in case of failed syscall
(failed syscall doesn't mean that iovec itself is inaccessible and
useless).  One caveat here is that we should explicitly provide proper
IOV_DECODE_* value based on syserror value in case printing is performed
on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting
when syserror is up, since this may be called by code which tries to
print iovec containing local data, which should be perfectly accessible
(on the other hand, there are no cases of such behaviour at the moment).

Since iovecs themselves are printed even if syscall has failed now,
preadv test is updated to reflect this.  It is notable, though, that this
is the only place where this case is checked.

* io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror
instead of umoven_or_printaddr as umoven_func parameter.
(SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value
based on syserror(tcp) value.
* scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise.
* tests/preadv.c: Update expected output for the case when preadv
with singe-item iovec failed.
2016-10-28 18:40:11 +00:00
a980c9ebbd Move umoven_or_printaddr_ignore_syserror to util.c
* defs.h (umoven_or_printaddr_ignore_syserror): New prototype.
* v4l2.c (umoven_or_printaddr_ignore_syserror): Move ...
* util.c: ... here.
2016-10-28 18:40:10 +00:00
b0c4a35ac1 v4l2: check for verbose flag in umoven_or_printaddr_ignore_syserror
This change makes behaviour of umoven_or_printaddr_ignore_syserror in
line with umoven_or_printaddr when verbose flag is disabled.

* v4l2.c (umoven_or_printaddr_ignore_syserror): Simply call printaddr
when verbose flag is unset.
2016-10-28 18:40:10 +00:00
a49ba91595 tests: check decoding of kcmp syscall
* tests/kcmp.c: New file.
* tests/kcmp.test: New test.
* tests/.gitignore: Add kcmp.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kcmp.test.
2016-10-28 18:40:10 +00:00
63c27873b6 kcmp: print index parameters of unknown commands as kernel_ulong_t
* lookup_dcookie.c (SYS_FUNC(kcmp)): Use getarg_ull to retrieve idx1
and idx2, print them using %#llx format in case of unknown command.
2016-10-28 18:40:10 +00:00
8b0f48ee06 tests: check decoding of inotify family syscalls
* tests/inotify.c: New file.
* tests/inotify_init1.c: Likewise.
* tests/inotify.test: New test.
* tests/inotify_init1.test: Likewise.
* tests/.gitignore: Add inotify and inotify_init1.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add inotify.test and inotify_init1.test.
2016-10-27 23:31:44 +00:00
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
ebdf6914f1 tests: check decoding of lookup_dcookie syscall
* tests/lookup_dcookie.c: New file.
* tests/lookup_dcookie.test: New test.
* tests/.gitignore: Add lookup_dcookie.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add lookup_dcookie.test.
2016-10-27 23:31:42 +00:00
2119f8d6b0 lookup_dcookie: print len parameter as kernel_ulong_t
It is size_t and without compat on x32/n32.

* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Change conversion
specifier from "%lu" to "%llu", use getarg_ull for len argument
retrieval.
2016-10-27 21:44:58 +00:00
6e6c11d9dd defs.h: add offsetofend macro
Analogous to offsetof but returns structure offset after the specified
field.  Useful for checking whether specific field is present in obtained
data or specifying amount of data to copy based on the (last) field needed.

* defs.h (offsetofend): New macro.
2016-10-26 04:20:06 +03:00
d212c95b84 tests: move ARG_STR and similar macros to tests.h
* tests/add_key.c (_STR, ARG_STR): Move ...
* tests/tests.h: ... here.
(ARG_ULL_STR): New macro.
* tests/keyctl.c (ARG_STR): Remove.
* tests/quotactl.h (ARG_STR): Likewise.
* tests/request_key.c (ARG_STR): Likewise.
2016-10-26 04:18:34 +03:00
f0fb4e9de4 tests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h
* tests/fadvise.h (LL_PAIR, LL_VAL_TO_PAIR): Move ...
* tests/tests.h: ... here.
2016-10-26 04:13:24 +03:00
eabfa5e9e0 tests: check decoding of ioprio_get and ioprio_set syscalls
* tests/ioprio.c: New file.
* tests/ioprio.test: New test.
* tests/.gitignore: Add ioprio.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioprio.test.
2016-10-26 01:06:09 +00:00
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
06934669ea tests: move fill_memory and fill_memory_ex into a separate file
* tests/fill_memory.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/quotactl.h (fill_memory, fill_memory_ex): Move to fill_memory.c.
* tests/tests.h (fill_memory, fill_memory_ex): New prototypes.
2016-10-26 01:06:09 +00:00
ab648c804c tests: add period parameter to fill_memory_ex
* tests/quotactl.h (fill_memory_ex): Add period parameter,
use it as a divisor in non-constant part of value.
(fill_memory): Specify period of 0x80 to fill_memory_ex call.
* tests/quotactl-xfs.c (main): Likewise.
2016-10-26 01:06:09 +00:00
e0916b6dc3 Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.14-1.
* strace.spec.in: Likewise.
2016-10-05 06:19:41 +00:00
e1fec334db Prepare for 4.14 release
* NEWS: Update for 4.14 release.
2016-10-04 18:19:20 +00:00
c1a0b67db5 Generate SEN numbers in a locale independent order
* generate_sen.sh: Sort SEN numbers using C collation rules.
2016-10-04 08:19:27 +00:00
7082acc0e3 Assume that offsetof is provided by stddef.h
According to C89, <stddef.h> shall define offsetof macro.

* defs.h: Include <stddef.h> unconditionally.
[!offsetof]: Remove.
2016-10-04 00:16:44 +00:00
7bce0e9fd4 tests: check decoding of add_key, keyctl, and request_key syscalls
* tests/add_key.c: New file.
* tests/keyctl.c: Likewise.
* tests/request_key.c: Likewise.
* tests/add_key.test: New test.
* tests/keyctl.test: Likewise.
* tests/request_key.test: Likewise.
* tests/.gitignore: Add add_key, keyctl, and request_key.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add add_key.test, keyctl.test, and request_key.test.
2016-10-03 23:50:57 +00:00
27aaa29d73 keyctl: use kernel_ulong_t and getarg_ull instead of long
This potentially fixes keyctl decoder for x32 personality.

* keyctl.c (keyctl_update_key, keyctl_read_key, keyctl_instantiate_key,
keyctl_instantiate_key_iov, keyctl_dh_compute): Change addr and len
arguments to kernel_ulong_t.  Print len using %llu format.
(keyctl_keyring_search): Change addr1 and addr2 arguments
to kernel_ulong_t.
(print_dh_params): Change addr argument to kernel_ulong_t.
(SYS_FUNC(keyctl)): Retrieve arguments via getarg_ull, pass them
to the appropriate handlers.
2016-10-03 23:48:48 +00:00
66db159f7e keyctl: fix parameter signedness
* keyctl.c (keyctl_update_key): Change addr and len arguments
to unsigned.
(keyctl_read_key): Likewise.
(keyctl_instantiate_key): Likewise.
(keyctl_instantiate_key_iov): Likewise.
(keyctl_dh_compute): Likewise.
(keyctl_keyring_search): Change addr1 and addr2 arguments to unsigned.
(keyctl_chown_key): Change user and group arguments to unsigned.
(keyctl_get_persistent): Change uid argument to unsigned.
2016-10-03 21:50:45 +00:00
9f294b39f5 keyctl: use printstr_ex for printing out buffer
keyctl_read_key had subtle bug by treating out buffer in KEYCTL_READ
as NUL-terminated, which is not true.  We fix it by adding parameter to
keyctl_read_key signalising whether buffer is NUL-terminated and using
printstr_ex for printing (expectedly) NUL-terminated strings.

* keyctl.c (keyctl_read_key): Add has_nul parameter.  Do not use -1 as
string len.  Use printstr_ex for buffer output with user style depending
on has_nul value.
(SYS_FUNC(keyctl)): Specify has_nul parameter to keyctl_read_key
by comparing cmd value with KEYCTL_READ.
2016-10-03 21:50:45 +00:00
ee70a1baac Add printstr_ex which allows for providing user quotation style
This is useful for providing QUOTE_OMIT_TRAILING_0 and maybe other
flags.

* defs.h (printstr_ex): New prototype.
(printstr): Change to a wrapper around printstr_ex with zero user style.
* util.c (printstr): Rename to ...
(printstr_ex) ... new function, add user_style argument which is or'ed
with computed style.
2016-10-03 21:50:33 +00:00
5cf68f97d5 util: add quote_string flag signalising that string is NUL-terminated
It is useful in cases strings with size provided are expected to be
NUL-terminated but are not trustworthy enough to call just plain
printstr(str, -1).

* defs.h (QUOTE_OMIT_TRAILING_0): New constant definition.
* util.c (string_quote): Swallow terminating NUL if
QUOTE_OMIT_TRAILING_0 is set.
2016-10-03 19:28:15 +00:00
04ec08ab62 keyctl: add support for KEYCTL_DH_COMPUTE
* keyctl.c (struct keyctl_dh_params): New structure.
(print_dh_params, keyctl_dh_compute): New functions.
(SYS_FUNC(keyctl)): Add support for KEYCTL_DH_COMPUTE cmd value.
2016-10-03 19:27:38 +00:00
820adffcd9 x86_64: fix is_negated_errno for x32 personality
* syscall.c (is_negated_errno) [X86_64]: Do not truncate kernel_ulong_t
to uint32_t for x32 personality.
2016-10-03 15:51:49 +00:00
7b6d66f215 tests: fix another regression in qual_syscall.test
* tests/qual_syscall.test: Fix pattern_nonabbrev_verbose pattern.
(check_output_mismatch): Print the pattern that triggered match failure.
2016-10-03 12:13:19 +00:00
4503da0816 Use err_name, print unrecognized errno values as numbers
* syscall.c (trace_syscall_exiting): Use err_name() instead
of open-coding it.  Print unrecognized errno values using %lu format
instead of ERRNO_%lu as the latter prodices an invalid constant.
2016-10-03 12:03:03 +00:00
7211bdb982 keyctl: print errno name in KEYCTL_REJECT in case it is available
* keyctl.c (keyctl_reject_key): Get errno string via err_name
and print it if it is not NULL.
2016-10-03 12:03:03 +00:00
6fdb10455a Add function for getting errno string
* defs.h (err_name): New prototype.
* syscall.c (err_name): New function.
2016-10-03 11:54:49 +00:00
ba63d8a166 struct tcb: change the type of u_error field from int to unsigned long
This is the type actually used for the error code on architectures
that use a dedicated register.

* defs.h (struct tcb): Change the type of u_error to unsigned long.
* syscall.c (trace_syscall_exiting): Change the type of u_error variable
to unsigned long, print it using %lu format, drop no longer needed
explicit cast to unsigned long.
(saved_u_error): Change type to unsigned long.
2016-10-03 11:48:55 +00:00
cce5aaef1e Use tprints instead of tprintf in a few more places
* btrfs.c (btrfs_print_qgroup_inherit, btrfs_print_tree_search,
btrfs_ioctl): Replace tprintf with tprints for printing strings without
format specifiers.
* net.c (print_group_req): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* term.c (decode_termios, decode_termio): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.
2016-10-02 19:19:28 +00:00
7fa26e1712 keyctl: do not print comma for KEYCTL_SESSION_TO_PARENT command
Since this command doesn't have any additional arguments, the comma does
not needed.  Since this is the only command which lacks additional
arguments, it's better to add special case for it rather than add
printing of comma to all other commands.

* keyctl.c (SYS_FUNC(keyctl)): Add check for command not being
KEYCTL_SESSION_TO_PARENT when printing comma dividing cmd argument
from the rest.
2016-10-02 19:19:15 +00:00
f5278a7d94 keyctl: use getarg_ull for printing generic arguments
Otherwise it is erroneous on x32, for example.

* keyctl.c (SYS_FUNC(keyctl)): Use "%#llx" conversion specifier
and getarg_ull for fallback argument printing.
2016-10-02 19:19:15 +00:00
db098f9a3d keyctl: use printuid for printing UID/GID
UID/GID are unsigned except special -1 value (which is also special in
context of specific keyctl commands), so special printing function
should be used.

* keyctl.c (keyctl_chown_key, keyctl_get_persistent): Use printuid
instead of printf with "%d" conversion for printing UID/GID.
2016-10-02 19:19:15 +00:00
f3228d3268 io: handle data_size of -1 as unlimited data in print_iovec
Otherwise it can be depleted and print_iovec starts printing empty
strings.

* io.c (print_iovec): Interpret c->data_size of -1 as unlimited data
and do not decrease it in this case.
2016-10-02 19:19:15 +00:00
e8f36ec0c5 tests: fix typo in qual_syscall.test
Fix test regression introduced by commit v4.13-225-g55334ef.

* tests/qual_syscall.test: Fix typo.
2016-10-01 14:27:00 +00:00
a606d3a74a Enhance -e abbrev=set, -e raw=set, and -e verbose=set
Enhance abbrev=, raw=, and verbose= to accept the same syntax as trace=.
For example, this allows such syntax as -e verbose=file.

* syscall.c (lookup_class): Define before qual_syscall.
(qualify): Move the loop based on lookup_class ...
(qual_syscall): ... here.
* tests/qual_syscall.test: Check it.
2016-09-30 13:43:48 +00:00
55334effed tests/qual_syscall.test: rewrite without ls
* tests/qual_syscall.test: Invoke ./umovestr instead of ls.
Update expected output.
2016-09-30 13:09:36 +00:00
a2402cea20 tests: check decoding of fadvise64 and fadvise64_64 syscalls
* tests/fadvise.h: New file.
* tests/fadvise64.c: Likewise.
* tests/fadvise64_64.c: Likewise.
* tests/fadvise64.test: New test.
* tests/fadvise64_64.test: Likewise.
* tests/.gitignore: Add fadvise64 and fadvise64_64.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fadvise64.test, fadvise64_64.test.
(EXTRA_DIST): Add fadvise.h.
2016-09-28 03:00:10 +00:00
54a4a1a918 mips o32: implement fetching the 7th subcall argument
* syscall.c [LINUX_MIPSO32] (decode_mips_subcall): Fetch the last
argument of 7-arg syscalls.
2016-09-28 03:00:10 +00:00
1929c2216a x32: use proper decoder for fadvise64 syscall
fadvise_64_64 decoder used before this change prints different sign
of the "len" argument (loff_t vs size_t).

* linux/x32/syscallent.h (fadvise64): Replace SEN(fadvise64_64)
with SEN(fadvise64).
2016-09-28 03:00:10 +00:00
2c871eb566 fadvise: use getarg_ull for obtaining len argument of fadvise64 syscall
Since its type is size_t, it is 64-bit wide on x32 and special care
should be taken in order to obtain it.

* fadvise.c (SYS_FUNC(fadvise64)): Use getarg_ull for obtaining value
of "len" syscall argument.
2016-09-28 03:00:10 +00:00
b93991d381 util: add getarg_ll and getarg_ull functions
These allow retrieving specific argument in full taking into account
peculiarities of runtimes which employ tcp->ext_arg (e.g. x32).

* defs.h (getarg_ll, getarg_ull): New prototypes.
* util.c (getarg_ll, getarg_ull): New functions.
(printargs): Use getarg_ull.
2016-09-28 03:00:10 +00:00
11f7093560 fadvise: change printing of len argument to unsigned in fadvise64 syscall
The kernel declares fadvise64 as
long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);

* fadvise.c (SYS_FUNC(fadvise64)): Change conversion specifier from
"%ld" to "%lu" for printing len argument since kernel expects argument
of type size_t.
2016-09-28 03:00:10 +00:00
cfa1b17619 sh64, sparc64: use proper decoder for fadvise64_64 syscall
This change is no-op yet, but things will change when decoder
of fadvise64 syscall get fixed.

* linux/sh64/syscallent.h (fadvise64_64): Replace SEN(fadvise64)
with SEN(fadvise64_64).
* linux/sparc64/syscallent.h (fadvise64_64): Likewise.
2016-09-28 03:00:10 +00:00
dbb76606dc tests: check decoding of fallocate syscall
* configure.ac (AC_CHECK_FUNCS): Add fallocate.
* tests/fallocate.c: New file.
* tests/fallocate.test: New test.
* tests/.gitignore: Add fallocate.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fallocate.test.
2016-09-28 03:00:07 +00:00
5af0e0dab8 fallocate: change print format of offset and len arguments to signed
Since types of these arguments are off_t and kernel actually expects
signed values in order to fail when negative values are provided,
lets display these values as signed.

* fallocate.c (SYS_FUNC(fallocate)): Change conversion specifier for
printing "offset" and "len" syscall arguments from %llu to %lld.
2016-09-27 18:02:07 +00:00
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
ec3761429e tests: check decoding of getcpu syscall
* tests/getcpu.c: New file.
* tests/getcpu.test: New test.
* tests/.gitignore: Add getcpu.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getcpu.test.
2016-09-27 18:01:09 +00:00
aefb09b9cc tests: make magic values in ioctl_block test distinctive
* tests/ioctl.block (init_magic): Add iterator value to magic value
in order to enable detection of potential 4-byte aligned shifts.
2016-09-27 17:55:35 +00:00
db27247d84 tests: additional getcwd decoding checks
* tests/getcwd.c (main): Add more checks for getcwd arguments decoding.
2016-09-27 17:53:50 +00:00
81b63834dd tests: check decoding of quotactl syscall
* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, linux/quota.h,
and sys/quota.h.
* tests/.gitignore: Add quotactl, quotactl-v, quotactl-xfs,
and quotactl-xfs-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add quotactl.test, quotactl-v.test,
quotactl-xfs.test, and quotactl-xfs-v.test.
(EXTRA_DIST): Add quotactl.h
* quotactl.h: New file.
* quotactl.c: Likewise.
* quotactl-v.c: Likewise.
* quotactl-xfs.c: Likewise.
* quotactl-xfs-v.c: Likewise.
* quotactl.test: New test.
* quotactl-v.test: Likewise.
* quotactl-xfs.test: Likewise.
* quotactl-xfs-v.test: Likewise.
2016-09-27 08:11:06 +00:00
ee9e7a7e5b quota: ensure that names of structure fields are printed properly
* quota.c (PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): New macros.
(decode_cmd_data): Use them to print structure fields.
2016-09-27 01:08:38 +00:00
906dc4aaa1 Enhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
* defs.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Add support of char types.
* tests/tests.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Likewise.
2016-09-27 00:57:28 +00:00
340909fd00 quota: move Q_QUOTAON handling to subcommand switch statement
* quota.c (SYS_FUNC(quotactl)): Move handling of Q_QUOTAON subcommand ...
(decode_cmd_data): ... here.
2016-09-27 00:57:28 +00:00
fd5195dccd quota: remove legacy subcommand decoding support code
Support for these quota subcommands by linux kernels has been dropped
long time ago (between 2.5.16 and 2.5.17), so lets drop it in order
to minimize amount of code which should be subjected to testing and
structured conversion.

* quota.c (struct v1_dqblk, struct v2_dqblk, struct v2_dqinfo,
struct v1_dqstats, struct v2_dqstats): Remove.
(decode_cmd_data): Remove handling of Q_V1_GETQUOTA, Q_V1_SETQUOTA,
Q_V2_GETQUOTA, Q_V2_SETQUOTA, Q_V2_GETINFO, Q_V2_SETINFO, Q_V1_GETSTATS,
and Q_V2_GETSTATS subcommands.
(SYS_FUNC(quotactl)): Remove handling of Q_V1_QUOTAON subcommand.
2016-09-27 00:57:28 +00:00
abde34546d quota: add realtime block limits fields to XFS disk quota printing code
* quota.c (decode_cmd_data): Add printing of d_rtb_hardlimit
and d_rtb_softlimit fields to struct xfs_dqblk printing code.
2016-09-27 00:57:27 +00:00
46b89571f5 quota: add packed attribute to struct if_dqblk definition
Since the only difference between 32-bit and 64-bit environments
regarding this structure is its padding, lets just add packed attribute
to its definition instead of going full mpers.

* quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED.
2016-09-27 00:57:27 +00:00
4cb1124902 quota: Add decoding for Q_XQUOTARM subcommand
* quota.c (decode_cmd_data): Add Q_XQUOTARM handling to subcommand
  switch.
2016-09-27 00:57:27 +00:00
01bb1d206a quota: add dispatch of SYNC subcommands
Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway.

* quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand
dispatch switch since id/addr arguments for these subcommands are known
to be ignored.
2016-09-27 00:57:27 +00:00
3b3fd71546 quota: add missing prefixes to struct field names
* quota.c (decode_cmd_data): Print field names in accordance with
their definition.
2016-09-27 00:57:27 +00:00
f8b50ef4ea quota: fix indentation inside subcommand dispatching switch statement 2016-09-27 00:57:20 +00:00
51330fd434 quota: avoid printing id argument for those commands that ignore it
As id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO,
Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF,
Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, and
Q_V2_GETSTATS subcommands, do not print it for these subcommands.

* quota.c (decode_cmd_data): Add id argument parameter, add printing
of id argument for Q_GETQUOTA, Q_SETQUOTA, Q_GETNEXTQUOTA,
Q_V1_GETQUOTA, Q_V1_SETQUOTA, Q_V2_GETQUOTA, Q_V2_SETQUOTA,
Q_XGETQUOTA, Q_XGETNEXTQUOTA, Q_XSETQLIM, and unknown subcommands.
(SYS_FUNC(quotactl)): Remove printing of id argument, pass it
to decode_cmd_data.
2016-09-27 00:57:20 +00:00
e87379b820 quota: use printuid for id parameter printing
* quota.c (SYS_FUNC(quotactl)): Since id call argument is used for
user/group/project ID which all have special semantics for -1,
print it the same way as UIDs are printed.
2016-09-27 00:57:20 +00:00
0cda3e0823 quota: display quota subcommand as a macro
* quota.c (SYS_FUNC(quotactl)): Replace disjunction of two xlat values
(which also lacks shift of the left part) with QCMD macro call.
2016-09-27 00:57:14 +00:00
632cc8a697 tests: use VERBOSE macro in waitid and waitid-v tests
* tests/waitid-v.c (VERBOSE_RUSAGE): Remove.
(VERBOSE): Define to 1.
* tests/waitid.c (sprint_rusage): Check VERBOSE instead
of VERBOSE_RUSAGE.
2016-09-26 15:24:27 +00:00
5cc7036061 tests: use VERBOSE macro in wait4 and wait4-v tests
* tests/wait4-v.c (VERBOSE_RUSAGE): Remove.
(VERBOSE): Define to 1.
* tests/wait4.c (sprint_rusage): Check VERBOSE instead
of VERBOSE_RUSAGE.
2016-09-26 15:24:26 +00:00
074c630705 tests: use VERBOSE macro in msg_control and msg_control-v tests
* tests/msg_control-v.c (VERBOSE_MSGHDR): Remove.
(VERBOSE): Define to 1.
* tests/msg_control.c (print_fds, print_ip_opts): Check VERBOSE instead
of VERBOSE_MSGHDR.
2016-09-26 15:24:25 +00:00
0c5b09c658 tests: use VERBOSE macro in mmsg_name and mmsg_name-v tests
* tests/mmsg_name-v.c (VERBOSE_MMSGHDR): Remove.
(VERBOSE): Define to 1.
* tests/mmsg_name.c (test_mmsg_name): Check VERBOSE instead
of VERBOSE_MMSGHDR.
2016-09-26 15:24:23 +00:00
a392aaa796 tests: use VERBOSE macro in ioctl_rtc and ioctl_rtc-v tests
* tests/ioctl_rtc-v.c (VERBOSE_IOCTL): Remove.
(VERBOSE): Define to 1.
* tests/ioctl_rtc.c (print_rtc_time): Check VERBOSE instead
of VERBOSE_IOCTL.
2016-09-26 15:24:22 +00:00
aa95ec7648 tests: use VERBOSE macro in ioctl_evdev and ioctl_evdev-v tests
* tests/ioctl_evdev-v.c (VERBOSE_IOCTL): Remove.
(VERBOSE): Define to 1.
* tests/ioctl_evdev.c: Check VERBOSE instead of VERBOSE_IOCTL.
2016-09-26 15:24:01 +00:00
0400e2ca7d tests: use VERBOSE macro in execveat and execveat-v tests
* tests/execveat-v.c (VERBOSE_EXECVEAT): Remove.
(VERBOSE): Define to 1.
* tests/execveat.c (main): Check VERBOSE instead of VERBOSE_EXECVEAT.
2016-09-26 15:23:48 +00:00
68beed808a tests: use VERBOSE macro in execve and execve-v tests
* tests/execve-v.c (VERBOSE_EXECVE): Remove.
(VERBOSE): Define to 1.
* tests/execve.c (main): Check VERBOSE instead of VERBOSE_EXECVE.
2016-09-26 15:23:25 +00:00
91eb1eddb0 tests: add VERBOSE macro
Introduce VERBOSE macro (defaults to 0) that is expected to be defined
to 1 by code testing "strace -v" output.

* tests/tests.h [!VERBOSE] (VERBOSE): New macro.
2016-09-26 15:23:18 +00:00
212a444bdc decode_open: print the mode argument when O_TMPFILE flag is set
O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.

* open.c (STRACE_O_TMPFILE): New macro.
(decode_open): Print the mode argument when O_TMPFILE flag is set.
* tests/open.c (main): Check it.
Fixes RH#1377846.
2016-09-20 20:55:56 +00:00
0918a4c3a2 tests: use sprintrc in tests/ptrace.c
* tests/ptrace.c (errstr): New static variable.
(do_ptrace): Initialize it using sprintrc.
(test_peeksiginfo, main): Use errstr.
2016-09-20 15:17:37 +00:00
b9bac78553 tests: use sprintrc in tests/netlink_protocol.c
* tests/netlink_protocol.c (main): Use sprintrc.
2016-09-20 12:29:35 +00:00
99f41c592d tests: use sprintrc in tests/fchownat.c
* tests/fchownat.c (main): Use sprintrc.
2016-09-20 00:48:57 +00:00
48ba1de869 tests: use sprintrc in tests/fchmodat.c
* tests/fchmodat.c (main): Use sprintrc.  Add more fchmodat decoding tests.
2016-09-20 00:23:10 +00:00
e9bfa4e406 tests: use sprintrc in tests/fchmod.c
* tests/fchmod.c (main): Use sprintrc.  Add more fchmod decoding tests.
* tests/fchmod.test: Update the value specified for strace -a parameter.
2016-09-20 00:23:10 +00:00
ac563cff02 tests: use sprintrc in tests/getgroups.c
* tests/getgroups.c (main): Use sprintrc.
2016-09-20 00:23:10 +00:00
fe1a225459 tests: use sprintrc in tests/setgroups.c
* tests/setgroups.c (main): Use sprintrc.
2016-09-20 00:23:05 +00:00
24f6345505 tests/utime.c: rewrite without assert
* tests/utime.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.
2016-09-19 19:51:37 +00:00
c7cd262a06 tests/xattr.c: rewrite without assert
* tests/xattr.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.
2016-09-19 19:51:37 +00:00
1caf9f296b tests: use sprintrc in tests/xchownx.c
* tests/xchownx.c (main): Do not include <errno.h>.  Use sprintrc.
2016-09-19 19:51:37 +00:00
8870b9e831 tests/xstatfsx.c: fix potential errno clobbering
* tests/xstatfsx.c (main): Use sprintrc.
2016-09-19 19:51:37 +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
43e85a6648 tests: fix whitespace for explicit type casts in futex test 2016-09-15 20:05:44 +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
1ae660572f tests: workaround limited semctl implementation in musl
musl libc forwards semctl command argument for 8 known commands only,
for all the rest it passes 0 instead.

* tests/ipc_sem.c (main): Update semctl expected output.
2016-09-13 21:18:17 +00:00
1bc727fc2f tests: add more IPC decoding checks
* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
commands) checks.
* tests/ipc_sem.c: Additional semget and semctl checks.
* tests/ipc_shm.c: Additional shmget and shmctl checks.
* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
* tests/semop.test: Add explicit -e parameter in order to trace both
semop and semtimedop.
* tests/shmxt.c: Additional shmat and shmdt checks.
2016-09-13 17:21:20 +00:00
ecc9fc1e49 .mailmap: add addresses of Dr. David Alan Gilbert
* .mailmap: Add both addresses of Dr. David Alan Gilbert here to avoid
duplications in CREDITS file.
2016-09-12 23:38:20 +00:00
61bf3050f3 .mailmap: add canonical name for Eugene Syromyatnikov
This is needed due to apparent deviation in spelling of commit author
name in several commits.

* .mailmap: Add canonical name for Eugene Syromyatnikov.
2016-09-12 23:33:46 +00:00
7f6f692916 Update generic ioctl entries from linux 4.8
* linux/64/ioctls_inc.h: Update from linux v4.8 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
2016-09-12 15:34:27 +00:00
07eb711ec6 x32: update ioctl entries from linux 4.8
* linux/x32/ioctls_inc0.h: Update from linux v4.8 using ioctls_gen.sh.
2016-09-12 13:55:59 +00:00
7e8314eb34 maint: update for linux 4.8
* maint/ioctls_sym.sh: Add workarounds for linux/atm_zatm.h and
xen/evtchn.h files.
2016-09-12 13:55:59 +00:00
378a47e80a tests: use sprintrc_grep in tests/ipc_shm.c
* tests/ipc_shm.c (main): Use sprintrc_grep.
2016-09-12 10:30:22 +00:00
3138893026 tests: use sprintrc_grep in tests/ipc_sem.c
* tests/ipc_sem.c (main): Use sprintrc_grep.
2016-09-12 09:27:58 +00:00
adffd04424 tests: use sprintrc_grep in tests/ipc_msg.c
* tests/ipc_msg.c (main): Use sprintrc_grep.
2016-09-11 00:04:16 +00:00
961a541ab4 tests: use sprintrc in tests/chmod.c
* tests/chmod.c (main): Use sprintrc.  Add more chmod decoding tests.
2016-09-10 22:58:40 +00:00
06847fe282 ipc: fix printing of nsops argument of semop and semtimedop syscalls
According to POSIX, nsops argument of semop syscall has type size_t,
but the kernel treats nsops argument of semop and semtimedop syscalls
as unsigned int.

* ipc_sem.c (tprint_sembuf_array): Change type of "count" argument
from unsigned long to unsigned int, print it using %u format.
2016-09-09 22:18:11 +00:00
84de545d73 tests/aio.c: bring indentation in conformance with the rest of the file 2016-09-09 22:18:11 +00:00
083123860b tests: use predefined constant in aio_context_t checks in aio test
Also fix io_cancel and io_destroy checks which did not check correct
printing of context argument properly.

* tests/aio.c (main): Update syscall checks in order to use newly
defined bogus_ctx constant.
2016-09-09 22:18:11 +00:00
a92ba46c55 Mark io_setup and io_destroy as memory mapping related syscalls
As io_setup syscall allocates some memory using do_mmap_pgoff, and
io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
flag for all sysentries of io_setup and io_destroy using the following
oneliner:
sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h

* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.
2016-09-09 02:38:32 +00:00
f6c70f9f19 travis: add x86 musl
* .travis.yml (matric): Add musl-gcc/x86.
* travis-build.sh [TARGET == x86]: Specify --target along with --build
to configure.
* travis-install.sh [CC == musl-gcc && TARGET == x32]: Add -mx32 to $CC.
[CC == musl-gcc && TARGET == x86]: Add -m32 to $CC.  Specify --build
and --target to musl configure invocation.
2016-09-08 22:56:25 +00:00
3351924396 tests: use PRI__*64 macros in aio test
It was incorrectly assumed that __*64 types are long long on all
platforms, despite strace having specially crafted macros in order
to handle precisely this architecture discrepancy.
The commit fixes this oversight.

* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
specifiers for __*64-typed values.
2016-09-08 20:04:20 +00:00
047c42e7c8 ipc: fix printing of integer arguments
* ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int
by the kernel, cast it to int and print it using %d format.
* ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise,
for semid argument.
(SYS_FUNC(semget)): Likewise, for nsems argument.
(SYS_FUNC(semctl)): Likewise, for semid and semnum arguments.
* ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument.
* ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise.
2016-09-08 16:40:50 +00:00
7b93574bc7 ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
is __kernel_key_t (i.e. int), cast key_t argument to int
and print it using %#x format.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* tests/ipc_msg.c (main): Test it.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
2016-09-08 16:26:48 +00:00
f4b7ac23b9 tests: add more sched_getattr and sched_setattr decoding checks
* tests/sched_xetattr.c (main): Add more sched_getattr and sched_setattr
decoding checks.
2016-09-08 12:33:44 +00:00
0797de9efe tests: change type of sched_nice field to signed in sched_xetattr test
Kernel headers declare this field as s32, and strace prints it with %d
specifier.

* tests/sched_xetattr.c (main): Change type of sched_nice field of struct
sched_attr to int32_t, update format specifiers accordingly.
2016-09-08 12:33:44 +00:00
6d995ae68b tests: add sprintrc_grep function to libtests
New sprintrc_grep function is sprintrc function equivalent suitable for
tests where grep-base pattern matching is employed.

* tests/tests.h (sprintrc_grep): New prototype.
* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
(sprintrc_ex): New function, renamed from sprintrc and updated to
support different formats.
(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.
2016-09-08 01:37:18 +00:00
ee7d47f4d6 tests: perform more strict structure allocation in sched_xetattr test
Use tail_alloc with precise size of the structure.

* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
Rename sched to sched_attr.  Change type of sched_attr to struct
pointer.  Use tail_alloc for sched_attr allocation, update printf
statements accrodingly.
2016-09-08 01:37:14 +00:00
e3ed9f557c tests: split long lines in sched_xetattr test
* tests/sched_xetattr.c (main): Split long lines.
2016-09-08 01:34:12 +00:00
9b95549a25 tests/aio.c: fix for x32 personality
* tests/aio.c (main): Do not pass 64-bit aio_context_t to io_submit
and io_getevents until strace learns how to print 64-bit pointers on x32
and on x86_64 for x32 personality.
2016-09-07 13:17:59 +00:00
ed292f62d6 aio: print aio_context_t as a pointer type
As aio_context_t is treated by the kernel as a pointer,
print it using printaddr.

* aio.c (SYS_FUNC(io_setup)): Print the pointer to aio_context_t
argument using printnum_ptr.
(SYS_FUNC(io_destroy), SYS_FUNC(io_submit), SYS_FUNC(io_cancel),
SYS_FUNC(io_getevents)): Print aio_context_t argument using printaddr.
* tests/aio.c (sprint_aio_context_t): Remove.
(main): Update expected output.
2016-09-07 13:01:29 +00:00
460c6253c4 tests/aio.c: rewrite without assert
* tests/aio.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.
2016-09-07 01:44:50 +00:00
851ac444f4 tests: add more aio decoding checks
* tests/aio.c (sprint_aio_context_t): New function.
(main): Use it; add more checks.
2016-09-06 16:07:14 +00:00
ea7adc3c4f tests: add suffix and cast to 64-bit constants in aio test
This helps to avoid warnings like
"integer constant is too large for ‘long’ type"
reported by some versions of gcc on 32-bit platforms.

* tests/aio.c (main): Add ULL suffix to 64-bit constants
and cast them to unsigned long.
2016-09-06 09:06:24 +00:00
06d0a0eaa3 tests: check decoding of perf_event_open syscall
* tests/perf_event_open.c: New file.
* tests/perf_event_open.test: New test.
* tests/.gitignore: Add perf_event_open.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add perf_event_open.test.
2016-09-05 19:58:00 +00:00
af0d956078 Makefile.am: use pwd instead of realpath
* Makefile.am (CODE_COVERAGE_GENHTML_OPTIONS): Use standard pwd(1)
instead of less widespread realpath(1) utility from GNU coreutils.
2016-09-05 19:52:57 +00:00
b5d7a0b7cf tests: use sprintrc in tests/xetpriority.c
* tests/xetpriority.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
b177783770 tests: use sprintrc in vhangup.test
* tests/vhangup.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
60d5765b5a tests: use sprintrc in tests/sockname.c
* tests/sockname.c (test_sockname_syscall): Use sprintrc.
2016-09-05 15:58:35 +00:00
e0a886d378 tests: use sprintrc in signalfd4.test
* tests/signalfd4.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
a46700d697 tests: use sprintrc in setrlimit.test
* tests/setrlimit.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
746d6eb2e2 tests: use sprintrc in set_mempolicy.test
* tests/set_mempolicy.c (main, print_nodes): Use sprintrc.
2016-09-05 15:58:35 +00:00
416896888d tests: use sprintrc in openat.test
* tests/openat.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
f7352b73a2 tests: use sprintrc in open.test
* tests/open.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
1b03fa4ab8 tests: use sprintrc in move_pages.test
* tests/move_pages.c (print_stat_pages, print_move_pages): Use sprintrc.
2016-09-05 15:58:35 +00:00
79582ae9af tests: use sprintrc in mlockall.test
* tests/mlockall.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
ef62ce49a1 tests: use sprintrc in mlock.test
* tests/mlock.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
1b36107cc2 tests: use sprintrc in epoll_create1.test
* tests/epoll_create1.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00
df00cad32e tests: fix printing of min_nr and nr arguments of io_getevents syscall
* tests/aio.c (main): Change output format for min_nr and nr arguments
in io_getevents check to %ld, cast these arguments to long.
2016-09-05 15:58:35 +00:00
afcbaaf050 tests: use sprintrc for return code output in aio test
* tests/aio.c (main): Use sprintrc for return code output.
2016-09-05 15:58:35 +00:00
25463ec93e tests: add more tests for ched_rr_get_interval decoding
* tests/sched_rr_get_interval.c (main): Check decoding of invalid
timespec pointer and successful syscall invocation.
2016-09-05 15:58:35 +00:00
2fdb64efd6 tests: use sprintrc for return code output in sched_rr_get_interval test
* tests/sched_rr_get_interval.c (main): Use sprintrc for return code
output.
2016-09-05 15:58:35 +00:00
7890a1e208 tests: add more tests for sched_getscheduler and sched_xetscheduler
* tests/sched_xetscheduler.c (main): Check for decoding of invalid PID
in sched_getscheduler and sched_setscheduler, invalid address
of sched_param structure, and invalid policy value.
2016-09-05 15:58:35 +00:00
88d0a427ed tests: use sprintrc for return code output in sched_xetscheduler test
* tests/sched_xetscheduler.c (main): Use sprintrc for return code output.
2016-09-05 15:58:35 +00:00
2b962b26a0 aio: use printfd for fd printing
struct iocb contains two fields with fd semantics: aio_fildes and
aio_resfd.  It is quite reasonable to use the appropriate function for
printing them (apart from just "%d").

* aio.c (print_common_flags): Add struct tcb pointer to parameter list;
use printfd for printing aio_resfd field.
(print_iocb_header): Add struct tcb pointer to parameter list;
use printfd for printing aio_fildes field.
(print_iocb): Provide tcp argument to print_iocb_header
and print_common_flags.
(SYS_FUNC(io_cancel)): Likewise.
2016-09-05 15:08:40 +00:00
724c623596 sh64: wire up new syscalls
* linux/sh64/syscallent.h [380..393]: New entries.
2016-09-05 13:05:38 +00:00
596c63dead sh: wire up new syscalls
* linux/sh/syscallent.h [369..382]: New entries.
2016-09-02 21:04:49 +00:00
5ff4be2bd2 avr32: wire up preadv2 and pwritev2 syscalls
* linux/avr32/syscallent.h [326]: Add preadv2 entry.
[327]: Add pwritev2 entry.
2016-09-05 13:04:29 +00:00
0c766339fe tests: check decoding of readahead syscall
* configure.ac (AC_CHECK_FUNCS): Add readahead.
* tests/readahead.c: New file.
* tests/readahead.test: New test.
* tests/.gitignore: Add readahead.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add readahead.test.
2016-09-05 01:31:14 +00:00
6f9aefde21 tests: move sprintrc function to libtests
* tests/tests.h (sprintrc): New prototype.
* tests/futex.c (sprintrc): Move to ...
* tests/sprintrc.c: ... new file.
* tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c.
2016-09-02 17:42:42 +00:00
8bb9f473e4 tests/futex: add support to sprintrc for return codes other than 0 and -1
* tests/futex.c (sprintrc): Print the actual return code provided,
not just "0".  Check snprintf return code.
2016-09-02 17:21:14 +00:00
243e1a909c tests/futex: increase sprintrc static buffer size
* tests/futex.c (sprintrc): Increase buffer size from 256 to 4096.
2016-09-02 17:20:04 +00:00
100a7f2f8d tests/futex: rename retstr to sprintrc
* tests/futex.c (retstr): Rename to sprintrc.
(main): Convert all retstr calls to sprintrc.
2016-09-02 17:19:17 +00:00
680d0e960c readahead: fix print format for the "count" argument
According to documentation and kernel's syscalls.h, its type is size_t,
so "%lu" format should be used instead of "%ld".

* readahead.c (SYS_FUNC(readahead)): Fix conversion specifier
for the "count" argument.
2016-09-01 15:18:11 +00:00
db4ef238bd tests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll
Use zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
instead of explicit casts with unpredictable sign extension semantics.

* tests/xstatx.c (print_time, main): Use zero_extend_signed_to_ull
instead of explicit cast.
(print_stat): Use zero_extend_signed_to_ull and
sign_extend_unsigned_to_ll instead of explicit casts.
2016-08-31 16:31:53 +00:00
ca7c8952ea tests: add sign_extend_unsigned_to_ll macro
* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.
2016-08-31 16:09:24 +00:00
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
78b0755828 Remove HAVE_SIGACTION checks
The syscall parsers guarded by HAVE_SIGACTION check have to be compiled
regardless of libc sigaction function availability.

* configure.ac (AC_CHECK_FUNCS): Remove sigaction.
* signal.c: Remove HAVE_SIGACTION checks.
2016-08-30 17:44:33 +00:00
c47beb7091 Remove obsolescent autoconf macro AC_TYPE_SIGNAL
All supported systems are expected to have C89 conforming sematics.

* configure.ac (AC_TYPE_SIGNAL): Remove.
2016-08-30 17:38:37 +00:00
a7857e50e4 Remove obsolescent autoconf macro AC_C_CONST
All supported systems are expected to have the 'const' keyword.

* configure.ac (AC_C_CONST): Remove.
2016-08-30 17:38:37 +00:00
c965bec3a1 tests: check decoding of futex syscall
* tests/futex.c: New file.
* tests/futex.test: New test.
* tests/.gitignore: Add futex.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add futex.test.
2016-08-30 17:38:26 +00:00
d02a91dd2c futex: do not pretend <linux/futex.h> is included
As configure.ac does not check for linux/futex.h, HAVE_LINUX_FUTEX_H is
never defined and therefore the inclusion of <linux/futex.h> guarded by
HAVE_LINUX_FUTEX_H makes no sense.

Moreover, <linux/futex.h> used to have an incorrect definition
of FUTEX_WAIT_BITSET_PRIVATE and FUTEX_WAKE_BITSET_PRIVATE:
since kernel commit v2.6.24-6320-gcd68998 where these definitions
were initially introduced and up to v2.6.31-7082-gf8d1e54 where they
were finally fixed these macros had been incorrectly defined via
FUTEX_WAIT_BITS and FUTEX_WAKE_BITS instead of FUTEX_WAIT_BITSET
and FUTEX_WAKE_BITSET, and these incorrect definitions made their way
into some distributions still in use.

* futex.c [HAVE_LINUX_FUTEX_H]: Remove.
2016-08-30 17:29:28 +00:00
110da33aff futex: avoid printing val when it is not used by the futex command
This is analogous to timeout argument omitting in FUTEX_WAKE_BITSET
command.

* futex.c (SYS_FUNC(futex)): Remove common printing of val argument.
Add printing of val argument for all futex commands except
FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI.
2016-08-30 17:29:28 +00:00
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
ebeae24de4 futex: fix formatting of unknown command argument
Use alternate form for printing hexadecimal numbers to avoid confusion.
Use printaddr to print uaddr as the latter is interpreted as a pointer
in all currently supported futex operations.

* futex.c (SYS_FUNC(futex)): Fix formatting of unknown command
argument.
2016-08-30 15:53:51 +00:00
3e0e10532d futex: add handling of FUTEX_FD command
Since obsolete FUTEX_FD command is known and used to have some expected
argument format, print FUTEX_FD using that format.

* futex.c (SYS_FUNC(futex)): Handle FUTEX_FD command.
2016-08-30 15:53:51 +00:00
a3e1ad344b futex: fix formatting of val3 hexadecimal argument
* futex.c (SYS_FUNC(futex)): In FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET,
print hexadecimal val3 argument in alternate form to avoid confusion.
2016-08-30 15:53:51 +00:00
bfa22a596f futex: fix FUTEX_WAKE_OP compare function mask
According to the initial and current (v4.7) kernel implementations,
in FUTEX_WAKE_OP case the compare function does not have
FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits starting with bit 24.

* futex.c (SYS_FUNC(futex)): Do not print FUTEX_OP_OPARG_SHIFT
for 27th bit of val3 in FUTEX_WAKE_OP case.
2016-08-30 15:53:51 +00:00
b80894cf07 tests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c
* bootstrap: Add -DMPERS_IS_$(MPERS_NAME) to ARCH_MFLAGS.
* tests/xstatx.c [USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC.
[USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC.
[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC.
[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC.

Based on patch by James Clarke <jrtc27@jrtc27.com>.
2016-08-30 15:50:36 +00:00
ae914db459 Remove redundant check for PTRACE_LISTEN availability
As ptrace.h already ensures that PTRACE_LISTEN is defined,
there is no need to check this fact in other places.

* strace.c (ptrace_restart): Do not check that PTRACE_LISTEN is defined.
2016-08-30 09:12:06 +00:00
e2ea606a60 Remove unused autoconf macro AC_TYPE_GETGROUPS
strace code does not use GETGROUPS_T.

* configure.ac (AC_TYPE_GETGROUPS): Remove.
2016-08-30 00:56:13 +00:00
730c49fb2a Remove unused autoconf macro AC_TYPE_MODE_T
strace code already redefines mode_t.

* configure.ac (AC_TYPE_MODE_T): Remove.
2016-08-30 00:56:04 +00:00
b4a32f9e57 Use PTRACE_SUNDETACH everywhere on SPARC and SPARC64
SPARC has a different PTRACE_DETACH value correctly defined in
sys/ptrace.h, but linux/ptrace.h clobbers it with the standard one.
PTRACE_SUNDETACH is also defined to the correct value by sys/ptrace.h,
so use that instead.

* strace.c (detach) [SPARC]: Move redefinition of PTRACE_DETACH
to PTRACE_SUNDETACH ...
* ptrace.h [SPARC || SPARC64]: ... here.
2016-08-30 00:48:36 +00:00
fcfdf89b8e Remove obsolescent autoconf macro AC_HEADER_STDC
All systems supported by strace are expected to have C89 conforming
header files.

* configure.ac (AC_HEADER_STDC): Remove.
2016-08-29 16:18:11 +00:00
79396167dd Remove unneeded autoconf macro AC_HEADER_DIRENT
strace code already includes <dirent.h> unconditionally.

* configure.ac (AC_HEADER_DIRENT): Remove.
2016-08-29 16:09:57 +00:00
39888f9358 Remove unneeded autoconf macro AC_HEADER_STDBOOL
strace code assumes C99.

* configure.ac (AC_HEADER_STDBOOL): Remove.
* defs.h: Include <stdbool.h> unconditionally.
2016-08-28 00:03:14 +00:00
5670786bcd Remove obsolescent autoconf macro AC_HEADER_STAT
No systems supported by strace are expected to have the bug workarounded
by AC_HEADER_STAT macro.

* configure.ac (AC_HEADER_STAT): Remove.
2016-08-27 23:42:29 +00:00
50608a4098 Do not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally
glibc, starting with commit glibc-2.24-28-gdbab657, has deprecated
inclusion of <sys/sysmacros.h> by <sys/types.h>.  The method used
for deprecation breaks AC_HEADER_MAJOR: this autoconf macro no longer
defines MAJOR_IN_SYSMACROS, which consequently breaks build.

Let's assume that all systems supported by strace provide major, minor,
and makedev macros via <sys/sysmacros.h>.

* configure.ac (AC_HEADER_MAJOR): Remove.
* mknod.c [MAJOR_IN_SYSMACROS, MAJOR_IN_MKDEV]: Remove.
Include <sys/sysmacros.h> unconditionally.
* print_struct_stat.c: Likewise.
* tests/mknod.c: Likewise.
* tests/mknodat.c: Likewise.
* tests/xstatx.c: Likewise.
2016-08-29 15:36:02 +00:00
e7d3d645ae btrfs: mpersify struct btrfs_ioctl_vol_args_v2
This complements commit v4.11-719-gfb0c609.

* btrfs.c (struct_btrfs_ioctl_vol_args_v2): New type.  Mpersify it.
(btrfs_print_qgroup_inherit): Change qgi_addr type to unsigned long.
(btrfs_ioctl): Replace struct btrfs_ioctl_vol_args_v2 with
struct_btrfs_ioctl_vol_args_v2.
2016-08-29 15:30:45 +00:00
27a1a3f3eb mpers.awk: relax union member name absence check
This fixes mpersing of unions containing nameless members,
e.g. struct btrfs_ioctl_vol_args_v2.

* mpers.awk (what_is): Print names of union_type members as is.
2016-08-29 15:30:21 +00:00
6fc53380c6 Revert "tests/xstatx.c: fix stat syscall tests on mips64"
Previous commit effectively changed types of st_atime, st_ctime, and
st_mtime members of struct stat and struct stat64 to signed integers,
making the mips64 workaround obsolete.

This reverts commit 3fb84bfc79.

* tests/xstatx.c (create_sample) [__mips64]: Remove.
2016-08-24 15:33:34 +00:00
a7c4ee41ff Mpersify parsers of struct stat and struct stat64
On many architectures that support multiple personalities,
struct stat differ between personalities.  While old code could handle
these differences, there are some architectures, e.g. sparc64, that also
have different struct stat64.  Rewrite parsers using mpers functionality
to fix these issues.

* fetch_struct_stat.c: New file.
* fetch_struct_stat64.c: Likewise.
* print_struct_stat.c: Likewise.
* oldstat.c: Likewise.
* stat.c: Likewise.
* stat.h: Likewise.
* stat64.c: Likewise.
* file.c: Remove.
* printstat.h: Likewise.
* linux/aarch64/stat32.h: Likewise.
* linux/powerpc64/stat32.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/sparc64/stat32.h: Likewise.
* linux/tile/stat32.h: Likewise.
* linux/x32/stat32.h: Likewise.
* linux/x86_64/stat32.h: Likewise.
* Makefile.am (strace_SOURCES): Add fetch_struct_stat.c,
fetch_struct_stat64.c, print_struct_stat.c, oldstat.c, stat.c, stat.h,
and stat64.c.  Remove file.c, printstat.h, linux/aarch64/stat32.h,
linux/powerpc64/stat32.h, linux/riscv/stat32.h, linux/sparc64/stat32.h,
linux/tile/stat32.h, linux/x32/stat32.h, and linux/x86_64/stat32.h.
* configure.ac (AC_CHECK_MEMBERS): Add struct stat64.st_mtime_nsec.
* defs.h (struct strace_stat): New declaration.
(print_struct_stat): New prototype.
* linux/dummy.h (sys_fstatat64): Remove.
2016-08-24 15:32:10 +00:00
c778f7aff6 mpers.m4: check for struct stat64, struct stat, and their members
* m4/mpers.m4 (st_MPERS_STRUCT_STAT): New macro.
(st_MPERS): Use it.
2016-08-24 12:10:55 +00:00
a27c47b2c4 mpers: add MPERS_IS_* to CFLAGS passed to mpers.sh
This allows testing of MPERS_IS_* macros in pre-MPERS_DEFS parts
of source code.

* Makefile.am (mpers-m%.stamp): Add -DMPERS_IS_$(mpers_NAME) to CFLAGS
passed to mpers.sh.
* mpers_test.sh: Likewise.
2016-08-24 12:10:55 +00:00
1aae061d4d Move redefinition of stat types to asm_stat.h
* file.c: Move redefinition of types that might be used
to define struct stat ...
* linux/asm_stat.h: ... here.
* tests/xstatx.c: Remove redefinition of stat types.
2016-08-24 12:10:55 +00:00
1d81b3b35f x86_64: provide a replacement of <asm/stat.h> for x32 personality
For the reason described in commit v4.10-517-gcfde1e3, a correct
definition of struct stat for x32 personality is necessary to enable
"asm_stat.h" with -mx32 on x86_64.

* linux/x32/asm_stat.h: Rename to ...
* linux/x86_64/asm_stat.h: ... new file.
* Makefile.am (strace_SOURCES): Add it.
* linux/x32/asm_stat.h: New file, include "x86_64/asm_stat.h".
2016-08-24 12:10:50 +00:00
cbb95b6c6a x32/asm_stat.h: provide definitions for i386 personality
This enables x32/asm_stat.h with -m32.

* linux/x32/asm_stat.h [__x86_64__ && __ILP32__]: Redirect stat.
Include "linux/asm_stat.h".
(struct stat): Define for [__x86_64__ && __ILP32__] only.
(struct __old_kernel_stat): Remove.
2016-08-24 12:09:59 +00:00
c4da489a74 Introduce a separate SEN entry for fstatat64 syscall
* linux/dummy.h (sys_fstatat64): Redirect to sys_newfstatat.
* linux/32/syscallent.h: Replace SEN(newfstatat) with SEN(fstatat64).
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_fstatat64.
2016-08-23 15:06:34 +00:00
788939b4a7 Do not check for struct stat.st_{a,c}time_nsec
Assume that the check for struct stat.st_mtime_nsec is enough.
Likewise, do not check for struct stat.st_{a,c}tim.tv_nsec.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_atime_nsec,
struct stat.st_ctime_nsec, struct stat.st_atim.tv_nsec,
and struct stat.st_ctim.tv_nsec.
* file.c (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Remove.
* printstat.h (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Replace with
HAVE_STRUCT_STAT_ST_MTIME_NSEC.
* tests/xstatx.c: Likewise.
2016-08-23 15:06:34 +00:00
b685f90eb7 Add sign_extend_unsigned_to_ll macro
* defs.h (sign_extend_unsigned_to_ll): New macro, mirrors
zero_extend_signed_to_ull.
2016-08-23 00:24:22 +00:00
b2dd46398f zero_extend_signed_to_ull: add short int support
* defs.h (zero_extend_signed_to_ull): Add short int support.
* tests/tests.h: Likewise.
2016-08-23 00:24:17 +00:00
031fc80059 Rename widen_to_ull to zero_extend_signed_to_ull
* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
All callers changed.
* tests/tests.h: Likewise.
2016-08-23 00:24:10 +00:00
3cac5ddd01 sparc, sparc64: remove obsolete code
Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64] (SYS_FUNC(xstat), SYS_FUNC(fxstat)): Remove.
2016-08-23 00:24:03 +00:00
5f5fd0d6e2 sparc64: fix decoding of struct stat64 related syscalls
For some reason, struct stat and struct stat64 are different on sparc64.
This change fixes decoding of struct stat64 related syscalls for sparc64
personality, sparc32 personality on sparc64 needs more work.

* file.c (printstat64) [SPARC64]: Do not use printstat.
(SYS_FUNC(newfstatat)): Likewise.
2016-08-22 09:35:13 +00:00
bce8163937 tests: fill old_value argument in timer{,fd}_xettime tests
This is needed in order to differentiate it from the value returned
by the call.  As a consequence, it enables revealing possible bugs
in syscall parsers, for example, when the value read on syscall
entering and not on syscall exiting, as it was the case with
timerfd_settime parser.

* tests/timer_xettime.c (main): Fill old.its field with value different
from the expected one upon call return.
* tests/timerfd_xettime.c: Likewise.
2016-08-22 09:32:47 +00:00
b53f546d3e Fix old_value argument retrieval in timerfd_settime parser
This is done similar to timer_settime syscall parser.

* time.c (SYS_FUNC(timerfd_settime)): Retrieve old_value argument
on exiting and not on entering.  Return 0 instead of RVAL_DECODED
since the call hasn't been decoded in full on entering.
2016-08-22 09:32:47 +00:00
d8f673568b Add RISC-V architecture support
The original port of strace was done by Palmer Dabbelt
(eecs.berkeley.edu), based on strace 4.9.

* configure.ac: Define RISCV for riscv*.
* clone.c [RISCV]: Define ARG_* macros as for OR1K.
* defs.h [RISCV] (SUPPORTED_PERSONALITIES): Define to 2.
[RISCV] (NEED_UID16_PARSERS): Define to 1.
* linux/riscv/arch_regs.c: New file.
* linux/riscv/errnoent1.h: Likewise.
* linux/riscv/get_error.c: Likewise.
* linux/riscv/get_scno.c: Likewise.
* linux/riscv/get_syscall_args.c: Likewise.
* linux/riscv/ioctls_arch0.h: Likewise.
* linux/riscv/ioctls_arch1.h: Likewise.
* linux/riscv/ioctls_inc0.h: Likewise.
* linux/riscv/ioctls_inc1.h: Likewise.
* linux/riscv/signalent1.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/riscv/syscallent.h: Likewise.
* linux/riscv/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2016-08-21 22:03:05 +00:00
714a162048 Move SH-specific argument number calculation to getllval
This change prevents scattering of ll-related hacks and simplifies
pread/pwrite syscalls parsers' logic a bit.

* util.c (getllval): Add fixup for arg_no for SuperH when argument
number is equal to 3.
* io.c (PREAD_OFFSET_ARG): Remove.
(SYS_FUNC(pread)): Always use argument number 3 for "count" argument
printing.
(SYS_FUNC(pwrite)): Likewise.
2016-08-21 22:02:20 +00:00
ae5feb49c2 sparc64: fix sigreturn decoding for sparc personality
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Parametrize
member types of struct signal_frame.
* linux/sparc64/arch_sigreturn.c (sparc64_arch_sigreturn,
sparc32_arch_sigreturn): New functions.
(arch_sigreturn): Use them.
2016-08-21 22:02:09 +00:00
aa0c46ffed Fix compat decoding of struct sigaction.sa_mask on big endian architectures
* signal.c (decode_new_sigaction) [SUPPORTED_PERSONALITIES > 1 &&
SIZEOF_LONG > 4]: Use LONG_LONG to convert sa_mask from 32-bit
struct sigaction to 64-bit struct sigaction.
2016-08-20 00:08:10 +00:00
3dfed0ef4e Fix decoding of indirect shmat's return code for non-native personalities
* ipc_shm.c (SYS_FUNC(shmat)): Fetch current_wordsize bytes of data
to obtain return code of indirect shmat subcall.
2016-08-19 22:57:27 +00:00
a48bbc70e8 sparc64: fix sparc personality decoding of mmap64's offset argument
* linux/sparc64/syscallent1.h: Remove redirection of sys_mmap_4koff.
2016-08-18 22:33:12 +00:00
1a6470fc80 sparc64: fix decoding of the forth argument of semctl syscall
On sparc64, unlike all other architectures where semctl is an indirect
ipc subcall, the forth argument is passed directly.

* ipc_sem.c (SYS_FUNC(semctl)) [SPARC64]: Print 4th argument without
indirection in case of native personality.
2016-08-19 22:11:46 +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
daa04830aa sparc64: fix sign extension bug of syscall args for sparc personality
* linux/sparc64/get_syscall_args.c (get_syscall_args): Zero-extend
syscall args from 32 bit for sparc personality.
2016-08-16 09:15:36 +00:00
23a51410ba sparc64: fix tty ioctl numbers
The structures defined in asm/termbits.h have the same size
on sparc and sparc64.

* linux/sparc64/ioctls_arch0.h (TCGETS, TCGETS2, TCSETS, TCSETS2,
TCSETSF, TCSETSF2, TCSETSW, TCSETSW2): Sync with
linux/sparc/ioctls_arch0.h
2016-08-16 09:15:24 +00:00
7af5e6593f evdev.c: fix typo in comment 2016-08-15 21:08:56 +00:00
7e2fe5029a Drop support of dummy members of struct stat
As st_flags, st_fstype, and st_gen members of struct stat are not filled
by the kernel, there is no use supporting them.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_flags,
struct stat.st_fstype, and struct stat.st_gen.
* file.c [STAT32_PERSONALITY, HAVE_STRUCT_STAT64]: Do not undefine
HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
and HAVE_STRUCT_STAT_ST_GEN.
* printstat.h (DO_PRINTSTAT): Do not check for
HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
and HAVE_STRUCT_STAT_ST_GEN.
2016-08-15 19:09:24 +00:00
18cac625e5 Assume that struct stat contains st_blksize, st_blocks, and st_rdev
Our test suite already assumes that struct stat contains st_blksize,
st_blocks, and st_rdev members, and there haven't been any complaints.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_blksize,
struct stat.st_blocks, and struct stat.st_rdev.
* printstat.h (DO_PRINTSTAT): Do not check for
HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_STRUCT_STAT_ST_BLOCKS,
and HAVE_STRUCT_STAT_ST_RDEV.
2016-08-15 22:06:06 +03:00
472ce30535 tests: fix pause.test when pause syscall is not available
* tests/pause.c (main): Fix expected output when pause syscall
is not available.
2016-08-15 22:06:06 +03:00
aaa7a77b5f powerpc64, sparc64: fix redefinitions of ARCH_PC_REG
This fixes compilation warning that ARCH_PC_REG is redefined.

* linux/powerpc64/arch_regs.c (ARCH_PC_REG): Undefine before
the new definition.
* linux/sparc64/arch_regs.c (ARCH_PC_REG): Likewise.
2016-08-14 00:03:03 +00:00
8e982692d4 s390x, x32: remove redundant definitions of ARCH_PC_REG
* linux/s390x/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
in just included linux/s390/arch_regs.c.
* linux/x32/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
in just included linux/x86_64/arch_regs.c.
2016-08-14 00:02:55 +00:00
7c6e8f1490 tests: check for leaks of placeholder descriptors
* tests/redirect-fds.c: New file.
* tests/redirect-fds.test: New test.
* tests/.gitignore: Add redirect-fds.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add redirect-fds.test.
2016-08-13 22:05:28 +00:00
e4e9df2259 tests/init.sh: print exit code of failed commands
* init.sh (run_prog, run_prog_skip_if_failed): When the program fails,
add its exit code to the diagnostic message.
(run_strace): When strace fails, add its exit code to the diagnostic
message.
(run_strace_merge): When strace-log-merge fails, add its exit code
to the diagnostic message.
2016-08-13 22:05:20 +00:00
559ec3e06d Fix leakage of placeholder descriptors to tracees
As a side effect of commit v4.11-211-g0736d4e, strace used to leak
placeholders for standard descriptors to tracees thus affecting their
behaviour.  Fix this by setting close-on-exec flag on placeholder
descriptors.

* strace.c (open_dummy_desc): Set close-on-exec flag on the descriptor
that is going to be returned to the caller.
(fd_is_placeholder): New array.
(ensure_standard_fds_opened, redirect_standard_fds): New functions.
(startup_child): Use redirect_standard_fds.
(init): Use ensure_standard_fds_opened.
2016-08-13 22:04:59 +00:00
c65e6b9989 sparc64: fix decoding of uid and gid-related syscalls
sparc64 has no native 16-bit uid/gid syscalls.

* linux/sparc64/syscallent.h (chown, lchown, setuid, getuid, setgid,
getgid, geteuid, getegid, getgroups, setgroups, fchown, setreuid,
setregid, setfsuid, setfsgid): Change handlers from 16-bit to 32-bit.
2016-08-12 01:00:04 +00:00
ad109aba29 tests: fix *stat64 tests on alpha
On some architectures including alpha, <asm/stat.h> provides a
definition of struct stat that has no st_atime_nsec, st_mtime_nsec, and
st_ctime_nsec fields.  At the same time, struct stat64 always has these
fields.  Fix tests to take this difference into account.

* tests/fstat64.c (STRUCT_STAT_IS_STAT64): New macro, defined to 1.
* tests/lstat64.c (STRUCT_STAT_IS_STAT64): Likewise.
* tests/stat64.c (STRUCT_STAT_IS_STAT64): Likewise.
* tests/xstatx.c [!STRUCT_STAT] (STRUCT_STAT_IS_STAT64): New macro,
defined to 0.
[USE_ASM_STAT && STRUCT_STAT_IS_STAT64]:
(HAVE_STRUCT_STAT_ST_ATIME_NSEC, HAVE_STRUCT_STAT_ST_CTIME_NSEC,
HAVE_STRUCT_STAT_ST_MTIME_NSEC): Redefine to 1.
2016-08-12 00:07:54 +00:00
67ee3d6184 tests: skip rt_tgsigqueueinfo.test when the syscall is not available
* tests/rt_tgsigqueueinfo.c (main): Skip the test when the syscall
is not available.
2016-08-11 17:58:09 +00:00
a9147beeb0 tests/fcntl.c: fix fcntl test on mips64
On mips64 the F_GETLK and F_SETLKW64 constants have identical values which
causes the "wrong" constant to be printed by strace.

tests/fcntl.c (test_flock64): Do not test F_SETLKW64 on mips64.
2016-08-11 16:48:12 +00:00
468dccf59d tests/nsyscalls.test: only trace the "syscall" syscall on mips o32
The "syscall" syscall only exists on o32 and causes strace to error out on
64-bit mips ABIs. Pass MIPS_ABI from the configure script through to
nsyscalls.test so the MIPS ABI can be checked.

* configure.ac (MIPS_ABI): Substitute into output files.
* tests/Makefile.am (MIPS_ABI): Export via AM_TEST_LOG_FLAGS.
* tests/nsyscalls.test: Restrict special mips handling to mips o32.
2016-08-11 16:47:29 +00:00
3fb84bfc79 tests/xstatx.c: fix stat syscall tests on mips64
For historical reasons the kernel struct stat represents times as unsigned
32-bit integers on mips64. Therefore, while it's possible to give a file a
timestamp before 1970 with futimens, reading the same timestamp through
struct stat will give a positive time (around 2106).
Workaround by using positive timestamps for testing on mips64.

* tests/xstatx.c (create_sample): Use positive timestamps on mips64.
2016-08-11 16:45:23 +00:00
0bc735e5aa tests/mlock2.c: fix test failure on mips64
* tests/mlock2.c (main): Pass unsigned long arguments to mlock2 syscall
explicitly, to avoid unwanted sign extension issues.

Based on patch by James Cowgill <james410@cowgill.org.uk>
2016-08-11 11:18:56 +00:00
6a2f43ce64 Use <asm/unistd.h> instead of <sys/syscall.h>
There are no users of SYS_* macros provided by <sys/syscall.h>,
and definitions of __NR_* macros could be obtained directly
from <asm/unistd.h>.

* defs.h: Include <asm/unistd.h> instead of <sys/syscall.h>.
* test/seccomp.c: Likewise.
* test/threaded_execve.c: Likewise.
* test/x32_lseek.c: Likewise.
* test/x32_mmap.c: Likewise.
* tests/_newselect.c: Likewise.
* tests/access.c: Likewise.
* tests/acct.c: Likewise.
* tests/aio.c: Likewise.
* tests/alarm.c: Likewise.
* tests/attach-f-p.c: Likewise.
* tests/bpf.c: Likewise.
* tests/brk.c: Likewise.
* tests/chmod.c: Likewise.
* tests/chown.c: Likewise.
* tests/chown32.c: Likewise.
* tests/chroot.c: Likewise.
* tests/clock_adjtime.c: Likewise.
* tests/clock_nanosleep.c: Likewise.
* tests/clock_xettime.c: Likewise.
* tests/copy_file_range.c: Likewise.
* tests/creat.c: Likewise.
* tests/dup2.c: Likewise.
* tests/dup3.c: Likewise.
* tests/epoll_create.c: Likewise.
* tests/epoll_create1.c: Likewise.
* tests/epoll_ctl.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/epoll_wait.c: Likewise.
* tests/eventfd.c: Likewise.
* tests/execveat.c: Likewise.
* tests/faccessat.c: Likewise.
* tests/fchdir.c: Likewise.
* tests/fchmod.c: Likewise.
* tests/fchmodat.c: Likewise.
* tests/fchown.c: Likewise.
* tests/fchown32.c: Likewise.
* tests/fchownat.c: Likewise.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* tests/fdatasync.c: Likewise.
* tests/flock.c: Likewise.
* tests/fstat.c: Likewise.
* tests/fstat64.c: Likewise.
* tests/fstatat64.c: Likewise.
* tests/fstatfs.c: Likewise.
* tests/fstatfs64.c: Likewise.
* tests/fsync.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/ftruncate64.c: Likewise.
* tests/futimesat.c: Likewise.
* tests/get_mempolicy.c: Likewise.
* tests/getcwd.c: Likewise.
* tests/getdents.c: Likewise.
* tests/getdents64.c: Likewise.
* tests/getegid.c: Likewise.
* tests/getegid32.c: Likewise.
* tests/geteuid.c: Likewise.
* tests/geteuid32.c: Likewise.
* tests/getgid.c: Likewise.
* tests/getgid32.c: Likewise.
* tests/getgroups.c: Likewise.
* tests/getgroups32.c: Likewise.
* tests/getpgrp.c: Likewise.
* tests/getrandom.c: Likewise.
* tests/getresgid.c: Likewise.
* tests/getresgid32.c: Likewise.
* tests/getresuid.c: Likewise.
* tests/getresuid32.c: Likewise.
* tests/getrlimit.c: Likewise.
* tests/getrusage.c: Likewise.
* tests/getuid.c: Likewise.
* tests/getuid32.c: Likewise.
* tests/getxxid.c: Likewise.
* tests/ioctl_uffdio.c: Likewise.
* tests/ioperm.c: Likewise.
* tests/iopl.c: Likewise.
* tests/ipc.c: Likewise.
* tests/kill.c: Likewise.
* tests/lchown.c: Likewise.
* tests/lchown32.c: Likewise.
* tests/libmmsg.c: Likewise.
* tests/libsocketcall.c: Likewise.
* tests/link.c: Likewise.
* tests/linkat.c: Likewise.
* tests/llseek.c: Likewise.
* tests/lseek.c: Likewise.
* tests/lstat.c: Likewise.
* tests/lstat64.c: Likewise.
* tests/mbind.c: Likewise.
* tests/membarrier.c: Likewise.
* tests/memfd_create.c: Likewise.
* tests/migrate_pages.c: Likewise.
* tests/mkdir.c: Likewise.
* tests/mkdirat.c: Likewise.
* tests/mknod.c: Likewise.
* tests/mknodat.c: Likewise.
* tests/mlock.c: Likewise.
* tests/mlock2.c: Likewise.
* tests/move_pages.c: Likewise.
* tests/newfstatat.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/old_mmap.c: Likewise.
* tests/oldselect.c: Likewise.
* tests/open.c: Likewise.
* tests/openat.c: Likewise.
* tests/pause.c: Likewise.
* tests/poll.c: Likewise.
* tests/prctl-seccomp-filter-v.c: Likewise.
* tests/prctl-seccomp-strict.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/prlimit64.c: Likewise.
* tests/pselect6.c: Likewise.
* tests/ptrace.c: Likewise.
* tests/readdir.c: Likewise.
* tests/readlink.c: Likewise.
* tests/readlinkat.c: Likewise.
* tests/reboot.c: Likewise.
* tests/remap_file_pages.c: Likewise.
* tests/rename.c: Likewise.
* tests/renameat.c: Likewise.
* tests/renameat2.c: Likewise.
* tests/rmdir.c: Likewise.
* tests/rt_sigpending.c: Likewise.
* tests/rt_sigprocmask.c: Likewise.
* tests/rt_sigsuspend.c: Likewise.
* tests/rt_sigtimedwait.c: Likewise.
* tests/rt_tgsigqueueinfo.c: Likewise.
* tests/sched_get_priority_mxx.c: Likewise.
* tests/sched_rr_get_interval.c: Likewise.
* tests/sched_xetaffinity.c: Likewise.
* tests/sched_xetattr.c: Likewise.
* tests/sched_xetparam.c: Likewise.
* tests/sched_xetscheduler.c: Likewise.
* tests/sched_yield.c: Likewise.
* tests/seccomp-filter-v.c: Likewise.
* tests/seccomp-filter.c: Likewise.
* tests/seccomp-strict.c: Likewise.
* tests/select.c: Likewise.
* tests/sendfile.c: Likewise.
* tests/sendfile64.c: Likewise.
* tests/set_mempolicy.c: Likewise.
* tests/setdomainname.c: Likewise.
* tests/setfsgid.c: Likewise.
* tests/setfsgid32.c: Likewise.
* tests/setfsuid.c: Likewise.
* tests/setfsuid32.c: Likewise.
* tests/setgid.c: Likewise.
* tests/setgid32.c: Likewise.
* tests/setgroups.c: Likewise.
* tests/setgroups32.c: Likewise.
* tests/sethostname.c: Likewise.
* tests/setregid.c: Likewise.
* tests/setregid32.c: Likewise.
* tests/setresgid.c: Likewise.
* tests/setresgid32.c: Likewise.
* tests/setresuid.c: Likewise.
* tests/setresuid32.c: Likewise.
* tests/setreuid.c: Likewise.
* tests/setreuid32.c: Likewise.
* tests/setrlimit.c: Likewise.
* tests/setuid.c: Likewise.
* tests/setuid32.c: Likewise.
* tests/signalfd4.c: Likewise.
* tests/socketcall.c: Likewise.
* tests/splice.c: Likewise.
* tests/stat.c: Likewise.
* tests/stat64.c: Likewise.
* tests/statfs.c: Likewise.
* tests/statfs64.c: Likewise.
* tests/swap.c: Likewise.
* tests/symlink.c: Likewise.
* tests/symlinkat.c: Likewise.
* tests/sync.c: Likewise.
* tests/sync_file_range.c: Likewise.
* tests/sync_file_range2.c: Likewise.
* tests/syslog.c: Likewise.
* tests/tee.c: Likewise.
* tests/time.c: Likewise.
* tests/timer_create.c: Likewise.
* tests/timer_xettime.c: Likewise.
* tests/timerfd_xettime.c: Likewise.
* tests/times-fail.c: Likewise.
* tests/times.c: Likewise.
* tests/truncate.c: Likewise.
* tests/truncate64.c: Likewise.
* tests/ugetrlimit.c: Likewise.
* tests/umount.c: Likewise.
* tests/umount2.c: Likewise.
* tests/uname.c: Likewise.
* tests/unix-pair-send-recv.c: Likewise.
* tests/unlink.c: Likewise.
* tests/unlinkat.c: Likewise.
* tests/userfaultfd.c: Likewise.
* tests/utimes.c: Likewise.
* tests/vhangup.c: Likewise.
* tests/vmsplice.c: Likewise.
* tests/waitid.c: Likewise.
* tests/waitpid.c: Likewise.
* tests/xet_robust_list.c: Likewise.
* tests/xetpgid.c: Likewise.
* tests/xetpriority.c: Likewise.
* tests/xettimeofday.c: Likewise.
2016-08-09 14:38:29 +00:00
38d854e425 ia64: replace SYS_clone2 with __NR_clone2
Migrate to __NR_* the last user of SYS_* macros provided
by <sys/syscall.h>.

* clone.c [IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Replace
SYS_clone2 with __NR_clone2.
2016-08-09 14:35:06 +00:00
e3dfc5901f Make sure that tcp->s_ent and tcp->s_prev_ent do not point to freed memory
This complements commit v4.13-33-g60d7ec8.

* syscall.c (sysent_buf): New structure.
(free_sysent_buf): New function.
(get_scno): Use them.
2016-08-09 10:34:09 +00:00
09dee9ab25 file.c: move definitions of struct stat32 to separate files
* linux/aarch64/stat32.h: New file.
* linux/powerpc64/stat32.h: Likewise.
* linux/sparc64/stat32.h: Likewise.
* linux/tile/stat32.h: Likewise.
* linux/x32/stat32.h: Likewise.
* linux/x86_64/stat32.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* file.c [SUPPORTED_PERSONALITIES > 1]: Remove arch specific definitions
of struct stat32, include "stat32.h" instead.
2016-08-09 10:27:50 +00:00
5179183b49 sparc, sparc64: remove obsolete code
Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64]: Remove the code related to struct solstat.
(printstat, printoldstat) [SPARC || SPARC64]: Remove.
2016-08-09 09:21:46 +00:00
deb3bce1a2 sparc64: fix decoding of stat family syscalls
This complements commit v4.13-28-gaebfe83.

* file.c [SPARC64]: Change STAT32_PERSONALITY to 1.
2016-08-09 09:14:11 +00:00
60d7ec80d9 Fix decoding of invalid syscalls mapped to indirect subcalls
When the syscall number returned by arch_get_scno is a mapped indirect
subcall (i.e. mapped subcall of socketcall or ipc syscall), do not
mistakenly treat it as a valid indirect subcall.

* defs.h (SCNO_IS_VALID): Treat scno with TRACE_INDIRECT_SUBCALL flag
as invalid.
* syscall.c (syscall_name): Do no shuffle scno.
(trace_syscall_entering, trace_syscall_exiting): Use
tcp->s_ent->sys_name instead of syscall_name.
(get_scno): In case of invalid syscall, allocate a dynamic struct sysent
containing an appropriate .sys_name.
* tests/nsyscalls.c (main) [SYS_socket_subcall]: Check decoding
of direct syscall number SYS_socket_subcall+1.
(main) [SYS_ipc_subcall]: Check decoding of direct syscall number
SYS_ipc_subcall+1.
2016-08-09 01:13:24 +00:00
c61dd7f4d2 linux/subcall.h: remove redundant definitions
* linux/subcall.h: Remove definitions of non-existent socket
and ipc subcalls.
2016-08-08 23:43:50 +00:00
f2107d57e4 defs.h: simplify SUPPORTED_PERSONALITIES definition
* defs.h: Group definition of SUPPORTED_PERSONALITIES by value.
2016-08-08 23:28:29 +00:00
abfc0a6d59 defs.h: simplify PERSONALITY1_WORDSIZE definition
Move definition of PERSONALITY1_WORDSIZE macro outside arch specific
ifdefs.

* defs.h [SPARC64 || X86_64 || X32 || AARCH64 || POWERPC64 || TILE]
(PERSONALITY1_WORDSIZE): Remove.
[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_WORDSIZE): Define to 4
unconditionally.
2016-08-08 23:28:29 +00:00
8d92151c66 defs.h: simplify PERSONALITY0_WORDSIZE definition
Move definition of PERSONALITY0_WORDSIZE macro outside arch specific
ifdefs.

* defs.h (PERSONALITY0_WORDSIZE): Define to SIZEOF_LONG unconditionally.
2016-08-08 23:28:29 +00:00
aebfe832b8 sparc64: swap personality numbers
Fix inconsistency between syscall and ioctl entries on sparc64.
Make layout of personalities on sparc64 the same as on other
architectures that support two personalities.

* defs.h [SPARC64] (PERSONALITY0_WORDSIZE): Change to 8.
[SPARC64] (PERSONALITY1_WORDSIZE): Change to 4.
* linux/sparc64/get_scno.c (arch_get_scno): Swap personality numbers.
* linux/sparc64/ioctls_arch1.h: Rename to ioctls_arch0.h.
* linux/sparc64/ioctls_arch0.h: Rename to ioctls_arch1.h.
* linux/sparc64/ioctls_inc0.h: Rename to ioctls_inc1.h.
* linux/sparc64/ioctls_inc1.h: Rename to ioctls_inc0.h.
2016-08-08 23:27:08 +00:00
90a65a4aab defs.h: cleanup personality specific macro definitions
Move the code that defines PERSONALITY[12]_INCLUDE_FUNCS,
PERSONALITY[12]_INCLUDE_PRINTERS_DECLS,
PERSONALITY[12]_INCLUDE_PRINTERS_DEFS, and MPERS_{m,mx}32_IOCTL_MACROS
macros outside arch specific ifdefs.

* defs.h [SPARC] (PERSONALITY0_WORDSIZE): Remove.
[SPARC64 && HAVE_M32_MPERS]: Remove.
[X86_64 && HAVE_M32_MPERS]: Remove.
[X86_64 && HAVE_MX32_MPERS]: Remove.
[X32 && HAVE_M32_MPERS]: Remove.
[AARCH64 && HAVE_M32_MPERS]: Remove.
[POWERPC64 && HAVE_M32_MPERS]: Remove.
[TILE && HAVE_M32_MPERS]: Remove.
(PERSONALITY0_INCLUDE_PRINTERS_DECLS,
PERSONALITY0_INCLUDE_PRINTERS_DEFS): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS]
(PERSONALITY1_INCLUDE_PRINTERS_DECLS,
PERSONALITY1_INCLUDE_PRINTERS_DEFS, PERSONALITY1_INCLUDE_FUNCS,
MPERS_m32_IOCTL_MACROS): Define for
[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS] case.
(PERSONALITY2_INCLUDE_PRINTERS_DECLS,
PERSONALITY2_INCLUDE_PRINTERS_DEFS, PERSONALITY2_INCLUDE_FUNCS,
MPERS_mx32_IOCTL_MACROS): Define for
[SUPPORTED_PERSONALITIES > 2 && HAVE_MX32_MPERS] case.
2016-08-08 21:11:47 +00:00
42ceb0fd7f Change #include guard trailing part comments
* defs.h: Change comment of the trailing part of #include guard.
* flock.h: Likewise.
* gcc_compat.h: Likewise.
* ipc_defs.h: Likewise.
* kernel_types.h: Likewise.
* mpers_type.h: Likewise.
* msghdr.h: Likewise.
* printsiginfo.h: Likewise.
* ptrace.h: Likewise.
* regs.h: Likewise.
* seccomp_fprog.h: Likewise.
* sigevent.h: Likewise.
* statfs.h: Likewise.
* xlat.h: Likewise.
2016-08-07 22:02:46 +00:00
18907920bb Unify usage of #include guards
This commit is an attempt to unify usage of include guards (in top-level
headers, at least).  As a side note, different files with *.h extension
have different semantics: for example, printargs.h is included multiple
times in order to generate slightly varying code depending on values of
macro definitions - maybe it's better to change extension of such files
to something like *.inc.

* defs.h: Add #include guard.
* flock.h: Likewise.
* ipc_defs.h: Likewise.
* mpers_type.h: Likewise.
* printsiginfo.h: Likewise.
* ptrace.h: Likewise.
* regs.h: Likewise.
* seccomp_fprog.h: Likewise.
* gcc_compat.h: Rename the macro used for #include guard.
* msghdr.h: Likewise.
* sigevent.h: Likewise.
* kernel_types.h: Comment the trailing part of #include guard.
* xlat.h: Add missing macro definition for #include guard.
2016-08-08 09:54:01 +00:00
7b1401e965 tests: add #include guards
* tests/tests.h: Add #include guard.
2016-08-06 21:51:29 +00:00
3c8149a0f2 linux: add #include guards
* linux/dummy.h: Add #include guard.
* linux/inet_diag.h: Likewise.
* linux/netlink_diag.h: Likewise.
* linux/sock_diag.h: Likewise.
* linux/syscall.h: Likewise.
* linux/unix_diag.h: Likewise.
2016-08-05 15:06:43 +00:00
08601fdc68 tests/umode_t.c: guard against libc printf format errors
* tests/umode_t.c (test_syscall): Use different printf format specifiers
to detect libc printf format errors.
2016-08-04 12:11:19 +00:00
f4001a3d12 travis: use a suitable musl revision
There seems to be no readily available binary packages of musl that are
sufficiently up to date to be used to build and test strace, so prepare
a suitable musl from source.

* travis-install.sh (musl-gcc): Do not add an extra repository,
do not install musl-tools and linux-musl-dev packages.
Download, build, and install a suitable musl revision instead.
2016-08-04 01:10:05 +00:00
8d3743868e Fix printing of mode_t, umode_t, and umask types
Print numeric umode_t type using %#03ho format.
Print return value of umask syscall using %#03lo format.
When printing symbolic mode_t type, always print lower 9 bits,
and print the numeric part using %#03o format.

* defs.h (sprintmode): Remove.
(print_symbolic_mode_t, print_numeric_umode_t,
print_numeric_long_umask): New prototypes.
* printmode.c (sprintmode): Remove.
(print_symbolic_mode_t, print_numeric_umode_t,
print_numeric_long_umask): New functions.
* chmod.c (decode_chmod): Use print_numeric_umode_t.
* ipc_msg.c (SYS_FUNC(msgget)): Likewise.
* ipc_msgctl.c (print_msqid_ds): Likewise.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* ipc_shmctl.c (print_shmid_ds): Likewise.
* mq.c (SYS_FUNC(mq_open)): Likewise.
* open.c (decode_open, SYS_FUNC(creat)): Likewise.
* umask.c (SYS_FUNC(umask)): Likewise.
* mknod.c (decode_mknod): Use print_symbolic_mode_t.
* printstat.h (DO_PRINTSTAT): Likewise.
* syscall.c (trace_syscall_exiting): Use print_numeric_long_umask.
* tests/umode_t.c: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/creat.c: Rewrite as a thin wrapper around umode_t.c
* tests/mkdir.c: Likewise.
* tests/mkdirat.c: Likewise.
* tests/mknod.c: Extend test coverage of mknod syscall.
* tests/mknodat.c: Extend test coverage of mknodat syscall.
* tests/umask.c: Extend test coverage of umask syscall.
* tests/creat.test: Update the value specified for strace -a parameter.
* tests/mkdir.test: Likewise.
* tests/mkdirat.test: Likewise.
* tests/mknodat.test: Likewise.
2016-08-03 23:27:03 +00:00
c416ff5ffa tests: simplify attach-f-p.test
* tests/attach-f-p.c Simplify communications between threads
by replacing per-thread timers with pipes.
* tests/attach-f-p.test: Do not ignore signals.
2016-08-02 16:47:34 +00:00
09fc30c4c7 tests: cleanup attach-p-cmd.test
* tests/attach-p-cmd-cmd.c (main): Cleanup expected output.
* tests/attach-p-cmd-p.c (main): Print expected output.
* tests/attach-p-cmd.test: Do not print expected output.
2016-08-02 16:43:37 +00:00
8df052e2ae ip_mreq.test: rewrite from match_grep to match_diff
* tests/ip_mreq.c (main): Print expected output.
* tests/ip_mreq.test: Use run_strace_match_diff.
* tests/ip_mreq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-08-02 16:33:09 +00:00
79bbee8368 fanotify_mark.test: rewrite from match_grep to match_diff
* tests/fanotify_mark.c (main): Print expected output.
* tests/fanotify_mark.test: Use run_strace_match_diff.
* tests/fanotify_mark.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-08-02 11:11:52 +00:00
884e1e930b signalfd4.test: rewrite from match_grep to match_diff
* tests/signalfd4.c (get_sigset_size): New function.
(main): Use it.  Print expected output.
* tests/signalfd4.test: Use run_strace_match_diff.
* tests/signalfd4.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-08-02 11:00:06 +00:00
4f328761f3 tests: rename signalfd.test to signalfd4.test
* tests/signalfd.c: Rename to signalfd4.c.
* tests/signalfd.test: Rename to signalfd4.test.
* tests/signalfd.expected: Rename to signalfd4.expected.
* tests/.gitignore: Replace signalfd with signalfd4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Replace signalfd.test with signalfd4.test.
(EXTRA_DIST): Replace signalfd.expected with signalfd4.expected.
2016-07-31 21:55:23 +00:00
c4fdce5cea memfd_create.test: rewrite from match_grep to match_diff
* tests/memfd_create.c (main): Print expected output.
* tests/memfd_create.test: Use run_strace_match_diff.
* tests/memfd_create.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-07-30 22:52:27 +00:00
b9bc216fdd Set exit status to 1 if strace has not traced any processes
* strace.c (main): Initialize exit_code with 1 when no processes
has been attached.
* strace.1: Document it.
* NEWS: Mention this change.
2016-07-29 22:47:46 +00:00
2ddb73ddd3 Attach to the target process before attempting to attach to its siblings
* strace.c (attach_tcb): Attach to tcp->pid first.
2016-07-29 17:14:28 +00:00
c9251518b0 Report the name of ptrace command when ptrace_attach_or_seize fails.
* strace.c (ptrace_attach_cmd): New variable.
(ptrace_attach_or_seize): Save last ptrace command's name
to ptrace_attach_cmd.
(attach_tcb, startup_child): Use it in error diagnostics.
2016-07-29 17:13:53 +00:00
795795ae99 strace.c: refactor startup_attach
* strace.c (startup_attach): Move the inner part of the big loop
over tcbtab elements ...
(attach_tcb): ... to this new function.
2016-07-29 17:13:47 +00:00
bbfeea269e startup_attach: do not use atoi
* strace.c (startup_attach): Replace atoi with string_to_uint.
2016-07-29 17:10:50 +00:00
6d3162acf1 Do not enable mpers runtime checks if mpers is not enabled
* m4/mpers.m4 (HAVE_RUNTIME): Enable iff both mpers and runtime
work properly.
2016-07-28 18:32:29 +00:00
8ff8ada6ee linux/dummy_check.sh: remove obsolete script
Starting with commit v4.10-62-ga0bd374, function prototypes
of syscall parsers are generated at build time.

* linux/dummy_check.sh: Remove.
2016-07-28 18:32:29 +00:00
a290710b1b generate_xlat_in.sh: remove obsolete script
This script has been created by commit v4.8-180-g0ed617b
for the one-shot job of automatic convertion of xlat structures
from *.c files to xlat/*.in files.

* generate_xlat_in.sh: Remove.
2016-07-28 18:32:28 +00:00
f915f220c0 tests: use terse notation in designated initializers where appropriate
* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Initialize
struct btrfs_ioctl_dev_replace_args using terse notation.
* tests/clock_nanosleep.c (main): Initialize struct timespec
using terse notation.
* tests/nanosleep.c (main): Likewise.
2016-07-28 18:32:28 +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
1b2500c6bf tests: fix extended regexps
* tests/adjtimex.c (main): Consistently quote curly braces
in expected output.
* tests/uio.expected: Likewise.
2016-07-28 00:06:46 +00:00
1514448dad Post-release administrivia
* NEWS: Add header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.13-1.
* strace.spec.in: Likewise.
2016-07-27 09:19:37 +00:00
1401 changed files with 47737 additions and 14064 deletions

3
.gitignore vendored
View File

@ -24,6 +24,7 @@
/configure
/depcomp
/install-sh
/ioctl_iocdef.[ih]
/ioctl_redefs[12].h
/ioctlent[012].h
/ioctls_all[012].h
@ -49,6 +50,7 @@
/native_printer_decls.h
/native_printer_defs.h
/printers.h
/scno.h
/sen.h
/stamp-h1
/strace
@ -57,6 +59,7 @@
/strace.dsc
/strace.spec
/sys_func.h
/syscallent.i
/test-driver
/tests-m32
/tests-mx32

View File

@ -1,7 +1,11 @@
# Map git author names and email addresses to canonical/preferred form.
<ak@linux.intel.com> <ak@suse.de>
<chenjingpiao@gmail.com> <chenjingpiao@foxmail.com>
<dgilbert@redhat.com> <dave@treblig.org>
<holger@freyther.de> <zecke@selfish.org>
<kirill@shutemov.name> <kirill.shutemov@linux.intel.com>
<schwab@linux-m68k.org> <schwab@redhat.com>
<schwab@linux-m68k.org> <schwab@suse.de>
<thomas.de.schampheleire@gmail.com> <thomas.de_schampheleire@nokia.com>
<vda.linux@googlemail.com> <dvlasenk@redhat.com>
Eugene Syromyatnikov <evgsyr@gmail.com>

View File

@ -6,8 +6,6 @@ before_install: ./travis-install.sh
script: ./travis-build.sh
after_success: ./travis-success.sh
sudo: required
git:
@ -23,19 +21,35 @@ matrix:
- compiler: gcc
env:
- TARGET=x86_64
- COVERAGE=true
- compiler: gcc
env:
- TARGET=x32
- compiler: gcc
env:
- TARGET=x86
- compiler: clang-3.6
- compiler: clang-3.8
env:
- TARGET=x86_64
- compiler: musl-gcc
env:
- TARGET=x86_64
- compiler: clang-3.6
- compiler: clang-3.8
env:
- TARGET=x86
- compiler: musl-gcc
env:
- TARGET=x86
- compiler: gcc-7
env:
- TARGET=x86_64
- compiler: gcc-7
env:
- TARGET=x32
- compiler: gcc-7
env:
- TARGET=x86
- compiler: gcc
env:
- TARGET=x86_64
- CHECK=coverage
- KHEADERS=torvalds/linux

View File

@ -3,7 +3,8 @@ Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
Copyright (c) 1995, 1996 Michael Elizabeth Chastain <mec@duracef.shout.net>
Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
Copyright (C) 1998-2001 Wichert Akkerman <wakkerma@deephackmode.org>
Copyright (c) 1998-2001 Wichert Akkerman <wakkerma@deephackmode.org>
Copyright (c) 2001-2017 The strace developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -19,7 +19,7 @@ asrc=$ksrc/arch/blackfin/include
To use the errnoent.sh script, give it all the headers that might contain
appropriate errno values. Excessive headers are not a problem. The resulting
output should be directly usable without modification.
sh ./errnoent.sh \
sh ./maint/errnoent.sh \
$ksrc/include/linux/*errno*.h \
$ksrc/include/asm-generic/*errno*.h \
$asrc/asm/*errno*.h \
@ -44,7 +44,7 @@ merging should be used to produce the final ioctlent0.h header.
To use the signalent.sh script, give it all the headers that might contain
appropriate signal values. Excessive headers are not a problem. The resulting
output should be directly usable without modification.
sh ./signalent.sh \
sh ./maint/signalent.sh \
$asrc/asm/signal.h \
> signalent.h
@ -53,6 +53,6 @@ system call numbers. The resulting output is useful as a template for creating
a proper header as it can really only detect the system call number and its
name. It has no way of knowing the number of arguments or strace flags for
decoding them (yet?).
sh ./syscallent.sh \
sh ./maint/syscallent.sh \
$asrc/asm/unistd.h \
> syscallent.h

289
INSTALL
View File

@ -1,108 +1,107 @@
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved. This file is offered as-is, without
warranty of any kind.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
Briefly, the shell command './configure && make && make install' should
configure, build, and install this package. The following more-detailed
instructions are generic; see the 'README' file for instructions
specific to this package. Some packages provide this 'INSTALL' file but
do not implement all of the features documented below. The lack of an
optional feature in a given package is not necessarily a bug. More
recommendations for GNU packages can be found in *note Makefile
Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
The 'configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
those values to create a 'Makefile' in each directory of the package.
It may also create one or more '.h' files containing system-dependent
definitions. Finally, it creates a shell script 'config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
file 'config.log' containing compiler output (useful mainly for
debugging 'configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
It can also use an optional file (typically called 'config.cache' and
enabled with '--cache-file=config.cache' or simply '-C') that saves the
results of its tests to speed up reconfiguring. Caching is disabled by
default to prevent problems with accidental use of stale cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
to figure out how 'configure' could check whether to do them, and mail
diffs or instructions to the address given in the 'README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
some point 'config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The file 'configure.ac' (or 'configure.in') is used to create
'configure' by a program called 'autoconf'. You need 'configure.ac' if
you want to change it or regenerate 'configure' using a newer version of
'autoconf'.
The simplest way to compile this package is:
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
1. 'cd' to the directory containing the package's source code and type
'./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
Running 'configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
2. Type 'make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
3. Optionally, type 'make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
4. Type 'make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
user, and only the 'make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
5. Optionally, type 'make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
regular user, particularly if the prior 'make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
source code directory by typing 'make clean'. To also remove the
files that 'configure' created (so you can compile the package for
a different kind of computer), type 'make distclean'. There is
also a 'make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
7. Often, you can also type 'make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
8. Some packages, particularly those that use Automake, provide 'make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
targets like 'make install' and 'make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
'configure' script does not know about. Run './configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
You can give 'configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here is
an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
@ -111,90 +110,90 @@ is an example:
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
By default, 'make install' installs the package's commands under
'/usr/local/bin', include files under '/usr/local/include', etc. You
can specify an installation prefix other than '/usr/local' by giving
'configure' the option '--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
options like '--bindir=DIR' to specify different values for particular
kinds of files. Run 'configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the default
for these options is expressed in terms of '${prefix}', so that
specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
correct locations to 'configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
'make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
affected directory. For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
'${prefix}'. Any directories that were specified during 'configure',
but not in terms of '${prefix}', must each be overridden at install time
for the entire installation to be relocated. The approach of makefile
variable overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation. However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
The second method involves providing the 'DESTDIR' variable. For
example, 'make install DESTDIR=/alternate/directory' will prepend
'/alternate/directory' before all installation names. The approach of
'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
when some directory options were not specified in terms of '${prefix}'
at 'configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed with
an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
an extra prefix or suffix on their names by giving 'configure' the
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
Some packages pay attention to '--enable-FEATURE' options to
'configure', where FEATURE indicates an optional part of the package.
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
is something like 'gnu-as' or 'x' (for the X Window System). The
'README' should mention any '--enable-' and '--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
For packages that use the X Window System, 'configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
you can use the 'configure' options '--x-includes=DIR' and
'--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
execution of 'make' will be. For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
overridden with 'make V=0'.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
There may be some features 'configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
architectures, 'configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
'--build=TYPE' option. TYPE can either be a short name for the system
type, such as 'sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
@ -203,100 +202,100 @@ where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
See the file 'config.sub' for the possible values of each field. If
'config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
use the option '--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
eventually be run) with '--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
If you want to set default values for 'configure' scripts to share, you
can create a site shell script called 'config.site' that gives default
values for variables like 'CC', 'cache_file', and 'prefix'. 'configure'
looks for 'PREFIX/share/config.site' if it exists, then
'PREFIX/etc/config.site' if it exists. Or, you can set the
'CONFIG_SITE' environment variable to the location of the site script.
A warning: not all 'configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
environment passed to 'configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
them in the 'configure' command line, using 'VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
causes the specified 'gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
Autoconf limitation. Until the limitation is lifted, you can use this
workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
'configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
'configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
'--help'
'-h'
Print a summary of all of the options to 'configure', and exit.
`--help=short'
`--help=recursive'
'--help=short'
'--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
'configure', and exit. The 'short' variant lists options used only
in the top level, while the 'recursive' variant lists options also
present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
'--version'
'-V'
Print the version of Autoconf used to generate the 'configure'
script, and exit.
`--cache-file=FILE'
'--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
traditionally 'config.cache'. FILE defaults to '/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
'--config-cache'
'-C'
Alias for '--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
'--quiet'
'--silent'
'-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
suppress all normal output, redirect it to '/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
'--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
'configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
'--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names:: for
more details, including other options available for fine-tuning the
installation locations.
`--no-create'
`-n'
'--no-create'
'-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
'configure' also accepts some other, not widely useful, options. Run
'configure --help' for more details.

8
INSTALL-git.md Normal file
View File

@ -0,0 +1,8 @@
Build strace from git repository
================================
If you use the GIT version of strace there will be some files missing
that you need to build strace. These files are generated by tools from
the GNU Autoconf and Automake packages.
Note: rather than running `autoreconf` directly, use the `./bootstrap` script
and follow the instructions given in given in [INSTALL](INSTALL) file for further installation.

View File

@ -4,6 +4,7 @@
# Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
# Copyright (c) 2002-2017 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -53,6 +54,9 @@ AM_CPPFLAGS = -I$(builddir)/$(OS)/$(ARCH) \
-I$(builddir) \
-I$(srcdir)
AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD)
AM_CPPFLAGS_FOR_BUILD = $(AM_CPPFLAGS)
include xlat/Makemodule.am
strace_CPPFLAGS = $(AM_CPPFLAGS)
@ -67,12 +71,14 @@ libstrace_a_SOURCES = \
fstatfs.c \
fstatfs64.c \
ipc.c \
sigreturn.c \
socketcall.c \
statfs.c \
statfs64.c \
sync_file_range.c \
sync_file_range2.c \
upeek.c \
upoke.c \
# end of libstrace_a_SOURCES
strace_SOURCES = \
@ -97,12 +103,13 @@ strace_SOURCES = \
desc.c \
dirent.c \
dirent64.c \
dm.c \
dyxlat.c \
empty.h \
epoll.c \
evdev.c \
eventfd.c \
execve.c \
exit.c \
fadvise.c \
fallocate.c \
fanotify.c \
@ -112,8 +119,9 @@ strace_SOURCES = \
fetch_struct_flock.c \
fetch_struct_mmsghdr.c \
fetch_struct_msghdr.c \
fetch_struct_stat.c \
fetch_struct_stat64.c \
fetch_struct_statfs.c \
file.c \
file_handle.c \
file_ioctl.c \
fs_x_ioctl.c \
@ -147,9 +155,11 @@ strace_SOURCES = \
link.c \
linux/asm_stat.h \
linux/x32/asm_stat.h \
linux/x86_64/asm_stat.h \
lookup_dcookie.c \
loop.c \
lseek.c \
macros.h \
mem.c \
membarrier.c \
memfd_create.c \
@ -164,29 +174,45 @@ strace_SOURCES = \
native_defs.h \
net.c \
netlink.c \
netlink.h \
netlink_sock_diag.c \
nlattr.c \
nlattr.h \
nsfs.c \
nsfs.h \
nsig.h \
numa.c \
oldstat.c \
open.c \
or1k_atomic.c \
pathtrace.c \
perf.c \
perf_event_struct.h \
personality.c \
pkeys.c \
poll.c \
prctl.c \
print_dev_t.c \
print_fields.h \
print_mq_attr.c \
print_msgbuf.c \
print_sg_req_info.c \
print_sigevent.c \
print_statfs.c \
print_struct_stat.c \
print_time.c \
print_timespec.c \
print_timeval.c \
print_timex.c \
printmode.c \
printrusage.c \
printsiginfo.c \
printsiginfo.h \
printstat.h \
process.c \
process_vm.c \
ptp.c \
ptrace.h \
qualify.c \
quota.c \
readahead.c \
readlink.c \
@ -194,27 +220,37 @@ strace_SOURCES = \
regs.h \
renameat.c \
resource.c \
rt_sigframe.c \
rt_sigreturn.c \
rtc.c \
sched.c \
sched_attr.h \
scsi.c \
seccomp.c \
seccomp_fprog.h \
sendfile.c \
sg_io_v3.c \
sg_io_v4.c \
sigaltstack.c \
sigevent.h \
signal.c \
signalfd.c \
sigreturn.c \
sock.c \
sockaddr.c \
socketutils.c \
sram_alloc.c \
stat.c \
stat.h \
stat64.c \
statfs.c \
statfs.h \
statx.c \
statx.h \
strace.c \
swapon.c \
syscall.c \
sysctl.c \
sysent.h \
sysinfo.c \
syslog.c \
sysmips.c \
@ -229,13 +265,14 @@ strace_SOURCES = \
umount.c \
uname.c \
userfaultfd.c \
ustat.c \
util.c \
utime.c \
utimes.c \
v4l2.c \
vsprintf.c \
wait.c \
xattr.c \
xlat.c \
xlat.h \
xmalloc.c \
# end of strace_SOURCES
@ -250,7 +287,7 @@ endif
@CODE_COVERAGE_RULES@
CODE_COVERAGE_BRANCH_COVERAGE = 1
CODE_COVERAGE_GENHTML_OPTIONS = $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) \
--prefix $(shell realpath -Ls $(abs_top_srcdir)/..)
--prefix $(shell cd $(abs_top_srcdir)/.. && pwd || echo .)
CODE_COVERAGE_IGNORE_PATTERN = '/usr/include/*'
strace_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
strace_CFLAGS += $(CODE_COVERAGE_CFLAGS)
@ -281,10 +318,11 @@ EXTRA_DIST = \
debian/strace64.install \
debian/strace64.manpages \
debian/watch \
errnoent.sh \
generate_sen.sh \
ioctl_iocdef.c \
ioctlsort.c \
linux/32/ioctls_inc.h \
linux/32/ioctls_inc_align16.h \
linux/32/ioctls_inc_align32.h \
linux/32/ioctls_inc_align64.h \
linux/32/syscallent.h \
@ -292,6 +330,7 @@ EXTRA_DIST = \
linux/64/syscallent.h \
linux/aarch64/arch_regs.c \
linux/aarch64/arch_regs.h \
linux/aarch64/arch_rt_sigframe.c\
linux/aarch64/arch_sigreturn.c \
linux/aarch64/errnoent1.h \
linux/aarch64/get_error.c \
@ -301,12 +340,15 @@ EXTRA_DIST = \
linux/aarch64/ioctls_arch1.h \
linux/aarch64/ioctls_inc0.h \
linux/aarch64/ioctls_inc1.h \
linux/aarch64/set_error.c \
linux/aarch64/set_scno.c \
linux/aarch64/signalent1.h \
linux/aarch64/syscallent.h \
linux/aarch64/syscallent1.h \
linux/alpha/arch_getrval2.c \
linux/alpha/arch_regs.c \
linux/alpha/arch_regs.h \
linux/alpha/arch_rt_sigframe.c \
linux/alpha/arch_sigreturn.c \
linux/alpha/errnoent.h \
linux/alpha/get_error.c \
@ -315,63 +357,92 @@ EXTRA_DIST = \
linux/alpha/get_syscall_result.c\
linux/alpha/ioctls_arch0.h \
linux/alpha/ioctls_inc0.h \
linux/alpha/set_error.c \
linux/alpha/set_scno.c \
linux/alpha/signalent.h \
linux/alpha/syscallent.h \
linux/alpha/userent.h \
linux/arc/arch_regs.c \
linux/arc/arch_regs.h \
linux/arc/arch_rt_sigframe.c \
linux/arc/get_error.c \
linux/arc/get_scno.c \
linux/arc/get_syscall_args.c \
linux/arc/ioctls_arch0.h \
linux/arc/ioctls_inc0.h \
linux/arc/set_error.c \
linux/arc/set_scno.c \
linux/arc/syscallent.h \
linux/arch_regs.h \
linux/arch_sigreturn.c \
linux/arm/arch_regs.c \
linux/arm/arch_regs.h \
linux/arm/arch_rt_sigframe.c \
linux/arm/arch_sigreturn.c \
linux/arm/get_error.c \
linux/arm/get_scno.c \
linux/arm/get_syscall_args.c \
linux/arm/ioctls_arch0.h \
linux/arm/ioctls_inc0.h \
linux/arm/set_error.c \
linux/arm/set_scno.c \
linux/arm/syscallent.h \
linux/arm/userent.h \
linux/avr32/arch_regs.c \
linux/avr32/arch_regs.h \
linux/avr32/arch_rt_sigframe.c \
linux/avr32/get_error.c \
linux/avr32/get_scno.c \
linux/avr32/get_syscall_args.c \
linux/avr32/ioctls_arch0.h \
linux/avr32/ioctls_inc0.h \
linux/avr32/set_error.c \
linux/avr32/set_scno.c \
linux/avr32/syscallent.h \
linux/avr32/userent.h \
linux/bfin/arch_regs.c \
linux/bfin/arch_rt_sigframe.c \
linux/bfin/get_error.c \
linux/bfin/get_scno.c \
linux/bfin/get_syscall_args.c \
linux/bfin/get_syscall_result.c \
linux/bfin/ioctls_arch0.h \
linux/bfin/ioctls_inc0.h \
linux/bfin/rt_sigframe.h \
linux/bfin/set_error.c \
linux/bfin/set_scno.c \
linux/bfin/syscallent.h \
linux/bfin/userent.h \
linux/crisv10/arch_regs.c \
linux/crisv10/arch_rt_sigframe.c\
linux/crisv10/arch_sigreturn.c \
linux/crisv10/get_error.c \
linux/crisv10/get_scno.c \
linux/crisv10/get_syscall_args.c \
linux/crisv10/get_syscall_result.c \
linux/crisv10/rt_sigframe.h \
linux/crisv10/set_error.c \
linux/crisv10/set_scno.c \
linux/crisv10/syscallent.h \
linux/crisv10/userent.h \
linux/crisv32/arch_regs.c \
linux/crisv32/arch_rt_sigframe.c\
linux/crisv32/arch_sigreturn.c \
linux/crisv32/get_error.c \
linux/crisv32/get_scno.c \
linux/crisv32/get_syscall_args.c \
linux/crisv32/get_syscall_result.c \
linux/crisv32/rt_sigframe.h \
linux/crisv32/set_error.c \
linux/crisv32/set_scno.c \
linux/crisv32/syscallent.h \
linux/crisv32/userent.h \
linux/dummy.h \
linux/errnoent.h \
linux/getregs_old.h \
linux/hppa/arch_regs.c \
linux/hppa/arch_regs.h \
linux/hppa/arch_rt_sigframe.c \
linux/hppa/errnoent.h \
linux/hppa/get_error.c \
linux/hppa/get_scno.c \
@ -379,49 +450,68 @@ EXTRA_DIST = \
linux/hppa/get_syscall_result.c \
linux/hppa/ioctls_arch0.h \
linux/hppa/ioctls_inc0.h \
linux/hppa/rt_sigframe.h \
linux/hppa/set_error.c \
linux/hppa/set_scno.c \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
linux/i386/arch_regs.c \
linux/i386/arch_regs.h \
linux/i386/arch_rt_sigframe.c \
linux/i386/arch_sigreturn.c \
linux/i386/get_error.c \
linux/i386/get_scno.c \
linux/i386/get_syscall_args.c \
linux/i386/ioctls_arch0.h \
linux/i386/ioctls_inc0.h \
linux/i386/rt_sigframe.h \
linux/i386/set_error.c \
linux/i386/set_scno.c \
linux/i386/syscallent.h \
linux/i386/userent.h \
linux/i386/userent0.h \
linux/ia64/arch_getrval2.c \
linux/ia64/arch_regs.c \
linux/ia64/arch_regs.h \
linux/ia64/arch_sigreturn.c \
linux/ia64/arch_rt_sigframe.c \
linux/ia64/get_error.c \
linux/ia64/get_scno.c \
linux/ia64/get_syscall_args.c \
linux/ia64/ioctls_arch0.h \
linux/ia64/ioctls_inc0.h \
linux/ia64/rt_sigframe.h \
linux/ia64/set_error.c \
linux/ia64/set_scno.c \
linux/ia64/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
linux/m68k/arch_regs.c \
linux/m68k/arch_regs.h \
linux/m68k/arch_rt_sigframe.c \
linux/m68k/arch_sigreturn.c \
linux/m68k/get_error.c \
linux/m68k/get_scno.c \
linux/m68k/get_syscall_args.c \
linux/m68k/get_syscall_result.c \
linux/m68k/ioctls_arch0.h \
linux/m68k/ioctls_inc0.h \
linux/m68k/rt_sigframe.h \
linux/m68k/set_error.c \
linux/m68k/set_scno.c \
linux/m68k/syscallent.h \
linux/m68k/userent.h \
linux/metag/arch_regs.c \
linux/metag/arch_regs.h \
linux/metag/arch_rt_sigframe.c \
linux/metag/get_error.c \
linux/metag/get_scno.c \
linux/metag/get_syscall_args.c \
linux/metag/ioctls_arch0.h \
linux/metag/ioctls_inc0.h \
linux/metag/set_error.c \
linux/metag/set_scno.c \
linux/metag/syscallent.h \
linux/microblaze/arch_regs.c \
linux/microblaze/arch_rt_sigframe.c\
linux/microblaze/arch_sigreturn.c \
linux/microblaze/get_error.c \
linux/microblaze/get_scno.c \
@ -429,11 +519,14 @@ EXTRA_DIST = \
linux/microblaze/get_syscall_result.c \
linux/microblaze/ioctls_arch0.h \
linux/microblaze/ioctls_inc0.h \
linux/microblaze/set_error.c \
linux/microblaze/set_scno.c \
linux/microblaze/syscallent.h \
linux/microblaze/userent.h \
linux/mips/arch_getrval2.c \
linux/mips/arch_regs.c \
linux/mips/arch_regs.h \
linux/mips/arch_rt_sigframe.c \
linux/mips/arch_sigreturn.c \
linux/mips/errnoent.h \
linux/mips/genstub.sh \
@ -442,6 +535,9 @@ EXTRA_DIST = \
linux/mips/get_syscall_args.c \
linux/mips/ioctls_arch0.h \
linux/mips/ioctls_inc0.h \
linux/mips/rt_sigframe.h \
linux/mips/set_error.c \
linux/mips/set_scno.c \
linux/mips/signalent.h \
linux/mips/syscallent-compat.h \
linux/mips/syscallent-n32.h \
@ -452,35 +548,49 @@ EXTRA_DIST = \
linux/mtd-abi.h \
linux/netlink_diag.h \
linux/nios2/arch_regs.c \
linux/nios2/arch_regs.h \
linux/nios2/arch_rt_sigframe.c \
linux/nios2/get_error.c \
linux/nios2/get_scno.c \
linux/nios2/get_syscall_args.c \
linux/nios2/ioctls_arch0.h \
linux/nios2/ioctls_inc0.h \
linux/nios2/set_error.c \
linux/nios2/set_scno.c \
linux/nios2/syscallent.h \
linux/or1k/arch_regs.c \
linux/or1k/arch_regs.h \
linux/or1k/arch_rt_sigframe.c \
linux/or1k/get_error.c \
linux/or1k/get_scno.c \
linux/or1k/get_syscall_args.c \
linux/or1k/ioctls_arch0.h \
linux/or1k/ioctls_inc0.h \
linux/or1k/set_error.c \
linux/or1k/set_scno.c \
linux/or1k/syscallent.h \
linux/or1k/userent.h \
linux/packet_diag.h \
linux/personality.h \
linux/powerpc/arch_regs.c \
linux/powerpc/arch_regs.h \
linux/powerpc/arch_rt_sigframe.c\
linux/powerpc/arch_sigreturn.c \
linux/powerpc/errnoent.h \
linux/powerpc/get_error.c \
linux/powerpc/get_scno.c \
linux/powerpc/get_syscall_args.c \
linux/powerpc/getregs_old.c \
linux/powerpc/getregs_old.h \
linux/powerpc/ioctls_arch0.h \
linux/powerpc/ioctls_inc0.h \
linux/powerpc/set_error.c \
linux/powerpc/set_scno.c \
linux/powerpc/syscallent.h \
linux/powerpc/userent.h \
linux/powerpc64/arch_regs.c \
linux/powerpc64/arch_regs.h \
linux/powerpc64/arch_rt_sigframe.c\
linux/powerpc64/arch_sigreturn.c \
linux/powerpc64/errnoent.h \
linux/powerpc64/errnoent1.h \
@ -488,63 +598,101 @@ EXTRA_DIST = \
linux/powerpc64/get_scno.c \
linux/powerpc64/get_syscall_args.c \
linux/powerpc64/getregs_old.c \
linux/powerpc64/getregs_old.h \
linux/powerpc64/ioctls_arch0.h \
linux/powerpc64/ioctls_arch1.h \
linux/powerpc64/ioctls_inc0.h \
linux/powerpc64/ioctls_inc1.h \
linux/powerpc64/rt_sigframe.h \
linux/powerpc64/set_error.c \
linux/powerpc64/set_scno.c \
linux/powerpc64/signalent1.h \
linux/powerpc64/syscallent.h \
linux/powerpc64/syscallent1.h \
linux/powerpc64/userent.h \
linux/ptp_clock.h \
linux/riscv/arch_regs.c \
linux/riscv/arch_regs.h \
linux/riscv/arch_rt_sigframe.c \
linux/riscv/errnoent1.h \
linux/riscv/get_error.c \
linux/riscv/get_scno.c \
linux/riscv/get_syscall_args.c \
linux/riscv/ioctls_arch0.h \
linux/riscv/ioctls_arch1.h \
linux/riscv/ioctls_inc0.h \
linux/riscv/ioctls_inc1.h \
linux/riscv/set_error.c \
linux/riscv/set_scno.c \
linux/riscv/signalent1.h \
linux/riscv/syscallent.h \
linux/riscv/syscallent1.h \
linux/rt_sigframe.h \
linux/s390/arch_regs.c \
linux/s390/arch_regs.h \
linux/s390/arch_rt_sigframe.c \
linux/s390/arch_sigreturn.c \
linux/s390/get_error.c \
linux/s390/get_scno.c \
linux/s390/get_syscall_args.c \
linux/s390/ioctls_arch0.h \
linux/s390/ioctls_inc0.h \
linux/s390/rt_sigframe.h \
linux/s390/set_error.c \
linux/s390/set_scno.c \
linux/s390/syscallent.h \
linux/s390/userent.h \
linux/s390/userent0.h \
linux/s390/userent1.h \
linux/s390x/arch_regs.c \
linux/s390x/arch_regs.h \
linux/s390x/arch_rt_sigframe.c \
linux/s390x/arch_sigreturn.c \
linux/s390x/get_error.c \
linux/s390x/get_scno.c \
linux/s390x/get_syscall_args.c \
linux/s390x/ioctls_arch0.h \
linux/s390x/ioctls_inc0.h \
linux/s390x/rt_sigframe.h \
linux/s390x/set_error.c \
linux/s390x/set_scno.c \
linux/s390x/syscallent.h \
linux/s390x/userent.h \
linux/sh/arch_getrval2.c \
linux/sh/arch_regs.c \
linux/sh/arch_rt_sigframe.c \
linux/sh/get_error.c \
linux/sh/get_scno.c \
linux/sh/get_syscall_args.c \
linux/sh/get_syscall_result.c \
linux/sh/ioctls_arch0.h \
linux/sh/ioctls_inc0.h \
linux/sh/set_error.c \
linux/sh/set_scno.c \
linux/sh/syscallent.h \
linux/sh/userent.h \
linux/sh/userent0.h \
linux/sh64/arch_regs.c \
linux/sh64/arch_regs.h \
linux/sh64/arch_rt_sigframe.c \
linux/sh64/get_error.c \
linux/sh64/get_scno.c \
linux/sh64/get_syscall_args.c \
linux/sh64/get_syscall_result.c \
linux/sh64/ioctls_arch0.h \
linux/sh64/ioctls_inc0.h \
linux/sh64/rt_sigframe.h \
linux/sh64/set_error.c \
linux/sh64/set_scno.c \
linux/sh64/syscallent.h \
linux/sh64/userent.h \
linux/signalent.h \
linux/smc_diag.h \
linux/sock_diag.h \
linux/sparc/arch_getrval2.c \
linux/sparc/arch_regs.c \
linux/sparc/arch_regs.h \
linux/sparc/arch_rt_sigframe.c \
linux/sparc/arch_sigreturn.c \
linux/sparc/errnoent.h \
linux/sparc/gen.pl \
@ -553,12 +701,16 @@ EXTRA_DIST = \
linux/sparc/get_syscall_args.c \
linux/sparc/ioctls_arch0.h \
linux/sparc/ioctls_inc0.h \
linux/sparc/rt_sigframe.h \
linux/sparc/set_error.c \
linux/sparc/set_scno.c \
linux/sparc/signalent.h \
linux/sparc/syscallent.h \
linux/sparc/userent.h \
linux/sparc64/arch_getrval2.c \
linux/sparc64/arch_regs.c \
linux/sparc64/arch_regs.h \
linux/sparc64/arch_rt_sigframe.c\
linux/sparc64/arch_sigreturn.c \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
@ -569,6 +721,9 @@ EXTRA_DIST = \
linux/sparc64/ioctls_arch1.h \
linux/sparc64/ioctls_inc0.h \
linux/sparc64/ioctls_inc1.h \
linux/sparc64/rt_sigframe.h \
linux/sparc64/set_error.c \
linux/sparc64/set_scno.c \
linux/sparc64/signalent.h \
linux/sparc64/signalent1.h \
linux/sparc64/syscallent.h \
@ -578,6 +733,7 @@ EXTRA_DIST = \
linux/syscall.h \
linux/tile/arch_regs.c \
linux/tile/arch_regs.h \
linux/tile/arch_rt_sigframe.c \
linux/tile/arch_sigreturn.c \
linux/tile/errnoent1.h \
linux/tile/get_error.c \
@ -587,6 +743,9 @@ EXTRA_DIST = \
linux/tile/ioctls_arch1.h \
linux/tile/ioctls_inc0.h \
linux/tile/ioctls_inc1.h \
linux/tile/rt_sigframe.h \
linux/tile/set_error.c \
linux/tile/set_scno.c \
linux/tile/signalent1.h \
linux/tile/syscallent.h \
linux/tile/syscallent1.h \
@ -597,6 +756,7 @@ EXTRA_DIST = \
linux/userent0.h \
linux/x32/arch_regs.c \
linux/x32/arch_regs.h \
linux/x32/arch_rt_sigframe.c \
linux/x32/arch_sigreturn.c \
linux/x32/errnoent1.h \
linux/x32/get_error.c \
@ -606,12 +766,16 @@ EXTRA_DIST = \
linux/x32/ioctls_arch1.h \
linux/x32/ioctls_inc0.h \
linux/x32/ioctls_inc1.h \
linux/x32/rt_sigframe.h \
linux/x32/set_error.c \
linux/x32/set_scno.c \
linux/x32/signalent1.h \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
linux/x86_64/arch_regs.c \
linux/x86_64/arch_regs.h \
linux/x86_64/arch_rt_sigframe.c \
linux/x86_64/arch_sigreturn.c \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
@ -620,12 +784,16 @@ EXTRA_DIST = \
linux/x86_64/get_scno.c \
linux/x86_64/get_syscall_args.c \
linux/x86_64/getregs_old.c \
linux/x86_64/getregs_old.h \
linux/x86_64/ioctls_arch0.h \
linux/x86_64/ioctls_arch1.h \
linux/x86_64/ioctls_arch2.h \
linux/x86_64/ioctls_inc0.h \
linux/x86_64/ioctls_inc1.h \
linux/x86_64/ioctls_inc2.h \
linux/x86_64/rt_sigframe.h \
linux/x86_64/set_error.c \
linux/x86_64/set_scno.c \
linux/x86_64/signalent1.h \
linux/x86_64/signalent2.h \
linux/x86_64/syscallent.h \
@ -633,32 +801,33 @@ EXTRA_DIST = \
linux/x86_64/syscallent2.h \
linux/x86_64/userent.h \
linux/xtensa/arch_regs.c \
linux/xtensa/arch_rt_sigframe.c \
linux/xtensa/get_error.c \
linux/xtensa/get_scno.c \
linux/xtensa/get_syscall_args.c \
linux/xtensa/get_syscall_result.c \
linux/xtensa/ioctls_arch0.h \
linux/xtensa/ioctls_inc0.h \
linux/xtensa/set_error.c \
linux/xtensa/set_scno.c \
linux/xtensa/syscallent.h \
linux/xtensa/userent.h \
maint/ioctls_gen.sh \
maint/ioctls_hex.sh \
maint/ioctls_sym.sh \
maint/print_ioctlent.c \
mpers.awk \
mpers.sh \
mpers_test.sh \
mpers_xlat.h \
signalent.sh \
scno.head \
strace-graph \
strace-log-merge \
strace.spec \
syscallent.sh \
$(XLAT_INPUT_FILES) \
$(XLAT_HEADER_FILES) \
xlat/gen.sh \
xlate.el
.PHONY: check-valgrind-local
check-valgrind-local:
.PHONY: srpm
srpm: dist-xz
rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
@ -685,6 +854,7 @@ sen.h: $(patsubst %,$(srcdir)/%,$(syscallent_files))
dist-hook:
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
${AM_V_GEN}echo $(COPYRIGHT_YEAR) > $(distdir)/.year
today = $(shell date +%Y-%m-%d)
version_regexp = $(subst .,\.,$(VERSION))
@ -702,9 +872,9 @@ news-check: NEWS
ioctlsort_CC = $(CC_FOR_BUILD)
ioctlsort_DEFS = $(DEFS)
ioctlsort_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
ioctlsort_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD)
ioctlsort_CFLAGS = $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
ioctlsort_CPPFLAGS = $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD)
ioctlsort_CFLAGS = $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
ioctlsort_LDFLAGS = $(AM_LDFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD)
ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
@ -713,7 +883,7 @@ ioctl_redefs_h = $(filter-out ioctl_redefs0.h,$(subst ioctlent,ioctl_redefs,$(io
ioctl_redefs%.h: ioctlent%.h ioctlent0.h
sort $< > $<-t
sort ioctlent0.h | comm -23 $<-t - | \
sed -n 's/^{ "\([^"]\+\)", \(0x[[:xdigit:]]\+\) },$$/#ifdef \1\n# undef \1\n# define \1 \2\n#endif/p' \
sed -r -n 's/^\{ "([^"]+)", (0x[[:xdigit:]]+) \},$$/#ifdef \1\n# undef \1\n# define \1 \2\n#endif/p' \
> $@-t
rm -f $<-t
mv $@-t $@
@ -721,10 +891,19 @@ ioctl_redefs%.h: ioctlent%.h ioctlent0.h
ioctlent%.h: ioctlsort%
./$< > $@
# Need to pick up <linux/ioctl.h> definitions *for host* while compiling
# ioctlsort *for build*, hence this magic.
ioctl_iocdef.i: $(srcdir)/ioctl_iocdef.c
$(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(strace_CPPFLAGS) $(CPPFLAGS) $< -o $@
ioctl_iocdef.h: ioctl_iocdef.i
sed -n 's/^DEFINE HOST/#define /p' $< > $@
ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
$(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
ioctlsort%.o: ioctls_all%.h ioctl_iocdef.h $(srcdir)/ioctlsort.c
$(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
@ -733,9 +912,14 @@ ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioc
BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
CLEANFILES = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
ioctl_iocdef.h ioctl_iocdef.i \
native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
include scno.am
$(strace_OBJECTS): scno.h
# defines mpers_source_files
include mpers.am
srcdir_mpers_source_files = $(patsubst %,$(srcdir)/%,$(mpers_source_files))
@ -754,7 +938,7 @@ libmpers_CFLAGS = $(strace_CFLAGS)
mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
for f in $^; do \
CC="$(CC)" CFLAGS="$(mpers_sh_opts)" \
CC="$(CC)" 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) $$f || exit; \
done
@ -762,7 +946,7 @@ mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
m%_type_defs.h: $(srcdir_mpers_source_files)
for f in $^; do \
sed -n 's/^#include DEF_MPERS_TYPE(\([^)]\+\))/#ifdef MPERS_$(mpers_PREFIX)\1\n# define \1 MPERS_$(mpers_PREFIX)\1\n#endif/p' $$f || exit; \
sed -r -n 's/^#[[:space:]]*include DEF_MPERS_TYPE\(([^)]+)\)/#ifdef MPERS_$(mpers_PREFIX)\1\n# define \1 MPERS_$(mpers_PREFIX)\1\n#endif/p' $$f || exit; \
done > $@-t
echo '#undef MPERS_PRINTER_NAME' >> $@-t
echo '#define MPERS_PRINTER_NAME(printer_name) printer_name' >> $@-t
@ -772,7 +956,7 @@ m%_type_defs.h: $(srcdir_mpers_source_files)
m%_funcs.h: $(srcdir_mpers_source_files)
for f in $^; do \
sed -n 's/^SYS_FUNC(\([^)]\+\))/#undef sys_\1\n#define sys_\1 $(mpers_PREFIX)sys_\1/p' $$f || exit; \
sed -r -n 's/^SYS_FUNC\(([^)]+)\)/#undef sys_\1\n#define sys_\1 $(mpers_PREFIX)sys_\1/p' $$f || exit; \
done > $@-t && \
echo '#include "sys_func.h"' >> $@-t
mv $@-t $@
@ -782,13 +966,13 @@ m%_funcs.h: $(srcdir_mpers_source_files)
%.c.mpers.i: $(srcdir)/%.c
$(CPP) -P $(mpers_sh_opts) -DIN_MPERS_BOOTSTRAP $< -o $@
mpers_printer_decl_pattern = ^MPERS_PRINTER_DECL(\([^,)]\+\),[[:space:]]*\([^,)]\+\),[[:space:]]*\([^)]\+\))$$
mpers_printer_decl_pattern = ^MPERS_PRINTER_DECL\(([^,)]+),[[:space:]]*([^,)]+),[[:space:]]*([^)]+)\)$$
printers.h: $(mpers_preproc_files)
echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
echo 'typedef struct {' >> $@-t
for f in $^; do \
sed -n 's/$(mpers_printer_decl_pattern)/ \1 (*\2)(\3);\n#define \2 MPERS_PRINTER_NAME(\2)\n/p' $$f \
sed -r -n 's/$(mpers_printer_decl_pattern)/ \1 (*\2)(\3);\n#define \2 MPERS_PRINTER_NAME(\2)\n/p' $$f \
|| exit; \
done >> $@-t
echo '} struct_printers;' >> $@-t
@ -799,7 +983,7 @@ printers.h: $(mpers_preproc_files)
%_printer_decls.h: $(mpers_preproc_files)
echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
for f in $^; do \
sed -n 's/$(mpers_printer_decl_pattern)/extern \1 $(mpers_PREFIX)\2(\3);/p' $$f \
sed -r -n 's/$(mpers_printer_decl_pattern)/extern \1 $(mpers_PREFIX)\2(\3);/p' $$f \
|| exit; \
done >> $@-t
mv $@-t $@
@ -807,7 +991,7 @@ printers.h: $(mpers_preproc_files)
%_printer_defs.h: $(mpers_preproc_files)
echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
for f in $^; do \
sed -n 's/$(mpers_printer_decl_pattern)/\.\2 = $(mpers_PREFIX)\2,/p' $$f \
sed -r -n 's/$(mpers_printer_decl_pattern)/.\2 = $(mpers_PREFIX)\2,/p' $$f \
|| exit; \
done >> $@-t
mv $@-t $@
@ -869,7 +1053,7 @@ $(srcdir)/CREDITS: $(srcdir)/CREDITS.in $(srcdir)/.mailmap \
( \
cd $(srcdir); \
sed '/^##/,$$d' CREDITS.in; \
{ sed -n '1,/^##>/d; s/ \+/\t/; s/^./&/p' CREDITS.in; \
{ sed -n '1,/^##>/d; s/ */\t/; s/^./&/p' CREDITS.in; \
git log --pretty=format:'%aN %aE'; \
} | LC_ALL=C sort -u \
| awk -F'\t' '{printf("\t%s <%s>\n",$$1,$$2)}'; \

203
NEWS
View File

@ -1,3 +1,202 @@
Noteworthy changes in release 4.18 (2017-07-05)
===============================================
* Improvements
* Implemented decoding of SCM_TIMESTAMP* control messages.
* Implemented decoding of netlink NLMSG_DONE messages.
* Implemented decoding of netlink generic nlmsg_type and nlmsg_flags.
* Implemented decoding of NETLINK_AUDIT, NETLINK_NETFILTER, NETLINK_ROUTE,
NETLINK_SELINUX, NETLINK_SOCK_DIAG, and NETLINK_XFRM message types.
* Implemented decoding of NETLINK_GENERIC protocol families.
* Implemented basic protocol specific decoding of AF_INET, AF_INET6,
AF_NETLINK, AF_PACKET, AF_SMC, and AF_UNIX messages of NETLINK_SOCK_DIAG.
* Implemented basic decoding of netlink attributes.
* Implemented basic protocol specific decoding of AF_INET, AF_NETLINK,
AF_PACKET, AF_SMC, and AF_UNIX netlink attributes of NETLINK_SOCK_DIAG.
* Implemented decoding of inet_diag_msg, netlink_diag_msg, and unix_diag_msg
netlink attributes of NETLINK_SOCK_DIAG.
* Updated lists of ARPHRD_*, KEYCTL_*, NDIAG_SHOW_*, RTM_*, SCM_*, SCTP_*,
SO_*, V4L2_*, and prctl ARCH_* constants.
* Updated lists of ioctl commands from Linux 4.12.
* Bug fixes
* In interactive mode (-I2), those signals that were blocked at startup
will remain blocked for the whole period of strace execution.
* strace no longer resets SIGCHLD handler in tracees to the default action.
* When traced command is terminated by a blocked signal, strace unblocks
that signal to ensure its own termination with the same signal.
* Fixed corner cases in decoding of old sigaction syscall.
* Fixed build with old kernel headers on mips.
* Fixed build on aarch64 and tile with glibc >= 2.26.
* Fixed build on arc and nios2.
Noteworthy changes in release 4.17 (2017-05-24)
===============================================
* Changes in command line syntax
* Syscall classes specified in -e trace= option now have % prefix (like
-e trace=%process). Old style class names without leading % are still
supported, but considered deprecated now.
* Improvements
* Optimized syscall filtering.
* Improved representation of timestamps.
* Enhanced decoding of sched_setattr syscall.
* Added -e trace=%stat option for tracing variants of stat syscall.
* Added -e trace=%lstat option for tracing variants of lstat syscall.
* Added -e trace=%fstat option for tracing variants of fstat and fstatat
syscalls.
* Added -e trace=%%stat option for tracing syscalls used for querying file
status information (stat, lstat, fstat, fstatat, statx, and their
variations).
* Added -e trace=%statfs option for tracing statfs, statfs64 and statvfs
syscalls.
* Added -e trace=%fstatfs option for tracing fstatfs, fstatfs64 and fstatvfs
syscalls.
* Added -e trace=%%statfs option for tracing syscalls used for querying file
system statistics information (statfs-like, fstatfs-like and ustat).
* Added -e trace=/regex option for filtering syscalls using regular
expressions.
* Added support for prepending of question mark before syscall qualification
in -e trace expressions in order to suppress error in case no syscalls
matched the provided qualification.
* Implemented decoding of signal mask in rt_sigreturn syscall on alpha, arc,
arm, avr32, bfin, cris, hppa, m68k, metag, microblaze, mips, nios2, or1k,
powerpc, powerpc64, riscv, sh, sh64, sparc, sparc64, tile, x86, and xtensa
architectures.
* Implemented decoding of statx syscall.
* Implemented decoding of NS_* ioctl commands.
* Implemented decoding of the remaining V4L2_BUF_TYPE_* types.
* Implemented decoding of VIDIOC_[SG]_TUNER ioctl commands.
* Implemented decoding of NLMSG_ERROR netlink messages.
* Improved decoding of BPF_PROG_ATTACH command of bpf syscall.
* Improved decoding of misplaced parts in DM_* ioctl commands.
* Updated lists of ioctl commands from Linux 4.11.
* Bug fixes
* Fixed decoding of flags argument of preadv2 and pwritev2 syscalls on x32.
* Fixed the number of arguments and tracing flags of alpha specific syscalls.
* Fixed decoding of old sigsuspend syscall on alpha, cris, mips, powerpc,
powerpc64, sh, sh64, sparc, and sparc64.
* Fixed decoding of sgetmask and ssetmask syscalls on 64-bit architectures.
* Fixed decoding of netlink messages received within struct msghdr.
* Worked around a bug in miscompiled aarch64 kernels leading to the 3rd
argument of sched_getattr syscall being not quite 32-bit.
* Fixed corner cases of printing inaccessible times argument of utimes
and futimesat syscalls.
Noteworthy changes in release 4.16 (2017-02-14)
===============================================
* Improvements
* Implemented syscall return value injection (-e inject=SET:retval= option).
* Implemented signal injection (-e inject=SET:signal= option).
* Implemented decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE.
* Implemented decoding of all SG_* ioctl commands.
* Implemented decoding of ustat syscall.
* Implemented decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
and BPF_PROG_DETACH commands of bpf syscall.
* Enhanced decoding of sg_io_hdr and sg_io_v4 structures.
* Enhanced decoding of get_robust_list, getrandom, io_submit, set_robust_list
syscalls.
* Enhanced decoding of entities of kernel long type on x32 and mips n32 ABIs.
* Updated lists of IP_*, IPV6_*, and LOOP_* constants.
* Updated lists of ioctl commands from Linux 4.10.
* Added decoding of recently added syscalls on avr32, microblaze, ppc,
and ppc64.
* Bug fixes
* Fixed pathmatch of oldselect syscall on 64-bit architectures.
* Fixed decoding of mmap2 syscall on s390 when arguments are not available.
* Fixed decoding of kexec_file_load, mprotect, pkey_mprotect, prctl, preadv*,
and pwritev* syscalls on x32.
* Fixed printing of string arguments of getxattr and setxattr syscalls
when -s option is used to limit the printed string size.
* Fixed decoding of ifconf, ifreq, and loop_info structures on non-native
personalities.
* Fixed decoding of SG_* and LOOP_* ioctl commands.
* Fixed build on mips with musl libc.
* Fixed cross-building of ioctlsort.
* Applied minor formatting fixes to the manual page.
Noteworthy changes in release 4.15 (2016-12-14)
===============================================
* Changes in behavior
* Time stamps are now printed according to ISO 8601.
* Changed output format of val3 parameter of futex FUTEX_WAKE_OP operation.
* The last argument of mincore, sched_getaffinity, and sched_setaffinity
syscalls is now formatted as an array.
* Improvements
* Implemented syscall fault injection (-e fault=... option).
* Implemented decoding of DM_* ioctl commands.
* Implemented decoding of attr parameter of perf_event_open syscall.
* Implemented decoding of pkey_alloc, pkey_free, and pkey_mprotect syscalls.
* Implemented dumping of mq_timedsend and mq_timedreceive syscalls.
* Implemented decoding of PR_SET_FP_MODE and PR_GET_FP_MODE operations
of prctl syscall.
* Implemented PTRACE_GETREGS API support on m68k.
* Updated lists of ARCH_*, BPF_*, BTRFS_*, FALLOC_*, MS_*, *_MAGIC,
and V4L2_* constants.
* Updated lists of ioctl commands from Linux 4.9.
* Added decoding of recently added syscalls on arc, x32, and xtensa.
* Enhanced manual page.
* Bug fixes
* Fixed corner cases in decoding of exit, exit_group, futimesat, getgroups,
getresuid, init_module, inotify_init1, kcmp, kexec_load, lookup_dcookie,
mq_getsetattr, mq_notify, mq_open, mq_timedreceive, mq_timedsend,
name_to_handle_at, prctl, process_vm_readv, process_vm_writev, setfsuid,
setgroups, setns, unshare, and utimes syscalls.
* Fixed handling of verbose flag in printing of controls array
of struct v4l2_ext_controls.
* Fixed omission of field names in the output of capability, sigaction,
sigevent, statfs, timespec, timeval, and utimbuf structures.
* Fixed printing of unknown syscalls in siginfo structure.
* Fixed decoding of ioctl constants on m68k.
* Fixed cris architecture support.
* Fixed cross build when host compiler does not support the same
set of warning flags as the cross compiler.
* Fixed build on SLE10 and SLE11.
Noteworthy changes in release 4.14 (2016-10-04)
===============================================
* Changes in behavior
* When using -p option without a command and no processes has been attached,
strace exits with exit status 1.
* Improvements
* Added printing of the mode argument of open and openat syscalls
when O_TMPFILE flag is set. (Addresses Fedora bug #1377846).
* Enhanced -e abbrev=set, -e raw=set, and -e verbose=set.
* Enhanced decoding of futex, keyctl, quotactl, timerfd_settime,
and aio family syscalls.
* Implemented fetching of the 7th subcall argument on mips o32.
* Updated lists of BPF_*, ETH_P_*, KEXEC_ARCH_*, SCTP_*, TCP_*, and *_MAGIC
constants.
* Updated lists of ioctl commands from Linux 4.8.
* Added decoding of new syscalls on sh and sh64.
* Added RISC-V architecture support.
* Bug fixes
* Marked io_setup and io_destroy as memory mapping related syscalls.
* Fixed leakage of placeholder descriptors to tracees.
* Fixed printing of mode_t, umode_t, and umask types.
* Fixed decoding of iovec arrays without a limit on total data size.
* Fixed decoding of fadvise64, fallocate, futex, keyctl, quotactl, readahead,
and ipc family syscalls.
* Fixed decoding of invalid syscalls mapped to indirect subcalls.
* Fixed decoding of struct btrfs_ioctl_vol_args_v2 on non-native
personalities.
* Fixed decoding of PTRACE_DETACH on sparc and sparc64.
* Fixed decoding of struct stat64 on sparc64.
* Fixed decoding of uid and gid-related syscalls on sparc64.
* Fixed decoding of the forth argument of semctl syscall on sparc64.
* Fixed values of tty ioctl constants on sparc64.
* Fixed sparc personality support on sparc64.
Noteworthy changes in release 4.13 (2016-07-26)
===============================================
@ -665,7 +864,7 @@ Changes in 4.4
==============
* Fix Linux/ia64 support, looks like someone renamed a few things on us
* Fix the ioctl setup for Linux, turned out it did not really work.
Improve the ioctl extracter as well so we decode some more ones.
Improve the ioctl extractor as well so we decode some more ones.
Changes in 4.3.1
================
@ -757,7 +956,7 @@ New Features in version 3.0
===========================
* non-ascii strings can be optionally printed entirely in hex
* the output format is readable when mutiple processes are generating output
* the output format is readable when multiple processes are generating output
* exit values are printed in an alignment column
* is is possible to suppress messages about attaching and detaching
* various tracing features can be enabled on a per syscall/signal/desc basis

2
README
View File

@ -8,7 +8,7 @@ See the file INSTALL for compilation and installation instructions.
See the file NEWS for information on what has changed in recent versions.
The project's homepage is at
https://sourceforge.net/projects/strace/
https://strace.io
strace has a mailing list:
strace-devel@lists.sourceforge.net.

View File

@ -1,10 +1,6 @@
Requirements
============
If you use the GIT version of strace there will be some files missing
that you need to build strace. These files are generated by tools from
the GNU Autoconf and Automake packages.
Note: rather than run `autoreconf' directly, use the `./bootstrap' script.
If you use the GIT version of strace, please refer to INSTALL-git.md file.
No more ChangeLog file

View File

@ -1,9 +1,14 @@
This is [strace](http://strace.io) -- a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as [ptrace](http://man7.org/linux/man-pages/man2/ptrace.2.html).
strace - the linux syscall tracer
=================================
strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file [COPYING](https://raw.githubusercontent.com/strace/strace/master/COPYING) for details.
This is [strace](https://strace.io) -- a diagnostic, debugging and instructional userspace utility with a traditional command-line interface for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as [ptrace](http://man7.org/linux/man-pages/man2/ptrace.2.html).
See the file [NEWS](https://raw.githubusercontent.com/strace/strace/master/NEWS) for information on what has changed in recent versions.
strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file [COPYING](COPYING) for details.
Please send bug reports and enhancements to [the strace mailing list](https://lists.sourceforge.net/lists/listinfo/strace-devel).
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.
The user discussion and development of strace take place on [the strace mailing list](https://lists.sourceforge.net/lists/listinfo/strace-devel) -- everyone is welcome to post bug reports, feature requests, comments and patches to strace-devel@lists.sourceforge.net. The mailing list archives are available at https://sourceforge.net/p/strace/mailman/strace-devel/ and other archival sites.
[![Build Status](https://travis-ci.org/strace/strace.svg?branch=master)](https://travis-ci.org/strace/strace) [![Code Coverage](https://codecov.io/github/strace/strace/coverage.svg?branch=master)](https://codecov.io/github/strace/strace?branch=master)

View File

@ -35,10 +35,21 @@ get_cpuset_size(void)
static unsigned int cpuset_size;
if (!cpuset_size) {
pid_t pid = getpid();
/*
* If the cpuset size passed to sched_getaffinity is less
* than necessary to store the bitmask, the kernel does not
* look at the mask pointer and fails with EINVAL.
*
* If the cpuset size is large enough, the kernel fails with
* EFAULT on inaccessible mask pointers.
*
* This undocumented kernel feature can be used to probe
* the kernel and find out the minimal valid cpuset size
* without allocating any memory for the CPU affinity mask.
*/
cpuset_size = 128;
while (cpuset_size &&
sched_getaffinity(pid, cpuset_size, NULL) == -1 &&
sched_getaffinity(0, cpuset_size, NULL) == -1 &&
EINVAL == errno) {
cpuset_size <<= 1;
}
@ -50,7 +61,8 @@ get_cpuset_size(void)
}
static void
print_affinitylist(struct tcb *tcp, const unsigned long addr, const unsigned int len)
print_affinitylist(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned int len)
{
const unsigned int max_size = get_cpuset_size();
const unsigned int umove_size = len < max_size ? len : max_size;
@ -75,7 +87,7 @@ print_affinitylist(struct tcb *tcp, const unsigned long addr, const unsigned int
if (i < 0)
break;
tprintf("%s%d", sep, i);
sep = " ";
sep = ", ";
}
if (size < len)
tprintf("%s...", sep);

64
aio.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,13 +37,13 @@ SYS_FUNC(io_setup)
if (entering(tcp))
tprintf("%u, ", (unsigned int) tcp->u_arg[0]);
else
printnum_ulong(tcp, tcp->u_arg[1]);
printnum_ptr(tcp, tcp->u_arg[1]);
return 0;
}
SYS_FUNC(io_destroy)
{
tprintf("%lu", tcp->u_arg[0]);
printaddr(tcp->u_arg[0]);
return RVAL_DECODED;
}
@ -73,19 +74,22 @@ tprint_lio_opcode(unsigned cmd)
tprints(cmds[cmd].name);
return cmds[cmd].sub;
}
tprintf("%u /* SUB_??? */", cmd);
tprintf("%u", cmd);
tprints_comment("SUB_???");
return SUB_NONE;
}
static void
print_common_flags(const struct iocb *cb)
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 & IOCB_FLAG_RESFD)
tprintf(", resfd=%d", cb->aio_resfd);
if (cb->aio_flags & IOCB_FLAG_RESFD) {
tprints(", resfd=");
printfd(tcp, cb->aio_resfd);
}
if (cb->aio_flags & ~IOCB_FLAG_RESFD)
tprintf(", flags=%x", cb->aio_flags);
tprintf(", flags=%#x", cb->aio_flags);
#endif
}
@ -98,7 +102,7 @@ iocb_is_valid(const struct iocb *cb)
}
static enum iocb_sub
print_iocb_header(const struct iocb *cb)
print_iocb_header(struct tcb *tcp, const struct iocb *cb)
{
enum iocb_sub sub;
@ -113,7 +117,8 @@ print_iocb_header(const struct iocb *cb)
if (cb->aio_reqprio)
tprintf(", reqprio=%hd", cb->aio_reqprio);
tprintf(", fildes=%d", cb->aio_fildes);
tprints(", fildes=");
printfd(tcp, cb->aio_fildes);
return sub;
}
@ -121,20 +126,19 @@ print_iocb_header(const struct iocb *cb)
static void
print_iocb(struct tcb *tcp, const struct iocb *cb)
{
enum iocb_sub sub = print_iocb_header(cb);
enum iocb_sub sub = print_iocb_header(tcp, cb);
switch (sub) {
case SUB_COMMON:
if (cb->aio_lio_opcode == 1 && iocb_is_valid(cb)) {
tprints(", str=");
printstr(tcp, (unsigned long) cb->aio_buf,
(unsigned long) cb->aio_nbytes);
printstrn(tcp, cb->aio_buf, cb->aio_nbytes);
} else {
tprintf(", buf=%#" PRIx64, (uint64_t) cb->aio_buf);
}
tprintf(", nbytes=%" PRIu64 ", offset=%" PRId64,
(uint64_t) cb->aio_nbytes, (int64_t) cb->aio_offset);
print_common_flags(cb);
print_common_flags(tcp, cb);
break;
case SUB_VECTOR:
if (iocb_is_valid(cb)) {
@ -149,7 +153,7 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
(uint64_t) cb->aio_nbytes);
}
tprintf(", offset=%" PRId64, (int64_t) cb->aio_offset);
print_common_flags(cb);
print_common_flags(tcp, cb);
break;
case SUB_NONE:
break;
@ -159,13 +163,13 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
static bool
print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
unsigned long addr;
kernel_ulong_t addr;
struct iocb cb;
if (elem_size < sizeof(long)) {
addr = * (unsigned int *) elem_buf;
if (elem_size < sizeof(kernel_ulong_t)) {
addr = *(unsigned int *) elem_buf;
} else {
addr = * (unsigned long *) elem_buf;
addr = *(kernel_ulong_t *) elem_buf;
}
tprints("{");
@ -178,11 +182,13 @@ print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
SYS_FUNC(io_submit)
{
const long nr = widen_to_long(tcp->u_arg[1]);
const unsigned long addr = tcp->u_arg[2];
unsigned long iocbp;
const kernel_long_t nr =
truncate_klong_to_current_wordsize(tcp->u_arg[1]);
const kernel_ulong_t addr = tcp->u_arg[2];
kernel_ulong_t iocbp;
tprintf("%lu, %ld, ", tcp->u_arg[0], nr);
printaddr(tcp->u_arg[0]);
tprintf(", %" PRI_kld ", ", nr);
if (nr < 0)
printaddr(addr);
@ -209,12 +215,14 @@ print_io_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
SYS_FUNC(io_cancel)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
printaddr(tcp->u_arg[0]);
tprints(", ");
struct iocb cb;
if (!umove_or_printaddr(tcp, tcp->u_arg[1], &cb)) {
tprints("{");
print_iocb_header(&cb);
print_iocb_header(tcp, &cb);
tprints("}");
}
tprints(", ");
@ -230,10 +238,10 @@ SYS_FUNC(io_cancel)
SYS_FUNC(io_getevents)
{
if (entering(tcp)) {
tprintf("%lu, %ld, %ld, ",
tcp->u_arg[0],
widen_to_long(tcp->u_arg[1]),
widen_to_long(tcp->u_arg[2]));
printaddr(tcp->u_arg[0]);
tprintf(", %" PRI_kld ", %" PRI_kld ", ",
truncate_klong_to_current_wordsize(tcp->u_arg[1]),
truncate_klong_to_current_wordsize(tcp->u_arg[2]));
} else {
struct io_event buf;
print_array(tcp, tcp->u_arg[3], tcp->u_rval, &buf, sizeof(buf),

20
bjm.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,17 +34,9 @@
#include "xlat/delete_module_flags.h"
SYS_FUNC(create_module)
{
printpath(tcp, tcp->u_arg[0]);
tprintf(", %lu", tcp->u_arg[1]);
return RVAL_DECODED | RVAL_HEX;
}
SYS_FUNC(delete_module)
{
printstr(tcp, tcp->u_arg[0], -1);
printstr(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(delete_module_flags, tcp->u_arg[1], "O_???");
@ -53,15 +46,12 @@ SYS_FUNC(delete_module)
SYS_FUNC(init_module)
{
printaddr(tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2], -1);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2]);
return RVAL_DECODED;
}
#define MODULE_INIT_IGNORE_MODVERSIONS 1
#define MODULE_INIT_IGNORE_VERMAGIC 2
#include "xlat/module_init_flags.h"
SYS_FUNC(finit_module)
@ -70,7 +60,7 @@ SYS_FUNC(finit_module)
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* param_values */
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, tcp->u_arg[1]);
tprints(", ");
/* flags */
printflags(module_init_flags, tcp->u_arg[2], "MODULE_INIT_???");

64
block.c
View File

@ -32,9 +32,27 @@
#include DEF_MPERS_TYPE(struct_blkpg_ioctl_arg)
#include DEF_MPERS_TYPE(struct_blkpg_partition)
#include <linux/blkpg.h>
#include <linux/ioctl.h>
#include <linux/fs.h>
typedef struct {
int op;
int flags;
int datalen;
void *data;
} struct_blkpg_ioctl_arg;
#define BLKPG_DEVNAMELTH 64
#define BLKPG_VOLNAMELTH 64
typedef struct {
int64_t start; /* starting offset in bytes */
int64_t length; /* length in bytes */
int pno; /* partition number */
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
to be used in kernel messages */
char volname[BLKPG_VOLNAMELTH]; /* volume label */
} struct_blkpg_partition;
#define BLKTRACE_BDEV_SIZE 32
typedef struct blk_user_trace_setup {
char name[BLKTRACE_BDEV_SIZE]; /* output */
@ -46,11 +64,12 @@ typedef struct blk_user_trace_setup {
uint32_t pid;
} struct_blk_user_trace_setup;
typedef struct blkpg_ioctl_arg struct_blkpg_ioctl_arg;
typedef struct blkpg_partition struct_blkpg_partition;
#include MPERS_DEFS
#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
@ -61,40 +80,40 @@ typedef struct blkpg_partition struct_blkpg_partition;
# define BLKTRACESETUP _IOWR(0x12, 115, struct_blk_user_trace_setup)
#endif
#ifndef BLKTRACESTART
# define BLKTRACESTART _IO(0x12,116)
# define BLKTRACESTART _IO(0x12, 116)
#endif
#ifndef BLKTRACESTOP
# define BLKTRACESTOP _IO(0x12,117)
# define BLKTRACESTOP _IO(0x12, 117)
#endif
#ifndef BLKTRACETEARDOWN
# define BLKTRACETEARDOWN _IO(0x12,118)
# define BLKTRACETEARDOWN _IO(0x12, 118)
#endif
#ifndef BLKDISCARD
# define BLKDISCARD _IO(0x12,119)
# define BLKDISCARD _IO(0x12, 119)
#endif
#ifndef BLKIOMIN
# define BLKIOMIN _IO(0x12,120)
# define BLKIOMIN _IO(0x12, 120)
#endif
#ifndef BLKIOOPT
# define BLKIOOPT _IO(0x12,121)
# define BLKIOOPT _IO(0x12, 121)
#endif
#ifndef BLKALIGNOFF
# define BLKALIGNOFF _IO(0x12,122)
# define BLKALIGNOFF _IO(0x12, 122)
#endif
#ifndef BLKPBSZGET
# define BLKPBSZGET _IO(0x12,123)
# define BLKPBSZGET _IO(0x12, 123)
#endif
#ifndef BLKDISCARDZEROES
# define BLKDISCARDZEROES _IO(0x12,124)
# define BLKDISCARDZEROES _IO(0x12, 124)
#endif
#ifndef BLKSECDISCARD
# define BLKSECDISCARD _IO(0x12,125)
# define BLKSECDISCARD _IO(0x12, 125)
#endif
#ifndef BLKROTATIONAL
# define BLKROTATIONAL _IO(0x12,126)
# define BLKROTATIONAL _IO(0x12, 126)
#endif
#ifndef BLKZEROOUT
# define BLKZEROOUT _IO(0x12,127)
# define BLKZEROOUT _IO(0x12, 127)
#endif
#include "xlat/blkpg_ops.h"
@ -110,9 +129,10 @@ print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg)
tprintf(", flags=%d, datalen=%d, data=",
blkpg->flags, blkpg->datalen);
if (!umove_or_printaddr(tcp, (long) blkpg->data, &p)) {
tprintf("{start=%lld, length=%lld, pno=%d, devname=",
(long long) p.start, (long long) p.length, p.pno);
if (!umove_or_printaddr(tcp, ptr_to_kulong(blkpg->data), &p)) {
tprintf("{start=%" PRId64 ", length=%" PRId64
", pno=%d, devname=",
p.start, p.length, p.pno);
print_quoted_string(p.devname, sizeof(p.devname),
QUOTE_0_TERMINATED);
tprints(", volname=");
@ -123,14 +143,14 @@ print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg)
tprints("}");
}
MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *tcp,
const unsigned int code, const long arg)
MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
/* take arg as a value, not as a pointer */
case BLKRASET:
case BLKFRASET:
tprintf(", %lu", arg);
tprintf(", %" PRI_klu, arg);
break;
/* return an unsigned short */

View File

@ -1,11 +1,18 @@
#!/bin/sh -eu
./generate_mpers_am.sh
./xlat/gen.sh
./tests/gen_pure_executables.sh
./tests/gen_tests.sh
for m in m32 mx32; do
tests=tests-$m
rm -rf $tests
mkdir $tests
s='[[:space:]]*'
sed "s/@arch@/@arch_$m@/;s/^MPERS_NAME$s=.*/& $m/;s/^ARCH_MFLAGS$s=.*/& -$m/" \
sed "s/@arch@/@arch_$m@/;
s/^MPERS_NAME$s=.*/& $m/;
s/^ARCH_MFLAGS$s=.*/& -DMPERS_IS_\$(MPERS_NAME) -$m/" \
tests/Makefile.am > $tests/Makefile.am
for f in tests/*; do
case "${f##*/}" in
@ -15,7 +22,4 @@ for m in m32 mx32; do
done
done
./generate_mpers_am.sh
./xlat/gen.sh
exec autoreconf -f -i "$@"

111
bpf.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2017 Quentin Monnet <quentin.monnet@6wind.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -35,9 +36,12 @@
#include "xlat/bpf_map_types.h"
#include "xlat/bpf_prog_types.h"
#include "xlat/bpf_map_update_elem_flags.h"
#include "xlat/bpf_attach_type.h"
#include "xlat/bpf_attach_flags.h"
static int
bpf_map_create(struct tcb *tcp, const long addr, unsigned int size)
bpf_map_create(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_type, key_size, value_size, max_entries;
@ -61,7 +65,8 @@ bpf_map_create(struct tcb *tcp, const long addr, unsigned int size)
}
static void
bpf_map_update_elem(struct tcb *tcp, const long addr, unsigned int size)
bpf_map_update_elem(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_fd;
@ -88,7 +93,8 @@ bpf_map_update_elem(struct tcb *tcp, const long addr, unsigned int size)
}
static void
bpf_map_delete_elem(struct tcb *tcp, const long addr, unsigned int size)
bpf_map_delete_elem(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_fd;
@ -110,7 +116,8 @@ bpf_map_delete_elem(struct tcb *tcp, const long addr, unsigned int size)
}
static int
bpf_map_io(struct tcb *tcp, const long addr, unsigned int size, const char *text)
bpf_map_io(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int size,
const char *const text)
{
struct bpf_io_elem_struct {
uint32_t map_fd;
@ -142,7 +149,8 @@ bpf_map_io(struct tcb *tcp, const long addr, unsigned int size, const char *text
}
static int
bpf_prog_load(struct tcb *tcp, const long addr, unsigned int size)
bpf_prog_load(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t prog_type, insn_cnt;
@ -165,17 +173,92 @@ bpf_prog_load(struct tcb *tcp, const long addr, unsigned int size)
printxval(bpf_prog_types, attr.prog_type, "BPF_PROG_TYPE_???");
tprintf(", insn_cnt=%u, insns=%#" PRIx64 ", license=",
attr.insn_cnt, attr.insns);
printstr(tcp, attr.license, -1);
printstr(tcp, attr.license);
tprintf(", log_level=%u, log_size=%u, log_buf=%#" PRIx64 ", kern_version=%u}",
attr.log_level, attr.log_size, attr.log_buf, attr.kern_version);
return RVAL_DECODED | RVAL_FD;
}
static int
bpf_obj_manage(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
uint32_t bpf_fd;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED | RVAL_FD;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED | RVAL_FD;
tprints("{pathname=");
printpath(tcp, attr.pathname);
tprints(", bpf_fd=");
printfd(tcp, attr.bpf_fd);
tprints("}");
return RVAL_DECODED | RVAL_FD;
}
static int
bpf_prog_attach_detach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size, bool print_attach)
{
struct {
uint32_t target_fd, attach_bpf_fd, attach_type, attach_flags;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED;
tprints("{target_fd=");
printfd(tcp, attr.target_fd);
if (print_attach) {
tprints(", attach_bpf_fd=");
printfd(tcp, attr.attach_bpf_fd);
}
tprints(", attach_type=");
printxval(bpf_attach_type, attr.attach_type, "BPF_???");
if (print_attach) {
tprints(", attach_flags=");
printflags(bpf_attach_flags, attr.attach_flags, "BPF_F_???");
}
tprints("}");
return RVAL_DECODED;
}
static int
bpf_prog_attach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
return bpf_prog_attach_detach(tcp, addr, size, true);
}
static int
bpf_prog_detach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
return bpf_prog_attach_detach(tcp, addr, size, false);
}
SYS_FUNC(bpf)
{
const int cmd = tcp->u_arg[0];
const long addr = tcp->u_arg[1];
const unsigned int cmd = tcp->u_arg[0];
const kernel_ulong_t addr = tcp->u_arg[1];
const unsigned int size = tcp->u_arg[2];
int rc = RVAL_DECODED;
@ -203,6 +286,18 @@ SYS_FUNC(bpf)
case BPF_PROG_LOAD:
rc = bpf_prog_load(tcp, addr, size);
break;
case BPF_OBJ_PIN:
rc = bpf_obj_manage(tcp, addr, size);
break;
case BPF_OBJ_GET:
rc = bpf_obj_manage(tcp, addr, size);
break;
case BPF_PROG_ATTACH:
rc = bpf_prog_attach(tcp, addr, size);
break;
case BPF_PROG_DETACH:
rc = bpf_prog_detach(tcp, addr, size);
break;
default:
printaddr(addr);
break;

98
btrfs.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,6 +33,7 @@
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_dev_replace_args)
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_send_args)
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_received_subvol_args)
#include DEF_MPERS_TYPE(struct_btrfs_ioctl_vol_args_v2)
# include <linux/btrfs.h>
@ -41,6 +43,8 @@ typedef struct btrfs_ioctl_send_args
struct_btrfs_ioctl_send_args;
typedef struct btrfs_ioctl_received_subvol_args
struct_btrfs_ioctl_received_subvol_args;
typedef struct btrfs_ioctl_vol_args_v2
struct_btrfs_ioctl_vol_args_v2;
#endif /* HAVE_LINUX_BTRFS_H */
@ -177,7 +181,7 @@ print_u64(const char *name, uint64_t value)
{
tprintf(", %s=%" PRIu64, name, value);
if (value == UINT64_MAX)
tprints(" /* UINT64_MAX */");
tprints_comment("UINT64_MAX");
}
#define print_member_u64(obj, name) print_u64(#name, obj->name)
@ -201,7 +205,7 @@ btrfs_print_balance_args(const char *name, const struct btrfs_balance_args *bba)
}
static void
btrfs_print_balance(struct tcb *tcp, const long arg, bool out)
btrfs_print_balance(struct tcb *const tcp, const kernel_ulong_t arg, bool out)
{
struct btrfs_ioctl_balance_args balance_args;
@ -258,19 +262,15 @@ btrfs_print_qgroup_limit(const struct btrfs_qgroup_limit *lim)
static void
btrfs_print_key_type(uint32_t type)
{
const char *str = xlookup(btrfs_key_types, type);
tprintf("%u", type);
if (str)
tprintf(" /* %s */", str);
tprints_comment(xlookup(btrfs_key_types, type));
}
static void
btrfs_print_objectid(uint64_t objectid)
{
const char *str = xlookup(btrfs_tree_objectids, objectid);
tprintf("%" PRIu64, objectid);
if (str)
tprintf(" /* %s */", str);
tprints_comment(xlookup(btrfs_tree_objectids, objectid));
}
static void
@ -367,20 +367,20 @@ btrfs_print_ino_path_container(struct tcb *tcp,
static bool
print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
tprintf("%" PRIu64, * (uint64_t *) elem_buf);
tprintf("%" PRIu64, *(uint64_t *) elem_buf);
return true;
}
static void
btrfs_print_qgroup_inherit(struct tcb *tcp, const uint64_t qgi_addr)
btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr)
{
struct btrfs_qgroup_inherit inherit;
if (umove_or_printaddr(tcp, qgi_addr, &inherit))
return;
tprintf("{flags=");
tprints("{flags=");
printflags64(btrfs_qgroup_inherit_flags, inherit.flags,
"BTRFS_QGROUP_INHERIT_???");
tprintf(", num_qgroups=%" PRI__u64 ", num_ref_copies=%" PRI__u64
@ -409,7 +409,7 @@ print_key_value_internal(struct tcb *tcp, const char *name, uint64_t value)
if (value) {
tprintf(", %s=%" PRIu64, name, value);
if (value == UINT64_MAX)
tprints(" /* UINT64_MAX */");
tprints_comment("UINT64_MAX");
}
}
#define print_key_value(tcp, key, name) \
@ -420,7 +420,7 @@ btrfs_print_tree_search(struct tcb *tcp, struct btrfs_ioctl_search_key *key,
uint64_t buf_addr, uint64_t buf_size, bool print_size)
{
if (entering(tcp)) {
tprintf("{key={tree_id=");
tprints("{key={tree_id=");
btrfs_print_objectid(key->tree_id);
if (key->min_objectid != BTRFS_FIRST_FREE_OBJECTID ||
@ -488,7 +488,7 @@ static bool
print_objectid_callback(struct tcb *tcp, void *elem_buf,
size_t elem_size, void *data)
{
btrfs_print_objectid(* (uint64_t *) elem_buf);
btrfs_print_objectid(*(uint64_t *) elem_buf);
return true;
}
@ -509,7 +509,8 @@ print_btrfs_ioctl_space_info(struct tcb *tcp, void *elem_buf,
}
MPERS_PRINTER_DECL(int, btrfs_ioctl,
struct tcb *tcp, const unsigned int code, const long arg)
struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
/* Take no arguments; command only. */
@ -606,7 +607,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprintf("%" PRIu64, (uint64_t) args.len);
if (args.len == UINT64_MAX)
tprints(" /* UINT64_MAX */");
tprints_comment("UINT64_MAX");
tprints(", flags=");
printflags64(btrfs_defrag_flags, args.flags,
@ -678,12 +679,12 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
(uint64_t) args.start.srcdevid,
(uint64_t) args.start.cont_reading_from_srcdev_mode);
str = (const char*) args.start.srcdev_name;
str = (const char *) args.start.srcdev_name;
print_quoted_string(str,
sizeof(args.start.srcdev_name),
QUOTE_0_TERMINATED);
tprints(", tgtdev_name=");
str = (const char*) args.start.tgtdev_name;
str = (const char *) args.start.tgtdev_name;
print_quoted_string(str,
sizeof(args.start.tgtdev_name),
QUOTE_0_TERMINATED);
@ -698,35 +699,27 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
printxval64(btrfs_dev_replace_results, args.result,
"BTRFS_IOCTL_DEV_REPLACE_RESULT_???");
if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) {
char buf[sizeof("HH:MM:SS") + 1];
time_t time;
tprints(", ");
printxval64(btrfs_dev_replace_state,
args.status.replace_state,
"BTRFS_IOCTL_DEV_REPLACE_STATE_???");
tprintf(", progress_1000=%" PRIu64 " /* ",
tprintf(", progress_1000=%" PRIu64,
(uint64_t) args.status.progress_1000);
if (args.status.progress_1000 <= 1000)
tprintf("%" PRIu64 ".%.2" PRIu64 "%%",
(uint64_t) args.status.progress_1000 / 10,
(uint64_t) args.status.progress_1000 % 10);
else
tprints("???");
tprints(" */ ,");
tprintf_comment("%u.%u%%",
(unsigned) args.status.progress_1000 / 10,
(unsigned) args.status.progress_1000 % 10);
time = args.status.time_started;
strftime(buf, sizeof(buf), "%T",
localtime(&time));
tprintf("time_started=%" PRIu64" /* %s */, ",
(uint64_t) args.status.time_started, buf);
tprintf(", time_started=%" PRIu64,
(uint64_t) args.status.time_started);
tprints_comment(sprinttime(args.status.time_started));
time = args.status.time_stopped;
strftime(buf, sizeof(buf), "%T",
localtime(&time));
tprintf("time_stopped=%" PRIu64" /* %s */, ",
(uint64_t) args.status.time_stopped, buf);
tprintf(", time_stopped=%" PRIu64,
(uint64_t) args.status.time_stopped);
tprints_comment(sprinttime(args.status.time_stopped));
tprintf("num_write_errors=%" PRIu64
tprintf(", num_write_errors=%" PRIu64
", num_uncorrectable_read_errors=%" PRIu64,
(uint64_t) args.status.num_write_errors,
(uint64_t) args.status.num_uncorrectable_read_errors);
@ -775,14 +768,17 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &flarg))
break;
tprints("[ /* supported */ ");
tprints("[");
btrfs_print_features(&flarg[0]);
tprints_comment("supported");
tprints(", /* safe to set */ ");
tprints(", ");
btrfs_print_features(&flarg[1]);
tprints_comment("safe to set");
tprints(", /* safe to clear */ ");
tprints(", ");
btrfs_print_features(&flarg[2]);
tprints_comment("safe to clear");
tprints("]");
break;
@ -865,10 +861,8 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("...");
break;
}
const char *name = xlookup(btrfs_dev_stats_values, i);
if (name)
tprintf("/* %s */ ", name);
tprintf("%" PRI__u64, args.values[i]);
tprints_comment(xlookup(btrfs_dev_stats_values, i));
}
tprints("]}");
break;
@ -1104,7 +1098,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
args.start);
tprintf("%" PRI__u64, args.end);
if (args.end == UINT64_MAX)
tprints(" /* UINT64_MAX */");
tprints_comment("UINT64_MAX");
tprints(", flags=");
printflags64(btrfs_scrub_flags, args.flags,
"BTRFS_SCRUB_???");
@ -1213,7 +1207,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("...");
else {
uint64_t record;
print_array(tcp, (unsigned long) args.clone_sources,
print_array(tcp, ptr_to_kulong(args.clone_sources),
args.clone_sources_count,
&record, sizeof(record),
umoven_or_printaddr,
@ -1294,7 +1288,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
case BTRFS_IOC_SNAP_CREATE_V2:
case BTRFS_IOC_SUBVOL_CREATE_V2: { /* code is W, but is actually RW */
struct btrfs_ioctl_vol_args_v2 args;
struct_btrfs_ioctl_vol_args_v2 args;
if (entering(tcp))
tprints(", ");
@ -1313,19 +1307,19 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
printflags64(btrfs_snap_flags_v2, args.flags,
"BTRFS_SUBVOL_???");
if (args.flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
tprintf(", size=%" PRI__u64 ", qgroup_inherit=",
args.size);
tprintf(", size=%" PRIu64 ", qgroup_inherit=",
(uint64_t) args.size);
btrfs_print_qgroup_inherit(tcp,
(unsigned long)args.qgroup_inherit);
ptr_to_kulong(args.qgroup_inherit));
}
tprintf(", name=");
tprints(", name=");
print_quoted_string(args.name, sizeof(args.name),
QUOTE_0_TERMINATED);
tprints("}");
return 0;
}
tprintf("{transid=%" PRI__u64 "}", args.transid);
tprintf("{transid=%" PRIu64 "}", (uint64_t) args.transid);
break;
}

View File

@ -4,6 +4,7 @@
* Copyright (c) 2010 Carmelo Amoroso <carmelo.amoroso@st.com>
* Copyright (c) 2015 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -2,6 +2,7 @@
* Copyright (c) 2000 Wichert Akkerman <wakkerma@debian.org>
* Copyright (c) 2011 Denys Vlasenko <dvlasenk@redhat.com>
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -52,19 +53,19 @@ enum {
#include "xlat/cap_version.h"
typedef struct user_cap_header_struct {
struct user_cap_header_struct {
uint32_t version;
int pid;
} *cap_user_header_t;
};
typedef struct user_cap_data_struct {
struct user_cap_data_struct {
uint32_t effective;
uint32_t permitted;
uint32_t inheritable;
} *cap_user_data_t;
};
static cap_user_header_t
get_cap_header(struct tcb *tcp, unsigned long addr)
static const struct user_cap_header_struct *
get_cap_header(struct tcb *const tcp, const kernel_ulong_t addr)
{
static struct user_cap_header_struct header;
@ -78,17 +79,18 @@ get_cap_header(struct tcb *tcp, unsigned long addr)
}
static void
print_cap_header(struct tcb *tcp, unsigned long addr, cap_user_header_t h)
print_cap_header(struct tcb *const tcp, const kernel_ulong_t addr,
const struct user_cap_header_struct *const h)
{
if (!addr || !h) {
printaddr(addr);
return;
}
tprints("{");
tprints("{version=");
printxval(cap_version, h->version,
"_LINUX_CAPABILITY_VERSION_???");
tprintf(", %d}", h->pid);
tprintf(", pid=%d}", h->pid);
}
static void
@ -105,7 +107,8 @@ print_cap_bits(const uint32_t lo, const uint32_t hi)
}
static void
print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
print_cap_data(struct tcb *const tcp, const kernel_ulong_t addr,
const struct user_cap_header_struct *const h)
{
struct user_cap_data_struct data[2];
unsigned int len;
@ -124,18 +127,18 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
if (umoven_or_printaddr(tcp, addr, len * sizeof(data[0]), data))
return;
tprints("{");
tprints("{effective=");
print_cap_bits(data[0].effective, len > 1 ? data[1].effective : 0);
tprints(", ");
tprints(", permitted=");
print_cap_bits(data[0].permitted, len > 1 ? data[1].permitted : 0);
tprints(", ");
tprints(", inheritable=");
print_cap_bits(data[0].inheritable, len > 1 ? data[1].inheritable : 0);
tprints("}");
}
SYS_FUNC(capget)
{
cap_user_header_t h;
const struct user_cap_header_struct *h;
if (entering(tcp)) {
h = get_cap_header(tcp, tcp->u_arg[0]);
@ -150,7 +153,8 @@ SYS_FUNC(capget)
SYS_FUNC(capset)
{
cap_user_header_t h = get_cap_header(tcp, tcp->u_arg[0]);
const struct user_cap_header_struct *const h =
get_cap_header(tcp, tcp->u_arg[0]);
print_cap_header(tcp, tcp->u_arg[0], h);
tprints(", ");
print_cap_data(tcp, tcp->u_arg[1], h);

View File

@ -4,7 +4,8 @@ static void
decode_chmod(struct tcb *tcp, const int offset)
{
printpath(tcp, tcp->u_arg[offset]);
tprintf(", %#lo", tcp->u_arg[offset + 1]);
tprints(", ");
print_numeric_umode_t(tcp->u_arg[offset + 1]);
}
SYS_FUNC(chmod)
@ -25,7 +26,8 @@ SYS_FUNC(fchmodat)
SYS_FUNC(fchmod)
{
printfd(tcp, tcp->u_arg[0]);
tprintf(", %#lo", tcp->u_arg[1]);
tprints(", ");
print_numeric_umode_t(tcp->u_arg[1]);
return RVAL_DECODED;
}

64
clone.c
View File

@ -4,6 +4,7 @@
* Copyright (c) 2008 Jan Kratochvil <jan.kratochvil@redhat.com>
* Copyright (c) 2009-2013 Denys Vlasenko <dvlasenk@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,22 +31,24 @@
*/
#include "defs.h"
#include <sched.h>
#include <asm/unistd.h>
#ifndef CSIGNAL
# define CSIGNAL 0x000000ff
#endif
#include "xlat/clone_flags.h"
#include "xlat/setns_types.h"
#include "xlat/unshare_flags.h"
#if defined IA64
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_STACKSIZE (tcp->scno == SYS_clone2 ? 2 : -1)
# define ARG_PTID (tcp->scno == SYS_clone2 ? 3 : 2)
# define ARG_CTID (tcp->scno == SYS_clone2 ? 4 : 3)
# define ARG_TLS (tcp->scno == SYS_clone2 ? 5 : 4)
# define ARG_STACKSIZE (tcp->scno == __NR_clone2 ? 2 : -1)
# define ARG_PTID (tcp->scno == __NR_clone2 ? 3 : 2)
# define ARG_CTID (tcp->scno == __NR_clone2 ? 4 : 3)
# define ARG_TLS (tcp->scno == __NR_clone2 ? 5 : 4)
#elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
# define ARG_STACK 0
# define ARG_FLAGS 1
@ -59,7 +62,7 @@
# define ARG_PTID 2
# define ARG_CTID ((current_personality != 1) ? 3 : 4)
# define ARG_TLS ((current_personality != 1) ? 4 : 3)
#elif defined ALPHA || defined TILE || defined OR1K
#elif defined ALPHA || defined TILE || defined OR1K || defined RISCV
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_PTID 2
@ -73,25 +76,40 @@
# define ARG_CTID 4
#endif
#if defined I386 || defined X86_64 || defined X32
extern void print_user_desc(struct tcb *, long);
#endif /* I386 || X86_64 || X32 */
static void
print_tls_arg(struct tcb *const tcp, const kernel_ulong_t addr)
{
#ifdef HAVE_STRUCT_USER_DESC
# if SUPPORTED_PERSONALITIES > 1
if (current_personality == 1)
# endif
{
print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
}
# if SUPPORTED_PERSONALITIES > 1
else
# endif
#endif /* HAVE_STRUCT_USER_DESC */
{
printaddr(tcp->u_arg[ARG_TLS]);
}
}
SYS_FUNC(clone)
{
if (exiting(tcp)) {
const char *sep = "|";
unsigned long flags = tcp->u_arg[ARG_FLAGS];
kernel_ulong_t flags = tcp->u_arg[ARG_FLAGS];
tprints("child_stack=");
printaddr(tcp->u_arg[ARG_STACK]);
tprints(", ");
#ifdef ARG_STACKSIZE
if (ARG_STACKSIZE != -1)
tprintf("stack_size=%#lx, ",
tprintf("stack_size=%#" PRI_klx ", ",
tcp->u_arg[ARG_STACKSIZE]);
#endif
tprints("flags=");
if (!printflags(clone_flags, flags &~ CSIGNAL, NULL))
if (!printflags64(clone_flags, flags & ~CSIGNAL, NULL))
sep = "";
if ((flags & CSIGNAL) != 0)
tprintf("%s%s", sep, signame(flags & CSIGNAL));
@ -103,22 +121,8 @@ SYS_FUNC(clone)
printaddr(tcp->u_arg[ARG_PTID]);
}
if (flags & CLONE_SETTLS) {
#if defined I386 || defined X86_64 || defined X32
# ifndef I386
if (current_personality == 1)
# endif
{
tprints(", tls=");
print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
}
# ifndef I386
else
# endif
#endif /* I386 || X86_64 || X32 */
{
tprints(", tls=");
printaddr(tcp->u_arg[ARG_TLS]);
}
tprints(", tls=");
print_tls_arg(tcp, tcp->u_arg[ARG_TLS]);
}
if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) {
tprints(", child_tidptr=");
@ -144,14 +148,14 @@ SYS_FUNC(setns)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
printxval(setns_types, tcp->u_arg[1], "CLONE_NEW???");
return RVAL_DECODED;
}
SYS_FUNC(unshare)
{
printflags_long(clone_flags, tcp->u_arg[0], "CLONE_???");
printflags64(unshare_flags, tcp->u_arg[0], "CLONE_???");
return RVAL_DECODED;
}

View File

@ -5,6 +5,7 @@
# Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
# Copyright (c) 2002-2017 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -32,11 +33,16 @@
AC_PREREQ(2.57)
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
[strace-devel@lists.sourceforge.net])
[strace-devel@lists.sourceforge.net],
[strace],
[https://strace.io])
m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year]))
AC_COPYRIGHT([Copyright (c) 1999-]copyright_year[ The strace developers.])
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests])
AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
@ -47,6 +53,7 @@ AC_SUBST(DEB_CHANGELOGTIME)
AC_PROG_CC
AC_PROG_CPP
st_WARN_CFLAGS
AX_PROG_CC_FOR_BUILD
AC_PROG_INSTALL
AC_PROG_RANLIB
@ -54,6 +61,9 @@ AC_PROG_RANLIB
AC_USE_SYSTEM_EXTENSIONS
AX_CODE_COVERAGE
AC_DEFINE([COPYRIGHT_YEAR], "[copyright_year]", [Current copyright year.])
AC_SUBST([COPYRIGHT_YEAR], [copyright_year])
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
@ -187,6 +197,11 @@ xtensa*)
AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
;;
riscv*)
arch=riscv
AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
;;
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
@ -202,34 +217,34 @@ AC_SUBST(arch)
AC_SUBST(arch_m32)
AC_SUBST(arch_mx32)
MIPS_ABI=
if test "$arch" = mips; then
AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
[#include <sgidefs.h>],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], ,
[AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
# requires GCC >= 3.4
AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIO32 ? 1 : - 1];]])],
[st_cv_mips_abi=o32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIN32 ? 1 : - 1];]])],
[st_cv_mips_abi=n32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABI64 ? 1 : - 1];]])],
[st_cv_mips_abi=n64],
[st_cv_mips_abi=unknown])])])])
case "$st_cv_mips_abi" in
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _ABIO32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _ABIN32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _ABI64.]);;
*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
esac
MIPS_ABI="$st_cv_mips_abi"
fi
AC_SUBST(MIPS_ABI)
AC_ARG_ENABLE([arm-oabi],
[AS_HELP_STRING([--enable-arm-oabi],
@ -243,46 +258,14 @@ esac
AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
[Define to 1 if you want OABI support on ARM EABI.])
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wempty-body])
gl_WARN_ADD([-Wformat-security])
gl_WARN_ADD([-Wignored-qualifiers])
gl_WARN_ADD([-Winit-self])
gl_WARN_ADD([-Wlogical-op])
gl_WARN_ADD([-Wmissing-parameter-type])
gl_WARN_ADD([-Wnested-externs])
gl_WARN_ADD([-Wold-style-declaration])
gl_WARN_ADD([-Wold-style-definition])
gl_WARN_ADD([-Wsign-compare])
gl_WARN_ADD([-Wtype-limits])
gl_WARN_ADD([-Wwrite-strings])
AC_ARG_ENABLE([gcc-Werror],
[AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
[case $enableval in
yes) gl_WARN_ADD([-Werror]) ;;
no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
esac]
)
AC_SUBST([WARN_CFLAGS])
AC_C_BIGENDIAN
AC_C_CONST
AC_C_TYPEOF
AC_TYPE_GETGROUPS
AC_TYPE_MODE_T
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_HEADER_DIRENT
AC_HEADER_MAJOR
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_HEADER_STDC
AC_CHECK_FUNCS(m4_normalize([
accept4
fallocate
fanotify_mark
fopen64
fork
@ -292,15 +275,15 @@ AC_CHECK_FUNCS(m4_normalize([
futimens
if_indextoname
open64
pipe2
prctl
preadv
process_vm_readv
pwritev
sigaction
readahead
signalfd
stpcpy
strerror
strndup
strsignal
sync_file_range
utimensat
@ -317,6 +300,12 @@ AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
[#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
AC_CHECK_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,,
[#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES(m4_normalize([
struct pt_all_user_regs,
struct ia64_fpreg,
@ -332,35 +321,40 @@ AC_CHECK_TYPES(m4_normalize([
[#include <sys/types.h>
#include <linux/fcntl.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_atim.tv_nsec,
struct stat.st_blksize,
struct stat.st_blocks,
struct stat.st_ctim.tv_nsec,
struct stat.st_flags,
struct stat.st_fstype,
struct stat.st_gen,
struct stat.st_mtim.tv_nsec,
struct stat.st_rdev
]))
AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_atime_nsec,
struct stat.st_ctime_nsec,
struct stat.st_mtime_nsec
]),,, [#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_MEMBERS(m4_normalize([
siginfo_t.si_syscall,
siginfo_t.si_timerid,
siginfo_t.si_overrun
]),,, [#include <signal.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct perf_event_attr.precise_ip,
struct perf_event_attr.mmap_data,
struct perf_event_attr.sample_id_all,
struct perf_event_attr.exclude_host,
struct perf_event_attr.exclude_guest,
struct perf_event_attr.exclude_callchain_kernel,
struct perf_event_attr.exclude_callchain_user,
struct perf_event_attr.mmap2,
struct perf_event_attr.comm_exec,
struct perf_event_attr.use_clockid,
struct perf_event_attr.context_switch,
struct perf_event_attr.write_backward,
struct perf_event_attr.bp_type,
struct perf_event_attr.config1,
struct perf_event_attr.config2,
struct perf_event_attr.branch_sample_type,
struct perf_event_attr.sample_regs_user,
struct perf_event_attr.sample_stack_user,
struct perf_event_attr.sample_regs_intr,
struct perf_event_attr.aux_watermark,
struct perf_event_attr.sample_max_stack
]),,, [#include <linux/perf_event.h>])
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/sysmips.h
@ -368,15 +362,21 @@ AC_CHECK_HEADERS(m4_normalize([
elf.h
inttypes.h
linux/bsg.h
linux/dm-ioctl.h
linux/dqblk_xfs.h
linux/falloc.h
linux/fiemap.h
linux/filter.h
linux/genetlink.h
linux/hiddev.h
linux/ip_vs.h
linux/ipc.h
linux/mmtimer.h
linux/msg.h
linux/netfilter/nfnetlink.h
linux/nsfs.h
linux/perf_event.h
linux/quota.h
linux/seccomp.h
linux/securebits.h
linux/sem.h
@ -393,11 +393,13 @@ AC_CHECK_HEADERS(m4_normalize([
sys/fanotify.h
sys/ipc.h
sys/msg.h
sys/quota.h
sys/reg.h
sys/sem.h
sys/shm.h
sys/signalfd.h
sys/xattr.h
ustat.h
]))
AC_CHECK_HEADERS([asm/sigcontext.h],,, [#include <signal.h>])
@ -430,6 +432,28 @@ AC_CHECK_HEADERS([linux/bpf.h], [
AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
[Define to 1 if union bpf_attr.log_buf initialization works])
fi
AC_CACHE_CHECK([whether union bpf_attr.bpf_fd initialization works],
[st_cv_have_union_bpf_attr_bpf_fd],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .bpf_fd = 0 };]])],
[st_cv_have_union_bpf_attr_bpf_fd=yes],
[st_cv_have_union_bpf_attr_bpf_fd=no])])
if test $st_cv_have_union_bpf_attr_bpf_fd = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_BPF_FD, [1],
[Define to 1 if union bpf_attr.bpf_fd initialization works])
fi
AC_CACHE_CHECK([whether union bpf_attr.attach_flags initialization works],
[st_cv_have_union_bpf_attr_attach_flags],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .attach_flags = 0 };]])],
[st_cv_have_union_bpf_attr_attach_flags=yes],
[st_cv_have_union_bpf_attr_attach_flags=no])])
if test $st_cv_have_union_bpf_attr_attach_flags = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_ATTACH_FLAGS, [1],
[Define to 1 if union bpf_attr.attach_flags initialization works])
fi
])
AC_CHECK_TYPES([struct statfs], [
@ -466,8 +490,8 @@ AC_CHECK_HEADERS([linux/btrfs.h], [
struct btrfs_ioctl_search_args_v2.buf_size
]),,, [ #include <stdio.h>
#include <linux/btrfs.h>])
AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
BTRFS_COMPRESS_LZO]),,,[ #include <stdio.h>
AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
BTRFS_COMPRESS_LZO]),,,[ #include <stdio.h>
#include <linux/btrfs.h>])])
AC_CHECK_DECLS([sys_errlist])
@ -490,8 +514,10 @@ AC_CHECK_DECLS(m4_normalize([
AC_CHECK_DECLS(m4_normalize([
LO_FLAGS_READ_ONLY,
LO_FLAGS_USE_AOPS,
LO_FLAGS_AUTOCLEAR,
LO_FLAGS_PARTSCAN
LO_FLAGS_PARTSCAN,
LO_FLAGS_DIRECT_IO
]),,, [#include <linux/loop.h>])
AC_CHECK_DECLS(m4_normalize([
@ -591,6 +617,8 @@ AC_CHECK_DECLS(m4_normalize([
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
V4L2_BUF_TYPE_SDR_CAPTURE,
V4L2_BUF_TYPE_SDR_OUTPUT,
V4L2_TUNER_RADIO,
V4L2_TUNER_ANALOG_TV,
V4L2_TUNER_DIGITAL_TV,
@ -630,6 +658,14 @@ AC_CHECK_DECLS(m4_normalize([
#include <linux/types.h>
#include <linux/videodev2.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct v4l2_window.global_alpha,
struct v4l2_sdr_format.buffersize
]),,, [#include <sys/time.h>
#include <linux/ioctl.h>
#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>
@ -642,13 +678,14 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
AC_CHECK_SIZEOF([kernel_long_t],,[#include "$srcdir/kernel_types.h"])
AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep '^[0-9]')"
test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
if test "x$st_cv_SIGRTMIN" != xno; then
AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
[SIGRTMIN defined in <asm/signal.h>])
@ -657,7 +694,7 @@ AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
[st_cv_SA_RESTORER="$(echo SA_RESTORER |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep ^0x)"
test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
if test "x$st_cv_SA_RESTORER" != xno; then
AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
[SA_RESTORER defined in <asm/signal.h>])
@ -672,6 +709,16 @@ if test "x$st_cv_have___builtin_popcount" = xyes; then
[Define to 1 if the system provides __builtin_popcount function])
fi
AC_CACHE_CHECK([for program_invocation_name], [st_cv_have_program_invocation_name],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
[[return !*program_invocation_name]])],
[st_cv_have_program_invocation_name=yes],
[st_cv_have_program_invocation_name=no])])
if test "x$st_cv_have_program_invocation_name" = xyes; then
AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
[Define to 1 if the system provides program_invocation_name variable])
fi
AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
if test "x$ac_cv_lib_dl_dladdr" = xyes; then
AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
@ -685,15 +732,15 @@ libunwind_CPPFLAGS=
libunwind_LDFLAGS=
libunwind_LIBS=
AC_ARG_WITH([libunwind],
[AS_HELP_STRING([--with-libunwind],
[use libunwind to implement stack tracing support])],
[case "${withval}" in
yes|no|check) ;;
*) with_libunwind=yes
libunwind_CPPFLAGS="-I${withval}/include"
libunwind_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libunwind=check]
[AS_HELP_STRING([--with-libunwind],
[use libunwind to implement stack tracing support])],
[case "${withval}" in
yes|no|check) ;;
*) with_libunwind=yes
libunwind_CPPFLAGS="-I${withval}/include"
libunwind_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libunwind=check]
)
use_libunwind=no
@ -702,56 +749,56 @@ AS_IF([test "x$with_libunwind" != xno],
CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
AC_CHECK_HEADERS([libunwind-ptrace.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
AC_CHECK_LIB([unwind], [backtrace],
[libunwind_LIBS="-lunwind $libunwind_LIBS"
AC_CHECK_LIB([unwind], [backtrace],
[libunwind_LIBS="-lunwind $libunwind_LIBS"
AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
saved_LIBS="$LIBS"
LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
saved_LIBS="$LIBS"
LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
[[return !unw_create_addr_space(0, 0)]])
],
[AC_MSG_RESULT([yes])
libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
[[return !unw_create_addr_space(0, 0)]])
],
[AC_MSG_RESULT([yes])
libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
[libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
use_libunwind=yes
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
fi
],
[$libunwind_LIBS]
)
],
[AC_MSG_RESULT([no])
if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
fi
]
)
AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
[libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
use_libunwind=yes
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
fi
],
[$libunwind_LIBS]
)
],
[AC_MSG_RESULT([no])
if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
fi
]
)
LIBS="$saved_LIBS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind])
fi
],
[$libunwind_LIBS]
)
LIBS="$saved_LIBS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind])
fi
],
[$libunwind_LIBS]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
fi
]
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
@ -781,6 +828,9 @@ fi
st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AX_VALGRIND_DFLT([sgcheck], [off])
AX_VALGRIND_CHECK
AC_CONFIG_FILES([Makefile
tests/Makefile
tests-m32/Makefile

View File

@ -42,7 +42,7 @@ SYS_FUNC(copy_file_range)
printnum_int64(tcp, tcp->u_arg[3], "%" PRId64);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[4]);
tprintf("%" PRI_klu ", ", tcp->u_arg[4]);
/* unsigned int flags */
tprintf("%u", (unsigned int) tcp->u_arg[5]);

27
copyright-year-gen Executable file
View File

@ -0,0 +1,27 @@
#! /bin/sh
: ${YEAR_FILE:=$1}
: ${DEFAULT_YEAR:=$2}
year=
[ -n "${YEAR_FILE}" ] || {
echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
exit 1
}
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
[ -n "${year}" ] ||
year="$(git show --format=format:%cd --no-patch --date=format:%Y)"
[ -n "${year}" ] || year="${DEFAULT_YEAR}"
[ -n "${year}" ] || year="$(date "+%Y")"
[ -n "${year}" ] || {
echo >&2 'Undefined year.'
exit 1
}
printf "%s" "${year}"

10
count.c
View File

@ -8,6 +8,7 @@
* <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com>
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2006-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -53,17 +54,16 @@ count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
struct timeval wtv;
struct timeval *tv = &wtv;
struct call_counts *cc;
unsigned long scno = tcp->scno;
if (!SCNO_IN_RANGE(scno))
if (!scno_in_range(tcp->scno))
return;
if (!counts)
counts = xcalloc(nsyscalls, sizeof(*counts));
cc = &counts[scno];
cc = &counts[tcp->scno];
cc->calls++;
if (tcp->u_error)
if (syserror(tcp))
cc->errors++;
/* tv = wall clock time spent while in syscall */
@ -77,7 +77,7 @@ count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
/* Initialize it. */
struct itimerval it;
memset(&it, 0, sizeof it);
memset(&it, 0, sizeof(it));
it.it_interval.tv_usec = 1;
setitimer(ITIMER_REAL, &it, NULL);
getitimer(ITIMER_REAL, &it);

30
debian/changelog.in vendored
View File

@ -4,6 +4,36 @@ strace (@PACKAGE_VERSION@-1) experimental; urgency=low
-- Strace <@PACKAGE_BUGREPORT@> @DEB_CHANGELOGTIME@
strace (4.17-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Wed, 24 May 2017 16:17:18 +0000
strace (4.16-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 14 Feb 2017 10:11:12 +0000
strace (4.15-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Wed, 14 Dec 2016 08:09:10 +0000
strace (4.14-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 04 Oct 2016 18:19:20 +0000
strace (4.13-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Tue, 26 Jul 2016 16:17:18 +0000
strace (4.12-3) unstable; urgency=medium
* Fix up 32/64-bit test output in strace -S test to fix i386 build

4
debian/control vendored
View File

@ -4,7 +4,9 @@ Section: utils
Priority: optional
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc sparc64 x32], debhelper (>= 7.0.0), gawk
Standards-Version: 3.9.6
Homepage: http://sourceforge.net/projects/strace/
Homepage: https://strace.io
Vcs-Git: https://anonscm.debian.org/git/collab-maint/strace.git
Vcs-Browser: https://anonscm.debian.org/git/collab-maint/strace.git
Package: strace
Architecture: alpha amd64 arm64 armeb armel armhf hppa i386 ia64 m68k mips mipsel mips64 mips64el or1k powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32

2
debian/copyright vendored
View File

@ -10,7 +10,7 @@ Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
Copyright (c) 1993 Ulrich Pegelow <pegelow@moorea.uni-muenster.de>
Copyright (c) 1995, 1996 Michael Elizabeth Chastain <mec@duracef.shout.net>
Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
Copyright (C) 1998-2003 Wichert Akkerman <wakkerma@deephackmode.org>
Copyright (c) 1998-2003 Wichert Akkerman <wakkerma@deephackmode.org>
Copyright (c) 2002-2008 Roland McGrath <roland@redhat.com>
Copyright (c) 2003-2008 Dmitry V. Levin <ldv@altlinux.org>
Copyright (c) 2007-2008 Jan Kratochvil <jan.kratochvil@redhat.com>

2
debian/watch vendored
View File

@ -1,2 +1,2 @@
version=3
opts="uversionmangle=s/-/./g" http://sf.net/strace/strace-([[:digit:].-]*)\.tar\.xz
opts=pgpsigurlmangle=s/$/.asc/,uversionmangle=s/-/./g http://sf.net/strace/strace-([[:digit:].-]*)\.tar\.xz

835
defs.h

File diff suppressed because it is too large Load Diff

81
desc.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -69,17 +70,17 @@ SYS_FUNC(dup3)
}
static int
decode_select(struct tcb *tcp, long *args,
void (*print_tv_ts) (struct tcb *, const long),
const char * (*sprint_tv_ts) (struct tcb *, const long))
decode_select(struct tcb *const tcp, const kernel_ulong_t *const args,
void (*const print_tv_ts) (struct tcb *, kernel_ulong_t),
const char * (*const sprint_tv_ts) (struct tcb *, kernel_ulong_t))
{
int i, j;
int nfds, fdsize;
fd_set *fds = NULL;
const char *sep;
long arg;
kernel_ulong_t addr;
/* Kernel truncates arg[0] to int, we do the same. */
/* Kernel truncates args[0] to int, we do the same. */
nfds = (int) args[0];
/* Kernel rejects negative nfds, so we don't parse it either. */
@ -102,13 +103,13 @@ decode_select(struct tcb *tcp, long *args,
if (verbose(tcp) && fdsize > 0)
fds = malloc(fdsize);
for (i = 0; i < 3; i++) {
arg = args[i+1];
addr = args[i+1];
tprints(", ");
if (!fds) {
printaddr(arg);
printaddr(addr);
continue;
}
if (umoven_or_printaddr(tcp, arg, fdsize, fds))
if (umoven_or_printaddr(tcp, addr, fdsize, fds))
continue;
tprints("[");
for (j = 0, sep = "";; j++) {
@ -146,8 +147,8 @@ decode_select(struct tcb *tcp, long *args,
for (i = 0; i < 3 && ready_fds > 0; i++) {
int first = 1;
arg = args[i+1];
if (!arg || !fds || umoven(tcp, arg, fdsize, fds) < 0)
addr = args[i+1];
if (!addr || !fds || umoven(tcp, addr, fdsize, fds) < 0)
continue;
for (j = 0;; j++) {
j = next_set_bit(fds, j, nfds);
@ -163,8 +164,7 @@ decode_select(struct tcb *tcp, long *args,
);
first = 0;
sep = ", ";
}
else {
} else {
outptr += sprintf(outptr, " %u", j);
}
}
@ -192,26 +192,26 @@ decode_select(struct tcb *tcp, long *args,
SYS_FUNC(oldselect)
{
long long_args[5];
#undef oldselect_args
#if SIZEOF_LONG == 4
# define oldselect_args long_args
#else
kernel_ulong_t select_args[5];
unsigned int oldselect_args[5];
unsigned int i;
#endif
if (umove(tcp, tcp->u_arg[0], &oldselect_args) < 0) {
printaddr(tcp->u_arg[0]);
return 0;
if (sizeof(*select_args) == sizeof(*oldselect_args)) {
if (umove_or_printaddr(tcp, tcp->u_arg[0], &select_args)) {
return 0;
}
} else {
unsigned int i;
if (umove_or_printaddr(tcp, tcp->u_arg[0], &oldselect_args)) {
return 0;
}
for (i = 0; i < 5; ++i) {
select_args[i] = oldselect_args[i];
}
}
#ifndef oldselect_args
for (i = 0; i < 5; i++) {
long_args[i] = oldselect_args[i];
}
#endif
return decode_select(tcp, long_args, print_timeval, sprint_timeval);
#undef oldselect_args
return decode_select(tcp, select_args, print_timeval, sprint_timeval);
}
#ifdef ALPHA
@ -226,27 +226,23 @@ SYS_FUNC(select)
return decode_select(tcp, tcp->u_arg, print_timeval, sprint_timeval);
}
#include "kernel_types.h"
static int
umove_kulong_array_or_printaddr(struct tcb *tcp, const long addr,
kernel_ulong_t *ptr, size_t n)
umove_kulong_array_or_printaddr(struct tcb *const tcp, const kernel_ulong_t addr,
kernel_ulong_t *const ptr, const size_t n)
{
#if defined X86_64 || defined X32
if (current_personality == 1) {
#else
if (current_wordsize < sizeof(*ptr)) {
#endif
#ifndef current_klongsize
if (current_klongsize < sizeof(*ptr)) {
uint32_t ptr32[n];
int r = umove_or_printaddr(tcp, addr, &ptr32);
if (!r) {
size_t i;
for (i = 0; i < n; ++i)
ptr[i] = (kernel_ulong_t) ptr32[i];
ptr[i] = ptr32[i];
}
return r;
}
#endif /* !current_klongsize */
return umoven_or_printaddr(tcp, addr, n * sizeof(*ptr), ptr);
}
@ -260,10 +256,9 @@ SYS_FUNC(pselect6)
if (!umove_kulong_array_or_printaddr(tcp, tcp->u_arg[5],
data, ARRAY_SIZE(data))) {
tprints("{");
/* NB: kernel requires data[1] == NSIG / 8 */
print_sigset_addr_len(tcp, (unsigned long) data[0],
(unsigned long) data[1]);
tprintf(", %llu}", (unsigned long long) data[1]);
/* NB: kernel requires data[1] == NSIG_BYTES */
print_sigset_addr_len(tcp, data[0], data[1]);
tprintf(", %" PRI_klu "}", data[1]);
}
}

View File

@ -4,6 +4,7 @@
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,14 +34,12 @@
#include DEF_MPERS_TYPE(kernel_dirent)
#include "kernel_types.h"
#include MPERS_DEFS
#define D_NAME_LEN_MAX 256
static void
print_old_dirent(struct tcb *tcp, long addr)
print_old_dirent(struct tcb *const tcp, const kernel_ulong_t addr)
{
kernel_dirent d;
@ -48,8 +47,8 @@ print_old_dirent(struct tcb *tcp, long addr)
return;
tprintf("{d_ino=%llu, d_off=%llu, d_reclen=%u, d_name=",
widen_to_ull(d.d_ino),
widen_to_ull(d.d_off), d.d_reclen);
zero_extend_signed_to_ull(d.d_ino),
zero_extend_signed_to_ull(d.d_off), d.d_reclen);
if (d.d_reclen > D_NAME_LEN_MAX)
d.d_reclen = D_NAME_LEN_MAX;
printpathn(tcp, addr + offsetof(kernel_dirent, d_name), d.d_reclen);
@ -68,7 +67,7 @@ SYS_FUNC(readdir)
print_old_dirent(tcp, tcp->u_arg[1]);
/* Not much point in printing this out, it is always 1. */
if (tcp->u_arg[2] != 1)
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
}
@ -80,13 +79,13 @@ SYS_FUNC(getdents)
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
return 0;
}
const unsigned int count = tcp->u_arg[2];
if (syserror(tcp) || !verbose(tcp)) {
tprints(", ");
printaddr(tcp->u_arg[1]);
tprintf(", %u", count);
return 0;
@ -103,6 +102,7 @@ SYS_FUNC(getdents)
if (len) {
buf = malloc(len);
if (!buf || umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
tprints(", ");
printaddr(tcp->u_arg[1]);
tprintf(", %u", count);
free(buf);
@ -112,8 +112,9 @@ SYS_FUNC(getdents)
buf = NULL;
}
tprints(",");
if (!abbrev(tcp))
tprints("[");
tprints(" [");
for (i = 0; len && i <= len - sizeof(kernel_dirent); ) {
kernel_dirent *d = (kernel_dirent *) &buf[i];
@ -127,11 +128,12 @@ SYS_FUNC(getdents)
tprintf("%s{d_ino=%llu, d_off=%llu, d_reclen=%u"
", d_name=", i ? ", " : "",
widen_to_ull(d->d_ino),
widen_to_ull(d->d_off), d->d_reclen);
zero_extend_signed_to_ull(d->d_ino),
zero_extend_signed_to_ull(d->d_off),
d->d_reclen);
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
@ -144,7 +146,7 @@ SYS_FUNC(getdents)
}
dents++;
if (d->d_reclen < sizeof(kernel_dirent)) {
tprints("/* d_reclen < sizeof(struct dirent) */");
tprints_comment("d_reclen < sizeof(struct dirent)");
break;
}
i += d->d_reclen;
@ -152,7 +154,7 @@ SYS_FUNC(getdents)
if (!abbrev(tcp))
tprints("]");
else
tprintf("/* %u entries */", dents);
tprintf_comment("%u entries", dents);
tprintf(", %u", count);
free(buf);
return 0;

View File

@ -4,6 +4,7 @@
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -46,13 +47,13 @@ SYS_FUNC(getdents64)
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
return 0;
}
const unsigned int count = tcp->u_arg[2];
if (syserror(tcp) || !verbose(tcp)) {
tprints(", ");
printaddr(tcp->u_arg[1]);
tprintf(", %u", count);
return 0;
@ -69,6 +70,7 @@ SYS_FUNC(getdents64)
if (len) {
buf = malloc(len);
if (!buf || umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
tprints(", ");
printaddr(tcp->u_arg[1]);
tprintf(", %u", count);
free(buf);
@ -78,8 +80,9 @@ SYS_FUNC(getdents64)
buf = NULL;
}
tprints(",");
if (!abbrev(tcp))
tprints("[");
tprints(" [");
for (i = 0; len && i <= len - d_name_offset; ) {
struct dirent64 *d = (struct dirent64 *) &buf[i];
if (!abbrev(tcp)) {
@ -103,14 +106,14 @@ SYS_FUNC(getdents64)
tprints(", d_name=");
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
tprints("}");
}
if (d->d_reclen < d_name_offset) {
tprints("/* d_reclen < offsetof(struct dirent64, d_name) */");
tprints_comment("d_reclen < offsetof(struct dirent64, d_name)");
break;
}
i += d->d_reclen;
@ -119,7 +122,7 @@ SYS_FUNC(getdents64)
if (!abbrev(tcp))
tprints("]");
else
tprintf("/* %u entries */", dents);
tprintf_comment("%u entries", dents);
tprintf(", %u", count);
free(buf);
return 0;

606
dm.c Normal file
View File

@ -0,0 +1,606 @@
/*
* Support for decoding of DM_* ioctl commands.
*
* Copyright (c) 2016 Mikulas Patocka <mpatocka@redhat.com>
* Copyright (c) 2016 Masatake Yamato <yamato@redhat.com>
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
* Copyright (c) 2016-2017 The strace developers.
* 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.
*/
#include "defs.h"
#ifdef HAVE_LINUX_DM_IOCTL_H
# include <linux/dm-ioctl.h>
# include <linux/ioctl.h>
# if DM_VERSION_MAJOR == 4
/* Definitions for command which have been added later */
# ifndef DM_LIST_VERSIONS
# define DM_LIST_VERSIONS _IOWR(DM_IOCTL, 0xd, struct dm_ioctl)
# endif
# ifndef DM_TARGET_MSG
# define DM_TARGET_MSG _IOWR(DM_IOCTL, 0xe, struct dm_ioctl)
# endif
# ifndef DM_DEV_SET_GEOMETRY
# define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, 0xf, struct dm_ioctl)
# endif
static void
dm_decode_device(const unsigned int code, const struct dm_ioctl *ioc)
{
switch (code) {
case DM_REMOVE_ALL:
case DM_LIST_DEVICES:
case DM_LIST_VERSIONS:
break;
default:
if (ioc->dev) {
tprints(", dev=");
print_dev_t(ioc->dev);
}
if (ioc->name[0]) {
tprints(", name=");
print_quoted_string(ioc->name, DM_NAME_LEN,
QUOTE_0_TERMINATED);
}
if (ioc->uuid[0]) {
tprints(", uuid=");
print_quoted_string(ioc->uuid, DM_UUID_LEN,
QUOTE_0_TERMINATED);
}
break;
}
}
static void
dm_decode_values(struct tcb *tcp, const unsigned int code,
const struct dm_ioctl *ioc)
{
if (entering(tcp)) {
switch (code) {
case DM_TABLE_LOAD:
tprintf(", target_count=%" PRIu32,
ioc->target_count);
break;
case DM_DEV_SUSPEND:
if (ioc->flags & DM_SUSPEND_FLAG)
break;
/* Fall through */
case DM_DEV_RENAME:
case DM_DEV_REMOVE:
case DM_DEV_WAIT:
tprintf(", event_nr=%" PRIu32,
ioc->event_nr);
break;
}
} else if (!syserror(tcp)) {
switch (code) {
case DM_DEV_CREATE:
case DM_DEV_RENAME:
case DM_DEV_SUSPEND:
case DM_DEV_STATUS:
case DM_DEV_WAIT:
case DM_TABLE_LOAD:
case DM_TABLE_CLEAR:
case DM_TABLE_DEPS:
case DM_TABLE_STATUS:
case DM_TARGET_MSG:
tprintf(", target_count=%" PRIu32,
ioc->target_count);
tprintf(", open_count=%" PRIu32,
ioc->open_count);
tprintf(", event_nr=%" PRIu32,
ioc->event_nr);
break;
}
}
}
#include "xlat/dm_flags.h"
static void
dm_decode_flags(const struct dm_ioctl *ioc)
{
tprints(", flags=");
printflags(dm_flags, ioc->flags, "DM_???");
}
static void
dm_decode_dm_target_spec(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t target_spec_size =
sizeof(struct dm_target_spec);
uint32_t i;
uint32_t offset = ioc->data_start;
uint32_t offset_end = 0;
if (abbrev(tcp)) {
if (ioc->target_count)
tprints(", ...");
return;
}
for (i = 0; i < ioc->target_count; i++) {
tprints(", ");
if (i && offset <= offset_end)
goto misplaced;
offset_end = offset + target_spec_size;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
if (i >= max_strlen) {
tprints("...");
break;
}
struct dm_target_spec s;
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprintf("{sector_start=%" PRI__u64 ", length=%" PRI__u64,
s.sector_start, s.length);
if (exiting(tcp))
tprintf(", status=%" PRId32, s.status);
tprints(", target_type=");
print_quoted_string(s.target_type, DM_MAX_TYPE_NAME,
QUOTE_0_TERMINATED);
tprints(", string=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
if (entering(tcp))
offset += s.next;
else
offset = ioc->data_start + s.next;
}
return;
misplaced:
tprints("???");
tprints_comment("misplaced struct dm_target_spec");
}
bool
dm_print_dev(struct tcb *tcp, void *dev_ptr, size_t dev_size, void *dummy)
{
uint64_t *dev = (uint64_t *) dev_ptr;
print_dev_t(*dev);
return 1;
}
static void
dm_decode_dm_target_deps(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
if (ioc->data_start == ioc->data_size)
return;
tprints(", ");
if (abbrev(tcp)) {
tprints("...");
return;
}
static const uint32_t target_deps_dev_offs =
offsetof(struct dm_target_deps, dev);
uint64_t dev_buf;
struct dm_target_deps s;
uint32_t offset = ioc->data_start;
uint32_t offset_end = offset + target_deps_dev_offs;
uint32_t space;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
if (umove_or_printaddr(tcp, addr + offset, &s))
return;
space = (ioc->data_size - offset_end) / sizeof(dev_buf);
if (s.count > space)
goto misplaced;
tprintf("{count=%u, deps=", s.count);
print_array(tcp, addr + offset_end, s.count, &dev_buf, sizeof(dev_buf),
umoven_or_printaddr, dm_print_dev, NULL);
tprints("}");
return;
misplaced:
tprints("???");
tprints_comment("misplaced struct dm_target_deps");
}
static void
dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t name_list_name_offs =
offsetof(struct dm_name_list, name);
struct dm_name_list s;
uint32_t offset = ioc->data_start;
uint32_t offset_end = 0;
uint32_t count;
if (ioc->data_start == ioc->data_size)
return;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
for (count = 0;; count++) {
tprints(", ");
if (count && offset <= offset_end)
goto misplaced;
offset_end = offset + name_list_name_offs;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
if (count >= max_strlen) {
tprints("...");
break;
}
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprints("{dev=");
print_dev_t(s.dev);
tprints("name=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
if (!s.next)
break;
offset += s.next;
}
return;
misplaced:
tprints("???");
tprints_comment("misplaced struct dm_name_list");
}
static void
dm_decode_dm_target_versions(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
static const uint32_t target_vers_name_offs =
offsetof(struct dm_target_versions, name);
struct dm_target_versions s;
uint32_t offset = ioc->data_start;
uint32_t offset_end = 0;
uint32_t count;
if (ioc->data_start == ioc->data_size)
return;
if (abbrev(tcp)) {
tprints(", ...");
return;
}
for (count = 0;; count++) {
tprints(", ");
if (count && offset <= offset_end)
goto misplaced;
offset_end = offset + target_vers_name_offs;
if (offset_end <= offset || offset_end > ioc->data_size)
goto misplaced;
if (count >= max_strlen) {
tprints("...");
break;
}
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprints("{name=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprintf(", version=%" PRIu32 ".%" PRIu32 ".%" PRIu32 "}",
s.version[0], s.version[1], s.version[2]);
if (!s.next)
break;
offset += s.next;
}
return;
misplaced:
tprints("???");
tprints_comment("misplaced struct dm_target_versions");
}
static void
dm_decode_dm_target_msg(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
if (ioc->data_start == ioc->data_size)
return;
tprints(", ");
if (abbrev(tcp)) {
tprints("...");
return;
}
static const uint32_t target_msg_message_offs =
offsetof(struct dm_target_msg, message);
uint32_t offset = ioc->data_start;
uint32_t offset_end = offset + target_msg_message_offs;
if (offset_end > offset && offset_end <= ioc->data_size) {
struct dm_target_msg s;
if (umove_or_printaddr(tcp, addr + offset, &s))
return;
tprintf("{sector=%" PRI__u64 ", message=", s.sector);
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
} else {
tprints("???");
tprints_comment("misplaced struct dm_target_msg");
}
}
static void
dm_decode_string(struct tcb *const tcp, const kernel_ulong_t addr,
const struct dm_ioctl *const ioc)
{
tprints(", ");
if (abbrev(tcp)) {
tprints("...");
return;
}
uint32_t offset = ioc->data_start;
if (offset <= ioc->data_size) {
tprints("string=");
printstr_ex(tcp, addr + offset, ioc->data_size - offset,
QUOTE_0_TERMINATED);
} else {
tprints("???");
tprints_comment("misplaced string");
}
}
static inline bool
dm_ioctl_has_params(const unsigned int code)
{
switch (code) {
case DM_VERSION:
case DM_REMOVE_ALL:
case DM_DEV_CREATE:
case DM_DEV_REMOVE:
case DM_DEV_SUSPEND:
case DM_DEV_STATUS:
case DM_TABLE_CLEAR:
return false;
}
return true;
}
static int
dm_known_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
struct dm_ioctl *ioc = NULL;
struct dm_ioctl *entering_ioc = NULL;
bool ioc_changed = false;
if (entering(tcp)) {
ioc = malloc(sizeof(*ioc));
if (!ioc)
return 0;
} else {
ioc = alloca(sizeof(*ioc));
}
if ((umoven(tcp, arg, offsetof(struct dm_ioctl, data), ioc) < 0) ||
(ioc->data_size < offsetof(struct dm_ioctl, data_size))) {
if (entering(tcp))
free(ioc);
return 0;
}
if (entering(tcp))
set_tcb_priv_data(tcp, ioc, free);
else {
entering_ioc = get_tcb_priv_data(tcp);
/*
* retrieve_status, __dev_status called only in case of success,
* so it looks like there's no need to check open_count,
* event_nr, target_count, dev fields for change (they are
* printed only in case of absence of errors).
*/
if (!entering_ioc ||
(ioc->version[0] != entering_ioc->version[0]) ||
(ioc->version[1] != entering_ioc->version[1]) ||
(ioc->version[2] != entering_ioc->version[2]) ||
(ioc->data_size != entering_ioc->data_size) ||
(ioc->data_start != entering_ioc->data_start) ||
(ioc->flags != entering_ioc->flags))
ioc_changed = true;
}
if (exiting(tcp) && syserror(tcp) && !ioc_changed)
return 1;
/*
* device mapper code uses %d in some places and %u in another, but
* fields themselves are declared as __u32.
*/
tprintf("%s{version=%u.%u.%u", entering(tcp) ? ", " : " => ",
ioc->version[0], ioc->version[1], ioc->version[2]);
/*
* if we use a different version of ABI, do not attempt to decode
* ioctl fields
*/
if (ioc->version[0] != DM_VERSION_MAJOR) {
tprints_comment("unsupported device mapper ABI version");
goto skip;
}
tprintf(", data_size=%u", ioc->data_size);
if (ioc->data_size < offsetof(struct dm_ioctl, data)) {
tprints_comment("data_size too small");
goto skip;
}
if (dm_ioctl_has_params(code))
tprintf(", data_start=%u", ioc->data_start);
dm_decode_device(code, ioc);
dm_decode_values(tcp, code, ioc);
dm_decode_flags(ioc);
switch (code) {
case DM_DEV_WAIT:
case DM_TABLE_STATUS:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_target_spec(tcp, arg, ioc);
break;
case DM_TABLE_LOAD:
if (exiting(tcp))
break;
dm_decode_dm_target_spec(tcp, arg, ioc);
break;
case DM_TABLE_DEPS:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_target_deps(tcp, arg, ioc);
break;
case DM_LIST_DEVICES:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_name_list(tcp, arg, ioc);
break;
case DM_LIST_VERSIONS:
if (entering(tcp) || syserror(tcp))
break;
dm_decode_dm_target_versions(tcp, arg, ioc);
break;
case DM_TARGET_MSG:
if (entering(tcp))
dm_decode_dm_target_msg(tcp, arg, ioc);
else if (!syserror(tcp) && ioc->flags & DM_DATA_OUT_FLAG)
dm_decode_string(tcp, arg, ioc);
break;
case DM_DEV_RENAME:
case DM_DEV_SET_GEOMETRY:
if (exiting(tcp))
break;
dm_decode_string(tcp, arg, ioc);
break;
}
skip:
tprints("}");
return 1;
}
int
dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
case DM_VERSION:
case DM_REMOVE_ALL:
case DM_LIST_DEVICES:
case DM_DEV_CREATE:
case DM_DEV_REMOVE:
case DM_DEV_RENAME:
case DM_DEV_SUSPEND:
case DM_DEV_STATUS:
case DM_DEV_WAIT:
case DM_TABLE_LOAD:
case DM_TABLE_CLEAR:
case DM_TABLE_DEPS:
case DM_TABLE_STATUS:
case DM_LIST_VERSIONS:
case DM_TARGET_MSG:
case DM_DEV_SET_GEOMETRY:
return dm_known_ioctl(tcp, code, arg);
default:
return 0;
}
}
# else /* !(DM_VERSION_MAJOR == 4) */
int
dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
{
return 0;
}
# endif /* DM_VERSION_MAJOR == 4 */
#endif /* HAVE_LINUX_DM_IOCTL_H */

103
dyxlat.c Normal file
View File

@ -0,0 +1,103 @@
/*
* Copyright (c) 2017 The strace developers.
*
* 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.
*/
#include "defs.h"
struct dyxlat {
size_t used;
size_t allocated;
struct xlat *xlat;
};
#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->allocated = nmemb ? nmemb : 16;
dyxlat->xlat = xcalloc(dyxlat->allocated, sizeof(struct xlat));
MARK_END(dyxlat->xlat[0]);
return dyxlat;
}
void
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;
}
free(dyxlat->xlat);
dyxlat->xlat = NULL;
free(dyxlat);
}
const struct xlat *
dyxlat_get(const struct dyxlat *const dyxlat)
{
return dyxlat->xlat;
}
void
dyxlat_add_pair(struct dyxlat *const dyxlat, const uint64_t val,
const char *const str, const size_t len)
{
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')
return;
free((void *) dyxlat->xlat[i].str);
dyxlat->xlat[i].str = xstrndup(str, len);
return;
}
}
if (dyxlat->used >= dyxlat->allocated) {
dyxlat->allocated *= 2;
dyxlat->xlat = xreallocarray(dyxlat->xlat, dyxlat->allocated,
sizeof(struct xlat));
}
dyxlat->xlat[dyxlat->used - 1].val = val;
dyxlat->xlat[dyxlat->used - 1].str = xstrndup(str, len);
MARK_END(dyxlat->xlat[dyxlat->used]);
dyxlat->used++;
}

View File

@ -2,6 +2,7 @@
* Copyright (c) 2004-2007 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -109,9 +110,9 @@ SYS_FUNC(epoll_pwait)
epoll_wait_common(tcp);
if (exiting(tcp)) {
tprints(", ");
/* NB: kernel requires arg[5] == NSIG / 8 */
/* NB: kernel requires arg[5] == NSIG_BYTES */
print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
tprintf(", %lu", tcp->u_arg[5]);
tprintf(", %" PRI_klu, tcp->u_arg[5]);
}
return 0;
}

45
evdev.c
View File

@ -37,7 +37,7 @@
typedef struct ff_effect struct_ff_effect;
#endif /* HAVE_LINUX_BTRFS_H */
#endif /* HAVE_LINUX_INPUT_H */
#include MPERS_DEFS
@ -76,7 +76,7 @@ decode_envelope(void *const data)
}
static int
ff_effect_ioctl(struct tcb *tcp, long arg)
ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -135,7 +135,7 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
decode_envelope(&ffe.u.periodic.envelope);
tprintf(", custom_len=%u, custom_data=",
ffe.u.periodic.custom_len);
printaddr((unsigned long) ffe.u.periodic.custom_data);
printaddr(ptr_to_kulong(ffe.u.periodic.custom_data));
tprints("}");
break;
case FF_RUMBLE:
@ -154,7 +154,7 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
}
static int
abs_ioctl(struct tcb *tcp, long arg)
abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -188,7 +188,7 @@ abs_ioctl(struct tcb *tcp, long arg)
}
static int
keycode_ioctl(struct tcb *tcp, long arg)
keycode_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -205,7 +205,7 @@ keycode_ioctl(struct tcb *tcp, long arg)
# ifdef EVIOCGKEYCODE_V2
static int
keycode_V2_ioctl(struct tcb *tcp, long arg)
keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -242,7 +242,7 @@ keycode_V2_ioctl(struct tcb *tcp, long arg)
# endif /* EVIOCGKEYCODE_V2 */
static int
getid_ioctl(struct tcb *tcp, long arg)
getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
@ -262,13 +262,14 @@ getid_ioctl(struct tcb *tcp, long arg)
}
static int
decode_bitset(struct tcb *tcp, long arg, const struct xlat decode_nr[],
const unsigned int max_nr, const char *dflt)
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(", ");
unsigned int size;
if ((unsigned long) tcp->u_rval > max_nr)
if ((kernel_ulong_t) tcp->u_rval > max_nr)
size = max_nr;
else
size = tcp->u_rval;
@ -304,7 +305,8 @@ decode_bitset(struct tcb *tcp, long arg, const struct xlat decode_nr[],
# ifdef EVIOCGMTSLOTS
static int
mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
mtslots_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
tprints(", ");
@ -336,7 +338,7 @@ mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
# if defined EVIOCGREP || defined EVIOCSREP
static int
repeat_ioctl(struct tcb *tcp, long arg)
repeat_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
printpair_int(tcp, arg, "%u");
@ -345,7 +347,8 @@ repeat_ioctl(struct tcb *tcp, long arg)
# endif /* EVIOCGREP || EVIOCSREP */
static int
bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
const kernel_ulong_t arg)
{
switch (ev_nr) {
case EV_SYN:
@ -395,7 +398,8 @@ bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
}
static int
evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
evdev_read_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
/* fixed-number fixed-length commands */
switch (code) {
@ -434,7 +438,7 @@ evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
if (syserror(tcp))
printaddr(arg);
else
printstr(tcp, arg, tcp->u_rval);
printstrn(tcp, arg, tcp->u_rval);
return 1;
# ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
@ -469,7 +473,8 @@ evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
}
static int
evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
evdev_write_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
/* fixed-number fixed-length commands */
switch (code) {
@ -492,7 +497,7 @@ evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
# ifdef EVIOCREVOKE
case EVIOCREVOKE:
# endif
tprintf(", %lu", arg);
tprintf(", %" PRI_klu, arg);
return 1;
# ifdef EVIOCSCLOCKID
case EVIOCSCLOCKID:
@ -509,10 +514,10 @@ evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
return 0;
}
MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *tcp,
const unsigned int code, const long arg)
MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *const tcp,
const unsigned int code, const kernel_ulong_t arg)
{
switch(_IOC_DIR(code)) {
switch (_IOC_DIR(code)) {
case _IOC_READ:
if (entering(tcp))
return 0;

View File

@ -6,6 +6,7 @@
* Copyright (c) 2007 Roland McGrath <roland@redhat.com>
* Copyright (c) 2011-2012 Denys Vlasenko <vda.linux@googlemail.com>
* Copyright (c) 2010-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -34,7 +35,7 @@
#include "defs.h"
static void
printargv(struct tcb *tcp, long addr)
printargv(struct tcb *const tcp, kernel_ulong_t addr)
{
if (!addr || !verbose(tcp)) {
printaddr(addr);
@ -49,8 +50,8 @@ printargv(struct tcb *tcp, long addr)
for (n = 0; addr; sep = ", ", addr += wordsize, ++n) {
union {
unsigned int p32;
unsigned long p64;
char data[sizeof(long)];
kernel_ulong_t p64;
char data[sizeof(kernel_ulong_t)];
} cp;
if (umoven(tcp, addr, wordsize, cp.data)) {
@ -70,18 +71,18 @@ printargv(struct tcb *tcp, long addr)
break;
}
tprints(sep);
printstr(tcp, wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64, -1);
printstr(tcp, wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64);
}
tprints("]");
}
static void
printargc(struct tcb *tcp, long addr)
printargc(struct tcb *const tcp, kernel_ulong_t addr)
{
if (!addr || !verbose(tcp)) {
printaddr(addr);
printaddr(addr);
if (!addr || !verbose(tcp))
return;
}
bool unterminated = false;
unsigned int count = 0;
@ -89,17 +90,16 @@ printargc(struct tcb *tcp, long addr)
for (; addr; addr += current_wordsize, ++count) {
if (umoven(tcp, addr, current_wordsize, &cp)) {
if (count) {
unterminated = true;
break;
}
printaddr(addr);
return;
if (!count)
return;
unterminated = true;
break;
}
if (!cp)
break;
}
tprintf("[/* %u var%s%s */]",
tprintf_comment("%u var%s%s",
count, count == 1 ? "" : "s",
unterminated ? ", unterminated" : "");
}

15
exit.c
View File

@ -1,15 +0,0 @@
#include "defs.h"
SYS_FUNC(exit)
{
if (exiting(tcp)) {
error_msg("_exit returned!");
return -1;
}
/* special case: we stop tracing this process, finish line now */
tprintf("%ld) ", tcp->u_arg[0]);
tabto();
tprints("= ?\n");
line_ended();
return 0;
}

View File

@ -5,6 +5,7 @@
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
* Copyright (c) 2009 Kirill A. Shutemov <kirill@shutemov.name>
* Copyright (c) 2011-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -42,7 +43,7 @@ SYS_FUNC(fadvise64)
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld", 1);
tprintf(", %ld, ", tcp->u_arg[argn++]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[argn++]);
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
return RVAL_DECODED;

View File

@ -19,10 +19,10 @@ SYS_FUNC(fallocate)
tprints(", ");
/* offset */
argn = printllval(tcp, "%llu, ", 2);
argn = printllval(tcp, "%lld, ", 2);
/* len */
printllval(tcp, "%llu", argn);
printllval(tcp, "%lld", argn);
return RVAL_DECODED;
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

29
fcntl.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -46,15 +47,15 @@ print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
printxval(lockfcmds, (unsigned short) fl->l_type, "F_???");
tprints(", l_whence=");
printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???");
tprintf(", l_start=%lld, l_len=%lld",
(long long) fl->l_start, (long long) fl->l_len);
tprintf(", l_start=%" PRId64 ", l_len=%" PRId64,
(int64_t) fl->l_start, (int64_t) fl->l_len);
if (getlk)
tprintf(", l_pid=%lu", (unsigned long) fl->l_pid);
tprints("}");
}
static void
printflock64(struct tcb *tcp, const long addr, const int getlk)
printflock64(struct tcb *const tcp, const kernel_ulong_t addr, const int getlk)
{
struct_kernel_flock64 fl;
@ -63,7 +64,7 @@ printflock64(struct tcb *tcp, const long addr, const int getlk)
}
static void
printflock(struct tcb *tcp, const long addr, const int getlk)
printflock(struct tcb *const tcp, const kernel_ulong_t addr, const int getlk)
{
struct_kernel_flock64 fl;
@ -72,7 +73,7 @@ printflock(struct tcb *tcp, const long addr, const int getlk)
}
static void
print_f_owner_ex(struct tcb *tcp, const long addr)
print_f_owner_ex(struct tcb *const tcp, const kernel_ulong_t addr)
{
struct { int type, pid; } owner;
@ -96,11 +97,11 @@ print_fcntl(struct tcb *tcp)
break;
case F_SETOWN:
case F_SETPIPE_SZ:
tprintf(", %ld", tcp->u_arg[2]);
tprintf(", %" PRI_kld, tcp->u_arg[2]);
break;
case F_DUPFD:
case F_DUPFD_CLOEXEC:
tprintf(", %ld", tcp->u_arg[2]);
tprintf(", %" PRI_kld, tcp->u_arg[2]);
return RVAL_DECODED | RVAL_FD;
case F_SETFL:
tprints(", ");
@ -122,15 +123,15 @@ print_fcntl(struct tcb *tcp)
break;
case F_NOTIFY:
tprints(", ");
printflags_long(notifyflags, tcp->u_arg[2], "DN_???");
printflags64(notifyflags, tcp->u_arg[2], "DN_???");
break;
case F_SETLEASE:
tprints(", ");
printxval_long(lockfcmds, tcp->u_arg[2], "F_???");
printxval64(lockfcmds, tcp->u_arg[2], "F_???");
break;
case F_ADD_SEALS:
tprints(", ");
printflags_long(f_seals, tcp->u_arg[2], "F_SEAL_???");
printflags64(f_seals, tcp->u_arg[2], "F_SEAL_???");
break;
case F_SETSIG:
tprints(", ");
@ -143,7 +144,7 @@ print_fcntl(struct tcb *tcp)
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = sprintflags("flags ", fdflags,
(unsigned long) tcp->u_rval);
(kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETFL:
if (entering(tcp) || syserror(tcp))
@ -171,13 +172,13 @@ print_fcntl(struct tcb *tcp)
case F_GETLEASE:
if (entering(tcp) || syserror(tcp))
return 0;
tcp->auxstr = xlookup(lockfcmds, (unsigned long) tcp->u_rval);
tcp->auxstr = xlookup(lockfcmds, (kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GET_SEALS:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr = sprintflags("seals ", f_seals,
(unsigned long) tcp->u_rval);
(kernel_ulong_t) tcp->u_rval);
return RVAL_HEX | RVAL_STR;
case F_GETSIG:
if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
@ -185,7 +186,7 @@ print_fcntl(struct tcb *tcp)
tcp->auxstr = signame(tcp->u_rval);
return RVAL_STR;
default:
tprintf(", %#lx", tcp->u_arg[2]);
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
break;
}
return RVAL_DECODED;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -34,8 +35,8 @@ typedef struct seccomp_fprog seccomp_fprog_t;
#include MPERS_DEFS
MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog,
struct tcb *tcp, const long addr, void *p)
MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct seccomp_fprog *pfp = p;
seccomp_fprog_t mfp;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,8 +52,8 @@ typedef struct_kernel_flock64 struct_flock64;
&& FLOCK_MEMBERS_EQ(type, l_len) \
&& FLOCK_MEMBERS_EQ(type, l_pid))
MPERS_PRINTER_DECL(bool, fetch_struct_flock,
struct tcb *tcp, const long addr, void *p)
MPERS_PRINTER_DECL(bool, fetch_struct_flock, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct_kernel_flock64 *pfl = p;
struct_flock mfl;
@ -71,8 +72,8 @@ MPERS_PRINTER_DECL(bool, fetch_struct_flock,
return true;
}
MPERS_PRINTER_DECL(bool, fetch_struct_flock64,
struct tcb *tcp, const long addr, void *p)
MPERS_PRINTER_DECL(bool, fetch_struct_flock64, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct_kernel_flock64 *pfl = p;
struct_flock64 mfl;

View File

@ -43,7 +43,8 @@ typedef struct mmsghdr struct_mmsghdr;
*/
MPERS_PRINTER_DECL(int, fetch_struct_mmsghdr,
struct tcb *tcp, const unsigned long addr, void *p)
struct tcb *const tcp, const kernel_ulong_t addr,
void *const p)
{
struct mmsghdr *p_native = p;
struct_mmsghdr v_compat;

View File

@ -43,9 +43,10 @@ typedef struct msghdr struct_msghdr;
*/
MPERS_PRINTER_DECL(int, fetch_struct_msghdr,
struct tcb *tcp, const unsigned long addr, void *p)
struct tcb *const tcp, const kernel_ulong_t addr,
void *const p)
{
struct msghdr *p_native = p;
struct msghdr *const p_native = p;
struct_msghdr v_compat;
if (sizeof(*p_native) == sizeof(v_compat))

106
fetch_struct_stat.c Normal file
View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* 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.
*/
#include "defs.h"
#include DEF_MPERS_TYPE(struct_stat)
#include "asm_stat.h"
#if defined MPERS_IS_m32
# undef HAVE_STRUCT_STAT
# undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
# ifdef HAVE_M32_STRUCT_STAT
# define HAVE_STRUCT_STAT 1
# ifdef HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC
# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
# endif /* HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC */
# endif /* HAVE_M32_STRUCT_STAT */
#elif defined MPERS_IS_mx32
# undef HAVE_STRUCT_STAT
# undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
# ifdef HAVE_MX32_STRUCT_STAT
# define HAVE_STRUCT_STAT 1
# ifdef HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC
# define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
# endif /* HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC */
# endif /* HAVE_MX32_STRUCT_STAT */
#else /* !MPERS_IS_m32 && !MPERS_IS_mx32 */
# define HAVE_STRUCT_STAT 1
#endif
#ifndef HAVE_STRUCT_STAT
struct stat {};
#endif
typedef struct stat struct_stat;
#include MPERS_DEFS
#include "stat.h"
#ifdef HAVE_STRUCT_STAT_ST_MTIME_NSEC
# define TIME_NSEC(arg) zero_extend_signed_to_ull(arg)
# define HAVE_NSEC true
#else
# define TIME_NSEC(arg) 0
# define HAVE_NSEC false
#endif
MPERS_PRINTER_DECL(bool, fetch_struct_stat,
struct tcb *const tcp, const kernel_ulong_t addr,
struct strace_stat *const dst)
{
#ifdef HAVE_STRUCT_STAT
struct_stat buf;
if (umove_or_printaddr(tcp, addr, &buf))
return false;
dst->dev = zero_extend_signed_to_ull(buf.st_dev);
dst->ino = zero_extend_signed_to_ull(buf.st_ino);
dst->rdev = zero_extend_signed_to_ull(buf.st_rdev);
dst->size = zero_extend_signed_to_ull(buf.st_size);
dst->blocks = zero_extend_signed_to_ull(buf.st_blocks);
dst->blksize = zero_extend_signed_to_ull(buf.st_blksize);
dst->mode = zero_extend_signed_to_ull(buf.st_mode);
dst->nlink = zero_extend_signed_to_ull(buf.st_nlink);
dst->uid = zero_extend_signed_to_ull(buf.st_uid);
dst->gid = zero_extend_signed_to_ull(buf.st_gid);
dst->atime = sign_extend_unsigned_to_ll(buf.st_atime);
dst->ctime = sign_extend_unsigned_to_ll(buf.st_ctime);
dst->mtime = sign_extend_unsigned_to_ll(buf.st_mtime);
dst->atime_nsec = TIME_NSEC(buf.st_atime_nsec);
dst->ctime_nsec = TIME_NSEC(buf.st_ctime_nsec);
dst->mtime_nsec = TIME_NSEC(buf.st_mtime_nsec);
dst->has_nsec = HAVE_NSEC;
return true;
#else /* !HAVE_STRUCT_STAT */
printaddr(addr);
return false;
#endif
}

104
fetch_struct_stat64.c Normal file
View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* 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.
*/
#include "defs.h"
#include DEF_MPERS_TYPE(struct_stat64)
#include "asm_stat.h"
#if defined MPERS_IS_m32
# undef HAVE_STRUCT_STAT64
# undef HAVE_STRUCT_STAT64_ST_MTIME_NSEC
# ifdef HAVE_M32_STRUCT_STAT64
# define HAVE_STRUCT_STAT64 1
# ifdef HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC
# define HAVE_STRUCT_STAT64_ST_MTIME_NSEC 1
# endif /* HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC */
# endif /* HAVE_M32_STRUCT_STAT64 */
#elif defined MPERS_IS_mx32
# undef HAVE_STRUCT_STAT64
# undef HAVE_STRUCT_STAT64_ST_MTIME_NSEC
# ifdef HAVE_MX32_STRUCT_STAT64
# define HAVE_STRUCT_STAT64 1
# ifdef HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC
# define HAVE_STRUCT_STAT64_ST_MTIME_NSEC 1
# endif /* HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC */
# endif /* HAVE_MX32_STRUCT_STAT64 */
#endif /* MPERS_IS_m32 || MPERS_IS_mx32 */
#ifndef HAVE_STRUCT_STAT64
struct stat64 {};
#endif
typedef struct stat64 struct_stat64;
#include MPERS_DEFS
#include "stat.h"
#ifdef HAVE_STRUCT_STAT64_ST_MTIME_NSEC
# define TIME_NSEC(arg) zero_extend_signed_to_ull(arg)
# define HAVE_NSEC true
#else
# define TIME_NSEC(arg) 0
# define HAVE_NSEC false
#endif
MPERS_PRINTER_DECL(bool, fetch_struct_stat64,
struct tcb *const tcp, const kernel_ulong_t addr,
struct strace_stat *const dst)
{
#ifdef HAVE_STRUCT_STAT64
struct_stat64 buf;
if (umove_or_printaddr(tcp, addr, &buf))
return false;
dst->dev = zero_extend_signed_to_ull(buf.st_dev);
dst->ino = zero_extend_signed_to_ull(buf.st_ino);
dst->rdev = zero_extend_signed_to_ull(buf.st_rdev);
dst->size = zero_extend_signed_to_ull(buf.st_size);
dst->blocks = zero_extend_signed_to_ull(buf.st_blocks);
dst->blksize = zero_extend_signed_to_ull(buf.st_blksize);
dst->mode = zero_extend_signed_to_ull(buf.st_mode);
dst->nlink = zero_extend_signed_to_ull(buf.st_nlink);
dst->uid = zero_extend_signed_to_ull(buf.st_uid);
dst->gid = zero_extend_signed_to_ull(buf.st_gid);
dst->atime = sign_extend_unsigned_to_ll(buf.st_atime);
dst->ctime = sign_extend_unsigned_to_ll(buf.st_ctime);
dst->mtime = sign_extend_unsigned_to_ll(buf.st_mtime);
dst->atime_nsec = TIME_NSEC(buf.st_atime_nsec);
dst->ctime_nsec = TIME_NSEC(buf.st_ctime_nsec);
dst->mtime_nsec = TIME_NSEC(buf.st_mtime_nsec);
dst->has_nsec = HAVE_NSEC;
return true;
#else /* !HAVE_STRUCT_STAT64 */
printaddr(addr);
return false;
#endif
}

View File

@ -40,33 +40,34 @@ typedef struct statfs64 struct_statfs64;
#include "statfs.h"
MPERS_PRINTER_DECL(bool, fetch_struct_statfs,
struct tcb *tcp, const long addr, struct strace_statfs *p)
struct tcb *const tcp, const kernel_ulong_t addr,
struct strace_statfs *const p)
{
struct_statfs b;
if (umove_or_printaddr(tcp, addr, &b))
return false;
p->f_type = widen_to_ull(b.f_type);
p->f_bsize = widen_to_ull(b.f_bsize);
p->f_blocks = widen_to_ull(b.f_blocks);
p->f_bfree = widen_to_ull(b.f_bfree);
p->f_bavail = widen_to_ull(b.f_bavail);
p->f_files = widen_to_ull(b.f_files);
p->f_ffree = widen_to_ull(b.f_ffree);
p->f_type = zero_extend_signed_to_ull(b.f_type);
p->f_bsize = zero_extend_signed_to_ull(b.f_bsize);
p->f_blocks = zero_extend_signed_to_ull(b.f_blocks);
p->f_bfree = zero_extend_signed_to_ull(b.f_bfree);
p->f_bavail = zero_extend_signed_to_ull(b.f_bavail);
p->f_files = zero_extend_signed_to_ull(b.f_files);
p->f_ffree = zero_extend_signed_to_ull(b.f_ffree);
#if defined HAVE_STRUCT_STATFS_F_FSID_VAL
p->f_fsid[0] = widen_to_ull(b.f_fsid.val[0]);
p->f_fsid[1] = widen_to_ull(b.f_fsid.val[1]);
p->f_fsid[0] = zero_extend_signed_to_ull(b.f_fsid.val[0]);
p->f_fsid[1] = zero_extend_signed_to_ull(b.f_fsid.val[1]);
#elif defined HAVE_STRUCT_STATFS_F_FSID___VAL
p->f_fsid[0] = widen_to_ull(b.f_fsid.__val[0]);
p->f_fsid[1] = widen_to_ull(b.f_fsid.__val[1]);
p->f_fsid[0] = zero_extend_signed_to_ull(b.f_fsid.__val[0]);
p->f_fsid[1] = zero_extend_signed_to_ull(b.f_fsid.__val[1]);
#endif
p->f_namelen = widen_to_ull(b.f_namelen);
p->f_namelen = zero_extend_signed_to_ull(b.f_namelen);
#ifdef HAVE_STRUCT_STATFS_F_FRSIZE
p->f_frsize = widen_to_ull(b.f_frsize);
p->f_frsize = zero_extend_signed_to_ull(b.f_frsize);
#endif
#ifdef HAVE_STRUCT_STATFS_F_FLAGS
p->f_flags = widen_to_ull(b.f_flags);
p->f_flags = zero_extend_signed_to_ull(b.f_flags);
#endif
return true;
@ -78,12 +79,12 @@ MPERS_PRINTER_DECL(bool, fetch_struct_statfs,
#endif
MPERS_PRINTER_DECL(bool, fetch_struct_statfs64,
struct tcb *tcp, const long addr, const unsigned long size,
struct strace_statfs *p)
struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t size, struct strace_statfs *const p)
{
struct_statfs64 b;
if (sizeof(b) != size
if (sizeof(b) != size
#ifdef COMPAT_STATFS64_PADDED_SIZE
&& sizeof(b) != COMPAT_STATFS64_PADDED_SIZE
#endif
@ -95,26 +96,26 @@ MPERS_PRINTER_DECL(bool, fetch_struct_statfs64,
if (umove_or_printaddr(tcp, addr, &b))
return false;
p->f_type = widen_to_ull(b.f_type);
p->f_bsize = widen_to_ull(b.f_bsize);
p->f_blocks = widen_to_ull(b.f_blocks);
p->f_bfree = widen_to_ull(b.f_bfree);
p->f_bavail = widen_to_ull(b.f_bavail);
p->f_files = widen_to_ull(b.f_files);
p->f_ffree = widen_to_ull(b.f_ffree);
p->f_type = zero_extend_signed_to_ull(b.f_type);
p->f_bsize = zero_extend_signed_to_ull(b.f_bsize);
p->f_blocks = zero_extend_signed_to_ull(b.f_blocks);
p->f_bfree = zero_extend_signed_to_ull(b.f_bfree);
p->f_bavail = zero_extend_signed_to_ull(b.f_bavail);
p->f_files = zero_extend_signed_to_ull(b.f_files);
p->f_ffree = zero_extend_signed_to_ull(b.f_ffree);
#if defined HAVE_STRUCT_STATFS64_F_FSID_VAL
p->f_fsid[0] = widen_to_ull(b.f_fsid.val[0]);
p->f_fsid[1] = widen_to_ull(b.f_fsid.val[1]);
p->f_fsid[0] = zero_extend_signed_to_ull(b.f_fsid.val[0]);
p->f_fsid[1] = zero_extend_signed_to_ull(b.f_fsid.val[1]);
#elif defined HAVE_STRUCT_STATFS64_F_FSID___VAL
p->f_fsid[0] = widen_to_ull(b.f_fsid.__val[0]);
p->f_fsid[1] = widen_to_ull(b.f_fsid.__val[1]);
p->f_fsid[0] = zero_extend_signed_to_ull(b.f_fsid.__val[0]);
p->f_fsid[1] = zero_extend_signed_to_ull(b.f_fsid.__val[1]);
#endif
p->f_namelen = widen_to_ull(b.f_namelen);
p->f_namelen = zero_extend_signed_to_ull(b.f_namelen);
#ifdef HAVE_STRUCT_STATFS64_F_FRSIZE
p->f_frsize = widen_to_ull(b.f_frsize);
p->f_frsize = zero_extend_signed_to_ull(b.f_frsize);
#endif
#ifdef HAVE_STRUCT_STATFS64_F_FLAGS
p->f_flags = widen_to_ull(b.f_flags);
p->f_flags = zero_extend_signed_to_ull(b.f_flags);
#endif
return true;

493
file.c
View File

@ -1,493 +0,0 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* 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.
*/
#include "defs.h"
#undef dev_t
#undef ino_t
#undef mode_t
#undef nlink_t
#undef uid_t
#undef gid_t
#undef off_t
#undef loff_t
#define dev_t __kernel_dev_t
#define ino_t __kernel_ino_t
#define mode_t __kernel_mode_t
#define nlink_t __kernel_nlink_t
#define uid_t __kernel_uid_t
#define gid_t __kernel_gid_t
#define off_t __kernel_off_t
#define loff_t __kernel_loff_t
#include "asm_stat.h"
#undef dev_t
#undef ino_t
#undef mode_t
#undef nlink_t
#undef uid_t
#undef gid_t
#undef off_t
#undef loff_t
#define dev_t dev_t
#define ino_t ino_t
#define mode_t mode_t
#define nlink_t nlink_t
#define uid_t uid_t
#define gid_t gid_t
#define off_t off_t
#define loff_t loff_t
/* for S_IFMT */
#define stat libc_stat
#define stat64 libc_stat64
#include <sys/stat.h>
#undef stat
#undef stat64
/* These might be macros. */
#undef st_atime
#undef st_mtime
#undef st_ctime
#if defined MAJOR_IN_SYSMACROS
# include <sys/sysmacros.h>
#elif defined MAJOR_IN_MKDEV
# include <sys/mkdev.h>
#endif
/* several stats */
#include "printstat.h"
/* all locally defined structures provide these fields */
#undef HAVE_STRUCT_STAT_ST_ATIME_NSEC
#define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1
#undef HAVE_STRUCT_STAT_ST_CTIME_NSEC
#define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1
#undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
#define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
#undef STAT32_PERSONALITY
#if SUPPORTED_PERSONALITIES > 1
# if defined AARCH64 || defined X86_64 || defined X32
struct stat32 {
unsigned int st_dev;
unsigned int st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned int st_rdev;
unsigned int st_size;
unsigned int st_blksize;
unsigned int st_blocks;
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int __unused4;
unsigned int __unused5;
};
# define STAT32_PERSONALITY 1
# elif defined POWERPC64
struct stat32 {
unsigned int st_dev;
unsigned int st_ino;
unsigned int st_mode;
unsigned short st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned int st_rdev;
unsigned int st_size;
unsigned int st_blksize;
unsigned int st_blocks;
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int __unused4;
unsigned int __unused5;
};
# define STAT32_PERSONALITY 1
# elif defined SPARC64
struct stat32 {
unsigned short st_dev;
unsigned int st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned short st_rdev;
unsigned int st_size;
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int st_blksize;
unsigned int st_blocks;
unsigned int __unused4[2];
};
# define STAT32_PERSONALITY 0
# elif defined SPARC
# /* no 64-bit personalities */
# elif defined TILE
# /* no 32-bit stat */
# else
# warning FIXME: check whether struct stat32 definition is needed for this architecture!
# endif /* X86_64 || X32 || POWERPC64 */
#endif /* SUPPORTED_PERSONALITIES > 1 */
#ifdef STAT32_PERSONALITY
# define DO_PRINTSTAT do_printstat32
# define STRUCT_STAT struct stat32
# undef HAVE_STRUCT_STAT_ST_FLAGS
# undef HAVE_STRUCT_STAT_ST_FSTYPE
# undef HAVE_STRUCT_STAT_ST_GEN
# include "printstat.h"
#endif /* STAT32_PERSONALITY */
#if defined(SPARC) || defined(SPARC64)
struct solstat {
unsigned st_dev;
unsigned int st_pad1[3]; /* network id */
unsigned st_ino;
unsigned st_mode;
unsigned st_nlink;
unsigned st_uid;
unsigned st_gid;
unsigned st_rdev;
unsigned int st_pad2[2];
unsigned int st_size;
unsigned int st_pad3; /* st_size, off_t expansion */
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned int st_blksize;
unsigned int st_blocks;
char st_fstype[16];
unsigned int st_pad4[8]; /* expansion area */
};
# define DO_PRINTSTAT do_printstat_sol
# define STRUCT_STAT struct solstat
# define STAT_MAJOR(x) (((x) >> 18) & 0x3fff)
# define STAT_MINOR(x) ((x) & 0x3ffff)
# undef HAVE_STRUCT_STAT_ST_FLAGS
# undef HAVE_STRUCT_STAT_ST_FSTYPE
# undef HAVE_STRUCT_STAT_ST_GEN
# include "printstat.h"
#endif /* SPARC || SPARC64 */
static void
printstat(struct tcb *tcp, long addr)
{
struct stat statbuf;
#ifdef STAT32_PERSONALITY
if (current_personality == STAT32_PERSONALITY) {
struct stat32 statbuf;
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat32(tcp, &statbuf);
return;
}
#endif
#if defined(SPARC) || defined(SPARC64)
if (current_personality == 1) {
struct solstat statbuf;
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat_sol(tcp, &statbuf);
return;
}
#endif /* SPARC || SPARC64 */
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat(tcp, &statbuf);
}
SYS_FUNC(stat)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
printstat(tcp, tcp->u_arg[1]);
}
return 0;
}
SYS_FUNC(fstat)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
printstat(tcp, tcp->u_arg[1]);
}
return 0;
}
#if defined STAT32_PERSONALITY && !defined HAVE_STRUCT_STAT64
# if defined AARCH64 || defined X86_64 || defined X32
/*
* Linux x86_64 and x32 have unified `struct stat' but their i386 personality
* needs `struct stat64'.
* linux/arch/x86/include/uapi/asm/stat.h defines `struct stat64' only for i386.
*
* Similarly, aarch64 has a unified `struct stat' but its arm personality
* needs `struct stat64' (unlike x86, it shouldn't be packed).
*/
struct stat64 {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned int __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned int st_blksize;
unsigned long long st_blocks;
unsigned int st_atime;
unsigned int st_atime_nsec;
unsigned int st_mtime;
unsigned int st_mtime_nsec;
unsigned int st_ctime;
unsigned int st_ctime_nsec;
unsigned long long st_ino;
}
# if defined X86_64 || defined X32
ATTRIBUTE_PACKED
# define STAT64_SIZE 96
# else
# define STAT64_SIZE 104
# endif
;
# define HAVE_STRUCT_STAT64 1
# else /* !(AARCH64 || X86_64 || X32) */
# warning FIXME: check whether struct stat64 definition is needed for this architecture!
# endif
#endif /* STAT32_PERSONALITY && !HAVE_STRUCT_STAT64 */
#ifdef HAVE_STRUCT_STAT64
# define DO_PRINTSTAT do_printstat64
# define STRUCT_STAT struct stat64
# undef HAVE_STRUCT_STAT_ST_FLAGS
# undef HAVE_STRUCT_STAT_ST_FSTYPE
# undef HAVE_STRUCT_STAT_ST_GEN
# include "printstat.h"
static void
printstat64(struct tcb *tcp, long addr)
{
struct stat64 statbuf;
# ifdef STAT64_SIZE
(void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
# endif
# ifdef STAT32_PERSONALITY
if (current_personality != STAT32_PERSONALITY) {
printstat(tcp, addr);
return;
}
# endif /* STAT32_PERSONALITY */
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat64(tcp, &statbuf);
}
SYS_FUNC(stat64)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
printstat64(tcp, tcp->u_arg[1]);
}
return 0;
}
SYS_FUNC(fstat64)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
printstat64(tcp, tcp->u_arg[1]);
}
return 0;
}
#else
SYS_FUNC(stat64)
{
return sys_stat(tcp);
}
SYS_FUNC(fstat64)
{
return sys_fstat(tcp);
}
#endif /* HAVE_STRUCT_STAT64 */
SYS_FUNC(newfstatat)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
} else {
#if defined STAT32_PERSONALITY
if (current_personality == STAT32_PERSONALITY)
printstat64(tcp, tcp->u_arg[2]);
else
printstat(tcp, tcp->u_arg[2]);
#elif defined HAVE_STRUCT_STAT64
printstat64(tcp, tcp->u_arg[2]);
#else
printstat(tcp, tcp->u_arg[2]);
#endif /* STAT32_PERSONALITY || HAVE_STRUCT_STAT64 */
tprints(", ");
printflags(at_flags, tcp->u_arg[3], "AT_???");
}
return 0;
}
#if defined(HAVE_STRUCT___OLD_KERNEL_STAT)
static void
convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
{
memset(newbuf, 0, sizeof(*newbuf));
newbuf->st_dev = oldbuf->st_dev;
newbuf->st_ino = oldbuf->st_ino;
newbuf->st_mode = oldbuf->st_mode;
newbuf->st_nlink = oldbuf->st_nlink;
newbuf->st_uid = oldbuf->st_uid;
newbuf->st_gid = oldbuf->st_gid;
newbuf->st_rdev = oldbuf->st_rdev;
newbuf->st_size = oldbuf->st_size;
newbuf->st_atime = oldbuf->st_atime;
newbuf->st_mtime = oldbuf->st_mtime;
newbuf->st_ctime = oldbuf->st_ctime;
}
static void
printoldstat(struct tcb *tcp, long addr)
{
struct __old_kernel_stat statbuf;
struct stat newstatbuf;
# if defined(SPARC) || defined(SPARC64)
if (current_personality == 1) {
struct solstat statbuf;
if (!umove_or_printaddr(tcp, addr, &statbuf))
do_printstat_sol(tcp, &statbuf);
return;
}
# endif
if (!umove_or_printaddr(tcp, addr, &statbuf)) {
convertoldstat(&statbuf, &newstatbuf);
do_printstat(tcp, &newstatbuf);
}
}
SYS_FUNC(oldstat)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
printoldstat(tcp, tcp->u_arg[1]);
}
return 0;
}
SYS_FUNC(oldfstat)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
printoldstat(tcp, tcp->u_arg[1]);
}
return 0;
}
#endif /* HAVE_STRUCT___OLD_KERNEL_STAT */
#if defined(SPARC) || defined(SPARC64)
SYS_FUNC(xstat)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
} else {
printstat(tcp, tcp->u_arg[2]);
}
return 0;
}
SYS_FUNC(fxstat)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
} else {
printstat(tcp, tcp->u_arg[2]);
}
return 0;
}
#endif /* SPARC || SPARC64 */

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,6 +28,8 @@
#include "defs.h"
#include "xlat/name_to_handle_at_flags.h"
#ifndef MAX_HANDLE_SZ
# define MAX_HANDLE_SZ 128
#endif
@ -39,7 +42,7 @@ typedef struct {
SYS_FUNC(name_to_handle_at)
{
file_handle_header h;
const long addr = tcp->u_arg[2];
const kernel_ulong_t addr = tcp->u_arg[2];
if (entering(tcp)) {
/* dirfd */
@ -58,7 +61,8 @@ SYS_FUNC(name_to_handle_at)
tprints(", ");
/* flags */
printflags(at_flags, tcp->u_arg[4], "AT_???");
printflags(name_to_handle_at_flags, tcp->u_arg[4],
"AT_???");
return RVAL_DECODED;
}
@ -95,7 +99,7 @@ SYS_FUNC(name_to_handle_at)
tprints(", ");
/* flags */
printflags(at_flags, tcp->u_arg[4], "AT_???");
printflags(name_to_handle_at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
}
@ -103,7 +107,7 @@ SYS_FUNC(name_to_handle_at)
SYS_FUNC(open_by_handle_at)
{
file_handle_header h;
const long addr = tcp->u_arg[1];
const kernel_ulong_t addr = tcp->u_arg[1];
/* mount_fd */
printfd(tcp, tcp->u_arg[0]);

View File

@ -36,11 +36,11 @@
#endif
#ifndef FICLONE
# define FICLONE _IOW(0x94, 9, int)
# define FICLONE _IOW(0x94, 9, int)
#endif
#ifndef FICLONERANGE
# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
struct file_clone_range {
int64_t src_fd;
uint64_t src_offset;
@ -50,7 +50,7 @@ struct file_clone_range {
#endif
#ifndef FIDEDUPERANGE
# define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
# define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range)
struct file_dedupe_range_info {
int64_t dest_fd; /* in - destination file */
uint64_t dest_offset; /* in - start of extent in destination */
@ -123,7 +123,8 @@ print_fiemap_extent(struct tcb *tcp, void *elem_buf, size_t elem_size, void *dat
#endif /* HAVE_LINUX_FIEMAP_H */
int
file_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
file_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
case FICLONE: /* W */

View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,6 +26,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRACE_FLOCK_H
#define STRACE_FLOCK_H
#include <linux/fcntl.h>
#if defined HAVE_STRUCT_FLOCK
@ -42,3 +46,5 @@ typedef struct __kernel_flock64 struct_kernel_flock64;
#else
# error struct flock64 definition not found in <linux/fcntl.h>
#endif
#endif /* !STRACE_FLOCK_H */

View File

@ -30,7 +30,8 @@
#include <linux/fs.h>
int
fs_x_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
fs_x_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
#ifdef FITRIM

View File

@ -2,13 +2,11 @@
SYS_FUNC(fstatfs64)
{
const unsigned long size = tcp->u_arg[1];
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprintf(", %lu, ", size);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
} else {
print_struct_statfs64(tcp, tcp->u_arg[2], size);
print_struct_statfs64(tcp, tcp->u_arg[2], tcp->u_arg[1]);
}
return 0;
}

57
futex.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 2007-2008 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,10 +31,6 @@
#include "defs.h"
#ifdef HAVE_LINUX_FUTEX_H
# include <linux/futex.h>
#endif
#ifndef FUTEX_PRIVATE_FLAG
# define FUTEX_PRIVATE_FLAG 128
#endif
@ -47,68 +44,90 @@
SYS_FUNC(futex)
{
const long uaddr = tcp->u_arg[0];
const kernel_ulong_t uaddr = tcp->u_arg[0];
const int op = tcp->u_arg[1];
const int cmd = op & 127;
const long timeout = tcp->u_arg[3];
const long uaddr2 = tcp->u_arg[4];
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];
const unsigned int val2 = tcp->u_arg[3];
const unsigned int val3 = tcp->u_arg[5];
const char *comment;
printaddr(uaddr);
tprints(", ");
printxval(futexops, op, "FUTEX_???");
tprintf(", %u", val);
switch (cmd) {
case FUTEX_WAIT:
tprintf(", %u", val);
tprints(", ");
print_timespec(tcp, timeout);
break;
case FUTEX_LOCK_PI:
tprints(", ");
print_timespec(tcp, timeout);
break;
case FUTEX_WAIT_BITSET:
tprintf(", %u", val);
tprints(", ");
print_timespec(tcp, timeout);
tprintf(", %x", val3);
tprintf(", %#x", val3);
break;
case FUTEX_WAKE_BITSET:
tprintf(", %x", val3);
tprintf(", %u", val);
tprintf(", %#x", val3);
break;
case FUTEX_REQUEUE:
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
break;
case FUTEX_CMP_REQUEUE:
case FUTEX_CMP_REQUEUE_PI:
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
tprintf(", %u", val3);
break;
case FUTEX_WAKE_OP:
tprintf(", %u", val);
tprintf(", %u, ", val2);
printaddr(uaddr2);
tprints(", {");
tprints(", ");
if ((val3 >> 28) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakeops, (val3 >> 28) & 0x7, "FUTEX_OP_???");
tprintf(", %u, ", (val3 >> 12) & 0xfff);
if ((val3 >> 24) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakecmps, (val3 >> 24) & 0x7, "FUTEX_OP_CMP_???");
tprintf(", %u}", val3 & 0xfff);
tprints("FUTEX_OP_OPARG_SHIFT<<28|");
comment = printxval(futexwakeops, (val3 >> 28) & 0x7, NULL)
? NULL : "FUTEX_OP_???";
tprints("<<28");
tprints_comment(comment);
tprintf("|%#x<<12|", (val3 >> 12) & 0xfff);
comment = printxval(futexwakecmps, (val3 >> 24) & 0xf, NULL)
? NULL : "FUTEX_OP_CMP_???";
tprints("<<24");
tprints_comment(comment);
tprintf("|%#x", val3 & 0xfff);
break;
case FUTEX_WAIT_REQUEUE_PI:
tprintf(", %u", val);
tprints(", ");
print_timespec(tcp, timeout);
tprints(", ");
printaddr(uaddr2);
break;
case FUTEX_FD:
case FUTEX_WAKE:
tprintf(", %u", val);
break;
case FUTEX_UNLOCK_PI:
case FUTEX_TRYLOCK_PI:
break;
default:
tprintf(", %lx, %lx, %x", timeout, uaddr2, val3);
tprintf(", %u", val);
tprints(", ");
printaddr(timeout);
tprints(", ");
printaddr(uaddr2);
tprintf(", %#x", val3);
break;
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,8 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GCC_COMPAT_H_
#define GCC_COMPAT_H_
#ifndef STRACE_GCC_COMPAT_H
#define STRACE_GCC_COMPAT_H
#if defined __GNUC__ && defined __GNUC_MINOR__
# define GNUC_PREREQ(maj, min) \
@ -52,6 +53,16 @@
# define ATTRIBUTE_PACKED /* empty */
#endif
#if GNUC_PREREQ(3, 0)
# define SAME_TYPE(x, y) __builtin_types_compatible_p(typeof(x), typeof(y))
# define FAIL_BUILD_ON_ZERO(expr) (sizeof(int[-1 + 2 * !!(expr)]) * 0)
/* &(a)[0] is a pointer and not an array, shouldn't be treated as the same */
# define MUST_BE_ARRAY(a) FAIL_BUILD_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
#else
# define SAME_TYPE(x, y) 0
# define MUST_BE_ARRAY(a) 0
#endif
#if GNUC_PREREQ(3, 0)
# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
#else
@ -70,10 +81,16 @@
# define ATTRIBUTE_SENTINEL /* empty */
#endif
#if GNUC_PREREQ(4, 1)
# define ALIGNOF(t_) __alignof__(t_)
#else
# define ALIGNOF(t_) (sizeof(struct { char x_; t_ y_; }) - sizeof(t_))
#endif
#if GNUC_PREREQ(4, 3)
# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
#else
# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
#endif
#endif
#endif /* !STRACE_GCC_COMPAT_H */

View File

@ -1,7 +1,7 @@
#!/bin/sh -e
list="$(sed -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*\([[:alnum:]][^.]*\.c\)[[:space:]]*\\$/\1/p' Makefile.am |
xargs -r grep -lx '#[[:space:]]*include[[:space:]]\+MPERS_DEFS' |
list="$(sed -r -n '/^strace_SOURCES[[:space:]]*=/,/^[[:space:]]*# end of strace_SOURCES/ s/^[[:space:]]*([[:alnum:]][^.]*\.c)[[:space:]]*\\$/\1/p' Makefile.am |
xargs -r grep -Elx '#[[:space:]]*include[[:space:]]+MPERS_DEFS' |
tr '\n' ' ')"
cat > mpers.am <<EOF
@ -9,5 +9,5 @@ cat > mpers.am <<EOF
mpers_source_files = $list
EOF
sed -n 's/^#[[:space:]]*include[[:space:]]*"xlat\/\([^."]\+\)\.h".*/extern const struct xlat \1[];/p' \
sed -r -n 's/^#[[:space:]]*include[[:space:]]*"xlat\/([a-z][a-z_0-9]*)\.h".*/extern const struct xlat \1[];/p' \
$list > mpers_xlat.h

View File

@ -2,7 +2,7 @@
echo 'enum {'
echo 'SEN_printargs = 0,'
sed -n '/printargs/! s/.*SEN(\([^)]*\)).*/\1/p' |
sort -u |
sed -r -n '/printargs/! s/.*SEN\(([^)]+)\).*/\1/p' |
LC_COLLATE=C sort -u |
sed 's/.*/SEN_&,/'
echo '};'

View File

@ -1,28 +0,0 @@
#!/bin/sh
convert() {
sed -n '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/{
s/^[[:space:]]*XLAT(\([^)]\+\)).*/\1/p
s/^[[:space:]]*{[[:space:]]*(\?\(1<<[^),[:space:]]\+\).*/\1/p
s/.*not NULL-terminated.*/#unterminated/p
s/^\([[:space:]]*{.*\)/\1/p
s/^\t*\( *[/*].*\)/\1/p}' "$f" >> xlat/"$n".in
sed -i '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/c #include "xlat/'"$n"'.h"' "$f"
}
for f; do
for n in $(sed -n 's/^\(static \)\?const struct xlat \([a-z0-9_]\+\)\[\] = {$/\2/p' "$f"); do
case "$n" in
cacheflush_flags|struct_user_offsets) # skip
;;
ioprio_class|ioprio_who|mtd_mode_options|personality_options|syslog_action_type|ubi_volume_props|ubi_volume_types)
echo '#unconditional' > xlat/"$n".in
convert
;;
*)
> xlat/"$n".in
convert
;;
esac
done
done

View File

@ -7,7 +7,7 @@ SYS_FUNC(getcwd)
printaddr(tcp->u_arg[0]);
else
printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
tprintf(", %lu", tcp->u_arg[1]);
tprintf(", %" PRI_klu, tcp->u_arg[1]);
}
return 0;
}

View File

@ -7,8 +7,9 @@ SYS_FUNC(getrandom)
if (syserror(tcp))
printaddr(tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[1]);
printstr_ex(tcp, tcp->u_arg[0], tcp->u_rval,
QUOTE_FORCE_HEX);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
printflags(getrandom_flags, tcp->u_arg[2], "GRND_???");
}
return 0;

View File

@ -3,6 +3,7 @@
scriptversion=2014-12-02.19; # UTC
# Copyright (C) 2007-2014 Free Software Foundation, Inc.
# Copyright (c) 2013-2017 The strace developers.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

4
hdio.c
View File

@ -36,8 +36,8 @@ typedef struct hd_geometry struct_hd_geometry;
#include MPERS_DEFS
MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *tcp,
const unsigned int code, const long arg)
MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *const tcp,
const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
case HDIO_GETGEO:

View File

@ -1,9 +1,24 @@
#include "defs.h"
#ifdef HAVE_LINUX_UTSNAME_H
# include <linux/utsname.h>
#endif
#ifndef __NEW_UTS_LEN
# define __NEW_UTS_LEN 64
#endif
SYS_FUNC(sethostname)
{
printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[1]);
unsigned int len = tcp->u_arg[1];
if (len > __NEW_UTS_LEN) {
printaddr(tcp->u_arg[0]);
} else {
printstrn(tcp, tcp->u_arg[0], len);
}
tprintf(", %u", len);
return RVAL_DECODED;
}
@ -15,8 +30,8 @@ SYS_FUNC(gethostname)
if (syserror(tcp))
printaddr(tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], -1);
tprintf(", %lu", tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[0]);
tprintf(", %" PRI_klu, tcp->u_arg[1]);
}
return 0;
}

357
install.texi Normal file
View File

@ -0,0 +1,357 @@
@c This file is imported from GNU Autoconf and edited to produce
@c the INSTALL file.
@ifclear autoconf
@unnumbered Installation Instructions
Copyright @copyright{} 1994-1996, 1999-2002, 2004-2013 Free Software
Foundation, Inc.
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice
and this notice are preserved. This file is offered as-is, without
warranty of any kind.
@end ifclear
@node Basic Installation
@section Basic Installation
Briefly, the shell command
@samp{./configure@tie{}&& make@tie{}&& make@tie{}install}
should configure, build, and install this package. The following
more-detailed instructions are generic; see the @file{README} file for
instructions specific to this package.
@ifclear autoconf
Some packages provide this @file{INSTALL} file but do not implement all
of the features documented below. The lack of an optional feature in a
given package is not necessarily a bug.
@end ifclear
More recommendations for GNU packages can be found in
@ref{Makefile Conventions, , Makefile Conventions, standards,
GNU Coding Standards}.
The @command{configure} shell script attempts to guess correct values
for various system-dependent variables used during compilation. It uses
those values to create a @file{Makefile} in each directory of the
package. It may also create one or more @file{.h} files containing
system-dependent definitions. Finally, it creates a shell script
@file{config.status} that you can run in the future to recreate the
current configuration, and a file @file{config.log} containing compiler
output (useful mainly for debugging @command{configure}).
It can also use an optional file (typically called @file{config.cache}
and enabled with @option{--cache-file=config.cache} or simply
@option{-C}) that saves the results of its tests to speed up
reconfiguring. Caching is disabled by default to prevent problems with
accidental use of stale cache files.
If you need to do unusual things to compile the package, please try to
figure out how @command{configure} could check whether to do them, and
mail diffs or instructions to the address given in the @file{README} so
they can be considered for the next release. If you are using the
cache, and at some point @file{config.cache} contains results you don't
want to keep, you may remove or edit it.
The file @file{configure.ac} (or @file{configure.in}) is used to create
@file{configure} by a program called @command{autoconf}. You need
@file{configure.ac} if you want to change it or regenerate
@file{configure} using a newer version of @command{autoconf}.
The simplest way to compile this package is:
@enumerate
@item
@command{cd} to the directory containing the package's source code and type
@samp{./configure} to configure the package for your system.
Running @command{configure} might take a while. While running, it prints some
messages telling which features it is checking for.
@item
Type @samp{make} to compile the package.
@item
Optionally, type @samp{make check} to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
@item
Type @samp{make install} to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular user,
and only the @samp{make install} phase executed with root privileges.
@item
Optionally, type @samp{make installcheck} to repeat any self-tests, but
this time using the binaries in their final installed location. This
target does not install anything. Running this target as a regular
user, particularly if the prior @samp{make install} required root
privileges, verifies that the installation completed correctly.
@item
You can remove the program binaries and object files from the source
code directory by typing @samp{make clean}. To also remove the files
that @command{configure} created (so you can compile the package for a
different kind of computer), type @samp{make distclean}. There is also
a @samp{make maintainer-clean} target, but that is intended mainly for
the package's developers. If you use it, you may have to get all sorts
of other programs in order to regenerate files that came with the
distribution.
@item
Often, you can also type @samp{make uninstall} to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
@item
Some packages, particularly those that use Automake, provide @samp{make
distcheck}, which can by used by developers to test that all other
targets like @samp{make install} and @samp{make uninstall} work
correctly. This target is generally not run by end users.
@end enumerate
@node Compilers and Options
@section Compilers and Options
Some systems require unusual options for compilation or linking that the
@command{configure} script does not know about. Run @samp{./configure
--help} for details on some of the pertinent environment variables.
You can give @command{configure} initial values for configuration
parameters by setting variables in the command line or in the environment.
Here is an example:
@example
./configure CC=c99 CFLAGS=-g LIBS=-lposix
@end example
@xref{Defining Variables}, for more details.
@node Installation Names
@section Installation Names
By default, @samp{make install} installs the package's commands under
@file{/usr/local/bin}, include files under @file{/usr/local/include}, etc.
You can specify an
installation prefix other than @file{/usr/local} by giving
@command{configure} the option @option{--prefix=@var{prefix}}, where
@var{prefix} must be an absolute file name.
You can specify separate installation prefixes for architecture-specific
files and architecture-independent files. If you pass the option
@option{--exec-prefix=@var{prefix}} to @command{configure}, the
package uses @var{prefix} as the prefix for installing programs and
libraries. Documentation and other data files still use the
regular prefix.
In addition, if you use an unusual directory layout you can give options
like @option{--bindir=@var{dir}} to specify different values for
particular kinds of files. Run @samp{configure --help} for a list of
the directories you can set and what kinds of files go in them. In
general, the default for these options is expressed in terms of
@samp{$@{prefix@}}, so that specifying just @option{--prefix} will
affect all of the other directory specifications that were not
explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to @command{configure}; however, many packages provide
one or both of the following shortcuts of passing variable assignments
to the @samp{make install} command line to change installation locations
without having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, @samp{make install
prefix=/alternate/directory} will choose an alternate location for all
directory configuration variables that were expressed in terms of
@samp{$@{prefix@}}. Any directories that were specified during
@command{configure}, but not in terms of @samp{$@{prefix@}}, must each be
overridden at install time for the entire
installation to be relocated. The approach of makefile variable
overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation. However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.
The second method involves providing the @samp{DESTDIR} variable. For
example, @samp{make install DESTDIR=/alternate/directory} will prepend
@samp{/alternate/directory} before all installation names. The approach
of @samp{DESTDIR} overrides is not required by the GNU Coding
Standards, and does not work on platforms that have drive letters. On
the other hand, it does better at avoiding recompilation issues, and
works well even when some directory options were not specified in terms
of @samp{$@{prefix@}} at @command{configure} time.
@node Optional Features
@section Optional Features
If the package supports it, you can cause programs to be installed with
an extra prefix or suffix on their names by giving @command{configure}
the option @option{--program-prefix=@var{PREFIX}} or
@option{--program-suffix=@var{SUFFIX}}.
Some packages pay attention to @option{--enable-@var{feature}} options
to @command{configure}, where @var{feature} indicates an optional part
of the package. They may also pay attention to
@option{--with-@var{package}} options, where @var{package} is something
like @samp{gnu-as} or @samp{x} (for the X Window System). The
@file{README} should mention any @option{--enable-} and @option{--with-}
options that the package recognizes.
For packages that use the X Window System, @command{configure} can
usually find the X include and library files automatically, but if it
doesn't, you can use the @command{configure} options
@option{--x-includes=@var{dir}} and @option{--x-libraries=@var{dir}} to
specify their locations.
Some packages offer the ability to configure how verbose the execution
of @command{make} will be. For these packages, running
@samp{./configure --enable-silent-rules} sets the default to minimal
output, which can be overridden with @code{make V=1}; while running
@samp{./configure --disable-silent-rules} sets the default to verbose,
which can be overridden with @code{make V=0}.
@node System Type
@section Specifying the System Type
There may be some features @command{configure} cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
@emph{same} architectures, @command{configure} can figure that out, but
if it prints a message saying it cannot guess the machine type, give it
the @option{--build=@var{type}} option. @var{type} can either be a
short name for the system type, such as @samp{sun4}, or a canonical name
which has the form:
@example
@var{cpu}-@var{company}-@var{system}
@end example
@noindent
where @var{system} can have one of these forms:
@example
@var{os}
@var{kernel}-@var{os}
@end example
See the file @file{config.sub} for the possible values of each field.
If @file{config.sub} isn't included in this package, then this package
doesn't need to know the machine type.
If you are @emph{building} compiler tools for cross-compiling, you
should use the option @option{--target=@var{type}} to select the type of
system they will produce code for.
If you want to @emph{use} a cross compiler, that generates code for a
platform different from the build platform, you should specify the
@dfn{host} platform (i.e., that on which the generated programs will
eventually be run) with @option{--host=@var{type}}.
@node Sharing Defaults
@section Sharing Defaults
If you want to set default values for @command{configure} scripts to
share, you can create a site shell script called @file{config.site} that
gives default values for variables like @code{CC}, @code{cache_file},
and @code{prefix}. @command{configure} looks for
@file{@var{prefix}/share/config.site} if it exists, then
@file{@var{prefix}/etc/config.site} if it exists. Or, you can set the
@code{CONFIG_SITE} environment variable to the location of the site
script. A warning: not all @command{configure} scripts look for a site
script.
@node Defining Variables
@section Defining Variables
Variables not defined in a site shell script can be set in the
environment passed to @command{configure}. However, some packages may
run configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the @command{configure} command line, using @samp{VAR=value}.
For example:
@example
./configure CC=/usr/local2/bin/gcc
@end example
@noindent
causes the specified @command{gcc} to be used as the C compiler (unless it is
overridden in the site shell script).
@noindent
Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
to an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
@example
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
@end example
@node configure Invocation
@section @command{configure} Invocation
@command{configure} recognizes the following options to control how it
operates.
@table @option
@item --help
@itemx -h
Print a summary of all of the options to @command{configure}, and exit.
@item --help=short
@itemx --help=recursive
Print a summary of the options unique to this package's
@command{configure}, and exit. The @code{short} variant lists options
used only in the top level, while the @code{recursive} variant lists
options also present in any nested packages.
@item --version
@itemx -V
Print the version of Autoconf used to generate the @command{configure}
script, and exit.
@item --cache-file=@var{file}
@cindex Cache, enabling
Enable the cache: use and save the results of the tests in @var{file},
traditionally @file{config.cache}. @var{file} defaults to
@file{/dev/null} to disable caching.
@item --config-cache
@itemx -C
Alias for @option{--cache-file=config.cache}.
@item --quiet
@itemx --silent
@itemx -q
Do not print messages saying which checks are being made. To suppress
all normal output, redirect it to @file{/dev/null} (any error messages
will still be shown).
@item --srcdir=@var{dir}
Look for the package's source code in directory @var{dir}. Usually
@command{configure} can determine that directory automatically.
@item --prefix=@var{dir}
Use @var{dir} as the installation prefix. @ref{Installation Names}
for more details, including other options available for fine-tuning
the installation locations.
@item --no-create
@itemx -n
Run the configure checks, but stop before creating any output files.
@end table
@noindent
@command{configure} also accepts some other, not widely useful, options.
Run @samp{configure --help} for more details.
@c Local Variables:
@c fill-column: 72
@c ispell-local-dictionary: "american"
@c indent-tabs-mode: nil
@c whitespace-check-buffer-indent: nil
@c End:

167
io.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -41,8 +42,8 @@ SYS_FUNC(read)
if (syserror(tcp))
printaddr(tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu", tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
}
@ -51,25 +52,25 @@ SYS_FUNC(write)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
}
struct print_iovec_config {
enum iov_decode decode_iov;
unsigned long data_size;
kernel_ulong_t data_size;
};
static bool
print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
const unsigned long *iov;
unsigned long iov_buf[2], len;
const kernel_ulong_t *iov;
kernel_ulong_t iov_buf[2], len;
struct print_iovec_config *c = data;
if (elem_size < sizeof(iov_buf)) {
if (elem_size < sizeof(iov_buf)) {
iov_buf[0] = ((unsigned int *) elem_buf)[0];
iov_buf[1] = ((unsigned int *) elem_buf)[1];
iov = iov_buf;
@ -85,21 +86,24 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
case IOV_DECODE_STR:
if (len > c->data_size)
len = c->data_size;
c->data_size -= len;
printstr(tcp, iov[0], len);
if (c->data_size != (kernel_ulong_t) -1)
c->data_size -= len;
printstrn(tcp, iov[0], len);
break;
case IOV_DECODE_NETLINK:
if (len > c->data_size)
len = c->data_size;
c->data_size -= len;
decode_netlink(tcp, iov[0], iov[1]);
if (c->data_size != (kernel_ulong_t) -1)
c->data_size -= len;
/* assume that the descriptor is 1st syscall argument */
decode_netlink(tcp, tcp->u_arg[0], iov[0], len);
break;
default:
printaddr(iov[0]);
break;
}
tprintf(", iov_len=%lu}", iov[1]);
tprintf(", iov_len=%" PRI_klu "}", iov[1]);
return true;
}
@ -109,22 +113,17 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
* Example: recvmsg returing a short read.
*/
void
tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr,
enum iov_decode decode_iov, unsigned long data_size)
tprint_iov_upto(struct tcb *const tcp, const kernel_ulong_t len,
const kernel_ulong_t addr, const enum iov_decode decode_iov,
const kernel_ulong_t data_size)
{
unsigned long iov[2];
struct print_iovec_config config =
{ .decode_iov = decode_iov, .data_size = data_size };
kernel_ulong_t iov[2];
struct print_iovec_config config = {
.decode_iov = decode_iov, .data_size = data_size
};
print_array(tcp, addr, len, iov, current_wordsize * 2,
umoven_or_printaddr, print_iovec, &config);
}
void
tprint_iov(struct tcb *tcp, unsigned long len, unsigned long addr,
enum iov_decode decode_iov)
{
tprint_iov_upto(tcp, len, addr, decode_iov, (unsigned long) -1L);
umoven_or_printaddr_ignore_syserror, print_iovec, &config);
}
SYS_FUNC(readv)
@ -134,8 +133,9 @@ SYS_FUNC(readv)
tprints(", ");
} else {
tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
syserror(tcp) ? IOV_DECODE_ADDR :
IOV_DECODE_STR, tcp->u_rval);
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
}
return 0;
}
@ -145,22 +145,11 @@ SYS_FUNC(writev)
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
}
/* The SH4 ABI does allow long longs in odd-numbered registers, but
does not allow them to be split between registers and memory - and
there are only four argument registers for normal functions. As a
result pread takes an extra padding argument before the offset. This
was changed late in the 2.4 series (around 2.4.20). */
#if defined(SH)
#define PREAD_OFFSET_ARG 4
#else
#define PREAD_OFFSET_ARG 3
#endif
SYS_FUNC(pread)
{
if (entering(tcp)) {
@ -170,9 +159,9 @@ SYS_FUNC(pread)
if (syserror(tcp))
printaddr(tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[2]);
printllval(tcp, "%lld", PREAD_OFFSET_ARG);
printstrn(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
printllval(tcp, "%lld", 3);
}
return 0;
}
@ -181,9 +170,9 @@ SYS_FUNC(pwrite)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, ", tcp->u_arg[2]);
printllval(tcp, "%lld", PREAD_OFFSET_ARG);
printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
printllval(tcp, "%lld", 3);
return RVAL_DECODED;
}
@ -191,38 +180,20 @@ SYS_FUNC(pwrite)
static void
print_lld_from_low_high_val(struct tcb *tcp, int arg)
{
#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
# if SUPPORTED_PERSONALITIES > 1
# ifdef X86_64
if (current_personality != 1)
# else
if (current_wordsize == sizeof(long))
# endif
# endif
tprintf("%ld", tcp->u_arg[arg]);
# if SUPPORTED_PERSONALITIES > 1
else
tprintf("%ld",
((unsigned long) tcp->u_arg[arg + 1] << current_wordsize * 8)
| (unsigned long) tcp->u_arg[arg]);
# endif
#elif SIZEOF_LONG > 4
# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
#elif HAVE_STRUCT_TCB_EXT_ARG
# if SUPPORTED_PERSONALITIES > 1
if (current_personality == 1) {
tprintf("%lld",
(widen_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
| widen_to_ull(tcp->u_arg[arg]));
#if SIZEOF_KERNEL_LONG_T > 4
# ifndef current_klongsize
if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
tprintf("%" PRI_kld, (tcp->u_arg[arg + 1] << 32)
| tcp->u_arg[arg]);
} else
# endif
# endif /* !current_klongsize */
{
tprintf("%lld", tcp->ext_arg[arg]);
tprintf("%" PRI_kld, tcp->u_arg[arg]);
}
#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && !HAVE_STRUCT_TCB_EXT_ARG */
#else /* SIZEOF_KERNEL_LONG_T == 4 */
tprintf("%lld",
(widen_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
| widen_to_ull(tcp->u_arg[arg]));
((long long) tcp->u_arg[arg + 1] << 32)
| ((long long) tcp->u_arg[arg]));
#endif
}
@ -235,9 +206,13 @@ do_preadv(struct tcb *tcp, const int flags_arg)
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
tprint_iov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR,
tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[2]);
kernel_ulong_t len =
truncate_kulong_to_current_wordsize(tcp->u_arg[2]);
tprint_iov_upto(tcp, len, tcp->u_arg[1],
syserror(tcp) ? IOV_DECODE_ADDR :
IOV_DECODE_STR, tcp->u_rval);
tprintf(", %" PRI_klu ", ", len);
print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
@ -252,18 +227,16 @@ SYS_FUNC(preadv)
return do_preadv(tcp, -1);
}
SYS_FUNC(preadv2)
{
return do_preadv(tcp, 5);
}
static int
do_pwritev(struct tcb *tcp, const int flags_arg)
{
kernel_ulong_t len =
truncate_kulong_to_current_wordsize(tcp->u_arg[2]);
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %lu, ", tcp->u_arg[2]);
tprint_iov(tcp, len, tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %" PRI_klu ", ", len);
print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
@ -278,9 +251,29 @@ SYS_FUNC(pwritev)
return do_pwritev(tcp, -1);
}
/*
* x32 is the only architecture where preadv2 takes 5 arguments
* instead of 6, see preadv64v2 in kernel sources.
* Likewise, x32 is the only architecture where pwritev2 takes 5 arguments
* instead of 6, see pwritev64v2 in kernel sources.
*/
#if defined X86_64
# define PREADV2_PWRITEV2_FLAGS_ARG_NO (current_personality == 2 ? 4 : 5)
#elif defined X32
# define PREADV2_PWRITEV2_FLAGS_ARG_NO (current_personality == 0 ? 4 : 5)
#else
# define PREADV2_PWRITEV2_FLAGS_ARG_NO 5
#endif
SYS_FUNC(preadv2)
{
return do_preadv(tcp, PREADV2_PWRITEV2_FLAGS_ARG_NO);
}
SYS_FUNC(pwritev2)
{
return do_pwritev(tcp, 5);
return do_pwritev(tcp, PREADV2_PWRITEV2_FLAGS_ARG_NO);
}
#include "xlat/splice_flags.h"
@ -294,7 +287,7 @@ SYS_FUNC(tee)
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[2]);
tprintf("%" PRI_klu ", ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
@ -316,7 +309,7 @@ SYS_FUNC(splice)
printnum_int64(tcp, tcp->u_arg[3], "%" PRId64);
tprints(", ");
/* size_t len */
tprintf("%lu, ", tcp->u_arg[4]);
tprintf("%" PRI_klu ", ", tcp->u_arg[4]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[5], "SPLICE_F_???");
@ -330,7 +323,7 @@ SYS_FUNC(vmsplice)
tprints(", ");
/* const struct iovec *iov, unsigned long nr_segs */
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], IOV_DECODE_STR);
tprintf(", %lu, ", tcp->u_arg[2]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[2]);
/* unsigned int flags */
printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");

19
ioctl.c
View File

@ -3,6 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-2001 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -42,7 +43,7 @@
static int
compare(const void *a, const void *b)
{
const unsigned int code1 = (const unsigned long) a;
const unsigned int code1 = (const uintptr_t) a;
const unsigned int code2 = ((struct_ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
@ -52,7 +53,7 @@ ioctl_lookup(const unsigned int code)
{
struct_ioctlent *iop;
iop = bsearch((const void *) (const unsigned long) code, ioctlent,
iop = bsearch((const void *) (const uintptr_t) code, ioctlent,
nioctlents, sizeof(ioctlent[0]), compare);
while (iop > ioctlent) {
iop--;
@ -79,7 +80,7 @@ ioctl_print_code(const unsigned int code)
{
tprints("_IOC(");
printflags(ioctl_dirs, _IOC_DIR(code), "_IOC_???");
tprintf(", 0x%02x, 0x%02x, 0x%02x)",
tprintf(", %#x, %#x, %#x)",
_IOC_TYPE(code), _IOC_NR(code), _IOC_SIZE(code));
}
@ -227,7 +228,7 @@ static int
ioctl_decode(struct tcb *tcp)
{
const unsigned int code = tcp->u_arg[1];
const long arg = tcp->u_arg[2];
const kernel_ulong_t arg = tcp->u_arg[2];
switch (_IOC_TYPE(code)) {
#if defined(ALPHA) || defined(POWERPC)
@ -255,10 +256,8 @@ ioctl_decode(struct tcb *tcp)
return block_ioctl(tcp, code, arg);
case 'X':
return fs_x_ioctl(tcp, code, arg);
#ifdef HAVE_SCSI_SG_H
case 0x22:
return scsi_ioctl(tcp, code, arg);
#endif
case 'L':
return loop_ioctl(tcp, code, arg);
case 'M':
@ -281,6 +280,12 @@ ioctl_decode(struct tcb *tcp)
#ifdef HAVE_LINUX_BTRFS_H
case 0x94:
return btrfs_ioctl(tcp, code, arg);
#endif
case 0xb7:
return nsfs_ioctl(tcp, code, arg);
#ifdef HAVE_LINUX_DM_IOCTL_H
case 0xfd:
return dm_ioctl(tcp, code, arg);
#endif
default:
break;
@ -319,7 +324,7 @@ SYS_FUNC(ioctl)
if (ret)
--ret;
else
tprintf(", %#lx", tcp->u_arg[2]);
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
ret |= RVAL_DECODED;
} else {
if (ret)

43
ioctl_iocdef.c Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2017 Alexey Neyman <stilor@att.net>
* 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.
*/
/*
* This file is *PREPROCESSED*, not *COMPILED* for host and the result
* is included into ioctlsort (which is compiled for build). Since some
* of these values are used in structure initializers, they cannot be
* defined as 'const unsigned int' - instead, they have to be macros.
* Hence, the result of preprocessing will be run through sed to change
* 'DEFINE' into '#define'
*/
#include <linux/ioctl.h>
DEFINE HOST_IOC_NONE _IOC_NONE
DEFINE HOST_IOC_READ _IOC_READ
DEFINE HOST_IOC_WRITE _IOC_WRITE
DEFINE HOST_IOC_SIZESHIFT _IOC_SIZESHIFT
DEFINE HOST_IOC_DIRSHIFT _IOC_DIRSHIFT

View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2001 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2004-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,7 +34,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/ioctl.h>
#include "ioctl_iocdef.h"
struct ioctlent {
const char *info;
@ -54,7 +56,7 @@ is_prefix(const char *s1, const char *s2)
}
static int
compare_name_info(const void* a, const void* b)
compare_name_info(const void *a, const void *b)
{
int rc;
@ -91,7 +93,7 @@ code(const struct ioctlent *e)
}
static int
compare_code_name(const void* a, const void* b)
compare_code_name(const void *a, const void *b)
{
unsigned int code1 = code((struct ioctlent *) a);
unsigned int code2 = code((struct ioctlent *) b);

View File

@ -2,7 +2,7 @@
SYS_FUNC(ioperm)
{
tprintf("%#lx, %#lx, %d",
tprintf("%#" PRI_klx ", %#" PRI_klx ", %d",
tcp->u_arg[0], tcp->u_arg[1], (int) tcp->u_arg[2]);
return RVAL_DECODED;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

2
ipc.c
View File

@ -45,7 +45,7 @@ SYS_FUNC(ipc)
unsigned int i;
for (i = 1; i < tcp->s_ent->nargs; ++i)
tprintf(", %#lx", tcp->u_arg[i]);
tprintf(", %#" PRI_klx, tcp->u_arg[i]);
return RVAL_DECODED;
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2003 Roland McGrath <roland@redhat.com>
* Copyright (c) 2003-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,6 +26,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRACE_IPC_DEFS_H
#define STRACE_IPC_DEFS_H
#ifdef HAVE_SYS_IPC_H
# include <sys/ipc.h>
#elif defined HAVE_LINUX_IPC_H
@ -37,6 +41,11 @@
# define IPC_64 0x100
#endif
#define PRINTCTL(flagset, arg, dflt) \
if ((arg) & IPC_64) tprints("IPC_64|"); \
printxval((flagset), (arg) &~ IPC_64, dflt)
#define PRINTCTL(flagset, arg, dflt) \
do { \
if ((arg) & IPC_64) \
tprints("IPC_64|"); \
printxval((flagset), (arg) & ~IPC_64, dflt); \
} while (0)
#endif /* !STRACE_IPC_DEFS_H */

View File

@ -5,6 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -44,19 +45,21 @@
SYS_FUNC(msgget)
{
if (tcp->u_arg[0])
tprintf("%#lx, ", tcp->u_arg[0]);
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE, ");
tprints("IPC_PRIVATE");
tprints(", ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[1] & 0777);
print_numeric_umode_t(tcp->u_arg[1] & 0777);
return RVAL_DECODED;
}
static void
tprint_msgsnd(struct tcb *tcp, const long addr, const unsigned long count,
const unsigned long flags)
tprint_msgsnd(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t count, const unsigned int flags)
{
tprint_msgbuf(tcp, addr, count);
printflags(ipc_msg_flags, flags, "MSG_???");
@ -76,15 +79,16 @@ SYS_FUNC(msgsnd)
}
static void
tprint_msgrcv(struct tcb *tcp, const long addr, const unsigned long count,
const long msgtyp)
tprint_msgrcv(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t count, const kernel_ulong_t msgtyp)
{
tprint_msgbuf(tcp, addr, count);
tprintf("%ld, ", msgtyp);
tprintf("%" PRI_kld ", ", msgtyp);
}
static int
fetch_msgrcv_args(struct tcb *tcp, const long addr, unsigned long *pair)
fetch_msgrcv_args(struct tcb *const tcp, const kernel_ulong_t addr,
kernel_ulong_t *const pair)
{
if (current_wordsize == sizeof(*pair)) {
if (umoven_or_printaddr(tcp, addr, 2 * sizeof(*pair), pair))
@ -115,10 +119,10 @@ SYS_FUNC(msgrcv)
tprint_msgrcv(tcp, tcp->u_arg[3],
tcp->u_arg[1], tcp->u_arg[4]);
} else {
unsigned long pair[2];
kernel_ulong_t pair[2];
if (fetch_msgrcv_args(tcp, tcp->u_arg[3], pair))
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
else
tprint_msgrcv(tcp, pair[0],
tcp->u_arg[1], pair[1]);

View File

@ -5,6 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,7 +52,7 @@ typedef struct msqid64_ds msqid_ds_t;
#include "xlat/msgctl_flags.h"
static void
print_msqid_ds(struct tcb *tcp, const long addr, int cmd)
print_msqid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
{
/* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
@ -67,7 +68,7 @@ print_msqid_ds(struct tcb *tcp, const long addr, int cmd)
printuid("uid=", msqid_ds.msg_perm.uid);
printuid(", gid=", msqid_ds.msg_perm.gid);
tprints(", mode=");
tprints(sprintmode(msqid_ds.msg_perm.mode));
print_numeric_umode_t(msqid_ds.msg_perm.mode);
if (cmd != IPC_STAT) {
tprints("}, ...}");
@ -97,11 +98,11 @@ print_msqid_ds(struct tcb *tcp, const long addr, int cmd)
SYS_FUNC(msgctl)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
tprintf("%d, ", (int) tcp->u_arg[0]);
PRINTCTL(msgctl_flags, tcp->u_arg[1], "MSG_???");
tprints(", ");
} else {
const long addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
const kernel_ulong_t addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
print_msqid_ds(tcp, addr, tcp->u_arg[1]);
}
return 0;

View File

@ -5,6 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -57,7 +58,8 @@ print_sembuf(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
#endif
static void
tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
tprint_sembuf_array(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned int count)
{
#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
struct sembuf sb;
@ -66,12 +68,12 @@ tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
#else
printaddr(addr);
#endif
tprintf(", %lu", count);
tprintf(", %u", count);
}
SYS_FUNC(semop)
{
tprintf("%lu, ", tcp->u_arg[0]);
tprintf("%d, ", (int) tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
} else {
@ -82,7 +84,7 @@ SYS_FUNC(semop)
SYS_FUNC(semtimedop)
{
tprintf("%lu, ", tcp->u_arg[0]);
tprintf("%d, ", (int) tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
tprints(", ");
@ -101,26 +103,31 @@ SYS_FUNC(semtimedop)
SYS_FUNC(semget)
{
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %d, ", (int) tcp->u_arg[1]);
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
print_numeric_umode_t(tcp->u_arg[2] & 0777);
return RVAL_DECODED;
}
SYS_FUNC(semctl)
{
tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
tprintf("%d, %d, ", (int) tcp->u_arg[0], (int) tcp->u_arg[1]);
PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
tprints(", ");
if (indirect_ipccall(tcp)) {
if (indirect_ipccall(tcp)
#ifdef SPARC64
&& current_personality != 0
#endif
) {
printnum_ptr(tcp, tcp->u_arg[3]);
} else {
tprintf("%#lx", tcp->u_arg[3]);
printaddr(tcp->u_arg[3]);
}
return RVAL_DECODED;
}

View File

@ -5,6 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -43,21 +44,22 @@
SYS_FUNC(shmget)
{
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
print_numeric_umode_t(tcp->u_arg[2] & 0777);
return RVAL_DECODED;
}
SYS_FUNC(shmat)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
tprintf("%d, ", (int) tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
printaddr(tcp->u_arg[3]);
tprints(", ");
@ -72,10 +74,14 @@ SYS_FUNC(shmat)
if (syserror(tcp))
return 0;
if (indirect_ipccall(tcp)) {
unsigned long raddr;
if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
union {
uint64_t r64;
uint32_t r32;
} u;
if (umoven(tcp, tcp->u_arg[2], current_wordsize, &u) < 0)
return RVAL_NONE;
tcp->u_rval = raddr;
tcp->u_rval = (sizeof(u.r32) == current_wordsize)
? u.r32 : u.r64;
}
return RVAL_HEX;
}

View File

@ -5,6 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,7 +52,7 @@ typedef struct shmid64_ds shmid_ds_t;
#include "xlat/shmctl_flags.h"
static void
print_shmid_ds(struct tcb *tcp, const long addr, int cmd)
print_shmid_ds(struct tcb *const tcp, const kernel_ulong_t addr, int cmd)
{
/* TODO: We don't properly decode old compat ipc calls. */
if (cmd & IPC_64)
@ -67,7 +68,7 @@ print_shmid_ds(struct tcb *tcp, const long addr, int cmd)
printuid("uid=", shmid_ds.shm_perm.uid);
printuid(", gid=", shmid_ds.shm_perm.gid);
tprints(", mode=");
tprints(sprintmode(shmid_ds.shm_perm.mode));
print_numeric_umode_t(shmid_ds.shm_perm.mode);
if (cmd != IPC_STAT) {
tprints("}, ...}");
@ -97,11 +98,11 @@ print_shmid_ds(struct tcb *tcp, const long addr, int cmd)
SYS_FUNC(shmctl)
{
if (entering(tcp)) {
tprintf("%lu, ", tcp->u_arg[0]);
tprintf("%d, ", (int) tcp->u_arg[0]);
PRINTCTL(shmctl_flags, tcp->u_arg[1], "SHM_???");
tprints(", ");
} else {
const long addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
const kernel_ulong_t addr = tcp->u_arg[indirect_ipccall(tcp) ? 3 : 2];
print_shmid_ds(tcp, addr, tcp->u_arg[1]);
}
return 0;

9
kcmp.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,13 +34,13 @@ SYS_FUNC(kcmp)
pid_t pid1 = tcp->u_arg[0];
pid_t pid2 = tcp->u_arg[1];
int type = tcp->u_arg[2];
unsigned long idx1 = tcp->u_arg[3];
unsigned long idx2 = tcp->u_arg[4];
kernel_ulong_t idx1 = tcp->u_arg[3];
kernel_ulong_t idx2 = tcp->u_arg[4];
tprintf("%d, %d, ", pid1, pid2);
printxval(kcmp_types, type, "KCMP_???");
switch(type) {
switch (type) {
case KCMP_FILE:
tprintf(", %u, %u", (unsigned) idx1, (unsigned) idx2);
break;
@ -51,7 +52,7 @@ SYS_FUNC(kcmp)
case KCMP_VM:
break;
default:
tprintf(", %#lx, %#lx", idx1, idx2);
tprintf(", %#" PRI_klx ", %#" PRI_klx, idx1, idx2);
}
return RVAL_DECODED;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,8 +27,7 @@
*/
#ifndef STRACE_KERNEL_TYPES_H
# define STRACE_KERNEL_TYPES_H
#define STRACE_KERNEL_TYPES_H
# if defined HAVE___KERNEL_LONG_T && defined HAVE___KERNEL_ULONG_T
@ -36,7 +36,7 @@
typedef __kernel_long_t kernel_long_t;
typedef __kernel_ulong_t kernel_ulong_t;
# elif defined __x86_64__ && defined __ILP32__
# elif (defined __x86_64__ && defined __ILP32__) || defined LINUX_MIPSN32
typedef long long kernel_long_t;
typedef unsigned long long kernel_ulong_t;
@ -55,4 +55,4 @@ typedef struct {
char d_name[1];
} kernel_dirent;
#endif
#endif /* !STRACE_KERNEL_TYPES_H */

35
kexec.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -40,10 +41,10 @@
static bool
print_seg(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
const unsigned long *seg;
unsigned long seg_buf[4];
const kernel_ulong_t *seg;
kernel_ulong_t seg_buf[4];
if (elem_size < sizeof(seg_buf)) {
if (elem_size < sizeof(seg_buf)) {
unsigned int i;
for (i = 0; i < ARRAY_SIZE(seg_buf); ++i)
@ -53,25 +54,25 @@ print_seg(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
seg = elem_buf;
}
tprints("{");
tprints("{buf=");
printaddr(seg[0]);
tprintf(", %lu, ", seg[1]);
tprintf(", bufsz=%" PRI_klu ", mem=", seg[1]);
printaddr(seg[2]);
tprintf(", %lu}", seg[3]);
tprintf(", memsz=%" PRI_klu "}", seg[3]);
return true;
}
static void
print_kexec_segments(struct tcb *tcp, const unsigned long addr,
const unsigned long len)
print_kexec_segments(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t len)
{
if (len > KEXEC_SEGMENT_MAX) {
printaddr(addr);
return;
}
unsigned long seg[4];
kernel_ulong_t seg[4];
const size_t sizeof_seg = ARRAY_SIZE(seg) * current_wordsize;
print_array(tcp, addr, len, seg, sizeof_seg,
@ -82,19 +83,19 @@ SYS_FUNC(kexec_load)
{
/* entry, nr_segments */
printaddr(tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
/* segments */
print_kexec_segments(tcp, tcp->u_arg[2], tcp->u_arg[1]);
tprints(", ");
/* flags */
unsigned long n = tcp->u_arg[3];
printxval_long(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
n &= ~KEXEC_ARCH_MASK;
kernel_ulong_t n = tcp->u_arg[3];
printxval64(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
n &= ~(kernel_ulong_t) KEXEC_ARCH_MASK;
if (n) {
tprints("|");
printflags_long(kexec_load_flags, n, "KEXEC_???");
printflags64(kexec_load_flags, n, "KEXEC_???");
}
return RVAL_DECODED;
@ -111,12 +112,12 @@ SYS_FUNC(kexec_file_load)
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
/* cmdline_len */
tprintf("%lu, ", tcp->u_arg[2]);
tprintf("%" PRI_klu ", ", tcp->u_arg[2]);
/* cmdline */
printstr(tcp, tcp->u_arg[3], tcp->u_arg[2]);
printstrn(tcp, tcp->u_arg[3], tcp->u_arg[2]);
tprints(", ");
/* flags */
printflags_long(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
printflags64(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
return RVAL_DECODED;
}

183
keyctl.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,6 +32,12 @@ typedef int32_t key_serial_t;
#include "xlat/key_spec.h"
struct keyctl_dh_params {
int32_t private;
int32_t prime;
int32_t base;
};
static void
print_keyring_serial_number(key_serial_t id)
{
@ -45,15 +52,15 @@ print_keyring_serial_number(key_serial_t id)
SYS_FUNC(add_key)
{
/* type */
printstr(tcp, tcp->u_arg[0], -1);
printstr(tcp, tcp->u_arg[0]);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, tcp->u_arg[1]);
/* payload */
tprints(", ");
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
printstrn(tcp, tcp->u_arg[2], tcp->u_arg[3]);
/* payload length */
tprintf(", %lu, ", tcp->u_arg[3]);
tprintf(", %" PRI_klu ", ", tcp->u_arg[3]);
/* keyring serial number */
print_keyring_serial_number(tcp->u_arg[4]);
@ -63,13 +70,13 @@ SYS_FUNC(add_key)
SYS_FUNC(request_key)
{
/* type */
printstr(tcp, tcp->u_arg[0], -1);
printstr(tcp, tcp->u_arg[0]);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, tcp->u_arg[1]);
/* callout_info */
tprints(", ");
printstr(tcp, tcp->u_arg[2], -1);
printstr(tcp, tcp->u_arg[2]);
/* keyring serial number */
tprints(", ");
print_keyring_serial_number(tcp->u_arg[3]);
@ -85,12 +92,13 @@ keyctl_get_keyring_id(struct tcb *tcp, key_serial_t id, int create)
}
static void
keyctl_update_key(struct tcb *tcp, key_serial_t id, long addr, long len)
keyctl_update_key(struct tcb *tcp, key_serial_t id, kernel_ulong_t addr,
kernel_ulong_t len)
{
print_keyring_serial_number(id);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu", len);
printstrn(tcp, addr, len);
tprintf(", %llu", zero_extend_signed_to_ull(len));
}
static void
@ -102,7 +110,8 @@ keyctl_handle_key_key(struct tcb *tcp, key_serial_t id1, key_serial_t id2)
}
static void
keyctl_read_key(struct tcb *tcp, key_serial_t id, long addr, long len)
keyctl_read_key(struct tcb *tcp, key_serial_t id, kernel_ulong_t addr,
kernel_ulong_t len, bool has_nul)
{
if (entering(tcp)) {
print_keyring_serial_number(id);
@ -111,53 +120,58 @@ keyctl_read_key(struct tcb *tcp, key_serial_t id, long addr, long len)
if (syserror(tcp))
printaddr(addr);
else {
long rval = tcp->u_rval > len ?
len : (tcp->u_rval ? -1 : 0);
printstr(tcp, addr, rval);
kernel_ulong_t rval = (tcp->u_rval >= 0) &&
((kernel_ulong_t) tcp->u_rval > len) ? len :
(kernel_ulong_t) tcp->u_rval;
printstr_ex(tcp, addr, rval, has_nul ?
QUOTE_OMIT_TRAILING_0 : 0);
}
tprintf(", %lu", len);
tprintf(", %llu", zero_extend_signed_to_ull(len));
}
}
static void
keyctl_keyring_search(struct tcb *tcp, key_serial_t id1, long addr1,
long addr2, key_serial_t id2)
keyctl_keyring_search(struct tcb *tcp, key_serial_t id1, kernel_ulong_t addr1,
kernel_ulong_t addr2, key_serial_t id2)
{
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr1, -1);
printstr(tcp, addr1);
tprints(", ");
printstr(tcp, addr2, -1);
printstr(tcp, addr2);
tprints(", ");
print_keyring_serial_number(id2);
}
static void
keyctl_chown_key(struct tcb *tcp, key_serial_t id, int user, int group)
keyctl_chown_key(struct tcb *tcp, key_serial_t id, unsigned user,
unsigned group)
{
print_keyring_serial_number(id);
tprintf(", %d, %d", user, group);
printuid(", ", user);
printuid(", ", group);
}
static void
keyctl_instantiate_key(struct tcb *tcp, key_serial_t id1, long addr,
long len, key_serial_t id2)
keyctl_instantiate_key(struct tcb *tcp, key_serial_t id1, kernel_ulong_t addr,
kernel_ulong_t len, key_serial_t id2)
{
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu, ", len);
printstrn(tcp, addr, len);
tprintf(", %llu, ", zero_extend_signed_to_ull(len));
print_keyring_serial_number(id2);
}
static void
keyctl_instantiate_key_iov(struct tcb *tcp, key_serial_t id1,
long addr, long len, key_serial_t id2)
kernel_ulong_t addr, kernel_ulong_t len,
key_serial_t id2)
{
print_keyring_serial_number(id1);
tprints(", ");
tprint_iov(tcp, len, addr, IOV_DECODE_STR);
tprintf(", %lu, ", len);
tprintf(", %llu, ", zero_extend_signed_to_ull(len));
print_keyring_serial_number(id2);
}
@ -174,8 +188,16 @@ 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, %u, ", timeout, error);
tprintf(", %u, ", timeout);
if (err_str)
tprintf("%s, ", err_str);
else
tprintf("%u, ", error);
print_keyring_serial_number(id2);
}
@ -187,9 +209,10 @@ keyctl_set_timeout(struct tcb *tcp, key_serial_t id, unsigned timeout)
}
static void
keyctl_get_persistent(struct tcb *tcp, int uid, key_serial_t id)
keyctl_get_persistent(struct tcb *tcp, unsigned uid, key_serial_t id)
{
tprintf("%d, ", uid);
printuid("", uid);
tprints(", ");
print_keyring_serial_number(id);
}
@ -203,105 +226,147 @@ keyctl_setperm_key(struct tcb *tcp, key_serial_t id, uint32_t perm)
printflags(key_perms, perm, "KEY_???");
}
static void
print_dh_params(struct tcb *tcp, kernel_ulong_t addr)
{
struct keyctl_dh_params params;
if (umove_or_printaddr(tcp, addr, &params))
return;
tprints("{private=");
print_keyring_serial_number(params.private);
tprints(", prime=");
print_keyring_serial_number(params.prime);
tprints(", base=");
print_keyring_serial_number(params.base);
tprints("}");
}
static void
keyctl_dh_compute(struct tcb *tcp, kernel_ulong_t params, kernel_ulong_t buf,
kernel_ulong_t len)
{
if (entering(tcp)) {
print_dh_params(tcp, params);
tprints(", ");
} else {
if (syserror(tcp)) {
printaddr(buf);
} else {
kernel_ulong_t rval = (tcp->u_rval >= 0) &&
((kernel_ulong_t) tcp->u_rval > len) ? len :
(kernel_ulong_t) tcp->u_rval;
printstrn(tcp, buf, rval);
}
tprintf(", %llu", zero_extend_signed_to_ull(len));
}
}
#include "xlat/key_reqkeys.h"
#include "xlat/keyctl_commands.h"
SYS_FUNC(keyctl)
{
int cmd = tcp->u_arg[0];
kernel_ulong_t arg2 = tcp->u_arg[1];
kernel_ulong_t arg3 = tcp->u_arg[2];
kernel_ulong_t arg4 = tcp->u_arg[3];
kernel_ulong_t arg5 = tcp->u_arg[4];
if (entering(tcp)) {
printxval(keyctl_commands, cmd, "KEYCTL_???");
tprints(", ");
/*
* For now, KEYCTL_SESSION_TO_PARENT is the only cmd without
* arguments.
*/
if (cmd != KEYCTL_SESSION_TO_PARENT)
tprints(", ");
}
switch (cmd) {
case KEYCTL_GET_KEYRING_ID:
keyctl_get_keyring_id(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_get_keyring_id(tcp, arg2, arg3);
break;
case KEYCTL_JOIN_SESSION_KEYRING:
printstr(tcp, tcp->u_arg[1], -1);
printstr(tcp, arg2);
break;
case KEYCTL_UPDATE:
keyctl_update_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
keyctl_update_key(tcp, arg2, arg3, arg4);
break;
case KEYCTL_REVOKE:
case KEYCTL_CLEAR:
case KEYCTL_INVALIDATE:
case KEYCTL_ASSUME_AUTHORITY:
print_keyring_serial_number(tcp->u_arg[1]);
print_keyring_serial_number(arg2);
break;
case KEYCTL_LINK:
case KEYCTL_UNLINK:
keyctl_handle_key_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_handle_key_key(tcp, arg2, arg3);
break;
case KEYCTL_DESCRIBE:
case KEYCTL_READ:
case KEYCTL_GET_SECURITY:
keyctl_read_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
keyctl_read_key(tcp, arg2, arg3, arg4, cmd != KEYCTL_READ);
return 0;
case KEYCTL_SEARCH:
keyctl_keyring_search(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
keyctl_keyring_search(tcp, arg2, arg3, arg4, arg5);
break;
case KEYCTL_CHOWN:
keyctl_chown_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
keyctl_chown_key(tcp, arg2, arg3, arg4);
break;
case KEYCTL_SETPERM:
keyctl_setperm_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_setperm_key(tcp, arg2, arg3);
break;
case KEYCTL_INSTANTIATE:
keyctl_instantiate_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
keyctl_instantiate_key(tcp, arg2, arg3, arg4, arg5);
break;
case KEYCTL_NEGATE:
keyctl_negate_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
keyctl_negate_key(tcp, arg2, arg3, arg4);
break;
case KEYCTL_SET_REQKEY_KEYRING:
printxval(key_reqkeys, tcp->u_arg[1], "KEY_REQKEY_DEFL_???");
printxval(key_reqkeys, arg2, "KEY_REQKEY_DEFL_???");
break;
case KEYCTL_SET_TIMEOUT:
keyctl_set_timeout(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_set_timeout(tcp, arg2, arg3);
break;
case KEYCTL_SESSION_TO_PARENT:
break;
case KEYCTL_REJECT:
keyctl_reject_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
keyctl_reject_key(tcp, arg2, arg3, arg4, arg5);
break;
case KEYCTL_INSTANTIATE_IOV:
keyctl_instantiate_key_iov(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3],
tcp->u_arg[4]);
keyctl_instantiate_key_iov(tcp, arg2, arg3, arg4, arg5);
break;
case KEYCTL_GET_PERSISTENT:
keyctl_get_persistent(tcp, tcp->u_arg[1], tcp->u_arg[2]);
keyctl_get_persistent(tcp, arg2, arg3);
break;
case KEYCTL_DH_COMPUTE:
keyctl_dh_compute(tcp, arg2, arg3, arg4);
return 0;
default:
tprintf("%#lx, %#lx, %#lx, %#lx",
tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
tprintf("%#" PRI_klx ", %#" PRI_klx
", %#" PRI_klx ", %#" PRI_klx,
arg2, arg3, arg4, arg5);
break;
}

11
ldt.c
View File

@ -6,6 +6,7 @@
* Copyright (c) 2002-2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2010 Andreas Schwab <schwab@linux-m68k.org>
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,12 +34,12 @@
#include "defs.h"
#if defined I386 || defined X86_64 || defined X32
#ifdef HAVE_STRUCT_USER_DESC
# include <asm/ldt.h>
void
print_user_desc(struct tcb *tcp, const long addr)
print_user_desc(struct tcb *const tcp, const kernel_ulong_t addr)
{
struct user_desc desc;
@ -67,12 +68,12 @@ print_user_desc(struct tcb *tcp, const long addr)
SYS_FUNC(modify_ldt)
{
tprintf("%ld, ", tcp->u_arg[0]);
tprintf("%" PRI_kld ", ", tcp->u_arg[0]);
if (tcp->u_arg[2] != sizeof(struct user_desc))
printaddr(tcp->u_arg[1]);
else
print_user_desc(tcp, tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[2]);
tprintf(", %" PRI_klu, tcp->u_arg[2]);
return RVAL_DECODED;
}
@ -105,7 +106,7 @@ SYS_FUNC(get_thread_area)
return 0;
}
#endif /* I386 || X86_64 || X32 */
#endif /* HAVE_STRUCT_USER_DESC */
#if defined(M68K) || defined(MIPS)
SYS_FUNC(set_thread_area)

View File

@ -1,4 +1,6 @@
#if defined X86_64 || defined X32 \
#if defined M68K
# include "32/ioctls_inc_align16.h"
#elif defined X86_64 || defined X32 \
|| SIZEOF_STRUCT_I64_I32 < SIZEOF_LONG_LONG * 2
# include "32/ioctls_inc_align32.h"
#else

File diff suppressed because it is too large Load Diff

View File

@ -93,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@ -185,7 +186,7 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x30 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
@ -232,6 +233,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_ENTERVT", _IOC_NONE, 0x6459, 0x00 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER", _IOC_WRITE, 0x6454, 0x28 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER2", _IOC_WRITE, 0x6469, 0x40 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER2_WR", _IOC_READ|_IOC_WRITE, 0x6469, 0x40 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_APERTURE", _IOC_READ, 0x6463, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_CACHING", _IOC_READ|_IOC_WRITE, 0x6470, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6462, 0x10 },
@ -263,11 +265,14 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_IRQ_WAIT", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_ATTRS", _IOC_READ|_IOC_WRITE, 0x6468, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_PUT_IMAGE", _IOC_WRITE, 0x6467, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_VBLANK_PIPE", _IOC_WRITE, 0x644d, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_VBLANK_SWAP", _IOC_READ|_IOC_WRITE, 0x644f, 0x0c },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_DISABLE", _IOC_NONE, 0x6901, 0x00 },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_ENABLE", _IOC_NONE, 0x6900, 0x00 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_BLIT", _IOC_WRITE, 0x6448, 0x34 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_CLEAR", _IOC_WRITE, 0x6444, 0x14 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_DMA_BOOTSTRAP", _IOC_READ|_IOC_WRITE, 0x644c, 0x1c },
@ -284,8 +289,9 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_CPU_FINI", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x20 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
@ -392,10 +398,13 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_SIGNAL", _IOC_WRITE, 0x6442, 0x08 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_AGP_INIT", _IOC_READ|_IOC_WRITE, 0x6442, 0x08 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_ALLOCMEM", _IOC_READ|_IOC_WRITE, 0x6440, 0x14 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_BLIT_SYNC", _IOC_WRITE, 0x644f, 0x08 },
@ -446,8 +455,10 @@
{ "linux/android/binder.h", "BC_REGISTER_LOOPER", _IOC_NONE, 0x630b, 0x00 },
{ "linux/android/binder.h", "BC_RELEASE", _IOC_WRITE, 0x6306, 0x04 },
{ "linux/android/binder.h", "BC_REPLY", _IOC_WRITE, 0x6301, 0x40 },
{ "linux/android/binder.h", "BC_REPLY_SG", _IOC_WRITE, 0x6312, 0x48 },
{ "linux/android/binder.h", "BC_REQUEST_DEATH_NOTIFICATION", _IOC_WRITE, 0x630e, 0x0c },
{ "linux/android/binder.h", "BC_TRANSACTION", _IOC_WRITE, 0x6300, 0x40 },
{ "linux/android/binder.h", "BC_TRANSACTION_SG", _IOC_WRITE, 0x6311, 0x48 },
{ "linux/android/binder.h", "BINDER_SET_CONTEXT_MGR", _IOC_WRITE, 0x6207, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_PRIORITY", _IOC_WRITE, 0x6206, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_TIMEOUT", _IOC_WRITE, 0x6203, 0x08 },
@ -477,6 +488,8 @@
{ "linux/apm_bios.h", "APM_IOC_SUSPEND", _IOC_NONE, 0x4102, 0x00 },
{ "linux/arcfb.h", "FBIO_GETCONTROL2", _IOC_READ, 0x4689, 0x04 },
{ "linux/arcfb.h", "FBIO_WAITEVENT", _IOC_NONE, 0x4688, 0x00 },
{ "linux/aspeed-lpc-ctrl.h", "ASPEED_LPC_CTRL_IOCTL_GET_SIZE", _IOC_READ|_IOC_WRITE, 0xb200, 0x10 },
{ "linux/aspeed-lpc-ctrl.h", "ASPEED_LPC_CTRL_IOCTL_MAP", _IOC_WRITE, 0xb201, 0x10 },
{ "linux/atm_eni.h", "ENI_MEMDUMP", _IOC_WRITE, 0x6160, 0x0c },
{ "linux/atm_eni.h", "ENI_SETMULT", _IOC_WRITE, 0x6167, 0x0c },
{ "linux/atm_he.h", "HE_GET_REG", _IOC_WRITE, 0x6160, 0x0c },
@ -553,6 +566,9 @@
{ "linux/auto_fs4.h", "AUTOFS_IOC_EXPIRE_MULTI", _IOC_WRITE, 0x9366, 0x04 },
{ "linux/auto_fs4.h", "AUTOFS_IOC_PROTOSUBVER", _IOC_READ, 0x9367, 0x04 },
{ "linux/blkpg.h", "BLKPG", _IOC_NONE, 0x1269, 0x00 },
{ "linux/blkzoned.h", "BLKREPORTZONE", _IOC_READ|_IOC_WRITE, 0x1282, 0x10 },
{ "linux/blkzoned.h", "BLKRESETZONE", _IOC_WRITE, 0x1283, 0x10 },
{ "linux/bt-bmc.h", "BT_BMC_IOCTL_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/btrfs.h", "BTRFS_IOC_ADD_DEV", _IOC_WRITE, 0x940a, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE", _IOC_WRITE, 0x940c, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE_CTL", _IOC_WRITE, 0x9421, 0x04 },
@ -683,6 +699,16 @@
{ "linux/cdrom.h", "DVD_AUTH", 0, 0x5392, 0 },
{ "linux/cdrom.h", "DVD_READ_STRUCT", 0, 0x5390, 0 },
{ "linux/cdrom.h", "DVD_WRITE_STRUCT", 0, 0x5391, 0 },
{ "linux/cec.h", "CEC_ADAP_G_CAPS", _IOC_READ|_IOC_WRITE, 0x6100, 0x4c },
{ "linux/cec.h", "CEC_ADAP_G_LOG_ADDRS", _IOC_READ, 0x6103, 0x5c },
{ "linux/cec.h", "CEC_ADAP_G_PHYS_ADDR", _IOC_READ, 0x6101, 0x02 },
{ "linux/cec.h", "CEC_ADAP_S_LOG_ADDRS", _IOC_READ|_IOC_WRITE, 0x6104, 0x5c },
{ "linux/cec.h", "CEC_ADAP_S_PHYS_ADDR", _IOC_WRITE, 0x6102, 0x02 },
{ "linux/cec.h", "CEC_DQEVENT", _IOC_READ|_IOC_WRITE, 0x6107, 0x50 },
{ "linux/cec.h", "CEC_G_MODE", _IOC_READ, 0x6108, 0x04 },
{ "linux/cec.h", "CEC_RECEIVE", _IOC_READ|_IOC_WRITE, 0x6106, 0x38 },
{ "linux/cec.h", "CEC_S_MODE", _IOC_WRITE, 0x6109, 0x04 },
{ "linux/cec.h", "CEC_TRANSMIT", _IOC_READ|_IOC_WRITE, 0x6105, 0x38 },
{ "linux/chio.h", "CHIOEXCHANGE", _IOC_WRITE, 0x6302, 0x1c },
{ "linux/chio.h", "CHIOGELEM", _IOC_WRITE, 0x6310, 0x6c },
{ "linux/chio.h", "CHIOGPARAMS", _IOC_READ, 0x6306, 0x14 },
@ -951,6 +977,7 @@
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_START", _IOC_READ|_IOC_WRITE, 0xaf03, 0x10 },
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_STOP", _IOC_READ|_IOC_WRITE, 0xaf04, 0x08 },
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_SETPROP", _IOC_READ|_IOC_WRITE, 0xaf08, 0x28 },
{ "linux/fsmap.h", "FS_IOC_GETFSMAP", _IOC_READ|_IOC_WRITE, 0x583b, 0xc0 },
{ "linux/fuse.h", "FUSE_DEV_IOC_CLONE", _IOC_READ, 0xe500, 0x04 },
{ "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_DDCB", _IOC_READ|_IOC_WRITE, 0xa532, 0xe8 },
{ "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_RAW_DDCB", _IOC_READ|_IOC_WRITE, 0xa533, 0xe8 },
@ -969,7 +996,11 @@
{ "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
{ "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
{ "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
{ "linux/gpio.h", "GPIOHANDLE_GET_LINE_VALUES_IOCTL", _IOC_READ|_IOC_WRITE, 0xb408, 0x40 },
{ "linux/gpio.h", "GPIOHANDLE_SET_LINE_VALUES_IOCTL", _IOC_READ|_IOC_WRITE, 0xb409, 0x40 },
{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
{ "linux/gpio.h", "GPIO_GET_LINEEVENT_IOCTL", _IOC_READ|_IOC_WRITE, 0xb404, 0x30 },
{ "linux/gpio.h", "GPIO_GET_LINEHANDLE_IOCTL", _IOC_READ|_IOC_WRITE, 0xb403, 0x16c },
{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
{ "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
{ "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
@ -1293,123 +1324,9 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ARM_VCPU_INIT", _IOC_WRITE, 0xaeae, 0x20 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_PCI_DEVICE", _IOC_READ, 0xae69, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_INTX_MASK", _IOC_WRITE, 0xaea4, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_ENTRY", _IOC_WRITE, 0xae74, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_NR", _IOC_WRITE, 0xae73, 0x08 },
{ "linux/kvm.h", "KVM_CHECK_EXTENSION", _IOC_NONE, 0xae03, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_DEVICE", _IOC_READ|_IOC_WRITE, 0xaee0, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_IRQCHIP", _IOC_NONE, 0xae60, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
{ "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
{ "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
{ "linux/kvm.h", "KVM_DEASSIGN_PCI_DEVICE", _IOC_WRITE, 0xae72, 0x40 },
{ "linux/kvm.h", "KVM_DIRTY_TLB", _IOC_WRITE, 0xaeaa, 0x0c },
{ "linux/kvm.h", "KVM_ENABLE_CAP", _IOC_WRITE, 0xaea3, 0x68 },
{ "linux/kvm.h", "KVM_GET_API_VERSION", _IOC_NONE, 0xae00, 0x00 },
{ "linux/kvm.h", "KVM_GET_CLOCK", _IOC_READ, 0xae7c, 0x30 },
{ "linux/kvm.h", "KVM_GET_CPUID2", _IOC_READ|_IOC_WRITE, 0xae91, 0x08 },
{ "linux/kvm.h", "KVM_GET_DEBUGREGS", _IOC_READ, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_GET_DEVICE_ATTR", _IOC_WRITE, 0xaee2, 0x18 },
{ "linux/kvm.h", "KVM_GET_DIRTY_LOG", _IOC_WRITE, 0xae42, 0x10 },
{ "linux/kvm.h", "KVM_GET_EMULATED_CPUID", _IOC_READ|_IOC_WRITE, 0xae09, 0x08 },
{ "linux/kvm.h", "KVM_GET_FPU", _IOC_READ, 0xae8c, 0x1a0 },
{ "linux/kvm.h", "KVM_GET_IRQCHIP", _IOC_READ|_IOC_WRITE, 0xae62, 0x208 },
{ "linux/kvm.h", "KVM_GET_LAPIC", _IOC_READ, 0xae8e, 0x400 },
{ "linux/kvm.h", "KVM_GET_MP_STATE", _IOC_READ, 0xae98, 0x04 },
{ "linux/kvm.h", "KVM_GET_MSRS", _IOC_READ|_IOC_WRITE, 0xae88, 0x08 },
{ "linux/kvm.h", "KVM_GET_MSR_INDEX_LIST", _IOC_READ|_IOC_WRITE, 0xae02, 0x04 },
{ "linux/kvm.h", "KVM_GET_NR_MMU_PAGES", _IOC_NONE, 0xae45, 0x00 },
{ "linux/kvm.h", "KVM_GET_ONE_REG", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_GET_PIT", _IOC_READ|_IOC_WRITE, 0xae65, 0x48 },
{ "linux/kvm.h", "KVM_GET_PIT2", _IOC_READ, 0xae9f, 0x70 },
{ "linux/kvm.h", "KVM_GET_REGS", _IOC_READ, 0xae81, 0x90 },
{ "linux/kvm.h", "KVM_GET_REG_LIST", _IOC_READ|_IOC_WRITE, 0xaeb0, 0x08 },
{ "linux/kvm.h", "KVM_GET_SREGS", _IOC_READ, 0xae83, 0x138 },
{ "linux/kvm.h", "KVM_GET_SUPPORTED_CPUID", _IOC_READ|_IOC_WRITE, 0xae05, 0x08 },
{ "linux/kvm.h", "KVM_GET_TSC_KHZ", _IOC_NONE, 0xaea3, 0x00 },
{ "linux/kvm.h", "KVM_GET_VCPU_EVENTS", _IOC_READ, 0xae9f, 0x40 },
{ "linux/kvm.h", "KVM_GET_VCPU_MMAP_SIZE", _IOC_NONE, 0xae04, 0x00 },
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },
{ "linux/kvm.h", "KVM_IRQ_LINE", _IOC_WRITE, 0xae61, 0x08 },
{ "linux/kvm.h", "KVM_IRQ_LINE_STATUS", _IOC_READ|_IOC_WRITE, 0xae67, 0x08 },
{ "linux/kvm.h", "KVM_KVMCLOCK_CTRL", _IOC_NONE, 0xaead, 0x00 },
{ "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 },
{ "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 },
{ "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
{ "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
{ "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
{ "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x04 },
{ "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
{ "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
{ "linux/kvm.h", "KVM_S390_VCPU_FAULT", _IOC_WRITE, 0xae52, 0x04 },
{ "linux/kvm.h", "KVM_SET_BOOT_CPU_ID", _IOC_NONE, 0xae78, 0x00 },
{ "linux/kvm.h", "KVM_SET_CLOCK", _IOC_WRITE, 0xae7b, 0x30 },
{ "linux/kvm.h", "KVM_SET_CPUID", _IOC_WRITE, 0xae8a, 0x08 },
{ "linux/kvm.h", "KVM_SET_CPUID2", _IOC_WRITE, 0xae90, 0x08 },
{ "linux/kvm.h", "KVM_SET_DEBUGREGS", _IOC_WRITE, 0xaea2, 0x80 },
{ "linux/kvm.h", "KVM_SET_DEVICE_ATTR", _IOC_WRITE, 0xaee1, 0x18 },
{ "linux/kvm.h", "KVM_SET_FPU", _IOC_WRITE, 0xae8d, 0x1a0 },
{ "linux/kvm.h", "KVM_SET_GSI_ROUTING", _IOC_WRITE, 0xae6a, 0x08 },
{ "linux/kvm.h", "KVM_SET_GUEST_DEBUG", _IOC_WRITE, 0xae9b, 0x48 },
{ "linux/kvm.h", "KVM_SET_IDENTITY_MAP_ADDR", _IOC_WRITE, 0xae48, 0x08 },
{ "linux/kvm.h", "KVM_SET_IRQCHIP", _IOC_READ, 0xae63, 0x208 },
{ "linux/kvm.h", "KVM_SET_LAPIC", _IOC_WRITE, 0xae8f, 0x400 },
{ "linux/kvm.h", "KVM_SET_MEMORY_ALIAS", _IOC_WRITE, 0xae43, 0x20 },
{ "linux/kvm.h", "KVM_SET_MEMORY_REGION", _IOC_WRITE, 0xae40, 0x18 },
{ "linux/kvm.h", "KVM_SET_MP_STATE", _IOC_WRITE, 0xae99, 0x04 },
{ "linux/kvm.h", "KVM_SET_MSRS", _IOC_WRITE, 0xae89, 0x08 },
{ "linux/kvm.h", "KVM_SET_NR_MMU_PAGES", _IOC_NONE, 0xae44, 0x00 },
{ "linux/kvm.h", "KVM_SET_ONE_REG", _IOC_WRITE, 0xaeac, 0x10 },
{ "linux/kvm.h", "KVM_SET_PIT", _IOC_READ, 0xae66, 0x48 },
{ "linux/kvm.h", "KVM_SET_PIT2", _IOC_WRITE, 0xaea0, 0x70 },
{ "linux/kvm.h", "KVM_SET_REGS", _IOC_WRITE, 0xae82, 0x90 },
{ "linux/kvm.h", "KVM_SET_SIGNAL_MASK", _IOC_WRITE, 0xae8b, 0x04 },
{ "linux/kvm.h", "KVM_SET_SREGS", _IOC_WRITE, 0xae84, 0x138 },
{ "linux/kvm.h", "KVM_SET_TSC_KHZ", _IOC_NONE, 0xaea2, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSS_ADDR", _IOC_NONE, 0xae47, 0x00 },
{ "linux/kvm.h", "KVM_SET_USER_MEMORY_REGION", _IOC_WRITE, 0xae46, 0x20 },
{ "linux/kvm.h", "KVM_SET_VAPIC_ADDR", _IOC_WRITE, 0xae93, 0x08 },
{ "linux/kvm.h", "KVM_SET_VCPU_EVENTS", _IOC_WRITE, 0xaea0, 0x40 },
{ "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
{ "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
{ "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
{ "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
{ "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
{ "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
{ "linux/kvm.h", "KVM_X86_GET_MCE_CAP_SUPPORTED", _IOC_READ, 0xae9d, 0x08 },
{ "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
{ "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
{ "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_IO_VIO", _IOC_READ|_IOC_WRITE, 0x4c43, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_SUBMIT_VIO", _IOC_READ|_IOC_WRITE, 0x4c42, 0x40 },
{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
@ -1418,30 +1335,14 @@
{ "linux/lightnvm.h", "NVM_INFO", _IOC_READ|_IOC_WRITE, 0x4c20, 0x1000 },
{ "linux/lirc.h", "LIRC_GET_FEATURES", _IOC_READ, 0x6900, 0x04 },
{ "linux/lirc.h", "LIRC_GET_LENGTH", _IOC_READ, 0x690f, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_PULSE", _IOC_READ, 0x690b, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_SPACE", _IOC_READ, 0x690d, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_TIMEOUT", _IOC_READ, 0x6909, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_PULSE", _IOC_READ, 0x690a, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_SPACE", _IOC_READ, 0x690c, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_TIMEOUT", _IOC_READ, 0x6908, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_CARRIER", _IOC_READ, 0x6904, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_DUTY_CYCLE", _IOC_READ, 0x6906, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_MODE", _IOC_READ, 0x6902, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_RESOLUTION", _IOC_READ, 0x6907, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_CARRIER", _IOC_READ, 0x6903, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_DUTY_CYCLE", _IOC_READ, 0x6905, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_MODE", _IOC_READ, 0x6901, 0x04 },
{ "linux/lirc.h", "LIRC_NOTIFY_DECODE", _IOC_NONE, 0x6920, 0x00 },
{ "linux/lirc.h", "LIRC_SETUP_END", _IOC_NONE, 0x6922, 0x00 },
{ "linux/lirc.h", "LIRC_SETUP_START", _IOC_NONE, 0x6921, 0x00 },
{ "linux/lirc.h", "LIRC_SET_MEASURE_CARRIER_MODE", _IOC_WRITE, 0x691d, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_CARRIER", _IOC_WRITE, 0x6914, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_CARRIER_RANGE", _IOC_WRITE, 0x691f, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE", _IOC_WRITE, 0x6916, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE_RANGE", _IOC_WRITE, 0x691e, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER", _IOC_WRITE, 0x691c, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER_PULSE", _IOC_WRITE, 0x691a, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER_SPACE", _IOC_WRITE, 0x691b, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_MODE", _IOC_WRITE, 0x6912, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT", _IOC_WRITE, 0x6918, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT_REPORTS", _IOC_WRITE, 0x6919, 0x04 },
@ -1553,19 +1454,23 @@
{ "linux/ndctl.h", "ND_IOCTL_SMART", _IOC_READ|_IOC_WRITE, 0x4e01, 0x84 },
{ "linux/ndctl.h", "ND_IOCTL_SMART_THRESHOLD", _IOC_READ|_IOC_WRITE, 0x4e02, 0x0c },
{ "linux/ndctl.h", "ND_IOCTL_VENDOR", _IOC_READ|_IOC_WRITE, 0x4e09, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_BDESCS", _IOC_READ|_IOC_WRITE, 0x6e87, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_CPINFO", _IOC_READ, 0x6e82, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_CPSTAT", _IOC_READ, 0x6e83, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_SUINFO", _IOC_READ, 0x6e84, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_SUSTAT", _IOC_READ, 0x6e85, 0x30 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_VINFO", _IOC_READ|_IOC_WRITE, 0x6e86, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_RESIZE", _IOC_WRITE, 0x6e8b, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_BDESCS", _IOC_READ|_IOC_WRITE, 0x6e87, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_CPINFO", _IOC_READ, 0x6e82, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_CPSTAT", _IOC_READ, 0x6e83, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_SUINFO", _IOC_READ, 0x6e84, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_SUSTAT", _IOC_READ, 0x6e85, 0x30 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_VINFO", _IOC_READ|_IOC_WRITE, 0x6e86, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_RESIZE", _IOC_WRITE, 0x6e8b, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nsfs.h", "NS_GET_NSTYPE", _IOC_NONE, 0xb703, 0x00 },
{ "linux/nsfs.h", "NS_GET_OWNER_UID", _IOC_NONE, 0xb704, 0x00 },
{ "linux/nsfs.h", "NS_GET_PARENT", _IOC_NONE, 0xb702, 0x00 },
{ "linux/nsfs.h", "NS_GET_USERNS", _IOC_NONE, 0xb701, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
@ -1605,6 +1510,12 @@
{ "linux/omapfb.h", "OMAPFB_VSYNC", _IOC_NONE, 0x4f26, 0x00 },
{ "linux/omapfb.h", "OMAPFB_WAITFORGO", _IOC_NONE, 0x4f3c, 0x00 },
{ "linux/omapfb.h", "OMAPFB_WAITFORVSYNC", _IOC_NONE, 0x4f39, 0x00 },
{ "linux/pcitest.h", "PCITEST_BAR", _IOC_NONE, 0x5001, 0x00 },
{ "linux/pcitest.h", "PCITEST_COPY", _IOC_WRITE, 0x5006, 0x04 },
{ "linux/pcitest.h", "PCITEST_LEGACY_IRQ", _IOC_NONE, 0x5002, 0x00 },
{ "linux/pcitest.h", "PCITEST_MSI", _IOC_WRITE, 0x5003, 0x04 },
{ "linux/pcitest.h", "PCITEST_READ", _IOC_WRITE, 0x5005, 0x04 },
{ "linux/pcitest.h", "PCITEST_WRITE", _IOC_WRITE, 0x5004, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x04 },
@ -1739,6 +1650,17 @@
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
{ "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x04 },
{ "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_ACCEPT", _IOC_READ|_IOC_WRITE, 0x6307, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_BIND", _IOC_WRITE, 0x6305, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CLOSE", _IOC_WRITE, 0x6304, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CONNECT", _IOC_WRITE, 0x6308, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CREATE", _IOC_READ|_IOC_WRITE, 0x6303, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_LISTEN", _IOC_WRITE, 0x6306, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_RECEIVE", _IOC_READ|_IOC_WRITE, 0x630a, 0x10 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_SEND", _IOC_WRITE, 0x6309, 0x10 },
{ "linux/rio_cm_cdev.h", "RIO_CM_EP_GET_LIST", _IOC_READ|_IOC_WRITE, 0x6302, 0x04 },
{ "linux/rio_cm_cdev.h", "RIO_CM_EP_GET_LIST_SIZE", _IOC_READ|_IOC_WRITE, 0x6301, 0x04 },
{ "linux/rio_cm_cdev.h", "RIO_CM_MPORT_GET_LIST", _IOC_READ|_IOC_WRITE, 0x630b, 0x04 },
{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
@ -1763,6 +1685,8 @@
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
{ "linux/rpmsg.h", "RPMSG_CREATE_EPT_IOCTL", _IOC_WRITE, 0xb501, 0x28 },
{ "linux/rpmsg.h", "RPMSG_DESTROY_EPT_IOCTL", _IOC_NONE, 0xb502, 0x00 },
{ "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
{ "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
{ "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@ -1802,6 +1726,18 @@
{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x24 },
{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x24 },
{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x24 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_LSP", _IOC_WRITE, 0x70df, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_USR", _IOC_WRITE, 0x70e1, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ADD_USR_TO_LR", _IOC_WRITE, 0x70e4, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ENABLE_DISABLE_MBR", _IOC_WRITE, 0x70e5, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ERASE_LR", _IOC_WRITE, 0x70e6, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_LOCK_UNLOCK", _IOC_WRITE, 0x70dd, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_LR_SETUP", _IOC_WRITE, 0x70e3, 0x128 },
{ "linux/sed-opal.h", "IOC_OPAL_REVERT_TPR", _IOC_WRITE, 0x70e2, 0x108 },
{ "linux/sed-opal.h", "IOC_OPAL_SAVE", _IOC_WRITE, 0x70dc, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_SECURE_ERASE_LR", _IOC_WRITE, 0x70e7, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_SET_PW", _IOC_WRITE, 0x70e0, 0x220 },
{ "linux/sed-opal.h", "IOC_OPAL_TAKE_OWNERSHIP", _IOC_WRITE, 0x70de, 0x108 },
{ "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x04 },
{ "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
{ "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@ -1849,6 +1785,7 @@
{ "linux/sockios.h", "SIOCGMIIPHY", 0, 0x8947, 0 },
{ "linux/sockios.h", "SIOCGMIIREG", 0, 0x8948, 0 },
{ "linux/sockios.h", "SIOCGRARP", 0, 0x8961, 0 },
{ "linux/sockios.h", "SIOCGSKNS", 0, 0x894C, 0 },
{ "linux/sockios.h", "SIOCOUTQNSD", 0, 0x894B, 0 },
{ "linux/sockios.h", "SIOCPROTOPRIVATE", 0, 0x89E0, 0 },
{ "linux/sockios.h", "SIOCRTMSG", 0, 0x890D, 0 },
@ -2013,6 +1950,12 @@
{ "linux/suspend_ioctls.h", "SNAPSHOT_S2RAM", _IOC_NONE, 0x330b, 0x00 },
{ "linux/suspend_ioctls.h", "SNAPSHOT_SET_SWAP_AREA", _IOC_WRITE, 0x330d, 0x0c },
{ "linux/suspend_ioctls.h", "SNAPSHOT_UNFREEZE", _IOC_NONE, 0x3302, 0x00 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_EVENT_CTL", _IOC_READ|_IOC_WRITE, 0x5743, 0x28 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_EVENT_SUMMARY", _IOC_READ, 0x5742, 0x198 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_FLASH_INFO", _IOC_READ, 0x5740, 0x10 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_FLASH_PART_INFO", _IOC_READ|_IOC_WRITE, 0x5741, 0x10 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_PFF_TO_PORT", _IOC_READ|_IOC_WRITE, 0x5744, 0x0c },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_PORT_TO_PFF", _IOC_READ|_IOC_WRITE, 0x5745, 0x0c },
{ "linux/sync_file.h", "SYNC_IOC_FILE_INFO", _IOC_READ|_IOC_WRITE, 0x3e04, 0x38 },
{ "linux/sync_file.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e03, 0x30 },
{ "linux/synclink.h", "MGSL_IOCCLRMODCOUNT", _IOC_NONE, 0x6d0f, 0x00 },
@ -2035,6 +1978,14 @@
{ "linux/synclink.h", "MGSL_IOCTXENABLE", _IOC_NONE, 0x6d04, 0x00 },
{ "linux/synclink.h", "MGSL_IOCWAITEVENT", _IOC_READ|_IOC_WRITE, 0x6d08, 0x04 },
{ "linux/synclink.h", "MGSL_IOCWAITGPIO", _IOC_READ|_IOC_WRITE, 0x6d12, 0x10 },
{ "linux/tee.h", "TEE_IOC_CANCEL", _IOC_READ, 0xa404, 0x08 },
{ "linux/tee.h", "TEE_IOC_CLOSE_SESSION", _IOC_READ, 0xa405, 0x04 },
{ "linux/tee.h", "TEE_IOC_INVOKE", _IOC_READ, 0xa403, 0x10 },
{ "linux/tee.h", "TEE_IOC_OPEN_SESSION", _IOC_READ, 0xa402, 0x10 },
{ "linux/tee.h", "TEE_IOC_SHM_ALLOC", _IOC_READ|_IOC_WRITE, 0xa401, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
@ -2244,6 +2195,8 @@
{ "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
{ "linux/vhost.h", "VHOST_SET_VRING_KICK", _IOC_WRITE, 0xaf20, 0x08 },
{ "linux/vhost.h", "VHOST_SET_VRING_NUM", _IOC_WRITE, 0xaf10, 0x08 },
{ "linux/vhost.h", "VHOST_VSOCK_SET_GUEST_CID", _IOC_WRITE, 0xaf60, 0x08 },
{ "linux/vhost.h", "VHOST_VSOCK_SET_RUNNING", _IOC_WRITE, 0xaf61, 0x04 },
{ "linux/videodev2.h", "VIDIOC_CREATE_BUFS", _IOC_READ|_IOC_WRITE, 0x565c, 0xf8 },
{ "linux/videodev2.h", "VIDIOC_CROPCAP", _IOC_READ|_IOC_WRITE, 0x563a, 0x2c },
{ "linux/videodev2.h", "VIDIOC_DBG_G_CHIP_INFO", _IOC_READ|_IOC_WRITE, 0x5666, 0xc8 },
@ -2348,7 +2301,6 @@
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_SOCKETS_VERSION", _IOC_NONE, 0x07b4, 0x00 },
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_VERSION", _IOC_NONE, 0x079f, 0x00 },
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_VERSION2", _IOC_NONE, 0x07a7, 0x00 },
{ "linux/vsp1.h", "VIDIOC_VSP1_LUT_CONFIG", _IOC_READ|_IOC_WRITE, 0x56c1, 0x400 },
{ "linux/vt.h", "VT_ACTIVATE", 0, 0x5606, 0 },
{ "linux/vt.h", "VT_DISALLOCATE", 0, 0x5608, 0 },
{ "linux/vt.h", "VT_GETHIFONTMASK", 0, 0x560D, 0 },
@ -2365,6 +2317,7 @@
{ "linux/vt.h", "VT_UNLOCKSWITCH", 0, 0x560C, 0 },
{ "linux/vt.h", "VT_WAITACTIVE", 0, 0x5607, 0 },
{ "linux/vt.h", "VT_WAITEVENT", 0, 0x560E, 0 },
{ "linux/vtpm_proxy.h", "VTPM_PROXY_IOC_NEW_DEV", _IOC_READ|_IOC_WRITE, 0xa100, 0x14 },
{ "linux/watchdog.h", "WDIOC_GETBOOTSTATUS", _IOC_READ, 0x5702, 0x04 },
{ "linux/watchdog.h", "WDIOC_GETPRETIMEOUT", _IOC_READ, 0x5709, 0x04 },
{ "linux/watchdog.h", "WDIOC_GETSTATUS", _IOC_READ, 0x5701, 0x04 },
@ -2513,23 +2466,23 @@
{ "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
{ "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
@ -2761,18 +2714,8 @@
{ "staging/android/ashmem.h", "ASHMEM_SET_PROT_MASK", _IOC_WRITE, 0x7705, 0x04 },
{ "staging/android/ashmem.h", "ASHMEM_SET_SIZE", _IOC_WRITE, 0x7703, 0x04 },
{ "staging/android/ashmem.h", "ASHMEM_UNPIN", _IOC_WRITE, 0x7708, 0x08 },
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x14 },
{ "staging/android/ion.h", "ION_IOC_CUSTOM", _IOC_READ|_IOC_WRITE, 0x4906, 0x08 },
{ "staging/android/ion.h", "ION_IOC_FREE", _IOC_READ|_IOC_WRITE, 0x4901, 0x04 },
{ "staging/android/ion.h", "ION_IOC_IMPORT", _IOC_READ|_IOC_WRITE, 0x4905, 0x08 },
{ "staging/android/ion.h", "ION_IOC_MAP", _IOC_READ|_IOC_WRITE, 0x4902, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SHARE", _IOC_READ|_IOC_WRITE, 0x4904, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SYNC", _IOC_READ|_IOC_WRITE, 0x4907, 0x08 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_DMA_MAPPING", _IOC_WRITE, 0x49f1, 0x20 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_KERNEL_MAPPING", _IOC_WRITE, 0x49f2, 0x20 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_SET_FD", _IOC_NONE, 0x49f0, 0x00 },
{ "staging/android/sw_sync.h", "SW_SYNC_IOC_CREATE_FENCE", _IOC_READ|_IOC_WRITE, 0x5700, 0x28 },
{ "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x18 },
{ "staging/android/ion.h", "ION_IOC_HEAP_QUERY", _IOC_READ|_IOC_WRITE, 0x4908, 0x18 },
{ "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
{ "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
{ "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
@ -2813,6 +2756,7 @@
{ "xen/evtchn.h", "IOCTL_EVTCHN_BIND_VIRQ", _IOC_NONE, 0x4500, 0x04 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_NOTIFY", _IOC_NONE, 0x4504, 0x04 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_RESET", _IOC_NONE, 0x4505, 0x00 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_RESTRICT_DOMID", _IOC_NONE, 0x4506, 0x02 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_UNBIND", _IOC_NONE, 0x4503, 0x04 },
{ "xen/gntdev.h", "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", _IOC_NONE, 0x4702, 0x18 },
{ "xen/gntdev.h", "IOCTL_GNTDEV_GRANT_COPY", _IOC_NONE, 0x4708, 0x08 },

View File

@ -93,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@ -185,7 +186,7 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x30 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
@ -232,6 +233,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_ENTERVT", _IOC_NONE, 0x6459, 0x00 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER", _IOC_WRITE, 0x6454, 0x28 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER2", _IOC_WRITE, 0x6469, 0x40 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER2_WR", _IOC_READ|_IOC_WRITE, 0x6469, 0x40 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_APERTURE", _IOC_READ, 0x6463, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_CACHING", _IOC_READ|_IOC_WRITE, 0x6470, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6462, 0x10 },
@ -263,11 +265,14 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_IRQ_WAIT", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_ATTRS", _IOC_READ|_IOC_WRITE, 0x6468, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_PUT_IMAGE", _IOC_WRITE, 0x6467, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_VBLANK_PIPE", _IOC_WRITE, 0x644d, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_VBLANK_SWAP", _IOC_READ|_IOC_WRITE, 0x644f, 0x0c },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_DISABLE", _IOC_NONE, 0x6901, 0x00 },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_ENABLE", _IOC_NONE, 0x6900, 0x00 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_BLIT", _IOC_WRITE, 0x6448, 0x34 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_CLEAR", _IOC_WRITE, 0x6444, 0x14 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_DMA_BOOTSTRAP", _IOC_READ|_IOC_WRITE, 0x644c, 0x1c },
@ -284,8 +289,9 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_CPU_FINI", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x20 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
@ -392,10 +398,13 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_SIGNAL", _IOC_WRITE, 0x6442, 0x08 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_AGP_INIT", _IOC_READ|_IOC_WRITE, 0x6442, 0x08 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_ALLOCMEM", _IOC_READ|_IOC_WRITE, 0x6440, 0x14 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_BLIT_SYNC", _IOC_WRITE, 0x644f, 0x08 },
@ -446,8 +455,10 @@
{ "linux/android/binder.h", "BC_REGISTER_LOOPER", _IOC_NONE, 0x630b, 0x00 },
{ "linux/android/binder.h", "BC_RELEASE", _IOC_WRITE, 0x6306, 0x04 },
{ "linux/android/binder.h", "BC_REPLY", _IOC_WRITE, 0x6301, 0x40 },
{ "linux/android/binder.h", "BC_REPLY_SG", _IOC_WRITE, 0x6312, 0x48 },
{ "linux/android/binder.h", "BC_REQUEST_DEATH_NOTIFICATION", _IOC_WRITE, 0x630e, 0x0c },
{ "linux/android/binder.h", "BC_TRANSACTION", _IOC_WRITE, 0x6300, 0x40 },
{ "linux/android/binder.h", "BC_TRANSACTION_SG", _IOC_WRITE, 0x6311, 0x48 },
{ "linux/android/binder.h", "BINDER_SET_CONTEXT_MGR", _IOC_WRITE, 0x6207, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_PRIORITY", _IOC_WRITE, 0x6206, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_TIMEOUT", _IOC_WRITE, 0x6203, 0x08 },
@ -477,6 +488,8 @@
{ "linux/apm_bios.h", "APM_IOC_SUSPEND", _IOC_NONE, 0x4102, 0x00 },
{ "linux/arcfb.h", "FBIO_GETCONTROL2", _IOC_READ, 0x4689, 0x04 },
{ "linux/arcfb.h", "FBIO_WAITEVENT", _IOC_NONE, 0x4688, 0x00 },
{ "linux/aspeed-lpc-ctrl.h", "ASPEED_LPC_CTRL_IOCTL_GET_SIZE", _IOC_READ|_IOC_WRITE, 0xb200, 0x10 },
{ "linux/aspeed-lpc-ctrl.h", "ASPEED_LPC_CTRL_IOCTL_MAP", _IOC_WRITE, 0xb201, 0x10 },
{ "linux/atm_eni.h", "ENI_MEMDUMP", _IOC_WRITE, 0x6160, 0x0c },
{ "linux/atm_eni.h", "ENI_SETMULT", _IOC_WRITE, 0x6167, 0x0c },
{ "linux/atm_he.h", "HE_GET_REG", _IOC_WRITE, 0x6160, 0x0c },
@ -553,6 +566,9 @@
{ "linux/auto_fs4.h", "AUTOFS_IOC_EXPIRE_MULTI", _IOC_WRITE, 0x9366, 0x04 },
{ "linux/auto_fs4.h", "AUTOFS_IOC_PROTOSUBVER", _IOC_READ, 0x9367, 0x04 },
{ "linux/blkpg.h", "BLKPG", _IOC_NONE, 0x1269, 0x00 },
{ "linux/blkzoned.h", "BLKREPORTZONE", _IOC_READ|_IOC_WRITE, 0x1282, 0x10 },
{ "linux/blkzoned.h", "BLKRESETZONE", _IOC_WRITE, 0x1283, 0x10 },
{ "linux/bt-bmc.h", "BT_BMC_IOCTL_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/btrfs.h", "BTRFS_IOC_ADD_DEV", _IOC_WRITE, 0x940a, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE", _IOC_WRITE, 0x940c, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE_CTL", _IOC_WRITE, 0x9421, 0x04 },
@ -683,6 +699,16 @@
{ "linux/cdrom.h", "DVD_AUTH", 0, 0x5392, 0 },
{ "linux/cdrom.h", "DVD_READ_STRUCT", 0, 0x5390, 0 },
{ "linux/cdrom.h", "DVD_WRITE_STRUCT", 0, 0x5391, 0 },
{ "linux/cec.h", "CEC_ADAP_G_CAPS", _IOC_READ|_IOC_WRITE, 0x6100, 0x4c },
{ "linux/cec.h", "CEC_ADAP_G_LOG_ADDRS", _IOC_READ, 0x6103, 0x5c },
{ "linux/cec.h", "CEC_ADAP_G_PHYS_ADDR", _IOC_READ, 0x6101, 0x02 },
{ "linux/cec.h", "CEC_ADAP_S_LOG_ADDRS", _IOC_READ|_IOC_WRITE, 0x6104, 0x5c },
{ "linux/cec.h", "CEC_ADAP_S_PHYS_ADDR", _IOC_WRITE, 0x6102, 0x02 },
{ "linux/cec.h", "CEC_DQEVENT", _IOC_READ|_IOC_WRITE, 0x6107, 0x50 },
{ "linux/cec.h", "CEC_G_MODE", _IOC_READ, 0x6108, 0x04 },
{ "linux/cec.h", "CEC_RECEIVE", _IOC_READ|_IOC_WRITE, 0x6106, 0x38 },
{ "linux/cec.h", "CEC_S_MODE", _IOC_WRITE, 0x6109, 0x04 },
{ "linux/cec.h", "CEC_TRANSMIT", _IOC_READ|_IOC_WRITE, 0x6105, 0x38 },
{ "linux/chio.h", "CHIOEXCHANGE", _IOC_WRITE, 0x6302, 0x1c },
{ "linux/chio.h", "CHIOGELEM", _IOC_WRITE, 0x6310, 0x6c },
{ "linux/chio.h", "CHIOGPARAMS", _IOC_READ, 0x6306, 0x14 },
@ -951,6 +977,7 @@
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_START", _IOC_READ|_IOC_WRITE, 0xaf03, 0x10 },
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_STOP", _IOC_READ|_IOC_WRITE, 0xaf04, 0x08 },
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_SETPROP", _IOC_READ|_IOC_WRITE, 0xaf08, 0x28 },
{ "linux/fsmap.h", "FS_IOC_GETFSMAP", _IOC_READ|_IOC_WRITE, 0x583b, 0xc0 },
{ "linux/fuse.h", "FUSE_DEV_IOC_CLONE", _IOC_READ, 0xe500, 0x04 },
{ "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_DDCB", _IOC_READ|_IOC_WRITE, 0xa532, 0xe8 },
{ "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_RAW_DDCB", _IOC_READ|_IOC_WRITE, 0xa533, 0xe8 },
@ -969,7 +996,11 @@
{ "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
{ "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
{ "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
{ "linux/gpio.h", "GPIOHANDLE_GET_LINE_VALUES_IOCTL", _IOC_READ|_IOC_WRITE, 0xb408, 0x40 },
{ "linux/gpio.h", "GPIOHANDLE_SET_LINE_VALUES_IOCTL", _IOC_READ|_IOC_WRITE, 0xb409, 0x40 },
{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
{ "linux/gpio.h", "GPIO_GET_LINEEVENT_IOCTL", _IOC_READ|_IOC_WRITE, 0xb404, 0x30 },
{ "linux/gpio.h", "GPIO_GET_LINEHANDLE_IOCTL", _IOC_READ|_IOC_WRITE, 0xb403, 0x16c },
{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
{ "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
{ "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
@ -1293,123 +1324,9 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ARM_VCPU_INIT", _IOC_WRITE, 0xaeae, 0x20 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_PCI_DEVICE", _IOC_READ, 0xae69, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_INTX_MASK", _IOC_WRITE, 0xaea4, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_ENTRY", _IOC_WRITE, 0xae74, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_NR", _IOC_WRITE, 0xae73, 0x08 },
{ "linux/kvm.h", "KVM_CHECK_EXTENSION", _IOC_NONE, 0xae03, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_DEVICE", _IOC_READ|_IOC_WRITE, 0xaee0, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_IRQCHIP", _IOC_NONE, 0xae60, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
{ "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
{ "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
{ "linux/kvm.h", "KVM_DEASSIGN_PCI_DEVICE", _IOC_WRITE, 0xae72, 0x40 },
{ "linux/kvm.h", "KVM_DIRTY_TLB", _IOC_WRITE, 0xaeaa, 0x10 },
{ "linux/kvm.h", "KVM_ENABLE_CAP", _IOC_WRITE, 0xaea3, 0x68 },
{ "linux/kvm.h", "KVM_GET_API_VERSION", _IOC_NONE, 0xae00, 0x00 },
{ "linux/kvm.h", "KVM_GET_CLOCK", _IOC_READ, 0xae7c, 0x30 },
{ "linux/kvm.h", "KVM_GET_CPUID2", _IOC_READ|_IOC_WRITE, 0xae91, 0x08 },
{ "linux/kvm.h", "KVM_GET_DEBUGREGS", _IOC_READ, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_GET_DEVICE_ATTR", _IOC_WRITE, 0xaee2, 0x18 },
{ "linux/kvm.h", "KVM_GET_DIRTY_LOG", _IOC_WRITE, 0xae42, 0x10 },
{ "linux/kvm.h", "KVM_GET_EMULATED_CPUID", _IOC_READ|_IOC_WRITE, 0xae09, 0x08 },
{ "linux/kvm.h", "KVM_GET_FPU", _IOC_READ, 0xae8c, 0x00 },
{ "linux/kvm.h", "KVM_GET_IRQCHIP", _IOC_READ|_IOC_WRITE, 0xae62, 0x208 },
{ "linux/kvm.h", "KVM_GET_LAPIC", _IOC_READ, 0xae8e, 0x400 },
{ "linux/kvm.h", "KVM_GET_MP_STATE", _IOC_READ, 0xae98, 0x04 },
{ "linux/kvm.h", "KVM_GET_MSRS", _IOC_READ|_IOC_WRITE, 0xae88, 0x08 },
{ "linux/kvm.h", "KVM_GET_MSR_INDEX_LIST", _IOC_READ|_IOC_WRITE, 0xae02, 0x04 },
{ "linux/kvm.h", "KVM_GET_NR_MMU_PAGES", _IOC_NONE, 0xae45, 0x00 },
{ "linux/kvm.h", "KVM_GET_ONE_REG", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_GET_PIT", _IOC_READ|_IOC_WRITE, 0xae65, 0x48 },
{ "linux/kvm.h", "KVM_GET_PIT2", _IOC_READ, 0xae9f, 0x70 },
{ "linux/kvm.h", "KVM_GET_REGS", _IOC_READ, 0xae81, 0x98 },
{ "linux/kvm.h", "KVM_GET_REG_LIST", _IOC_READ|_IOC_WRITE, 0xaeb0, 0x08 },
{ "linux/kvm.h", "KVM_GET_SREGS", _IOC_READ, 0xae83, 0x00 },
{ "linux/kvm.h", "KVM_GET_SUPPORTED_CPUID", _IOC_READ|_IOC_WRITE, 0xae05, 0x08 },
{ "linux/kvm.h", "KVM_GET_TSC_KHZ", _IOC_NONE, 0xaea3, 0x00 },
{ "linux/kvm.h", "KVM_GET_VCPU_EVENTS", _IOC_READ, 0xae9f, 0x40 },
{ "linux/kvm.h", "KVM_GET_VCPU_MMAP_SIZE", _IOC_NONE, 0xae04, 0x00 },
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },
{ "linux/kvm.h", "KVM_IRQ_LINE", _IOC_WRITE, 0xae61, 0x08 },
{ "linux/kvm.h", "KVM_IRQ_LINE_STATUS", _IOC_READ|_IOC_WRITE, 0xae67, 0x08 },
{ "linux/kvm.h", "KVM_KVMCLOCK_CTRL", _IOC_NONE, 0xaead, 0x00 },
{ "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 },
{ "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 },
{ "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
{ "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
{ "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
{ "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x04 },
{ "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
{ "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
{ "linux/kvm.h", "KVM_S390_VCPU_FAULT", _IOC_WRITE, 0xae52, 0x04 },
{ "linux/kvm.h", "KVM_SET_BOOT_CPU_ID", _IOC_NONE, 0xae78, 0x00 },
{ "linux/kvm.h", "KVM_SET_CLOCK", _IOC_WRITE, 0xae7b, 0x30 },
{ "linux/kvm.h", "KVM_SET_CPUID", _IOC_WRITE, 0xae8a, 0x08 },
{ "linux/kvm.h", "KVM_SET_CPUID2", _IOC_WRITE, 0xae90, 0x08 },
{ "linux/kvm.h", "KVM_SET_DEBUGREGS", _IOC_WRITE, 0xaea2, 0x80 },
{ "linux/kvm.h", "KVM_SET_DEVICE_ATTR", _IOC_WRITE, 0xaee1, 0x18 },
{ "linux/kvm.h", "KVM_SET_FPU", _IOC_WRITE, 0xae8d, 0x00 },
{ "linux/kvm.h", "KVM_SET_GSI_ROUTING", _IOC_WRITE, 0xae6a, 0x08 },
{ "linux/kvm.h", "KVM_SET_GUEST_DEBUG", _IOC_WRITE, 0xae9b, 0x08 },
{ "linux/kvm.h", "KVM_SET_IDENTITY_MAP_ADDR", _IOC_WRITE, 0xae48, 0x08 },
{ "linux/kvm.h", "KVM_SET_IRQCHIP", _IOC_READ, 0xae63, 0x208 },
{ "linux/kvm.h", "KVM_SET_LAPIC", _IOC_WRITE, 0xae8f, 0x400 },
{ "linux/kvm.h", "KVM_SET_MEMORY_ALIAS", _IOC_WRITE, 0xae43, 0x20 },
{ "linux/kvm.h", "KVM_SET_MEMORY_REGION", _IOC_WRITE, 0xae40, 0x18 },
{ "linux/kvm.h", "KVM_SET_MP_STATE", _IOC_WRITE, 0xae99, 0x04 },
{ "linux/kvm.h", "KVM_SET_MSRS", _IOC_WRITE, 0xae89, 0x08 },
{ "linux/kvm.h", "KVM_SET_NR_MMU_PAGES", _IOC_NONE, 0xae44, 0x00 },
{ "linux/kvm.h", "KVM_SET_ONE_REG", _IOC_WRITE, 0xaeac, 0x10 },
{ "linux/kvm.h", "KVM_SET_PIT", _IOC_READ, 0xae66, 0x48 },
{ "linux/kvm.h", "KVM_SET_PIT2", _IOC_WRITE, 0xaea0, 0x70 },
{ "linux/kvm.h", "KVM_SET_REGS", _IOC_WRITE, 0xae82, 0x98 },
{ "linux/kvm.h", "KVM_SET_SIGNAL_MASK", _IOC_WRITE, 0xae8b, 0x04 },
{ "linux/kvm.h", "KVM_SET_SREGS", _IOC_WRITE, 0xae84, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSC_KHZ", _IOC_NONE, 0xaea2, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSS_ADDR", _IOC_NONE, 0xae47, 0x00 },
{ "linux/kvm.h", "KVM_SET_USER_MEMORY_REGION", _IOC_WRITE, 0xae46, 0x20 },
{ "linux/kvm.h", "KVM_SET_VAPIC_ADDR", _IOC_WRITE, 0xae93, 0x08 },
{ "linux/kvm.h", "KVM_SET_VCPU_EVENTS", _IOC_WRITE, 0xaea0, 0x40 },
{ "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
{ "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
{ "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
{ "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
{ "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
{ "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
{ "linux/kvm.h", "KVM_X86_GET_MCE_CAP_SUPPORTED", _IOC_READ, 0xae9d, 0x08 },
{ "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
{ "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
{ "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_IO_VIO", _IOC_READ|_IOC_WRITE, 0x4c43, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_SUBMIT_VIO", _IOC_READ|_IOC_WRITE, 0x4c42, 0x40 },
{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
@ -1418,30 +1335,14 @@
{ "linux/lightnvm.h", "NVM_INFO", _IOC_READ|_IOC_WRITE, 0x4c20, 0x1000 },
{ "linux/lirc.h", "LIRC_GET_FEATURES", _IOC_READ, 0x6900, 0x04 },
{ "linux/lirc.h", "LIRC_GET_LENGTH", _IOC_READ, 0x690f, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_PULSE", _IOC_READ, 0x690b, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_SPACE", _IOC_READ, 0x690d, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_TIMEOUT", _IOC_READ, 0x6909, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_PULSE", _IOC_READ, 0x690a, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_SPACE", _IOC_READ, 0x690c, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_TIMEOUT", _IOC_READ, 0x6908, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_CARRIER", _IOC_READ, 0x6904, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_DUTY_CYCLE", _IOC_READ, 0x6906, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_MODE", _IOC_READ, 0x6902, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_RESOLUTION", _IOC_READ, 0x6907, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_CARRIER", _IOC_READ, 0x6903, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_DUTY_CYCLE", _IOC_READ, 0x6905, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_MODE", _IOC_READ, 0x6901, 0x04 },
{ "linux/lirc.h", "LIRC_NOTIFY_DECODE", _IOC_NONE, 0x6920, 0x00 },
{ "linux/lirc.h", "LIRC_SETUP_END", _IOC_NONE, 0x6922, 0x00 },
{ "linux/lirc.h", "LIRC_SETUP_START", _IOC_NONE, 0x6921, 0x00 },
{ "linux/lirc.h", "LIRC_SET_MEASURE_CARRIER_MODE", _IOC_WRITE, 0x691d, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_CARRIER", _IOC_WRITE, 0x6914, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_CARRIER_RANGE", _IOC_WRITE, 0x691f, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE", _IOC_WRITE, 0x6916, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE_RANGE", _IOC_WRITE, 0x691e, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER", _IOC_WRITE, 0x691c, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER_PULSE", _IOC_WRITE, 0x691a, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER_SPACE", _IOC_WRITE, 0x691b, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_MODE", _IOC_WRITE, 0x6912, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT", _IOC_WRITE, 0x6918, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT_REPORTS", _IOC_WRITE, 0x6919, 0x04 },
@ -1553,19 +1454,23 @@
{ "linux/ndctl.h", "ND_IOCTL_SMART", _IOC_READ|_IOC_WRITE, 0x4e01, 0x84 },
{ "linux/ndctl.h", "ND_IOCTL_SMART_THRESHOLD", _IOC_READ|_IOC_WRITE, 0x4e02, 0x0c },
{ "linux/ndctl.h", "ND_IOCTL_VENDOR", _IOC_READ|_IOC_WRITE, 0x4e09, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_BDESCS", _IOC_READ|_IOC_WRITE, 0x6e87, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_CPINFO", _IOC_READ, 0x6e82, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_CPSTAT", _IOC_READ, 0x6e83, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_SUINFO", _IOC_READ, 0x6e84, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_SUSTAT", _IOC_READ, 0x6e85, 0x30 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_VINFO", _IOC_READ|_IOC_WRITE, 0x6e86, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_RESIZE", _IOC_WRITE, 0x6e8b, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_BDESCS", _IOC_READ|_IOC_WRITE, 0x6e87, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_CPINFO", _IOC_READ, 0x6e82, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_CPSTAT", _IOC_READ, 0x6e83, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_SUINFO", _IOC_READ, 0x6e84, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_SUSTAT", _IOC_READ, 0x6e85, 0x30 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_VINFO", _IOC_READ|_IOC_WRITE, 0x6e86, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_RESIZE", _IOC_WRITE, 0x6e8b, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nsfs.h", "NS_GET_NSTYPE", _IOC_NONE, 0xb703, 0x00 },
{ "linux/nsfs.h", "NS_GET_OWNER_UID", _IOC_NONE, 0xb704, 0x00 },
{ "linux/nsfs.h", "NS_GET_PARENT", _IOC_NONE, 0xb702, 0x00 },
{ "linux/nsfs.h", "NS_GET_USERNS", _IOC_NONE, 0xb701, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
@ -1605,6 +1510,12 @@
{ "linux/omapfb.h", "OMAPFB_VSYNC", _IOC_NONE, 0x4f26, 0x00 },
{ "linux/omapfb.h", "OMAPFB_WAITFORGO", _IOC_NONE, 0x4f3c, 0x00 },
{ "linux/omapfb.h", "OMAPFB_WAITFORVSYNC", _IOC_NONE, 0x4f39, 0x00 },
{ "linux/pcitest.h", "PCITEST_BAR", _IOC_NONE, 0x5001, 0x00 },
{ "linux/pcitest.h", "PCITEST_COPY", _IOC_WRITE, 0x5006, 0x04 },
{ "linux/pcitest.h", "PCITEST_LEGACY_IRQ", _IOC_NONE, 0x5002, 0x00 },
{ "linux/pcitest.h", "PCITEST_MSI", _IOC_WRITE, 0x5003, 0x04 },
{ "linux/pcitest.h", "PCITEST_READ", _IOC_WRITE, 0x5005, 0x04 },
{ "linux/pcitest.h", "PCITEST_WRITE", _IOC_WRITE, 0x5004, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x04 },
@ -1739,6 +1650,17 @@
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
{ "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x04 },
{ "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_ACCEPT", _IOC_READ|_IOC_WRITE, 0x6307, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_BIND", _IOC_WRITE, 0x6305, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CLOSE", _IOC_WRITE, 0x6304, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CONNECT", _IOC_WRITE, 0x6308, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CREATE", _IOC_READ|_IOC_WRITE, 0x6303, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_LISTEN", _IOC_WRITE, 0x6306, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_RECEIVE", _IOC_READ|_IOC_WRITE, 0x630a, 0x10 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_SEND", _IOC_WRITE, 0x6309, 0x10 },
{ "linux/rio_cm_cdev.h", "RIO_CM_EP_GET_LIST", _IOC_READ|_IOC_WRITE, 0x6302, 0x04 },
{ "linux/rio_cm_cdev.h", "RIO_CM_EP_GET_LIST_SIZE", _IOC_READ|_IOC_WRITE, 0x6301, 0x04 },
{ "linux/rio_cm_cdev.h", "RIO_CM_MPORT_GET_LIST", _IOC_READ|_IOC_WRITE, 0x630b, 0x04 },
{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
@ -1763,6 +1685,8 @@
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
{ "linux/rpmsg.h", "RPMSG_CREATE_EPT_IOCTL", _IOC_WRITE, 0xb501, 0x28 },
{ "linux/rpmsg.h", "RPMSG_DESTROY_EPT_IOCTL", _IOC_NONE, 0xb502, 0x00 },
{ "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
{ "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
{ "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@ -1802,6 +1726,18 @@
{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x28 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_LSP", _IOC_WRITE, 0x70df, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_USR", _IOC_WRITE, 0x70e1, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ADD_USR_TO_LR", _IOC_WRITE, 0x70e4, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ENABLE_DISABLE_MBR", _IOC_WRITE, 0x70e5, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ERASE_LR", _IOC_WRITE, 0x70e6, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_LOCK_UNLOCK", _IOC_WRITE, 0x70dd, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_LR_SETUP", _IOC_WRITE, 0x70e3, 0x128 },
{ "linux/sed-opal.h", "IOC_OPAL_REVERT_TPR", _IOC_WRITE, 0x70e2, 0x108 },
{ "linux/sed-opal.h", "IOC_OPAL_SAVE", _IOC_WRITE, 0x70dc, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_SECURE_ERASE_LR", _IOC_WRITE, 0x70e7, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_SET_PW", _IOC_WRITE, 0x70e0, 0x220 },
{ "linux/sed-opal.h", "IOC_OPAL_TAKE_OWNERSHIP", _IOC_WRITE, 0x70de, 0x108 },
{ "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x04 },
{ "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
{ "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@ -1849,6 +1785,7 @@
{ "linux/sockios.h", "SIOCGMIIPHY", 0, 0x8947, 0 },
{ "linux/sockios.h", "SIOCGMIIREG", 0, 0x8948, 0 },
{ "linux/sockios.h", "SIOCGRARP", 0, 0x8961, 0 },
{ "linux/sockios.h", "SIOCGSKNS", 0, 0x894C, 0 },
{ "linux/sockios.h", "SIOCOUTQNSD", 0, 0x894B, 0 },
{ "linux/sockios.h", "SIOCPROTOPRIVATE", 0, 0x89E0, 0 },
{ "linux/sockios.h", "SIOCRTMSG", 0, 0x890D, 0 },
@ -2013,6 +1950,12 @@
{ "linux/suspend_ioctls.h", "SNAPSHOT_S2RAM", _IOC_NONE, 0x330b, 0x00 },
{ "linux/suspend_ioctls.h", "SNAPSHOT_SET_SWAP_AREA", _IOC_WRITE, 0x330d, 0x0c },
{ "linux/suspend_ioctls.h", "SNAPSHOT_UNFREEZE", _IOC_NONE, 0x3302, 0x00 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_EVENT_CTL", _IOC_READ|_IOC_WRITE, 0x5743, 0x28 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_EVENT_SUMMARY", _IOC_READ, 0x5742, 0x198 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_FLASH_INFO", _IOC_READ, 0x5740, 0x10 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_FLASH_PART_INFO", _IOC_READ|_IOC_WRITE, 0x5741, 0x10 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_PFF_TO_PORT", _IOC_READ|_IOC_WRITE, 0x5744, 0x0c },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_PORT_TO_PFF", _IOC_READ|_IOC_WRITE, 0x5745, 0x0c },
{ "linux/sync_file.h", "SYNC_IOC_FILE_INFO", _IOC_READ|_IOC_WRITE, 0x3e04, 0x38 },
{ "linux/sync_file.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e03, 0x30 },
{ "linux/synclink.h", "MGSL_IOCCLRMODCOUNT", _IOC_NONE, 0x6d0f, 0x00 },
@ -2035,6 +1978,14 @@
{ "linux/synclink.h", "MGSL_IOCTXENABLE", _IOC_NONE, 0x6d04, 0x00 },
{ "linux/synclink.h", "MGSL_IOCWAITEVENT", _IOC_READ|_IOC_WRITE, 0x6d08, 0x04 },
{ "linux/synclink.h", "MGSL_IOCWAITGPIO", _IOC_READ|_IOC_WRITE, 0x6d12, 0x10 },
{ "linux/tee.h", "TEE_IOC_CANCEL", _IOC_READ, 0xa404, 0x08 },
{ "linux/tee.h", "TEE_IOC_CLOSE_SESSION", _IOC_READ, 0xa405, 0x04 },
{ "linux/tee.h", "TEE_IOC_INVOKE", _IOC_READ, 0xa403, 0x10 },
{ "linux/tee.h", "TEE_IOC_OPEN_SESSION", _IOC_READ, 0xa402, 0x10 },
{ "linux/tee.h", "TEE_IOC_SHM_ALLOC", _IOC_READ|_IOC_WRITE, 0xa401, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
@ -2244,6 +2195,8 @@
{ "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
{ "linux/vhost.h", "VHOST_SET_VRING_KICK", _IOC_WRITE, 0xaf20, 0x08 },
{ "linux/vhost.h", "VHOST_SET_VRING_NUM", _IOC_WRITE, 0xaf10, 0x08 },
{ "linux/vhost.h", "VHOST_VSOCK_SET_GUEST_CID", _IOC_WRITE, 0xaf60, 0x08 },
{ "linux/vhost.h", "VHOST_VSOCK_SET_RUNNING", _IOC_WRITE, 0xaf61, 0x04 },
{ "linux/videodev2.h", "VIDIOC_CREATE_BUFS", _IOC_READ|_IOC_WRITE, 0x565c, 0xf8 },
{ "linux/videodev2.h", "VIDIOC_CROPCAP", _IOC_READ|_IOC_WRITE, 0x563a, 0x2c },
{ "linux/videodev2.h", "VIDIOC_DBG_G_CHIP_INFO", _IOC_READ|_IOC_WRITE, 0x5666, 0xc8 },
@ -2348,7 +2301,6 @@
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_SOCKETS_VERSION", _IOC_NONE, 0x07b4, 0x00 },
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_VERSION", _IOC_NONE, 0x079f, 0x00 },
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_VERSION2", _IOC_NONE, 0x07a7, 0x00 },
{ "linux/vsp1.h", "VIDIOC_VSP1_LUT_CONFIG", _IOC_READ|_IOC_WRITE, 0x56c1, 0x400 },
{ "linux/vt.h", "VT_ACTIVATE", 0, 0x5606, 0 },
{ "linux/vt.h", "VT_DISALLOCATE", 0, 0x5608, 0 },
{ "linux/vt.h", "VT_GETHIFONTMASK", 0, 0x560D, 0 },
@ -2365,6 +2317,7 @@
{ "linux/vt.h", "VT_UNLOCKSWITCH", 0, 0x560C, 0 },
{ "linux/vt.h", "VT_WAITACTIVE", 0, 0x5607, 0 },
{ "linux/vt.h", "VT_WAITEVENT", 0, 0x560E, 0 },
{ "linux/vtpm_proxy.h", "VTPM_PROXY_IOC_NEW_DEV", _IOC_READ|_IOC_WRITE, 0xa100, 0x14 },
{ "linux/watchdog.h", "WDIOC_GETBOOTSTATUS", _IOC_READ, 0x5702, 0x04 },
{ "linux/watchdog.h", "WDIOC_GETPRETIMEOUT", _IOC_READ, 0x5709, 0x04 },
{ "linux/watchdog.h", "WDIOC_GETSTATUS", _IOC_READ, 0x5701, 0x04 },
@ -2513,23 +2466,23 @@
{ "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
{ "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
@ -2761,18 +2714,8 @@
{ "staging/android/ashmem.h", "ASHMEM_SET_PROT_MASK", _IOC_WRITE, 0x7705, 0x04 },
{ "staging/android/ashmem.h", "ASHMEM_SET_SIZE", _IOC_WRITE, 0x7703, 0x04 },
{ "staging/android/ashmem.h", "ASHMEM_UNPIN", _IOC_WRITE, 0x7708, 0x08 },
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x14 },
{ "staging/android/ion.h", "ION_IOC_CUSTOM", _IOC_READ|_IOC_WRITE, 0x4906, 0x08 },
{ "staging/android/ion.h", "ION_IOC_FREE", _IOC_READ|_IOC_WRITE, 0x4901, 0x04 },
{ "staging/android/ion.h", "ION_IOC_IMPORT", _IOC_READ|_IOC_WRITE, 0x4905, 0x08 },
{ "staging/android/ion.h", "ION_IOC_MAP", _IOC_READ|_IOC_WRITE, 0x4902, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SHARE", _IOC_READ|_IOC_WRITE, 0x4904, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SYNC", _IOC_READ|_IOC_WRITE, 0x4907, 0x08 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_DMA_MAPPING", _IOC_WRITE, 0x49f1, 0x20 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_KERNEL_MAPPING", _IOC_WRITE, 0x49f2, 0x20 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_SET_FD", _IOC_NONE, 0x49f0, 0x00 },
{ "staging/android/sw_sync.h", "SW_SYNC_IOC_CREATE_FENCE", _IOC_READ|_IOC_WRITE, 0x5700, 0x28 },
{ "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x18 },
{ "staging/android/ion.h", "ION_IOC_HEAP_QUERY", _IOC_READ|_IOC_WRITE, 0x4908, 0x18 },
{ "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
{ "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
{ "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
@ -2813,6 +2756,7 @@
{ "xen/evtchn.h", "IOCTL_EVTCHN_BIND_VIRQ", _IOC_NONE, 0x4500, 0x04 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_NOTIFY", _IOC_NONE, 0x4504, 0x04 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_RESET", _IOC_NONE, 0x4505, 0x00 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_RESTRICT_DOMID", _IOC_NONE, 0x4506, 0x02 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_UNBIND", _IOC_NONE, 0x4503, 0x04 },
{ "xen/gntdev.h", "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", _IOC_NONE, 0x4702, 0x18 },
{ "xen/gntdev.h", "IOCTL_GNTDEV_GRANT_COPY", _IOC_NONE, 0x4708, 0x08 },

View File

@ -1,8 +1,8 @@
#ifndef sys_ARCH_mmap
# define sys_ARCH_mmap sys_mmap
#endif
[ 0] = { 2, 0, SEN(io_setup), "io_setup" },
[ 1] = { 1, 0, SEN(io_destroy), "io_destroy" },
[ 0] = { 2, TM, SEN(io_setup), "io_setup" },
[ 1] = { 1, TM, SEN(io_destroy), "io_destroy" },
[ 2] = { 3, 0, SEN(io_submit), "io_submit" },
[ 3] = { 3, 0, SEN(io_cancel), "io_cancel" },
[ 4] = { 5, 0, SEN(io_getevents), "io_getevents" },
@ -44,8 +44,8 @@
[ 40] = { 5, TF, SEN(mount), "mount" },
[ 41] = { 2, TF, SEN(pivotroot), "pivot_root" },
[ 42] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[ 43] = { 3, TF, SEN(statfs64), "statfs64" },
[ 44] = { 3, TD, SEN(fstatfs64), "fstatfs64" },
[ 43] = { 3, TF|TSF|TSFA, SEN(statfs64), "statfs64" },
[ 44] = { 3, TD|TFSF|TSFA, SEN(fstatfs64), "fstatfs64" },
[ 45] = { 3, TF, SEN(truncate64), "truncate64" },
[ 46] = { 3, TD, SEN(ftruncate64), "ftruncate64" },
[ 47] = { 6, TD, SEN(fallocate), "fallocate" },
@ -80,8 +80,8 @@
[ 76] = { 6, TD, SEN(splice), "splice" },
[ 77] = { 4, TD, SEN(tee), "tee" },
[ 78] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[ 79] = { 4, TD|TF, SEN(newfstatat), "fstatat64" },
[ 80] = { 2, TD, SEN(fstat64), "fstat64" },
[ 79] = { 4, TD|TF|TFST|TSTA,SEN(fstatat64), "fstatat64" },
[ 80] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat64" },
[ 81] = { 0, 0, SEN(sync), "sync" },
[ 82] = { 1, TD, SEN(fsync), "fsync" },
[ 83] = { 1, TD, SEN(fdatasync), "fdatasync" },
@ -267,17 +267,21 @@
[274] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[275] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[276] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[277] = { 3, 0, SEN(seccomp), "seccomp", },
[278] = { 3, 0, SEN(getrandom), "getrandom", },
[279] = { 2, TD, SEN(memfd_create), "memfd_create", },
[280] = { 3, TD, SEN(bpf), "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
[283] = { 2, 0, SEN(membarrier), "membarrier", },
[277] = { 3, 0, SEN(seccomp), "seccomp" },
[278] = { 3, 0, SEN(getrandom), "getrandom" },
[279] = { 2, TD, SEN(memfd_create), "memfd_create" },
[280] = { 3, TD, SEN(bpf), "bpf" },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[283] = { 2, 0, SEN(membarrier), "membarrier" },
[284] = { 3, TM, SEN(mlock2), "mlock2" },
[285] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[286] = { 6, TD, SEN(preadv2), "preadv2" },
[287] = { 6, TD, SEN(pwritev2), "pwritev2" },
[288] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[289] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[290] = { 1, 0, SEN(pkey_free), "pkey_free" },
[291] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
#undef sys_ARCH_mmap
#undef ARCH_WANT_SYNC_FILE_RANGE2

View File

@ -93,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x20 },
{ "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@ -185,7 +186,7 @@
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x30 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x38 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
@ -232,6 +233,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_ENTERVT", _IOC_NONE, 0x6459, 0x00 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER", _IOC_WRITE, 0x6454, 0x28 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER2", _IOC_WRITE, 0x6469, 0x40 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER2_WR", _IOC_READ|_IOC_WRITE, 0x6469, 0x40 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_APERTURE", _IOC_READ, 0x6463, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_CACHING", _IOC_READ|_IOC_WRITE, 0x6470, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6462, 0x10 },
@ -263,11 +265,14 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_IRQ_WAIT", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_ATTRS", _IOC_READ|_IOC_WRITE, 0x6468, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_OVERLAY_PUT_IMAGE", _IOC_WRITE, 0x6467, 0x2c },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_VBLANK_PIPE", _IOC_WRITE, 0x644d, 0x04 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_VBLANK_SWAP", _IOC_READ|_IOC_WRITE, 0x644f, 0x0c },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_DISABLE", _IOC_NONE, 0x6901, 0x00 },
{ "drm/i915_drm.h", "I915_PERF_IOCTL_ENABLE", _IOC_NONE, 0x6900, 0x00 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_BLIT", _IOC_WRITE, 0x6448, 0x34 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_CLEAR", _IOC_WRITE, 0x6444, 0x14 },
{ "drm/mga_drm.h", "DRM_IOCTL_MGA_DMA_BOOTSTRAP", _IOC_READ|_IOC_WRITE, 0x644c, 0x20 },
@ -284,8 +289,9 @@
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_CPU_FINI", _IOC_WRITE, 0x6445, 0x04 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6448, 0x0c },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x20 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x28 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
{ "drm/msm_drm.h", "DRM_IOCTL_MSM_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x18 },
{ "drm/nouveau_drm.h", "DRM_IOCTL_NOUVEAU_GEM_CPU_FINI", _IOC_WRITE, 0x6483, 0x04 },
@ -392,10 +398,13 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_SIGNAL", _IOC_WRITE, 0x6442, 0x08 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_AGP_INIT", _IOC_READ|_IOC_WRITE, 0x6442, 0x08 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_ALLOCMEM", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 },
{ "drm/via_drm.h", "DRM_IOCTL_VIA_BLIT_SYNC", _IOC_WRITE, 0x644f, 0x08 },
@ -446,8 +455,10 @@
{ "linux/android/binder.h", "BC_REGISTER_LOOPER", _IOC_NONE, 0x630b, 0x00 },
{ "linux/android/binder.h", "BC_RELEASE", _IOC_WRITE, 0x6306, 0x04 },
{ "linux/android/binder.h", "BC_REPLY", _IOC_WRITE, 0x6301, 0x40 },
{ "linux/android/binder.h", "BC_REPLY_SG", _IOC_WRITE, 0x6312, 0x48 },
{ "linux/android/binder.h", "BC_REQUEST_DEATH_NOTIFICATION", _IOC_WRITE, 0x630e, 0x0c },
{ "linux/android/binder.h", "BC_TRANSACTION", _IOC_WRITE, 0x6300, 0x40 },
{ "linux/android/binder.h", "BC_TRANSACTION_SG", _IOC_WRITE, 0x6311, 0x48 },
{ "linux/android/binder.h", "BINDER_SET_CONTEXT_MGR", _IOC_WRITE, 0x6207, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_PRIORITY", _IOC_WRITE, 0x6206, 0x04 },
{ "linux/android/binder.h", "BINDER_SET_IDLE_TIMEOUT", _IOC_WRITE, 0x6203, 0x08 },
@ -477,6 +488,8 @@
{ "linux/apm_bios.h", "APM_IOC_SUSPEND", _IOC_NONE, 0x4102, 0x00 },
{ "linux/arcfb.h", "FBIO_GETCONTROL2", _IOC_READ, 0x4689, 0x08 },
{ "linux/arcfb.h", "FBIO_WAITEVENT", _IOC_NONE, 0x4688, 0x00 },
{ "linux/aspeed-lpc-ctrl.h", "ASPEED_LPC_CTRL_IOCTL_GET_SIZE", _IOC_READ|_IOC_WRITE, 0xb200, 0x10 },
{ "linux/aspeed-lpc-ctrl.h", "ASPEED_LPC_CTRL_IOCTL_MAP", _IOC_WRITE, 0xb201, 0x10 },
{ "linux/atm_eni.h", "ENI_MEMDUMP", _IOC_WRITE, 0x6160, 0x10 },
{ "linux/atm_eni.h", "ENI_SETMULT", _IOC_WRITE, 0x6167, 0x10 },
{ "linux/atm_he.h", "HE_GET_REG", _IOC_WRITE, 0x6160, 0x10 },
@ -553,6 +566,9 @@
{ "linux/auto_fs4.h", "AUTOFS_IOC_EXPIRE_MULTI", _IOC_WRITE, 0x9366, 0x04 },
{ "linux/auto_fs4.h", "AUTOFS_IOC_PROTOSUBVER", _IOC_READ, 0x9367, 0x04 },
{ "linux/blkpg.h", "BLKPG", _IOC_NONE, 0x1269, 0x00 },
{ "linux/blkzoned.h", "BLKREPORTZONE", _IOC_READ|_IOC_WRITE, 0x1282, 0x10 },
{ "linux/blkzoned.h", "BLKRESETZONE", _IOC_WRITE, 0x1283, 0x10 },
{ "linux/bt-bmc.h", "BT_BMC_IOCTL_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/btrfs.h", "BTRFS_IOC_ADD_DEV", _IOC_WRITE, 0x940a, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE", _IOC_WRITE, 0x940c, 0x1000 },
{ "linux/btrfs.h", "BTRFS_IOC_BALANCE_CTL", _IOC_WRITE, 0x9421, 0x04 },
@ -683,6 +699,16 @@
{ "linux/cdrom.h", "DVD_AUTH", 0, 0x5392, 0 },
{ "linux/cdrom.h", "DVD_READ_STRUCT", 0, 0x5390, 0 },
{ "linux/cdrom.h", "DVD_WRITE_STRUCT", 0, 0x5391, 0 },
{ "linux/cec.h", "CEC_ADAP_G_CAPS", _IOC_READ|_IOC_WRITE, 0x6100, 0x4c },
{ "linux/cec.h", "CEC_ADAP_G_LOG_ADDRS", _IOC_READ, 0x6103, 0x5c },
{ "linux/cec.h", "CEC_ADAP_G_PHYS_ADDR", _IOC_READ, 0x6101, 0x02 },
{ "linux/cec.h", "CEC_ADAP_S_LOG_ADDRS", _IOC_READ|_IOC_WRITE, 0x6104, 0x5c },
{ "linux/cec.h", "CEC_ADAP_S_PHYS_ADDR", _IOC_WRITE, 0x6102, 0x02 },
{ "linux/cec.h", "CEC_DQEVENT", _IOC_READ|_IOC_WRITE, 0x6107, 0x50 },
{ "linux/cec.h", "CEC_G_MODE", _IOC_READ, 0x6108, 0x04 },
{ "linux/cec.h", "CEC_RECEIVE", _IOC_READ|_IOC_WRITE, 0x6106, 0x38 },
{ "linux/cec.h", "CEC_S_MODE", _IOC_WRITE, 0x6109, 0x04 },
{ "linux/cec.h", "CEC_TRANSMIT", _IOC_READ|_IOC_WRITE, 0x6105, 0x38 },
{ "linux/chio.h", "CHIOEXCHANGE", _IOC_WRITE, 0x6302, 0x1c },
{ "linux/chio.h", "CHIOGELEM", _IOC_WRITE, 0x6310, 0x6c },
{ "linux/chio.h", "CHIOGPARAMS", _IOC_READ, 0x6306, 0x14 },
@ -951,6 +977,7 @@
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_START", _IOC_READ|_IOC_WRITE, 0xaf03, 0x10 },
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_STOP", _IOC_READ|_IOC_WRITE, 0xaf04, 0x08 },
{ "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_SETPROP", _IOC_READ|_IOC_WRITE, 0xaf08, 0x28 },
{ "linux/fsmap.h", "FS_IOC_GETFSMAP", _IOC_READ|_IOC_WRITE, 0x583b, 0xc0 },
{ "linux/fuse.h", "FUSE_DEV_IOC_CLONE", _IOC_READ, 0xe500, 0x04 },
{ "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_DDCB", _IOC_READ|_IOC_WRITE, 0xa532, 0xe8 },
{ "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_RAW_DDCB", _IOC_READ|_IOC_WRITE, 0xa533, 0xe8 },
@ -969,7 +996,11 @@
{ "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
{ "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
{ "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
{ "linux/gpio.h", "GPIOHANDLE_GET_LINE_VALUES_IOCTL", _IOC_READ|_IOC_WRITE, 0xb408, 0x40 },
{ "linux/gpio.h", "GPIOHANDLE_SET_LINE_VALUES_IOCTL", _IOC_READ|_IOC_WRITE, 0xb409, 0x40 },
{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
{ "linux/gpio.h", "GPIO_GET_LINEEVENT_IOCTL", _IOC_READ|_IOC_WRITE, 0xb404, 0x30 },
{ "linux/gpio.h", "GPIO_GET_LINEHANDLE_IOCTL", _IOC_READ|_IOC_WRITE, 0xb403, 0x16c },
{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
{ "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
{ "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
@ -1293,123 +1324,9 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ARM_VCPU_INIT", _IOC_WRITE, 0xaeae, 0x20 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_PCI_DEVICE", _IOC_READ, 0xae69, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_INTX_MASK", _IOC_WRITE, 0xaea4, 0x40 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_ENTRY", _IOC_WRITE, 0xae74, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_SET_MSIX_NR", _IOC_WRITE, 0xae73, 0x08 },
{ "linux/kvm.h", "KVM_CHECK_EXTENSION", _IOC_NONE, 0xae03, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_DEVICE", _IOC_READ|_IOC_WRITE, 0xaee0, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_IRQCHIP", _IOC_NONE, 0xae60, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
{ "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
{ "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
{ "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
{ "linux/kvm.h", "KVM_DEASSIGN_PCI_DEVICE", _IOC_WRITE, 0xae72, 0x40 },
{ "linux/kvm.h", "KVM_DIRTY_TLB", _IOC_WRITE, 0xaeaa, 0x10 },
{ "linux/kvm.h", "KVM_ENABLE_CAP", _IOC_WRITE, 0xaea3, 0x68 },
{ "linux/kvm.h", "KVM_GET_API_VERSION", _IOC_NONE, 0xae00, 0x00 },
{ "linux/kvm.h", "KVM_GET_CLOCK", _IOC_READ, 0xae7c, 0x30 },
{ "linux/kvm.h", "KVM_GET_CPUID2", _IOC_READ|_IOC_WRITE, 0xae91, 0x08 },
{ "linux/kvm.h", "KVM_GET_DEBUGREGS", _IOC_READ, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_GET_DEVICE_ATTR", _IOC_WRITE, 0xaee2, 0x18 },
{ "linux/kvm.h", "KVM_GET_DIRTY_LOG", _IOC_WRITE, 0xae42, 0x10 },
{ "linux/kvm.h", "KVM_GET_EMULATED_CPUID", _IOC_READ|_IOC_WRITE, 0xae09, 0x08 },
{ "linux/kvm.h", "KVM_GET_FPU", _IOC_READ, 0xae8c, 0x1a0 },
{ "linux/kvm.h", "KVM_GET_IRQCHIP", _IOC_READ|_IOC_WRITE, 0xae62, 0x208 },
{ "linux/kvm.h", "KVM_GET_LAPIC", _IOC_READ, 0xae8e, 0x400 },
{ "linux/kvm.h", "KVM_GET_MP_STATE", _IOC_READ, 0xae98, 0x04 },
{ "linux/kvm.h", "KVM_GET_MSRS", _IOC_READ|_IOC_WRITE, 0xae88, 0x08 },
{ "linux/kvm.h", "KVM_GET_MSR_INDEX_LIST", _IOC_READ|_IOC_WRITE, 0xae02, 0x04 },
{ "linux/kvm.h", "KVM_GET_NR_MMU_PAGES", _IOC_NONE, 0xae45, 0x00 },
{ "linux/kvm.h", "KVM_GET_ONE_REG", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_GET_PIT", _IOC_READ|_IOC_WRITE, 0xae65, 0x48 },
{ "linux/kvm.h", "KVM_GET_PIT2", _IOC_READ, 0xae9f, 0x70 },
{ "linux/kvm.h", "KVM_GET_REGS", _IOC_READ, 0xae81, 0x90 },
{ "linux/kvm.h", "KVM_GET_REG_LIST", _IOC_READ|_IOC_WRITE, 0xaeb0, 0x08 },
{ "linux/kvm.h", "KVM_GET_SREGS", _IOC_READ, 0xae83, 0x138 },
{ "linux/kvm.h", "KVM_GET_SUPPORTED_CPUID", _IOC_READ|_IOC_WRITE, 0xae05, 0x08 },
{ "linux/kvm.h", "KVM_GET_TSC_KHZ", _IOC_NONE, 0xaea3, 0x00 },
{ "linux/kvm.h", "KVM_GET_VCPU_EVENTS", _IOC_READ, 0xae9f, 0x40 },
{ "linux/kvm.h", "KVM_GET_VCPU_MMAP_SIZE", _IOC_NONE, 0xae04, 0x00 },
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },
{ "linux/kvm.h", "KVM_IRQ_LINE", _IOC_WRITE, 0xae61, 0x08 },
{ "linux/kvm.h", "KVM_IRQ_LINE_STATUS", _IOC_READ|_IOC_WRITE, 0xae67, 0x08 },
{ "linux/kvm.h", "KVM_KVMCLOCK_CTRL", _IOC_NONE, 0xaead, 0x00 },
{ "linux/kvm.h", "KVM_NMI", _IOC_NONE, 0xae9a, 0x00 },
{ "linux/kvm.h", "KVM_PPC_ALLOCATE_HTAB", _IOC_READ|_IOC_WRITE, 0xaea7, 0x04 },
{ "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
{ "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
{ "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
{ "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
{ "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x08 },
{ "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
{ "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
{ "linux/kvm.h", "KVM_S390_VCPU_FAULT", _IOC_WRITE, 0xae52, 0x08 },
{ "linux/kvm.h", "KVM_SET_BOOT_CPU_ID", _IOC_NONE, 0xae78, 0x00 },
{ "linux/kvm.h", "KVM_SET_CLOCK", _IOC_WRITE, 0xae7b, 0x30 },
{ "linux/kvm.h", "KVM_SET_CPUID", _IOC_WRITE, 0xae8a, 0x08 },
{ "linux/kvm.h", "KVM_SET_CPUID2", _IOC_WRITE, 0xae90, 0x08 },
{ "linux/kvm.h", "KVM_SET_DEBUGREGS", _IOC_WRITE, 0xaea2, 0x80 },
{ "linux/kvm.h", "KVM_SET_DEVICE_ATTR", _IOC_WRITE, 0xaee1, 0x18 },
{ "linux/kvm.h", "KVM_SET_FPU", _IOC_WRITE, 0xae8d, 0x1a0 },
{ "linux/kvm.h", "KVM_SET_GSI_ROUTING", _IOC_WRITE, 0xae6a, 0x08 },
{ "linux/kvm.h", "KVM_SET_GUEST_DEBUG", _IOC_WRITE, 0xae9b, 0x48 },
{ "linux/kvm.h", "KVM_SET_IDENTITY_MAP_ADDR", _IOC_WRITE, 0xae48, 0x08 },
{ "linux/kvm.h", "KVM_SET_IRQCHIP", _IOC_READ, 0xae63, 0x208 },
{ "linux/kvm.h", "KVM_SET_LAPIC", _IOC_WRITE, 0xae8f, 0x400 },
{ "linux/kvm.h", "KVM_SET_MEMORY_ALIAS", _IOC_WRITE, 0xae43, 0x20 },
{ "linux/kvm.h", "KVM_SET_MEMORY_REGION", _IOC_WRITE, 0xae40, 0x18 },
{ "linux/kvm.h", "KVM_SET_MP_STATE", _IOC_WRITE, 0xae99, 0x04 },
{ "linux/kvm.h", "KVM_SET_MSRS", _IOC_WRITE, 0xae89, 0x08 },
{ "linux/kvm.h", "KVM_SET_NR_MMU_PAGES", _IOC_NONE, 0xae44, 0x00 },
{ "linux/kvm.h", "KVM_SET_ONE_REG", _IOC_WRITE, 0xaeac, 0x10 },
{ "linux/kvm.h", "KVM_SET_PIT", _IOC_READ, 0xae66, 0x48 },
{ "linux/kvm.h", "KVM_SET_PIT2", _IOC_WRITE, 0xaea0, 0x70 },
{ "linux/kvm.h", "KVM_SET_REGS", _IOC_WRITE, 0xae82, 0x90 },
{ "linux/kvm.h", "KVM_SET_SIGNAL_MASK", _IOC_WRITE, 0xae8b, 0x04 },
{ "linux/kvm.h", "KVM_SET_SREGS", _IOC_WRITE, 0xae84, 0x138 },
{ "linux/kvm.h", "KVM_SET_TSC_KHZ", _IOC_NONE, 0xaea2, 0x00 },
{ "linux/kvm.h", "KVM_SET_TSS_ADDR", _IOC_NONE, 0xae47, 0x00 },
{ "linux/kvm.h", "KVM_SET_USER_MEMORY_REGION", _IOC_WRITE, 0xae46, 0x20 },
{ "linux/kvm.h", "KVM_SET_VAPIC_ADDR", _IOC_WRITE, 0xae93, 0x08 },
{ "linux/kvm.h", "KVM_SET_VCPU_EVENTS", _IOC_WRITE, 0xaea0, 0x40 },
{ "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
{ "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
{ "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
{ "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
{ "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
{ "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
{ "linux/kvm.h", "KVM_X86_GET_MCE_CAP_SUPPORTED", _IOC_READ, 0xae9d, 0x08 },
{ "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
{ "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
{ "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_IO_VIO", _IOC_READ|_IOC_WRITE, 0x4c43, 0x50 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_SUBMIT_VIO", _IOC_READ|_IOC_WRITE, 0x4c42, 0x40 },
{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
@ -1418,30 +1335,14 @@
{ "linux/lightnvm.h", "NVM_INFO", _IOC_READ|_IOC_WRITE, 0x4c20, 0x1000 },
{ "linux/lirc.h", "LIRC_GET_FEATURES", _IOC_READ, 0x6900, 0x04 },
{ "linux/lirc.h", "LIRC_GET_LENGTH", _IOC_READ, 0x690f, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_PULSE", _IOC_READ, 0x690b, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_SPACE", _IOC_READ, 0x690d, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MAX_TIMEOUT", _IOC_READ, 0x6909, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_PULSE", _IOC_READ, 0x690a, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_SPACE", _IOC_READ, 0x690c, 0x04 },
{ "linux/lirc.h", "LIRC_GET_MIN_TIMEOUT", _IOC_READ, 0x6908, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_CARRIER", _IOC_READ, 0x6904, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_DUTY_CYCLE", _IOC_READ, 0x6906, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_MODE", _IOC_READ, 0x6902, 0x04 },
{ "linux/lirc.h", "LIRC_GET_REC_RESOLUTION", _IOC_READ, 0x6907, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_CARRIER", _IOC_READ, 0x6903, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_DUTY_CYCLE", _IOC_READ, 0x6905, 0x04 },
{ "linux/lirc.h", "LIRC_GET_SEND_MODE", _IOC_READ, 0x6901, 0x04 },
{ "linux/lirc.h", "LIRC_NOTIFY_DECODE", _IOC_NONE, 0x6920, 0x00 },
{ "linux/lirc.h", "LIRC_SETUP_END", _IOC_NONE, 0x6922, 0x00 },
{ "linux/lirc.h", "LIRC_SETUP_START", _IOC_NONE, 0x6921, 0x00 },
{ "linux/lirc.h", "LIRC_SET_MEASURE_CARRIER_MODE", _IOC_WRITE, 0x691d, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_CARRIER", _IOC_WRITE, 0x6914, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_CARRIER_RANGE", _IOC_WRITE, 0x691f, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE", _IOC_WRITE, 0x6916, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE_RANGE", _IOC_WRITE, 0x691e, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER", _IOC_WRITE, 0x691c, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER_PULSE", _IOC_WRITE, 0x691a, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_FILTER_SPACE", _IOC_WRITE, 0x691b, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_MODE", _IOC_WRITE, 0x6912, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT", _IOC_WRITE, 0x6918, 0x04 },
{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT_REPORTS", _IOC_WRITE, 0x6919, 0x04 },
@ -1553,19 +1454,23 @@
{ "linux/ndctl.h", "ND_IOCTL_SMART", _IOC_READ|_IOC_WRITE, 0x4e01, 0x84 },
{ "linux/ndctl.h", "ND_IOCTL_SMART_THRESHOLD", _IOC_READ|_IOC_WRITE, 0x4e02, 0x0c },
{ "linux/ndctl.h", "ND_IOCTL_VENDOR", _IOC_READ|_IOC_WRITE, 0x4e09, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_BDESCS", _IOC_READ|_IOC_WRITE, 0x6e87, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_CPINFO", _IOC_READ, 0x6e82, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_CPSTAT", _IOC_READ, 0x6e83, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_SUINFO", _IOC_READ, 0x6e84, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_SUSTAT", _IOC_READ, 0x6e85, 0x30 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_GET_VINFO", _IOC_READ|_IOC_WRITE, 0x6e86, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_RESIZE", _IOC_WRITE, 0x6e8b, 0x08 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_fs.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_BDESCS", _IOC_READ|_IOC_WRITE, 0x6e87, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_CPINFO", _IOC_READ, 0x6e82, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_CPSTAT", _IOC_READ, 0x6e83, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_SUINFO", _IOC_READ, 0x6e84, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_SUSTAT", _IOC_READ, 0x6e85, 0x30 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_GET_VINFO", _IOC_READ|_IOC_WRITE, 0x6e86, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_RESIZE", _IOC_WRITE, 0x6e8b, 0x08 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
{ "linux/nilfs2_api.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
{ "linux/nsfs.h", "NS_GET_NSTYPE", _IOC_NONE, 0xb703, 0x00 },
{ "linux/nsfs.h", "NS_GET_OWNER_UID", _IOC_NONE, 0xb704, 0x00 },
{ "linux/nsfs.h", "NS_GET_PARENT", _IOC_NONE, 0xb702, 0x00 },
{ "linux/nsfs.h", "NS_GET_USERNS", _IOC_NONE, 0xb701, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
@ -1605,6 +1510,12 @@
{ "linux/omapfb.h", "OMAPFB_VSYNC", _IOC_NONE, 0x4f26, 0x00 },
{ "linux/omapfb.h", "OMAPFB_WAITFORGO", _IOC_NONE, 0x4f3c, 0x00 },
{ "linux/omapfb.h", "OMAPFB_WAITFORVSYNC", _IOC_NONE, 0x4f39, 0x00 },
{ "linux/pcitest.h", "PCITEST_BAR", _IOC_NONE, 0x5001, 0x00 },
{ "linux/pcitest.h", "PCITEST_COPY", _IOC_WRITE, 0x5006, 0x08 },
{ "linux/pcitest.h", "PCITEST_LEGACY_IRQ", _IOC_NONE, 0x5002, 0x00 },
{ "linux/pcitest.h", "PCITEST_MSI", _IOC_WRITE, 0x5003, 0x04 },
{ "linux/pcitest.h", "PCITEST_READ", _IOC_WRITE, 0x5005, 0x08 },
{ "linux/pcitest.h", "PCITEST_WRITE", _IOC_WRITE, 0x5004, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x08 },
@ -1739,6 +1650,17 @@
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
{ "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x08 },
{ "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_ACCEPT", _IOC_READ|_IOC_WRITE, 0x6307, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_BIND", _IOC_WRITE, 0x6305, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CLOSE", _IOC_WRITE, 0x6304, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CONNECT", _IOC_WRITE, 0x6308, 0x08 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_CREATE", _IOC_READ|_IOC_WRITE, 0x6303, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_LISTEN", _IOC_WRITE, 0x6306, 0x02 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_RECEIVE", _IOC_READ|_IOC_WRITE, 0x630a, 0x10 },
{ "linux/rio_cm_cdev.h", "RIO_CM_CHAN_SEND", _IOC_WRITE, 0x6309, 0x10 },
{ "linux/rio_cm_cdev.h", "RIO_CM_EP_GET_LIST", _IOC_READ|_IOC_WRITE, 0x6302, 0x04 },
{ "linux/rio_cm_cdev.h", "RIO_CM_EP_GET_LIST_SIZE", _IOC_READ|_IOC_WRITE, 0x6301, 0x04 },
{ "linux/rio_cm_cdev.h", "RIO_CM_MPORT_GET_LIST", _IOC_READ|_IOC_WRITE, 0x630b, 0x04 },
{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
@ -1763,6 +1685,8 @@
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
{ "linux/rpmsg.h", "RPMSG_CREATE_EPT_IOCTL", _IOC_WRITE, 0xb501, 0x28 },
{ "linux/rpmsg.h", "RPMSG_DESTROY_EPT_IOCTL", _IOC_NONE, 0xb502, 0x00 },
{ "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
{ "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
{ "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@ -1802,6 +1726,18 @@
{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x28 },
{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x28 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_LSP", _IOC_WRITE, 0x70df, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ACTIVATE_USR", _IOC_WRITE, 0x70e1, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ADD_USR_TO_LR", _IOC_WRITE, 0x70e4, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_ENABLE_DISABLE_MBR", _IOC_WRITE, 0x70e5, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_ERASE_LR", _IOC_WRITE, 0x70e6, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_LOCK_UNLOCK", _IOC_WRITE, 0x70dd, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_LR_SETUP", _IOC_WRITE, 0x70e3, 0x128 },
{ "linux/sed-opal.h", "IOC_OPAL_REVERT_TPR", _IOC_WRITE, 0x70e2, 0x108 },
{ "linux/sed-opal.h", "IOC_OPAL_SAVE", _IOC_WRITE, 0x70dc, 0x118 },
{ "linux/sed-opal.h", "IOC_OPAL_SECURE_ERASE_LR", _IOC_WRITE, 0x70e7, 0x110 },
{ "linux/sed-opal.h", "IOC_OPAL_SET_PW", _IOC_WRITE, 0x70e0, 0x220 },
{ "linux/sed-opal.h", "IOC_OPAL_TAKE_OWNERSHIP", _IOC_WRITE, 0x70de, 0x108 },
{ "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x08 },
{ "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
{ "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@ -1849,6 +1785,7 @@
{ "linux/sockios.h", "SIOCGMIIPHY", 0, 0x8947, 0 },
{ "linux/sockios.h", "SIOCGMIIREG", 0, 0x8948, 0 },
{ "linux/sockios.h", "SIOCGRARP", 0, 0x8961, 0 },
{ "linux/sockios.h", "SIOCGSKNS", 0, 0x894C, 0 },
{ "linux/sockios.h", "SIOCOUTQNSD", 0, 0x894B, 0 },
{ "linux/sockios.h", "SIOCPROTOPRIVATE", 0, 0x89E0, 0 },
{ "linux/sockios.h", "SIOCRTMSG", 0, 0x890D, 0 },
@ -2013,6 +1950,12 @@
{ "linux/suspend_ioctls.h", "SNAPSHOT_S2RAM", _IOC_NONE, 0x330b, 0x00 },
{ "linux/suspend_ioctls.h", "SNAPSHOT_SET_SWAP_AREA", _IOC_WRITE, 0x330d, 0x0c },
{ "linux/suspend_ioctls.h", "SNAPSHOT_UNFREEZE", _IOC_NONE, 0x3302, 0x00 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_EVENT_CTL", _IOC_READ|_IOC_WRITE, 0x5743, 0x28 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_EVENT_SUMMARY", _IOC_READ, 0x5742, 0x198 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_FLASH_INFO", _IOC_READ, 0x5740, 0x10 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_FLASH_PART_INFO", _IOC_READ|_IOC_WRITE, 0x5741, 0x10 },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_PFF_TO_PORT", _IOC_READ|_IOC_WRITE, 0x5744, 0x0c },
{ "linux/switchtec_ioctl.h", "SWITCHTEC_IOCTL_PORT_TO_PFF", _IOC_READ|_IOC_WRITE, 0x5745, 0x0c },
{ "linux/sync_file.h", "SYNC_IOC_FILE_INFO", _IOC_READ|_IOC_WRITE, 0x3e04, 0x38 },
{ "linux/sync_file.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e03, 0x30 },
{ "linux/synclink.h", "MGSL_IOCCLRMODCOUNT", _IOC_NONE, 0x6d0f, 0x00 },
@ -2035,6 +1978,14 @@
{ "linux/synclink.h", "MGSL_IOCTXENABLE", _IOC_NONE, 0x6d04, 0x00 },
{ "linux/synclink.h", "MGSL_IOCWAITEVENT", _IOC_READ|_IOC_WRITE, 0x6d08, 0x04 },
{ "linux/synclink.h", "MGSL_IOCWAITGPIO", _IOC_READ|_IOC_WRITE, 0x6d12, 0x10 },
{ "linux/tee.h", "TEE_IOC_CANCEL", _IOC_READ, 0xa404, 0x08 },
{ "linux/tee.h", "TEE_IOC_CLOSE_SESSION", _IOC_READ, 0xa405, 0x04 },
{ "linux/tee.h", "TEE_IOC_INVOKE", _IOC_READ, 0xa403, 0x10 },
{ "linux/tee.h", "TEE_IOC_OPEN_SESSION", _IOC_READ, 0xa402, 0x10 },
{ "linux/tee.h", "TEE_IOC_SHM_ALLOC", _IOC_READ|_IOC_WRITE, 0xa401, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
@ -2244,6 +2195,8 @@
{ "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
{ "linux/vhost.h", "VHOST_SET_VRING_KICK", _IOC_WRITE, 0xaf20, 0x08 },
{ "linux/vhost.h", "VHOST_SET_VRING_NUM", _IOC_WRITE, 0xaf10, 0x08 },
{ "linux/vhost.h", "VHOST_VSOCK_SET_GUEST_CID", _IOC_WRITE, 0xaf60, 0x08 },
{ "linux/vhost.h", "VHOST_VSOCK_SET_RUNNING", _IOC_WRITE, 0xaf61, 0x04 },
{ "linux/videodev2.h", "VIDIOC_CREATE_BUFS", _IOC_READ|_IOC_WRITE, 0x565c, 0x100 },
{ "linux/videodev2.h", "VIDIOC_CROPCAP", _IOC_READ|_IOC_WRITE, 0x563a, 0x2c },
{ "linux/videodev2.h", "VIDIOC_DBG_G_CHIP_INFO", _IOC_READ|_IOC_WRITE, 0x5666, 0xc8 },
@ -2348,7 +2301,6 @@
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_SOCKETS_VERSION", _IOC_NONE, 0x07b4, 0x00 },
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_VERSION", _IOC_NONE, 0x079f, 0x00 },
{ "linux/vmw_vmci_defs.h", "IOCTL_VMCI_VERSION2", _IOC_NONE, 0x07a7, 0x00 },
{ "linux/vsp1.h", "VIDIOC_VSP1_LUT_CONFIG", _IOC_READ|_IOC_WRITE, 0x56c1, 0x400 },
{ "linux/vt.h", "VT_ACTIVATE", 0, 0x5606, 0 },
{ "linux/vt.h", "VT_DISALLOCATE", 0, 0x5608, 0 },
{ "linux/vt.h", "VT_GETHIFONTMASK", 0, 0x560D, 0 },
@ -2365,6 +2317,7 @@
{ "linux/vt.h", "VT_UNLOCKSWITCH", 0, 0x560C, 0 },
{ "linux/vt.h", "VT_WAITACTIVE", 0, 0x5607, 0 },
{ "linux/vt.h", "VT_WAITEVENT", 0, 0x560E, 0 },
{ "linux/vtpm_proxy.h", "VTPM_PROXY_IOC_NEW_DEV", _IOC_READ|_IOC_WRITE, 0xa100, 0x14 },
{ "linux/watchdog.h", "WDIOC_GETBOOTSTATUS", _IOC_READ, 0x5702, 0x04 },
{ "linux/watchdog.h", "WDIOC_GETPRETIMEOUT", _IOC_READ, 0x5709, 0x04 },
{ "linux/watchdog.h", "WDIOC_GETSTATUS", _IOC_READ, 0x5701, 0x04 },
@ -2513,23 +2466,23 @@
{ "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
{ "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x08 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x08 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/hfi/hfi1_user.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x08 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_RECV_CTRL", _IOC_WRITE, 0x1be8, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_SET_PKEY", _IOC_WRITE, 0x1beb, 0x02 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_FREE", _IOC_READ|_IOC_WRITE, 0x1be5, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_INVAL_READ", _IOC_READ|_IOC_WRITE, 0x1bed, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_TID_UPDATE", _IOC_READ|_IOC_WRITE, 0x1be4, 0x18 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_USER_INFO", _IOC_WRITE, 0x1be3, 0x78 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
@ -2761,18 +2714,8 @@
{ "staging/android/ashmem.h", "ASHMEM_SET_PROT_MASK", _IOC_WRITE, 0x7705, 0x08 },
{ "staging/android/ashmem.h", "ASHMEM_SET_SIZE", _IOC_WRITE, 0x7703, 0x08 },
{ "staging/android/ashmem.h", "ASHMEM_UNPIN", _IOC_WRITE, 0x7708, 0x08 },
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x20 },
{ "staging/android/ion.h", "ION_IOC_CUSTOM", _IOC_READ|_IOC_WRITE, 0x4906, 0x10 },
{ "staging/android/ion.h", "ION_IOC_FREE", _IOC_READ|_IOC_WRITE, 0x4901, 0x04 },
{ "staging/android/ion.h", "ION_IOC_IMPORT", _IOC_READ|_IOC_WRITE, 0x4905, 0x08 },
{ "staging/android/ion.h", "ION_IOC_MAP", _IOC_READ|_IOC_WRITE, 0x4902, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SHARE", _IOC_READ|_IOC_WRITE, 0x4904, 0x08 },
{ "staging/android/ion.h", "ION_IOC_SYNC", _IOC_READ|_IOC_WRITE, 0x4907, 0x08 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_DMA_MAPPING", _IOC_WRITE, 0x49f1, 0x20 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_KERNEL_MAPPING", _IOC_WRITE, 0x49f2, 0x20 },
{ "staging/android/ion_test.h", "ION_IOC_TEST_SET_FD", _IOC_NONE, 0x49f0, 0x00 },
{ "staging/android/sw_sync.h", "SW_SYNC_IOC_CREATE_FENCE", _IOC_READ|_IOC_WRITE, 0x5700, 0x28 },
{ "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
{ "staging/android/ion.h", "ION_IOC_ALLOC", _IOC_READ|_IOC_WRITE, 0x4900, 0x18 },
{ "staging/android/ion.h", "ION_IOC_HEAP_QUERY", _IOC_READ|_IOC_WRITE, 0x4908, 0x18 },
{ "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
{ "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
{ "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
@ -2813,6 +2756,7 @@
{ "xen/evtchn.h", "IOCTL_EVTCHN_BIND_VIRQ", _IOC_NONE, 0x4500, 0x04 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_NOTIFY", _IOC_NONE, 0x4504, 0x04 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_RESET", _IOC_NONE, 0x4505, 0x00 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_RESTRICT_DOMID", _IOC_NONE, 0x4506, 0x02 },
{ "xen/evtchn.h", "IOCTL_EVTCHN_UNBIND", _IOC_NONE, 0x4503, 0x04 },
{ "xen/gntdev.h", "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", _IOC_NONE, 0x4702, 0x18 },
{ "xen/gntdev.h", "IOCTL_GNTDEV_GRANT_COPY", _IOC_NONE, 0x4708, 0x10 },

View File

@ -1,5 +1,5 @@
[ 0] = { 2, 0, SEN(io_setup), "io_setup" },
[ 1] = { 1, 0, SEN(io_destroy), "io_destroy" },
[ 0] = { 2, TM, SEN(io_setup), "io_setup" },
[ 1] = { 1, TM, SEN(io_destroy), "io_destroy" },
[ 2] = { 3, 0, SEN(io_submit), "io_submit" },
[ 3] = { 3, 0, SEN(io_cancel), "io_cancel" },
[ 4] = { 5, 0, SEN(io_getevents), "io_getevents" },
@ -41,8 +41,8 @@
[ 40] = { 5, TF, SEN(mount), "mount" },
[ 41] = { 2, TF, SEN(pivotroot), "pivot_root" },
[ 42] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
[ 43] = { 2, TF, SEN(statfs), "statfs" },
[ 44] = { 2, TD, SEN(fstatfs), "fstatfs" },
[ 43] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" },
[ 44] = { 2, TD|TFSF|TSFA, SEN(fstatfs), "fstatfs" },
[ 45] = { 2, TF, SEN(truncate), "truncate" },
[ 46] = { 2, TD, SEN(ftruncate), "ftruncate" },
[ 47] = { 4, TD, SEN(fallocate), "fallocate" },
@ -77,8 +77,8 @@
[ 76] = { 6, TD, SEN(splice), "splice" },
[ 77] = { 4, TD, SEN(tee), "tee" },
[ 78] = { 4, TD|TF, SEN(readlinkat), "readlinkat" },
[ 79] = { 4, TD|TF, SEN(newfstatat), "newfstatat" },
[ 80] = { 2, TD, SEN(fstat), "fstat" },
[ 79] = { 4, TD|TF|TFST|TSTA,SEN(newfstatat), "newfstatat" },
[ 80] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" },
[ 81] = { 0, 0, SEN(sync), "sync" },
[ 82] = { 1, TD, SEN(fsync), "fsync" },
[ 83] = { 1, TD, SEN(fdatasync), "fdatasync" },
@ -137,7 +137,7 @@
[136] = { 2, TS, SEN(rt_sigpending), "rt_sigpending" },
[137] = { 4, TS, SEN(rt_sigtimedwait), "rt_sigtimedwait" },
[138] = { 3, TS, SEN(rt_sigqueueinfo), "rt_sigqueueinfo" },
[139] = { 0, TS, SEN(sigreturn), "rt_sigreturn" },
[139] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
[140] = { 3, 0, SEN(setpriority), "setpriority" },
[141] = { 2, 0, SEN(getpriority), "getpriority" },
[142] = { 4, 0, SEN(reboot), "reboot" },
@ -260,14 +260,18 @@
[274] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
[275] = { 4, 0, SEN(sched_getattr), "sched_getattr" },
[276] = { 5, TD|TF, SEN(renameat2), "renameat2" },
[277] = { 3, 0, SEN(seccomp), "seccomp", },
[278] = { 3, 0, SEN(getrandom), "getrandom", },
[279] = { 2, TD, SEN(memfd_create), "memfd_create", },
[280] = { 3, TD, SEN(bpf), "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
[283] = { 2, 0, SEN(membarrier), "membarrier", },
[277] = { 3, 0, SEN(seccomp), "seccomp" },
[278] = { 3, 0, SEN(getrandom), "getrandom" },
[279] = { 2, TD, SEN(memfd_create), "memfd_create" },
[280] = { 3, TD, SEN(bpf), "bpf" },
[281] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[282] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[283] = { 2, 0, SEN(membarrier), "membarrier" },
[284] = { 3, TM, SEN(mlock2), "mlock2" },
[285] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[286] = { 6, TD, SEN(preadv2), "preadv2" },
[287] = { 6, TD, SEN(pwritev2), "pwritev2" },
[288] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[289] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[290] = { 1, 0, SEN(pkey_free), "pkey_free" },
[291] = { 5, TD|TF|TSTA, SEN(statx), "statx" },

View File

@ -1,34 +1,34 @@
struct arm_pt_regs {
uint32_t uregs[18];
uint32_t uregs[18];
};
#define ARM_cpsr uregs[16]
#define ARM_pc uregs[15]
#define ARM_lr uregs[14]
#define ARM_sp uregs[13]
#define ARM_ip uregs[12]
#define ARM_fp uregs[11]
#define ARM_r10 uregs[10]
#define ARM_r9 uregs[9]
#define ARM_r8 uregs[8]
#define ARM_r7 uregs[7]
#define ARM_r6 uregs[6]
#define ARM_r5 uregs[5]
#define ARM_r4 uregs[4]
#define ARM_r3 uregs[3]
#define ARM_r2 uregs[2]
#define ARM_r1 uregs[1]
#define ARM_r0 uregs[0]
#define ARM_ORIG_r0 uregs[17]
#define ARM_cpsr uregs[16]
#define ARM_pc uregs[15]
#define ARM_lr uregs[14]
#define ARM_sp uregs[13]
#define ARM_ip uregs[12]
#define ARM_fp uregs[11]
#define ARM_r10 uregs[10]
#define ARM_r9 uregs[9]
#define ARM_r8 uregs[8]
#define ARM_r7 uregs[7]
#define ARM_r6 uregs[6]
#define ARM_r5 uregs[5]
#define ARM_r4 uregs[4]
#define ARM_r3 uregs[3]
#define ARM_r2 uregs[2]
#define ARM_r1 uregs[1]
#define ARM_r0 uregs[0]
#define ARM_ORIG_r0 uregs[17]
static union {
struct user_pt_regs aarch64_r;
struct arm_pt_regs arm_r;
} arm_regs_union;
#define aarch64_regs arm_regs_union.aarch64_r
#define arm_regs arm_regs_union.arm_r
#define aarch64_regs arm_regs_union.aarch64_r
#define arm_regs arm_regs_union.arm_r
uint64_t *const aarch64_sp_ptr = (uint64_t *) &aarch64_regs.sp;
uint32_t *const arm_sp_ptr = (uint32_t *) &arm_regs.ARM_sp;
uint32_t *const arm_sp_ptr = &arm_regs.ARM_sp;
static struct iovec aarch64_io = {
.iov_base = &arm_regs_union
};

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2017 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.
*/
#undef FUNC_GET_RT_SIGFRAME_ADDR
#define FUNC_GET_RT_SIGFRAME_ADDR \
static kernel_ulong_t arm_get_rt_sigframe_addr(struct tcb *tcp)
#include "arm/arch_rt_sigframe.c"
#undef FUNC_GET_RT_SIGFRAME_ADDR
#define FUNC_GET_RT_SIGFRAME_ADDR DEF_FUNC_GET_RT_SIGFRAME_ADDR
FUNC_GET_RT_SIGFRAME_ADDR
{
return tcp->currpers == 1 ? arm_get_rt_sigframe_addr(tcp)
: *aarch64_sp_ptr;
}

View File

@ -2,7 +2,7 @@
static int
arch_get_scno(struct tcb *tcp)
{
long scno = 0;
kernel_ulong_t scno = 0;
switch (aarch64_io.iov_len) {
case sizeof(aarch64_regs):

25
linux/aarch64/set_error.c Normal file
View File

@ -0,0 +1,25 @@
#define arch_set_error arm_set_error
#define arch_set_success arm_set_success
#include "arm/set_error.c"
#undef arch_set_success
#undef arch_set_error
static int
arch_set_error(struct tcb *tcp)
{
if (aarch64_io.iov_len == sizeof(arm_regs))
return arm_set_error(tcp);
aarch64_regs.regs[0] = -tcp->u_error;
return set_regs(tcp->pid);
}
static int
arch_set_success(struct tcb *tcp)
{
if (aarch64_io.iov_len == sizeof(arm_regs))
return arm_set_success(tcp);
aarch64_regs.regs[0] = tcp->u_rval;
return set_regs(tcp->pid);
}

22
linux/aarch64/set_scno.c Normal file
View File

@ -0,0 +1,22 @@
#ifndef NT_ARM_SYSTEM_CALL
# define NT_ARM_SYSTEM_CALL 0x404
#endif
/*
* NT_ARM_SYSTEM_CALL regset is supported by linux kernel
* starting with commit v3.19-rc1~59^2~16.
*/
static int
arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
{
unsigned int n = (uint16_t) scno;
const struct iovec io = {
.iov_base = &n,
.iov_len = sizeof(n)
};
int rc = ptrace(PTRACE_SETREGSET, tcp->pid, NT_ARM_SYSTEM_CALL, &io);
if (rc && errno != ESRCH)
perror_msg("arch_set_scno: NT_ARM_SYSTEM_CALL pid:%d scno:%#x",
tcp->pid, n);
return rc;
}

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