]>
granicus.if.org Git - strace/log
Dmitry V. Levin [Wed, 26 Aug 2015 22:50:58 +0000 (22:50 +0000)]
build: fix -I options
* configure.ac (AM_INIT_AUTOMAKE): Add nostdinc.
* Makefile.am (AM_CPPFLAGS): Append -I$(builddir) and -I$(srcdir).
* tests/Makefile.am (AM_CPPFLAGS): Likewise.
Dmitry V. Levin [Wed, 26 Aug 2015 17:48:40 +0000 (17:48 +0000)]
aio: rewrite from libaio.h to linux/aio_abi.h
* configure.ac (AC_CHECK_HEADERS): Remove libaio.h.
* aio.c: Assume that <linux/aio_abi.h> is available,
include it instead of <libaio.h>.
[!IOCB_RESFD]: Remove.
(enum iocb_sub): Remove SUB_POLL.
(tprint_lio_opcode): Update.
(print_common_flags): Use IOCB_FLAG_RESFD instead of IOCB_RESFD,
rename fields of struct iocb.
(iocb_is_valid, print_iocb_header, print_iocb): New functions.
(sys_io_submit): Use print_iocb.
(print_io_event): Fix struct io_event decoding.
(sys_io_cancel): Use print_iocb_header.
* strace.spec (BuildRequires): Remove libaio-devel.
* tests/aio.c (main): Test IOCB_CMD_PREADV, io_cancel,
and struct io_event decoding.
* tests/aio.test (syscalls): Add io_cancel.
Dmitry V. Levin [Wed, 26 Aug 2015 12:49:07 +0000 (12:49 +0000)]
Fix multiple personalities support in parser of io_submit syscall
Introduce a new helper function to fetch tracee's long integers
and use it to fix multiple personalities support in io_submit parser.
* defs.h (umove_long_or_printaddr): New prototype.
* util.c (umove_long_or_printaddr): New function.
* aio.c (sys_io_submit): Use it to fetch tracee's pointers.
* tests/aio.c: New file.
* tests/aio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add aio.
(TESTS): Add aio.test.
* tests/.gitignore: Add aio.
Dmitry V. Levin [Wed, 26 Aug 2015 21:02:04 +0000 (21:02 +0000)]
tests: fix build on systems that lack O_CLOEXEC definition
* tests/epoll_create1.c (main): Check that O_CLOEXEC is defined.
* tests/eventfd.c (main): Likewise.
* tests/signalfd.c (main): Likewise.
Dmitry V. Levin [Wed, 26 Aug 2015 20:20:38 +0000 (20:20 +0000)]
tests: fix build on systems that lack AT_FDCWD definition
* tests/readlinkat.c: Stop including <fcntl.h>.
(main): Replace AT_FDCWD with -100.
Dmitry V. Levin [Wed, 26 Aug 2015 16:15:46 +0000 (16:15 +0000)]
Fix printing of io_getevents first argument
* aio.c (sys_io_getevents): Print first argument using "%lu" format.
Mike Frysinger [Wed, 19 Aug 2015 17:29:27 +0000 (13:29 -0400)]
decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list. The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions. See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.
To support this, extend the printxval function to take multiple sets of
xlats as varargs. Then we add the new get/set lists, and pass them down
in the net code when decoding things.
A simple example is iptables; before:
getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0
If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.
* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument. Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this. Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
Dmitry V. Levin [Wed, 26 Aug 2015 11:55:05 +0000 (11:55 +0000)]
Fix build on systems that lack VIDIOC_CREATE_BUFS definition
* v4l2.c (v4l2_ioctl): Check that v4l2_ioctl is defined.
Dmitry V. Levin [Tue, 25 Aug 2015 21:56:02 +0000 (21:56 +0000)]
Fix build on systems that lack EM_ARM/EM_OPENRISC definitions
* xlat/audit_arch.in: Guard AUDIT_ARCH_ARM and AUDIT_ARCH_ARMEB
with EM_ARM check. Guard AUDIT_ARCH_OPENRISC with EM_OPENRISC check.
Dmitry V. Levin [Tue, 25 Aug 2015 21:48:36 +0000 (21:48 +0000)]
Fix build on systems that lack UBI_IOCVOLCRBLK/UBI_IOCVOLRMBLK definitions
* mtd.c (ubi_ioctl): Check that UBI_IOCVOLCRBLK and UBI_IOCVOLRMBLK
are defined.
Dmitry V. Levin [Mon, 24 Aug 2015 09:38:03 +0000 (09:38 +0000)]
Fix build on systems that lack O_CLOEXEC definition
* xlat/efd_flags.in: Check that O_CLOEXEC is defined.
* xlat/epollflags.in: Likewise.
* xlat/sfd_flags.in: Likewise.
* xlat/timerfdflags.in: Fix O_CLOEXEC check.
Elvira Khabirova [Fri, 21 Aug 2015 17:46:35 +0000 (20:46 +0300)]
printsiginfo.c: fix integer conversions
* printsiginfo.c (printsigsource): Print si_pid and si_uid as unsigned
integers.
(printsigval): Print si_int as signed int.
Dmitry V. Levin [Thu, 20 Aug 2015 21:20:14 +0000 (21:20 +0000)]
Fix decoding of times syscall return value
Always print return value of successful times syscall
as unsigned long integer.
* times.c (sys_times): Return RVAL_UDECIMAL unless syserror.
Elvira Khabirova [Thu, 20 Aug 2015 18:14:29 +0000 (21:14 +0300)]
mq.c: remove repeated code
* mq.c (sys_mq_open): Use printmqattr instead of implementing it again.
[HAVE_MQUEUE_H]: Remove.
Elvira Khabirova [Wed, 19 Aug 2015 03:06:29 +0000 (06:06 +0300)]
ipc_msg.c: fix multiple personalities support in msgrcv ipc subcall
When msgrcv syscall is an ipc subcall, msgp (pointer to struct msgbuf)
and msgtyp (message type) syscall arguments are passed via proxy
structure which definition significantly depends on tracee's
wordsize.
* ipc_msg.c (fetch_msgrcv_args): New function.
(sys_msgrcv): Use it.
Elvira Khabirova [Wed, 19 Aug 2015 02:06:26 +0000 (05:06 +0300)]
ipc.c: split into separate files
In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.
* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c. Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.
Elvira Khabirova [Thu, 20 Aug 2015 17:32:22 +0000 (20:32 +0300)]
.gitignore: add sen.h and sys_func.h
Dmitry V. Levin [Wed, 19 Aug 2015 01:25:39 +0000 (01:25 +0000)]
tests: add sendfile.test and sendfile64.test
* tests/sendfile.c: New file.
* tests/sendfile64.c: New file.
* tests/sendfile.test: New test.
* tests/sendfile64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sendfile and sendfile64.
(TESTS): Add sendfile.test and sendfile64.test.
* tests/.gitignore: Add sendfile and sendfile64.
Dmitry V. Levin [Tue, 18 Aug 2015 22:17:52 +0000 (22:17 +0000)]
sendfile: decode file offset both on entering and exiting syscall
When sendfile is called with a valid pointer to a file offset variable,
kernel updates this variable on successfull exit from syscall.
* sendfile.c (sys_sendfile, sys_sendfile64): Print tcp->u_arg[2]
on exiting syscall as well as on entering.
Dmitry V. Levin [Tue, 18 Aug 2015 22:09:30 +0000 (22:09 +0000)]
io.c: move sendfile parsers to a separate file
* sendfile.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c
Dmitry V. Levin [Tue, 18 Aug 2015 21:57:27 +0000 (21:57 +0000)]
Make printnum_* functions return boolean status
With this change, printnum_* functions return true iff they
successfully fetched necessary data from tracee's memory.
* defs.h (printnum_short, printnum_int, printnum_int64,
printnum_long_int, printpair_int, printpair_int64): Return bool.
* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
Dmitry V. Levin [Tue, 18 Aug 2015 22:53:22 +0000 (22:53 +0000)]
mips: print _MIPS_SIM in configure.ac for debug purposes
* configure.ac [MIPS]: Print _MIPS_SIM.
Dmitry V. Levin [Wed, 19 Aug 2015 13:34:00 +0000 (13:34 +0000)]
xtensa: fix several syscall entries
* linux/xtensa/syscallent.h: Fix nargs in splice, tee, vmsplice,
pselect6, ppoll, epoll_pwait, and set_robust_list syscall entries.
Dmitry V. Levin [Wed, 19 Aug 2015 13:31:42 +0000 (13:31 +0000)]
ia64: fix syscall numbers for set_robust_list, get_robust_list, and splice syscalls
* linux/ia64/syscallent.h: Place syscall entries for set_robust_list,
get_robust_list, and splice in correct order.
Dmitry V. Levin [Tue, 18 Aug 2015 19:21:36 +0000 (19:21 +0000)]
tests: add a test for get_robust_list and set_robust_list decoding
* tests/xet_robust_list.c: New file.
* tests/xet_robust_list.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xet_robust_list.
(TESTS): Add xet_robust_list.test.
* tests/.gitignore: Add xet_robust_list.
Dmitry V. Levin [Tue, 18 Aug 2015 18:33:44 +0000 (18:33 +0000)]
Simplify printing of get_robust_list first argument
* get_robust_list.c (sys_get_robust_list): Print first argument
using "%d" format.
Elvira Khabirova [Tue, 18 Aug 2015 15:02:20 +0000 (18:02 +0300)]
Fix io_setup first argument printing
* aio.c (sys_io_setup): Print first argument using "%u" format.
Dmitry V. Levin [Tue, 18 Aug 2015 14:58:27 +0000 (14:58 +0000)]
Fix printing tracee's long integers
Replace ambiguous printnum_long that used to fetch native long integers
from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
that fetch tracee's pointer, signed long, and unsigned long integers.
* defs.h (printnum_long, printpair_long): Remove prototypes.
(printnum_int64, printpair_int64): Remove macros, declare functions
unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New prototype.
(printnum_ptr, printnum_slong, printnum_ulong): New macros.
* aio.c (sys_io_setup): Use printnum_ulong.
* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
and printnum_ulong.
* io.c (print_off_t): Remove.
(sys_sendfile): Use printnum_ulong.
* ipc.c (sys_semctl): Use printnum_ptr.
* prctl.c (sys_prctl): Likewise.
* process.c (sys_ptrace): Likewise.
* rtc.c (rtc_ioctl): Use printnum_ulong.
* util.c (printnum_long, printpair_long): Remove.
(printnum_int64, printpair_int64): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New function.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
Dmitry V. Levin [Tue, 18 Aug 2015 13:25:36 +0000 (13:25 +0000)]
Fix time syscall decoding for some personalities
* time.c (current_time_t_is_int32): Define.
(sys_time): Use it, printnum_int, and printnum_int64 instead
of printnum_long.
* tests/time.c: New file.
* tests/time.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add time.
(TESTS): Add time.test.
* tests/.gitignore: Add time.
Mike Frysinger [Tue, 18 Aug 2015 07:24:59 +0000 (03:24 -0400)]
signal: SIGSYS: decode si_syscall & si_arch fields
When receiving SIGSYS, the si_syscall & si_arch fields are set to known
values, so make sure we decode their values into the symbol settings.
This makes stracing seccomp failures much easier.
* defs.h (syscall_name): New prototype.
* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
(print_si_info): Decode si_syscall & si_arch for SIGSYS.
* syscall.c (undefined_scno_name): Delete.
(syscall_name): New function.
(trace_syscall_entering): Change undefined_scno_name to syscall_name.
(trace_syscall_exiting): Likewise.
* xlat/audit_arch.in: New file.
Elvira Khabirova [Mon, 17 Aug 2015 19:48:43 +0000 (22:48 +0300)]
ipc.c: remove unnecesarry #ifdef IPC_64
* ipc.c (PRINTCTL): Remove #ifdef IPC_64 check as IPC_64 is always
defined at this point.
Elvira Khabirova [Mon, 3 Aug 2015 04:09:34 +0000 (07:09 +0300)]
resource.c: move times parser to a separate file
* times.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_times): Move to times.c.
Elvira Khabirova [Mon, 3 Aug 2015 05:33:44 +0000 (08:33 +0300)]
sysctl.c: remove KERN_JAVA_* defines handling
This has been obsoleted by binfmt_misc since Linux 2.1.43.
* sysctl.c (sys_sysctl): Remove KERN_JAVA_INTERPRETER
and KERN_JAVA_APPLETVIEWER.
Elvira Khabirova [Mon, 3 Aug 2015 02:37:52 +0000 (05:37 +0300)]
sysinfo.c: remove obsolete code
struct sysinfo members totalhigh, freehigh and mem_unit are present
since Linux 2.3.48.
* configure.ac (AC_CHECK_MEMBERS): Remove struct sysinfo checks.
* sysinfo.c (sys_sysinfo): Remove HAVE_STRUCT_SYSINFO_* checks.
Gleb Fotengauer-Malinovskiy [Fri, 14 Aug 2015 15:49:27 +0000 (17:49 +0200)]
tests: add readlink.test and readlinkat.test
* tests/readlink.c: New file.
* tests/readlink.awk: Likewise.
* tests/readlinkat.c: Likewise.
* tests/readlinkat.awk: Likewise.
* tests/readlink.test: New test.
* tests/readlinkat.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add readlink and readlinkat.
(TESTS): Add readlink.test and readlinkat.test.
(EXTRA_DIST): Add readlink.awk and readlinkat.awk.
* tests/.gitignore: Add readlink and readlinkat.
Dmitry V. Levin [Sat, 8 Aug 2015 12:12:13 +0000 (12:12 +0000)]
Print nanoseconds along with seconds in stat family syscalls
* configure.ac (AC_CHECK_MEMBERS): Add stat.st_atim.tv_nsec,
stat.st_ctim.tv_nsec, stat.st_mtim.tv_nsec, stat.st_atime_nsec,
stat.st_atime_csec, and stat.st_mtime_nsec.
* file.c: Explicitly define HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC and HAVE_STRUCT_STAT_ST_MTIME_NSEC
for locally defined types.
* printstat.h (DO_PRINTSTAT): Print st_atime_nsec, st_ctime_nsec,
and st_mtime_nsec members.
* tests/stat.c [_FILE_OFFSET_BITS == 64]: Use st_atime_nsec,
st_ctime_nsec, and st_mtime_nsec via st_atim.tv_nsec, st_ctim.tv_nsec,
and st_mtim.tv_nsec.
(main): Print st_atime_nsec, st_ctime_nsec, and st_mtime_nsec members.
This fixes Fedora bug #
1251176 .
Dmitry V. Levin [Mon, 3 Aug 2015 09:47:25 +0000 (09:47 +0000)]
signalfd4: fix flags decoding
* configure.ac (AC_CHECK_FUNCS): Add eventfd.
(AC_CHECK_HEADERS): Add sys/signalfd.h.
* signalfd.c: Include <fcntl.h>.
[HAVE_SYS_SIGNALFD_H] Include <sys/signalfd.h>.
Include "xlat/sfd_flags.h".
(do_signalfd): Use sfd_flags for flags decoding.
* xlat/sfd_flags.in: New file.
* tests/signalfd.c: Likewise.
* tests/signalfd.expected: Likewise.
* tests/signalfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add signalfd.
(TESTS): Add signalfd.test.
(EXTRA_DIST): Add signalfd.expected.
* tests/.gitignore: Add signalfd.
Dmitry V. Levin [Mon, 3 Aug 2015 09:14:28 +0000 (09:14 +0000)]
signalfd, signalfd4: mark return code with RVAL_FD flag
* signalfd.c (do_signalfd): Set RVAL_FD flag in the return code.
Dmitry V. Levin [Mon, 3 Aug 2015 09:12:26 +0000 (09:12 +0000)]
signal.c: move signalfd parsers to a separate file
* signalfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (do_signalfd, sys_signalfd, sys_signalfd4): Move to signalfd.c
Dmitry V. Levin [Mon, 3 Aug 2015 09:06:59 +0000 (09:06 +0000)]
perf_event_open: mark return code with RVAL_FD flag
* perf.c (sys_perf_event_open): Set RVAL_FD flag in the return code.
Dmitry V. Levin [Sun, 2 Aug 2015 01:54:48 +0000 (01:54 +0000)]
pipe, pipe2, socketpair: print returned descriptors using printfd
* net.c (printpair_fd, decode_pair_fd): New functions.
(do_pipe, sys_socketpair): Use them.
Dmitry V. Levin [Sun, 2 Aug 2015 01:41:26 +0000 (01:41 +0000)]
socket: mark return code with RVAL_FD flag
* net.c (sys_socket): Set RVAL_FD flag in the return code.
* tests/net-yy-accept.awk: Update socket and bind regexps.
* tests/unix-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Update socket and connect regexps.
* tests/unix-yy-connect.awk: Likewise.
Dmitry V. Levin [Sun, 2 Aug 2015 01:37:19 +0000 (01:37 +0000)]
timerfd, timerfd_create: mark return code with RVAL_FD flag
* time.c (sys_timerfd, sys_timerfd_create): Set RVAL_FD flag
in the return code.
Dmitry V. Levin [Sun, 2 Aug 2015 01:34:57 +0000 (01:34 +0000)]
inotify_init1: mark return code with RVAL_FD flag
* inotify.c (sys_inotify_init1): Set RVAL_FD flag in the return code.
Dmitry V. Levin [Sun, 2 Aug 2015 01:31:40 +0000 (01:31 +0000)]
fanotify_init: mark return code with RVAL_FD flag
* fanotify.c (sys_fanotify_init): Set RVAL_FD flag in the return code.
Dmitry V. Levin [Sat, 1 Aug 2015 23:11:43 +0000 (23:11 +0000)]
Fix epoll_create syscall decoding
* epoll.c (sys_epoll_create): New function.
* linux/dummy.h (sys_epoll_create): Remove.
Dmitry V. Levin [Sat, 1 Aug 2015 23:08:39 +0000 (23:08 +0000)]
epoll_create1: mark return code with RVAL_FD flag
* epoll.c (sys_epoll_create1): Set RVAL_FD flag in the return code.
Dmitry V. Levin [Sat, 1 Aug 2015 23:07:19 +0000 (23:07 +0000)]
epoll_create1: fix pathtrace support
* pathtrace.c (pathtrace_match): Add SEN_epoll_create1.
Dmitry V. Levin [Sat, 1 Aug 2015 23:04:32 +0000 (23:04 +0000)]
epoll_create1: fix flags decoding
* xlat/epollflags.in: Remove EPOLL_NONBLOCK, provide fallback definition
for EPOLL_CLOEXEC.
* tests/epoll_create1.c: New file.
* tests/epoll_create1.expected: Likewise.
* tests/epoll_create1.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add epoll_create1.
(TESTS): Add epoll_create1.test.
(EXTRA_DIST): Add epoll_create1.expected.
* tests/.gitignore: Add epoll_create1.
Dmitry V. Levin [Sat, 1 Aug 2015 22:58:17 +0000 (22:58 +0000)]
desc.c: move epoll parsers to a separate file
* epoll.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (sys_epoll_create1, print_epoll_event, sys_epoll_ctl,
print_epoll_event_array, epoll_wait_common, epoll_wait, epoll_pwait):
Move to epoll.c.
Dmitry V. Levin [Sat, 1 Aug 2015 21:08:13 +0000 (21:08 +0000)]
eventfd2: fix flags decoding
* configure.ac (AC_CHECK_HEADERS): Add sys/eventfd.h.
* eventfd.c: Include <fcntl.h>.
[HAVE_SYS_EVENTFD_H] Include <sys/eventfd.h>.
Include "xlat/efd_flags.h".
(do_eventfd): Use efd_flags for flags decoding.
* xlat/efd_flags.in: New file.
* tests/eventfd.c: New file.
* tests/eventfd.expected: Likewise.
* tests/eventfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add eventfd.
(TESTS): Add eventfd.test.
(EXTRA_DIST): Add eventfd.expected.
* tests/.gitignore: Add eventfd.
Dmitry V. Levin [Sat, 1 Aug 2015 20:43:51 +0000 (20:43 +0000)]
eventfd: print first argument as unsigned int
* eventfd.c (do_eventfd): Explicitly cast initial value to unsigned int.
Dmitry V. Levin [Sat, 1 Aug 2015 20:39:48 +0000 (20:39 +0000)]
Mark eventfd return code with RVAL_FD flag
* eventfd.c (do_eventfd): Set RVAL_FD flag in the return code.
Dmitry V. Levin [Sat, 1 Aug 2015 20:36:53 +0000 (20:36 +0000)]
desc.c: move eventfd parsers to a separate file
* eventfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (do_eventfd, sys_eventfd, sys_eventfd2): Move to eventfd.c.
Dmitry V. Levin [Sat, 1 Aug 2015 20:31:42 +0000 (20:31 +0000)]
Update PERF_FLAG_* constants
* xlat/perf_event_open_flags.in: Add PERF_FLAG_FD_CLOEXEC,
provide fallback definitions.
Dmitry V. Levin [Sat, 1 Aug 2015 20:28:21 +0000 (20:28 +0000)]
desc.c: move perf_event_open parser to a separate file
* perf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (sys_perf_event_open): Move to perf.c.
Elvira Khabirova [Thu, 30 Jul 2015 20:44:12 +0000 (23:44 +0300)]
time.c: remove obsolete code from adjtimex parser
Linux versions 1.3.28 and below are not supported.
* time.c (tprint_timex) [LINUX_VERSION_CODE < 66332]: Remove.
Elvira Khabirova [Fri, 31 Jul 2015 15:44:42 +0000 (18:44 +0300)]
ipc.c: move fallback definitions of msg, sem, and shm constants to xlat/
* ipc.c: Move MSG_STAT and MSG_INFO definitions to xlat/msgctl_flags.in.
Move SHM_STAT and SHM_INFO definitions to xlat/shmctl_flags.in.
Move SEM_STAT and SEM_INFO definitions to xlat/semctl_flags.in.
Dmitry V. Levin [Sat, 1 Aug 2015 08:55:32 +0000 (08:55 +0000)]
tests/ppoll: replace SIGABRT with SIGHUP
Use SIGHUP instead of SIGABRT, the number of the former
is more portable across architectures.
* tests/ppoll.c (test2): Replace SIGABRT with SIGHUP.
* tests/ppoll.expected: Update regexp.
* tests/ppoll-v.expected: Likewise.
Dmitry V. Levin [Sat, 1 Aug 2015 08:34:57 +0000 (08:34 +0000)]
decode_poll_exiting: reserve more space in output buffer
* poll.c (decode_poll_exiting): Reserve more space in output buffer.
Dmitry V. Levin [Thu, 30 Jul 2015 19:46:11 +0000 (19:46 +0000)]
Cleanup poll/ppoll decoders
* poll.c (decode_poll): Split into print_pollfd, decode_poll_entering,
and decode_poll_exiting.
(sys_poll, sys_ppoll): Update callers.
* tests/ppoll.c: New file.
* tests/ppoll.expected: Likewise.
* tests/ppoll-v.expected: Likewise.
* tests/ppoll.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ppoll.
(TESTS): Add ppoll.test.
(EXTRA_DIST): Add ppoll.expected and ppoll-v.expected.
* tests/.gitignore: Add ppoll.
Dmitry V. Levin [Thu, 30 Jul 2015 16:54:31 +0000 (16:54 +0000)]
poll: print timeout argument as int
* poll.c (sys_poll): Explicitly cast timeout argument to int.
Dmitry V. Levin [Thu, 30 Jul 2015 16:49:42 +0000 (16:49 +0000)]
stream.c: move poll and ppoll parsers to a separate file
* poll.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* stream.c (decode_poll, sys_poll, sys_ppoll): Move to poll.c.
Dmitry V. Levin [Thu, 30 Jul 2015 16:23:58 +0000 (16:23 +0000)]
Assume that <poll.h> is available
* configure.ac (AC_CHECK_HEADERS): Remove poll.h and sys/poll.h.
* pathtrace.c: Include <poll.h> unconditionally.
* stream.c: Likewise.
[HAVE_SYS_POLL_H]: Compile unconditionally.
[!HAVE_SYS_POLL_H]: Remove.
Dmitry V. Levin [Thu, 30 Jul 2015 08:24:32 +0000 (08:24 +0000)]
tests: add oldselect.test
* tests/oldselect.c: New file.
* tests/oldselect.expected: Likewise.
* tests/oldselect.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add oldselect.
(TESTS): Add oldselect.test.
(EXTRA_DIST): Add oldselect.expected.
* tests/.gitignore: Add oldselect.
Elvira Khabirova [Wed, 29 Jul 2015 18:38:54 +0000 (21:38 +0300)]
Fix oldselect decoding on 64-bit architectures
As struct sel_arg_struct is an array of 32-bit values,
fetch it using an intermediate array on 64-bit architectures.
* desc.c (sys_oldselect): Rename args to long_args.
[SIZEOF_LONG == 4] Alias oldselect_args to long_args.
[SIZEOF_LONG != 4] Introduce oldselect_args to fetch oldselect args.
* linux/sh64/syscallent.h (oldselect): Remove.
Dmitry V. Levin [Thu, 30 Jul 2015 13:53:42 +0000 (13:53 +0000)]
net.c: use printaddr
* net.c (printsock, sys_recvfrom): Use printaddr.
Denys Vlasenko [Thu, 30 Jul 2015 11:29:20 +0000 (13:29 +0200)]
net.c: recvfrom fixes
This change fixes these three problems (before/after is shown):
On interrupted syscall, flags are not decoded:
-recvfrom(3, 0x7fff0a41e306, 10, 2, 0, 0) = ? ERESTARTSYS
+recvfrom(3, 0x7fff0a41e306, 10, MSG_PEEK, 0, 0) = ? ERESTARTSYS
If peer address is unavalable (example: anon sockets from socketpair()),
kernel returns socklen of 0, but we ignore that and show bogus sockaddr data:
-recvfrom(3, "
123456789 \0", 10, MSG_PEEK, {sa_family=0x7777 /* AF_??? */, sa_data="wwwwwwwwwwwwww"}, [0]) = 10
+recvfrom(3, "
123456789 \0", 10, MSG_PEEK, 0x7ffde6edf760, [0]) = 10
SYS_FUNC(recvfrom) passes address of fromlen, not fromlen, to printsock():
- printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
+ printsock(tcp, tcp->u_arg[4], fromlen);
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Elliott Hughes [Wed, 29 Jul 2015 22:49:38 +0000 (22:49 +0000)]
prctl: decode Android-specific PR_SET_VMA
Android kernels have a prctl to name VMAs.
* prctl.c (sys_prctl) [__ANDROID__]: Decode PR_SET_VMA.
Dmitry V. Levin [Wed, 29 Jul 2015 21:32:35 +0000 (21:32 +0000)]
mips: fix stub files
This complements commit
140ecf876686d49085c6eb3a2306e2ea6ea641bc .
* linux/mips/genstub.sh: Output SEN(printargs) instead of printargs.
Reported-by: Elliott Hughes <enh@google.com>
Dmitry V. Levin [Wed, 29 Jul 2015 16:27:16 +0000 (16:27 +0000)]
tests/bpf: fix build with incompatibly old linux/bpf.h and/or gcc
* configure.ac: Check how union bpf_attr.log_buf initialization works.
* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_LOG_BUF.
Dmitry V. Levin [Wed, 29 Jul 2015 07:59:56 +0000 (07:59 +0000)]
Implement sched_getattr and sched_setattr syscalls decoding
* xlat/sched_flags.in: New file.
* sched.c: Include "xlat/sched_flags.h".
(print_sched_attr, sys_sched_setattr, sys_sched_getattr): New functions.
* linux/dummy.h (sys_sched_getattr, sys_sched_setattr): Remove.
* tests/sched_xetattr.c: New file.
* tests/sched_xetattr.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sched_xetattr.
(TESTS): Add sched_xetattr.test.
* tests/.gitignore: Add sched_xetattr.
Dmitry V. Levin [Tue, 28 Jul 2015 23:03:41 +0000 (23:03 +0000)]
Implement memfd_create syscall decoding
* memfd_create.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_memfd_create): Remove.
* pathtrace.c (pathtrace_match): Add SEN_memfd_create.
* xlat/memfd_create_flags.in: New file.
* tests/memfd_create.c: New file.
* tests/memfd_create.expected: Likewise.
* tests/memfd_create.test: New test.
* tests/Makefile.am: (check_PROGRAMS): Add memfd_create.
(TESTS): Add memfd_create.test.
(EXTRA_DIST): Add memfd_create.expected.
* tests/.gitignore: Add memfd_create.
Elliott Hughes [Tue, 28 Jul 2015 22:39:12 +0000 (22:39 +0000)]
Fix builds where HAVE_MQUEUE_H isn't defined
Android doesn't have <mqueue.h>.
* ipc.c (sys_mq_open) [!HAVE_MQUEUE_H]: Fix printaddr invocation.
Dmitry V. Levin [Mon, 27 Jul 2015 12:34:58 +0000 (12:34 +0000)]
tests/restart_syscall: skip if nanosleep looks uninterrupted
* tests/restart_syscall.test: Skip if restart_syscall is not detected
and nanosleep syscall looks uninterrupted.
Dmitry V. Levin [Sun, 26 Jul 2015 11:06:53 +0000 (11:06 +0000)]
Implement execveat syscall decoding
* execve.c (decode_execve): New function.
(sys_execve): Use it.
(sys_execveat): New function.
* linux/dummy.h (sys_execveat): Remove.
* tests/execveat.c: New file.
* tests/execveat.expected: Likewise.
* tests/execveat-v.expected: Likewise.
* tests/execveat.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add execveat.
(TESTS): Add execveat.test.
(EXTRA_DIST): Add execveat.expected and execveat-v.expected.
* tests/.gitignore: Add execveat.
Dmitry V. Levin [Mon, 27 Jul 2015 10:02:33 +0000 (10:02 +0000)]
execve: fix support of personalities with different word size
* execve.c (printargc): Do not assume that host and target pointers have
the same size.
* tests/execve.c: New file.
* tests/execve.expected: Likewise.
* tests/execve-v.expected: Likewise.
* tests/execve.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add execve.
(TESTS): Add execve.test.
(EXTRA_DIST): Add execve.expected and execve-v.expected.
* tests/.gitignore: Add execve.
Dmitry V. Levin [Sat, 25 Jul 2015 23:55:51 +0000 (23:55 +0000)]
Implement bpf syscall decoding
* bpf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Add linux/bpf.h.
* linux/dummy.h (sys_bpf): Remove.
* pathtrace.c (pathtrace_match): Add SEN_bpf.
* xlat/bpf_commands.in: New file.
* xlat/bpf_map_types.in: New file.
* xlat/bpf_map_update_elem_flags.in: New file.
* xlat/bpf_prog_types.in: New file.
* tests/bpf.c: New file.
* tests/bpf.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add bpf.
(TESTS): Add bpf.test.
* tests/.gitignore: Add bpf.
Dmitry V. Levin [Sat, 25 Jul 2015 09:43:01 +0000 (09:43 +0000)]
prctl: fix decoding of unrecognized commands
The use of printargs introduced by commit
v4.10-179-g210a6b6 is wrong:
when the first argument is already printed, printargs cannot be called.
* prctl.c (print_prctl_args): New function.
(sys_prctl): Use it.
Dmitry V. Levin [Thu, 23 Jul 2015 11:19:47 +0000 (11:19 +0000)]
Macroize -m32/-mx32 configure checks
Prepare for additional configure checks that would be needed
for new multiple personalities support.
* m4/mpers.m4: New file.
* configure.ac: Use it.
Dmitry V. Levin [Wed, 22 Jul 2015 19:31:54 +0000 (19:31 +0000)]
tests/uid: import uid overflow check from tests/uid16
* tests/uid.c (main): Skip if the uid returned by getuid matches
/proc/sys/kernel/overflowuid.
Dmitry V. Levin [Tue, 21 Jul 2015 16:34:25 +0000 (16:34 +0000)]
sh64: fix inotify_{add,rm}_watch syscall entries
* linux/sh64/syscallent.h (inotify_add_watch, inotify_rm_watch):
Set sys_func.
Dmitry V. Levin [Tue, 21 Jul 2015 16:33:00 +0000 (16:33 +0000)]
microblaze: fix several syscall entries
* linux/microblaze/syscallent.h (signalfd4, eventfd2, epoll_create1,
dup3, pipe2, inotify_init1, recvmmsg): Set sys_func.
Dmitry V. Levin [Tue, 21 Jul 2015 16:30:19 +0000 (16:30 +0000)]
hppa: fix several syscall entries
* linux/hppa/syscallent.h (remap_file_pages, mq_open, mq_unlink,
mq_timedsend, mq_timedreceive, mq_notify, mq_getsetattr,
clock_nanosleep, signalfd, timerfd): Set sys_func.
Dmitry V. Levin [Tue, 21 Jul 2015 16:29:26 +0000 (16:29 +0000)]
ia64: fix getpagesize syscall entry
* linux/ia64/syscallent.h (getpagesize): Fux nargs.
Dmitry V. Levin [Tue, 21 Jul 2015 16:28:48 +0000 (16:28 +0000)]
avr32: fix fstatat64 syscall entry
* linux/avr32/syscallent.h (fstatat64): Set sys_func.
Dmitry V. Levin [Tue, 21 Jul 2015 16:26:51 +0000 (16:26 +0000)]
alpha: fix 2 dummy osf syscall entries
* linux/alpha/syscallent.h (osf_set_program_attributes): Fix nargs.
(osf_sigstack): Fix nargs and sys_name.
Dmitry V. Levin [Tue, 21 Jul 2015 16:04:23 +0000 (16:04 +0000)]
alpha, arm, ia64, mips, sh64: fix semop syscall entries
* linux/alpha/syscallent.h (semop): Fix nargs, set sys_func.
* linux/ia64/syscallent.h (semop): Set sys_func.
* linux/mips/syscallent-n32.h (semop): Likewise.
* linux/mips/syscallent-n64.h (semop): Likewise.
* linux/arm/syscallent.h (semop): Fix nargs.
* linux/sh64/syscallent.h (semop): Likewise.
Dmitry V. Levin [Tue, 21 Jul 2015 15:55:09 +0000 (15:55 +0000)]
m68k: fix getpagesize decoding
* linux/m68k/syscallent.h (getpagesize): Set sys_func.
* mem.c [M68K] (sys_getpagesize): Define.
Dmitry V. Levin [Tue, 21 Jul 2015 10:36:03 +0000 (10:36 +0000)]
tests/ip_mreq: skip if basic setsockopt operations fail
* tests/ip_mreq.c (main): Return 77 if basic
IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP options cannot be set.
Dmitry V. Levin [Tue, 21 Jul 2015 10:17:33 +0000 (10:17 +0000)]
tests: use -lpthread instead of -pthread
On some obscure systems, -lpthread is more likely to work than -pthread.
* tests/Makefile.am (filter_unavailable_LDFLAGS): Rename to
filter_unavailable_LDADD and change to -lpthread.
Dmitry V. Levin [Tue, 21 Jul 2015 10:08:42 +0000 (10:08 +0000)]
mips o32: fix utimensat syscall entry
* linux/mips/syscallent-o32.h (utimensat): set sys_flags and sys_func.
Dmitry V. Levin [Tue, 21 Jul 2015 09:55:42 +0000 (09:55 +0000)]
linux/mips/syscallent-compat.h: use designated initializers
Change linux/mips/syscallent-compat.h to use designated initializers
like normal syscallent.h files.
* linux/mips/syscallent-compat.h: Use designated initializers.
Dmitry V. Levin [Tue, 21 Jul 2015 09:45:00 +0000 (09:45 +0000)]
linux/mips/syscallent-compat.h: fix initalization of empty entries
This complements commit
140ecf876686d49085c6eb3a2306e2ea6ea641bc .
* linux/mips/syscallent-compat.h: Fix initalization of empty entries.
Dmitry V. Levin [Mon, 20 Jul 2015 21:37:24 +0000 (21:37 +0000)]
Remove unused parsers of getmsg and putmsg
* stream.c [SPARC || SPARC64] (sys_putmsg, sys_getmsg): Remove.
Stop including "xlat/msgflags.h".
* xlat/msgflags.in: Remove.
Dmitry V. Levin [Mon, 20 Jul 2015 21:33:09 +0000 (21:33 +0000)]
sigreturn: make use of RVAL_DECODED
* sigreturn.c (arch_sigreturn): New function.
(sys_sigreturn): Use it. Return RVAL_DECODED.
* linux/alpha/arch_sigreturn.c: Update.
* linux/crisv10/arch_sigreturn.c: Likewise.
* linux/m68k/arch_sigreturn.c: Likewise.
* linux/microblaze/arch_sigreturn.c: Likewise.
* linux/x86_64/arch_sigreturn.c: Likewise.
Dmitry V. Levin [Mon, 20 Jul 2015 21:18:14 +0000 (21:18 +0000)]
or1k_atomic.c: make use of RVAL_DECODED
* or1k_atomic.c (sys_or1k_atomic): Update for RVAL_DECODED.
Dmitry V. Levin [Fri, 17 Jul 2015 22:03:29 +0000 (22:03 +0000)]
Update openat parser for the RVAL_DECODED change
* open.c (sys_openat): Update for RVAL_DECODED.
Dmitry V. Levin [Mon, 20 Jul 2015 19:35:42 +0000 (19:35 +0000)]
bjm.c: make use of RVAL_DECODED
* bjm.c (sys_create_module, sys_delete_module, sys_init_module,
sys_finit_module): Update for RVAL_DECODED.
Dmitry V. Levin [Mon, 20 Jul 2015 19:27:51 +0000 (19:27 +0000)]
access.c: make use of RVAL_DECODED
* access.c (decode_access, sys_faccessat): Update for RVAL_DECODED.