Commit Graph

136 Commits

Author SHA1 Message Date
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
e9c702f9ad Introduce NSIG_BYTES
* nsig.h (NSIG_BYTES): New macro.
* desc.c: Use it in comments instead of NSIG.
* epoll.c: Likewise.
* poll.c: Likewise.
* signalfd.c: Likewise.
* signal.c: Likewise.
(sprintsigmask_n, print_sigset_addr_len_limit): Use it instead of NSIG.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
* tests/pselect6.c (main): Likewise.
2016-12-27 23:32:44 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
d4e4e873ee desc: change tracee address type from long to kernel_ureg_t
* desc.c (decode_select): Rename arg to addr, change its type
from long to kernel_ureg_t.
2016-12-25 11:32:45 +00:00
61b2e2199f print_time*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (sprint_timeval32, print_timeval32,
print_timeval32_pair, print_itimerval32): Change address argument type
from long to kernel_ureg_t.
* desc.c (decode_select): Change the type of tracee address argument
of print_tv_ts and sprint_tv_ts from long to kernel_ureg_t.
* print_timespec.c (print_timespec, sprint_timespec,
print_timespec_utime_pair, print_itimerspec): Change address argument
type from long to kernel_ureg_t.
* print_timeval.c (print_timeval, print_timeval_pair, sprint_timeval,
print_itimerval, print_timeval32, print_timeval32_pair,
print_itimerval32, sprint_timeval32): Likewise.
2016-12-25 11:32:44 +00:00
956e3a34a3 umove*: change tracee address argument type from long to kernel_ureg_t
* defs.h (umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr,
umoven_or_printaddr_ignore_syserror): Change tracee address argument
type from long to kernel_ureg_t.
(print_array): Change the type of tracee address argument of umoven_func
from long to kernel_ureg_t.
* desc.c (umove_kulong_array_or_printaddr): Change tracee address
argument type from long to kernel_ureg_t.
* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise.
2016-12-25 11:32:43 +00:00
274348cbac desc: remove redundant casts
* desc.c (umove_kulong_array_or_printaddr): Remove redundant cast
from uint32_t to kernel_ulong_t.
(SYS_FUNC(pselect6)): Remove redundant casts from kernel_ulong_t
to unsigned long.
2016-12-23 00:01:58 +00:00
b3d82da686 Check for current_klongsize instead of current_personality where appropriate
current_klongsize checks are more universal, therefore they are usually
shorter and easier to comprehend.

* desc.c (umove_kulong_array_or_printaddr): Check for current_klongsize
instead of current_personality and current_wordsize.
* io.c (print_lld_from_low_high_val): Likewise.
* lseek.c (SYS_FUNC(lseek)): Likewise.
* resource.c (decode_rlimit): Likewise.
* syscall.c (is_negated_errno): Likewise.
* util.c (getllval, getarg_klu): Likewise.
2016-12-19 19:58:16 +00:00
a2485b86e7 Use kernel_ulong_t instead of unsigned long long where appropriate
* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t.  All callers updated.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t.  All callers updated.
(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
PRI_klu format.
* desc.c (SYS_FUNC(pselect6)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
PRI_klx format.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
* util.c (printaddr_ull): Rename to printaddr_klu, change argument
type from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
(getarg_ull): Rename to getarg_klu, change return value type
from unsigned long long to kernel_ulong_t, print it using
PRI_klx format.
2016-12-19 19:58:16 +00:00
fc346f1d91 struct tcb: make types of syscall arguments unsigned
This is the first step in the direction of revisiting current practice
of indiscriminate use of signed types for syscall arguments and memory
addresses.

* kernel_types.h (kernel_ureg_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of u_arg from long to kernel_ureg_t.
[HAVE_STRUCT_TCB_EXT_ARG]: Change type of ext_arg from long long
to unsigned long long.
* desc.c (decode_select): Change type of syscall arguments from long
to kernel_ureg_t.
(SYS_FUNC(oldselect)): Change type of select_args from long
to kernel_ureg_t.
* io.c (print_lld_from_low_high_val): Remove no longer needed cast
of syscall arguments to unsigned long.
* lseek.c (SYS_FUNC(lseek)): Cast syscall argument from unsigned long
to long.
* mem.c (print_mmap): Change type of syscall arguments from long
to kernel_ureg_t.
(SYS_FUNC(old_mmap), SYS_FUNC(old_mmap_pgoff)): Change type of u_arg
from long to kernel_ureg_t.
(SYS_FUNC(mmap), SYS_FUNC(mmap_pgoff), SYS_FUNC(mmap_pgoff)): Remove
no longer needed cast of syscall arguments to unsigned long.
* pathtrace.c (pathtrace_match): Change type of args and select_args
from long to kernel_ureg_t.
* util.c (getarg_ull): Remove no longer needed casts of syscall
arguments to unsigned types.
2016-12-19 12:38:29 +00:00
4cb2d29f2f Cleanup oldselect
* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.
2016-12-19 11:40:43 +00:00
f55ef46feb Include "kernel_types.h" in defs.h and tests/tests.h
As kernel_ulong_t type is going to be used in the definition
of struct tcb and in many function prototypes, make it readily
available for every source file by including "kernel_types.h"
in defs.h and tests/tests.h files.

* defs.h: Include "kernel_types.h".
* tests/tests.h: Likewise.
* desc.c: Do not include "kernel_types.h".
* dirent.c: Likewise.
* keyctl.c: Likewise.
* syscall.c: Likewise.
* linux/asm_stat.h: Likewise.
* tests/answer.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/fanotify_init.c: Likewise.
* tests/fanotify_mark.c: Likewise.
* tests/file_handle.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/getdents.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/inotify.c: Likewise.
* tests/inotify_init1.c: Likewise.
* tests/ioprio.c: Likewise.
* tests/ipc_msgbuf.c: Likewise.
* tests/kcmp.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/kexec_load.c: Likewise.
* tests/keyctl.c: Likewise.
* tests/lookup_dcookie.c: Likewise.
* tests/lseek.c: Likewise.
* tests/mq_sendrecv.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/prctl-pdeathsig.c: Likewise.
* tests/prctl-tsc.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/process_vm_readv_writev.c: Likewise.
* tests/read-write.c: Likewise.
* tests/setfsugid.c: Likewise.
* tests/setns.c: Likewise.
* tests/truncate.c: Likewise.
* tests/unshare.c: Likewise.
* tests/xgetrlimit.c: Likewise.
2016-12-16 12:01:44 +00:00
fbec510297 alpha: alias getdtablesize to printargs
* linux/dummy.h [ALPHA] (sys_getdtablesize): Alias to printargs.
* desc.c [ALPHA] (SYS_FUNC(getdtablesize)): Remove.
2016-01-08 18:53:27 +00:00
e67c8e44db Replace %Ld/%Lu printf format specifiers with %lld/%llu
As %Ld and %Lu printf format specifiers are not quite portable,
replace them with %lld and %llu, respectively.

* desc.c (SYS_FUNC(pselect6)): Replace %Lu with %llu.
* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Likewise.
* times.c (SYS_FUNC(times)): Likewise.
* fcntl.c (print_struct_flock64): Replace %Ld with %lld.
* tests/ftruncate.c (main): Replace %Lu with %llu.
* tests/ftruncate64.c (main): Likewise.
* tests/getdents.c (print_dirent): Likewise.
* tests/llseek.c (main): Likewise.
* tests/lseek.c (main): Likewise.
* tests/truncate.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/xstatx.c (main): Likewise.
* tests/pselect6.c (main): Replace %Ld with %lld.
* tests/xselect.c(main): Likewise.

Reported-by: Szabolcs Nagy <nsz@port70.net>
2015-12-16 00:07:16 +00:00
4408e8595c x32: fix pselect6 decoding
* desc.c: Include "kernel_types.h".
(umove_kulong_array_or_printaddr): New function.
(SYS_FUNC(pselect6)): Use it.
2015-11-27 04:37:46 +00:00
2512003cea desc.c: move parser of fcntl syscall to a separate file
* fcntl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (printflock64, printflock, SYS_FUNC(fcntl)): Move to fcntl.c.
2015-10-08 22:41:54 +00:00
5d68f468f4 desc.c: move parser of flock syscall to a separate file
* flock.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (SYS_FUNC(flock)): Move to flock.c.
2015-10-08 22:41:54 +00:00
4cb5ccca24 Convert another parser of struct timeval to new mpers infrastructure
* print_time.c (sprint_timeval): New mpers printer.
[ALPHA] (sprint_timeval32): New function.
* defs.h [ALPHA] (sprint_timeval32): New prototype.
(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
* desc.c (decode_select): Replace bitness parameter with two printers.
Use them instead of printtv_bitness and sprinttv.
(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
to decode_select.
[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
to decode_select.
(pselect6): Pass print_timespec and sprint_timespec to decode_select.
* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.
2015-09-19 04:04:49 +03:00
b172a94d02 Add a new helper function umove_ulong_array_or_printaddr
* defs.h (umove_ulong_array_or_printaddr): New prototype.
* util.c (umove_ulong_array_or_printaddr): New function.
* desc.c (sys_pselect6): Use it instead of open-coding
a proxy struct parser for different personalities.
* io.c (tprint_iov_upto): Use it instead of open-coding
a struct iovec parser for different personalities.
* kexec.c (print_kexec_segments): Use it instead of open-coding
a struct kexec_segment parser for different personalities.
(print_seg): Pass arguments using an array.
2015-09-15 11:23:27 +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
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
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
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
cbabaf9141 Alias sys_epoll_create to printargs_ld
* desc.c (sys_epoll_create): Remove.
* linux/dummy.h (sys_epoll_create): Alias to printargs_ld.
2015-07-20 22:03:07 +00:00
df0c18c4a3 desc.c: make use of RVAL_DECODED
* desc.c (sys_flock, sys_close, sys_dup, do_dup2, sys_epoll_create1,
sys_epoll_ctl, do_eventfd, sys_perf_event_open): Update
for RVAL_DECODED.
2015-07-20 22:03:07 +00:00
e6019fd424 desc.c: do not use xmalloc, use umove_or_printaddr and printaddr
* desc.c (printflock64, printflock): Use umove_or_printaddr.
(decode_select): Do not use xmalloc.  Use umoven_or_printaddr
and printaddr.
(sys_oldselect): Use printaddr.
(sys_epoll_ctl): Use umoven_or_printaddr and printaddr.
(print_epoll_event_array): New function.
(sys_epoll_wait_common): Use it.
(sys_pselect6): Use umove_or_printaddr.
(sys_eventfd2): Use printaddr.
2015-07-20 22:03:07 +00:00
3e9d71feaa Introduce memory allocation wrappers
Introduce wrappers to the following functions that do memory allocation:
malloc, calloc, realloc, strdup.

This commit is a follow-up to the related discussions in strace-devel ML:
http://sourceforge.net/p/strace/mailman/message/33618180/
http://sourceforge.net/p/strace/mailman/message/33733470/

* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
* xmalloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* count.c (count_syscall, call_summary_pers): Use xcalloc.
* desc.c (decode_select): Use xmalloc.
* dirent.c (sys_getdents, sys_getdents64): Likewise.
* net.c (sys_recvmmsg): Use xstrdup.
* pathtrace.c (storepath): Use xreallocarray.
(pathtrace_match): Use xmalloc.
* strace.c (die_out_of_memory): Move to xmalloc.c.
(expand_tcbtab): Use xcalloc and xreallocarray.
(startup_child): Use xstrdup.
(init): Use xmalloc, xcalloc, and xstrdup.
* syscall.c (reallocate_qual): Use xreallocarray.
(qualify): Use xstrdup.
* unwind.c (unwind_tcb_init): Use xmalloc.
(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
(get_symbol_name): Use xreallocarray.
(stacktrace_walk, queue_put): Use xmalloc.
* util.c (printstr): Use xmalloc.
* vsprintf.c (strace_vfprintf): Likewise.
2015-05-25 22:25:22 +00:00
a0bd3749fc Declare syscall parsers using SYS_FUNC macro
Introduce SYS_FUNC macro to declare and define all syscall parsers.

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
(sys_func.h): New rule.
* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
* linux/syscall.h: Include "sys_func.h".
[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
Remove other declarations.
* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
and osf_fstatfs syscall parsers.
* *.c: Use SYS_FUNC to define syscall parsers.
2015-04-07 11:22:49 +00:00
Denys Vlasenko
7e69ed98cd Change last parameter of umoven() from char* to void*
Saves tons of casts.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 19:50:53 +01:00
2fc5d80858 decode_select: do not allocate unused memory
* desc.c (decode_select): On entering syscall, do not allocate memory
in non-verbose mode.
2015-01-28 01:26:04 +00:00
6522f132ba decode_select: fix potential use of an uninitialized variable
A pointer to fd_set was used uninitialized when nfds == 0.

* desc.c (decode_select): Initialize fds.

Reported-by: Zubin Mithra <zubin.mithra@gmail.com>
2014-09-09 22:51:05 +00:00
Zubin Mithra
64aa1b1e2d Decode paths associated with file descriptors returned by syscalls
* defs.h (RVAL_FD): New macro.
(RVAL_MASK, RVAL_STR, RVAL_NONE): Update.
* desc.c (sys_dup, sys_delete_module): New functions.
(do_dup2, decode_open, sys_creat): Change return value to RVAL_FD.
* linux/dummy.h (sys_delete_module, sys_dup): Remove.
* linux/syscall.h (sys_delete_module, sys_dup): New prototypes.
* syscall.c (trace_syscall_exiting): Handle RVAL_FD.

Signed-off-by: Zubin Mithra <zubin.mithra@gmail.com>
2014-06-04 16:28:04 +00:00
d35bdcad13 Compress blank lines
Suppress empty lines left after automated xlat conversion.
2014-05-30 22:10:21 +00:00
0ed617bd66 Generate xlat/*.in files
Automatically convert xlat structures from *.c files to xlat/*.in files
using "./generate_xlat_in.sh *.c" command.
2014-05-30 21:40:03 +00:00
e51ce47b11 epoll_ctl: fix EPOLL_CTL_DEL argument decoding
* desc.c (sys_epoll_ctl): Do not parse the event structure for
EPOLL_CTL_DEL operation.

Reported-by: Марк Коренберг <socketpair@gmail.com>
2014-04-17 14:33:59 +00:00
54cabefc75 Fix fcntl decoding
Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined or
not defined altogether.
Do not assume that sizeof(off_t) < sizeof(long long) when F_SETLK64 is
undefined.

This change fixes build with musl libc on x86.

* configure.ac: Define SIZEOF_OFF_T.
* desc.c (USE_PRINTFLOCK64): New macro.
(struct flock64, printflock64): Do not define on X32.
(printflock): Replace X32 specific workaround with SIZEOF_OFF_T check.
Fix printing off_t members of struct flock.
(sys_fcntl): Use USE_PRINTFLOCK64.
2014-03-03 23:30:04 +00:00
ec21e07441 sys_fcntl: remove F_FREESP and F_FREESP64 support
F_FREESP and F_FREESP64 fcntl commands are not available in Linux
and therefore the code implementing their decoding is useless.
Besides that, F_FREESP64 decoding is too complicated to support.

* desc.c (fcntlcmds): Remove F_FREESP and F_FREESP64.
Remove F_FREESP64 from the check whether to define struct flock64.
(sys_fcntl): Remove F_FREESP and F_FREESP64 support.
2014-03-01 21:17:17 +00:00
5945273533 Use XLAT_END macro
Automatically update all xlat structures using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
2014-02-05 02:28:18 +00:00
bce0cc6a2d Use XLAT macro
Automatically convert all xlat structures to XLAT form
using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
2014-02-05 01:33:50 +00:00
594eb8f8f8 Define printflock64 only if it is referenced by other code
* configure.ac (AC_CHECK_TYPES): Add struct flock64.
* desc.c (HAVE_F_SETLK64, HAVE_F_SETLKW64, HAVE_F_GETLK64): New macros.
[!HAVE_STRUCT_FLOCK64] (struct flock64): Define.
(printflock64): Define only if referenced by other code.
(sys_fcntl): Handle F_FREESP64, F_SETLK64, F_SETLKW64, and F_GETLK64 iff
these constants are defined and differ from their non-64bit versions.
2013-11-12 22:10:44 +00:00
2b64034786 Move io_* syscalls decoding to a separate file
* desc.c (sys_io_setup, sys_io_destroy, sys_io_submit, sys_io_cancel,
sys_io_getevents, declarations from libaio.h): Move to ...
* aio.c: new file.
* Makefile.am (strace_SOURCES): Add aio.c.
2013-11-11 15:06:18 +00:00
Denys Vlasenko
2df03c494e Stop using external libaio.h.
This change incorporates a partial copy instead
of using external libaio.h.
Why?
Because we want to properly decode 32-bit aio calls
by 64-bit strace. For that, we need more definitions than
libaio.h provides.
(These defs are not done yet, but will eventually be done).
Keeping our local 32-bit compat defs in sync with libaio.h
_without seeing libaio structs_ is hard/more bug prone.
A smaller benefit is that we don't need libaio installed.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-11 12:50:47 +01:00
Denys Vlasenko
abd2fda380 sys_io_submit: simplify iocb_cmd_lookup() helper.
This helper returns two values (a string and an enum).
The caller prints the string. It's simpler to just print
the string in the caller itself. This eliminates
"return by reference" and more importantly, an intermediate
static string buffer for the string result.

Since function of the helper is different now,
it is renamed to tprint_lio_opcode().

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-11 12:31:18 +01:00
Denys Vlasenko
ab24d51828 sys_io_submit: stop traversing iocb vector after first failure.
The program may use a very large nr but supply either outright
invalid iocbpp[], or one with far fewer elements than nr.
We used to try reading iocbpp[i] until i == nr.
With this change, we stop on the first failure.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-11 12:24:29 +01:00
Denys Vlasenko
b338f2d65e Fix select decoding on e.g. 32-bit ppc process by 64-bit strace.
Added next_set_bit() function which finds the next set bit,
properly taking into account word size of the traced process.
Use it in decode_select() instead of fd_isset().
Also, properly round fdsize up to word size of traced process,
not to strace's word size.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-09 20:40:31 +01:00
Denys Vlasenko
1297a513da Speed up and explain fd_isset()
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-06 11:34:02 +01:00
c2982b5b72 Fix select decoding for glibc in _FORTIFY_SOURCE mode
glibc in _FORTIFY_SOURCE mode raises SIGABRT when descriptor greater
or equal to FD_SETSIZE is passed to FD_ISSET.  Select family syscalls,
however, can legitimately accept such descriptors.  To overcome this
limitation, we have to replace FD_ISSET with an equivalent that imposes
no such restrictions.

* desc.c (fd_isset): New function.
(decode_select): Use it instead of FD_ISSET.
2013-11-05 23:35:37 +00:00
f3696b3c8b More select decoding fixes
* desc.c (decode_select): Actually print arg[0] as int on entering
syscall.  When arg[0] is negative, do not attempt to fetch and decode
descriptor sets on entering syscall, kernel will reject it anyway.
On exiting syscall, stop checking descriptor sets as soon as all
returned descriptors are found.
2013-11-05 22:46:43 +00:00
Denys Vlasenko
1f65c3cd2a Truncate arg[0] to int in select decoding.
This matches kernel's behavior.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-05 16:20:16 +01:00