]> granicus.if.org Git - strace/log
strace
7 years agotests: make test executables invocable outside current work directory
Dmitry V. Levin [Sat, 1 Apr 2017 23:11:28 +0000 (23:11 +0000)]
tests: make test executables invocable outside current work directory

Most of test executables were ready for the upcoming change,
this change prepares all the rest.

* tests/getdents.c (main): Use fixed name for the sample directory.
* tests/getdents64.c (main): Likewise.
* tests/readdir.c (main): Likewise.
* tests/mknod.c (sample): Change to a pointer.
(main): Use av[0] as a sample.
* tests/symlink.c (main): Use av[0] as a linkpath.
* tests/umode_t.c (sample): Change to a pointer.
(test_syscall): Fix expected output.
(main): Use av[0] as a sample.

7 years agotests: cleanup access.test
Dmitry V. Levin [Fri, 31 Mar 2017 23:25:32 +0000 (23:25 +0000)]
tests: cleanup access.test

* tests/access.test: Use run_strace_match_diff.
* tests/access.c (main): Update expected output.

7 years agotests: cleanup oldfstat.test
Dmitry V. Levin [Thu, 30 Mar 2017 23:29:24 +0000 (23:29 +0000)]
tests: cleanup oldfstat.test

* tests/oldfstat.test: Use fstat.test.

7 years agoaarch64: workaround gcc+kernel bug
Dmitry V. Levin [Wed, 29 Mar 2017 17:55:35 +0000 (17:55 +0000)]
aarch64: workaround gcc+kernel bug

Due to a subtle gcc bug that leads to miscompiled aarch64 kernels,
the 3rd argument of sched_getattr syscall is not quite 32-bit
on aarch64 as on other architectures.  For more details see
https://sourceforge.net/p/strace/mailman/message/35721703/

* defs.h (print_abnormal_hi): New prototype.
* util.c (print_abnormal_hi): New function.
* sched.c (SYS_FUNC(sched_getattr)) [AARCH64]: Use it.
* tests/sched_xetattr.c (main) [__arm64__ || __aarch64__]: Test it.

7 years agoalpha, mips: fix missing flags in stat related compatibility syscalls
Abhishek Tiwari [Tue, 28 Mar 2017 03:50:07 +0000 (09:20 +0530)]
alpha, mips: fix missing flags in stat related compatibility syscalls

Following commands do the fix:

Add TF flag, fixed by:
git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
   's/0\(,[[:space:]]*SEN(.*_l\?stat[^i]\)/TF\1/'

Add TD flag, fixed by:
git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
  's/0\(,[[:space:]]*SEN(.*_fstat\)/TD\1/'

* linux/alpha/syscallent.h: Add TF and TD flags to stat related
compat syscall entries.
* linux/mips/syscallent-compat.h: Likewise.

7 years agoalpha: fix the number of arguments in alpha specific syscalls
Dmitry V. Levin [Fri, 24 Mar 2017 15:09:59 +0000 (15:09 +0000)]
alpha: fix the number of arguments in alpha specific syscalls

* linux/alpha/syscallent.h (getxgid, osf_stat, osf_lstat, osf_fstat,
osf_sysinfo, sethae): Set nargs according to arch/alpha/kernel/osf_sys.c
from linux v4.10.

7 years agoalpha: update comments about not implemented syscalls
Dmitry V. Levin [Fri, 24 Mar 2017 15:09:59 +0000 (15:09 +0000)]
alpha: update comments about not implemented syscalls

* linux/alpha/syscallent.h: Sync "not implemented" comments
with arch/alpha/kernel/systbls.S from linux v4.10.

7 years agoUpdate BPF_MAP_TYPE_* constants
Quentin Monnet [Thu, 23 Mar 2017 12:18:55 +0000 (13:18 +0100)]
Update BPF_MAP_TYPE_* constants

* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_ARRAY_OF_MAPS
and BPF_MAP_TYPE_HASH_OF_MAPS constants.

7 years agoUpdate ioctl entries from linux v4.11-rc3
Gleb Fotengauer-Malinovskiy [Thu, 23 Mar 2017 16:24:00 +0000 (19:24 +0300)]
Update ioctl entries from linux v4.11-rc3

* linux/32/ioctls_inc_align16.h: Update from linux v4.11-rc3 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.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.

7 years agomaint: update for linux 4.11
Gleb Fotengauer-Malinovskiy [Thu, 23 Mar 2017 13:26:47 +0000 (16:26 +0300)]
maint: update for linux 4.11

* maint/ioctls_sym.sh (ppc_list): Add KVM_PPC_GET_RMMU_INFO
and KVM_PPC_CONFIGURE_V3_MMU.

7 years agotest: rename README to README.md
Dmitry V. Levin [Sun, 19 Mar 2017 13:34:16 +0000 (13:34 +0000)]
test: rename README to README.md

* test/README: Rename to README.md, turn ../tests reference into an URL.

7 years agotest: update README
Dmitry V. Levin [Sun, 19 Mar 2017 13:34:16 +0000 (13:34 +0000)]
test: update README

* test/README: Tell the reader what this directory is actually for.

7 years agotest: rewrite skodic.c demo
Dmitry V. Levin [Sat, 18 Mar 2017 22:14:16 +0000 (22:14 +0000)]
test: rewrite skodic.c demo

* test/skodic.c: Rewrite this demo to simplify its use.

7 years agoImplement decoding of statx syscall
Victor Krapivensky [Sat, 18 Mar 2017 15:19:07 +0000 (18:19 +0300)]
Implement decoding of statx syscall

* linux/i386/syscallent.h [383]: Add statx entry.
* linux/x32/syscallent.h [332]: Likewise.
* linux/x86_64/syscallent.h [332]: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_statx.
* statx.c: New file.
* statx.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/.gitignore: Add statx.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add statx.test.
* tests/statx.c: New file.
* tests/statx.test: Likewise.
* tests/xstatx.c: Modify to support statx.
* xlat/at_statx_sync_types.in: New file.
* xlat/statx_attrs.in: Likewise.
* xlat/statx_masks.in: Likewise.
* NEWS: Mention this change.

7 years agotests: check for out of bounds fetch in parsers of stat family syscalls
Dmitry V. Levin [Fri, 17 Mar 2017 20:15:20 +0000 (20:15 +0000)]
tests: check for out of bounds fetch in parsers of stat family syscalls

* tests/xstatx.c (main): Create STRUCT_STAT object using
TAIL_ALLOC_OBJECT_CONST_PTR.

7 years agotests: check unexpected syscall errors returned by stat family syscalls
Dmitry V. Levin [Fri, 17 Mar 2017 20:15:20 +0000 (20:15 +0000)]
tests: check unexpected syscall errors returned by stat family syscalls

* tests/xstatx.c (main) [!OLD_STAT]: Do not skip the test
in case of EOVERFLOW.
Treat errors other than ENOSYS and EOVERFLOW as fatal.

7 years agotests: move try_run_prog to init.sh
Eugene Syromyatnikov [Fri, 17 Mar 2017 20:04:03 +0000 (21:04 +0100)]
tests: move try_run_prog to init.sh

Looks like try_run_prog may be of general use by other syscall class
tests.

* tests/sched.test (try_run_prog): Move it...
* tests/init: ... here.

7 years agotests/sched.test: rc should be a local variable in try_run_prog
Eugene Syromyatnikov [Fri, 17 Mar 2017 19:49:59 +0000 (20:49 +0100)]
tests/sched.test: rc should be a local variable in try_run_prog

* tests/sched.test (try_run_prog): Add local rc.

7 years agotests: check decoding of int 0x80 on x86_64, x32, and x86
Dmitry V. Levin [Thu, 16 Mar 2017 20:38:48 +0000 (20:38 +0000)]
tests: check decoding of int 0x80 on x86_64, x32, and x86

* tests/int_0x80.c: New file.
* tests/int_0x80.test: New test.
* tests/.gitignore: Add int_0x80.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS, XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Add int_0x80.test.
(XFAIL_TESTS): Add $(XFAIL_TESTS_$(ARCH)).
(CLEANFILES): Add $(TESTS:=.tmp.out) and $(TESTS:=.tmp.exp).

7 years agostrace-graph: handle pid looping
Damien Profeta [Thu, 16 Mar 2017 09:01:55 +0000 (10:01 +0100)]
strace-graph: handle pid looping

* strace-graph: On long running process or heavily forking one (like
compilation), it can happen that a parent get 2 different children with
the same pid.  By tracking the currently runnig pid and adding the start
timestamp to the pid, the graph can now handle that case.

Closes: https://github.com/strace/strace/pull/7
7 years agotests: use TAIL_ALLOC_OBJECT_CONST_PTR
Dmitry V. Levin [Thu, 16 Mar 2017 13:46:36 +0000 (13:46 +0000)]
tests: use TAIL_ALLOC_OBJECT_CONST_PTR

Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \
tests/*.c

7 years agotests: use TAIL_ALLOC_OBJECT_VAR_PTR
Dmitry V. Levin [Thu, 16 Mar 2017 13:46:36 +0000 (13:46 +0000)]
tests: use TAIL_ALLOC_OBJECT_VAR_PTR

Automatically convert tests to use TAIL_ALLOC_OBJECT_VAR_PTR macro
with the following sed expression:

sed -ri \
's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*([^ =]+) = tail_alloc\(sizeof\((\2|\*\5)\)\);/\1TAIL_ALLOC_OBJECT_VAR_PTR(\2, \5);/' \
tests/{move_pages,net-sockaddr,sendfile}.c

7 years agotests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h
Dmitry V. Levin [Thu, 16 Mar 2017 13:46:36 +0000 (13:46 +0000)]
tests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h

Introduce a new macros for the most widespread use of tail_alloc.

* tests/tests.h (TAIL_ALLOC_OBJECT_CONST_PTR,
TAIL_ALLOC_OBJECT_VAR_PTR): New macros.

7 years agoDecode RUSAGE_THREAD
Victor Krapivensky [Thu, 16 Mar 2017 07:35:40 +0000 (10:35 +0300)]
Decode RUSAGE_THREAD

* xlat/usagewho.in: Add values for existing entities, add
RUSAGE_THREAD.
* tests/getrusage.c: Test decoding of RUSAGE_THREAD.

7 years agotests/sched.test: use heredoc in order to avoid spawning of subprocess
Eugene Syromyatnikov [Mon, 13 Mar 2017 16:52:41 +0000 (17:52 +0100)]
tests/sched.test: use heredoc in order to avoid spawning of subprocess

Pipelined commands executed in subprocesses (some shells have special
provision for last command in the pipeline, but it is not guaranteed
and not POSIX), so exit codes of these subprocesses can be lost.
In order to avoid creating subprocesses, input for read commands
is better to supply via heredoc and not pipe.

* tests/sched.test: Move test cases to heredoc.

7 years agotests: do not skip sched.test if one of its subtests skips
Dmitry V. Levin [Wed, 15 Mar 2017 01:05:45 +0000 (01:05 +0000)]
tests: do not skip sched.test if one of its subtests skips

* tests/sched.test (try_run_prog): New function.
Use it instead of run_prog.

7 years agotests: do not check decoding of setitimer syscall outside xetitimer.test
Dmitry V. Levin [Wed, 15 Mar 2017 00:00:29 +0000 (00:00 +0000)]
tests: do not check decoding of setitimer syscall outside xetitimer.test

xetitimer.test already implements a comprehensive test of setitimer
syscall parser, no need to duplicate its parts in other tests.

* tests/clock_nanosleep.c (main): Remove setitimer expected output.
* tests/nanosleep.c (main): Likewise.
* tests/clock_nanosleep.test: Remove setitimer from the trace set.
* tests/nanosleep.test: Likewise.

7 years agotests: check decoding of getitimer and setitimer corner cases
Dmitry V. Levin [Tue, 14 Mar 2017 22:35:13 +0000 (22:35 +0000)]
tests: check decoding of getitimer and setitimer corner cases

* tests/sched_xetattr.c: Include <unistd.h> and <asm/unistd.h>.
(main): Check that pointer and integer arguments of getitimer
and setitimer syscalls are decoded properly.
* tests/xetitimer.test: Add -a option.

7 years agotests: rewrite sigreturn syscall decoding check from match_grep to match_diff
Dmitry V. Levin [Mon, 13 Mar 2017 11:37:36 +0000 (11:37 +0000)]
tests: rewrite sigreturn syscall decoding check from match_grep to match_diff

Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/sigreturn.c: Rewrite.
* tests/sigreturn.test: Likewise.

7 years agoia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls
Dmitry V. Levin [Mon, 13 Mar 2017 01:58:39 +0000 (01:58 +0000)]
ia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls

As there is no sigreturn syscall on ia64, mips n32, mips n64, x32,
and x86_64, no longer used parsers could be safely removed.

* linux/ia64/arch_sigreturn.c: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Remove [!LINUX_MIPSO32].
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Remove.

7 years agoMove sigreturn parser to libstrace
Dmitry V. Levin [Mon, 13 Mar 2017 01:58:33 +0000 (01:58 +0000)]
Move sigreturn parser to libstrace

All architectures have rt_sigreturn, but only old ones also have
sigreturn.  Since not all architectures need a parser of sigreturn
syscall, remove the warning and move the parser to libstrace.

* Makefile.am (strace_SOURCES): Move sigreturn.c ...
(libstrace_a_SOURCES): ... here.
* linux/arch_sigreturn.c: Remove warning.

7 years agotests: check decoding of rt_sigreturn syscall
Dmitry V. Levin [Sun, 12 Mar 2017 16:11:38 +0000 (16:11 +0000)]
tests: check decoding of rt_sigreturn syscall

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

7 years agoImplement proper decoding of rt_sigreturn syscall
Dmitry V. Levin [Sun, 12 Mar 2017 22:01:09 +0000 (22:01 +0000)]
Implement proper decoding of rt_sigreturn syscall

* rt_sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_rt_sigreturn): Remove.
* linux/64/syscallent.h (rt_sigreturn): Change sys_func to rt_sigreturn.
* linux/hppa/syscallent.h (rt_sigreturn): Likewise.
* linux/ia64/syscallent.h (rt_sigreturn): Likewise.
* linux/s390/syscallent.h (rt_sigreturn): Likewise.
* linux/s390x/syscallent.h (rt_sigreturn): Likewise.
* linux/x86_64/syscallent.h (rt_sigreturn): Likewise.
* linux/x32/syscallent.h (rt_sigreturn, 64:rt_sigreturn): Likewise.
* NEWS: Mention this change.

7 years agoIntroduce get_rt_sigframe_addr function
Dmitry V. Levin [Sat, 11 Mar 2017 21:49:06 +0000 (21:49 +0000)]
Introduce get_rt_sigframe_addr function

Add get_rt_sigframe_addr function for all supported architectures.
It is going to be used in a parser of rt_sigreturn syscall.

* defs.h (get_rt_sigframe_addr): New function prototype.
* rt_sigframe.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/arch_rt_sigframe.c: New file.
* linux/alpha/arch_rt_sigframe.c: Likewise.
* linux/arc/arch_rt_sigframe.c: Likewise.
* linux/arm/arch_rt_sigframe.c: Likewise.
* linux/avr32/arch_rt_sigframe.c: Likewise.
* linux/bfin/arch_rt_sigframe.c: Likewise.
* linux/crisv10/arch_rt_sigframe.c: Likewise.
* linux/crisv32/arch_rt_sigframe.c: Likewise.
* linux/hppa/arch_rt_sigframe.c: Likewise.
* linux/i386/arch_rt_sigframe.c: Likewise.
* linux/ia64/arch_rt_sigframe.c: Likewise.
* linux/m68k/arch_rt_sigframe.c: Likewise.
* linux/metag/arch_rt_sigframe.c: Likewise.
* linux/microblaze/arch_rt_sigframe.c: Likewise.
* linux/mips/arch_rt_sigframe.c: Likewise.
* linux/nios2/arch_rt_sigframe.c: Likewise.
* linux/or1k/arch_rt_sigframe.c: Likewise.
* linux/powerpc/arch_rt_sigframe.c: Likewise.
* linux/powerpc64/arch_rt_sigframe.c: Likewise.
* linux/riscv/arch_rt_sigframe.c: Likewise.
* linux/s390/arch_rt_sigframe.c: Likewise.
* linux/s390x/arch_rt_sigframe.c: Likewise.
* linux/sh/arch_rt_sigframe.c: Likewise.
* linux/sh64/arch_rt_sigframe.c: Likewise.
* linux/sparc/arch_rt_sigframe.c: Likewise.
* linux/sparc64/arch_rt_sigframe.c: Likewise.
* linux/tile/arch_rt_sigframe.c: Likewise.
* linux/x32/arch_rt_sigframe.c: Likewise.
* linux/x86_64/arch_rt_sigframe.c: Likewise.
* linux/xtensa/arch_rt_sigframe.c: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

7 years agoIntroduce struct_rt_sigframe type
Dmitry V. Levin [Sat, 11 Mar 2017 21:26:22 +0000 (21:26 +0000)]
Introduce struct_rt_sigframe type

Add rt_sigframe.h files with definitions of struct_rt_sigframe type
for all supported architectures.
These definitions are going to be used in a parser of rt_sigreturn
syscall.

* linux/rt_sigframe.h: New file.
* linux/bfin/rt_sigframe.h: Likewise.
* linux/crisv10/rt_sigframe.h: Likewise.
* linux/crisv32/rt_sigframe.h: Likewise.
* linux/hppa/rt_sigframe.h: Likewise.
* linux/i386/rt_sigframe.h: Likewise.
* linux/ia64/rt_sigframe.h: Likewise.
* linux/m68k/rt_sigframe.h: Likewise.
* linux/mips/rt_sigframe.h: Likewise.
* linux/powerpc64/rt_sigframe.h: Likewise.
* linux/s390/rt_sigframe.h: Likewise.
* linux/s390x/rt_sigframe.h: Likewise.
* linux/sh64/rt_sigframe.h: Likewise.
* linux/sparc/rt_sigframe.h: Likewise.
* linux/sparc64/rt_sigframe.h: Likewise.
* linux/tile/rt_sigframe.h: Likewise.
* linux/x32/rt_sigframe.h: Likewise.
* linux/x86_64/rt_sigframe.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.

7 years agounwind.c: fix a possible buffer overflow
Victor Krapivensky [Sat, 11 Mar 2017 11:27:33 +0000 (14:27 +0300)]
unwind.c: fix a possible buffer overflow

Linux does not prevent a user from creating a lot of nested directories
with length of the absolute path of the deepest one exceeding PATH_MAX,
then chdir'ing into it, creating a file there and mmap'ing it. Since the
length of the prefix preceding the pathname in /proc/[pid]/maps is not
necessary 80 (it's 73 on my machine), an overflow is possible.

* unwind.c (build_mmap_cache): Fix a possible buffer overflow.

7 years agoutil.c: remove a wrong comment
Victor Krapivensky [Fri, 10 Mar 2017 17:48:35 +0000 (20:48 +0300)]
util.c: remove a wrong comment

4924dbd6d750665cf383b20ab4fd67e48219ab91 modified the return type, but
not the comment.

7 years agoriscv: export riscv_sp_ptr
Dmitry V. Levin [Fri, 10 Mar 2017 20:06:58 +0000 (20:06 +0000)]
riscv: export riscv_sp_ptr

Export SP register for later use by get_rt_sigframe_addr.

* linux/riscv/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/riscv/arch_regs.c (riscv_sp_ptr): New variable.

7 years agoor1k: export or1k_sp_ptr
Dmitry V. Levin [Fri, 10 Mar 2017 19:52:11 +0000 (19:52 +0000)]
or1k: export or1k_sp_ptr

Export SP register for later use by get_rt_sigframe_addr.

* linux/or1k/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/or1k/arch_regs.c (or1k_sp_ptr): New variable.

7 years agonios2: export nios2_sp_ptr
Dmitry V. Levin [Fri, 10 Mar 2017 19:45:06 +0000 (19:45 +0000)]
nios2: export nios2_sp_ptr

Export SP register for later use by get_rt_sigframe_addr.

* linux/nios2/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/nios2/arch_regs.c (nios2_sp_ptr): New variable.

7 years agometag: export metag_sp_ptr
Dmitry V. Levin [Fri, 10 Mar 2017 19:26:54 +0000 (19:26 +0000)]
metag: export metag_sp_ptr

Export SP register for later use by get_rt_sigframe_addr.

* linux/metag/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/metag/arch_regs.c (metag_sp_ptr): New variable.

7 years agoavr32: export avr32_sp_ptr
Dmitry V. Levin [Fri, 10 Mar 2017 18:40:05 +0000 (18:40 +0000)]
avr32: export avr32_sp_ptr

Export SP register for later use by get_rt_sigframe_addr.

* linux/avr32/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/avr32/arch_regs.c (avr32_sp_ptr): New variable.

7 years agoarc: export arc_sp_ptr
Dmitry V. Levin [Fri, 10 Mar 2017 18:34:46 +0000 (18:34 +0000)]
arc: export arc_sp_ptr

Export SP register for later use by get_rt_sigframe_addr.

* linux/arc/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/arc/arch_regs.c (arc_sp_ptr): New variable.

7 years agoIntroduce print_sigset_addr function
Dmitry V. Levin [Thu, 9 Mar 2017 22:51:46 +0000 (22:51 +0000)]
Introduce print_sigset_addr function

As the definition of NSIG_BYTES is based on NSIG defined in <signal.h>,
NSIG_BYTES cannot be used in files that use kernel sigset_t.

Add another wrapper around print_sigset_addr_len_limit function that
takes one argument less than print_sigset_addr_len wrapper.  This new
wrapper is going to be used in cases when the length argument is equal
to NSIG_BYTES.

* defs.h (print_sigset_addr): New function prototype.
* signal.c (print_sigset_addr): New function.
* linux/alpha/arch_sigreturn.c (arch_sigreturn): Replace
print_sigset_addr_len with print_sigset_addr.
* 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/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.

7 years agoREADME.md: rework guidelines about sending bug reports
Dmitry V. Levin [Wed, 8 Mar 2017 13:43:47 +0000 (13:43 +0000)]
README.md: rework guidelines about sending bug reports

7 years agoUpdate information on how to build strace from git repository
Abhishek Tiwari [Tue, 7 Mar 2017 03:19:30 +0000 (08:49 +0530)]
Update information on how to build strace from git repository

* INSTALL-git.md: Describe how to build strace from git repository.
* README.md: Add reference to INSTALL-git.md.
* README-hacking: Likewise.

7 years agoREADME.md: fix references to in-tree files
Dmitry V. Levin [Sun, 5 Mar 2017 16:02:32 +0000 (16:02 +0000)]
README.md: fix references to in-tree files

* README.md: Change references to COPYING and NEWS files from absolute
to relative.

7 years agoINSTALL: regenerate from install.texi
Dmitry V. Levin [Sun, 5 Mar 2017 16:29:41 +0000 (16:29 +0000)]
INSTALL: regenerate from install.texi

Regenerate INSTALL from install.texi using the following command:
makeinfo --plaintext install.texi > INSTALL

* INSTALL: Regenerate from install.texi.

7 years agoinstall.texi: remove irrelevant sections
Dmitry V. Levin [Sun, 5 Mar 2017 16:29:41 +0000 (16:29 +0000)]
install.texi: remove irrelevant sections

Remove "Multiple Architectures" and "Particular Systems" sections using
the following filter script:

awk '/^@node (Multiple Architectures|Particular Systems)/{skip=1;next}
/^@node/{skip=0} {if(!skip)print}'

* install.texi (Multiple Architectures, Particular Systems): Remove.

7 years agoinstall.texi: import from GNU Autoconf
Dmitry V. Levin [Sun, 5 Mar 2017 16:15:55 +0000 (16:15 +0000)]
install.texi: import from GNU Autoconf

install.texi from GNU Autoconf is the ultimate source of INSTALL file.
This edition of install.texi has been downloaded from
https://git.savannah.gnu.org/cgit/autoconf.git/plain/doc/install.texi?id=63f3c78cdb0ccc85751543e387ef2a7252d5f0a2

* install.texi: Import from GNU Autoconf.

7 years agoImplement -e trace=%sched option for tracing sched_* syscalls
Eugene Syromyatnikov [Sat, 4 Mar 2017 12:28:42 +0000 (13:28 +0100)]
Implement -e trace=%sched option for tracing sched_* syscalls

Based on the patch by Md Haris Iqbal
(https://sourceforge.net/p/strace/mailman/message/35111320/)

linux/*/syscallent.h part is modified automatically by:

    git grep -Fl 'SEN(sched_' linux/ | xargs sed -i \
        's/0\(,[[:space:]]*SEN(sched_\)/TSC\1/'

* sysent.h (TRACE_SCHED): New definition.
* syscall.c: Alias TSC to TRACE_SCHED around syscallent.h inclusion.
* linux/32/syscallent.h: Add TSC flag for sched_* sycalls.
* 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/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.
* qualify.c (lookup_class): Add TRACE_SCHED for "%sched".
* tests/ksysent.c: Define TSC to 0.
* tests/nsyscalls.c: Likewise.
* tests/sched.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add sched.test.
* strace.1 (.SS Filtering): Add information about %sched syscall class.
* NEWS: Mention this change.

Co-authored-by: Md Haris Iqbal <haris.phnx@gmail.com>
7 years agoAdd "%" prefix for syscall classes in qualify
Eugene Syromyatnikov [Sat, 4 Mar 2017 03:22:06 +0000 (04:22 +0100)]
Add "%" prefix for syscall classes in qualify

(as suggested in
https://www.mail-archive.com/strace-devel@lists.sourceforge.net/msg05147.html )

In order to move them to a different namespace than syscall names. This is
already a problem in case of ipc class which shadows ipc syscall.

Old behaviour is retained in order to preserve backwards compatibility.

* qualify.c (lookup_class) <syscall_class>: Add %-prefixed class definitions.
* strace.1 (.SS Filtering): Add information regarding %-prefixed class
syntax, declare legacy class syntax deprecated.
* tests/net.test: Update to use %-prefixed syscall class name.
* tests/netlink_protocol.test: Likewise.
* tests/qual_fault-exit_group.test: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/sigreturn.test: Likewise.
* tests/uio.test: Likewise.
* NEWS: Mention this change.

7 years agotests: simplify print_time_t
Dmitry V. Levin [Tue, 28 Feb 2017 01:21:15 +0000 (01:21 +0000)]
tests: simplify print_time_t

* tests/print_time.c (print_time_t): Treat localtime errors as fatal.

7 years agoUpdate homepage URL
Dmitry V. Levin [Mon, 27 Feb 2017 23:11:07 +0000 (23:11 +0000)]
Update homepage URL

* README: Change homepage URL to https://strace.io
* debian/control: Likewise.
* strace.spec.in: Likewise.

7 years agotests: transform print_time_t into print_time_t_nsec
Dmitry V. Levin [Sun, 26 Feb 2017 23:23:31 +0000 (23:23 +0000)]
tests: transform print_time_t into print_time_t_nsec

* tests/print_time.c (print_time_t): Rename to print_time_t_nsec,
take second argument and print it.
* tests/tests.h (print_time_t): Rename to print_time_t_nsec,
add second argument.
* tests/utime.c (main): Use print_time_t_nsec instead of print_time_t.
* tests/xstatx.c (print_stat): Likewise.  Pass nanoseconds
to print_time_t_nsec instead of printing them.

7 years agotests: use print_time_t in utime.test
Dmitry V. Levin [Sun, 26 Feb 2017 22:57:37 +0000 (22:57 +0000)]
tests: use print_time_t in utime.test

* tests/utime.c (print_tm): Remove.
(main): Use print_time_t instead of print_tm.

7 years agotests: move print_time function to libtests
Dmitry V. Levin [Sun, 26 Feb 2017 20:35:37 +0000 (20:35 +0000)]
tests: move print_time function to libtests

Rename print_time function to print_time_t and move it to libtests.

* tests/print_time.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (print_time_t): New prototype.
* tests/print_time.c (print_time): Remove.
(print_stat): Replace print_time with print_time_t.

7 years agotests: macroize printing of atime, mtime, and ctime fields in xstatx.c
Dmitry V. Levin [Sun, 26 Feb 2017 19:14:34 +0000 (19:14 +0000)]
tests: macroize printing of atime, mtime, and ctime fields in xstatx.c

Introduce a macro for printing similar time related fields.

* print_struct_stat.c (PRINT_ST_TIME): New macro.
(print_stat): Use it.

7 years agoprint_struct_stat.c: macroize printing of atime, mtime, and ctime fields
Dmitry V. Levin [Sun, 26 Feb 2017 19:14:34 +0000 (19:14 +0000)]
print_struct_stat.c: macroize printing of atime, mtime, and ctime fields

Introduce a macro for printing similar time related fields.

* print_struct_stat.c (PRINT_ST_TIME): New macro.
(print_struct_stat): Use it.

7 years agox32: fix decoding of flags argument of preadv2 and pwritev2 syscalls
Dmitry V. Levin [Sat, 25 Feb 2017 15:55:31 +0000 (15:55 +0000)]
x32: fix decoding of flags argument of preadv2 and pwritev2 syscalls

x32 is the only linux architecture where preadv2 and pwritev2 syscalls
take 5 arguments instead of 6.

* io.c (PREADV2_PWRITEV2_FLAGS_ARG_NO): New macro.
(SYS_FUNC(preadv2), SYS_FUNC(pwritev2)): Use it.
* linux/x32/syscallent.h (preadv2, pwritev2): Change nargs to 5.
* NEWS: Mention this fix.
* tests/preadv2-pwritev2.c (main): Fix invocation of preadv2
and pwritev2 syscalls on x32.

7 years agotests: rewrite ppoll syscall decoding check from match_grep to match_diff
Dmitry V. Levin [Tue, 21 Feb 2017 22:39:45 +0000 (22:39 +0000)]
tests: rewrite ppoll syscall decoding check from match_grep to match_diff

Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/ppoll-v.c: New file.
* tests/ppoll-v.test: New test.
* tests/ppoll.c: Rewrite.
* tests/ppoll.test: Likewise.
* tests/ppoll.expected: Remove.
* tests/ppoll-v.expected: Remove.
* tests/.gitignore: Add ppoll-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ppoll-v.test.
(EXTRA_DIST): Remove ppoll.expected and ppoll-v.expected.

7 years agotests: move get_sigset_size function to libtests
Dmitry V. Levin [Mon, 20 Feb 2017 00:10:35 +0000 (00:10 +0000)]
tests: move get_sigset_size function to libtests

* tests/get_sigset_size.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (get_sigset_size): New prototype.
* tests/ptrace.c: Do not check for __NR_rt_sigprocmask.
(main): Use get_sigset_size.
* tests/signalfd4.c: Do not check for __NR_rt_sigprocmask.
(get_sigset_size): Remove.

7 years agosched: enhance decoding of sched_setattr syscall
Dmitry V. Levin [Sun, 19 Feb 2017 00:31:40 +0000 (00:31 +0000)]
sched: enhance decoding of sched_setattr syscall

Implement read/write semantics of struct sched_attr.size argument
of sched_setattr syscall.  Do not print members of struct sched_attr
besides sched_attr.size when the specified structure size is less than
the minimal size allowed by the kernel.

* sched.c (print_sched_attr): Fetch struct sched_attr.size and use it
as the structure size.  Print struct sched_attr.size only when the
structure size is less than SCHED_ATTR_MIN_SIZE.
(SYS_FUNC(sched_setattr)): Call print_sched_attr with zero size
argument.  Print struct sched_attr.size returned by the kernel
on exiting syscall in case of E2BIG. Print the last syscall argument
on exiting syscall.
(SYS_FUNC(sched_getattr)): Do not call print_sched_attr with zero size
argument.
* NEWS: Mention it.
* tests/sched_xetattr.c (main): Check it.

7 years agotests: check decoding of sched_[gs]etattr corner cases
Dmitry V. Levin [Sat, 18 Feb 2017 09:58:52 +0000 (09:58 +0000)]
tests: check decoding of sched_[gs]etattr corner cases

* tests/sched_xetattr.c (main): Check that integer arguments
of sched_getattr and sched_setattr syscalls are decoded properly
by adding a few cases with filled higher 32 bits.
Check that pointer argument is decoded properly
on F8ILL_KULONG_SUPPORTED architectures.

7 years agoMove definition of struct sched_attr to a separate header file
Dmitry V. Levin [Sat, 18 Feb 2017 09:58:52 +0000 (09:58 +0000)]
Move definition of struct sched_attr to a separate header file

Avoid multiple defintions of struct sched_attr by creating a separate
header file with its definition and using it in other places.

* sched_attr.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* sched.c: Include it.
(print_sched_attr): Use it.
* tests/sched_xetattr.c: Include it.
(main): Use it.

7 years agotests: rewrite sched_xetattr.test from match_grep to match_diff
Dmitry V. Levin [Sat, 18 Feb 2017 09:58:52 +0000 (09:58 +0000)]
tests: rewrite sched_xetattr.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/adjtimex.c: Include "xlat.h" and "xlat/schedulers.h",
(sys_sched_getattr, sys_sched_setattr): New functions.
(main): Use them.  Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.

7 years agoUse tprints instead of tprintf in a few more places
Dmitry V. Levin [Sat, 18 Feb 2017 00:58:17 +0000 (00:58 +0000)]
Use tprints instead of tprintf in a few more places

* bpf.c (bpf_obj_manage, bpf_prog_attach_detach): Replace tprintf
with tprints for printing strings without format specifiers.
* dm.c (dm_decode_dm_target_spec): Likewise.
* mq.c (SYS_FUNC(mq_timedreceive)): Likewise.
* perf.c (print_perf_event_attr): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.

7 years agobpf: update BPF_PROG_ATTACH decoding
Dmitry V. Levin [Fri, 17 Feb 2017 00:05:00 +0000 (00:05 +0000)]
bpf: update BPF_PROG_ATTACH decoding

Implement decoding of BPF_F_ALLOW_OVERRIDE flag of BPF_PROG_ATTACH
command introduced by linux kernel commit v4.10-rc7-174-g7f67763.

* configure.ac: Check for union bpf_attr.attach_flags
instead of union bpf_attr.attach_type.
* xlat/bpf_attach_flags.in: New file.
* bpf.c: Include "xlat/bpf_attach_flags.h".
(bpf_prog_attach_detach): Rename print_attach_bpf_fd argument
to print_attach.  Add attach_flags field to the structure,
print it in case of BPF_PROG_ATTACH.
* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_ATTACH_FLAGS
instead of HAVE_UNION_BPF_ATTR_ATTACH_TYPE.
(prog_cgroup): Initialize attach_flags field.
(main): Update expected output.

7 years agotests: rewrite adjtimex.test from match_grep to match_diff
Dmitry V. Levin [Thu, 16 Feb 2017 21:02:44 +0000 (21:02 +0000)]
tests: rewrite adjtimex.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/adjtimex.c: Include "xlat.h", "xlat/adjtimex_state.h",
and "xlat/adjtimex_status.h".
(main): Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.

7 years agotests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK
Dmitry V. Levin [Thu, 16 Feb 2017 16:36:14 +0000 (16:36 +0000)]
tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK

* tests/init_delete_module.h (bogus_zero): Remove.
* tests/delete_module.c (main): Replace bogus_zero and
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/finit_module.c (main): Replace bogus_zero
with F8ILL_KULONG_MASK.
* tests/init_module.c (main): Likewise.
* tests/pipe2.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Replace
(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
* tests/fanotify_init.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/fanotify_mark.c (main): Likewise.
* tests/file_handle.c (main): Likewise.
* tests/kexec_load.c (main): Likewise.
* tests/setfsugid.c (main): Likewise.
* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
with F8ILL_KULONG_MASK.
* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.

7 years agotests: fill higher bits of integer arguments of fcntl* syscalls
Dmitry V. Levin [Thu, 16 Feb 2017 12:51:00 +0000 (12:51 +0000)]
tests: fill higher bits of integer arguments of fcntl* syscalls

Check that integer arguments of fcntl and fcntl64 syscalls are decoded
properly by casting them to kernel_ulong_t and filling higher bits.

* tests/struct_flock.c (invoke_test_syscall): Cast "fd" and "cmd"
syscall arguments to kernel_ulong_t, fill their higher 32 bits.

7 years agotests: use sprintrc in tests of fcntl and fcntl64 syscalls
Dmitry V. Levin [Thu, 16 Feb 2017 12:51:00 +0000 (12:51 +0000)]
tests: use sprintrc in tests of fcntl and fcntl64 syscalls

* tests/struct_flock.c (EINVAL_STR): Remove.
(test_flock_einval, test_flock): Use sprintrc instead of EINVAL_STR.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval, test_flock64): Likewise.

7 years agoPost-release administrivia
Dmitry V. Levin [Wed, 15 Feb 2017 22:59:59 +0000 (22:59 +0000)]
Post-release administrivia

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

7 years agoPrepare for 4.16 release v4.16
Dmitry V. Levin [Tue, 14 Feb 2017 10:11:12 +0000 (10:11 +0000)]
Prepare for 4.16 release

* NEWS: Update for 4.16 release.

7 years ago.mailmap: add addresses of JingPiao Chen
Dmitry V. Levin [Mon, 13 Feb 2017 21:08:41 +0000 (21:08 +0000)]
.mailmap: add addresses of JingPiao Chen

* .mailmap: Add both addresses of JingPiao Chen here to avoid
duplications in CREDITS file.

7 years agotests: skip scno tampering tests on compat mips abi
Dmitry V. Levin [Mon, 13 Feb 2017 17:30:00 +0000 (17:30 +0000)]
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.

7 years agoFix -Werror=duplicate-decl-specifier compilation issues
Dmitry V. Levin [Sun, 12 Feb 2017 19:14:15 +0000 (19:14 +0000)]
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".

7 years agotests: rewrite pipe syscall decoding check from match_grep to match_diff
Dmitry V. Levin [Sun, 12 Feb 2017 14:12:41 +0000 (14:12 +0000)]
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.

7 years agotests: rewrite pipe2 syscall decoding check from match_grep to match_diff
Dmitry V. Levin [Sat, 11 Feb 2017 13:40:42 +0000 (13:40 +0000)]
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.

7 years agotests: rewrite mq.test from match_grep to match_diff
Dmitry V. Levin [Fri, 10 Feb 2017 00:14:45 +0000 (00:14 +0000)]
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.

7 years agoSimplify struct inject_opts.rval semantics
Dmitry V. Levin [Thu, 9 Feb 2017 22:26:14 +0000 (22:26 +0000)]
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.

7 years agotests: check signal injection along with fault injection
Dmitry V. Levin [Thu, 9 Feb 2017 22:26:14 +0000 (22:26 +0000)]
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.

7 years agotests: simplify qual_inject-signal.test
Dmitry V. Levin [Thu, 9 Feb 2017 22:26:14 +0000 (22:26 +0000)]
tests: simplify qual_inject-signal.test

* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.

7 years agoMake symbolic errno values match case-insensitive
Dmitry V. Levin [Thu, 9 Feb 2017 14:38:08 +0000 (14:38 +0000)]
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.

7 years agotests: check case-insensitive symbolic signal match
Dmitry V. Levin [Thu, 9 Feb 2017 14:38:08 +0000 (14:38 +0000)]
tests: check case-insensitive symbolic signal match

* tests/qual_signal.test: Test case-insensitive symbolic signal match.

7 years agoUpdate NEWS
Eugene Syromyatnikov [Wed, 8 Feb 2017 18:47:45 +0000 (19:47 +0100)]
Update NEWS

7 years agoUpdate NEWS
Dmitry V. Levin [Wed, 8 Feb 2017 17:22:02 +0000 (17:22 +0000)]
Update NEWS

7 years agostrace.spec.in: fix dist version checks
Dmitry V. Levin [Wed, 8 Feb 2017 16:36:57 +0000 (16:36 +0000)]
strace.spec.in: fix dist version checks

* strace.spec.in: Fix libunwind availability check.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
7 years agotests: update ipc_sem.test for new glibc
Dmitry V. Levin [Wed, 8 Feb 2017 15:54:35 +0000 (15:54 +0000)]
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.

7 years agotests: fix typo in bpf.test
Dmitry V. Levin [Wed, 8 Feb 2017 15:12:40 +0000 (15:12 +0000)]
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")
7 years agotests: check signal injection
Dmitry V. Levin [Wed, 8 Feb 2017 13:51:33 +0000 (13:51 +0000)]
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.

7 years agoImplement -e inject= option
Dmitry V. Levin [Wed, 8 Feb 2017 09:28:38 +0000 (09:28 +0000)]
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.

7 years agotests: prepare for introduction of -e inject= option
Dmitry V. Levin [Wed, 8 Feb 2017 09:28:30 +0000 (09:28 +0000)]
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.

7 years agoPrepare for introduction of -e inject= option
Dmitry V. Levin [Wed, 8 Feb 2017 09:28:07 +0000 (09:28 +0000)]
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.

7 years agotests: make Makefile.am lists sorted in C locale
Dmitry V. Levin [Tue, 7 Feb 2017 16:11:05 +0000 (16:11 +0000)]
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.

7 years agotests: use ARG_STR in msg_control.test
Dmitry V. Levin [Tue, 7 Feb 2017 15:25:41 +0000 (15:25 +0000)]
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.

7 years agopowerpc, powerpc64: wire up new syscalls
Dmitry V. Levin [Tue, 7 Feb 2017 14:58:30 +0000 (14:58 +0000)]
powerpc, powerpc64: wire up new syscalls

* linux/powerpc/syscallent.h [382]: Add kexec_file_load entry.
* linux/powerpc64/syscallent.h [382]: Likewise.

7 years agomicroblaze: wire up new syscalls
Dmitry V. Levin [Tue, 7 Feb 2017 14:58:30 +0000 (14:58 +0000)]
microblaze: wire up new syscalls

* linux/microblaze/syscallent.h [392..397]: New entries.

7 years agoavr32: wire up new syscalls
Dmitry V. Levin [Tue, 7 Feb 2017 14:58:30 +0000 (14:58 +0000)]
avr32: wire up new syscalls

* linux/avr32/syscallent.h [328..330]: New entries.

7 years agoUpdate IPV6_* constants
Dmitry V. Levin [Mon, 6 Feb 2017 22:13:20 +0000 (22:13 +0000)]
Update IPV6_* constants

* xlat/sockipv6options.in: Add IPV6_RECVFRAGSIZE introduced
by linux kernel commit v4.10-rc1~202^2~340^2~1.