Dmitry V. Levin [Sat, 14 May 2016 21:46:05 +0000 (21:46 +0000)]
Prepare for transition from xlookup64 to xlookup
* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)):
Cast 2nd argument of xlookup to unsigned long.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
* time.c (do_adjtimex): Likewise.
* ioprio.c (sprint_ioprio): Change type of the argument
and local variables from int to unsigned int.
* keyctl.c (print_keyring_serial_number): Cast 2nd argument
of xlookup to unsigned int.
* net.c (tprint_sock_type): Change type of the argument to unsigned int.
* printmode.c (sprintmode): Likewise.
* printsiginfo.c (printsigval): Change type of si_code argument
to unsigned int.
Dmitry V. Levin [Fri, 13 May 2016 20:22:18 +0000 (20:22 +0000)]
sock.c: include <linux/ioctl.h> instead of <sys/ioctl.h> or <ioctls.h>
Include <linux/ioctl.h> for <linux/sockios.h> on alpha, sh, and sh64
architectures because their <asm/sockios.h> use _IOR and _IOW macros
but don't include anything that would define these macros.
Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
no benefits in this case. <ioctls.h> simply doesn't exist.
* sock.c [ALPHA || SH || SH64]: Include <linux/ioctl.h>
instead of <sys/ioctl.h> or <ioctls.h>.
Dmitry V. Levin [Fri, 13 May 2016 04:04:08 +0000 (04:04 +0000)]
tests/ioctl_v4l2.c: fix build on older systems
Fix build on systems without HAVE_DECL_V4L2_CTRL_TYPE_STRING or
V4L2_CTRL_CLASS_CAMERA.
* tests/ioctl_v4l2.c (main) [VIDIOC_S_EXT_CTRLS]: Disable part of the
test if [!HAVE_DECL_V4L2_CTRL_TYPE_STRING].
Replace V4L2_CTRL_CLASS_CAMERA with V4L2_CTRL_CLASS_USER.
Dmitry V. Levin [Fri, 13 May 2016 02:33:33 +0000 (02:33 +0000)]
ptrace: decode data argument of PTRACE_PEEKSIGINFO request
The data argument of PTRACE_PEEKSIGINFO request is a pointer
to siginfo_t array.
* printsiginfo.c (print_siginfo_t): New function.
(print_siginfo_array): New mpers printer.
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_PEEKSIGINFO request using print_siginfo_array.
Dmitry V. Levin [Thu, 12 May 2016 15:45:24 +0000 (15:45 +0000)]
ptrace: decode addr argument of PTRACE_PEEKSIGINFO request
The addr argument of PTRACE_PEEKSIGINFO request is a pointer to
a struct ptrace_peeksiginfo_args.
* process.c: Include "xlat/ptrace_peeksiginfo_flags.h".
(SYS_FUNC(ptrace)): Print addr argument of PTRACE_PEEKSIGINFO request
as a struct ptrace_peeksiginfo_args.
* xlat/ptrace_peeksiginfo_flags.in: New file.
Dmitry V. Levin [Thu, 12 May 2016 15:38:35 +0000 (15:38 +0000)]
ptrace: fix printing addr argument of PTRACE_GETSIGMASK et al requests
For PTRACE_GETSIGMASK and PTRACE_SETSIGMASK requests, addr argument
contains the size of the buffer pointed to by data argument.
For PTRACE_SECCOMP_GET_FILTER request, addr argument contains
an offset counter.
* process.c (SYS_FUNC(ptrace)): Print addr argument of
PTRACE_GETSIGMASK, PTRACE_SETSIGMASK, and PTRACE_SECCOMP_GET_FILTER
requests using %lu format.
Dmitry V. Levin [Thu, 12 May 2016 15:18:05 +0000 (15:18 +0000)]
ptrace: do not print data argument of some requests on sparc
On sparc, kernel ignores data argument of PTRACE_GETREGS,
PTRACE_SETREGS, PTRACE_GETFPREGS, and PTRACE_SETFPREGS requests.
* process.c (SYS_FUNC(ptrace)) [SPARC || SPARC64]: Return RVAL_DECODED
right after printing addr argument if request is one of PTRACE_GETREGS,
PTRACE_SETREGS, PTRACE_GETFPREGS, or PTRACE_SETFPREGS.
Dmitry V. Levin [Thu, 12 May 2016 15:10:41 +0000 (15:10 +0000)]
ptrace: do not print addr and data arguments of PTRACE_ATTACH-like requests
As kernel ignores addr and data arguments of PTRACE_ATTACH,
PTRACE_INTERRUPT, PTRACE_KILL, and PTRACE_LISTEN request,
we do not print them either.
* process.c (SYS_FUNC(ptrace)): After printing pid argument, return
RVAL_DECODED if request is one of PTRACE_ATTACH, PTRACE_INTERRUPT,
PTRACE_KILL, or PTRACE_LISTEN.
Dmitry V. Levin [Thu, 12 May 2016 14:27:49 +0000 (14:27 +0000)]
Do not sign-extend siginfo_t.si_syscall
* printsiginfo.c (print_si_info): Explicitly cast si_syscall member
of siginfo_t that has type "int" to "unsigned int", to avoid sign
extension when passed to syscall_name function.
Dmitry V. Levin [Tue, 10 May 2016 18:18:32 +0000 (18:18 +0000)]
tests: extend test coverage of xattr family syscalls
* tests/xattr.c: Check decoding of all xattr family syscalls.
* tests/xattr.test: Use run_strace_match_diff.
* tests/xattr.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
Dmitry V. Levin [Tue, 10 May 2016 22:05:53 +0000 (22:05 +0000)]
tests: add print_quoted_memory function to libtests
* tests/print_quoted_string.c (print_quoted_memory): New function.
(print_quoted_string): Use it.
* tests/tests.h (print_quoted_memory): New prototype.
Dmitry V. Levin [Tue, 10 May 2016 18:52:06 +0000 (18:52 +0000)]
Fix corner cases of xattr family syscalls decoding
* xattr.c (print_xattr_val): Do not take insize into account, print it
as unsigned long.
Do not decode xattr values of size larger than XATTR_SIZE_MAX.
Use static buffer for fetching xattr values.
(print_xattr_list): Do not decode string when size is zero.
Dmitry V. Levin [Tue, 10 May 2016 02:08:56 +0000 (02:08 +0000)]
Update AX_CODE_COVERAGE
* m4/ax_code_coverage.m4: Update to serial 16.
* Makefile.am (CODE_COVERAGE_LCOV_OPTIONS): Remove.
(CODE_COVERAGE_GENHTML_OPTIONS): Update, add prefix.
(CODE_COVERAGE_BRANCH_COVERAGE): Set to 1.
Dmitry V. Levin [Mon, 9 May 2016 23:15:52 +0000 (23:15 +0000)]
strace-ff.test: check that -ff does not create unexpected output files
* tests/strace-ff.expected: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/strace-ff.test: Use it. Check that no other output files
have been created.
Dmitry V. Levin [Sat, 7 May 2016 23:11:52 +0000 (23:11 +0000)]
seccomp.c: use print_array function
* seccomp.c (decode_filter, decode_seccomp_fprog): Remove.
(print_bpf_filter): New function.
(print_seccomp_fprog): Use it via print_array.
* tests/seccomp-filter-v.c (main): Update.
Dmitry V. Levin [Sat, 7 May 2016 23:09:09 +0000 (23:09 +0000)]
poll.c: use print_array function
* poll.c (print_pollfd): Change for use as print_array callback.
(decode_poll_entering): Use print_array.
* tests/poll.c: Update.
* tests/poll.test: Update.
Dmitry V. Levin [Sat, 7 May 2016 23:02:36 +0000 (23:02 +0000)]
numa.c: use print_array function
* numa.c (print_node): New function.
(print_nodemask): Use it via print_array.
(print_page_array, print_int_array): Remove.
(print_addr): New function.
(print_status, print_int): Change for use as print_array callback.
(SYS_FUNC(move_pages)): Use print_addr, print_int, and print_status
via print_array.
* tests/move_pages.c: Update.
* tests/set_mempolicy.c: Likewise.
* tests/set_mempolicy.test: Likewise.
Dmitry V. Levin [Sat, 7 May 2016 22:49:39 +0000 (22:49 +0000)]
epoll.c: use print_array function
* epoll.c (print_epoll_event): Change signature for use as print_array
callback, all users updated.
(print_epoll_event_array): Remove.
(epoll_wait_common): Change to use print_array instead
of print_epoll_event_array.
Dmitry V. Levin [Sat, 7 May 2016 22:40:06 +0000 (22:40 +0000)]
aio.c: use print_array function
* aio.c (print_iocbp): New function.
(SYS_FUNC(io_submit)): Use it via print_array. Use widen_to_long
to process long int argument.
(print_io_event): Change to print struct io_event fetched elsewhere.
(SYS_FUNC(io_cancel)): Update use of print_io_event.
(SYS_FUNC(io_getevents)): Use print_io_event via print_array.
Use widen_to_long to print long int arguments.
* tests/aio.c (main): Check decoding of io_submit with negative "nr".
Dmitry V. Levin [Mon, 2 May 2016 22:06:56 +0000 (22:06 +0000)]
Mpersify ioctl macros
As values of some ioctl macros differ between personalities, these
personality specific ioctl macros should be properly defined for
mpersified code. Implement this by redefining personality specific
ioctl macros from ioctlent*.h for each file that includes MPERS_DEFS.
* Makefile.am (ioctl_macros_h): New variable.
(ioctl_macros%.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add $(ioctl_macros_h).
(m%_type_defs.h): #include MPERS_$(mpers_PREFIX)IOCTL_MACROS.
* defs.h [HAVE_M32_MPERS] (MPERS_m32_IOCTL_MACROS): New macro.
[HAVE_MX32_MPERS] (MPERS_mx32_IOCTL_MACROS): Likewise.
Remove initialization of big holes in syscallent.h files
There is no need to explicitly initialize big holes after conversion
of syscallent.h files to use designated initializers. For architectures
that have some data at the end of syscallent.h this initialization of
big holes is no-op, for others it just inflates the table unnecessarily.
* linux/arc/syscallent.h: Remove initialization of arch specific block
at the end of table.
* linux/metag/syscallent.h: Likewise.
* linux/nios2/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
* linux/arm/syscallent.h: Remove explicit initialization of a big hole
before socket subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.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/mips/syscallent-compat.h: Remove explicit initialization
of big holes between different mips ABIs.
* linux/mips/syscallent-n64.h: Remove explicit initialization
of big holes before socket subcalls and between different mips ABIs.
* linux/mips/syscallent-o32.h: Likewise.
When #val_type directive is encountered, gen.sh starts using
XLAT_TYPE/XLAT_TYPE_PAIR macros instead of XLAT/XLAT_PAIR,
with #val_type's argument as a type.
For example, "#val_type uint64_t" means values of type uint64_t.
* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
to the specified type instead of unsigned int.
(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
to the specified type instead of unsigned int.
xlat: generate xlat pairs using new XLAT_PAIR macro
Before this change there were two forms of xlat entries: those that use XLAT
or XLAT_END macros, and others verbatim entries. This change converts
the latter to use new XLAT_PAIR macro.
This is necessary for the upcoming change of xlat.val type.
* xlat.h (XLAT_PAIR): New macro.
* xlat/gen.sh (cond_xlat, gen_header): Use it.
tests/remap_file_pages.c: fix for the upcoming change of xlat.val type
The "flags" argument of remap_file_page syscall has type "unsigned
long", so it is not correct to load most significant bits with garbage
ans assume they are going to be ignored.
* tests/remap_file_pages.c (main): Remove artificial garbage from flags.
This is necessary for the upcoming change of xlat.val type.
* defs.h (printflags): Rename to printflags64, change type of integer
argument to uint64_t.
(printflags): New static inline function.
* util.c (printflags): Rename to printflags64, change type of integer
argument to uint64_t. Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
This is necessary for the upcoming change of xlat.val type.
* defs.h (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t.
(sprintflags): New static inline function.
* util.c (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t. Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
printxvals: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of printxvals are already prepared for this change.
* defs.h (printxvals): Change type of integer argument to uint64_t.
* util.c (printxvals): Likewise. Print it using PRIx64 format.
Patch by Jeff Mahoney <jeffm@suse.com>.
xlat_search: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.
* defs.h (xlat_search): Change type of integer argument to uint64_t.
* util.c (xlat_search): Likewise. Pass it by pointer.
(xlat_bsearch_compare): Treat first argument as a pointer.
Patch by Jeff Mahoney <jeffm@suse.com>.
This is necessary for the upcoming change of xlat.val type.
* defs.h (xlookup): Rename to xlookup64, change type of integer argument
to uint64_t.
(xlookup): New static inline function.
* util.c (xlookup): Rename to xlookup64, change type of integer
argument to uint64_t.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
addflags: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.
* defs.h (addflags): Change type of integer argument to uint64_t.
* util.c (addflags): Likewise. Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.