blob: d0bf7d5bf4404ec3494fb11bdd05ec5e5d481abb [file] [log] [blame]
2017-02-14 Dmitry V. Levin <ldv@altlinux.org>
Prepare for 4.16 release.
* NEWS: Update for 4.16 release.
2017-02-13 Dmitry V. Levin <ldv@altlinux.org>
.mailmap: add addresses of JingPiao Chen.
* .mailmap: Add both addresses of JingPiao Chen here to avoid
duplications in CREDITS file.
tests: skip scno tampering tests on compat mips abi.
* tests/scno_tampering.sh: In case of mips abi, skip the test
unless it is the native abi.
2017-02-12 Dmitry V. Levin <ldv@altlinux.org>
Fix -Werror=duplicate-decl-specifier compilation issues.
capability.c:82:28: error: duplicate "const" declaration specifier
capability.c:110:33: error: duplicate "const" declaration specifier
rt_tgsigqueueinfo.c:42:61: error: duplicate "const" declaration specifier
utime.c:66:23: error: duplicate "const" declaration specifier
waitid.c:147:20: error: duplicate "const" declaration specifier
* capability.c (cap_user_header_t, cap_user_data_t): Remove.
(get_cap_header): Change return type
to "const struct user_cap_header_struct *".
(print_cap_header, print_cap_data): Change the type of last argument
to "const struct user_cap_header_struct * const".
(SYS_FUNC(capget)): Change type of "h" variable
to "const struct user_cap_header_struct *".
(SYS_FUNC(capset)): Change type of "h" variable
to "const struct user_cap_header_struct * const".
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Change the type of last
argument to "const void *const".
* tests/utime.c (main): Change the type of "tail_u" variable
to "const struct utimbuf *const".
* tests/waitid.c (do_waitid): Change the type of 3rd argument
to "const siginfo_t *const".
2017-02-12 Dmitry V. Levin <ldv@altlinux.org>
tests: rewrite pipe syscall decoding check from match_grep to match_diff
* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
instead of [!HAVE_PIPE2].
(main): Do not call pipe2.
* tests/pipe.test: Skip the test if libc pipe wrapper does not use
pipe syscall, rewrite from match_grep to match_diff.
* tests/pipe.expected: Update expected output.
2017-02-11 Dmitry V. Levin <ldv@altlinux.org>
tests: rewrite pipe2 syscall decoding check from match_grep to match_diff
Unlike pipe.test that is based on match_grep, the new test
is based on match_diff and does more rigorous testing.
* tests/pipe2.c: New file.
* tests/pipe2.test: New test.
* tests/.gitignore: Add pipe2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pipe2.test.
2017-02-10 Dmitry V. Levin <ldv@altlinux.org>
tests: rewrite mq.test from match_grep to match_diff.
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.
* tests/mq.c: Include <stdio.h>.
(NAME): New macro.
(main): Use it. Print expected output.
* tests/mq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
* tests/mq.test: Use run_strace_match_diff.
2017-02-09 Dmitry V. Levin <ldv@altlinux.org>
Simplify struct inject_opts.rval semantics.
Drop use of INJECT_OPTS_RVAL_DISABLE special inject_opts.rval value,
INJECT_OPTS_RVAL_DEFAULT is enough.
* defs.h (INJECT_OPTS_RVAL_DISABLE): Remove.
* qualify.c (qualify_inject_common): Do not replace
INJECT_OPTS_RVAL_DEFAULT with INJECT_OPTS_RVAL_DISABLE
in inject_opts.rval.
* syscall.c (tamper_with_syscall_entering): Check
for INJECT_OPTS_RVAL_DEFAULT instead of INJECT_OPTS_RVAL_DISABLE.
2017-02-09 Dmitry V. Levin <ldv@altlinux.org>
tests: check signal injection along with fault injection.
* tests/qual_inject-error-signal.c: New file.
* tests/qual_inject-error-signal.expected: Likewise.
* tests/qual_inject-error-signal.test: New test.
* tests/.gitignore: Add qual_inject-error-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-error-signal.test.
(EXTRA_DIST): Add qual_inject-error-signal.expected.
tests: simplify qual_inject-signal.test.
* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.
2017-02-09 Dmitry V. Levin <ldv@altlinux.org>
Make symbolic errno values match case-insensitive.
Follow the example of case-insensitive symbolic signal values in signal
and inject expressions and make symbolic errno values in inject
expressions case-insensitive.
* qualify.c (find_errno_by_name): Use strcasecmp instead of strcmp
to match symbolic errno values.
* tests/qual_fault.c (main): Likewise.
* tests/qual_fault.test: Test case-insensitive symbolic errno match.
2017-02-09 Dmitry V. Levin <ldv@altlinux.org>
tests: check case-insensitive symbolic signal match.
* tests/qual_signal.test: Test case-insensitive symbolic signal match.
2017-02-09 Eugene Syromyatnikov <evgsyr@gmail.com>
Update NEWS.
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
Update NEWS.
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
strace.spec.in: fix dist version checks.
* strace.spec.in: Fix libunwind availability check.
Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
tests: update ipc_sem.test for new glibc.
Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
address to semctl like other libcs.
* tests/ipc_sem.c (main) [__GLIBC__]: Remove.
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
tests: fix typo in bpf.test.
* tests/bpf.c (main): Add missing semicolon.
Fixes: ad427721 ("tests: rewrite bpf.test from match_grep to match_diff")
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
tests: check signal injection.
* tests/qual_inject-signal.c: New file.
* tests/qual_inject-signal.expected: Likewise.
* tests/qual_inject-signal.test: New test.
* tests/.gitignore: Add qual_inject-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-signal.test.
(EXTRA_DIST): Add qual_inject-signal.expected.
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
Implement -e inject= option.
Introduce -e inject= as a general injection option,
limit -e fault= option to syscall fault injection.
Change default return code of syscall fault injection to ENOSYS.
* qualify.c (parse_inject_token): Add fault_tokens_only argument,
do not accept retval= and signal= tokens when fault_tokens_only
is set to true.
(parse_inject_expression): Add fault_tokens_only argument,
forward it to parse_inject_token.
(qualify_inject_common): New function.
(qualify_fault): Use it.
(qualify_inject): New function.
(qual_options): New entry.
* strace.1: Describe -e inject= option.
* NEWS: Mention -e inject= option.
* tests/qual_fault-syntax.test: Test that -e fault= option does not
support retval=, signal=, and multiple error= tokens.
* tests/qual_fault.c (DEFAULT_ERRNO): Set to ENOSYS unconditionally.
* tests/qual_inject-retval.test: Replace -e fault= option
with -e inject= option.
* tests/qual_inject-syntax.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
tests: prepare for introduction of -e inject= option.
Rename files related to fault injection to avoid further confusion.
* tests/fault_injection-exit_group.expected: Rename
to tests/qual_fault-exit_group.expected.
* tests/fault_injection-exit_group.test: Rename
to tests/qual_fault-exit_group.test.
* tests/fault_syntax.test: Rename to tests/qual_fault-syntax.test.
* tests/fault_injection.c: Rename to tests/qual_fault.c.
* tests/fault_injection.test: Rename to tests/qual_fault.test.
* tests/fault_injection-retval.c: Rename to tests/qual_inject-retval.c.
* tests/fault_injection-retval.test: Rename
to tests/qual_inject-retval.test.
* tests/fault_injection.sh: Rename to tests/scno_tampering.sh.
* tests/.gitignore: Update.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Update.
2017-02-08 Dmitry V. Levin <ldv@altlinux.org>
Prepare for introduction of -e inject= option.
As -e fault= injection syntax has been extended to configure various
kinds of injections besides fault injection, the original option name
bacame too narrow.
This change renames internal constants, types, and functions from
"fault" to more generic inject/tamper ones.
* defs.h (fault_opts): Rename to inject_opts.
(FAULT_OPTS_RVAL_DEFAULT): Rename to INJECT_OPTS_RVAL_DEFAULT.
(FAULT_OPTS_RVAL_DISABLE): Rename to INJECT_OPTS_RVAL_DISABLE.
(struct tcb): Rename fault_vec field to inject_vec.
(TCB_FAULT_INJ): Rename to TCB_TAMPERED.
(QUAL_FAULT): Rename to QUAL_INJECT.
(fault_vec): Rename to inject_vec.
All users changed.
* qualify.c (fault_set): Rename to inject_set.
(parse_fault_token): Rename to parse_inject_token.
(parse_fault_expression): Rename to parse_inject_expression.
All callers changed.
* syscall.c (fault_vec): Rename to inject_vec.
(tcb_fault_opts): Rename to tcb_inject_opts.
(inject_syscall_fault_entering): Rename to tamper_with_syscall_entering.
(update_syscall_fault_exiting): Rename to tamper_with_syscall_exiting.
(syscall_fault_injected): Rename to syscall_tampered.
All callers changed.
2017-02-07 Dmitry V. Levin <ldv@altlinux.org>
tests: make Makefile.am lists sorted in C locale.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Make sorted in C locale.
2017-02-07 Dmitry V. Levin <ldv@altlinux.org>
tests: use ARG_STR in msg_control.test.
Drop local VAL_STR macro in favour of ARG_STR macro from tests/tests.h.
* tests/msg_control.c (VAL_STR): Remove.
(test_sol_socket, test_sol_ip): Replace VAL_STR with ARG_STR.
2017-02-07 Dmitry V. Levin <ldv@altlinux.org>
powerpc, powerpc64: wire up new syscalls.
* linux/powerpc/syscallent.h [382]: Add kexec_file_load entry.
* linux/powerpc64/syscallent.h [382]: Likewise.
microblaze: wire up new syscalls.
* linux/microblaze/syscallent.h [392..397]: New entries.
avr32: wire up new syscalls.
* linux/avr32/syscallent.h [328..330]: New entries.
2017-02-06 Dmitry V. Levin <ldv@altlinux.org>
Update IPV6_* constants.
* xlat/sockipv6options.in: Add IPV6_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~1.
Update IP_* constants.
* xlat/sockipoptions.in: Add IP_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~2.
2017-02-06 Jacob Goense <dugo@xs4all.nl>
or1k: fix build.
This fixes a typo in the arch_set_success for the or1k architecture.
* linux/or1k/set_error.c (arch_setsuccess): Rename to arch_set_success.
Fixes: 41d647c ("Implement success injection")
Closes: https://github.com/strace/strace/pull/6
2017-02-04 Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Update ioctl entries from linux 4.10.
* linux/32/ioctls_inc_align16.h: Update from linux v4.10 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* NEWS: Mention this.
maint: update for linux 4.10.
* maint/ioctls_sym.sh: Update workaround for linux/if_pppox.h file.
maint: add workaround for m68k.
* maint/ioctls_sym.sh: Skip asm/amigayle.h.
2017-01-31 Dmitry V. Levin <ldv@altlinux.org>
tests: check decoding of bpf corner cases.
* tests/bpf.c (bogus_bpf): New function.
(BOGUS_BPF): New macro.
(main): Use them.
* tests/bpf.test: Add -a option.
2017-01-29 Dmitry V. Levin <ldv@altlinux.org>
tests: rewrite bpf.test from match_grep to match_diff.
* tests/bpf.c (errstr): New variable.
(sys_bpf): New function.
(map_create, map_any, prog_load, obj_manage, prog_cgroup): Use it.
(main): Update expected output.
* tests/bpf.test: Use run_strace_match_diff.
bpf: move common code to a separate function.
* bpf.c (bpf_prog_attach_detach): New function.
(bpf_prog_attach, bpf_prog_detach): Use it.
2017-01-29 Quentin Monnet <quentin.monnet@6wind.com>
Update bpf syscall decoding.
Implement decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
and BPF_PROG_DETACH commands.
* bpf.c: Include "xlat/bpf_attach_type.h".
(bpf_obj_manage, bpf_prog_attach, bpf_prog_detach): New functions.
(SYS_FUNC(bpf)): Use them.
* configure.ac: Check for union bpf_attr.bpf_fd and union
bpf_attr.attach_type.
* xlat/bpf_attach_type.in: New file.
* xlat/bpf_commands.in: Update list of BPF_* command constants.
* xlat/bpf_map_types.in: Update list of BPF_MAP_TYPE_* constants.
* xlat/bpf_prog_types.in: Update list of BPF_PROG_TYPE_* constants.
* tests/bpf.c [HAVE_UNION_BPF_ATTR_BPF_FD] (obj_manage): New function.
[HAVE_UNION_BPF_ATTR_ATTACH_TYPE] (prog_cgroup): Likewise.
(main): Use them.
2017-01-28 Elvira Khabirova <lineprinter0@gmail.com>
tests: check success injection.
* tests/fault_injection-retval.c: New file.
* tests/fault_injection-retval.test: New test.
* tests/.gitignore: Add fault_injection-retval.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add fault_injection-retval.test.
2017-01-28 Elvira Khabirova <lineprinter0@gmail.com>
Implement success injection.
This extends fault injection syntax with :retval= option.
When :retval=VALUE is specified, the syscall number is replaced by -1
and a bogus success VALUE is returned to the callee.
* defs.h (fault_opts): Remove err field, add rval field.
(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
New macros.
* qualify.c (parse_fault_token): Handle retval= token.
(qualify_fault): Update fault_opts initialization after the move
from struct fault_opts.err to struct fault_opts.rval.
* syscall.c (arch_set_success): New prototype.
(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
(update_syscall_fault_exiting): Implement retval injection.
* strace.1: Update the section on fault injection.
* NEWS: Mention retval= option.
* linux/aarch64/set_error.c (arch_set_success): New function.
* linux/alpha/set_error.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/xtensa/set_error.c: Likewise.
Closes: https://github.com/strace/strace/issues/3
2017-01-26 Dmitry V. Levin <ldv@altlinux.org>
mips: rewrite configure check without sgidefs.h.
Use builtin macros provided by gcc >= 3.4 instead of sgidefs.h macros.
* configure.ac <mips>: Do not include <asm/sgidefs.h>, use _ABIO32
instead of _MIPS_SIM_ABI32, _ABIN32 instead of _MIPS_SIM_NABI32,
and _ABI64 instead of _MIPS_SIM_ABI64.
2017-01-20 Elvira Khabirova <lineprinter0@gmail.com>
.gitignore: add missing files that should be ignored.
* .gitignore: Add /ioctl_iocdef.[ih].
Fixes: 5679fad ("ioctlsort: get ioctl definitions from host, not build")
2017-01-20 Andre McCurdy <armccurdy@gmail.com>
mips: use <asm/sgidefs.h>
Build fix for MIPS with musl libc.
The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
but not by musl. Regardless of the libc, the kernel headers provide
<asm/sgidefs.h> which provides the same definitions, so use that
instead.
* configure.ac: Replace <sgidefs.h> with <asm/sgidefs.h>.
2017-01-20 JingPiao Chen <chenjingpiao@gmail.com>
Implement decoding of ustat syscall.
* configure.ac (AC_CHECK_HEADERS): Add ustat.h.
* ustat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h: Remove sys_ustat.
* tests/ustat.c: New file.
* tests/ustat.test: New test.
* tests/.gitignore: Add ustat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ustat.test.
Makefile.am: allow indented DEF_MPERS_TYPE includes.
* Makefile.am (m%_type_defs.h): Change sed regular expression to allow
arbitrary number of whitespace characters between "#" symbol
and "include" directive.
strace.1: fix formatting.
* strace.1: Remove misplaced .TP macros.
2017-01-13 Dmitry V. Levin <ldv@altlinux.org>
tests: drop non-USE_ASM_STAT case support.
With the switch of fstatat family tests to USE_ASM_STAT variant,
there are no non-USE_ASM_STAT users left. Remove support of unused
non-USE_ASM_STAT case.
* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_mtim.tv_nsec.
* tests/fstatat.c (USE_ASM_STAT): Remove.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.
* tests/xstatx.c: Assume USE_ASM_STAT.
[!USE_ASM_STAT]: Remove.
2017-01-13 Dmitry V. Levin <ldv@altlinux.org>
tests: call newfstatat and fstatat64 syscalls directly.
Do not use glibc wrappers to call newfstatat and fstatat64.
These wrappers have various problems, e.g. they segfault on sparc64
and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
conversion of timestamps on mips64.
* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
directly.
(USE_ASM_STAT): Define.
* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.
Based on patch by James Cowgill <james410@cowgill.org.uk>.
2017-01-13 Dmitry V. Levin <ldv@altlinux.org>
tests: remove redundant SAMPLE_SIZE definitions.
Remove all definitions of SAMPLE_SIZE that are identical to the fallback
definition in tests/xstatx.c.
* tests/fstat64.c (SAMPLE_SIZE): Remove.
* tests/lstat64.c (SAMPLE_SIZE): Remove.
* tests/stat64.c (SAMPLE_SIZE): Remove.
2017-01-13 Dmitry V. Levin <ldv@altlinux.org>
tests: change SAMPLE_SIZE type to libc_off_t.
As ftruncate libc function and our create_sample function that calls
ftruncate both take size argument of type libc_off_t, change the type
of SAMPLE_SIZE constant to libc_off_t.
* tests/fstat.c (SAMPLE_SIZE): Cast to libc_off_t.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/oldfstat.c (SAMPLE_SIZE): Likewise.
* tests/oldlstat.c (SAMPLE_SIZE): Likewise.
* tests/oldstat.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/xstatx.c (SAMPLE_SIZE): Likewise.
2017-01-13 Alexey Neyman <stilor@att.net>
ioctlsort: get ioctl definitions from host, not build.
When cross-compiling, ioctlsort must obtain _IOC_* values from the
host, build's values may be incompatible.
* ioctl_iocdef.c: New file.
* Makefile.am (EXTRA_DIST): Add it.
(ioctl_iocdef.i, ioctl_iocdef.h): New rules.
(ioctlsort%.o): Depend on ioctl_iocdef.h.
(CLEANFILES): Add ioctl_iocdef.h and ioctl_iocdef.i.
* ioctlsort.c: Include "ioctl_iocdef.h" instead of <linux/ioctl.h>.
2017-01-13 Dmitry V. Levin <ldv@altlinux.org>
tests: treat struct stat mismatch as an error.
If the test detects struct stat mismatch, this is likely an error
in definitions of a stat structure that might affect strace as well.
Fail the test instead of skipping it to attract more attention.
* tests/xstatx.c (main): Return 1 instead of 77
in case of struct stat mismatch.
2017-01-12 Dmitry V. Levin <ldv@altlinux.org>
tests: rewrite diagnostics about struct stat mismatch.
* tests/xstatx.c (LOG_STAT_OFFSETOF_SIZEOF): New macro.
(main): Use it to print struct stat mismatch details.
tests: fix typo in tests/xstatx.c.
* tests/xstatx.c [!IS_FSTAT]: Define IS_FSTAT instead of IS_STAT.
2017-01-12 JingPiao Chen <chenjingpiao@gmail.com>
tests: fix typo in mlock.c.
* tests/mlock.c [!(__NR_mlock && __NR_munlock)]: Fix spelling
of SKIP_MAIN_UNDEFINED.
2017-01-12 JingPiao Chen <chenjingpiao@gmail.com>
strace: move description of -k option to the appropriate place.
Follow the example of strace.1 and put the description of -k option
into the output format group.
* strace.c (usage): Move description of -k option to the output
format group.
2017-01-11 Dmitry V. Levin <ldv@altlinux.org>
Remove redundant commas at the end of structure initializers.
Automatically remove redundant commas using the following
sed expression:
git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'
* linux/32/syscallent.h: Remove redundant commas at the end of structure
initializers.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/microblaze/userent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/kexec_file_load.c: Likewise.
Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
tests: check decoding of scsi ioctl commands.
* tests/ioctl_scsi.c: New file.
* tests/ioctl_scsi.test: New test.
* tests/.gitignore: Add ioctl_scsi.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_scsi.test.
scsi: implement decoding of all SG_* ioctl commands.
* print_sg_req_info.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/sg_scsi_reset.in: New file.
* scsi.c: Include "xlat/sg_scsi_reset.h".
(scsi_ioctl): Implement decoding of all SG_* ioctl commands.
scsi: prepare for decoding of other SG_* ioctl commands.
* scsi.c (scsi_ioctl): Introduce a switch statement.
tests: check decoding of ioctl SG_IO v3 commands.
* tests/ioctl_sg_io_v3.c: New file.
* tests/ioctl_sg_io_v3.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v3.test.
tests: check decoding of ioctl SG_IO v4 commands.
* tests/ioctl_sg_io_v4.c: New file.
* tests/ioctl_sg_io_v4.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v4.test.
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
scsi: add fallback definitions for SG_* ioctl command constants.
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.
* xlat/scsi_sg_commands.in: New file.
* scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing
a fallback definition of SG_IO.
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
xlat: provide fallback definitions for BSG_FLAG_* constants.
BSG_FLAG_* constants were introduced later than the header file where
they are defined.
* xlat/bsg_flags.in: Add default values for constants.
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
xlat: provide fallback definitions for SG_FLAG_* constants.
Unfortunately, <scsi/sg.h> from libc does not provide all constants
recognized by the kernel.
* xlat/sg_io_flags.in: Add default values for constants.
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
sg_io_v4: print din_resid and dout_resid fields as signed integers.
* sg_io_v4.c (decode_response): Print din_resid and dout_resid fields
using %d format.
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
sg_io: cleanup printing of sg_io buffers.
Turn print_sg_io_buffer into a universal sg_io buffer printer.
* sg_io_v3.c (print_sg_io_buffer): Add iovec_count argument.
Call tprint_iov_upto when iovec_count is non-zero.
(decode_request, decode_response): Do not call tprint_iov_upto directly,
use print_sg_io_buffer instead.
* sg_io_v4.c: Likewise.
2017-01-10 Dmitry V. Levin <ldv@altlinux.org>
sg_io: decode structures on exiting syscall in case of syserror.
The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78,
translates its "struct request.errors" to ioctl errors after
filling in all the output members of the SG_IO header structure.
As there is no easy way to tell SCSI layer errors from other syscall
errors, decode the structure on exiting syscall in case of syserror,
too.
* scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use
get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io
unconditionally.
* sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data. Print its i/o
fields when umove call fails. Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
* sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using
set_tcb_priv_data.
(decode_response): Restore it using get_tcb_priv_data. Print its i/o
fields when umove call fails. Pass IOV_DECODE_STR to tprint_iov_upto
unconditionally.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io: reorder printing of fields to follow structure order.
* sg_io_v4.c (decode_request): Print timeout, flags, and usr_ptr fields
after dout_xferp field.
sg_io_v3: print sg_io_hdr.duration field as unsigned integer.
* sg_io_v3.c (decode_response): Print duration field using %u format.
sg_io_v3: print msg_status field.
* sg_io_v3.c (decode_response): Print msg_status field.
sg_io: print names of array fields and corresponding length fields.
* sg_io_v3.c (decode_request): Print names of cmd_len, cmdp,
and dxferp fields.
(decode_response): Print names of dxferp, sb_len_wr, and sbp fields.
* sg_io_v4.c (decode_request): Print names of request_len, request,
dout_xfer_len, and dout_xferp fields.
(decode_response): Print names of response_len, response,
and din_xferp fields.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io_v3: print status fields using %#x format specifier.
The formerly used format string %02x led to misleading output as there
was no clear indication sometimes whether the printed integer was
decimal or hexadecimal.
* sg_io_v3.c (decode_response): Print status and masked_status fields
using %#x format specifier instead of %02x.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io_v4: print status fields in a hexadecimal form.
The tradition is to print scsi status codes in a hexadecimal form.
* sg_io_v4.c (decode_response): Print driver_status, transport_status,
and device_status fields using %#x format specifier instead of %u.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io_v4: print request_tag and generated_tag fields in hex.
The tradition is to print scsi tags in a hexadecimal form.
* sg_io_v4.c (decode_request): Print request_tag field
using ("%#" PRI__x64) format string.
(decode_response): Print generated_tag field using ("%#" PRI__x64)
format string.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io_v4: print usr_ptr field in a hexadecimal form.
As the nature of this field is pointer-like, print it
in a hexadecimal form.
* sg_io_v4.c (decode_request): Print usr_ptr field
using ("%#" PRI__x64) format string.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io_v4: do not print spare_in and spare_out fields.
As the kernel does not touch these fields, there is no use
to print them.
* sg_io_v4.c (decode_request): Do not print spare_in field.
(decode_response): Do not print spare_out field.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io: decode struct sg_io_hdr.info and struct sg_io_v4.info.
Print struct sg_io_hdr.info and struct sg_io_v4.info using printflags.
* xlat/sg_io_info.in: New file.
* defs.h (sg_io_info): New xlat prototype.
* sg_io_v3.c: Include "xlat/sg_io_info.h".
(decode_response): Print struct_sg_io_hdr.info using printflags.
* sg_io_v4.c: (decode_response): Print struct sg_io_v4.info
using printflags.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
sg_io: decode struct sg_io_hdr.flags and struct sg_io_v4.flags.
Print struct sg_io_hdr.flags and struct sg_io_v4.flags using printflags.
* xlat/sg_io_flags.in: New file.
* sg_io_v3.c: Include "xlat/sg_io_flags.h".
(decode_request): Print struct_sg_io_hdr.flags using printflags.
* xlat/bsg_flags.in: New file.
* sg_io_v4.c: Include "xlat/bsg_flags.h".
(decode_request): Print struct sg_io_v4.flags using printflags.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
Mpersify struct sg_io_hdr.
struct sg_io_hdr contains pointers and therefore has to be mpersified.
* defs.h (decode_sg_io_v3): Remove prototype.
* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
Mpersify it.
(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.
2017-01-08 Dmitry V. Levin <ldv@altlinux.org>
Split scsi.c.
Move decoders of SG_IO v3 and v4 APIs into separate files,
compile generic SG_IO decoder unconditionally.
* sg_io_v3.c: New file.
* sg_io_v4.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes.
* ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition.
* scsi.c: (print_sg_io_res): Remove.
(print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req
with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4,
compile uncoditionally.
(scsi_ioctl): Replace print_sg_io_req and print_sg_io_res
with decode_sg_io, compile uncoditionally.
Move [HAVE_SCSI_SG_H] code to sg_io_v3.c.
Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.
2017-01-07 Dmitry V. Levin <ldv@altlinux.org>
scsi: detect and print changes of interface id.
* scsi.c (print_sg_io_v3_res): Detect and print changes
of struct sg_io_hdr.interface_id field between entering and exiting
syscall.
(print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard
field between entering and exiting syscall.
scsi: print field names of all fields being printed.
* scsi.c (print_sg_io_v3_req): Always print the name
of struct sg_io_hdr.interface_id field.
(print_sg_io_v4_req): Always print the name of struct sg_io_v4.guard
field.
(print_sg_io_req): Print unknown interface id as an integer.
(scsi_ioctl): Save interface id on entering syscall and use it
on exiting syscall.
scsi: print struct sg_io_hdr.dxfer_direction field name.
* scsi.c (print_sg_io_v3_req): Print struct sg_io_hdr.dxfer_direction
field name.
scsi: print "protocol" and "subprotocol" field names of struct sg_io_v4.
* scsi.c (print_sg_io_v4_req): Print field names
of struct sg_io_v4.protocol and struct sg_io_v4.subprotocol.
2017-01-07 Dmitry V. Levin <ldv@altlinux.org>
Print hexadecimal integer in error diagnostics using %#x.
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.
* aio.c (startup_child, test_ptrace_seize): Print status
using %#x format specifier instead of %x.
2017-01-07 Dmitry V. Levin <ldv@altlinux.org>
aio: print hexadecimal integer using %#x.
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.
* aio.c (print_common_flags): Print struct iocb.aio_flags using %#x
format specifier instead of %x.
* tests/aio.c (main): Likewise.
2017-01-06 Dmitry V. Levin <ldv@altlinux.org>
scsi: rewrite print_sg_io_buffer using printstr_ex(QUOTE_FORCE_HEX)
As printstr_ex has got QUOTE_FORCE_HEX flag support, there is no need
to implement it manually any longer.
* scsi.c (print_uchar): Remove.
(print_sg_io_buffer): Rewrite using printstr_ex(QUOTE_FORCE_HEX).
2017-01-06 Eugene Syromyatnikov <evgsyr@gmail.com>
getrandom: print string as hex-escaped.
Since there is no reason to interpret the value returned by getrandom as
ASCII string, it makes sense to always print it as a hex-escaped string.
* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
to force hex-escaped string formatting.
* tests/getrandom.test: Remove no longer needed -xx flag as the string
is always printed in hexadecimal format now.
Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-01-06 Eugene Syromyatnikov <evgsyr@gmail.com>
util: add support for forcing printing string as hex-escaped.
This could be useful in cases when some binary data should not be
interpreted as an ASCII string, but rather as an array of byte values.
* defs.h (QUOTE_FORCE_HEX): New macro constant.
* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
in user_style parameter.
2017-01-06 Eugene Syromyatnikov <evgsyr@gmail.com>
term: do not abort decoding in case of non-verbose output.
The case of unset verbose is handled by umoven_or_printaddr, moreover,
exiting at this point is plain wrong and leads to last argument not
being printed while it should be.
* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Do not check verbose flags explicitly and do not
exit early if it is not set.
2017-01-05 Dmitry V. Levin <ldv@altlinux.org>
tests: skip fault injection tests on hppa if the kernel is too old.
* tests/fault_injection.sh: Add the minimal kernel version for hppa.
2017-01-05 Dmitry V. Levin <ldv@altlinux.org>
tests: skip readahead.test on MIPS n64 when built with glibc < 2.25.
Due to a bug in glibc readahead syscall wrapper on MIPS n64,
this wrapper cannot be used in readahead.test.
* tests/readahead.c [HAVE_READAHEAD && LINUX_MIPSN64 && glibc < 2.25]:
Undefine HAVE_READAHEAD.
Reported-by: James Cowgill <james410@cowgill.org.uk>
2017-01-05 Dmitry V. Levin <ldv@altlinux.org>
tests: replace init_magic with fill_memory.
Use the same fill_memory/fill_memory_ex interface in all affected tests.
* tests/ioctl_block.c (init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_evdev.c: Likewise.
* tests/ioctl_v4l2.c: Likewise.
* tests/ioctl_mtd.c (magic, init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_rtc.c: Likewise.
2017-01-05 Dmitry V. Levin <ldv@altlinux.org>
tests: rewrite ioctl_v4l2 test without reliance on init_magic.
* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros.
(main): Use them. Rewrite expected output without assumptions
on any particular magic data.
2017-01-04 Dmitry V. Levin <ldv@altlinux.org>
tests: remove redundant casts in fill_memory{,_ex} invocations.
* tests/ioctl_loop.c (main): Remove redundant casts of fill_memory
first argument.
* tests/kexec_load.c (main): Likewise.
* tests/perf_event_open.c (main): Likewise.
* tests/quotactl.c (main): Likewise.
* tests/mq_sendrecv.c (main): Remove redundant casts of fill_memory_ex
first argument.
* tests/quotactl-xfs.c (main): Likewise.
2017-01-04 Dmitry V. Levin <ldv@altlinux.org>
tests: change the type of fill_memory{,_ex} first argument to void *
As these functions behave like memset, it's more convenient to have
the first argument of type void * like memset.
* tests/fill_memory.c (fill_memory, fill_memory_ex): Change the type
of first argument from "char *" to "void *".
* tests/tests.h (fill_memory, fill_memory_ex): Likewise.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: check non-verbose decoding of LOOP_* ioctls.
* tests/ioctl_loop-nv.c: New file.
* tests/ioctl_loop-nv.test: New test.
* tests/ioctl_loop.c [!ABBREV] (ABBREV): Define to 0.
(print_loop_info, print_loop_info64): Handle [ABBREV != 0] case.
* tests/.gitignore: Add ioctl_loop-nv.
* tests/Makefile.am (check_PROGRAMS): Likewise.
tests: add more checks of LOOP_* ioctls decoding.
* tests/ioctl_loop.c: Include <linux/ioctl.h>.
(magic, lmagic): Move static constants ...
(main): ... here. Change types of magic constants to kernel_ulong_t.
Add more checks.
2017-01-04 JingPiao Chen <chenjingpiao@gmail.com>
Eugene Syromyatnikov <evgsyr@gmail.com>
tests: check decoding of LOOP_* ioctls.
* tests/ioctl_loop.c: New file.
* tests/ioctl_loop-v.c: Likewise.
* tests/ioctl_loop.test: New test.
* tests/ioctl_loop-v.test: Likewise.
* tests/.gitignore: Add ioctl_loop and ioctl_loop-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_loop.test and ioctl_loop-v.test.
2017-01-04 Dmitry V. Levin <ldv@altlinux.org>
Drop vsprintf.c.
Drop custom vfprintf implementation that was disabled by default.
Apparently nobody tests strace with this vfprintf enabled, otherwise
multiple uses of format specifiers not supported by this custom vfprintf
would not left unnoticed.
The GNU C library is not the only libc available, so those who want
faster implementations of libc functions are encouraged to try building
strace with other libc implementations.
* vsprintf.c: Remove.
* Makefile.am (strace_SOURCES): Remove vsprintf.c.
* defs.h (USE_CUSTOM_PRINTF, strace_vfprintf): Remove.
* strace.c (tprintf): Replace strace_vfprintf with vfprintf.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
loop: remove unnecessary verbose check.
The verbose flag is responsible for dereferencing of addresses, and it
is perfectly handled by umove_or_printaddr; moreover, this early exit
leads to incorrect formatting of last argument.
* loop.c (loop_ioctl): Do not check verbose flag explicitly and do not
exit early if it is not set.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
loop: fix lo_encrypt_key field output.
lo_encrypt_key is a sized string with its size specified by
lo_encrypt_key_size field, so take lo_encrypt_key_size into account.
* loop.c (decode_loop_info, decode_loop_info64): Use minimum of
LO_KEY_SIZE and lo_encrypt_key_size field value as lo_encrypt_key size.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
loop: print lo_encrypt_key_size field of struct loop_info as unsigned.
It is converted to an unsigned value in kernel (see loop_info64_from_old
in drivers/block/loop.c), so let's print it that way despite its type.
* loop.c (decode_loop_info): Print lo_encrypt_key_size as an uint32_t
value.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: add more checks of unknown ioctl command formatting.
* tests/ioctl.c (main): Additional check for unknown ioctl command
decoding.
* tests/ioctl_evdev.c (main): Likewise.
* tests/ioctl_dm.c: Include <linux/ioctl.h> for _IOC_SIZE and _IOC_NR.
(main) <dummy_dm_ioctl1, dummy_dm_ioctl2, dummy_dm_arg>: New constants.
Add more checks for unknown command formatting.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
ioctl: do not print explicit 0x prefix and do not specify minimum width.
Specifying output width for size argument is rather misleading - it can
be up to 14 bits in size. The use of explicit "0x" prefix is
discouraged because 0x0 looks ugly. Usage of width specification along
with alternate form flag leads to inconsistent output for 0.
Let's use just plain %#x qualifiers instead.
* ioctl.c (ioctl_print_code): Change printf qualifiers for ioctl command
type, number and size to "%#x".
* tests/ioctl.c (main): Update expected test output.
* tests/ioctl_dm.c (main): Likewise.
* tests/ioctl_evdev.c (main): Likewise.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
loop: fix printing of the reserved field array items.
They are of char type, so "hh" length modifier should be used (otherwise
they are printed incorrectly as they are sign extended implicitly when
passed as printf arguments in case char is a signed type which is true
for most compilers).
* loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx"
in printing routine for array elements of the "reserved" field of
loop_info structure.
2017-01-04 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: check ioctl(SIOCGIFCONF) decoding.
* tests/ioctl_sock_gifconf.c: New file.
* tests/ioctl_sock_gifconf.test: New test.
* tests/.gitignore: Add ioctl_sock_gifconf.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sock_gifconf.test.
dm.c: add copyright notice.
2017-01-04 Dmitry V. Levin <ldv@altlinux.org>
Add scno.h and syscallent.i to .gitignore files.
* .gitignore: Add /scno.h and /syscallent.i.
* tests/.gitignore: Add scno.h and syscallent.i.
2017-01-04 JingPiao Chen <chenjingpiao@gmail.com>
tests/.gitignore: add generated files that should be ignored.
* tests/.gitignore: Replace addkey with add_key, add attach-f-p-cmd.
2017-01-03 Dmitry V. Levin <ldv@altlinux.org>
Remove checks of __NR_* availability from strace source code.
* strace.c: Remove __NR_tkill checks, assume it is always defined.
* util.c: Remove __NR_process_vm_readv checks and fallback definitions,
assume it is always defined.
Include "scno.h" in files that check __NR_* constants.
* strace.c: Include "scno.h".
* util.c: Likewise.
Generate scno.h for use during the build of strace itself.
* Makefile.am: Include scno.am.
($(strace_OBJECTS)): New rule.
2017-01-01 Dmitry V. Levin <ldv@altlinux.org>
Generate scno.h without invoking a generated executable helper.
Generate scno.h using only those tools that are available for cross
build. This allows to use scno.h during the build of strace itself.
* scno.am: New file.
* scno.head: New file.
* Makefile.am (EXTRA_DIST): Add it.
* tests/generate_scno.c: Remove.
* tests/.gitignore: Remove generate_scno.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(CLEANFILES): Remove scno.h.
(scno.h, $(scno_dependants)): Remove rules.
(scno_dependants): Remove.
($(objects)): New rule.
Include ../scno.am.
2017-01-01 Dmitry V. Levin <ldv@altlinux.org>
Update all publicly shown copyright year number ranges.
* COPYING: Update copyright year number range.
* configure.ac: Likewise.
* strace.c: Likewise.
* tests/strace-V.test: Use the current year for the check.
2016-12-31 Dmitry V. Levin <ldv@altlinux.org>
defs.h: stop including <asm/unistd.h>
Limit the number of files where <asm/unistd.h> is included
to only those few that need it.
* defs.h: Do not include <asm/unistd.h>.
* clone.c: Include <asm/unistd.h>.
* strace.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2016-12-30 Dmitry V. Levin <ldv@altlinux.org>
tests: do not use BUILT_SOURCES.
* tests/Makefile.am (ksysent.$(OBJEXT)): New rule.
(BUILT_SOURCES): Remove.
2016-12-30 Dmitry V. Levin <ldv@altlinux.org>
Fix cross build.
This fixes cross build regression introduced by commit
v4.15-39-g605a705a63d533dceb3c2d489468fcd3aed3963c.
* tests/Makefile.am (BUILT_SOURCES): Remove scno.h
(objects, scno_dependants): New variables.
($(scno_dependants)): New rule.
Reported-by: Joakim Bech <joakim.bech@linaro.org>
2016-12-30 Dmitry V. Levin <ldv@altlinux.org>
tests: do not use defs.h and syscall.h.
* tests/generate_scno.c: Include "tests.h", "sysent.h", <stdio.h>,
<string.h>, and <asm/unistd.h> instead of "defs.h" and "syscall.h".
* tests/ksysent.c: Likewise.
* tests/nsyscalls.c: Include "tests.h", "sysent.h", <errno.h>,
<stdio.h>, and <unistd.h> instead of "defs.h" and "syscall.h".
Move definition of struct sysent and trace flags to a separate file.
* sysent.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Include it.
(struct sysent, TRACE_FILE, TRACE_IPC, TRACE_NETWORK, TRACE_PROCESS,
TRACE_SIGNAL, TRACE_DESC, TRACE_MEMORY, SYSCALL_NEVER_FAILS,
STACKTRACE_INVALIDATE_CACHE, STACKTRACE_CAPTURE_ON_ENTER,
TRACE_INDIRECT_SUBCALL, COMPAT_SYSCALL_TYPES): Remove.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
Mpersify SIOC* ioctls.
struct ifreq and struct ifconf are ABI-dependent and should have been
mpersified.
* defs.h (sock_ioctl): Remove prototype.
* sock.c (struct_ifconf, struct_ifreq): New typedefs.
(DEF_MPERS_TYPE(struct_ifconf), DEF_MPERS_TYPE(struct_ifreq),
MPERS_DEFS): New includes.
(print_ifreq, print_ifc_len, print_ifconf_ifreq): Replace struct ifreq
with struct_ifreq.
(decode_ifconf): Replace struct ifconf with struct_ifconf, struct ifreq
with struct_fireq.
(sock_ioctl): Wrap into MPERS_PRINTER_DECL.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
Dmitry V. Levin <ldv@altlinux.org>
sock: rewrite decode_ifconf.
* sock.c (decode_ifconf): Rewrite.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
xlat: update LOOP_* ioctl flags constants.
* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_USE_AOPS
and LO_FLAGS_DIRECT_IO.
* xlat/loop_flags_options.in: Likewise. Add default values
for constants.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
loop: add fallback definitions for LOOP_* ioctl command constants.
Since these are architecture-independent and have been added over the
kernel's lifetime, it makes sense to have these definitions in strace
itself.
* xlat/loop_cmds.in: New file.
* loop.c: Include "xlat/loop_cmds.h".
(loop_ioctl): Eliminate conditional compilation based on availability
of LOOP_* constant definitions.
2016-12-29 Dmitry V. Levin <ldv@altlinux.org>
xlat: extend syntax.
* xlat/gen.sh: Implement #stop directive that stops preprocessor
at the line it has been encountered during the first pass. This could
be used, for example, to provide fallback definitions for constants
without defining xlat tables.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
Dmitry V. Levin <ldv@altlinux.org>
loop: mpersify struct loop_info and loop_ioctl function.
struct loop_info contains fields of type long, so it definitely should
have been mpersified.
* defs.h (loop_ioctl): Remove prototype.
* loop.c (struct_loop_info): New typedef.
Include DEF_MPERS_TYPE(struct_loop_info) and MPERS_DEFS.
(decode_loop_info): Replace struct loop_info with struct_loop_info.
Cast lo_inode, lo_init[0], and lo_init[1] to kernel_ulong_t and print
them using appropriate format specifiers.
(loop_ioctl): Wrap into MPERS_PRINTER_DECL.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
loop: print lo_device and lo_rdevice fields using print_dev_t.
* loop.c (decode_loop_info, decode_loop_info64): Use print_dev_t
for printing lo_device and lo_rdevice fields.
2016-12-29 Eugene Syromyatnikov <evgsyr@gmail.com>
Dmitry V. Levin <ldv@altlinux.org>
Move device number printing code into a separate routine.
* print_dev_t.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (print_dev_t): New prototype.
* dm.c: Do not include <sys/sysmacros.h>.
(dm_decode_device, dm_print_dev, dm_decode_dm_name_list): Use
print_dev_t function for printing device numbers.
* mknod.c: Do not include <sys/sysmacros.h>.
(decode_mknod): Use print_dev_t function for printing device number.
* print_struct_stat.c: Do not include <sys/sysmacros.h>.
(print_struct_stat): Use print_dev_t function for printing device
numbers.
2016-12-28 Dmitry V. Levin <ldv@altlinux.org>
tests: enhance invalid address decoding check in seccomp-strict.test.
* tests/seccomp-strict.c (main): Change the type of addr variable
containg the invalid address from unsigned long to kernel_ulong_t,
print it using %#llx format.
2016-12-28 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: check decoding of prctl PR_GET_TID_ADDRESS operation.
* tests/prctl-tid_address.c: New file.
* tests/prctl-tid_address.test: New test.
* tests/.gitignore: Add prctl-tid_address.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-tid_address.test.
2016-12-28 Dmitry V. Levin <ldv@altlinux.org>
Update the publicly shown copyright information.
Set the publicly shown copyright holder to "The strace developers.".
* COPYING: Update copyright information.
* configure.ac: Add AC_COPYRIGHT.
* strace.c (print_version): New function.
(init): Use it.
* tests/strace-V.test: Update expected output.
2016-12-28 Dmitry V. Levin <ldv@altlinux.org>
configure: specify project URL.
* configure.ac (AC_INIT): Add URL.
2016-12-28 Seraphime Kirkovski <kirkseraph@gmail.com>
Document signal injection.
* strace.1: Describe :signal=SIG option of the fault injection syntax.
* NEWS: Mention signal injection.
2016-12-28 Seraphime Kirkovski <kirkseraph@gmail.com>
Implement signal injection.
This extends the fault injection capability with :signal=SIG option
which injects a signal on entering each syscall from the specified set.
:signal and :error options are complementary, if they are both specified
the syscall will be fault injected as usual and the specified signal
will be delivered to the tracee.
* defs.h (struct fault_opts): Change the type of err field to int16_t,
add signo field.
(trace_syscall): Add a pointer argument.
* qualify.c: Include "nsig.h".
(parse_fault_token): Handle signal= option.
(qualify_fault): Update default fault_opts.
* strace.c (trace): Forward signal number from trace_syscall
to ptrace_restart(PTRACE_SYSCALL).
* syscall.c (inject_syscall_fault_entering): Add pointer argument,
save there the signal number specified by fault options. Do not inject
a syscall fault unless instructed by fault options.
(update_syscall_fault_exiting): Update the error code injection check.
(trace_syscall_entering): Add pointer argument, forward it to
inject_syscall_fault_entering.
(trace_syscall): Add pointer argument, forward it to
trace_syscall_entering.
2016-12-28 Dmitry V. Levin <ldv@altlinux.org>
Update README.md.
* README.md: Update homepage URL, mention command-line interface
and tampering capabilities in the description.
2016-12-28 Dmitry V. Levin <ldv@altlinux.org>
tests: robustify prctl-arg2-intptr.test.
Robustify prctl-arg2-intptr.test against unrelated prctl invocations.
* tests/prctl-arg2-intptr.test: Filter out unrelated PR_GET_*
and PR_SET_* prctl calls.
2016-12-27 Dmitry V. Levin <ldv@altlinux.org>
signal: remove redundant checks around NSIG.
* signal.c (struct old_sigaction, struct new_sigaction,
struct new_sigaction32): Remove safety checks for NSIG >= sizeof(long).
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.
Move NSIG ifdefery to a separate header file.
* nsig.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c: Include "nsig.h" instead of <signal.h>, remove
NSIG workarounds.
* sigreturn.c: Likewise.
* syscall.c: Likewise.
* tests/pselect6.c: Likewise.
Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro.
* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
(truncate_klong_to_current_wordsize,
truncate_kulong_to_current_wordsize): Use it.
* mem.c (SYS_FUNC(old_mmap)): Likewise.
* util.c (umoven, umovestr, dumpiov_upto): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
Simplify personality checks in msghdr.c and signal.c.
* msghdr.c: Check for [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
* signal.c: Likewise.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Replace widen_to_long with truncate_klong_to_current_wordsize.
* defs.h (widen_to_long): Remove.
(truncate_klong_to_current_wordsize): New static inline function.
* aio.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents): Use it
instead of widen_to_long.
* linux/sparc64/get_syscall_args.c (get_syscall_args): Update comment.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
Replace widen_to_ulong with truncate_kulong_to_current_wordsize.
* defs.h (widen_to_ulong): Remove.
(truncate_kulong_to_current_wordsize): New static inline function.
* io.c (do_preadv, do_pwritev): Use it instead of widen_to_ulong.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Simplify print_lld_from_low_high_val ifdefery.
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.
* io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
[SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long
instead of zero_extend_signed_to_ull.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Simplify getllval ifdefery.
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.
* util.c (getllval): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
2016-12-26 Eugene Syromyatnikov <evgsyr@gmail.com>
prctl: print pointer returned by PR_GET_TID_ADDRESS as kernel long.
Since there is no compat handler for x32/n32, kernel returns kernel's
long as a result of the call.
Interesting, does any callee out there actually care to have enough room
allocated for kernel long?
* prctl.c (SYS_FUNC(prctl)): Use printnum_kptr instead of printnum_ptr
to print the value stored at address pointed by addr2 argument
of PR_GET_TID_ADDRESS operation.
2016-12-26 Eugene Syromyatnikov <evgsyr@gmail.com>
Add functions for printing pointers of kernel_ulong_t size.
In cases where no compat for x32/n32 is implemented, pointer is of
kernel's long size, so it should be printed appropriately.
* defs.h [!current_klongsize] (printnum_addr_klong_int): New prototype.
(printnum_kptr): New macro.
* util.c [!current_klongsize] (printnum_addr_klong_int): New function.
2016-12-26 Eugene Syromyatnikov <evgsyr@gmail.com>
Dmitry V. Levin <ldv@altlinux.org>
Print indirect pointers as pointers.
Originally, printnum_long_int was used, but it prints NULL incorrectly.
* defs.h (DECL_PRINTNUM_ADDR): New macro.
(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
[!current_wordsize] (printnum_addr_long_int): New prototype.
[!current_wordsize] (printnum_ptr): Use it.
[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
* util.c (DEF_PRINTNUM_ADDR): New macro.
(DEF_PRINTNUM_ADDR(int, unsigned int),
DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
provide printnum_addr_int and printnum_addr_int64, accordingly.
[!current_wordsize] (printnum_addr_long_int): New function.
* xet_robust_list.c (sprintaddr): New function.
(main): Use it, update expected output.
* tests/ipc_sem.c (main): Update expected output.
2016-12-26 Eugene Syromyatnikov <evgsyr@gmail.com>
ipc_sem: print 4th argument of semctl syscall as an address.
* ipc_sem.c (SYS_FUNC(semctl)): Print 4th argument using printaddr.
* tests/ipc_sem.c (cleanup): Update expected output.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Do not define printnum_long_int on systems with constant current_wordsize
* defs.h: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to select
definitions of printnum_slong, printnum_ulong, and printnum_ptr.
* util.c: Check [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to decide
whether to compile printnum_long_int.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
umoven: detect invalid addresses.
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.
* util.c (umoven): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umoven-illptr.c: New file.
* tests/umoven-illptr.test: New test.
* tests/.gitignore: Add umoven-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umoven-illptr.test.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
umovestr: detect invalid addresses.
Do not silently truncate tracee addresses to current_wordsize.
After transition from long to kernel_ulong_t there should be no sign
extension issues with tracee addresses, and invalid addresses should
be printed properly.
* util.c (umovestr): Check [SIZEOF_KERNEL_LONG_T > 4] instead
of [SIZEOF_LONG > 4], reject addresses that do not fit into
current_wordsize.
* tests/umovestr-illptr.c: New file.
* tests/umovestr-illptr.test: New test.
* tests/.gitignore: Add umovestr-illptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr-illptr.test.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
lseek: simplify _llseek syscall decoder.
After transition from long to kernel_ulong_t the implementation
could be made a bit simpler.
* lseek.c (SYS_FUNC(llseek)): Use direct cast to long long instead
of zero_extend_signed_to_ull.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
lseek: merge two different implementations of lseek syscall decoder.
After transition from long to kernel_ulong_t there are no mo
complications that required to keep a separate implementation
for x32 and mips n32.
* lseek.c (SYS_FUNC(lseek)): Merge two different implementations
into a single one.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval.
After transition from long to kernel_ulong_t these fields
are no longer needed.
* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
(RVAL_MASK): Update.
* io.c (print_lld_from_low_high_val): Check
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
Use u_arg instead of ext_arg.
* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
Remove.
[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
* linux/x86_64/get_error.c (get_error) [X32]: Remove.
* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG].
[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
instead of ext_arg. Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
to print_mmap.
* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
of RVAL_LUDECIMAL.
* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
instead of [HAVE_STRUCT_TCB_EXT_ARG]. Use u_arg instead of ext_arg.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Remove getarg_klu.
After transition from long to kernel_ulong_t we no longer need
tcp->ext_arg, and therefore a function to access it is also no longer
needed.
* defs.h (getarg_klu): Remove prototype.
* util.c (getarg_klu): Remove.
(printargs): Access tcp->u_arg directly
* bjm.c (SYS_FUNC(init_module)): Likewise.
* clone.c (SYS_FUNC(unshare)): Likewise.
* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
* kcmp.c (SYS_FUNC(kcmp)): Likewise.
* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
* keyctl.c (SYS_FUNC(keyctl)): Likewise.
* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
* mem.c (do_mprotect): Likewise.
* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
Likewise.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Remove printaddr_klu.
After transition from long to kernel_ulong_t we no longer need
two versions of printaddr function.
* defs.h (printaddr): Remove.
(printaddr_klu): Rename to printaddr.
* util.c (printaddr_klu): Likewise.
* bjm.c (SYS_FUNC(init_module)): Replace printaddr_klu with printaddr.
* mem.c (do_mprotect): Likewise.
2016-12-26 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: check decoding of a subset of prctl operations.
Check decoding of prctl operations that take the second syscall argument
as a pointer to an integer.
* tests/prctl-arg2-intptr.c: New file.
* tests/prctl-arg2-intptr.test: New test.
* tests/.gitignore: Add prctl-arg2-intptr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-arg2-intptr.test.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.
Automatically replace PRI_kr[dux] with PRI_kl[dux] using
$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'
* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove. All users updated.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
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 Dmitry V. Levin <ldv@altlinux.org>
Redirect kernel_ureg_t and kernel_scno_t from unsigned long to kernel_ulong_t
* defs.h (struct tcb): Change u_rval type from long to kernel_long_t.
(PRI_krd, PRI_kru, PRI_krx): Redirect to PRI_kld, PRI_klu, and PRI_klx.
* kernel_types.h (kernel_scno_t, kernel_ureg_t): Redirect
to kernel_ulong_t.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Print kernel_ureg_t and kernel_scno_t using dedicated format strings.
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.
* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
vm_read_mem: detect address truncation.
When sizeof(kernel_ureg_t) > sizeof(long), the tracee address passed
to vm_read_mem could be silently truncated. Detect this situation
and return EIO when the tracee address does not fit into unsigned long.
* util.c (vm_read_mem): Save raddr argument into a temporary variable
truncated_raddr of type unsigned long. Set errno to EIO and return -1
when truncated_raddr does not equal to raddr.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
trace_syscall_exiting: prepare personality check for u_rval type change.
* syscall.c (trace_syscall_exiting): Check for sizeof(tcp->u_rval)
instead of sizeof(long) when deciding how to print tcp->u_rval.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
Direct casts to kernel_ureg_t will not work after the change
of kernel_ureg_t from unsigned long to kernel_ulong_t.
* defs.h (ptr_to_kulong): New macro.
* block.c (print_blkpg_req): Use it instead of explicit casts
to kernel_ureg_t.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
* sigaltstack.c (print_stack_t): Likewise.
* sock.c (decode_ifconf): Likewise.
* sysctl.c (SYS_FUNC(sysctl)): Likewise.
* util.c (dumpiov_upto): Likewise.
* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
print_v4l2_ext_controls): Likewise.
2016-12-26 Dmitry V. Levin <ldv@altlinux.org>
umove*: remove redundant casts.
* util.c (umoven, umovestr): Remove casts from unsigned long to pointer.
upoke: remove redundant casts.
* upoke.c (upoke): Remove casts from unsigned long to pointer.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
signal: cleanup decoding of sa_handler and sa_restorer.
Change type of sa_handler and sa_restorer fields from function pointers
to unsigned long. This saves the code from a lot of casts between
pointers and integers.
Rename __sa_handler to sa_handler__ as names starting with underscore
symbol are reserved and should not be used.
* signal.c (old_sigaction): Rename __sa_handler to sa_handler__,
all users updated. Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(old_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_old_sigaction): Remove now redundant casts from
old_sigaction32.sa_handler__ to old_sigaction.sa_handler__,
from old_sigaction32.sa_restorer to old_sigaction.sa_restorer,
and from old_sigaction.sa_handler__ to unsigned long. Print
old_sigaction.sa_restorer using printaddr.
* signal.c (new_sigaction): Rename __sa_handler to sa_handler__,
all users updated. Change the type of sa_handler__ and sa_restorer
from pointer to unsigned long.
(new_sigaction32): Rename __sa_handler to sa_handler__, all users
updated.
(decode_new_sigaction): Remove now redundant casts from
new_sigaction32.sa_handler__ to new_sigaction.sa_handler__,
from new_sigaction32.sa_restorer to new_sigaction.sa_restorer,
and from new_sigaction.sa_handler__ to unsigned long. Print
new_sigaction.sa_restorer using printaddr.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
signal: change signal handler address type from unsigned long to kernel_ureg_t
* signal.c (get_sa_handler_str, print_sa_handler): Change handler type
from unsigned long to kernel_ureg_t.
quota: change address argument type from unsigned long to kernel_ureg_t.
* quota.c (decode_cmd_data): Change the type of data argument
from unsigned long to kernel_ureg_t.
execve: prepare for handling big pointers.
* execve.c (printargv): Change cp.p64 type from unsigned long
to kernel_ulong_t so it could handle wordsize > sizeof(long) properly.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
clone: print clone flags without truncation.
The flags argument is defined in kernel as unsigned long,
so change its decoding to avoid truncation.
* clone.c (SYS_FUNC(clone)): Change flags type from unsigned long
to kernel_ureg_t, print it using printflags64 instead of printflags.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
Use printxval64 instead of printxval_long.
After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
to stop using printxval_long proxy and pass syscall arguments directly
to printxval64.
* defs.h (printxval_long): Remove.
* fcntl.c (print_fcntl): Replace printxval_long with printxval64.
* mtd.c (mtd_ioctl): Likewise.
* numa.c (SYS_FUNC(mbind)): Likewise.
* or1k_atomic.c [OR1K] (SYS_FUNC(or1k_atomic)): Likewise.
* sysmips.c [MIPS] (SYS_FUNC(sysmips)): Likewise.
* term.c (term_ioctl): Likewise.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
Use printflags64 instead of printflags_long.
After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
to stop using printflags_long proxy and pass syscall arguments directly
to printflags64.
* defs.h (printflags_long): Remove.
* fcntl.c (print_fcntl): Replace printflags_long with printflags64.
* numa.c (SYS_FUNC(get_mempolicy)): Likewise.
* perf.c (SYS_FUNC(perf_event_open)): Likewise.
* sram_alloc.c [BFIN] (SYS_FUNC(sram_alloc)): Likewise.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
upeek, upoke: change argument types from long to unsigned long.
* defs.h (upeek, upoke): Change offset argument type from long
to unsigned long. Change res argument type from long to kernel_ureg_t.
* upeek.c (upeek): Likewise.
* upoke.c (upoke.c): Likewise.
* syscall.c (print_pc) [ARCH_PC_PEEK_ADDR]: Change pc type from long
to kernel_ureg_t.
* linux/aarch64/arch_regs.c (arm_sp_ptr): Remove redundant cast.
* linux/metag/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/sh64/get_syscall_result.c (get_syscall_result_regs): Likewise.
* linux/powerpc/getregs_old.c (getregs_old): Remove redundant casts.
* linux/alpha/arch_getrval2.c (getrval2): Change r20 type from long
to unsigned long.
* linux/alpha/arch_regs.c (alpha_r0, alpha_a3): Change type from long
to unsigned long.
* linux/bfin/arch_regs.c (bfin_r0): Likewise.
* linux/crisv10/arch_regs.c (cris_r10): Likewise.
* linux/hppa/arch_regs.c (hppa_r28): Likewise.
* linux/ia64/arch_regs.c (IA64_PSR_IS): Likewise.
* linux/microblaze/arch_regs.c (microblaze_r3): Likewise.
* linux/sh/arch_regs.c (sh_r0): Likewise.
* linux/sh64/arch_regs.c (sh64_r9): Likewise.
* linux/xtensa/arch_regs.c (xtensa_a2): Likewise.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Change addr type
from long to unsigned long.
* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/alpha/get_scno.c (arch_get_scno): Update for the change
of signedness.
* linux/arc/get_syscall_args.c (get_syscall_args): Change arc_args type
from pointer to long to pointer to unsigned long.
* linux/arm/arch_regs.c (arm_sp_ptr): Change type from pointer to long
to pointer to unsigned long.
* linux/arm/arch_regs.h (arm_sp_ptr): Likewise.
* linux/i386/arch_regs.c (i386_esp_ptr): Likewise.
* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
* linux/m68k/arch_regs.c (m68k_usp_ptr): Likewise.
* linux/m68k/arch_regs.h (m68k_usp_ptr): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Use umove
instead of umoven.
* linux/sh/arch_getrval2.c (getrval2): Change val type from long
to unsigned long.
arch_sigreturn: change tracee address type from long to unsigned long.
* linux/arm/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to unsigned long.
* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/m68k/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/crisv10/arch_sigreturn.c (arch_sigreturn): Change the type
of addr and regs variables from long to unsigned long.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Change addr variable
type from long to kernel_ureg_t.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Change the type
of offset and addr variables from long to kernel_ureg_t.
kexec: change flags type from unsigned long to kernel_ureg_t.
* kexec.c (SYS_FUNC(kexec_load)): Change n variable type
from unsigned long to kernel_ureg_t. Use printxval64 instead
of printxval_long. Use printflags64 instead of printflags_long.
kexec: change types of pointers and sizes to kernel_ureg_t.
* kexec.c (print_seg): Change the type of *seg and seg_buf variables
from unsigned long to kernel_ureg_t.
(print_kexec_segments): Change len argument type from unsigned long
to kernel_ureg_t. Change seg variable type from unsigned long
to kernel_ureg_t.
printsiginfo: change len argument type from unsigned long to kernel_ureg_t
* printsiginfo.c (print_siginfo_array): Change len argument type
from unsigned long to kernel_ureg_t.
signal: change address argument type from unsigned long to kernel_ureg_t
* signal.c (print_sigqueueinfo): Change address argument type
from unsigned long to kernel_ureg_t.
statfs64: change size argument type from unsigned long to kernel_ureg_t.
* defs.h (print_struct_statfs64): Change size argument type
from unsigned long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs64): Likewise.
* fstatfs64.c (SYS_FUNC(fstatfs64)): Pass size argument directly
to print_struct_statfs64.
* statfs64.c (SYS_FUNC(statfs64)): Likewise.
Cast tcp->u_rval to kernel_ureg_t instead of unsigned long.
* fcntl.c (print_fcntl): Cast tcp->u_rval to kernel_ureg_t instead
of unsigned long.
* membarrier.c (SYS_FUNC(membarrier)): Likewise.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
* time.c (do_adjtimex): Likewise.
decode_sockbuf: change addrlen argument type from long to kernel_ureg_t.
* net.c (decode_sockbuf): Change addrlen argument type from long
to kernel_ureg_t.
netlink: change size types from unsigned long to kernel_ureg_t.
* defs.h (decode_netlink): Change len argument type from unsigned long
to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr): Likewise.
(decode_nlmsghdr_with_payload): Likewise. Change nlmsg_len variable
type from unsigned long to unsigned int.
(decode_netlink): Change the type of len argument and next_len variable
from unsigned long to kernel_ureg_t. Change nlmsg_len variable type
from unsigned long to unsigned int.
ipc_msg: change size types from unsigned long to kernel_ureg_t.
* ipc_msg.c (tprint_msgsnd): Change count argument type
from unsigned long to kernel_ureg_t. Change flags argument type
from unsigned long to unsigned int.
(tprint_msgrcv): Change the type of count and msgtyp arguments
from unsigned long to kernel_ureg_t.
(fetch_msgrcv_args): Change *pair type from unsigned long
to kernel_ureg_t.
(SYS_FUNC(msgrcv)): Change pair type from unsigned long
to kernel_ureg_t.
* print_msgbuf.c (tprint_msgbuf): Change count argument type
from unsigned long to kernel_ureg_t.
dumpiov_upto: change size types from unsigned long to kernel_ureg_t.
* defs.h (dumpiov_upto): Change data_size argument type
from unsigned long to kernel_ureg_t.
* util.c (dumpiov_upto): Change the type of data_size argument
and iov_len variable from unsigned long to kernel_ureg_t.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
msghdr: change cmsghdr size types from size_t to unsigned int.
As the kernel does not accept control messages longer than the value
of int sysctl_optmem_max kernel variable exported as
/proc/sys/net/core/optmem_max, we do not print them either.
Since unsigned int has enough room to contain any valid control message
size, change all internal cmsghdr size types from size_t
to unsigned int.
* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_uint8_t,
print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr,
cmsg_printer, print_cmsg_type_data): Change data_len argument type
from size_t to unsigned int.
(cmsg_socket_printers): Change min_len type from size_t to unsigned int.
(decode_msg_control): Change the type of in_control_len argument,
cmsg_len, and len variables from size_t to kernel_ureg_t.
Change the type of cmsg_size, control_len, and buf_len variables
from size_t to unsigned int.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
msghdr: change register based size types from unsigned long to kernel_ureg_t
* defs.h (dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
* msghdr.h (print_struct_msghdr): Likewise.
* msghdr.c (print_struct_msghdr): Likewise. Cast msghdr.msg_iovlen
and msghdr.msg_controllen to kernel_ureg_t instead of unsigned long.
(decode_msghdr, dumpiov_in_msghdr): Change data_size argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(sendmsg)): Pass -1 instead of -1UL as data_size argument
to decode_msghdr.
* mmsghdr.c (print_struct_mmsghdr): Pass (kernel_ureg_t) -1 instead
of -1UL as data_size argument to print_struct_msghdr.
(dumpiov_in_mmsghdr): Cast msghdr.msg_iovlen to kernel_ureg_t instead
of unsigned long.
* syscall.c (dumpio): Pass -1 instead of -1UL as data_size argument
to dumpiov_in_msghdr
mq: remove redundant u_rval check.
* mq.c (SYS_FUNC(mq_timedreceive)): Do not check for tcp->u_rval < 0,
syserror(tcp) is enough, and printstrn can handle len < 0 anyway.
io: change size types from unsigned long to kernel_ureg_t.
* defs.h (tprint_iov_upto): Change the type of len and data_size
arguments from unsigned long to kernel_ureg_t.
(tprint_iov): Change the type of len argument from unsigned long
to kernel_ureg_t.
* io.c (print_iovec_config): Change data_size type from unsigned long
to kernel_ureg_t.
(print_iovec): Change the type of *iov, iov_buf, and len variables
from unsigned long to kernel_ureg_t.
(tprint_iov_upto): Change the type of len and data_size arguments, and
the type of iov variable from unsigned long to kernel_ureg_t.
mount: change flags type from unsigned long to kernel_ureg_t.
* mount.c (SYS_FUNC(mount)): Change the type of flags from unsigned long
to kernel_ureg_t, use printflags64 instead of printflags_long
to print it.
mem: change mmap arguments type from unsigned long to kernel_ureg_t.
* mem.c (print_mmap): Change the type of len, prot, and flags
from unsigned long to kernel_ureg_t. Use printflags64 instead
of printflags_long. Use printxval64 instead of printxval_long.
(SYS_FUNC(old_mmap)): Check for current_klongsize instead
of [AARCH64 || X86_64] to take X32 into account.
(SYS_FUNC(mremap)): Use printflags64 instead of printflags_long.
(SYS_FUNC(remap_file_pages)): Change the type of size, prot, pgoff, and
flags from unsigned long to kernel_ureg_t. Use printflags64 instead
of printflags_long. Use printxval64 instead of printxval_long.
[POWERPC] (SYS_FUNC(subpage_prot)): Change the type of len and nmemb
from unsigned long to kernel_ureg_t.
numa: change size arguments type from unsigned long to kernel_ureg_t.
* numa.c (print_node, print_addr): Add kernel_ureg_t support.
(print_nodemask): Change type of maxnodes argument from unsigned long
to kernel_ureg_t.
(SYS_FUNC(move_pages)): Change npages type from unsigned long
to kernel_ureg_t. Change buf type from long to kernel_ureg_t.
print_sigset_addr_len: change len argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len): Change len argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.
process_vm: change size arguments type from unsigned long to kernel_ureg_t
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Change the type of local_iovcnt,
remote_iovcnt, and flags from unsigned long to kernel_ureg_t.
printstr*: change len argument type from long to kernel_ureg_t.
* defs.h (printstr_ex, printstrn): Change len argument type from long
to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
xattr: change size arguments type from unsigned long to kernel_ureg_t.
* xattr.c (print_xattr_val): Change type of insize and size arguments
from unsigned long to kernel_ureg_t.
(print_xattr_list): Change type of size argument from unsigned long
to kernel_ureg_t.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
printstr_ex: fix decoding of non-NUL-terminated strings when len == -1.
Do not treat len == -1 in any special way. All users who need the
string to be handled as a NUL-terminated string set QUOTE_0_TERMINATED
bit in user_style flags already.
* util.c (printstr_ex): Remove (len == -1) check.
* tests/printstr.c: New file.
* tests/printstr.test: New test.
* tests/.gitignore: Add printstr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add printstr.test.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
Fix decoding of sethostname syscall.
The second argument of sethostname syscall is not an unsigned long but
unsigned int. The kernel does not look at the string argument when
the length argument is too long.
* hostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(SYS_FUNC(sethostname)): Treat the second argument as unsigned int.
Print the first argument as a pointer when the second argument exceeds
__NEW_UTS_LEN.
* tests/sethostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
(main): Use it. Check that the second argument of sethostname
is handled as unsigned int. Check that the first argument is printed
as a pointer when the second argument exceeds __NEW_UTS_LEN.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h.
* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
(f8ill_ptr_to_kulong): New static inline function.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
printstr: rename to printstrn, add printstr as a thin wrapper.
As about half of all printstr uses cases are invocations with the last
argument set to -1, create a dedicated function for this use case.
* defs.h (printstr): Rename to printstrn. All callers updated.
(printstr): New static inline function. All callers updated.
2016-12-25 Dmitry V. Levin <ldv@altlinux.org>
process: change ptrace arguments type from unsigned long to kernel_ureg_t
(SYS_FUNC(ptrace)): Change type of request and data arguments
from unsigned long to kernel_ureg_t.
process: change tracee address type from unsigned long to kernel_ureg_t.
* process.c (print_user_offset_addr): Change address argument type
from unsigned long to kernel_ureg_t.
(SYS_FUNC(ptrace)): Change addr variable type from unsigned long
to kernel_ureg_t.
net: change address argument type from long to kernel_ureg_t.
* net.c (decode_sockbuf, decode_pair_fd, print_linger, print_ucred,
print_tpacket_stats, print_icmp_filter, print_getsockopt, print_mreq,
print_mreq6, print_group_req, print_tpacket_req, print_packet_mreq,
print_setsockopt): Change address argument type from long
to kernel_ureg_t.
print_mq_attr: change address argument type from long to kernel_ureg_t.
* print_mq_attr.c (printmqattr): Change address argument type from long
to kernel_ureg_t.
ipc_*: change address argument type from long to kernel_ureg_t.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv, fetch_msgrcv_args): Change
address argument type from long to kernel_ureg_t.
* ipc_msgctl.c (print_msqid_ds): Likewise.
* ipc_sem.c (tprint_sembuf_array): Likewise.
* ipc_shmctl.c (print_shmid_ds): Likewise.
print_msgbuf: change address argument type from long to kernel_ureg_t.
* print_msgbuf.c (tprint_msgbuf): Change address argument type
from long to kernel_ureg_t.
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.
uid: change address argument type from long to kernel_ureg_t.
* uid.c (get_print_uid): Change address argument type
from long to kernel_ureg_t.
time: change address argument type from long to kernel_ureg_t.
* time.c (print_timezone, do_adjtimex): Change address argument type
from long to kernel_ureg_t.
sched: change address argument type from long to kernel_ureg_t.
* sched.c (print_sched_attr): Change address argument type
from long to kernel_ureg_t.
printsiginfo: change address argument type from long to kernel_ureg_t.
* printsiginfo.c (printsiginfo_at): Change address argument type
from long to kernel_ureg_t.
print_timex: change address argument type from long to kernel_ureg_t.
* print_timex.c (print_timex): Change address argument type
from long to kernel_ureg_t.
print_sigevent: change address argument type from long to kernel_ureg_t.
* print_sigevent.c (print_sigevent): Change address argument type
from long to kernel_ureg_t.
poll: change address argument type from long to kernel_ureg_t.
* poll.c (decode_poll_exiting): Change tracee address argument type
from long to kernel_ureg_t.
printrusage*: change tracee address argument type from long to kernel_ureg_t
* defs.h [ALPHA] (printrusage32): Change address argument type
from long to kernel_ureg_t.
* printrusage.c (printrusage): Likewise.
[ALPHA] (printrusage32): Likewise.
* wait.c (printwaitn): Change the type of tracee address argument
of print_rusage from long to kernel_ureg_t.
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.
rtc: change type of ioctl 3rd argument from long to kernel_ureg_t.
* rtc.c (decode_rtc_time, decode_rtc_wkalrm, decode_rtc_pll_info):
Change addr type from long to kernel_ureg_t.
(rtc_ioctl): Change arg type from long to kernel_ureg_t.
mtd: change type of ioctl 3rd argument from long to kernel_ureg_t.
* mtd.c (decode_erase_info_user, decode_erase_info_user64,
decode_mtd_oob_buf, decode_mtd_oob_buf64, decode_otp_info,
decode_otp_select, decode_mtd_write_req, decode_mtd_info_user,
decode_nand_oobinfo, decode_nand_ecclayout_user, decode_mtd_ecc_stats):
Change addr type from long to kernel_ureg_t.
(mtd_ioctl): Change arg type from long to kernel_ureg_t.
hdio: change type of ioctl 3rd argument from long to kernel_ureg_t.
* hdio.c (hdio_ioctl): Change arg type from long to kernel_ureg_t.
v4l2: change type of ioctl 3rd argument from long to kernel_ureg_t.
* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc, print_v4l2_format,
print_v4l2_requestbuffers, print_v4l2_buffer, print_v4l2_framebuffer,
print_v4l2_buf_type, print_v4l2_streamparm, print_v4l2_standard,
print_v4l2_input, print_v4l2_control, print_v4l2_queryctrl,
print_v4l2_cropcap, print_v4l2_crop, print_v4l2_ext_controls,
print_v4l2_frmsizeenum, print_v4l2_frmivalenum,
print_v4l2_create_buffers, v4l2_ioctl): Change arg type from long
to kernel_ureg_t.
evdev: change type of ioctl 3rd argument from long to kernel_ureg_t.
* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
from long to kernel_ureg_t.
btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t.
* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
to kernel_ureg_t.
block: change type of ioctl 3rd argument from long to kernel_ureg_t.
* block.c (block_ioctl): Change arg type from long to kernel_ureg_t.
Change type of ioctl 3rd argument from long to kernel_ureg_t.
* defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t.
* dm.c (dm_known_ioctl, dm_ioctl): Likewise.
* file_ioctl.c (file_ioctl): Likewise.
* fs_x_ioctl.c (fs_x_ioctl): Likewise.
* ioctl.c (ioctl_decode): Likewise.
* loop.c (decode_loop_info, decode_loop_info64): Change addr type
from long to kernel_ureg_t.
(loop_ioctl): Change arg type from long to kernel_ureg_t.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res, scsi_ioctl): Likewise.
* sock.c (print_ifreq, sock_ioctl): Likewise.
(decode_ifconf): Change addr type from long to kernel_ureg_t.
* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): Likewise.
(term_ioctl): Change arg type from long to kernel_ureg_t.
* ubi.c (ubi_ioctl): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.
ldt: change address argument type from long to kernel_ureg_t.
* defs.h [HAVE_STRUCT_USER_DESC] (print_user_desc): Change address
argument type from long to kernel_ureg_t.
* ldt.c [HAVE_STRUCT_USER_DESC] (print_user_desc): Likewise.
fcntl: change address argument type from long to kernel_ureg_t.
* fcntl.c (printflock64, printflock, print_f_owner_ex): Change
address argument type from long to kernel_ureg_t.
execve: change address argument type from long to kernel_ureg_t.
* execve.c (printargv, printargc): Change address argument type
from long to kernel_ureg_t.
dirent: change address argument type from long to kernel_ureg_t.
* dirent.c (print_old_dirent): Change address argument type from long
to kernel_ureg_t.
bpf: change address argument type from long to kernel_ureg_t.
* bpf.c (bpf_map_create, bpf_map_update_elem, bpf_map_delete_elem,
bpf_map_io, bpf_prog_load, SYS_FUNC(bpf)): Change address argument
type from long to kernel_ureg_t.
dump*: change address argument type from long to kernel_ureg_t.
* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
Change address argument type from long to kernel_ureg_t.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
Likewise.
* util.c (dumpiov_upto, dumpstr): Likewise.
print_sigset_addr_len: change address argument type from long to kernel_ureg_t
* defs.h (print_sigset_addr_len) Change address argument type from long
to kernel_ureg_t.
* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
decode_old_sigaction, decode_new_sigaction): Likewise.
decode_sockaddr: change address argument type from long to kernel_ureg_t
* defs.h (decode_sockaddr) Change tracee address argument type from long
to kernel_ureg_t.
* sockaddr.c (decode_sockaddr): Likewise.
print_struct_statfs*: change address argument type from long to kernel_ureg_t
* defs.h (print_struct_statfs, print_struct_statfs64): Change address
argument type from long to kernel_ureg_t.
* print_statfs.c (print_struct_statfs, print_struct_statfs64): Likewise.
* fetch_struct_statfs.c (fetch_struct_statfs, fetch_struct_statfs64):
Likewise.
fetch_struct_flock: change address argument type from long to kernel_ureg_t
* fetch_struct_flock.c (fetch_struct_flock, fetch_struct_flock64):
Change address argument type from long to kernel_ureg_t.
fetch_seccomp_fprog: change address argument type from long to kernel_ureg_t
* fetch_seccomp_fprog.c (fetch_seccomp_fprog): Change address argument
type from long to kernel_ureg_t.
printnum_*, printpair_*: change address argument type from long to kernel_ureg_t
* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR, printnum_long_int): Change
address argument type from long to kernel_ureg_t.
* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
printpath*: change address argument type from long to kernel_ureg_t.
* defs.h (printpath, printpathn): Change address argument type
from long to kernel_ureg_t.
* util.c (printpath, printpathn): Likewise.
printstr*: change address argument type from long to kernel_ureg_t.
* defs.h (printstr_ex, printstr_ex): Change address argument type
from long to kernel_ureg_t.
* util.c (printstr_ex): Likewise.
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.
futex: change address type from long to kernel_ureg_t.
* futex.c (SYS_FUNC(futex)): Change address type from long
to kernel_ureg_t.
file_handle: change address type from long to kernel_ureg_t.
* file_handle.c (SYS_FUNC(name_to_handle_at),
SYS_FUNC(open_by_handle_at)): Change address type from long
to kernel_ureg_t.
printsiginfo: cast pointers to kernel_ureg_t instead of unsigned long.
* printsiginfo.c (printsigval): Cast siginfo.si_ptr pointer
to kernel_ureg_t instead of unsigned long.
(print_si_info): Cast siginfo.si_addr and siginfo.si_call_addr pointers
to kernel_ureg_t instead of unsigned long.
sigaltstack: cast pointers and sizes to kernel_ureg_t instead of unsigned long
* sigaltstack.c (print_stack_t): Cast sigaltstack.ss_sp pointer
and sigaltstack.ss_size to kernel_ureg_t instead of unsigned long.
v4l2: cast pointers to kernel_ureg_t instead of long.
* v4l2.c (print_v4l2_ext_control): Cast v4l2_ext_control.string pointer
to kernel_ureg_t instead of long.
v4l2: cast pointers to kernel_ureg_t instead of unsigned long.
* v4l2.c (print_v4l2_buffer): Remove redundant cast.
(print_v4l2_framebuffer): Cast v4l2_framebuffer.base pointer
to kernel_ureg_t instead of unsigned long.
(print_v4l2_ext_controls): Cast v4l2_ext_controls.controls pointer
to kernel_ureg_t instead of unsigned long.
2016-12-24 Dmitry V. Levin <ldv@altlinux.org>
sysctl: cast pointers to kernel_ureg_t instead of size_t.
* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldval and
__sysctl_args.newval pointers to kernel_ureg_t instead of size_t.
sysctl: cast pointers to kernel_ureg_t instead of long.
* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldlenp pointer
to kernel_ureg_t instead of long.
block: cast pointers to kernel_ureg_t instead of long.
* block.c (print_blkpg_req): Cast blkpg_ioctl_arg.data pointer
to kernel_ureg_t instead of long.
dumpiov_upto: cast pointers to kernel_ureg_t instead of long.
* util.c (dumpiov_upto): Cast iovec.iov_base pointer to kernel_ureg_t
instead of long.
msghdr: cast pointers to kernel_ureg_t instead of long.
* msghdr.c (print_struct_msghdr): Cast msghdr.msg_name pointer
to kernel_ureg_t instead of long.
(dumpiov_in_msghdr): Cast msghdr.msg_iov pointer to kernel_ureg_t
instead of long.
mmsghdr: cast pointers to kernel_ureg_t instead of long.
* mmsghdr.c (dumpiov_in_mmsghdr): Cast msghdr.msg_iov pointer
to kernel_ureg_t instead of long.
Remove redundant casts of ptrace arguments.
* strace.c (maybe_switch_tcbs, trace): Do not cast ptrace 4th argument
from pointer to long type.
ptrace_restart: cleanup.
* strace.c (ptrace_restart): Replace the sequence of "if" statements
with a "switch" statement.
ptrace_restart: change types of integer arguments to unsigned.
* strace.c (ptrace_restart): Change types of "op" and "sig"
from int to unsigned int.
process: remove redundant syserror checks.
* process.c (SYS_FUNC(ptrace)): Remove syserror checks as both
print_siginfo_array and print_seccomp_fprog do the right thing
by using umoven_or_printaddr.
sparc64: remove redundant casts.
* linux/sparc64/get_syscall_args.c (get_syscall_args): Remove
redundant casts from uint32_t to long.
2016-12-23 Dmitry V. Levin <ldv@altlinux.org>
numa: change address argument type from unsigned long to kernel_ureg_t.
* numa.c (print_nodemask): Change address argument type from
unsigned long to kernel_ureg_t.
net: change address argument type from unsigned long to kernel_ureg_t.
* net.c (fetch_socklen): Change address argument type from
unsigned long to kernel_ureg_t.
mem: change tracee address type from unsigned long to kernel_ureg_t.
* mem.c (print_mmap, SYS_FUNC(remap_file_pages),
SYS_FUNC(subpage_prot)): Change the type of variables containing tracee
addresses from unsigned long to kernel_ureg_t.
kexec: change address argument type from unsigned long to kernel_ureg_t.
* kexec.c (print_kexec_segments): Change address argument type
from unsigned long to kernel_ureg_t.
poll: change counter type from unsigned long to unsigned int.
* poll.c (decode_poll_exiting): Change the type of printed and
max_printed counters from unsigned long to unsigned int.
xattr: change address argument type from unsigned long to kernel_ureg_t.
* xattr.c (print_xattr_val, print_xattr_list): Change address
argument type from unsigned long to kernel_ureg_t.
uid: change address argument type from unsigned long to kernel_ureg_t.
* uid.c (print_groups): Change address argument type
from unsigned long to kernel_ureg_t.
stat64: change address argument type from unsigned long to kernel_ureg_t
* stat64.c (decode_struct_stat64): Change address argument type
from unsigned long to kernel_ureg_t.
stat: change address argument type from unsigned long to kernel_ureg_t.
* stat.c (decode_struct_stat): Change address argument type
from unsigned long to kernel_ureg_t.
sigaltstack: change address argument type from unsigned long to kernel_ureg_t
* sigaltstack.c (print_stack_t): Change address argument type
from unsigned long to kernel_ureg_t.
resource: change address argument type from unsigned long to kernel_ureg_t
* resource.c (print_rlimit64, print_rlimit32, decode_rlimit): Change
address argument type from unsigned long to kernel_ureg_t.
printsiginfo: change address argument type from unsigned long to kernel_ureg_t
* printsiginfo.c (print_siginfo_array): Change address argument type
from unsigned long to kernel_ureg_t.
poll: change tracee address type from unsigned long to kernel_ureg_t.
* poll.c (decode_poll_entering, decode_poll_exiting): Change the type
all tracee address variables from unsigned long to kernel_ureg_t.
perf: change address argument type from unsigned long to kernel_ureg_t.
* perf.c (fetch_perf_event_attr, print_perf_event_attr): Change
address argument type from unsigned long to kernel_ureg_t.
pathtrace: change tracee address type from unsigned long to kernel_ureg_t
* pathtrace.c (upathmatch): Change address argument type
from unsigned long to kernel_ureg_t.
(pathtrace_match): Change the type of all tracee address variables
from unsigned long to kernel_ureg_t.
scsi: change address argument type from unsigned long to kernel_ureg_t.
* scsi.c (print_sg_io_buffer): Change address argument type
from unsigned long to kernel_ureg_t.
dm: change address argument type from unsigned long to kernel_ureg_t.
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string): Change address argument type
from unsigned long to kernel_ureg_t.
oldstat: change address argument type from unsigned long to kernel_ureg_t
* oldstat.c (print_old_kernel_stat): Change address argument type
from unsigned long to kernel_ureg_t.
capability: change address argument type from unsigned long to kernel_ureg_t
* capability.c (get_cap_header, print_cap_header, print_cap_data):
Change address argument type from unsigned long to kernel_ureg_t.
btrfs: change address argument type from unsigned long to kernel_ureg_t.
* btrfs.c (btrfs_print_qgroup_inherit): Change address argument type
from unsigned long to kernel_ureg_t.
affinity: change address argument type from unsigned long to kernel_ureg_t
* affinity.c (print_affinitylist): Change address argument type from
unsigned long to kernel_ureg_t.
aio: change address type from unsigned long to kernel_ureg_t.
* aio.c (print_iocb): Remove casts to unsigned long.
(print_iocbp, SYS_FUNC(io_submit)): Change address type
from unsigned long to kernel_ureg_t.
mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* mmsghdr.c (save_mmsgvec_namelen, decode_mmsgvec): Change
address argument type from unsigned long to kernel_ureg_t.
msghdr: change address argument type from unsigned long to kernel_ureg_t
* msghdr.c (decode_msg_control): Change address argument type
from unsigned long to kernel_ureg_t.
fetch_struct_stat64: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_stat64.c (fetch_struct_stat64): Change address argument
type from unsigned long to kernel_ureg_t.
fetch_struct_stat: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_stat.c (fetch_struct_stat): Change address argument
type from unsigned long to kernel_ureg_t.
fetch_struct_msghdr: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_msghdr.c (fetch_struct_msghdr): Change
address argument type from unsigned long to kernel_ureg_t.
fetch_struct_mmsghdr: change address argument type from unsigned long to kernel_ureg_t
* fetch_struct_mmsghdr.c (fetch_struct_mmsghdr): Change
address argument type from unsigned long to kernel_ureg_t.
decode_netlink: change address argument type from unsigned long to kernel_ureg_t
* defs.h (decode_netlink) Change address argument type
from unsigned long to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr, decode_nlmsghdr_with_payload,
decode_netlink): Likewise.
print_seccomp_*: change address argument type from unsigned long to kernel_ureg_t
* defs.h (print_seccomp_filter, print_seccomp_fprog): Change
address argument type from unsigned long to kernel_ureg_t.
* seccomp.c (print_seccomp_filter, print_seccomp_fprog,
decode_seccomp_set_mode_strict): Likewise.
tprint_iov*: change address argument type from unsigned long to kernel_ureg_t
* defs.h (tprint_iov, tprint_iov_upto): Change address argument type
from unsigned long to kernel_ureg_t.
* io.c (tprint_iov, tprint_iov_upto): Likewise.
print_array: change tracee address type from unsigned long to kernel_ureg_t
* defs.h (print_array): Change start_addr type from unsigned long
to kernel_ureg_t.
* util.c (print_array): Likewise. Change the type of all tracee
address variables from unsigned long to kernel_ureg_t.
2016-12-23 Dmitry V. Levin <ldv@altlinux.org>
Rename LONG_LONG to ULONG_LONG and change it to return unsigned long long
In all places where LONG_LONG is used the destination already has type
unsigned long long, so it is quite natural to change LONG_LONG as well.
* defs.h (LONG_LONG): Rename to ULONG_LONG, change return type
from long long to unsigned long long. All callers updated.
2016-12-23 Dmitry V. Levin <ldv@altlinux.org>
mem: remove redundant casts.
* mem.c (SYS_FUNC(old_mmap)): Remove redundant cast
from kernel_ureg_t to unsigned long.
[S390] (SYS_FUNC(old_mmap_pgoff)): Remove redundant cast
from unsigned int to unsigned long.
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-22 Dmitry V. Levin <ldv@altlinux.org>
print_sigevent: remove redundant cast.
* print_sigevent.c (print_sigevent): Remove redundant cast from
struct_sigevent.sigev_value.sival_ptr to unsigned long as the former
is not a pointer but an unsigned integer.
tests: fix xattr.test for the case when listxattr returns a long list.
* tests/xattr.c (DEFAULT_STRLEN): New macro.
(main): Use it to limit the length passed to print_quoted_memory.
Print ellipsis when the list returned by listxattr is too long.
2016-12-22 Gabriel Laskar <gabriel@lse.epita.fr>
tests: test for correct ellipsis with -s in xattr.
* tests/xattr-strings.c: New file.
* tests/xattr-strings.test: New test.
* tests/.gitignore: Add xattr-string.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add xattr-string.test.
2016-12-22 Gabriel Laskar <gabriel@lse.epita.fr>
xattr: use printstr_ex instead of print_quoted_string.
This fixes the display when using `-s` to limit the string size
of the values displayed by {get,set}xattr.
* xattr.c (print_xattr_val): Remove static buffer. Use printstr_ex
instead of print_quoted_string.
Reported-by: Марк Коренберг <socketpair@gmail.com>
2016-12-22 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: use scno.h in finit_module, kcmp, renameat2 tests.
* tests/finit_module.c: Include "scno.h".
* tests/kcmp.c: Likewise.
* tests/renameat2.c: Likewise.
2016-12-21 Dmitry V. Levin <ldv@altlinux.org>
sock: cast pointers to kernel_ureg_t instead of unsigned long.
* sock.c (decode_ifconf): Cast ifconf.ifc_buf pointer to kernel_ureg_t
instead of unsigned long.
scsi: cast pointers to kernel_ureg_t instead of unsigned long.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Cast sg_io_hdr.cmdp,
sg_io_hdr.dxferp, and sg_io_hdr.sbp pointers to kernel_ureg_t instead
of unsigned long.
mtd: cast pointers to kernel_ureg_t instead of unsigned long.
* mtd.c (decode_mtd_oob_buf): Cast mtd_oob_buf.ptr pointer
to kernel_ureg_t instead of unsigned long.
msghdr: cast pointers to kernel_ureg_t instead of unsigned long.
* msghdr.c (print_struct_msghdr): Cast msghdr.msg_iov and
msghdr.msg_control pointers to kernel_ureg_t instead of unsigned long.
evdev: cast tcp->u_rval to kernel_ureg_t instead of unsigned long.
* evdev.c (decode_bitset): Cast tcp->u_rval to kernel_ureg_t
instead of unsigned long.
evdev: cast pointers to kernel_ureg_t instead of unsigned long.
* evdev.c (ff_effect_ioctl): Cast ff_periodic_effect.custom_data
pointer to kernel_ureg_t instead of unsigned long.
btrfs: cast pointers to kernel_ureg_t instead of unsigned long.
* btrfs.c (btrfs_ioctl): Cast btrfs_ioctl_send_args.clone_sources
and btrfs_ioctl_vol_args_v2.qgroup_inherit pointers to kernel_ureg_t
instead of unsigned long.
Rework ifdefery around print_user_desc.
* configure.ac (AC_CHECK_TYPES): Check for struct user_desc
in <asm/ldt.h>.
* clone.c (print_tls_arg): New function.
(SYS_FUNC(clone)): Use it.
(print_user_desc): Move prototype ...
* defs.h [HAVE_STRUCT_USER_DESC]: ... here.
* ldt.c: Check for HAVE_STRUCT_USER_DESC instead of architectures.
* linux/dummy.h: Likewise.
Introduce DECL_IOCTL macro to declare *_ioctl functions.
* defs.h (DECL_IOCTL): New macro.
(dm_ioctl, file_ioctl, fs_x_ioctl, loop_ioctl, ptp_ioctl, scsi_ioctl,
sock_ioctl, term_ioctl, ubi_ioctl, uffdio_ioctl): Rewrite prototypes
using DECL_IOCTL.
Introduce DECL_PRINT* macros to declare printnum_* and printpair_*
* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR): New macros.
(printnum_short, printnum_int, printnum_int64): Rewrite prototypes
using DECL_PRINTNUM.
(printpair_int, printpair_int64): Rewrite prototypes
using DECL_PRINTPAIR.
ioctl: use uintptr_t for casts between 32-bit integers and pointers.
* ioctl.c (compare): Cast pointer to uintptr_t before assigning
it to an integer.
(ioctl_lookup): Cast integer to uintptr_t before passing it
as a pointer.
scsi: use umove_or_printaddr.
* scsi.c (scsi_ioctl): Use umove_or_printaddr.
Remove dumpiov wrapper.
* defs.h (dumpiov): Remove.
* syscall.c (dumpio): Use dumpiov_upto instead of dumpiov.
travis: fix enabling of gcc -Werror builds.
* travis-build.sh: Use DISTCHECK_CONFIGURE_FLAGS instead
of CHECK_CONFIGURE_FLAGS and ENABLE_GCC_WERROR.
[$CC == gcc]: Add --enable-gcc-Werror to DISTCHECK_CONFIGURE_FLAGS
instead of ENABLE_GCC_WERROR.
[$CHECK == coverage]: Add --enable-code-coverage
to DISTCHECK_CONFIGURE_FLAGS instead of CHECK_CONFIGURE_FLAGS.
printaddr: change argument type to kernel_ureg_t.
* defs.h (printaddr): Change argument type from unsigned long
to kernel_ureg_t.
tests: check decoding of unreadable ip_mreq and ipv6_mreq structures.
* tests/ip_mreq.c (main): Check short read.
tests: rewrite ip_mreq.c using arrays and iterators.
* tests/ip_mreq.c (main): Create arrays of setsockopt arguments to test.
Iterate over these arrays invoking setsockopt and printing expected
output.
tests: rewrite ip_mreq.c using tail_alloc.
* tests/ip_mreq.c (main): Allocate objects of struct ip_mreq
and struct ipv6_mreq using tail_alloc instead of using stack.
tests: rewrite ip_mreq.c without asserts.
* tests/ip_mreq.c: Do not include <assert.h>.
(main): Do not use assert. Use sprintrc instead of errno2name.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
Remove NEED_PTRACE_PROTOTYPE_WORKAROUND.
Remove the workaround for broken ptrace prototypes
that seems to be unneeded for quite a long time.
* defs.h [NEED_PTRACE_PROTOTYPE_WORKAROUND]: Remove.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
tests: use scno.h in tests of relatively new syscalls.
* tests/add_key.c: Include "scno.h" after <asm/unistd.h>.
* tests/copy_file_range.c: Likewise.
* tests/execveat.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/membarrier.c: Likewise.
* tests/memfd_create.c: Likewise.
* tests/mlock2.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/userfaultfd.c: Likewise.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
tests: generate scno.h from syscallent.h for use by other tests.
Provide scno.h with fallback definitions of all __NR_* constants known
to strace for the personbality being tested.
Some tests need just __NR_* constants without any kernel support.
Such tests can include "scno.h" after <asm/unistd.h> to get definitions
of these constants when system headers are too old.
* tests/generate_scno.c: New file.
* tests/.gitignore: Add generate_scno.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(scno.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add scno.h.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
tests: fix potential errno clobbering in membarrier test.
* tests/membarrier.c (main): Save errno.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
Do not use widen_to_ulong in kexec.c and process_vm.c.
Automatic argument truncation makes use of this function redundant.
* kexec.c (SYS_FUNC(kexec_load)): Do not invoke widen_to_ulong.
* process_vm.c (SYS_FUNC(process_vm_readv),
SYS_FUNC(process_vm_writev)): Likewise.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
x32: implement automatic argument truncation for compat syscalls.
x32 syscalls starting with number 512 are compat syscalls that operate
on compat types. Set COMPAT_SYSCALL_TYPES flag to these syscall entries
and make get_syscall_args truncate arguments of syscalls that have this
flag set, to avoid unpleasant alternative of adding multiple
widen_to_ulong invocations to individual syscall parsers.
preadv, pwritev, preadv2, and pwritev2 are exceptions: while these
syscalls operate on compat types, the offset argument has a regular
64-bit type, so the automatic argument truncation cannot be applied.
* defs.h (COMPAT_SYSCALL_TYPES): New macro.
* syscall.c (CST): New macro, defined to COMPAT_SYSCALL_TYPES.
* linux/ia64/syscallent.h: Do not include "../i386/syscallent.h"
unless [CST > 0].
* linux/x32/syscallent.h [512..533, 536..545]: Add CST flag.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Truncate arguments
of compat syscalls to 32-bit values.
* tests/ksysent.c (CST): New macro, defined to 0.
* tests/nsyscalls.c (CST): Likewise.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
x32: fix decoding of mprotect and pkey_mprotect syscall arguments.
As there are no compat versions of mprotect or pkey_mprotect syscalls
in x32 personality, "addr", "len", and "prot" syscall arguments have
kernel_ulong_t type and should be printed accordingly.
* mem.c (do_mprotect): Retrieve 1st, 2nd and 3rd arguments using
getarg_klu, print them using printaddr_klu, PRI_klu format,
and printflags64, correspondingly.
2016-12-20 Dmitry V. Levin <ldv@altlinux.org>
Make tprint_iov function a static inline wrapper.
* io.c (tprint_iov): Move ...
* defs.h: ... here, add static inline keywords.
2016-12-20 Eugene Syromyatnikov <evgsyr@gmail.com>
x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls.
In x32 personality these syscalls use compat type for the 3rd argument,
therefore it has to be truncated there.
* io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using
widen_to_ulong.
2016-12-19 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: fix preadv2-pwritev2 test on x32.
On x32 p(read|write)v(|2) syscalls are implemented via compat, which
truncates len argument to unsigned int.
* tests/preadv2-pwritev2.c (main): Print vlen argument as unsigned long.
2016-12-19 Eugene Syromyatnikov <evgsyr@gmail.com>
kexec: fix for the x32 ABI.
There is no compat (and no 32-bit version, ever) for x32 ABI, so
kernel's long type should be used for arguments' values.
The only remaining thing is a pointer to cmdline string, but it is
currently broken on x32 anyway.
* kexec.c (SYS_FUNC(kexec_file_load)): Print the cmdline_len argument
as kernel long, retrieve it via getarg_klu; use printflags64 for
printing the flags argument, retrieve it via getarg_klu.
2016-12-19 Dmitry V. Levin <ldv@altlinux.org>
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 Dmitry V. Levin <ldv@altlinux.org>
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.
fcntl.c: print 64-bit fields of struct_kernel_flock64 using PRId64 format
* fcntl.c (print_struct_flock64): Print l_start and l_len fields
of struct_kernel_flock64 using PRId64 format.
v4l2.c: print v4l2_ext_control.value64 using PRId64 format.
* v4l2.c (print_v4l2_ext_control): Print value64 field
of struct_v4l2_ext_control using PRId64 format.
perf.c: print perf_event_attr.__reserved_1 using PRIx64 format.
* perf.c (print_perf_event_attr): Print __reserved_1 field
of perf_event_attr using PRIx64 format.
btrfs.c: print 64-bit fields of btrfs_ioctl_vol_args_v2 using PRIu64 format
* block.c (btrfs_ioctl): Print size and transid fields
of struct_btrfs_ioctl_vol_args_v2 using PRIu64 format.
block.c: change type of long long fileds to int64_t.
* block.c (struct_blkpg_partition): Change type of start and length
fields from long long to int64_t.
(print_blkpg_req): Print them using PRId64 format.
2016-12-19 Eugene Syromyatnikov <evgsyr@gmail.com>
Introduce current_klongsize in addition to current_wordsize.
Subsequent commits are going to use current_klongsize
as the tracee's size of kernel_ulong_t type.
* defs.h (PERSONALITY0_KLONGSIZE): New macro.
[X86_64] (PERSONALITY2_KLONGSIZE): Likewise.
[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_KLONGSIZE): Likewise.
[SUPPORTED_PERSONALITIES == 1] (current_klongsize): Likewise.
[SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE ==
PERSONALITY1_KLONGSIZE] (current_klongsize): Likewise.
[SUPPORTED_PERSONALITIES != 1 && (SUPPORTED_PERSONALITIES != 2 ||
PERSONALITY0_KLONGSIZE != PERSONALITY1_KLONGSIZE)] (current_klongsize):
New variable prototype.
* syscall.c [!current_klongsize] (current_klongsize): New variable.
[!current_klongsize] (personality_klongsize): New array.
(set_personality) [!current_klongsize]: Update current_klongsize
with the appropriate value from personality_klongsize.
2016-12-19 Dmitry V. Levin <ldv@altlinux.org>
configure: define SIZEOF_KERNEL_LONG_T macro.
Provide SIZEOF_KERNEL_LONG_T macro in addition to SIZEOF_LONG and
SIZEOF_LONG_LONG for checking of kernel_long_t and kernel_ulong_t
types at the time of preprocessing.
* configure.ac (AC_CHECK_SIZEOF): Add kernel_long_t.
2016-12-19 Dmitry V. Levin <ldv@altlinux.org>
Remove getarg_ll.
This function has never been used in the code, and in perspective
the whole ext_arg thing will go away.
* defs.h (getarg_ll): Remove prototype.
* util.c (getarg_ll): Remove.
2016-12-19 Dmitry V. Levin <ldv@altlinux.org>
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 Dmitry V. Levin <ldv@altlinux.org>
s390: fix decoding of mmap2 syscall when arguments are not available.
* mem.c [S390] (SYS_FUNC(old_mmap_pgoff)): Use umove_or_printaddr
instead of umoven to fetch mmap arguments, fix return value when this
fetch fails.
Fix pathmatch of oldselect syscall on 64-bit architectures.
* pathtrace.c (pathtrace_match): Fix fetching of 32-bit oldselect
arguments on 64-bit architectures.
Cleanup oldselect.
* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.
2016-12-18 Dmitry V. Levin <ldv@altlinux.org>
Change scno type from long to unsigned long.
Use an unsigned type for syscall numbers as they are not intended
for signed arithmetics. Introduce kernel_scno_t as a typedef
to unsigned long, that could be changed later to kernel_ulong_t.
* kernel_types.h (kernel_scno_t): New type, typedef to unsigned long.
* defs.h (struct tcb): Change type of scno field from long
to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
(scno_in_range, scno_is_valid): Change argument type from unsigned long
to kernel_scno_t.
* linux/aarch64/set_scno.c (arch_set_scno): Change scno argument type
from long to kernel_scno_t.
* linux/alpha/set_scno.c (arch_set_scno): Likewise.
* linux/arc/set_scno.c (arch_set_scno): Likewise.
* linux/arm/set_scno.c (arch_set_scno): Likewise.
* linux/avr32/set_scno.c (arch_set_scno): Likewise.
* linux/bfin/set_scno.c (arch_set_scno): Likewise.
* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
* linux/hppa/set_scno.c (arch_set_scno): Likewise.
* linux/i386/set_scno.c (arch_set_scno): Likewise.
* linux/ia64/set_scno.c (arch_set_scno): Likewise.
* linux/m68k/set_scno.c (arch_set_scno): Likewise.
* linux/metag/set_scno.c (arch_set_scno): Likewise.
* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
* linux/mips/set_scno.c (arch_set_scno): Likewise.
* linux/nios2/set_scno.c (arch_set_scno): Likewise.
* linux/or1k/set_scno.c (arch_set_scno): Likewise.
* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
* linux/riscv/set_scno.c (arch_set_scno): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/sh/set_scno.c (arch_set_scno): Likewise.
* linux/sh64/set_scno.c (arch_set_scno): Likewise.
* linux/sparc/set_scno.c (arch_set_scno): Likewise.
* linux/tile/set_scno.c (arch_set_scno): Likewise.
* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
* linux/aarch64/get_scno.c (arch_get_scno): Change scno variable type
from long to kernel_scno_t.
* linux/alpha/get_scno.c (arch_get_scno): Likewise.
* linux/arm/get_scno.c (arch_get_scno): Likewise.
* linux/sh/get_scno.c (arch_get_scno): Likewise.
* linux/x86_64/get_scno.c (arch_get_scno): Likewise.
* syscall.c (arch_set_scno): Likewise.
(shuffle_scno): Change return type from long to kernel_scno_t.
(syscall_name): Change argument type from long to kernel_scno_t.
2016-12-18 Dmitry V. Levin <ldv@altlinux.org>
Lowercase SCNO_IN_RANGE and SCNO_IS_VALID.
* defs.h (SCNO_IN_RANGE): Rename to scno_in_range. All callers updated.
(SCNO_IS_VALID): Rename to scno_is_valid. All callers updated.
Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions.
* defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline
functions.
count.c: use syserror instead of direct u_error access.
* count.c (count_syscall): Use syserror instead of u_error.
Replace "(unsigned long) -1L" with -1UL.
* defs.h (dumpiov): Replace "(unsigned long) -1L" with -1UL.
* io.c (print_iovec, tprint_iov): Likewise.
* msghdr.c (SYS_FUNC(sendmsg)): Likewise.
* syscall.c (dumpio): Likewise.
* poll.c (decode_poll_exiting): Replace "(unsigned int) -1" with -1U.
Add toplevel recursive check-valgrind rule.
* Makefile.am (.PHONY): Add check-valgrind-local.
(check-valgrind): New rule.
* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Add it.
m4: fix check-valgrind-* rules generated by AX_VALGRIND_CHECK.
* m4/ax_valgrind_check.m4 (check-valgrind-$(1)): Depend
on $(BUILT_SOURCES), honor $(AM_MAKEFLAGS), build check-am
instead of check-TESTS.
travis: do coverage using a dedicated build.
* .travis.yml (after_success): Remove.
(matrix): Create an entry for the regular x86_64 target.
* travis-success.sh: Merge into ...
* travis-build.sh: ... this file. Disable optimization
for coverage builds.
* travis-install.sh: Rename COVERAGE=true to CHECK=coverage.
2016-12-17 Dmitry V. Levin <ldv@altlinux.org>
mips n32: provide fallback definitions of kernel_long_t/kernel_ulong_t.
* kernel_types.h [!(HAVE___KERNEL_LONG_T && HAVE___KERNEL_ULONG_T) &&
LINUX_MIPSN32] (kernel_long_t, kernel_ulong_t): Define to long long types.
2016-12-17 Eugene Syromyatnikov <evgsyr@gmail.com>
util: simplify definitions of bit mask constants in umovestr.
* util.c (umovestr): Do not check for SIZEOF_LONG in definitions
of bit mask constants.
tests: check decoding of prctl operations without arguments.
* tests/prctl-no-args.c: New file.
* tests/prctl-no-args.test: New test.
* tests/.gitignore: Add prctl-no-args.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-no-args.test.
tests: check decoding of prctl PR_[GS]ET_SECUREBITS operations.
* tests/prctl-securebits.c: New file.
* tests/prctl-securebits.test: New test.
* tests/.gitignore: Add prctl-securebits.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-securebits.test.
tests: check decoding of prctl PR_[GS]ET_DUMPABLE operations.
* tests/prctl-dumpable.c: New file.
* tests/prctl-dumpable.test: New test.
* tests/.gitignore: Add prctl-dumpable.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-dumpable.test.
prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE
* xlat/pr_dumpable.in: New file.
* prctl.c: Include "xlat/pr_dumpable.h".
(SYS_FUNC(prctl)): Decode returned value of PR_GET_DUMPABLE operation
and the second syscall argument of PR_SET_DUMPABLE operation
as SUID_DUMP_* constants.
2016-12-16 Dmitry V. Levin <ldv@altlinux.org>
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-15 Dmitry V. Levin <ldv@altlinux.org>
Post-release administrivia.
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.15-1.
* strace.spec.in: Likewise.
2016-12-14 Dmitry V. Levin <ldv@altlinux.org>
xlat: provide fallback definitions for NETLINK_* constants.
As new constants have been added gradually over kernel releases, define
all constant values to make newer constants decoded properly when strace
is built with older kernel headers.
* xlat/netlink_protocols.in: Add default values for constants.
* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]: Remove.
* socketutils.c: Likewise.
2016-12-14 Dmitry V. Levin <ldv@altlinux.org>
tests: relax getaffinity return value check in tests/sched_xetaffinity.c
* tests/sched_xetaffinity.c (errstr): New variable.
(getaffinity, setaffinity): Initialize it.
(main): Use it. Allow getaffinity return value to be less than
its cpusetsize argument.
tests: fix threads-execve.test for large pids.
* tests/threads-execve.c (main): Fix expected output for large pids.
2016-12-13 Dmitry V. Levin <ldv@altlinux.org>
Prepare for 4.15 release.
* NEWS: Update for 4.15 release.
.mailmap: add addresses of Thomas De Schampheleire.
* .mailmap: Add both addresses of Thomas De Schampheleire here to avoid
duplications in CREDITS file.
Sync strace.spec and debian/ with packages.
* debian/control: Add Vcs-* metadata from 4.13-0.1.
* debian/watch: Sync with 4.13-0.1.
* strace.spec.in: Sync with 4.14.0.100.622a-1.
2016-12-13 Dmitry V. Levin <ldv@altlinux.org>
tests: workaround a bug in GNU grep.
Workaround a bug introduced in GNU grep 2.27, for details see
https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html
* tests/init.sh (grep_pid_status): New function.
* tests/detach-running.test: Use it instead of grep to search
in /proc/$pid/status.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
2016-12-13 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: fix typo in comment inside prctl-tsc.c.
2016-12-13 Sean Stangl <sstangl@mozilla.com>
Dmitry V. Levin <ldv@altlinux.org>
Fix libunwind segfault when -p is passed before -k.
* strace.c (init) [USE_LIBUNWIND]: Call unwind_tcb_init after
unwind_init for all allocated tcb structures if stack trace is enabled.
* unwind.c (unwind_tcb_init): Skip if tcb is already initialized.
2016-12-13 Eugene Syromyatnikov <evgsyr@gmail.com>
Dmitry V. Levin <ldv@altlinux.org>
Update NEWS.
2016-12-07 Dmitry V. Levin <ldv@altlinux.org>
tests: skip fault injection tests on unsupported platforms.
* tests/fault_injection.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/fault_injection-exit_group.test: Use it.
* tests/fault_injection.test: Likewise.
tests: introduce require_min_kernel_version_or_skip function.
* tests/init.sh (kernel_version_code,
require_min_kernel_version_or_skip): New functions.
* tests/threads-execve.test: Use require_min_kernel_version_or_skip.
2016-12-07 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: add descriptions to prctl-pdeathsig and prctl-tsc tests.
2016-12-07 Dmitry V. Levin <ldv@altlinux.org>
tests: robustify prctl-pdeathsig.test and prctl-tsc.test.
Rrobustify remaining prctl tests against unrelated prctl invocations
* tests/prctl-pdeathsig.test: Filter out unrelated PR_GET_* and PR_SET_*
prctl calls.
* tests/prctl-tsc.test: Likewise.
2016-12-07 Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Makefile.am: don't confuse CFLAGS and CFLAGS_FOR_BUILD.
Commit dc427d50d96b15c9a64d7e78d97ce4d194622a63 enabled a number of extra
warning flags through configure.ac. The configure script will determine
dynamically if CC supports these flags before adding them to WARN_CFLAGS.
ioctlsort is compiled with CC_FOR_BUILD, rather than CC. Nevertheless,
the flags passed to this compilation also include WARN_CFLAGS (through
AM_CFLAGS). This is incorrect: in a cross-compilation use case, CC
and CC_FOR_BUILD are not the same. The former is the cross-compiler,
the latter is the host compiler. Both may be of different versions
and support different warning flags.
In particular, this posed a problem when cross-compiling with a host
compiler gcc 4.1, which does not support all the new flags:
/usr/bin/gcc -DHAVE_CONFIG_H -I./linux/arm -I./linux/arm -I./linux
-I./linux -I. -I. -I/host-sysroot/usr/include -Wall -Wempty-body
-Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op
-Wmissing-parameter-type -Wnested-externs -Wold-style-declaration
-Wold-style-definition -Wsign-compare -Wtype-limits -Wwrite-strings -O2
-I/host-sysroot/usr/include -DIOCTLSORT_INC=\"ioctls_all0.h\" -c -o
ioctlsort0.o ./ioctlsort.c
cc1: error: unrecognized command line option "-Wempty-body"
cc1: error: unrecognized command line option "-Wignored-qualifiers"
cc1: error: unrecognized command line option "-Wlogical-op"
cc1: error: unrecognized command line option "-Wmissing-parameter-type"
cc1: error: unrecognized command line option "-Wold-style-declaration"
cc1: error: unrecognized command line option "-Wtype-limits"
make[2]: *** [ioctlsort0.o] Error 1
* Makefile.am (AM_CFLAGS_FOR_BUILD, AM_CPPFLAGS_FOR_BUILD): New
variables.
(ioctlsort_CPPFLAGS): Use AM_CPPFLAGS_FOR_BUILD instead of AM_CPPFLAGS.
(ioctlsort_CFLAGS): Use AM_CFLAGS_FOR_BUILD instead of AM_CFLAGS.
(ioctlsort_LDFLAGS): Use AM_LDFLAGS_FOR_BUILD instead of AM_LDFLAGS.
* m4/ax_prog_cc_for_build.m4 (AX_PROG_CC_FOR_BUILD): Redirect
WARN_CFLAGS and gl_unknown_warnings_are_errors, call st_WARN_CFLAGS,
substitute WARN_CFLAGS_FOR_BUILD.
2016-12-07 Dmitry V. Levin <ldv@altlinux.org>
m4: prepare gl_WARN_ADD for simultaneous use of multiple compilers.
* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Change gl_Flags to use
_AC_LANG_PREFIX[]FLAGS in unquoted form. Change gl_Warn to use gl_Flags
instead of _AC_LANG_ABBREV. Change notification message to mention
the variable name of the compiler.
(gl_UNKNOWN_WARNINGS_ARE_ERRORS): Do nothing if
gl_unknown_warnings_are_errors is set.
(gl_WARN_ADD): Change the use of gl_UNKNOWN_WARNINGS_ARE_ERRORS from
AC_REQUIRE to a regular call.
2016-12-07 Dmitry V. Levin <ldv@altlinux.org>
AX_PROG_CC_FOR_BUILD: redirect more variables related to C compiler.
Some of these variables cannot be redirected using traditional
pushdef/popdef mechanism because of complex constructions like
[ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu] employed by autoconf macros.
Use st_SAVE_VAR/st_RESTORE_VAR to workaround this issue.
* m4/ax_prog_cc_for_build.m4: Redirect ac_cv_prog_cc_stdc,
ac_cv_prog_cc_c11, ac_cv_prog_cc_c99, ac_cv_prog_cc_c89,
am_cv_prog_cc_c_o, and am_cv_CC_dependencies_compiler_type using
pushdef/popdef.
Redirect ac_c_decl_warn_flag, ac_c_preproc_warn_flag, ac_c_werror_flag,
ac_compile, ac_compiler_gnu, ac_cpp, ac_cv_c_compiler_gnu,
ac_cv_c_decl_report, and ac_link using st_SAVE_VAR/st_RESTORE_VAR.
2016-12-07 Dmitry V. Levin <ldv@altlinux.org>
Move all gl_WARN_ADD calls to a separate m4 macro.
This is going to be needed for the upcoming AX_PROG_CC_FOR_BUILD
change.
* configure.ac: Call st_WARN_CFLAGS before AX_PROG_CC_FOR_BUILD.
Move all gl_WARN_ADD calls ...
* m4/st_warn_cflags.m4: ... here.
2016-12-07 Dmitry V. Levin <ldv@altlinux.org>
m4: introduce st_SAVE_VAR and st_RESTORE_VAR macros.
These new macros are going to be needed for the upcoming
AX_PROG_CC_FOR_BUILD change.
* m4/st_save_restore_var.m4: New file.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: add valgrind support to "make check"
* m4/ax_valgrind_check.m4: Import from the autoconf-archive package.
* configure.ac: Invoke AX_VALGRIND_CHECK.
* valgrind.supp: Move to tests/strace.supp.
* Makefile.am (EXTRA_DIST): Remove valgrind.supp.
* tests/Makefile.am: Add @VALGRIND_CHECK_RULES@.
(VALGRIND_FLAGS, VALGRIND_SUPPRESSIONS_FILES): New variables.
(EXTRA_DIST): Add strace.supp.
* tests/init.sh: Add valgrind command prefix to $STRACE when appropriate.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: robustify threads-execve.test against race conditions.
Due to probabilistic nature of the test, try it several times.
* tests/threads-execve.c (NUMBER_OF_ITERATIONS): Change to 1.
* tests/threads-execve.test: Iterate up to 10 times.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: fix expected output in strace-ttt.test.
If strace -ttt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.
* tests/strace-ttt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: fix expected output in strace-tt.test.
If strace -tt is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.
* tests/strace-tt.test: Allow any time stamp between start and finish
of strace invocation.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: robustify redirect.test against race conditions.
Introduce a synchronization mechanism between the tracee and its peer.
* tests/redirect.test: Change timeout file to $OUT. Let the tracee
remove $LOG, wait for $LOG removal in its peer.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: robustify attach-f-p.test against race conditions.
Introduce a synchronization mechanism between attach-f-p and strace.
* tests/attach-f-p-cmd.c: New file.
* tests/Makefile.am (check_PROGRAMS): Add attach-f-p-cmd.
* tests/attach-f-p.c: Include <sys/stat.h>.
(main): Write to stdout instead of descriptor 3. Wait for the peer
writing to stdout.
* tests/attach-f-p.test: Assume that ./attach-f-p-cmd works.
Use $OUT for expected output. Use attach-f-p-cmd for unlocking $OUT.
2016-12-06 Dmitry V. Levin <ldv@altlinux.org>
tests: robustify attach-p-cmd.test against race conditions.
Introduce a synchronization mechanism between attach-p-cmd-p
and attach-p-cmd-cmd processes.
* tests/attach-p-cmd-cmd.c: Include <errno.h> and <sys/stat.h>.
(main): Wait for the lock directory creation by attach-p-cmd-p.
* tests/attach-p-cmd-p.c: Include <errno.h> and <sys/stat.h>.
(main): Create a lock directory and wait for its removal
by attach-p-cmd-cmd.
* tests/attach-p-cmd.test: Assume that test programs work.
2016-12-05 Dmitry V. Levin <ldv@altlinux.org>
Rewrite remaining qual_* parsers using bit sets.
* defs.h (struct fault_opts): Replace forward declaration
with a definition.
(qualbits_t, qualify_read, qualify_write, qualify_signals): Remove.
(qual_flags): New function prototype.
(nsyscall_vec, sysent_vec, fault_vec): New variable prototypes.
* qualify.c (abbrev_set, fault_set, raw_set, trace_set, verbose_set):
New variables.
(qualify_read, qualify_write, qualify_signals): Add static qualifier.
(find_errno_by_name, lookup_class, parse_fault_expression,
parse_fault_token, qual_flags, qualify, qualify_abbrev, qualify_fault,
qualify_raw, qualify_syscall, qualify_syscall_class,
qualify_syscall_name, qualify_syscall_number, qualify_syscall_tokens,
qualify_trace, qualify_verbose, strip_prefix): New functions.
* syscall.c (nsyscall_vec, nsysent_vec): Remove static qualifier.
(MAX_NSYSCALLS1, MAX_NSYSCALLS2, MAX_NSYSCALLS, qual_vec, qual_flags,
qual_fault, qual_syscall, qual_options, fault_opts, qualify_one,
qualify_scno, lookup_class, qualify_syscall_class, qualify_syscall_name,
qual_syscall_ex, qual_syscall, strip_prefix, find_errno_by_name,
parse_fault_token, parse_fault_expression, qual_fault, qualify): Remove.
(decode_socket_subcall, decode_ipc_subcall, decode_mips_subcall,
get_scno): Update use of qual_flags.
(inject_syscall_fault_entering): Update per-personality allocation
of tcp->fault_vec.
* tests/fault_injection-exit_group.test: Check parsing of inversed
fault sets.
* tests/fault_injection.test: Check parsing of -efault=none.
* tests/options-syntax.test: Check parsing of invalid syscall numbers.
Change qual_vec/qual_fault into static fixed size arrays.
* defs.h (qual_vec, num_quals): Remove.
(qual_flags): Move ...
* syscall.c: ... here.
(num_quals, num_faults, MIN_QUALS, reallocate_vec, reallocate_qual,
reallocate_fault): Remove.
(qual_vec, qual_fault): Change into static fixed size arrays.
(qualify_one): Remove reallocate_qual and reallocate_fault calls.
(qualify): Likewise. Replace num_quals and num_faults with
MAX_NSYSCALLS.
Rewrite qual_signal using bit sets.
* defs.h (signal_set): New variable prototypes.
(qualify_signals): New function prototypes.
(QUAL_SIGNAL): Change to a value greater than 0xff.
(QUAL_FAULT): Change to a lower value.
* qualify.c (signal_set): New variable.
(sigstr_to_uint, qualify_signals): New functions.
* syscall.c (qual_signal): Remove.
(qual_options): Replace qual_signal with NULL.
(qualify): Use qualify_signals.
* strace.c (print_signalled, print_stopped): Use is_number_in_set
with signal_set argument.
2016-12-05 Dmitry V. Levin <ldv@altlinux.org>
Rewrite qual_desc using bit sets.
As a side effect, this also fixes support of negated sets
of descriptors.
* defs.h (struct number_set): New forward declaration.
(read_set, write_set): New variable prototypes.
(is_number_in_set, qualify_read, qualify_write): New function
prototypes.
(QUAL_READ, QUAL_WRITE): Change to values greater than 0xff.
* qualify.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* syscall.c (qual_desc): Remove.
(qual_options): Replace qual_desc with NULL.
(qualify): Use qualify_read and qualify_write.
(dumpio): Use is_number_in_set.
* tests/options-syntax.test: Check invalid sets of descriptors.
* tests/readv.test: Check dumping of negated sets of descriptors.
2016-12-05 Dmitry V. Levin <ldv@altlinux.org>
tests: skip redirect-fds.test when strace is wrapped with valgrind.
valgrind is not as transparent as strace wrt standard descriptors,
so if strace is wrapped with valgrind, the test would check valgrind
transparency properties and fail imminently.
* tests/redirect-fds.test: Skip the test when $STRACE shows a presence
of valgrind.
2016-12-05 Dmitry V. Levin <ldv@altlinux.org>
Add valgrind.supp.
As valgrind is not quite happy about the way how get_cpuset_size uses
sched_getaffinity, add a suppression file for this case.
* valgrind.supp: New file.
* Makefile.am (EXTRA_DIST): Add it.
2016-12-05 Dmitry V. Levin <ldv@altlinux.org>
affinity: pass 0 as a pid to sched_getaffinity.
* affinity.c (get_cpuset_size): Pass 0 instead of getpid()
to sched_getaffinity.
affinity: document the method of finding out the cpuset size.
* affinity.c (get_cpuset_size): Add a comment about sched_getaffinity.
2016-12-05 Dmitry V. Levin <ldv@altlinux.org>
tests: make options-syntax.test tolerant of strace wrappers.
Change the test to allow wrappers like STRACE="valgrind ./strace".
* tests/options-syntax.test: Strip all words but last from $STRACE
variable in all contexts where the name of strace executable is expected
in its output.
2016-12-04 Dmitry V. Levin <ldv@altlinux.org>
Do not allocate memory for line buffered output.
libc is perfectly capable of allocating memory for its buffers,
so let it do its job.
* strace.c (init): Do not allocate memory for setvbuf invocation.
2016-12-04 Eugene Syromyatnikov <evgsyr@gmail.com>
Update NEWS.
tests: use kernel_ulong_t as argument type in setfsuid/setfsgid tests.
* setfsugid.c: Include "kernel_types.h".
(main): Change type of entries of the "tests" array from long to
kernel_ulong_t.
2016-12-04 Eugene Syromyatnikov <evgsyr@gmail.com>
Elvira Khabirova <lineprinter0@gmail.com>
uid: print size as signed in setgroups/getgroups.
As this is the type used in kernel.
* uid.c (SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Print size parameter
as "%d".
* tests/getgroups.c: Update expected output.
* tests/setgroups.c: Likewise.
2016-12-04 Eugene Syromyatnikov <evgsyr@gmail.com>
Elvira Khabirova <lineprinter0@gmail.com>
uid: use printuid for printing UID/GID value.
* uid.c (setfsuid, get_print_uid, print_gid): Use printuid.
* tests/setfsugid.c (printuid): New function.
(main): Use it to print UID/GID values.
* tests/setgroups.c: Likewise.
* tests/setugid.c (ugid2int): Remove.
(printuid): New function.
(main): Use it to print UID/GID values.
2016-12-01 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: additional check for PTRACE_SETSIGINFO ptrace command.
* tests/ptrace.c (main): Add an additional PTRACE_SETSIGINFO check.
2016-12-01 Dmitry V. Levin <ldv@altlinux.org>
syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32.
* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
Clear __X32_SYSCALL_BIT from scno on x32 personality.
2016-12-01 Eugene Syromyatnikov <evgsyr@gmail.com>
Print syscall names only for defined syscalls.
The string literal "__NR_syscall_4294967295" is semantically incorrect
as there is no such constant defined.
* syscall.c (syscall_name): Return NULL if there is no syscall
corresponding to the given number.
* defs.h (syscall_name): Document this behaviour.
* printsiginfo.c (print_si_info): Print syscall name with "__NR_" prefix
only if there is a syscall corresponding to si_syscall number; print
a plain syscall number otherwise.
* tests/ptrace.c (main): Update expected output.
2016-12-01 Eugene Syromyatnikov <evgsyr@gmail.com>
affinity: print cpu set as an array.
* affinity.c: Add comma between elements of cpu set.
* tests/sched_xetaffinity.c (main): Update expected output.
statfs: fix printing format of f_fsid field.
* print_statfs.c: Print f_fsid as a structure containing field "val"
which, in turn, is an array of two elements that used to be printed
as members of f_fsid structure.
* tests/statfs.expected: Update expected output.
* tests/xstatfsx.c (print_statfs): Likewise.
swap: always print priority value.
* swapon.c (SYS_FUNC(swapon)): Do not check for non-zero the value
of the prio variable in order to print it.
* tests/swap.c (main): Update expected output.
2016-12-01 Elvira Khabirova <lineprinter0@gmail.com>
tests: show pattern line number in match_grep.
This makes debugging of failing test a bit easier.
* tests/init.sh (match_grep): Add the cnt variable, increment it on every
pattern line read, print it as a prefix for non-matched pattern.
2016-11-30 Eugene Syromyatnikov <evgsyr@gmail.com>
Elvira Khabirova <lineprinter0@gmail.com>
futex: make output of the val3 argument of the FUTEX_WAKE_OP command more structured
It is a number which consists of several xlat values, not a structure.
* futex.c (SYS_FUNC(futex)): Modify output of the val3 argument
of the FUTEX_WAKE_OP futex syscall command.
* tests/futex.c (main): Update expected output.
2016-11-30 Eugene Syromyatnikov <evgsyr@gmail.com>
tests: additional checks for prctl-* tests.
* tests/prctl-pdeathsig.c (main): Additional checks.
* tests/prctl-tsc.c (main): Likewise.
* tests/prctl-pdeathsig.test: Update value of -a argument.
* tests/prctl-tsc.test: Likewise.
2016-11-30 JingPiao Chen <chenjingpiao@foxmail.com>
tests: add prctl-pdeathsig.test and prctl-tsc.test.
* tests/prctl-pdeathsig.c: New file.
* tests/prctl-tsc.c: Likewise.
* tests/prctl-pdeathsig.test: New test.
* tests/prctl-tsc.test: Likewise.
* tests/.gitignore: Add prctl-pdeathsig and prctl-tsc.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prctl-pdeathsig.test and prctl-tsc.test.
2016-11-30 Dmitry V. Levin <ldv@altlinux.org>
syscall: Simplify strip_prefix.
* syscall.c (strip_prefix): Use strncmp instead of strlen+memcmp.
util: fix integer overflow check in string_to_uint_ex.
* util.c (string_to_uint_ex): Fix the check for integer overflow
on systems where LONG_MAX == INT_MAX.
Check dumping of io syscalls when descriptor arguments are sensibly large
* tests/tests.h (pipe_maxfd): New prototype.
* tests/pipe_maxfd.c: New file.
* tests/print_maxfd.c: Likewise.
* tests/.gitignore: Add print_maxfd.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(libtests_a_SOURCES): Add pipe_maxfd.c.
* tests/readv.c (main): Use pipe_maxfd() instead of pipe(),
fds[0] instead of 0, fds[1] instead of 1.
* tests/readv.test: Use print_maxfd to specify dump descriptor numbers.
dumpio: remove useless check.