d77f6693e4
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.
2015-08-19 13:36:44 +00:00
6684b6857c
mips: print _MIPS_SIM in configure.ac for debug purposes
...
* configure.ac [MIPS]: Print _MIPS_SIM.
2015-08-19 13:36:44 +00:00
daae8f9204
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.
2015-08-19 13:36:44 +00:00
9f1eb12d11
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.
2015-08-19 13:36:44 +00:00
41b9facc2a
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.
2015-08-18 20:28:54 +00:00
fe50316d2c
Simplify printing of get_robust_list first argument
...
* get_robust_list.c (sys_get_robust_list): Print first argument
using "%d" format.
2015-08-18 19:16:36 +00:00
Elvira Khabirova
afac9f0207
Fix io_setup first argument printing
...
* aio.c (sys_io_setup): Print first argument using "%u" format.
2015-08-18 16:42:37 +00:00
2479ef0bce
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>
2015-08-18 16:15:33 +00:00
f9b455cfd2
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.
2015-08-18 15:10:55 +00:00
Mike Frysinger
d2eaf67486
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.
2015-08-18 07:51:54 +00:00
Elvira Khabirova
4d2c8a2cf7
ipc.c: remove unnecesarry #ifdef IPC_64
...
* ipc.c (PRINTCTL): Remove #ifdef IPC_64 check as IPC_64 is always
defined at this point.
2015-08-18 07:48:37 +00:00
Elvira Khabirova
254ff1e623
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.
2015-08-16 10:05:19 +00:00
Elvira Khabirova
f1bb6391ea
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.
2015-08-16 09:41:28 +00:00
Elvira Khabirova
3a58e46d45
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.
2015-08-16 09:37:28 +00:00
Gleb Fotengauer-Malinovskiy
3af6aabe52
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.
2015-08-15 02:21:22 +02:00
525eed33fa
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 .
2015-08-09 09:19:55 +00:00
30ac0627f2
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.
2015-08-03 09:57:14 +00:00
9e8a84fa3d
signalfd, signalfd4: mark return code with RVAL_FD flag
...
* signalfd.c (do_signalfd): Set RVAL_FD flag in the return code.
2015-08-03 09:14:28 +00:00
2307d5c968
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
2015-08-03 09:12:26 +00:00
57823c6836
perf_event_open: mark return code with RVAL_FD flag
...
* perf.c (sys_perf_event_open): Set RVAL_FD flag in the return code.
2015-08-03 09:09:27 +00:00
2a4f0521fc
pipe, pipe2, socketpair: print returned descriptors using printfd
...
* net.c (printpair_fd, decode_pair_fd): New functions.
(do_pipe, sys_socketpair): Use them.
2015-08-03 09:09:26 +00:00
3d463be47e
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.
2015-08-03 09:09:26 +00:00
07c878a9b5
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.
2015-08-03 09:09:00 +00:00
323d912e0c
inotify_init1: mark return code with RVAL_FD flag
...
* inotify.c (sys_inotify_init1): Set RVAL_FD flag in the return code.
2015-08-02 01:34:57 +00:00
5d22f0742a
fanotify_init: mark return code with RVAL_FD flag
...
* fanotify.c (sys_fanotify_init): Set RVAL_FD flag in the return code.
2015-08-02 01:31:40 +00:00
baaa41c97a
Fix epoll_create syscall decoding
...
* epoll.c (sys_epoll_create): New function.
* linux/dummy.h (sys_epoll_create): Remove.
2015-08-02 00:10:52 +00:00
7b378e6b04
epoll_create1: mark return code with RVAL_FD flag
...
* epoll.c (sys_epoll_create1): Set RVAL_FD flag in the return code.
2015-08-02 00:10:52 +00:00
2716346602
epoll_create1: fix pathtrace support
...
* pathtrace.c (pathtrace_match): Add SEN_epoll_create1.
2015-08-02 00:10:52 +00:00
bf62c1b52d
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.
2015-08-02 00:10:48 +00:00
aba868c6c4
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.
2015-08-01 23:30:03 +00:00
c8cba990a2
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.
2015-08-01 22:23:58 +00:00
00cc35079e
eventfd: print first argument as unsigned int
...
* eventfd.c (do_eventfd): Explicitly cast initial value to unsigned int.
2015-08-01 20:46:43 +00:00
ede0c48554
Mark eventfd return code with RVAL_FD flag
...
* eventfd.c (do_eventfd): Set RVAL_FD flag in the return code.
2015-08-01 20:46:43 +00:00
28471d17f9
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.
2015-08-01 20:46:43 +00:00
73a4fa43f5
Update PERF_FLAG_* constants
...
* xlat/perf_event_open_flags.in: Add PERF_FLAG_FD_CLOEXEC,
provide fallback definitions.
2015-08-01 20:46:43 +00:00
0d60cf753e
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.
2015-08-01 20:46:37 +00:00
Elvira Khabirova
2c217fd8e2
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.
2015-08-01 16:52:43 +00:00
Elvira Khabirova
f9ce39d1e4
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.
2015-08-01 16:52:43 +00:00
0c0453a1cb
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.
2015-08-01 16:52:13 +00:00
3b9d315e8c
decode_poll_exiting: reserve more space in output buffer
...
* poll.c (decode_poll_exiting): Reserve more space in output buffer.
2015-08-01 08:37:46 +00:00
d9fb450748
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.
2015-07-30 22:03:07 +00:00
c18b002fe9
poll: print timeout argument as int
...
* poll.c (sys_poll): Explicitly cast timeout argument to int.
2015-07-30 22:03:07 +00:00
811bda6225
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.
2015-07-30 22:03:07 +00:00
80d5e012a1
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.
2015-07-30 22:03:07 +00:00
ea7ef9365f
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.
2015-07-30 22:03:07 +00:00
Elvira Khabirova
c44df3e3ca
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.
2015-07-30 22:02:56 +00:00
52dc1506ab
net.c: use printaddr
...
* net.c (printsock, sys_recvfrom): Use printaddr.
2015-07-30 13:53:42 +00:00
Denys Vlasenko
383386de73
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>
2015-07-30 13:38:32 +02:00
Elliott Hughes
1d246ce3d4
prctl: decode Android-specific PR_SET_VMA
...
Android kernels have a prctl to name VMAs.
* prctl.c (sys_prctl) [__ANDROID__]: Decode PR_SET_VMA.
2015-07-29 22:54:11 +00:00
0e4b1f2eb3
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>
2015-07-29 22:54:11 +00:00