]>
granicus.if.org Git - strace/log
Dmitry V. Levin [Tue, 5 Jan 2016 22:51:44 +0000 (22:51 +0000)]
tests/_newselect.c: use libtests
* tests/_newselect.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:41:28 +0000 (22:41 +0000)]
tests/fstatat.c: use libtests
* tests/fstatat.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:40:51 +0000 (22:40 +0000)]
tests/newfstatat.c: use libtests
* tests/newfstatat.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:40:17 +0000 (22:40 +0000)]
tests/fstatat64.c: use libtests
* tests/fstatat64.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:37:42 +0000 (22:37 +0000)]
tests/xstatx.c: use libtests
* tests/xstatx.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:35:52 +0000 (22:35 +0000)]
tests/stat64.c: use libtests
* tests/stat64.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:35:11 +0000 (22:35 +0000)]
tests/stat.c: use libtests
* tests/stat.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:34:30 +0000 (22:34 +0000)]
tests/lstat64.c: use libtests
* tests/lstat64.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:33:26 +0000 (22:33 +0000)]
tests/lstat.c: use libtests
* tests/lstat.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:32:37 +0000 (22:32 +0000)]
tests/fstat64.c: use libtests
* tests/fstat64.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:31:46 +0000 (22:31 +0000)]
tests/fstat.c: use libtests
* tests/fstat.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Tue, 5 Jan 2016 22:28:51 +0000 (22:28 +0000)]
tests/statfs.c: use libtests
* tests/statfs.c (main): Use perror_msg_and_fail.
Dmitry V. Levin [Mon, 4 Jan 2016 23:59:16 +0000 (23:59 +0000)]
tests/xettimeofday.c: use libtests
* tests/xettimeofday.c (main): Use assert and perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:58:19 +0000 (23:58 +0000)]
tests/utime.c: use libtests
* tests/utime.c (main): Use assert and perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:56:03 +0000 (23:56 +0000)]
tests/filter-unavailable.c: use libtests
* tests/filter-unavailable.c (main): Use perror_msg_and_fail.
Dmitry V. Levin [Mon, 4 Jan 2016 23:53:31 +0000 (23:53 +0000)]
tests/scm_rights.c: use libtests
* tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:51:11 +0000 (23:51 +0000)]
tests/caps.c: use libtests
* tests/caps.c (main): Use perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:49:32 +0000 (23:49 +0000)]
tests/rt_sigqueueinfo.c: use libtests
* tests/rt_sigqueueinfo.c (main): Use assert and perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:47:59 +0000 (23:47 +0000)]
tests/umount.c: use libtests
* tests/umount.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_fail.
Dmitry V. Levin [Mon, 4 Jan 2016 23:47:59 +0000 (23:47 +0000)]
tests/umount2.c: use libtests
* tests/umount2.c (main): Use perror_msg_and_fail.
Dmitry V. Levin [Mon, 4 Jan 2016 23:44:20 +0000 (23:44 +0000)]
tests/times.c: use libtests
* tests/times.c (main): Use perror_msg_and_fail and perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:43:09 +0000 (23:43 +0000)]
tests/times-fail.c: use assert
* tests/times-fail.c (main): Use assert.
Dmitry V. Levin [Mon, 4 Jan 2016 23:41:27 +0000 (23:41 +0000)]
tests/memfd_create.c: use libtests
* tests/memfd_create.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Mon, 4 Jan 2016 23:40:24 +0000 (23:40 +0000)]
tests/execveat.c: use libtests
* tests/execveat.c: Use SKIP_MAIN_UNDEFINED.
Dmitry V. Levin [Mon, 4 Jan 2016 23:38:19 +0000 (23:38 +0000)]
tests/xetitimer.c: use libtests
* tests/xetitimer.c (main): Use perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:36:00 +0000 (23:36 +0000)]
tests/sysinfo.c: use libtests
* tests/sysinfo.c (main): Use perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:34:00 +0000 (23:34 +0000)]
tests/sigaltstack.c: use libtests
* tests/sigaltstack.c (main): Use perror_msg_and_skip.
Dmitry V. Levin [Mon, 4 Jan 2016 23:31:09 +0000 (23:31 +0000)]
tests/adjtimex.c: use libtests
* tests/adjtimex.c (main): Use perror_msg_and_skip.
Dmitry V. Levin [Sun, 3 Jan 2016 22:09:54 +0000 (22:09 +0000)]
tests/xet_robust_list.c: use libtests
* tests/xet_robust_list.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip and tail_alloc.
Dmitry V. Levin [Sun, 3 Jan 2016 22:07:40 +0000 (22:07 +0000)]
tests/umovestr2.c: use libtests
* tests/umovestr2.c (main): Use get_page_size and tail_alloc.
Dmitry V. Levin [Sun, 3 Jan 2016 21:58:52 +0000 (21:58 +0000)]
tests/umovestr.c: use libtests
* tests/umovestr.c (main): Use perror_msg_and_skip and tail_alloc.
Dmitry V. Levin [Sun, 3 Jan 2016 21:56:05 +0000 (21:56 +0000)]
tests/time.c: use libtests
* tests/time.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip and tail_alloc.
Dmitry V. Levin [Sun, 3 Jan 2016 21:54:31 +0000 (21:54 +0000)]
tests/sendfile64.c: use libtests
* tests/sendfile64.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert, perror_msg_and_fail, perror_msg_and_skip,
and tail_alloc.
Dmitry V. Levin [Sun, 3 Jan 2016 21:52:58 +0000 (21:52 +0000)]
tests/sendfile.c: use libtests
* tests/sendfile.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert, perror_msg_and_fail, perror_msg_and_skip,
and tail_alloc.
Dmitry V. Levin [Sat, 2 Jan 2016 13:28:43 +0000 (13:28 +0000)]
tests: include tests.h instead of config.h
Automatically edit tests/*.c files using the following perl one-liner:
perl -0777 -pi -e \
's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \
tests/*.c
Dmitry V. Levin [Sat, 2 Jan 2016 12:05:14 +0000 (12:05 +0000)]
tests: introduce libtests
Introduce tests/libtests.a with common functions for use in tests.
* tests/tests.h: New file.
* tests/error_msg.c: Likewise.
* tests/tail_alloc.c: Likewise.
* tests/get_page_size.c: Likewise.
* tests/Makefile.am (libtests_a_SOURCES, libtests_a_CPPFLAGS,
check_LIBRARIES, LDADD): New variables.
(clock_xettime_LDADD, filter_unavailable_LDADD, mq_LDADD,
pc_LDADD, times_LDADD): Add $(LDADD).
* tests/.gitignore: Add libtests.a.
Dmitry V. Levin [Fri, 1 Jan 2016 23:09:02 +0000 (23:09 +0000)]
tests: enable strace-k.test only for --with-libunwind configurations
Also, since -k option does not support multiple personalities,
add strace-k.test to XFAIL_TESTS when running mpers tests.
* tests/Makefile.am (MPERS_NAME, LIBUNWIND_TESTS, XFAIL_TESTS_,
XFAIL_TESTS_m32, XFAIL_TESTS_mx32, XFAIL_TESTS): New variables.
[USE_LIBUNWIND] (LIBUNWIND_TESTS): Add strace-k.test.
(TESTS): Replace strace-k.test with $(LIBUNWIND_TESTS).
* bootstrap: Substitute MPERS_NAME variable in tests-*/Makefile.am.
* tests/strace-k.test: Do not check for -k option availability.
Dmitry V. Levin [Thu, 31 Dec 2015 14:19:41 +0000 (14:19 +0000)]
Move gcc compat macros to gcc_compat.h
* defs.h: Include "gcc_compat.h".
(GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): Move ...
* gcc_compat.h: ... here.
* Makefile.am (strace_SOURCES): Add gcc_compat.h.
Dmitry V. Levin [Thu, 31 Dec 2015 14:15:59 +0000 (14:15 +0000)]
Move defs.h from noinst_HEADERS to strace_SOURCES
* Makefile.am (noinst_HEADERS): Move defs.h ...
(strace_SOURCES): ... here.
Dmitry V. Levin [Wed, 30 Dec 2015 23:28:35 +0000 (23:28 +0000)]
test: remove fork.c and vfork.c
These manual tests are obsoleted by fork-f.test and vfork-f.test.
* test/fork.c: Remove.
* test/vfork.c: Remove.
* test/Makefile (PROGS): Remove fork and vfork.
* test/.gitignore: Remove fork and vfork.
Dmitry V. Levin [Wed, 30 Dec 2015 23:00:43 +0000 (23:00 +0000)]
tests: add fork-f.test and vfork-f.test
Check how strace -f follows fork and vfork syscalls.
* tests/fork-f.c: New file.
* tests/fork-f.test: New test.
* tests/vfork-f.c: New file.
* tests/vfork-f.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add fork-f and vfork-f.
(TESTS): Add fork-f.test and vfork-f.test.
* tests/.gitignore: Add fork-f and vfork-f.
Dmitry V. Levin [Tue, 29 Dec 2015 01:06:39 +0000 (01:06 +0000)]
Set SYSCALL_NEVER_FAILS flag for getpid, getppid and gettid syscall
* linux/*/syscallent*.h (getpid, getppid, gettid): Set NF flag.
Dmitry V. Levin [Mon, 28 Dec 2015 00:44:47 +0000 (00:44 +0000)]
Set SYSCALL_NEVER_FAILS flag for umask syscall
Linux kernel always ANDs umask argument with 0700 and therefore
this syscall never fails.
* linux/*/syscallent*.h (umask): Set NF flag.
Dmitry V. Levin [Sun, 27 Dec 2015 00:18:51 +0000 (00:18 +0000)]
alpha, ia64, mips, nios2, powerpc, sparc: always check for syscall error
On architectures that use dedicated registers to report syscall errors,
check for syscall error condition regardless of SYSCALL_NEVER_FAILS flag
in the syscall entry. On architectures that use negated errno
semantics, there is no way to distinguish a syscall error from a valid
return code that looks like a syscall error, and the check for
SYSCALL_NEVER_FAILS flag remains the only way to tell one case
from another.
* linux/alpha/get_error.c (get_error): Ignore check_errno.
* linux/ia64/get_error.c: Likewise.
* linux/mips/get_error.c: Likewise.
* linux/nios2/get_error.c: Likewise.
* linux/powerpc/get_error.c: Likewise.
* linux/sparc/get_error.c: Likewise.
* linux/sparc64/get_error.c: Likewise.
Dmitry V. Levin [Sun, 27 Dec 2015 00:18:35 +0000 (00:18 +0000)]
Handle unlikely errors from personality syscall
Despite being marked as SYSCALL_NEVER_FAILS, personality syscall still
might report a failure on some architectures due to obscure kernel
bugs. Check for this unlikely case and let users know that their
kernel has gone bananas.
* personality.c (SYS_FUNC(personality)): Do not parse syscall return
value in case of syserror.
Dmitry V. Levin [Sun, 27 Dec 2015 00:18:03 +0000 (00:18 +0000)]
Do not truncate return value of get{,e}[ug]id and setfs[ug]id syscalls
This should not be a user visible change unless the kernel does
something completely unexpected. In the latter case, let user see
what is going on.
* uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Do not truncate
tcp->u_rval to uid_t on exiting syscall, return RVAL_DECODED.
Dmitry V. Levin [Sat, 26 Dec 2015 01:40:50 +0000 (01:40 +0000)]
Enhance personality syscall decoding
* xlat/personality_options.in: Split into ...
* xlat/personality_types.in: ... personality types and ...
* xlat/personality_flags.in: ... personality flags.
* personality.c: Include "xlat/personality_types.h"
and "xlat/personality_flags.h" instead of "xlat/personality_options.h".
(SYS_FUNC(personality)): Print PER_MASK part of personality as
a symbolic value, and the rest of personality as a set of flags.
* tests/personality.c (main): Add more test cases.
* tests/personality.test: Update.
Dmitry V. Levin [Fri, 25 Dec 2015 21:02:03 +0000 (21:02 +0000)]
sh, sh64: fix syscall flags in several syscall entries
* linux/sh/syscallent.h (geteuid32, getegid32, setfsuid32, setfsgid32):
Set SYSCALL_NEVER_FAILS flag.
(fchown32): Set TRACE_DESC flag.
* linux/sh64/syscallent.h: Likewise.
Dmitry V. Levin [Fri, 25 Dec 2015 20:56:06 +0000 (20:56 +0000)]
Print personality value 0xffffffff properly
Value 0xffffffff of personality syscall first argument has a special
meaning, it is not a set of personality flags.
* personality.c (SYS_FUNC(personality)): If personality equals
to 0xffffffff, print it verbatim.
* tests/personality.c (main): Test it.
Dmitry V. Levin [Fri, 25 Dec 2015 00:52:42 +0000 (00:52 +0000)]
tests: add personality.test
* tests/personality.c: New file.
* tests/personality.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add personality.
(TESTS): Add personality.test.
* tests/.gitignore: Add personality.
Dmitry V. Levin [Thu, 24 Dec 2015 16:53:07 +0000 (16:53 +0000)]
Enhance personality syscall decoding
* personality.c (SYS_FUNC(personality)): On entering syscall,
print first argument not as a hex value but as a set of flags.
On exiting syscall, print return code as a set of flags.
* NEWS: Mention this enhancement.
Dmitry V. Levin [Fri, 25 Dec 2015 00:34:07 +0000 (00:34 +0000)]
Set SYSCALL_NEVER_FAILS flag for personality syscall
Starting with commit
v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940 , personality
syscall never fails to set the personality, but before commit
v2.6.35-rc1-372-g485d527 it still could return an error.
Starting with that commit, personality syscall never returns an error.
* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag in personality
syscall entries.
Dmitry V. Levin [Thu, 24 Dec 2015 16:28:24 +0000 (16:28 +0000)]
Add personality emulation flags
* xlat/personality_options.in: Add UNAME26, ADDR_NO_RANDOMIZE,
FDPIC_FUNCPTRS, MMAP_PAGE_ZERO, ADDR_COMPAT_LAYOUT, READ_IMPLIES_EXEC,
ADDR_LIMIT_32BIT, SHORT_INODE, WHOLE_SECONDS, STICKY_TIMEOUTS,
and ADDR_LIMIT_3GB.
Dmitry V. Levin [Thu, 24 Dec 2015 15:40:55 +0000 (15:40 +0000)]
arc, metag, nios2, or1k, tile: fix build
Fix build regression introduced by commit
34683e3926d8c2daa368afb805da422ee7043396 .
* linux/32/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap.
* linux/arc/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap_pgoff.
* linux/nios2/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Add sys_ prefix to ARCH_mmap and sys_mmap_4koff.
* pathtrace.c (pathtrace_match): Handle SEN_ARCH_mmap.
* NEWS: Mention this build fix.
Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Dmitry V. Levin [Thu, 24 Dec 2015 00:02:36 +0000 (00:02 +0000)]
packages: remove acl development library from build dependencies
Starting with commit
v4.9-46-g681452b that removed all references
to acl.h, we no longer use acl development library.
* .travis.yml (addons.apt.packages): Remove libacl1-dev.
* strace.spec (BuildRequires): Remove libacl-devel.
Dmitry V. Levin [Wed, 23 Dec 2015 04:23:13 +0000 (04:23 +0000)]
packages/x86_64: enable experimental -k option
* debian/control (Build-Depends) [amd64]: Add libunwind-dev.
* strace.spec (BuildRequires) [x86_64]: Add libunwind-devel.
Dmitry V. Levin [Tue, 22 Dec 2015 04:26:56 +0000 (04:26 +0000)]
maint: post-release administrivia
* NEWS: Add header line for the next release.
Dmitry V. Levin [Mon, 21 Dec 2015 20:21:22 +0000 (20:21 +0000)]
Prepare for 4.11 release
* NEWS: Update for 4.11 release.
* debian/changelog: 4.11-1.
* strace.spec: 4.11-1.
Dmitry V. Levin [Sun, 20 Dec 2015 00:51:51 +0000 (00:51 +0000)]
Sync strace.spec and debian/ with packages
* debian/changelog: Sync with 4.10-3.
* debian/control: Likewise.
* debian/rules: Likewise.
* strace.spec: Sync with 4.10-3.
Dmitry V. Levin [Sun, 20 Dec 2015 00:25:10 +0000 (00:25 +0000)]
.mailmap: add addresses of Kirill A. Shutemov
* .mailmap: Add both addresses of Kirill A. Shutemov here
to avoid duplications in CREDITS file.
Dmitry V. Levin [Sat, 19 Dec 2015 20:57:30 +0000 (20:57 +0000)]
NEWS: Prepare for 4.11 release
Dmitry V. Levin [Fri, 18 Dec 2015 20:55:40 +0000 (20:55 +0000)]
ia64: wire up mlock2 syscall
* linux/ia64/syscallent.h [1346]: Add mlock2 entry.
Dmitry V. Levin [Thu, 17 Dec 2015 17:56:48 +0000 (17:56 +0000)]
Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't. This
change fixes the inconsistency by adding missing copyright headers.
It doesn't mean that copyright headers became maintained. In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
Dmitry V. Levin [Wed, 16 Dec 2015 02:00:01 +0000 (02:00 +0000)]
tests/aio.c: include <time.h>
* tests/aio.c: Include <time.h> for struct timespec.
Reported-by: Szabolcs Nagy <nsz@port70.net>
Dmitry V. Levin [Wed, 16 Dec 2015 01:26:27 +0000 (01:26 +0000)]
mpers.sh: switch to DWARF version 2 format for better portability
* mpers.sh (CFLAGS): Replace -gdwarf-4 with -gdwarf-2.
Dmitry V. Levin [Wed, 16 Dec 2015 01:25:10 +0000 (01:25 +0000)]
mpers.awk: add support for DWARF version 2 format
* mpers.awk: Handle DW_AT_data_member_location in DWARF v2 format.
Dmitry V. Levin [Wed, 16 Dec 2015 00:07:16 +0000 (00:07 +0000)]
Replace %Ld/%Lu printf format specifiers with %lld/%llu
As %Ld and %Lu printf format specifiers are not quite portable,
replace them with %lld and %llu, respectively.
* desc.c (SYS_FUNC(pselect6)): Replace %Lu with %llu.
* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Likewise.
* times.c (SYS_FUNC(times)): Likewise.
* fcntl.c (print_struct_flock64): Replace %Ld with %lld.
* tests/ftruncate.c (main): Replace %Lu with %llu.
* tests/ftruncate64.c (main): Likewise.
* tests/getdents.c (print_dirent): Likewise.
* tests/llseek.c (main): Likewise.
* tests/lseek.c (main): Likewise.
* tests/truncate.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/xstatx.c (main): Likewise.
* tests/pselect6.c (main): Replace %Ld with %lld.
* tests/xselect.c(main): Likewise.
Reported-by: Szabolcs Nagy <nsz@port70.net>
Szabolcs Nagy [Tue, 15 Dec 2015 18:32:17 +0000 (18:32 +0000)]
Fix SYS_FUNC and SEN macros for musl
The syscall_name argument was subject to macro expansion because
it was passed down to other macros before it was prefixed.
musl libc defines lfs64 names as macros (e.g. fstat64 as fstat)
so SYS_FUNC(fstat64) was expanded to sys_fstat.
This change adds the prefix before the name is passed to other macros,
i.e. the argument of SYS_FUNC_NAME is already prefixed with sys_.
* defs.h (SYS_FUNC): Add sys_ prefix to SYS_FUNC_NAME's argument.
(SYS_FUNC_NAME): Do not add sys_ prefix to MPERS_FUNC_NAME's argument.
* linux/ia64/syscallent.h (SYS_FUNC_NAME): Do not add sys_ prefix
to MPERS_FUNC_NAME's argument.
* syscall.c (SEN_NAME): Remove.
(SEN): Replace SEN_NAME call with its definition. Add sys_ prefix
to SYS_FUNC_NAME's argument.
Dmitry V. Levin [Tue, 15 Dec 2015 15:26:29 +0000 (15:26 +0000)]
tests/times.test: workaround libc bug on x32
As glibc times wrapper on x32 is known to wrongly truncate and then sign
extend the syscall return value, invoke the syscall directly on x32.
* tests/times.c (main) [__NR_times && __x86_64__ && __ILP32__]:
Invoke times syscall using inline asm.
Dmitry V. Levin [Tue, 15 Dec 2015 12:58:42 +0000 (12:58 +0000)]
mpers.awk: make fillers added to the output structure more predictable
* mpers.awk (array_seq): New function.
(what_is): Use it for printing filler names. Tweak return types.
* mpers_test.sh: Use a more complicated sample type to test mpers
machinery.
Dmitry V. Levin [Tue, 15 Dec 2015 03:35:26 +0000 (03:35 +0000)]
Robustify mpers.awk against input containing index loops
Make mpers.awk check for potential index loops. Such loops should not
normally happen, but mpers.awk will not go into infinite recursion if
they do.
* mpers.awk (enter, leave): New functions.
(what_is): Use them.
Dmitry V. Levin [Tue, 15 Dec 2015 00:26:46 +0000 (00:26 +0000)]
Robustify mpers.awk against invalid input
Make mpers.awk check that accessed elements of the main array that
are expected to have non-empty values really meet this requirement.
* mpers.awk (array_get): New function.
(what_is, END): Use it.
* mpers_test.sh: Use a more complicated type to test mpers machinery.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Dmitry V. Levin [Mon, 14 Dec 2015 11:57:59 +0000 (11:57 +0000)]
Replace HAVE_LITTLE_ENDIAN_LONG_LONG with WORDS_BIGENDIAN
* defs.h: Use WORDS_BIGENDIAN instead of HAVE_LITTLE_ENDIAN_LONG_LONG.
* configure.ac (AC_LITTLE_ENDIAN_LONG_LONG): Remove.
* m4/long_long.m4: Remove.
Dmitry V. Levin [Mon, 14 Dec 2015 00:08:24 +0000 (00:08 +0000)]
Remove unused parser of xmknod syscall
The last reference to this parser was removed by commit
v4.10-45-gdf4dd8b .
* mknod.c [SPARC || SPARC64] (SYS_FUNC(xmknod)): Remove.
Dmitry V. Levin [Sun, 13 Dec 2015 01:12:55 +0000 (01:12 +0000)]
tests/restart_syscall: add a workaround for old arm kernels
As arm kernels used to overwrite ARM_r0 with -EINTR after
ERESTART_RESTARTBLOCK, update regexp to workaround this.
* tests/restart_syscall.c (main) [__arm__]: Add 0xfffffffc as a valid
alternative value for the first argument of restarted nanosleep syscall.
Dmitry V. Levin [Sat, 12 Dec 2015 00:02:16 +0000 (00:02 +0000)]
tests/.gitignore: add ksysent.h
tests/ksysent.h is a generated file listed in CLEANFILES.
This change complements commit
v4.10-566-gbab4ef4 .
* tests/.gitignore: Add ksysent.h.
Dmitry V. Levin [Fri, 11 Dec 2015 10:52:42 +0000 (10:52 +0000)]
aarch64: make arm registers unsigned
Follow the x86_64 example and define registers in arm_pt_regs
as unsigned, to avoid potential sign extension bugs.
This also fixes --enable-gcc-Werror build.
* linux/aarch64/arch_regs.c (arm_pt_regs): Change uregs's type
from int to uint32_t.
Reported-by: Sergey Bolshakov <sbolshakov@altlinux.org>
Dmitry V. Levin [Thu, 10 Dec 2015 02:06:25 +0000 (02:06 +0000)]
tests: add ksysent.test
Check that syscall names and numbers defined in syscallent files
match kernel __NR_* constants defined by <asm/unistd.h>.
Tested on various platforms, including the following combinations
of architectures and kernel headers:
x86_64: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.12, 3.11,
3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
i386: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.11,
3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
aarch64: 4.4-rc
alpha: 4.3
arm eabi: 4.4-rc, 4.2, 4.1
hppa: 3.18
ia64: 3.18
mips o32: 4.1
ppc: 3.18
ppc64: 3.10-rhel, 2.6.32-rhel
s390: 3.18
s390x: 3.18
sparc: 4.1
sparc: 3.18
x32: 3.19
The only platform which is known at this moment to fail the test
is CentOS-5 provided by OBS. On x86_64 instance it fails with
error: "prlimit64" syscall #300 is "fanotify_init" in syscallent.h
and on i586 it similarly fails with
error: "prlimit64" syscall #338 is "fanotify_init" in syscallent.h
So this is a real platform bug that is not likely to be worked around
on the strace side.
* tests/ksysent.c: New file.
* tests/ksysent.sed: Likewise.
* tests/ksysent.test: New test.
* tests/Makefile.am (AM_CPPFLAGS): Add -I$(builddir).
(check_PROGRAMS): Add ksysent.
(TESTS): Add ksysent.test.
(EXTRA_DIST): Add ksysent.sed.
(ksysent.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add ksysent.h.
* tests/.gitignore: Add ksysent.
Dmitry V. Levin [Wed, 9 Dec 2015 15:55:33 +0000 (15:55 +0000)]
Document that syscall names match kernel __NR_* constants
* strace.1: Note syscall naming difference between architectures
and the rule of choosing the right syscall name in each case.
Dmitry V. Levin [Wed, 9 Dec 2015 02:07:44 +0000 (02:07 +0000)]
ia64: print all ia32 syscalls using printargs
Printing of ia32 syscalls on ia64 must have been broken for a long time.
Do not pretend that it works, print ia32 syscalls using printargs
instead.
* linux/ia64/syscallent.h: Remove all redefinitions of sys_* macros.
Stop including"../dummy.h". Include "../i386/syscallent.h" with
SYS_FUNC_NAME macro temporarily redirected to printargs.
Dmitry V. Levin [Wed, 9 Dec 2015 11:38:56 +0000 (11:38 +0000)]
Fix build on architectures for which arch_sigreturn is not implemented
This complements commit
527b42ff8da3f52fa7c48eb766b2b57fb0f0b977 .
* linux/arch_sigreturn.c (arch_sigreturn): Define.
Dmitry V. Levin [Wed, 9 Dec 2015 00:43:39 +0000 (00:43 +0000)]
aarch64: swap 64-bit and 32-bit personalities
Let native 64-bit personality be personality 0, and 32-bit personality
be personality 1, to follow the traditional layout used for other
architectures.
* defs.h [AARCH64]: Swap PERSONALITY0_WORDSIZE and
PERSONALITY1_WORDSIZE, remove DEFAULT_PERSONALITY.
[AARCH64 && HAVE_M32_MPERS]: Rename PERSONALITY1_* to PERSONALITY0_*.
* file.c [AARCH64 || defined X86_64 || defined X32]: Define
STAT32_PERSONALITY for AARCH64 as well.
* syscall.c (update_personality) [AARCH64]: Adjust PERSONALITY_NAMES.
* linux/aarch64/errnoent1.h: Adjust comment.
* linux/aarch64/get_error.c (get_error): Adjust tcp->currpers check.
* linux/aarch64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Likewise.
* linux/aarch64/get_scno.c (arch_get_scno): Adjust update_personality
invocations.
* linux/aarch64/ioctls_arch0.h: Swap with ...
* linux/aarch64/ioctls_arch1.h: ... this file.
* linux/aarch64/ioctls_inc0.h: Swap with ...
* linux/aarch64/ioctls_inc1.h: ... this file.
* linux/aarch64/syscallent.h: Swap with ...
* linux/aarch64/syscallent1.h: ... this file.
Dmitry V. Levin [Tue, 8 Dec 2015 22:32:33 +0000 (22:32 +0000)]
mips: fix fadvise64 syscall entries
* linux/mips/syscallent-n32.h [6216]: Change syscall handler
from fadvise64 to fadvise64_64.
* linux/mips/syscallent-n64.h [5215]: Rename from "fadvise64_64"
to "fadvise64"
* linux/mips/syscallent-o32.h [4254]: Likewise.
Dmitry V. Levin [Tue, 8 Dec 2015 21:06:26 +0000 (21:06 +0000)]
xtensa: wire up syncfs syscall
* linux/xtensa/syscallent.h [179]: Add syncfs entry.
Dmitry V. Levin [Tue, 8 Dec 2015 20:58:38 +0000 (20:58 +0000)]
sh, sh64: fix syscall entries
* linux/sh/syscallent.h [322]: Fix timerfd_create entry.
* linux/sh64/syscallent.h [350]: Likewise.
[0]: Fix restart_syscall entry.
Dmitry V. Levin [Tue, 8 Dec 2015 20:49:46 +0000 (20:49 +0000)]
powerpc, powerpc64: wire up mlock2 syscall
* linux/powerpc/syscallent.h [378]: Add mlock2 entry.
* linux/powerpc64/syscallent.h: Likewise.
Dmitry V. Levin [Tue, 8 Dec 2015 20:43:52 +0000 (20:43 +0000)]
hppa: fix syscall entries
* linux/hppa/syscallent.h: Swap [343] and [344] entries.
Dmitry V. Levin [Tue, 8 Dec 2015 20:37:22 +0000 (20:37 +0000)]
avr32: update syscall entries
* linux/avr32/syscallent.h [0]: Rename from setup to restart_syscall.
[284 ... 320]: New entries.
Dmitry V. Levin [Tue, 8 Dec 2015 20:20:21 +0000 (20:20 +0000)]
m68k: fix syscall names
* linux/m68k/syscallent.h [335]: Rename "atomic_comxchg_32"
to "atomic_cmpxchg_32".
Dmitry V. Levin [Tue, 8 Dec 2015 18:24:42 +0000 (18:24 +0000)]
sparc: update syscall names
* linux/sparc/syscallent.h [160]: Rename "sched_setaffinity"
to "sched_set_affinity".
[161]: Rename "sched_getaffinity" to "sched_get_affinity".
Dmitry V. Levin [Tue, 8 Dec 2015 18:20:21 +0000 (18:20 +0000)]
powerpc, powerpc64: update syscall names
* linux/powerpc/syscallent.h [201]: Rename "MOL" to "multiplexer".
[225]: Rename "tux" to "tuxcall".
[256]: Rename "debug_setcontext" to "sys_debug_setcontext".
* linux/powerpc64/syscallent.h: Likewise.
Dmitry V. Levin [Tue, 8 Dec 2015 18:10:21 +0000 (18:10 +0000)]
alpha: update syscall entries
* linux/alpha/syscallent.h [224 ... 228]: Add stub entries.
[100]: Rename "osf_getpriority" to "getpriority".
[255]: Rename "osf_subsysinfo" to "osf_subsys_info".
[303]: Rename "adjtimex32" to "old_adjtimex".
[319]: Rename "sysctl" to "_sysctl".
[320]: Remove.
Dmitry V. Levin [Tue, 8 Dec 2015 18:13:58 +0000 (18:13 +0000)]
Fix mmap syscall entries
Change syscall names to match kernel __NR_* constants.
* linux/avr32/syscallent.h [90]: Rename "mmap" to "mmap2".
* linux/bfin/syscallent.h [90]: Rename "old_mmap" to "mmap".
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* tests/mmap.c (main): Remove old_mmap from expected output.
* tests/mmap.test: Remove old_mmap from the list of mmap syscalls.
Dmitry V. Levin [Tue, 8 Dec 2015 17:38:12 +0000 (17:38 +0000)]
Fix select and _newselect syscall entries
Change syscall names to match kernel __NR_* constants.
This reverts commit
ddcf54969d253582ab2cfdcab8ede9cdae3fb171 .
* linux/arm/syscallent.h [82]: Rename "oldselect" to "select".
[142]: Rename "select" to "_newselect".
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h [82]: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/hppa/syscallent.h [142]: Rename "select" to "_newselect".
* linux/mips/syscallent-n32.h [6022]: Rename "select" to "_newselect".
* linux/mips/syscallent-n64.h [5022]: Likewise.
* linux/mips/syscallent-o32.h [4142]: Likewise.
* linux/s390/syscallent.h [142]: Rename "select" to "_newselect".
* linux/sparc/syscallent.h [230]: Rename "select" to "_newselect".
* tests/oldselect.test: Rename oldselect to select. Convert
from match_grep to match_diff.
* tests/oldselect.expected: Likewise.
* xselect.c: New file, based on select.c.
* tests/_newselect.c: New file.
* tests/select.c: Replace with a wrapper around xselect.c.
* tests/select.test: Parametrize.
* tests/_newselect.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add _newselect.
(TESTS): Add _newselect.test.
(EXTRA_DIST): Add xselect.c.
* tests/.gitignore: Add _newselect.
Dmitry V. Levin [Tue, 8 Dec 2015 17:27:40 +0000 (17:27 +0000)]
Fix exit syscall entries
Change syscall names to match kernel __NR_* constants.
* linux/avr32/syscallent.h [1]: Rename "_exit" to "exit".
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h [60]: Rename "_exit" to "exit".
* linux/x86_64/syscallent.h: Likewise.
Dmitry V. Levin [Tue, 8 Dec 2015 16:52:06 +0000 (16:52 +0000)]
Fix pread64 and pwrite64 syscall entries
Change syscall names to match kernel __NR_* constants.
* linux/alpha/syscallent.h [349]: Rename "pread" to "pread64".
[350]: Rename "pwrite" to "pwrite64".
* linux/ia64/syscallent.h [1148]: Rename "pread" to "pread64".
[1149]: Rename "pwrite" to "pwrite64".
* linux/sh/syscallent.h [180]: Rename "pread" to "pread64".
[181]: Rename "pwrite" to "pwrite64".
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h [17]: Rename "pread" to "pread64".
[18]: Rename "pwrite" to "pwrite64".
* linux/x86_64/syscallent.h: Likewise.
Dmitry V. Levin [Tue, 8 Dec 2015 17:33:52 +0000 (17:33 +0000)]
tests: sort the list of tests
* tests/Makefile.am (TESTS): Sort the list of regular tests.
* tests/.gitignore: Sort.
Dmitry V. Levin [Tue, 8 Dec 2015 03:42:16 +0000 (03:42 +0000)]
ia64: fix remap_file_pages syscall entry
* linux/ia64/syscallent.h (1125): Set to remap_file_pages.
Dmitry V. Levin [Tue, 8 Dec 2015 02:49:39 +0000 (02:49 +0000)]
bfin, i386: remove sysentry for nonexistent security syscall
* linux/bfin/syscallent.h (223): Remove.
* linux/i386/syscallent.h: Likewise.
Dmitry V. Levin [Tue, 8 Dec 2015 00:24:53 +0000 (00:24 +0000)]
build: add -D_FILE_OFFSET_BITS=64 to _CPPFLAGS instead of _CFLAGS
* tests/Makefile.am (fstat64_CFLAGS): Rename to fstat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(fstatat64_CFLAGS): Rename to fstatat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(ftruncate64_CFLAGS): Rename to ftruncate64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(lstat64_CFLAGS): Rename to lstat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(mmap64_CFLAGS): Rename to mmap64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(newfstatat_CFLAGS): Rename to newfstatat_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(stat64_CFLAGS): Rename to stat64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(statfs_CFLAGS): Rename to statfs_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(truncate64_CFLAGS): Rename to truncate64_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
(uio_CFLAGS): Rename to uio_CPPFLAGS,
replace $(AM_CFLAGS) with $(AM_CPPFLAGS).