]> granicus.if.org Git - strace/log
strace
8 years agotests: check decoding of mq_{notify,open,timedreceive,timedsend,unlink}
Eugene Syromyatnikov [Thu, 27 Oct 2016 07:18:44 +0000 (10:18 +0300)]
tests: check decoding of mq_{notify,open,timedreceive,timedsend,unlink}

* tests/mq_sendrecv.c: New file.
* tests/mq_sendrecv-read.c: Likewise.
* tests/mq_sendrecv-write.c: Likewise.
* tests/mq_sendrecv.test: New test.
* tests/mq_sendrecv-read.test: Likewise.
* tests/mq_sendrecv-write.test: Likewise.
* tests/.gitignore: Add mq_sendrecv, mq_sendrecv-read,
and mq_sendrecv-write.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(mq_sendrecv_LDADD, mq_sendrecv_read_LDADD, mq_sendrecv_write_LDADD):
New variables.
(DECODER_TESTS): Add mq_sendrecv.test, mq_sendrecv-read.test,
and mq_sendrecv-write.test.

8 years agotests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work
Dmitry V. Levin [Tue, 8 Nov 2016 15:32:47 +0000 (15:32 +0000)]
tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work

* tests/times.c (main): Skip if clock_gettime consistenly returns zero
for CLOCK_PROCESS_CPUTIME_ID timer.

8 years agotests: add tests for perf_event_attr structure decoding in perf_event_open
Eugene Syromyatnikov [Sun, 2 Oct 2016 22:35:53 +0000 (01:35 +0300)]
tests: add tests for perf_event_attr structure decoding in perf_event_open

* configure.ac: Add checks for presence of various fields of struct
perf_event_attr defined in kernel headers.
* tests/perf_event_open.c: New file.
* tests/perf_event_open_unabbrev.c: Likewise.
* tests/perf_event_open.test: New test.
* tests/perf_event_open_unabbrev.test: Likewise.
* tests/.gitignore: Add perf_event_open, perf_event_open_unabbrev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add perf_event_open.test, perf_event_open_unabbrev.test.

8 years agoImplement decoding of perf_event_attr structure in perf_event_open syscall
Eugene Syromyatnikov [Sat, 3 Sep 2016 11:44:48 +0000 (14:44 +0300)]
Implement decoding of perf_event_attr structure in perf_event_open syscall

* linux/perf_event_struct.h: New file, definition of struct perf_event_attr
from Linux 4.8
* Makefile.am (strace_SOURCES): Add it.
* xlat/hw_breakpoint_len.in: New file.
* xlat/hw_breakpoint_type.in: Likewise.
* xlat/perf_attr_size.in: Likewise.
* xlat/perf_branch_sample_type.in: Likewise.
* xlat/perf_event_read_format.in: Likewise.
* xlat/perf_event_sample_format.in: Likewise.
* xlat/perf_hw_cache_id.in: Likewise.
* xlat/perf_hw_cache_op_id.in: Likewise.
* xlat/perf_hw_cache_op_result_id.in: Likewise.
* xlat/perf_hw_id.in: Likewise.
* xlat/perf_sw_ids.in: Likewise.
* xlat/perf_type_id.in: Likewise.
* perf.c [HAVE_LINUX_PERF_EVENT_H]: Remove inclusion of
<linux/perf_event.h>.
(PRINT_XLAT): New macro for simplifying printing values from
sorted xlat.
(printxlat_search): New function, wrapper for xlat_search with behaviour
similar to printval.
(print_perf_event_attr): New print_event_attr structure fetching and
printing function.
(SYS_FUNC(perf_event_open)): Use print_perf_event_attr for displaying
attr argument contents.
* tests/perf_event_open.c: Renamed to
tests/perf_event_open_nonverbose.c.
* tests/perf_event_open.test: add -e verbose=none in order to preserve
output format being checked (in case verbose output is enabled,
contents of attr arguments are shown now); rename to
tests/perf_event_open_nonverbose.test; add -e trace=perf_event_open.

8 years agotests: fix name spelling
Eugene Syromyatnikov [Sun, 30 Oct 2016 20:44:50 +0000 (23:44 +0300)]
tests: fix name spelling

8 years agotests: fix name spelling
Eugene Syromyatnikov [Sun, 30 Oct 2016 20:44:50 +0000 (23:44 +0300)]
tests: fix name spelling

8 years agoUpdate NEWS
Eugene Syromyatnikov [Sat, 29 Oct 2016 01:34:37 +0000 (04:34 +0300)]
Update NEWS

8 years agoFix typo in comment in tests/quotactl.h
Eugene Syromyatnikov [Sun, 30 Oct 2016 20:16:34 +0000 (23:16 +0300)]
Fix typo in comment in tests/quotactl.h

8 years agotests: fix invalid pointer checks in quotactl test
Eugene Syromyatnikov [Sun, 30 Oct 2016 19:28:37 +0000 (22:28 +0300)]
tests: fix invalid pointer checks in quotactl test

* tests/quotactl.h (bogus_special, bogus_addr): Move it...
* tests/quotactl.c (main): ... here; remove static and const qualifiers,
use memory after tail_alloc instead of magic numbers.
* tests/quotactl-xfs.c (main): Likewise.

8 years agotests: fix invalid pointer checks in getcpu test
Eugene Syromyatnikov [Sun, 30 Oct 2016 19:27:55 +0000 (22:27 +0300)]
tests: fix invalid pointer checks in getcpu test

* test/getcpu.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.

8 years agotests: fix invalid pointer checks in request_key test
Eugene Syromyatnikov [Sun, 30 Oct 2016 19:27:18 +0000 (22:27 +0300)]
tests: fix invalid pointer checks in request_key test

* test/request_key.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.

8 years agotests: fix invalid pointer checks in add_key test
Eugene Syromyatnikov [Sun, 30 Oct 2016 19:27:07 +0000 (22:27 +0300)]
tests: fix invalid pointer checks in add_key test

* test/add_key.c (main): Replace magic numbers deemed invalid pointers
with addresses after memory returned by tail_alloc.

8 years agostatfs: use printxval_search
Eugene Syromyatnikov [Sat, 29 Oct 2016 02:29:15 +0000 (05:29 +0300)]
statfs: use printxval_search

* print_statfs.c (print_statfs_type): Use printxval_search for printing
FS magic xlat value.

8 years agoutil: add printing helper for sorted xlat arrays
Eugene Syromyatnikov [Sat, 29 Oct 2016 02:26:50 +0000 (05:26 +0300)]
util: add printing helper for sorted xlat arrays

* util.c (printxval_searchn): New function.
* defs.h (printxval_searchn): New prototype.
(printxval_search): New helper macro useful in conjunction with static
xlat arrays.

8 years agodefs: add check for argument being array to ARRAY_SIZE macro
Eugene Syromyatnikov [Sat, 29 Oct 2016 02:24:08 +0000 (05:24 +0300)]
defs: add check for argument being array to ARRAY_SIZE macro

* gcc_compat.h [GNUC_PREREQ(3, 0)] (BUILD_BUG_ON_ZERO): New macro.
(SAME_TYPE, MUST_BE_ARRAY): Likewise.
* defs.h (ARRAY_SIZE): Add MUST_BE_ARRAY for build-time type check.

8 years agotests: check decoding of oldfstat, oldlstat, and oldstat syscalls
Eugene Syromyatnikov [Mon, 24 Oct 2016 01:50:36 +0000 (04:50 +0300)]
tests: check decoding of oldfstat, oldlstat, and oldstat syscalls

* tests/oldfstat.c: New file.
* tests/oldlstat.c: Likewise.
* tests/oldstat.c: Likewise.
* tests/oldfstat.test: New test.
* tests/oldlstat.test: Likewise.
* tests/oldstat.test: Likewise.
* tests/xstatx.c [!OLD_STAT]: define OLD_STAT to 0.
(print_stat) [OLD_STAT]: Print predefined values for
st_blksize/st_blocks.
(print_stat): Check for !OLD_STAT in nanosecond precision checks.
(main) [OLD_STAT]: Ignore EOVERFLOW.
(main): Test for successful rc in returned size value check;
print address only on non-successful rc.
* tests/.gitignore: Add oldfstat, oldlstat, and oldstat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add oldfstat.test, oldlstat.test, and oldstat.test.

8 years agotests: additional tests of stat decoders
Eugene Syromyatnikov [Wed, 19 Oct 2016 08:11:41 +0000 (11:11 +0300)]
tests: additional tests of stat decoders

* tests/fstatx.c (IS_FSTAT): Define to 1.
* tests/fstatat64.c [__GLIBC__ && __sparc64__] (TEST_BOGUS_STRUCT_STAT):
Define to 0.
* tests/xstatx.c [!IS_STAT] (IS_STAT): Define to 0.
[!TEST_BOGUS_STRUCT_STAT] (TEST_BOGUS_STRUCT_STAT): Define to 1.
(main): Add a check for non-available pointer and a check
for block device file.
* tests/statx.sh: Add tracing of /dev/full file, specify alignment.
* tests/fstat.test: Specify alignment.

8 years agotests: prepare for additional tests of stat decoders
Eugene Syromyatnikov [Wed, 19 Oct 2016 08:11:41 +0000 (11:11 +0300)]
tests: prepare for additional tests of stat decoders

PRINT_SYSCALL_HEADER/PRINT_SYSCALL_FOOTER now contain open/close brace
pair in order to save errno.  PRINT_SYSCALL_FOOTER now uses sprintrc for
printing rc/errno.

* tests/xstatx.c: Include <errno.h>.
(main): Update PRINT_SYSCALL_FOOTER call convention.
* tests/fstatat.c (PRINT_SYSCALL_HEADER): Add errno saving.
(PRINT_SYSCALL_FOOTER): Restore errno.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.

8 years agoProvide a safe definition of O_ACCMODE
Dmitry V. Levin [Fri, 28 Oct 2016 02:19:58 +0000 (02:19 +0000)]
Provide a safe definition of O_ACCMODE

Some libcs e.g. musl are guilty of messing up with O_ACCMODE.

* open.c (O_ACCMODE): Redefine to 03.

8 years agoImplement dumping of mq_timedsend and mq_timedreceive syscalls
Eugene Syromyatnikov [Thu, 27 Oct 2016 08:09:07 +0000 (11:09 +0300)]
Implement dumping of mq_timedsend and mq_timedreceive syscalls

* syscall.c (dumpio): Add SEN_mq_timedreceive and SEN_mq_timedsend.

8 years agomq: print msg_prio as a pointer, not as an immediate value
Eugene Syromyatnikov [Thu, 27 Oct 2016 07:14:49 +0000 (10:14 +0300)]
mq: print msg_prio as a pointer, not as an immediate value

* mq.c (SYS_FUNC(mq_timedreceive)): Use printnum_int for printing
msg_prio argument.

8 years agomq: print msg payload only in case of successful mq_timedreceive call
Eugene Syromyatnikov [Thu, 27 Oct 2016 07:12:32 +0000 (10:12 +0300)]
mq: print msg payload only in case of successful mq_timedreceive call

Also, use u_rval for determining message size.

* mq.c (SYS_FUNC(mq_timedreceive)): Check for syserror and non-negative
u_rval before calling printstr on msg_ptr argument, or use printaddr otherwise;
provide u_rval as string size.

8 years agomq: Print msg_prio parameter as unsigned int in mq_timedsend
Eugene Syromyatnikov [Thu, 27 Oct 2016 07:07:29 +0000 (10:07 +0300)]
mq: Print msg_prio parameter as unsigned int in mq_timedsend

* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%ld"
to "%u", cast argument value to unsigned int.

8 years agomq: Properly print mq_flags field
Eugene Syromyatnikov [Thu, 27 Oct 2016 07:00:46 +0000 (10:00 +0300)]
mq: Properly print mq_flags field

mq_flags field of struct mq_attr can contain only O_NONBLOCK flag (other
flags are treated as invalid by mq_getsetattr). Moreover, this field is
ignored by mq_open at all (O_NONBLOCK is set via oflag, not via attr
attribute).

* xlat/mq_attr_flags.in: New file.
* print_mq_attr.c: Include xlat/mq_attr_flags.h.
(printmqattr): New parameter, bool decode_flags; cast members of struct
mq_attr to long long type; use mq_attr_flags xlat for printing mq_flags;
print mq_flags as flags only in case decode_flags parameter is set
to true.
* mq.c (SYS_FUNC(mq_open)): Specify value of false for decode_flags
parameter of printmqattr call.
(SYS_FUNC(mq_getsetattr)): Specify value of true for decode_flags
parameter of printmqattr call.
* tests/mq.expected: Update expected output.

8 years agomq: Print msg_len parameter as kernel_ulong_t
Eugene Syromyatnikov [Thu, 27 Oct 2016 06:56:32 +0000 (09:56 +0300)]
mq: Print msg_len parameter as kernel_ulong_t

* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%lu"
to "%llu", use getarg_ull for obtaining msg_len parameter.
(SYS_FUNC(mq_timedreceive)): Likewise.

8 years agoprint_mq_attr: fix typo
Eugene Syromyatnikov [Thu, 27 Oct 2016 06:53:03 +0000 (09:53 +0300)]
print_mq_attr: fix typo

* print_mq_attr.c (printmqattr): Print field name "mq_curmsgs"
instead of "mq_curmsg".
* tests/mq.expected: Update expected output.

8 years agomq: print mqdes parameter as int
Eugene Syromyatnikov [Wed, 26 Oct 2016 14:41:54 +0000 (17:41 +0300)]
mq: print mqdes parameter as int

It is defined as int in <linux/posix_types.h>.

* mq.c (SYS_FUNC(mq_timedsend)): Use "%d" conversion specifier instead
of "%ld" for printing mqdes (0th parameter), cast parameter value to
int.
(SYS_FUNC(mq_timedreceive)): Likewise.
(SYS_FUNC(mq_notify)): Likewise.
(SYS_FUNC(mq_getsetattr)): Likewise.

8 years agomq: curly brackets usage fix
Eugene Syromyatnikov [Wed, 26 Oct 2016 14:38:43 +0000 (17:38 +0300)]
mq: curly brackets usage fix

Use curly brackets for denoting blocks in both of if branches if they
are already used in at least one branch.

8 years agotests: additional name_to_handle_at/open_by_handle_at checks
Eugene Syromyatnikov [Sun, 23 Oct 2016 20:33:02 +0000 (23:33 +0300)]
tests: additional name_to_handle_at/open_by_handle_at checks

* tests/file_handle.c: Additional name_to_handle_at/open_by_handle_at
checks.

8 years agotests: require only presence of __NR_* macros for file_handle test
Eugene Syromyatnikov [Sun, 23 Oct 2016 20:23:05 +0000 (23:23 +0300)]
tests: require only presence of __NR_* macros for file_handle test

* tests/file_handle.c: replace fcntl.h include with asm/unistd.h.
[MAX_HANDLE_SZ]: change to defined __NR_name_to_handle_at
&& defined __NR_open_by_handle_at, add fcntl.h include
[!MAX_HANDLE_SZ]: Add definition of MAX_HANDLE_SZ and struct
file_handle.
(main): Change name_to_handle_at and open_by_handle_at calls to syscall.

8 years agotests: proper type conversion in keyctl test
Eugene Syromyatnikov [Thu, 20 Oct 2016 22:38:47 +0000 (01:38 +0300)]
tests: proper type conversion in keyctl test

* tests/keyctl.c (printarg): Add intermediate conversion of arg to uintptr_t
since kernel_ulong_t may be of different size.

8 years agofile_handle: use separate xlat for name_ta_handle_at flags
Eugene Syromyatnikov [Thu, 20 Oct 2016 21:48:50 +0000 (00:48 +0300)]
file_handle: use separate xlat for name_ta_handle_at flags

Since the only two flags supported are AT_SYMLINK_FOLLOW and
AT_EMPTY_PATH.

* xlat/name_to_handle_at_flags.in: New file.
* file_handle.c (SYS_FUNC(name_to_handle_at)): Use name_to_handle_at_flags
for printing flags parameter.

8 years agotests: check decoding of kexec_file_load and kexec_load syscalls
Eugene Syromyatnikov [Thu, 20 Oct 2016 03:46:02 +0000 (06:46 +0300)]
tests: check decoding of kexec_file_load and kexec_load syscalls

* tests/kexec_file_load.c: New file.
* tests/kexec_load.c: Likewise.
* tests/kexec_file_load.test: New test.
* tests/kexec_load.test: Likewise.
* tests/.gitignore: Add kexec_file_load and kexec_load.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kexec_file_load.test and kexec_load.test.

8 years agokexec: use widen_to_ulong since kexec_load has compat on x32/n32
Eugene Syromyatnikov [Thu, 20 Oct 2016 08:34:47 +0000 (11:34 +0300)]
kexec: use widen_to_ulong since kexec_load has compat on x32/n32

Curiously, kexec_load uses compat on x32/n32, so its parameters should
be 4 bytes in size on these ABIs.

* kexec.c (SYS_FUNC(kexec_load)): Use widen_to_ulong for casting
parameters to proper size on x32/n32.

8 years agokexec: fix zeroing of higher bits of flags parameter in kexec_load
Eugene Syromyatnikov [Thu, 20 Oct 2016 03:44:06 +0000 (06:44 +0300)]
kexec: fix zeroing of higher bits of flags parameter in kexec_load

* kexec.c (SYS_FUNC(kexec_load)): Perform type conversion before
negation in order to properly negate higher bits of KEXEC_ARCH_MASK.

8 years agokexec: add printing of struct kexec_segment field names
Eugene Syromyatnikov [Thu, 20 Oct 2016 03:42:29 +0000 (06:42 +0300)]
kexec: add printing of struct kexec_segment field names

* kexec.c (print_seg): Print field names of the kexec_segment structure.

8 years agotests: check decoding of unshare syscall
Eugene Syromyatnikov [Wed, 19 Oct 2016 18:16:36 +0000 (21:16 +0300)]
tests: check decoding of unshare syscall

* tests/unshare.c: New file.
* tests/unshare.test: New test.
* tests/.gitignore: Add unshare.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unshare.test.

8 years agoclone: use kernel_ulong_t as type of flags parameter of unshare call
Eugene Syromyatnikov [Wed, 19 Oct 2016 18:12:51 +0000 (21:12 +0300)]
clone: use kernel_ulong_t as type of flags parameter of unshare call

Kernel declares flags parameter as long and looks like x32 and n32
implement no compat for this call.

* clone.c (SYS_FUNC(unshare)): Use getarg_ull and printflags64 for
obtaining and parsing flags parameter.

8 years agoclone: use separate flag list for unshare
Eugene Syromyatnikov [Wed, 19 Oct 2016 18:09:58 +0000 (21:09 +0300)]
clone: use separate flag list for unshare

Not all clone flags could be passed to unshare (see check_unshare_flags
function in kernel/fork.c).

* xlat/unshare_flags.in: New file.
* clone.c (SYS_FUNC(unshare)): Use unshare_flags for printing flags
parameter.

8 years agotests: check decoding of setns syscall
Eugene Syromyatnikov [Tue, 18 Oct 2016 19:32:07 +0000 (22:32 +0300)]
tests: check decoding of setns syscall

* tests/setns.c: New file.
* tests/setns.test: New test.
* tests/.gitignore: Add setns.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setns.test.

8 years agoclone: use separate xlat for nstype parameter of setns syscall
Eugene Syromyatnikov [Tue, 18 Oct 2016 18:17:33 +0000 (21:17 +0300)]
clone: use separate xlat for nstype parameter of setns syscall

nstype is not flag set but specific type value against which it is
compared in kernel (see kernel/nsproxy.c, SYSCALL_DEFINE2(setns, ...)).

* xlat/setns_types.in: New file.
* clone.c: Use printxval and setns_types for nstype parameter.

8 years agotests: check non-verbose capget/capset output
Eugene Syromyatnikov [Tue, 18 Oct 2016 11:04:20 +0000 (14:04 +0300)]
tests: check non-verbose capget/capset output

* tests/caps-abbrev.awk: New file.
* tests/caps-abbrev.c: Likewise.
* tests/caps-abbrev.test: New test.
* tests/.gitignore: Add caps-abbrev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add caps-abbrev.test.
(EXTRA_DIST): Add caps-abbrev.awk.

8 years agotests: additional capset decoder checks
Eugene Syromyatnikov [Tue, 18 Oct 2016 07:16:23 +0000 (10:16 +0300)]
tests: additional capset decoder checks

* tests/caps.awk: Add patterns for additional checks.
* tests/caps.c: Implement additional checks.

8 years agotests: check decoding of fanotify_init syscall
Eugene Syromyatnikov [Mon, 17 Oct 2016 22:57:49 +0000 (01:57 +0300)]
tests: check decoding of fanotify_init syscall

* tests/fanotify_init.c: New file.
* tests/fanotify_init.test: New test.
* tests/.gitignore: Add fanotify_init.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fanotify_init.test.

8 years agotests: some additional checks for fanotify_mark
Eugene Syromyatnikov [Mon, 17 Oct 2016 17:45:19 +0000 (20:45 +0300)]
tests: some additional checks for fanotify_mark

* tests/fanotify_mark.c (do_call): New function.
(main): Use it.

8 years agotests: use sprintrc in tests/fanotify_mark.c
Eugene Syromyatnikov [Mon, 17 Oct 2016 17:43:17 +0000 (20:43 +0300)]
tests: use sprintrc in tests/fanotify_mark.c

* tests/fanotify.c (main): Use sprintrc.

8 years agotests: check decoding of {init,finit,delete}_module syscalls
Eugene Syromyatnikov [Sun, 16 Oct 2016 23:17:48 +0000 (02:17 +0300)]
tests: check decoding of {init,finit,delete}_module syscalls

* tests/delete_module.c: New file.
* tests/finit_module.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/init_module.c: Likewise.
* tests/delete_module.test: New test.
* tests/finit_module.test: Likewise.
* tests/init_module.test: Likewise.
* tests/.gitignore: Add delete_nodule, finit_module, and init_module.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add delete_module.test, finit_module.test,
and init_module.test.
(EXTRA_DIST): Add init_delete_module.h.

8 years agobjm: use getarg_ull for retrieving first two parameters of init_module syscall
Eugene Syromyatnikov [Sun, 16 Oct 2016 23:15:37 +0000 (02:15 +0300)]
bjm: use getarg_ull for retrieving first two parameters of init_module syscall

As init_module has no compat wrapper, its first parameter is a pointer
and the second is length, they both have the same size as kernel_ulong_t
type.

* bjm.c (SYS_FUNC(init_module)): Obtain first two parameters using
getarg_ull, print address argument using printaddr_ull, print length
argument using "%llu" conversion specifier.

8 years agoAdd printaddr_ull, change printaddr into a thin wrapper around it
Dmitry V. Levin [Fri, 28 Oct 2016 00:24:53 +0000 (00:24 +0000)]
Add printaddr_ull, change printaddr into a thin wrapper around it

* defs.h (printaddr_ull): New prototype.
(printaddr): Change to a static inline wrapper around printaddr_ull.
* util.c (printaddr): Rename to printaddr_ull, change argument type
to unsigned long long, change print format to %#llx.

8 years agoxlat: add values for MODULE_INIT_* constants
Eugene Syromyatnikov [Sun, 16 Oct 2016 23:14:00 +0000 (02:14 +0300)]
xlat: add values for MODULE_INIT_* constants

* bjm.c (MODULE_INIT_IGNORE_MODVERSIONS, MODULE_INIT_IGNORE_VERMAGIC):
Remove.
* xlat/module_init_flags.in: Add values for
MODULE_INIT_IGNORE_MODVERSIONS and MODULE_INIT_IGNORE_VERMAGIC records.

8 years agoRemove parser of create_module syscall
Eugene Syromyatnikov [Sun, 16 Oct 2016 11:42:32 +0000 (14:42 +0300)]
Remove parser of create_module syscall

Since create_module syscall is present only in kernels before Linux 2.6
and strace does not support those kernels, there is no use to keep this
parser any longer.

* bjm.c (SYS_FUNC(create_module)): Remove.
* linux/dummy.h (sys_create_module): Add stub alias.

8 years agotests: check decoding of process_vm_readv and process_vm_writev syscalls
Eugene Syromyatnikov [Sat, 15 Oct 2016 00:20:06 +0000 (03:20 +0300)]
tests: check decoding of process_vm_readv and process_vm_writev syscalls

* tests/process_vm_readv.c: New file.
* tests/process_vm_readv_writev.c: Likewise.
* tests/process_vm_writev.c: Likewise.
* tests/process_vm_readv.test: New test.
* tests/process_vm_writev.test: Likewise.
* tests/.gitignore: Add process_vm_readv and process_vm_writev.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add process_vm_readv.test and process_vm_writev.test.
(EXTRA_DIST): Add process_vm_readv_writev.c.

8 years agoprocess_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags
Eugene Syromyatnikov [Fri, 14 Oct 2016 23:54:39 +0000 (02:54 +0300)]
process_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags

* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Use widen_to_ulong for local_iovcnt,
renote_iovcnt, and flags parameters.

8 years agodefs: add widen_to_ulong macro
Eugene Syromyatnikov [Thu, 20 Oct 2016 08:33:51 +0000 (11:33 +0300)]
defs: add widen_to_ulong macro

This is similar to widen_to_long, but for unsigned values.

* defs.h (widen_to_ulong): New macro.

8 years agoprocess_vm: print pid argument as int
Eugene Syromyatnikov [Fri, 14 Oct 2016 15:42:36 +0000 (18:42 +0300)]
process_vm: print pid argument as int

* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change conversion specifier for pid
argument from "%ld" to "%d".

8 years agoprocess_vm: remove syserror check for iovec printing
Eugene Syromyatnikov [Fri, 14 Oct 2016 23:57:47 +0000 (02:57 +0300)]
process_vm: remove syserror check for iovec printing

This check had been done by print_array inside tprint_iov anyway.

* process_vm.c (SYS_FUNC(process_vm_readv)): Use tprint_iov_upto for
printing local_iov; do not check for syserror, provide decode_iov
parameter to tprint_iov{,_upto} based on its value instead.

8 years agoio: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_upto
Eugene Syromyatnikov [Fri, 14 Oct 2016 23:30:47 +0000 (02:30 +0300)]
io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_upto

This enables printing of iovec arrays even in case of failed syscall
(failed syscall doesn't mean that iovec itself is inaccessible and
useless).  One caveat here is that we should explicitly provide proper
IOV_DECODE_* value based on syserror value in case printing is performed
on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting
when syserror is up, since this may be called by code which tries to
print iovec containing local data, which should be perfectly accessible
(on the other hand, there are no cases of such behaviour at the moment).

Since iovecs themselves are printed even if syscall has failed now,
preadv test is updated to reflect this.  It is notable, though, that this
is the only place where this case is checked.

* io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror
instead of umoven_or_printaddr as umoven_func parameter.
(SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value
based on syserror(tcp) value.
* scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise.
* tests/preadv.c: Update expected output for the case when preadv
with singe-item iovec failed.

8 years agoMove umoven_or_printaddr_ignore_syserror to util.c
Eugene Syromyatnikov [Fri, 14 Oct 2016 23:27:21 +0000 (02:27 +0300)]
Move umoven_or_printaddr_ignore_syserror to util.c

* defs.h (umoven_or_printaddr_ignore_syserror): New prototype.
* v4l2.c (umoven_or_printaddr_ignore_syserror): Move ...
* util.c: ... here.

8 years agov4l2: check for verbose flag in umoven_or_printaddr_ignore_syserror
Eugene Syromyatnikov [Fri, 14 Oct 2016 22:56:10 +0000 (01:56 +0300)]
v4l2: check for verbose flag in umoven_or_printaddr_ignore_syserror

This change makes behaviour of umoven_or_printaddr_ignore_syserror in
line with umoven_or_printaddr when verbose flag is disabled.

* v4l2.c (umoven_or_printaddr_ignore_syserror): Simply call printaddr
when verbose flag is unset.

8 years agotests: check decoding of kcmp syscall
Eugene Syromyatnikov [Thu, 13 Oct 2016 17:16:24 +0000 (20:16 +0300)]
tests: check decoding of kcmp syscall

* tests/kcmp.c: New file.
* tests/kcmp.test: New test.
* tests/.gitignore: Add kcmp.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kcmp.test.

8 years agokcmp: print index parameters of unknown commands as kernel_ulong_t
Dmitry V. Levin [Thu, 27 Oct 2016 22:44:08 +0000 (22:44 +0000)]
kcmp: print index parameters of unknown commands as kernel_ulong_t

* lookup_dcookie.c (SYS_FUNC(kcmp)): Use getarg_ull to retrieve idx1
and idx2, print them using %#llx format in case of unknown command.

8 years agotests: check decoding of inotify family syscalls
Eugene Syromyatnikov [Thu, 13 Oct 2016 10:15:32 +0000 (13:15 +0300)]
tests: check decoding of inotify family syscalls

* tests/inotify.c: New file.
* tests/inotify_init1.c: Likewise.
* tests/inotify.test: New test.
* tests/inotify_init1.test: Likewise.
* tests/.gitignore: Add inotify and inotify_init1.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add inotify.test and inotify_init1.test.

8 years agoxlat: use IN_* prefix for inotify_init1 flag constants
Eugene Syromyatnikov [Thu, 13 Oct 2016 07:50:40 +0000 (10:50 +0300)]
xlat: use IN_* prefix for inotify_init1 flag constants

* xlat/inotify_init_flags.in: Replace O_* prefix with IN_* prefix for
O_NONBLOCK and O_CLOEXEC constants, provide fallback definitions.

8 years agotests: check decoding of lookup_dcookie syscall
Eugene Syromyatnikov [Wed, 12 Oct 2016 07:36:28 +0000 (10:36 +0300)]
tests: check decoding of lookup_dcookie syscall

* tests/lookup_dcookie.c: New file.
* tests/lookup_dcookie.test: New test.
* tests/.gitignore: Add lookup_dcookie.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add lookup_dcookie.test.

8 years agolookup_dcookie: print len parameter as kernel_ulong_t
Eugene Syromyatnikov [Thu, 27 Oct 2016 07:24:21 +0000 (10:24 +0300)]
lookup_dcookie: print len parameter as kernel_ulong_t

It is size_t and without compat on x32/n32.

* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Change conversion
specifier from "%lu" to "%llu", use getarg_ull for len argument
retrieval.

8 years agodefs.h: add offsetofend macro
Eugene Syromyatnikov [Sat, 3 Sep 2016 11:41:33 +0000 (14:41 +0300)]
defs.h: add offsetofend macro

Analogous to offsetof but returns structure offset after the specified
field.  Useful for checking whether specific field is present in obtained
data or specifying amount of data to copy based on the (last) field needed.

* defs.h (offsetofend): New macro.

8 years agotests: move ARG_STR and similar macros to tests.h
Eugene Syromyatnikov [Thu, 13 Oct 2016 07:26:07 +0000 (10:26 +0300)]
tests: move ARG_STR and similar macros to tests.h

* tests/add_key.c (_STR, ARG_STR): Move ...
* tests/tests.h: ... here.
(ARG_ULL_STR): New macro.
* tests/keyctl.c (ARG_STR): Remove.
* tests/quotactl.h (ARG_STR): Likewise.
* tests/request_key.c (ARG_STR): Likewise.

8 years agotests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h
Eugene Syromyatnikov [Wed, 12 Oct 2016 07:24:00 +0000 (10:24 +0300)]
tests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h

* tests/fadvise.h (LL_PAIR, LL_VAL_TO_PAIR): Move ...
* tests/tests.h: ... here.

8 years agotests: check decoding of ioprio_get and ioprio_set syscalls
Eugene Syromyatnikov [Tue, 4 Oct 2016 18:41:10 +0000 (21:41 +0300)]
tests: check decoding of ioprio_get and ioprio_set syscalls

* tests/ioprio.c: New file.
* tests/ioprio.test: New test.
* tests/.gitignore: Add ioprio.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioprio.test.

8 years agoxlat: provide fallback definitions for CLOCK_* constants
Eugene Syromyatnikov [Sun, 2 Oct 2016 21:55:34 +0000 (00:55 +0300)]
xlat: provide fallback definitions for CLOCK_* constants

Since new values have been added gradually over various kernel versions,
it's better to define them explicitly in order to avoid situations when
strace built with older kernel headers cannot decode some recently
defined values.

* xlat/clocknames.in: Add values for constants.

8 years agotests: move fill_memory and fill_memory_ex into a separate file
Eugene Syromyatnikov [Sun, 2 Oct 2016 20:39:11 +0000 (23:39 +0300)]
tests: move fill_memory and fill_memory_ex into a separate file

* tests/fill_memory.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/quotactl.h (fill_memory, fill_memory_ex): Move to fill_memory.c.
* tests/tests.h (fill_memory, fill_memory_ex): New prototypes.

8 years agotests: add period parameter to fill_memory_ex
Eugene Syromyatnikov [Fri, 30 Sep 2016 18:59:20 +0000 (21:59 +0300)]
tests: add period parameter to fill_memory_ex

* tests/quotactl.h (fill_memory_ex): Add period parameter,
use it as a divisor in non-constant part of value.
(fill_memory): Specify period of 0x80 to fill_memory_ex call.
* tests/quotactl-xfs.c (main): Likewise.

8 years agoPost-release administrivia
Dmitry V. Levin [Wed, 5 Oct 2016 06:19:41 +0000 (06:19 +0000)]
Post-release administrivia

* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.14-1.
* strace.spec.in: Likewise.

8 years agoPrepare for 4.14 release v4.14
Dmitry V. Levin [Tue, 4 Oct 2016 18:19:20 +0000 (18:19 +0000)]
Prepare for 4.14 release

* NEWS: Update for 4.14 release.

8 years agoGenerate SEN numbers in a locale independent order
Dmitry V. Levin [Tue, 4 Oct 2016 08:15:19 +0000 (08:15 +0000)]
Generate SEN numbers in a locale independent order

* generate_sen.sh: Sort SEN numbers using C collation rules.

8 years agoAssume that offsetof is provided by stddef.h
Dmitry V. Levin [Tue, 4 Oct 2016 00:13:09 +0000 (00:13 +0000)]
Assume that offsetof is provided by stddef.h

According to C89, <stddef.h> shall define offsetof macro.

* defs.h: Include <stddef.h> unconditionally.
[!offsetof]: Remove.

8 years agotests: check decoding of add_key, keyctl, and request_key syscalls
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:36:09 +0000 (21:36 +0300)]
tests: check decoding of add_key, keyctl, and request_key syscalls

* tests/add_key.c: New file.
* tests/keyctl.c: Likewise.
* tests/request_key.c: Likewise.
* tests/add_key.test: New test.
* tests/keyctl.test: Likewise.
* tests/request_key.test: Likewise.
* tests/.gitignore: Add add_key, keyctl, and request_key.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add add_key.test, keyctl.test, and request_key.test.

8 years agokeyctl: use kernel_ulong_t and getarg_ull instead of long
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:36:03 +0000 (21:36 +0300)]
keyctl: use kernel_ulong_t and getarg_ull instead of long

This potentially fixes keyctl decoder for x32 personality.

* keyctl.c (keyctl_update_key, keyctl_read_key, keyctl_instantiate_key,
keyctl_instantiate_key_iov, keyctl_dh_compute): Change addr and len
arguments to kernel_ulong_t.  Print len using %llu format.
(keyctl_keyring_search): Change addr1 and addr2 arguments
to kernel_ulong_t.
(print_dh_params): Change addr argument to kernel_ulong_t.
(SYS_FUNC(keyctl)): Retrieve arguments via getarg_ull, pass them
to the appropriate handlers.

8 years agokeyctl: fix parameter signedness
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:35:57 +0000 (21:35 +0300)]
keyctl: fix parameter signedness

* keyctl.c (keyctl_update_key): Change addr and len arguments
to unsigned.
(keyctl_read_key): Likewise.
(keyctl_instantiate_key): Likewise.
(keyctl_instantiate_key_iov): Likewise.
(keyctl_dh_compute): Likewise.
(keyctl_keyring_search): Change addr1 and addr2 arguments to unsigned.
(keyctl_chown_key): Change user and group arguments to unsigned.
(keyctl_get_persistent): Change uid argument to unsigned.

8 years agokeyctl: use printstr_ex for printing out buffer
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:35:51 +0000 (21:35 +0300)]
keyctl: use printstr_ex for printing out buffer

keyctl_read_key had subtle bug by treating out buffer in KEYCTL_READ
as NUL-terminated, which is not true.  We fix it by adding parameter to
keyctl_read_key signalising whether buffer is NUL-terminated and using
printstr_ex for printing (expectedly) NUL-terminated strings.

* keyctl.c (keyctl_read_key): Add has_nul parameter.  Do not use -1 as
string len.  Use printstr_ex for buffer output with user style depending
on has_nul value.
(SYS_FUNC(keyctl)): Specify has_nul parameter to keyctl_read_key
by comparing cmd value with KEYCTL_READ.

8 years agoAdd printstr_ex which allows for providing user quotation style
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:35:45 +0000 (21:35 +0300)]
Add printstr_ex which allows for providing user quotation style

This is useful for providing QUOTE_OMIT_TRAILING_0 and maybe other
flags.

* defs.h (printstr_ex): New prototype.
(printstr): Change to a wrapper around printstr_ex with zero user style.
* util.c (printstr): Rename to ...
(printstr_ex) ... new function, add user_style argument which is or'ed
with computed style.

8 years agoutil: add quote_string flag signalising that string is NUL-terminated
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:35:37 +0000 (21:35 +0300)]
util: add quote_string flag signalising that string is NUL-terminated

It is useful in cases strings with size provided are expected to be
NUL-terminated but are not trustworthy enough to call just plain
printstr(str, -1).

* defs.h (QUOTE_OMIT_TRAILING_0): New constant definition.
* util.c (string_quote): Swallow terminating NUL if
QUOTE_OMIT_TRAILING_0 is set.

8 years agokeyctl: add support for KEYCTL_DH_COMPUTE
Eugene Syromyatnikov [Mon, 3 Oct 2016 18:35:24 +0000 (21:35 +0300)]
keyctl: add support for KEYCTL_DH_COMPUTE

* keyctl.c (struct keyctl_dh_params): New structure.
(print_dh_params, keyctl_dh_compute): New functions.
(SYS_FUNC(keyctl)): Add support for KEYCTL_DH_COMPUTE cmd value.

8 years agox86_64: fix is_negated_errno for x32 personality
Dmitry V. Levin [Mon, 3 Oct 2016 15:51:49 +0000 (15:51 +0000)]
x86_64: fix is_negated_errno for x32 personality

* syscall.c (is_negated_errno) [X86_64]: Do not truncate kernel_ulong_t
to uint32_t for x32 personality.

8 years agotests: fix another regression in qual_syscall.test
Dmitry V. Levin [Mon, 3 Oct 2016 12:13:19 +0000 (12:13 +0000)]
tests: fix another regression in qual_syscall.test

* tests/qual_syscall.test: Fix pattern_nonabbrev_verbose pattern.
(check_output_mismatch): Print the pattern that triggered match failure.

8 years agoUse err_name, print unrecognized errno values as numbers
Dmitry V. Levin [Mon, 3 Oct 2016 11:59:39 +0000 (11:59 +0000)]
Use err_name, print unrecognized errno values as numbers

* syscall.c (trace_syscall_exiting): Use err_name() instead
of open-coding it.  Print unrecognized errno values using %lu format
instead of ERRNO_%lu as the latter prodices an invalid constant.

8 years agokeyctl: print errno name in KEYCTL_REJECT in case it is available
Eugene Syromyatnikov [Thu, 29 Sep 2016 12:56:35 +0000 (15:56 +0300)]
keyctl: print errno name in KEYCTL_REJECT in case it is available

* keyctl.c (keyctl_reject_key): Get errno string via err_name
and print it if it is not NULL.

8 years agoAdd function for getting errno string
Eugene Syromyatnikov [Thu, 29 Sep 2016 12:56:27 +0000 (15:56 +0300)]
Add function for getting errno string

* defs.h (err_name): New prototype.
* syscall.c (err_name): New function.

8 years agostruct tcb: change the type of u_error field from int to unsigned long
Dmitry V. Levin [Mon, 3 Oct 2016 11:48:55 +0000 (11:48 +0000)]
struct tcb: change the type of u_error field from int to unsigned long

This is the type actually used for the error code on architectures
that use a dedicated register.

* defs.h (struct tcb): Change the type of u_error to unsigned long.
* syscall.c (trace_syscall_exiting): Change the type of u_error variable
to unsigned long, print it using %lu format, drop no longer needed
explicit cast to unsigned long.
(saved_u_error): Change type to unsigned long.

8 years agoUse tprints instead of tprintf in a few more places
Dmitry V. Levin [Sun, 2 Oct 2016 16:20:05 +0000 (16:20 +0000)]
Use tprints instead of tprintf in a few more places

* btrfs.c (btrfs_print_qgroup_inherit, btrfs_print_tree_search,
btrfs_ioctl): Replace tprintf with tprints for printing strings without
format specifiers.
* net.c (print_group_req): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* term.c (decode_termios, decode_termio): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.

8 years agokeyctl: do not print comma for KEYCTL_SESSION_TO_PARENT command
Eugene Syromyatnikov [Thu, 29 Sep 2016 12:56:20 +0000 (15:56 +0300)]
keyctl: do not print comma for KEYCTL_SESSION_TO_PARENT command

Since this command doesn't have any additional arguments, the comma does
not needed.  Since this is the only command which lacks additional
arguments, it's better to add special case for it rather than add
printing of comma to all other commands.

* keyctl.c (SYS_FUNC(keyctl)): Add check for command not being
KEYCTL_SESSION_TO_PARENT when printing comma dividing cmd argument
from the rest.

8 years agokeyctl: use getarg_ull for printing generic arguments
Eugene Syromyatnikov [Thu, 29 Sep 2016 12:56:12 +0000 (15:56 +0300)]
keyctl: use getarg_ull for printing generic arguments

Otherwise it is erroneous on x32, for example.

* keyctl.c (SYS_FUNC(keyctl)): Use "%#llx" conversion specifier
and getarg_ull for fallback argument printing.

8 years agokeyctl: use printuid for printing UID/GID
Eugene Syromyatnikov [Thu, 29 Sep 2016 12:56:02 +0000 (15:56 +0300)]
keyctl: use printuid for printing UID/GID

UID/GID are unsigned except special -1 value (which is also special in
context of specific keyctl commands), so special printing function
should be used.

* keyctl.c (keyctl_chown_key, keyctl_get_persistent): Use printuid
instead of printf with "%d" conversion for printing UID/GID.

8 years agoio: handle data_size of -1 as unlimited data in print_iovec
Eugene Syromyatnikov [Thu, 29 Sep 2016 12:57:55 +0000 (15:57 +0300)]
io: handle data_size of -1 as unlimited data in print_iovec

Otherwise it can be depleted and print_iovec starts printing empty
strings.

* io.c (print_iovec): Interpret c->data_size of -1 as unlimited data
and do not decrease it in this case.

8 years agotests: fix typo in qual_syscall.test
Dmitry V. Levin [Sat, 1 Oct 2016 14:27:00 +0000 (14:27 +0000)]
tests: fix typo in qual_syscall.test

Fix test regression introduced by commit v4.13-225-g55334ef.

* tests/qual_syscall.test: Fix typo.

8 years agoEnhance -e abbrev=set, -e raw=set, and -e verbose=set
Dmitry V. Levin [Fri, 30 Sep 2016 00:35:35 +0000 (00:35 +0000)]
Enhance -e abbrev=set, -e raw=set, and -e verbose=set

Enhance abbrev=, raw=, and verbose= to accept the same syntax as trace=.
For example, this allows such syntax as -e verbose=file.

* syscall.c (lookup_class): Define before qual_syscall.
(qualify): Move the loop based on lookup_class ...
(qual_syscall): ... here.
* tests/qual_syscall.test: Check it.

8 years agotests/qual_syscall.test: rewrite without ls
Dmitry V. Levin [Thu, 29 Sep 2016 23:56:23 +0000 (23:56 +0000)]
tests/qual_syscall.test: rewrite without ls

* tests/qual_syscall.test: Invoke ./umovestr instead of ls.
Update expected output.

8 years agotests: check decoding of fadvise64 and fadvise64_64 syscalls
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:57 +0000 (00:21 +0300)]
tests: check decoding of fadvise64 and fadvise64_64 syscalls

* tests/fadvise.h: New file.
* tests/fadvise64.c: Likewise.
* tests/fadvise64_64.c: Likewise.
* tests/fadvise64.test: New test.
* tests/fadvise64_64.test: Likewise.
* tests/.gitignore: Add fadvise64 and fadvise64_64.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fadvise64.test, fadvise64_64.test.
(EXTRA_DIST): Add fadvise.h.

8 years agomips o32: implement fetching the 7th subcall argument
Dmitry V. Levin [Wed, 28 Sep 2016 01:57:59 +0000 (01:57 +0000)]
mips o32: implement fetching the 7th subcall argument

* syscall.c [LINUX_MIPSO32] (decode_mips_subcall): Fetch the last
argument of 7-arg syscalls.

8 years agox32: use proper decoder for fadvise64 syscall
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:42 +0000 (00:21 +0300)]
x32: use proper decoder for fadvise64 syscall

fadvise_64_64 decoder used before this change prints different sign
of the "len" argument (loff_t vs size_t).

* linux/x32/syscallent.h (fadvise64): Replace SEN(fadvise64_64)
with SEN(fadvise64).