Commit Graph

4092 Commits

Author SHA1 Message Date
fe3de9c601 v4l2: include <linux/ioctl.h> instead of <sys/ioctl.h>
Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
no benefits for parser of VIDIOC_* ioctls.

* v4l2.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
2016-05-13 22:09:40 +00:00
f9199ab081 printsiginfo: remove "verbose" argument
Remove erroneous use of verbose(tcp) as a printing limit
for already fetched members of siginfo_t structure.

* printsiginfo.h (printsiginfo): Remove boolean argument.
* printsiginfo.c (printsigval): Remove boolean argument, print
si_int and si_ptr members unconditionally.  All callers changed.
(print_si_info): Remove boolean argument, print si_utime and si_stime
members unconditionally.  All callers changed.
(printsiginfo): Remove boolean argument.  All callers changed.
2016-05-13 22:09:07 +00:00
602998be62 tests/ptrace.c: tweak magic constants to make the test more reliable
* tests/ptrace.c (main): Change bad_request and bad_data to make they
lower 32-bit parts closer to -1U.
2016-05-13 09:37:10 +00:00
98f632a14c 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.
2016-05-13 05:18:42 +00:00
f2f162e89c Do not use htole32 function
htole32 function is not portable enough.

* v4l2.c (print_pixelformat): Rewrite initialization of pixel format
union without using of htole32.
* tests/ioctl_v4l2.c (main): Likewise.
2016-05-13 05:18:42 +00:00
09de43b39d tests/ioctl_v4l2.c: fix typo
* tests/ioctl_v4l2.c (main)
[!HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE]: Fix typo in expected
output string.
2016-05-13 05:18:42 +00:00
632efff900 tests: check decoding of ptrace syscall
* tests/ptrace.c: New file.
* tests/ptrace.test: New test.
* tests/.gitignore: Add ptrace.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ptrace.
2016-05-13 05:18:41 +00:00
76b4c33c7f 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.
2016-05-13 02:36:14 +00:00
d9fb4a434d ptrace: decode data argument of PTRACE_SECCOMP_GET_FILTER request
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_SECCOMP_GET_FILTER request on exiting using print_seccomp_fprog.
2016-05-13 01:39:41 +00:00
846f617805 ptrace: decode argument of PTRACE_GETEVENTMSG request
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_GETEVENTMSG request on exiting using printnum_ulong.
2016-05-13 01:39:41 +00:00
1634de70b2 ptrace: decode arguments of PTRACE_[GS]ETSIGMASK requests
* process.c (SYS_FUNC(ptrace)): Print arguments of PTRACE_GETSIGMASK
and PTRACE_SETSIGMASK requests using print_sigset_addr_len.
2016-05-13 01:39:41 +00:00
8bd7f3155c ptrace: return RVAL_DECODED for requests decoded on entering
* process.c (SYS_FUNC(ptrace)): Return RVAL_DECODED on entering for all
ptrace requests except those that are partially decoded in exiting,
2016-05-13 01:39:39 +00:00
388aca6472 ptrace: print PTRACE_O_* flags using printflags64
As flags argument has a long integer type, print it using printflags64
because printflags takes unsigned int argument.

* process.c (SYS_FUNC(ptrace)): Print PTRACE_O_* flags
using printflags64.
2016-05-12 16:35:54 +00:00
7c8e3302ea ptrace: print data argument of PTRACE_SEIZE et al requests as flags
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_SEIZE and PTRACE_OLDSETOPTIONS as PTRACE_O_* flags.
2016-05-12 15:53:28 +00:00
caa2bc3873 ptrace: print data argument of PTRACE_SINGLEBLOCK et al requests as signo
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_SINGLEBLOCK, PTRACE_SYSEMU, and PTRACE_SYSEMU_SINGLESTEP requests
as a signal number.
2016-05-12 15:50:43 +00:00
809ee3e46c 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.
2016-05-12 15:45:24 +00:00
3a5cd34e34 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.
2016-05-12 15:38:35 +00:00
5c720b0b9b 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.
2016-05-12 15:18:05 +00:00
91bd125f53 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.
2016-05-12 15:10:41 +00:00
89ca4aa140 ptrace: do not print arguments of PTRACE_TRACEME request
As kernel ignores arguments of PTRACE_TRACEME request,
we do not print them either.

* process.c (SYS_FUNC(ptrace)): If request is PTRACE_TRACEME,
return early with RVAL_DECODED.
2016-05-12 15:03:58 +00:00
73a8e97d56 ptrace: print request using printxval64
As first argument of ptrace syscall has a long integer type, print
it using printxval64 because printxval takes unsigned int argument.

* process.c (SYS_FUNC(ptrace)): Change type of "request" variable
from "long" to "unsigned long", print it using printxval64 instead
of printxval.
2016-05-12 14:47:01 +00:00
49955948fb 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.
2016-05-12 14:35:02 +00:00
50a26514a5 Export print_seccomp_fprog for further use in parser of ptrace syscall
* defs.h (print_seccomp_fprog): New prototype.
* seccomp.c (print_seccomp_fprog): Remove "static" keyword.
Move printing of struct seccomp_fprog fields ...
(print_seccomp_filter): ... here.
2016-05-12 14:35:02 +00:00
Fei Jie
01d16ccb96 tests: add munlockall.test
* tests/munlockall.c: New file.
* tests/munlockall.test: New test.
* tests/.gitignore: Add munlockall.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add munlockall.test.
2016-05-11 12:26:00 +00:00
Fei Jie
0684c35c25 tests: add link.test
* tests/link.c: New file.
* tests/link.test: New test.
* tests/.gitignore: Add link.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add link.test.
2016-05-11 12:26:00 +00:00
d81b58f650 tests: check decoding and dumping of preadv2 and pwritev2 syscalls
* tests/preadv2-pwritev2.c: New file.
* tests/preadv2-pwritev2.test: New test.
* tests/.gitignore: Add preadv2-pwritev2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add preadv2-pwritev2.
2016-05-11 01:54:12 +00:00
a6dd094287 Implement decoding of preadv2 and pwritev2 syscalls
* io.c: Include "xlat/rwf_flags.h".
(do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)):
New functions.
(SYS_FUNC(preadv)): Use do_preadv.
(SYS_FUNC(pwritev)): Use do_pwritev.
* linux/32/syscallent.h (preadv2, pwritev2): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/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/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2.
* xlat/rwf_flags.in: New file.
* NEWS: Mention parsers of new syscalls.
2016-05-11 00:58:06 +00:00
ea7b9dbcbd 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.
2016-05-10 22:25:23 +00:00
72cb81151f 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.
2016-05-10 22:12:01 +00:00
ec9c31705b 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.
2016-05-10 21:50:37 +00:00
Dr. David Alan Gilbert
0efd888e22 userfaultfd: Add ioctl tests
* tests/ioctl_uffdio.c: New file.
* tests/ioctl_uffdio.test: New test.
* tests/.gitignore: Add ioctl_uffdio.
* tests/Makefile.am (check_PROGRAMS):  Likewise.
(DECODER_TESTS): Add ioctl_uffdio.test.
2016-05-10 11:00:12 +00:00
Dr. David Alan Gilbert
5d1216a56b Decode UFFDIO_* ioctls
Decode the ioctls associated with the userfaultfd fd.
Note that they tend to read from and also return result in it's data
structure.

* configure.ac (AC_CHECK_HEADERS): Add linux/userfaultfd.h.
* userfaultfd.c [HAVE_LINUX_USERFAULTFD_H]: Add ioctl decoder.
* defs.h (uffdio_ioctl): New prototype.
* ioctl.c (ioctl_decode) [HAVE_LINUX_USERFAULTFD_H]: Wire in
uffdio_ioctl.
* xlat/uffd_*.in: Create flag xlat for all the IOCTLs.
2016-05-10 10:54:54 +00:00
c415387157 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.
2016-05-10 09:51:56 +00:00
26b2cfeb6b strace-ff.test: fix race condition
* tests/strace-ff.test: Wait for completion of PR_SET_PTRACER command.
2016-05-10 09:51:04 +00:00
d12c44bcac tests/epoll_pwait.c: fix for x32
* tests/epoll_pwait.c (main): Explicitly cast last syscall argument
to kernel_ulong_t.
2016-05-10 01:37:46 +00:00
a44c5184f9 strace-S.test: check "-S name"
* tests/strace-S.test: Add a check for "-c -S name" output.
2016-05-10 00:39:17 +00:00
fa925dce70 Fix NULL dereference in "-S name" when syscall table has holes
* count.c (syscall_cmp): Do not pass NULL to strcmp.
2016-05-10 00:38:59 +00:00
804bb8797b strace-S.test: cleanup
* tests/strace-S.test: Rewrite using sed.
2016-05-10 00:38:52 +00:00
Fei Jie
6781111857 tests: add strace-S.test
* tests/strace-S.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-05-09 23:33:32 +00:00
58ab8b49e0 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.
2016-05-09 23:21:30 +00:00
Fei Jie
c259f4fd5d tests: add strace-ff.test
* tests/strace-ff.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-05-09 23:21:20 +00:00
a30d02e902 strace-V.test: cleanup
* tests/strace-V.test: Move config.h parser to a function.
Rename $OUT to $EXP, swap arguments passed to match_diff.
2016-05-09 23:19:37 +00:00
Fei Jie
c4bb57745a tests: add strace-V.test
* tests/strace-V.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-05-09 23:18:40 +00:00
e3086cbc4d tests: check decoding of epoll_pwait syscall
* tests/epoll_pwait.c: New file.
* tests/epoll_pwait.test: New test.
* tests/.gitignore: Add epoll_pwait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add epoll_pwait.test.
2016-05-09 22:12:57 +00:00
6d44012cb5 Assume that sys/epoll.h exists
This header file was added in glibc-2.3.2,
so it's safe to assume its availability.

* configure.ac (AC_CHECK_HEADERS): Remove sys/epoll.h.
* epoll.c: Include <sys/epoll.h> unconditionally.
Compile [HAVE_SYS_EPOLL_H] code unconditionally.
* tests/epoll_ctl.c: Do not check for HAVE_SYS_EPOLL_H.
* tests/epoll_wait.c: Likewise.
2016-05-09 21:46:17 +00:00
Fabien Siron
071b9274f4 Factorize send_query functions
* socketutils.c (send_query): New function.
(inet_send_query, unix_send_query): Use it.
2016-05-08 12:37:03 +00:00
b6d4b1167b tests: relax timings
Allow nanosleep(2) to spend 10% more time to make the test suite
more reliable on slow systems.

* tests/count.test: Treat 1.1 seconds as valid output.
* tests/strace-T.expected: Likewise.
* tests/strace-r.expected: Likewise.
2016-05-08 00:00:18 +00:00
88fc4c23d4 tests/attach-f-p.c: increase timeouts
Increase timeouts to make the test more reliable on slow systems.

* tests/attach-f-p.c (its): Increase timeouts to 1, 2, and 3 seconds,
respectively.
2016-05-07 23:51:47 +00:00
dc0dcf90d6 Remove unused functions
* defs.h (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
Remove.
* util.c (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
Likewise.
2016-05-07 23:37:53 +00:00
17d1a1633d v4l2.c: use print_array function
* v4l2.c (print_v4l2_ext_control, umoven_or_printaddr_ignore_syserror):
New functions.
(print_v4l2_ext_controls): Use them via print_array.
2016-05-07 23:37:53 +00:00