]> granicus.if.org Git - strace/log
strace
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).

8 years agofadvise: use getarg_ull for obtaining len argument of fadvise64 syscall
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:35 +0000 (00:21 +0300)]
fadvise: use getarg_ull for obtaining len argument of fadvise64 syscall

Since its type is size_t, it is 64-bit wide on x32 and special care
should be taken in order to obtain it.

* fadvise.c (SYS_FUNC(fadvise64)): Use getarg_ull for obtaining value
of "len" syscall argument.

8 years agoutil: add getarg_ll and getarg_ull functions
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:27 +0000 (00:21 +0300)]
util: add getarg_ll and getarg_ull functions

These allow retrieving specific argument in full taking into account
peculiarities of runtimes which employ tcp->ext_arg (e.g. x32).

* defs.h (getarg_ll, getarg_ull): New prototypes.
* util.c (getarg_ll, getarg_ull): New functions.
(printargs): Use getarg_ull.

8 years agofadvise: change printing of len argument to unsigned in fadvise64 syscall
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:20 +0000 (00:21 +0300)]
fadvise: change printing of len argument to unsigned in fadvise64 syscall

The kernel declares fadvise64 as
long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);

* fadvise.c (SYS_FUNC(fadvise64)): Change conversion specifier from
"%ld" to "%lu" for printing len argument since kernel expects argument
of type size_t.

8 years agosh64, sparc64: use proper decoder for fadvise64_64 syscall
Dmitry V. Levin [Tue, 27 Sep 2016 18:11:10 +0000 (18:11 +0000)]
sh64, sparc64: use proper decoder for fadvise64_64 syscall

This change is no-op yet, but things will change when decoder
of fadvise64 syscall get fixed.

* linux/sh64/syscallent.h (fadvise64_64): Replace SEN(fadvise64)
with SEN(fadvise64_64).
* linux/sparc64/syscallent.h (fadvise64_64): Likewise.

8 years agotests: check decoding of fallocate syscall
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:50 +0000 (00:21 +0300)]
tests: check decoding of fallocate syscall

* configure.ac (AC_CHECK_FUNCS): Add fallocate.
* tests/fallocate.c: New file.
* tests/fallocate.test: New test.
* tests/.gitignore: Add fallocate.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fallocate.test.

8 years agofallocate: change print format of offset and len arguments to signed
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:14 +0000 (00:21 +0300)]
fallocate: change print format of offset and len arguments to signed

Since types of these arguments are off_t and kernel actually expects
signed values in order to fail when negative values are provided,
lets display these values as signed.

* fallocate.c (SYS_FUNC(fallocate)): Change conversion specifier for
printing "offset" and "len" syscall arguments from %llu to %lld.

8 years agoxlat: add default values for falloc_flags constants
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:07 +0000 (00:21 +0300)]
xlat: add default values for falloc_flags constants

In order to avoid dependence of declared constants to headers available
on build system.

* xlat/falloc_flags.in: Add default values for constants.

8 years agotests: check decoding of getcpu syscall
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:21:01 +0000 (00:21 +0300)]
tests: check decoding of getcpu syscall

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

8 years agotests: make magic values in ioctl_block test distinctive
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:20:53 +0000 (00:20 +0300)]
tests: make magic values in ioctl_block test distinctive

* tests/ioctl.block (init_magic): Add iterator value to magic value
in order to enable detection of potential 4-byte aligned shifts.

8 years agotests: additional getcwd decoding checks
Eugene Syromyatnikov [Wed, 21 Sep 2016 21:20:45 +0000 (00:20 +0300)]
tests: additional getcwd decoding checks

* tests/getcwd.c (main): Add more checks for getcwd arguments decoding.

8 years agotests: check decoding of quotactl syscall
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:12:37 +0000 (06:12 +0300)]
tests: check decoding of quotactl syscall

* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, linux/quota.h,
and sys/quota.h.
* tests/.gitignore: Add quotactl, quotactl-v, quotactl-xfs,
and quotactl-xfs-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add quotactl.test, quotactl-v.test,
quotactl-xfs.test, and quotactl-xfs-v.test.
(EXTRA_DIST): Add quotactl.h
* quotactl.h: New file.
* quotactl.c: Likewise.
* quotactl-v.c: Likewise.
* quotactl-xfs.c: Likewise.
* quotactl-xfs-v.c: Likewise.
* quotactl.test: New test.
* quotactl-v.test: Likewise.
* quotactl-xfs.test: Likewise.
* quotactl-xfs-v.test: Likewise.

8 years agoquota: ensure that names of structure fields are printed properly
Dmitry V. Levin [Tue, 27 Sep 2016 01:08:38 +0000 (01:08 +0000)]
quota: ensure that names of structure fields are printed properly

* quota.c (PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): New macros.
(decode_cmd_data): Use them to print structure fields.

8 years agoEnhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
Dmitry V. Levin [Mon, 26 Sep 2016 20:27:53 +0000 (20:27 +0000)]
Enhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros

* defs.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Add support of char types.
* tests/tests.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Likewise.

8 years agoquota: move Q_QUOTAON handling to subcommand switch statement
Dmitry V. Levin [Mon, 26 Sep 2016 19:03:52 +0000 (19:03 +0000)]
quota: move Q_QUOTAON handling to subcommand switch statement

* quota.c (SYS_FUNC(quotactl)): Move handling of Q_QUOTAON subcommand ...
(decode_cmd_data): ... here.

8 years agoquota: remove legacy subcommand decoding support code
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:12:10 +0000 (06:12 +0300)]
quota: remove legacy subcommand decoding support code

Support for these quota subcommands by linux kernels has been dropped
long time ago (between 2.5.16 and 2.5.17), so lets drop it in order
to minimize amount of code which should be subjected to testing and
structured conversion.

* quota.c (struct v1_dqblk, struct v2_dqblk, struct v2_dqinfo,
struct v1_dqstats, struct v2_dqstats): Remove.
(decode_cmd_data): Remove handling of Q_V1_GETQUOTA, Q_V1_SETQUOTA,
Q_V2_GETQUOTA, Q_V2_SETQUOTA, Q_V2_GETINFO, Q_V2_SETINFO, Q_V1_GETSTATS,
and Q_V2_GETSTATS subcommands.
(SYS_FUNC(quotactl)): Remove handling of Q_V1_QUOTAON subcommand.

8 years agoquota: add realtime block limits fields to XFS disk quota printing code
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:12:20 +0000 (06:12 +0300)]
quota: add realtime block limits fields to XFS disk quota printing code

* quota.c (decode_cmd_data): Add printing of d_rtb_hardlimit
and d_rtb_softlimit fields to struct xfs_dqblk printing code.

8 years agoquota: add packed attribute to struct if_dqblk definition
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:12:01 +0000 (06:12 +0300)]
quota: add packed attribute to struct if_dqblk definition

Since the only difference between 32-bit and 64-bit environments
regarding this structure is its padding, lets just add packed attribute
to its definition instead of going full mpers.

* quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED.

8 years agoquota: Add decoding for Q_XQUOTARM subcommand
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:11:52 +0000 (06:11 +0300)]
quota: Add decoding for Q_XQUOTARM subcommand

* quota.c (decode_cmd_data): Add Q_XQUOTARM handling to subcommand
  switch.

8 years agoquota: add dispatch of SYNC subcommands
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:11:38 +0000 (06:11 +0300)]
quota: add dispatch of SYNC subcommands

Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway.

* quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand
dispatch switch since id/addr arguments for these subcommands are known
to be ignored.

8 years agoquota: add missing prefixes to struct field names
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:11:28 +0000 (06:11 +0300)]
quota: add missing prefixes to struct field names

* quota.c (decode_cmd_data): Print field names in accordance with
their definition.

8 years agoquota: fix indentation inside subcommand dispatching switch statement
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:11:17 +0000 (06:11 +0300)]
quota: fix indentation inside subcommand dispatching switch statement

8 years agoquota: avoid printing id argument for those commands that ignore it
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:11:09 +0000 (06:11 +0300)]
quota: avoid printing id argument for those commands that ignore it

As id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO,
Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF,
Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, and
Q_V2_GETSTATS subcommands, do not print it for these subcommands.

* quota.c (decode_cmd_data): Add id argument parameter, add printing
of id argument for Q_GETQUOTA, Q_SETQUOTA, Q_GETNEXTQUOTA,
Q_V1_GETQUOTA, Q_V1_SETQUOTA, Q_V2_GETQUOTA, Q_V2_SETQUOTA,
Q_XGETQUOTA, Q_XGETNEXTQUOTA, Q_XSETQLIM, and unknown subcommands.
(SYS_FUNC(quotactl)): Remove printing of id argument, pass it
to decode_cmd_data.

8 years agoquota: use printuid for id parameter printing
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:10:57 +0000 (06:10 +0300)]
quota: use printuid for id parameter printing

* quota.c (SYS_FUNC(quotactl)): Since id call argument is used for
user/group/project ID which all have special semantics for -1,
print it the same way as UIDs are printed.

8 years agoquota: display quota subcommand as a macro
Eugene Syromyatnikov [Wed, 21 Sep 2016 03:10:46 +0000 (06:10 +0300)]
quota: display quota subcommand as a macro

* quota.c (SYS_FUNC(quotactl)): Replace disjunction of two xlat values
(which also lacks shift of the left part) with QCMD macro call.

8 years agotests: use VERBOSE macro in waitid and waitid-v tests
Dmitry V. Levin [Mon, 26 Sep 2016 15:21:22 +0000 (15:21 +0000)]
tests: use VERBOSE macro in waitid and waitid-v tests

* tests/waitid-v.c (VERBOSE_RUSAGE): Remove.
(VERBOSE): Define to 1.
* tests/waitid.c (sprint_rusage): Check VERBOSE instead
of VERBOSE_RUSAGE.

8 years agotests: use VERBOSE macro in wait4 and wait4-v tests
Dmitry V. Levin [Mon, 26 Sep 2016 15:20:26 +0000 (15:20 +0000)]
tests: use VERBOSE macro in wait4 and wait4-v tests

* tests/wait4-v.c (VERBOSE_RUSAGE): Remove.
(VERBOSE): Define to 1.
* tests/wait4.c (sprint_rusage): Check VERBOSE instead
of VERBOSE_RUSAGE.

8 years agotests: use VERBOSE macro in msg_control and msg_control-v tests
Dmitry V. Levin [Mon, 26 Sep 2016 15:19:05 +0000 (15:19 +0000)]
tests: use VERBOSE macro in msg_control and msg_control-v tests

* tests/msg_control-v.c (VERBOSE_MSGHDR): Remove.
(VERBOSE): Define to 1.
* tests/msg_control.c (print_fds, print_ip_opts): Check VERBOSE instead
of VERBOSE_MSGHDR.

8 years agotests: use VERBOSE macro in mmsg_name and mmsg_name-v tests
Dmitry V. Levin [Mon, 26 Sep 2016 15:16:50 +0000 (15:16 +0000)]
tests: use VERBOSE macro in mmsg_name and mmsg_name-v tests

* tests/mmsg_name-v.c (VERBOSE_MMSGHDR): Remove.
(VERBOSE): Define to 1.
* tests/mmsg_name.c (test_mmsg_name): Check VERBOSE instead
of VERBOSE_MMSGHDR.

8 years agotests: use VERBOSE macro in ioctl_rtc and ioctl_rtc-v tests
Dmitry V. Levin [Sun, 25 Sep 2016 00:10:27 +0000 (00:10 +0000)]
tests: use VERBOSE macro in ioctl_rtc and ioctl_rtc-v tests

* tests/ioctl_rtc-v.c (VERBOSE_IOCTL): Remove.
(VERBOSE): Define to 1.
* tests/ioctl_rtc.c (print_rtc_time): Check VERBOSE instead
of VERBOSE_IOCTL.

8 years agotests: use VERBOSE macro in ioctl_evdev and ioctl_evdev-v tests
Dmitry V. Levin [Sat, 24 Sep 2016 23:58:51 +0000 (23:58 +0000)]
tests: use VERBOSE macro in ioctl_evdev and ioctl_evdev-v tests

* tests/ioctl_evdev-v.c (VERBOSE_IOCTL): Remove.
(VERBOSE): Define to 1.
* tests/ioctl_evdev.c: Check VERBOSE instead of VERBOSE_IOCTL.

8 years agotests: use VERBOSE macro in execveat and execveat-v tests
Dmitry V. Levin [Fri, 23 Sep 2016 00:11:54 +0000 (00:11 +0000)]
tests: use VERBOSE macro in execveat and execveat-v tests

* tests/execveat-v.c (VERBOSE_EXECVEAT): Remove.
(VERBOSE): Define to 1.
* tests/execveat.c (main): Check VERBOSE instead of VERBOSE_EXECVEAT.

8 years agotests: use VERBOSE macro in execve and execve-v tests
Dmitry V. Levin [Thu, 22 Sep 2016 23:58:25 +0000 (23:58 +0000)]
tests: use VERBOSE macro in execve and execve-v tests

* tests/execve-v.c (VERBOSE_EXECVE): Remove.
(VERBOSE): Define to 1.
* tests/execve.c (main): Check VERBOSE instead of VERBOSE_EXECVE.

8 years agotests: add VERBOSE macro
Dmitry V. Levin [Wed, 21 Sep 2016 00:35:30 +0000 (00:35 +0000)]
tests: add VERBOSE macro

Introduce VERBOSE macro (defaults to 0) that is expected to be defined
to 1 by code testing "strace -v" output.

* tests/tests.h [!VERBOSE] (VERBOSE): New macro.

8 years agodecode_open: print the mode argument when O_TMPFILE flag is set
Dmitry V. Levin [Tue, 20 Sep 2016 18:41:50 +0000 (18:41 +0000)]
decode_open: print the mode argument when O_TMPFILE flag is set

O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.

* open.c (STRACE_O_TMPFILE): New macro.
(decode_open): Print the mode argument when O_TMPFILE flag is set.
* tests/open.c (main): Check it.
Fixes RH#1377846.

8 years agotests: use sprintrc in tests/ptrace.c
Dmitry V. Levin [Tue, 20 Sep 2016 15:17:37 +0000 (15:17 +0000)]
tests: use sprintrc in tests/ptrace.c

* tests/ptrace.c (errstr): New static variable.
(do_ptrace): Initialize it using sprintrc.
(test_peeksiginfo, main): Use errstr.

8 years agotests: use sprintrc in tests/netlink_protocol.c
Dmitry V. Levin [Tue, 20 Sep 2016 12:02:06 +0000 (12:02 +0000)]
tests: use sprintrc in tests/netlink_protocol.c

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

8 years agotests: use sprintrc in tests/fchownat.c
Dmitry V. Levin [Tue, 20 Sep 2016 00:48:57 +0000 (00:48 +0000)]
tests: use sprintrc in tests/fchownat.c

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

8 years agotests: use sprintrc in tests/fchmodat.c
Dmitry V. Levin [Tue, 20 Sep 2016 00:19:20 +0000 (00:19 +0000)]
tests: use sprintrc in tests/fchmodat.c

* tests/fchmodat.c (main): Use sprintrc.  Add more fchmodat decoding tests.

8 years agotests: use sprintrc in tests/fchmod.c
Dmitry V. Levin [Tue, 20 Sep 2016 00:19:20 +0000 (00:19 +0000)]
tests: use sprintrc in tests/fchmod.c

* tests/fchmod.c (main): Use sprintrc.  Add more fchmod decoding tests.
* tests/fchmod.test: Update the value specified for strace -a parameter.

8 years agotests: use sprintrc in tests/getgroups.c
Dmitry V. Levin [Mon, 19 Sep 2016 23:08:36 +0000 (23:08 +0000)]
tests: use sprintrc in tests/getgroups.c

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

8 years agotests: use sprintrc in tests/setgroups.c
Dmitry V. Levin [Mon, 19 Sep 2016 23:08:36 +0000 (23:08 +0000)]
tests: use sprintrc in tests/setgroups.c

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

8 years agotests/utime.c: rewrite without assert
Dmitry V. Levin [Mon, 19 Sep 2016 19:49:59 +0000 (19:49 +0000)]
tests/utime.c: rewrite without assert

* tests/utime.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.

8 years agotests/xattr.c: rewrite without assert
Dmitry V. Levin [Sun, 18 Sep 2016 00:00:53 +0000 (00:00 +0000)]
tests/xattr.c: rewrite without assert

* tests/xattr.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.

8 years agotests: use sprintrc in tests/xchownx.c
Dmitry V. Levin [Sat, 17 Sep 2016 23:30:01 +0000 (23:30 +0000)]
tests: use sprintrc in tests/xchownx.c

* tests/xchownx.c (main): Do not include <errno.h>.  Use sprintrc.

8 years agotests/xstatfsx.c: fix potential errno clobbering
Dmitry V. Levin [Fri, 16 Sep 2016 23:14:40 +0000 (23:14 +0000)]
tests/xstatfsx.c: fix potential errno clobbering

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

8 years agoAdd more fs magic constants
Dmitry V. Levin [Thu, 15 Sep 2016 23:55:17 +0000 (23:55 +0000)]
Add more fs magic constants

Add *_MAGIC constants defined for some relatively widespread
non-mainline filesystems.

* xlat/fsmagic.in: Add AUFS_SUPER_MAGIC, GPFS_SUPER_MAGIC,
VZFS_SUPER_MAGIC, and ZFS_SUPER_MAGIC constants.

8 years agotests: fix whitespace for explicit type casts in futex test
Eugene Syromyatnikov [Thu, 15 Sep 2016 20:04:07 +0000 (23:04 +0300)]
tests: fix whitespace for explicit type casts in futex test

8 years agoAdd more fs magic constants
Dmitry V. Levin [Wed, 14 Sep 2016 23:52:36 +0000 (23:52 +0000)]
Add more fs magic constants

Add *_MAGIC constants defined inside linux fs but not explicitly
exported via linux uapi.

* xlat/fsmagic.in: Add HFS_SUPER_MAGIC, HFSPLUS_SUPER_MAGIC,
EXOFS_SUPER_MAGIC, CEPH_SUPER_MAGIC, UBIFS_SUPER_MAGIC, JFS_SUPER_MAGIC,
BEFS_SUPER_MAGIC, NTFS_SB_MAGIC, XFS_SB_MAGIC, CONFIGFS_MAGIC,
FUSE_CTL_SUPER_MAGIC, FUSE_SUPER_MAGIC, AFS_FS_MAGIC, OCFS2_SUPER_MAGIC,
VXFS_SUPER_MAGIC, LOGFS_MAGIC, SMB2_MAGIC_NUMBER, and CIFS_MAGIC_NUMBER
constants.

8 years agoUpdate fs *_MAGIC constants
Dmitry V. Levin [Wed, 14 Sep 2016 23:41:19 +0000 (23:41 +0000)]
Update fs *_MAGIC constants

Add fs *_MAGIC constants exported by linux uapi.

* xlat/fsmagic.in: Add BFS_MAGIC, GFS2_MAGIC, and ROMFS_MAGIC constants
defined in linux/bfs_fs.h, linux/gfs2_ondisk.h, and linux/romfs_fs.h,
respectively.

8 years agotests: workaround limited semctl implementation in musl
Dmitry V. Levin [Tue, 13 Sep 2016 20:33:04 +0000 (20:33 +0000)]
tests: workaround limited semctl implementation in musl

musl libc forwards semctl command argument for 8 known commands only,
for all the rest it passes 0 instead.

* tests/ipc_sem.c (main): Update semctl expected output.

8 years agotests: add more IPC decoding checks
Eugene Syromyatnikov [Tue, 13 Sep 2016 16:18:42 +0000 (19:18 +0300)]
tests: add more IPC decoding checks

* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
commands) checks.
* tests/ipc_sem.c: Additional semget and semctl checks.
* tests/ipc_shm.c: Additional shmget and shmctl checks.
* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
* tests/semop.test: Add explicit -e parameter in order to trace both
semop and semtimedop.
* tests/shmxt.c: Additional shmat and shmdt checks.

8 years ago.mailmap: add addresses of Dr. David Alan Gilbert
Dmitry V. Levin [Mon, 12 Sep 2016 23:38:20 +0000 (23:38 +0000)]
.mailmap: add addresses of Dr. David Alan Gilbert

* .mailmap: Add both addresses of Dr. David Alan Gilbert here to avoid
duplications in CREDITS file.

8 years ago.mailmap: add canonical name for Eugene Syromyatnikov
Eugene Syromyatnikov [Mon, 12 Sep 2016 23:10:53 +0000 (02:10 +0300)]
.mailmap: add canonical name for Eugene Syromyatnikov

This is needed due to apparent deviation in spelling of commit author
name in several commits.

* .mailmap: Add canonical name for Eugene Syromyatnikov.

8 years agoUpdate generic ioctl entries from linux 4.8
Dmitry V. Levin [Mon, 12 Sep 2016 15:19:31 +0000 (15:19 +0000)]
Update generic ioctl entries from linux 4.8

* linux/64/ioctls_inc.h: Update from linux v4.8 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.

8 years agox32: update ioctl entries from linux 4.8
Gleb Fotengauer-Malinovskiy [Mon, 12 Sep 2016 13:30:18 +0000 (16:30 +0300)]
x32: update ioctl entries from linux 4.8

* linux/x32/ioctls_inc0.h: Update from linux v4.8 using ioctls_gen.sh.

8 years agomaint: update for linux 4.8
Gleb Fotengauer-Malinovskiy [Mon, 12 Sep 2016 13:29:38 +0000 (16:29 +0300)]
maint: update for linux 4.8

* maint/ioctls_sym.sh: Add workarounds for linux/atm_zatm.h and
xen/evtchn.h files.

8 years agotests: use sprintrc_grep in tests/ipc_shm.c
Dmitry V. Levin [Mon, 12 Sep 2016 10:30:22 +0000 (10:30 +0000)]
tests: use sprintrc_grep in tests/ipc_shm.c

* tests/ipc_shm.c (main): Use sprintrc_grep.

8 years agotests: use sprintrc_grep in tests/ipc_sem.c
Dmitry V. Levin [Mon, 12 Sep 2016 09:27:58 +0000 (09:27 +0000)]
tests: use sprintrc_grep in tests/ipc_sem.c

* tests/ipc_sem.c (main): Use sprintrc_grep.

8 years agotests: use sprintrc_grep in tests/ipc_msg.c
Dmitry V. Levin [Sun, 11 Sep 2016 00:04:16 +0000 (00:04 +0000)]
tests: use sprintrc_grep in tests/ipc_msg.c

* tests/ipc_msg.c (main): Use sprintrc_grep.

8 years agotests: use sprintrc in tests/chmod.c
Dmitry V. Levin [Sat, 10 Sep 2016 22:58:40 +0000 (22:58 +0000)]
tests: use sprintrc in tests/chmod.c

* tests/chmod.c (main): Use sprintrc.  Add more chmod decoding tests.

8 years agoipc: fix printing of nsops argument of semop and semtimedop syscalls
Dmitry V. Levin [Fri, 9 Sep 2016 19:13:54 +0000 (19:13 +0000)]
ipc: fix printing of nsops argument of semop and semtimedop syscalls

According to POSIX, nsops argument of semop syscall has type size_t,
but the kernel treats nsops argument of semop and semtimedop syscalls
as unsigned int.

* ipc_sem.c (tprint_sembuf_array): Change type of "count" argument
from unsigned long to unsigned int, print it using %u format.

8 years agotests/aio.c: bring indentation in conformance with the rest of the file
Eugene Syromyatnikov [Fri, 9 Sep 2016 07:54:54 +0000 (10:54 +0300)]
tests/aio.c: bring indentation in conformance with the rest of the file

8 years agotests: use predefined constant in aio_context_t checks in aio test
Eugene Syromyatnikov [Fri, 9 Sep 2016 07:54:38 +0000 (10:54 +0300)]
tests: use predefined constant in aio_context_t checks in aio test

Also fix io_cancel and io_destroy checks which did not check correct
printing of context argument properly.

* tests/aio.c (main): Update syscall checks in order to use newly
defined bogus_ctx constant.

8 years agoMark io_setup and io_destroy as memory mapping related syscalls
Dmitry V. Levin [Fri, 9 Sep 2016 02:38:32 +0000 (02:38 +0000)]
Mark io_setup and io_destroy as memory mapping related syscalls

As io_setup syscall allocates some memory using do_mmap_pgoff, and
io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
flag for all sysentries of io_setup and io_destroy using the following
oneliner:
sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h

* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.

8 years agotravis: add x86 musl
Dmitry V. Levin [Thu, 8 Sep 2016 17:11:51 +0000 (17:11 +0000)]
travis: add x86 musl

* .travis.yml (matric): Add musl-gcc/x86.
* travis-build.sh [TARGET == x86]: Specify --target along with --build
to configure.
* travis-install.sh [CC == musl-gcc && TARGET == x32]: Add -mx32 to $CC.
[CC == musl-gcc && TARGET == x86]: Add -m32 to $CC.  Specify --build
and --target to musl configure invocation.

8 years agotests: use PRI__*64 macros in aio test
Eugene Syromyatnikov [Thu, 8 Sep 2016 18:26:17 +0000 (21:26 +0300)]
tests: use PRI__*64 macros in aio test

It was incorrectly assumed that __*64 types are long long on all
platforms, despite strace having specially crafted macros in order
to handle precisely this architecture discrepancy.
The commit fixes this oversight.

* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
specifiers for __*64-typed values.

8 years agoipc: fix printing of integer arguments
Eugene Syromyatnikov [Wed, 7 Sep 2016 12:41:17 +0000 (15:41 +0300)]
ipc: fix printing of integer arguments

* ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int
by the kernel, cast it to int and print it using %d format.
* ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise,
for semid argument.
(SYS_FUNC(semget)): Likewise, for nsems argument.
(SYS_FUNC(semctl)): Likewise, for semid and semnum arguments.
* ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument.
* ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise.

8 years agoipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
Dmitry V. Levin [Thu, 8 Sep 2016 12:49:35 +0000 (12:49 +0000)]
ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls

* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
is __kernel_key_t (i.e. int), cast key_t argument to int
and print it using %#x format.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* tests/ipc_msg.c (main): Test it.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.

8 years agotests: add more sched_getattr and sched_setattr decoding checks
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:09:10 +0000 (05:09 +0300)]
tests: add more sched_getattr and sched_setattr decoding checks

* tests/sched_xetattr.c (main): Add more sched_getattr and sched_setattr
decoding checks.

8 years agotests: change type of sched_nice field to signed in sched_xetattr test
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:08:47 +0000 (05:08 +0300)]
tests: change type of sched_nice field to signed in sched_xetattr test

Kernel headers declare this field as s32, and strace prints it with %d
specifier.

* tests/sched_xetattr.c (main): Change type of sched_nice field of struct
sched_attr to int32_t, update format specifiers accordingly.

8 years agotests: add sprintrc_grep function to libtests
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:08:24 +0000 (05:08 +0300)]
tests: add sprintrc_grep function to libtests

New sprintrc_grep function is sprintrc function equivalent suitable for
tests where grep-base pattern matching is employed.

* tests/tests.h (sprintrc_grep): New prototype.
* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
(sprintrc_ex): New function, renamed from sprintrc and updated to
support different formats.
(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.

8 years agotests: perform more strict structure allocation in sched_xetattr test
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:08:10 +0000 (05:08 +0300)]
tests: perform more strict structure allocation in sched_xetattr test

Use tail_alloc with precise size of the structure.

* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
Rename sched to sched_attr.  Change type of sched_attr to struct
pointer.  Use tail_alloc for sched_attr allocation, update printf
statements accrodingly.