Commit Graph

3825 Commits

Author SHA1 Message Date
2743efccce getrusage.test: fix build on x32
* tests/getrusage.c: Include <stdint.h>
(main): Print members of struct timeval using %ju format.
2016-02-19 03:39:59 +00:00
274fd468e1 getrusage.test: check that getrusage parser does not access extra memory
Place struct rusage at the end of an allocated memory page followed by
an inaccessible page.

* tests/getrusage.c (main): Use tail_alloc.
2016-02-19 03:39:59 +00:00
Fei Jie
5204dbdbb1 tests: add getrusage.test
* tests/getrusage.c: New file.
* tests/getrusage.test: New test.
* tests/.gitignore: Add getrusage.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add getrusage.test.
2016-02-19 03:39:59 +00:00
49faae958a Print rt_sigtimedwait return value as a signal name
* signal.c (SYS_FUNC(rt_sigtimedwait)): Decode return value.
* tests/rt_sigtimedwait.c: New file.
* tests/rt_sigtimedwait.test: New test.
* tests/.gitignore: Add rt_sigtimedwait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigtimedwait.test.
2016-02-19 03:39:59 +00:00
f09b7c4984 tests: add rt_sigprocmask.test
* tests/rt_sigprocmask.c: New file.
* tests/rt_sigprocmask.test: New test.
* tests/.gitignore: Add rt_sigprocmask.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigprocmask.test.
2016-02-19 01:44:33 +00:00
11656206ff Fix corner cases of rt_sigpending syscall decoder
* signal (print_sigset_addr_len_limit): New function, cloned from
print_sigset_addr_len with added minimal length argument.
Treat length less than minimal length or greater than NSIG/8 as invalid.
Do not align length to 4-byte boundary.  Align destination buffer
to 4-byte boundary and initialize it with zeroes so that subsequent
call to sprintsigmask_n will not access uninitialized data.
(print_sigset_addr_len): Turn into a wrapper around
print_sigset_addr_len_limit with current_wordsize
as a minimal length argument.
(SYS_FUNC(rt_sigpending)): Call print_sigset_addr_len_limit
instead of print_sigset_addr_len with 1 as a minimal length argument.
* tests/rt_sigpending.c: New file.
* tests/rt_sigpending.test: New test.
* tests/.gitignore: Add rt_sigpending.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigpending.test.
2016-02-19 01:44:33 +00:00
10c61e3b22 Change unix_diag requests back to use full dump instead of exact match
Unfortunately, 64-bit linux kernel has a bug in matching inode numbers
greater than INT_MAX, so unix_diag exact match is not reliable.

This partially reverts commit 69bfc89770.

* socketutils.c (unix_send_query): Add NLM_F_DUMP to nlmsg_flags,
remove initialization of udiag_cookie.
* tests/netlink_unix_diag.c (send_query): Remove "inode" argument,
add NLM_F_DUMP to nlmsg_flags, remove initialization of udiag_ino
and udiag_cookie.
(check_responses): Remove "inode" argument and its use.
(main): Remove invocation of inode_of_sockfd and passing of listening
socket inode to send_query and check_responses.
2016-02-19 01:44:33 +00:00
Michael Shigorin
f20304b6ae tests: avoid using cpp -dD
-dD is less portable across some peculiar preprocessors.

tests/Makefile.am (ksysent.h): Use cpp -dM instead of cpp -dD.
2016-02-19 01:44:33 +00:00
446e5b1780 tests: add poll.test
* tests/poll.c: New file.
* tests/poll.test: New test.
* tests/.gitignore: Add poll.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add poll.test.
2016-02-16 01:35:36 +00:00
9f612ffc49 Fix abbreviated output of poll and ppoll decoders
* poll.c (decode_poll_entering, decode_poll_exiting): Fix corner cases
of abbreviated output.
* tests/ppoll-v.expected: Update.
* tests/ppoll.expected: Update.
* tests/ppoll.test: Update.
2016-02-16 01:35:36 +00:00
8ef9809b63 Print unfetchable address in poll and ppoll decoders
* poll.c (decode_poll_entering): Replace umove call with
umove_or_printaddr.
(decode_poll_exiting): Print unfetchable address when umove call fails.
2016-02-16 01:35:36 +00:00
ddbede5d9c Print offsets in lseek and _llseek syscalls as signed integers
* lseek.c (SYS_FUNC(lseek)): Print offset using %lld format.
(SYS_FUNC(llseek)): Likewise.  Treat high and low components of offset
as unsigned long integers.
* tests/llseek.c (main): Check that negative offset is printed properly.
* tests/lseek.c (main): Likewise.
2016-02-16 01:35:36 +00:00
669f8cfb42 tests: add xetpgid.test
* tests/xetpgid.c: New file.
* tests/xetpgid.test: New test.
* tests/.gitignore: Add xetpgid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add xetpgid.test.
2016-02-14 22:30:27 +00:00
7c05954cd8 tests: add alarm.test
* tests/alarm.c: New file.
* tests/alarm.test: New test.
* tests/.gitignore: Add alarm.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add alarm.test.
2016-02-14 22:30:27 +00:00
1ab6e25585 Replace printargs_lu and printargs_ld with printargs_u and printargs_d
* defs.h (printargs_lu): Rename to printargs_u.
(printargs_ld): Rename to printargs_d.
* syscall.c (printargs_lu): Rename to printargs_u.  Replace %lu with %u.
(printargs_ld): Rename to printargs_d.  Replace %ld with %d.
* linux/dummy.h (sys_getpgrp): Change to printargs.
(sys_alarm): Change to printargs_u.
(sys_getpgid, sys_getsid, sys_nice, sys_setpgid, sys_setpgrp,
sys_timer_delete, sys_timer_getoverrun): Change to printargs_d.
2016-02-14 22:30:27 +00:00
835127d469 Change printargs_lu and printargs_ld to return RVAL_DECODED
* syscall.c (printargs_lu, printargs_ld): Return RVAL_DECODED.
2016-02-14 22:30:27 +00:00
cff071a5ca redirect.test: fix the way how strace output is discarded
* tests/redirect.test: Disable tracing of syscalls, signals,
and exit status instead of redirecting strace output to /dev/null.
2016-02-14 00:59:42 +00:00
4774f8239b tests: extend coverage of struct iovec arrays
* tests/readv.c (main): Check decoding of empty, inaccessible,
and partially inaccessible iovec arrays.
* tests/readv.test: Update.
2016-02-14 00:36:38 +00:00
13870c5482 Implement dumping of vmsplice syscall
* syscall.c (dumpio): Add SEN_vmsplice.
* NEWS: Mention this.
* tests/vmsplice.c: New file.
* tests/vmsplice.test: New test.
* tests/.gitignore: Add vmsplice.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add vmsplice.test.
2016-02-14 00:36:38 +00:00
6c93254614 tests: add tee.test
* tests/tee.c: New file.
* tests/tee.test: New test.
* tests/.gitignore: Add tee.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add tee.test.
2016-02-14 00:36:38 +00:00
16a52b4b87 Fix printing of negative offsets in splice syscall
* io.c (SYS_FUNC(splice)): Use PRId64 instead of PRIu64 for printing
offsets.
* tests/splice.c: New file.
* tests/splice.test: New test.
* tests/.gitignore: Add splice.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add splice.test.
2016-02-14 00:36:38 +00:00
c1f99f569a Implement copy_file_range syscall decoding
* copy_file_range.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/32/syscallent.h (copy_file_range): New entry.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.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.
* pathtrace.c (pathtrace_match): Add SEN_copy_file_range.
* NEWS: Mention new syscall parser.
* tests/copy_file_range.c: New file.
* tests/copy_file_range.test: New test.
* tests/.gitignore: Add copy_file_range.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add copy_file_range.test.
2016-02-14 00:36:38 +00:00
38437688ec Update fs *_MAGIC constants
* xlat/fsmagic.in: Add CGROUP2_SUPER_MAGIC and OVERLAYFS_SUPER_MAGIC.
2016-02-14 00:36:38 +00:00
b9c8e66f46 Update IPV6_* constants
* xlat/sockipv6options.in: Add IPV6_HDRINCL.
2016-02-14 00:36:38 +00:00
c257fbe24d Update SO_* constants
* xlat/sockoptions.in: Add SO_ATTACH_REUSEPORT_CBPF
and SO_ATTACH_REUSEPORT_EBPF.
2016-02-14 00:36:38 +00:00
12d5e7c8c3 Update MADV_* constants
* xlat/madvise_cmds.in: Add MAD_FREE.
2016-02-14 00:36:38 +00:00
84be84db7b tests: robustify execve and execveat tests
* tests/execve.c (main): Use one page gap between two mapped regions
for an address that is more likely to be not yet mapped.
* tests/execveat.c (main): Likewise.
2016-02-13 01:32:48 +00:00
b5faea4c73 tests: simplify execve test
* tests/execve.c (main): Simplify the test assuming that execve syscall
never returns ENOSYS.
2016-02-13 01:32:48 +00:00
4ab20405bc Fix numbers of syscall arguments in syscall tables
This semi-automatic change brings syscall tables in sync with kernel's
include/linux/syscalls.h file.

* linux/aarch64/syscallent.h (recv): Fix nargs.
* linux/alpha/syscallent.h (sigaltstack, init_module,
sched_getscheduler, settimeofday): Likewise.
* linux/arm/syscallent.h (signal, pciconfig_iobase, msgrcv, msgctl,
shmat, shmdt, shmctl, semtimedop, get_mempolicy, set_mempolicy,
timerfd_create): Likewise.
* linux/bfin/syscallent.h (signal, delete_module): Likewise.
* linux/hppa/syscallent.h (init_module, munlockall, sched_getscheduler,
io_cancel, set_tid_address, listxattr, llistxattr, flistxattr,
removexattr, lremovexattr, fremovexattr): Likewise.
* linux/i386/syscallent.h (signal, mmap): Likewise.
* linux/ia64/syscallent.h (init_module, readv, writev,
sched_getscheduler): Likewise.
* linux/m68k/syscallent.h (signal, request_key): Likewise.
* linux/microblaze/syscallent.h (signal, clone, fstatfs64, vmsplice):
Likewise.
* linux/mips/syscallent-n32.h (getpgid, statfs, fstatfs, init_module,
delete_module): Likewise.
* linux/mips/syscallent-n64.h (getpgid, statfs, fstatfs, init_module,
delete_module): Likewise.
* linux/mips/syscallent-o32.h (signal, statfs, fstatfs, ioperm,
fstatfs64): Likewise.
* linux/powerpc/syscallent.h (signal, spu_run, spu_create): Likewise.
* linux/powerpc64/syscallent.h (signal, pread64, pwrite64, readahead,
fadvise64, lookup_dcookie, spu_run, spu_create, sync_file_range2,
fallocate, preadv, pwritev, fanotify_mark): Likewise.
* linux/s390/syscallent.h (signal, mmap, lookup_dcookie, ipc): Likewise.
* linux/s390x/syscallent.h (signal, ipc): Likewise.
* linux/sh/syscallent.h (signal, ipc, munlockall, fstatfs64, vmsplice):
Likewise.
* linux/sh64/syscallent.h (signal, ipc, msgrcv, msgctl, shmat, shmdt,
shmctl, fstatfs64, vmsplice): Likewise.
* linux/sparc/syscallent.h (ptrace, dup, signal, ipc): Likewise.
* linux/sparc64/syscallent.h (ptrace, dup, signal, pread64, pwrite64,
readahead, lookup_dcookie, fadvise64, fadvise64_64, ipc,
sync_file_range, fallocate, preadv, pwritev, fanotify_mark): Likewise.
* linux/x32/syscallent.h (64:recvmsg): Likewise.
* linux/xtensa/syscallent.h (mremap, futex, reboot, init_module,
delete_module, request_key, getcpu, ioprio_set, ioprio_get, utimensat,
futimesat, fchmodat, faccessat): Likewise.
* NEWS: Mention this fix.
2016-02-13 00:57:00 +00:00
f3948fe494 s390: decode fadvise64 and fadvise64_64
* linux/s390/syscallent.h (fadvise64): Set sys_func.
(fadvise64_64): Set nargs and sys_func.
2016-02-13 00:57:00 +00:00
61066ea8e7 mips n64: use the most optimal parser for fadvise64 syscall
* linux/mips/syscallent-n64.h (fadvise64): Replace SEN(fadvise64_64)
with SEN(fadvise64).
2016-02-13 00:57:00 +00:00
1a1661813d ia64: decode fstatfs64 and statfs64
* linux/ia64/syscallent.h (fstatfs64, statfs64): Set nargs and sys_func.
2016-02-13 00:57:00 +00:00
a1e822870e alpha, ia64, mips, sh, sh64: fix the number of pipe syscall arguments
On alpha, ia64, mips, sh, sh64, sparc, and sparc64 architectures
pipe syscall does not take arguments.

* linux/alpha/syscallent.h (pipe): Change nargs to 0.
* linux/ia64/syscallent.h (pipe): Likewise.
* linux/mips/syscallent-n32.h (pipe): Likewise.
* linux/mips/syscallent-n64.h (pipe): Likewise.
* linux/mips/syscallent-o32.h (pipe): Likewise.
* linux/sh/syscallent.h (pipe): Likewise.
* linux/sh64/syscallent.h (pipe): Likewise.
2016-02-13 00:57:00 +00:00
9b38885803 alpha, ia64, mips, sh*, sparc*: fix error path decoding of pipe syscall
* net.c (do_pipe) [HAVE_GETRVAL2]: Remove.
Always call decode_pair_fd on exiting.
(SYS_FUNC(pipe)) [HAVE_GETRVAL2]: Call printpair_fd instead of do_pipe.
2016-02-13 00:57:00 +00:00
f9f04f74fc Fix pathtrace match for pipe2 syscall
* pathtrace.c (pathtrace_match): As pipe2 syscall has no descriptors
or paths to test, move SEN_pipe2 to the appropriate category.
2016-02-13 00:57:00 +00:00
3a630751eb avr32: wire up missing syscalls
* linux/avr32/syscallent.h [322..324]: Add userfaultfd, membarrier,
and mlock2 entries.
2016-02-13 00:57:00 +00:00
0aae167293 tests: check decoding of madvise, mlockall, mremap, and msync syscalls
* tests/mmap.c (main): Change output format from regexp to verbatim.
Add tests for madvise, mlockall, mremap, and msync syscalls.
* tests/mmap.test: Convert from match_grep to match_diff.
Add madvise, mlockall, mremap, and msync syscalls to syscall filter.
2016-02-12 02:35:54 +00:00
af618fa943 Simplify decoding of waitpid and wait4 syscalls
* wait.c (printwaitn): Replace "n" and "bitness" integer arguments
with a single print_rusage function pointer.  All callers updated.
2016-02-11 03:06:17 +00:00
591906cccb waitid: print pid argument as int
* wait.c (SYS_FUNC(waitid)): As the type of second syscall argument
in the kernel is pid_t, print it as int.
2016-02-11 03:06:17 +00:00
d3f17c642d waitid: always print 5th argument
* wait.c (SYS_FUNC(waitid)): Do not check for tcp->s_ent->nargs
as waitid syscall has 5 arguments.
2016-02-11 03:06:17 +00:00
ea21823d27 socketutils: add const qualifier to variables
* socketutils.c (cache_and_print_inode_details): Make "details"
parameter const.
(print_sockaddr_by_inode_cached): Make "e" variable const.
(inet_send_query): Make struct nlmsghdr and struct inet_diag_req_v2
members const.  Make "msg" variable const.
(inet_parse_response): Make "data" parameter and diag_msg variable const.
(receive_responses): Make "h" and "rc" variables const.
(unix_send_query): Make struct nlmsghdr and struct unix_diag_req
members const.  Make "msg" variable const.
(unix_print): Make all parameters const.
(print_sockaddr_by_inode): Make proto_name parameter const.
2016-02-11 03:06:17 +00:00
bcf5975a3e print_sockaddr_by_inode: cleanup protocol lookup
* socketutils.c (tcp_v4_print, udp_v4_print, tcp_v6_print,
udp_v6_print): New functions.
(print_sockaddr_by_inode): Make "protocols" array static, replace
"family" and "protocol" members with "print" in its underlying
structure.  Iterate through protocols array when the protocol name
is specified.
2016-02-11 03:06:17 +00:00
6204654329 tests: check that -f -p attaches to threads properly
Check that -f -p attaches and follows all threads of the given pid.

* tests/attach-f-p.c: New file.
* tests/attach-f-p.test: New test.
* tests/.gitignore: Add attach-f-p.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(attach_f_p_LDADD): New variable.
(TESTS): Add attach-f-p.test.
2016-02-09 05:08:00 +00:00
6ca4c92c1b Introduce libstrace.a for potentially conditional compilation units
Some files are used conditionally depending on architecture and
configuration.  Create a library for the purpose of keeping such
compilation units.

* Makefile.am (strace_LDADD, noinst_LIBRARIES): Add libstrace.a.
(libstrace_a_CPPFLAGS): New variable, set to $(strace_CPPFLAGS).
(libstrace_a_CFLAGS): New variable, set to $(strace_CFLAGS).
(libstrace_a_SOURCES): New variable, set to upeek.c.
* util.c (upeek): Move ...
* upeek.c: ... here.
2016-02-09 05:08:00 +00:00
0acd8d0ec3 travis-ci: pass more gcov arguments to codecov 2016-02-08 18:35:16 +00:00
b1b692eb23 tests: extend coverage of struct itimerspec
* tests/timer_xettime.c (main): Check decoding of NULL struct itimerspec
pointer.
2016-02-08 18:28:36 +00:00
9ee77b9e65 tests: extend coverage of utimensat syscall
* tests/utimensat.c (main): Check decoding of NULL struct timespec
pointer.
2016-02-08 18:27:59 +00:00
c736b456ad tests: extend coverage of time syscall
* tests/time.c (main): Check decoding of NULL time_t pointer.
2016-02-08 18:27:17 +00:00
595fc10f11 tests: extend coverage of struct sigevent
* tests/timer_create.c (main): Check decoding of NULL struct sigevent
pointer.  Check decoding of invalid sigev_notify value.
2016-02-08 18:26:46 +00:00
23168c1e54 tests: extend coverage of execve and execveat syscalls
Check decoding of inaccessible or partially inaccessible arrays.

* tests/execve-v.c: New file.
* tests/execveat-v.c: Likewise.
* tests/execve-v.test: New test.
* tests/execveat-v.test: Likewise.
* tests/execve.c: Rewrite.
* tests/execveat.c: Likewise.
* tests/execve.test: Likewise.
* tests/execveat.test: Likewise.
* tests/execve.expected: Remove.
* tests/execve-v.expected: Likewise.
* tests/execveat.expected: Likewise.
* tests/execveat-v.expected: Likewise.
* tests/.gitignore: Add execve-v and execveat-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add execve-v.test and execveat-v.test.
(EXTRA_DIST): Remove execve.expected, execve-v.expected,
execveat.expected, and execveat-v.expected.
2016-02-08 18:25:33 +00:00