Commit Graph

2818 Commits

Author SHA1 Message Date
48f0890953 ia64: use PTRACE_GETREGS to fetch registers
* linux/ia64/arch_regs.h: Stop including <asm/rse.h>.
(ia64_frame_ptr): New declaration.
* signal.c (sys_sigreturn) [IA64]: Use ia64_frame_ptr.
* syscall.c [IA64]: Include <asm/rse.h>.
[IA64] (ia64_regs, ia64_frame_ptr): New variable.
[IA64] (ARCH_REGS_FOR_GETREGS): New macro.
[IA64] (ia64_ia32mode): Convert to macro.
[IA64] (ia64_r8, ia64_r10): Remove.
(getrval2, print_pc, get_scno, get_syscall_args, get_error) [IA64]:
Use ia64_regs.
(get_syscall_result) [IA64]: Remove.
2015-03-05 23:37:27 +00:00
20eca8a1c5 s390, s390x: use PTRACE_GETREGSET to fetch registers
* linux/s390/arch_regs.h: New file.
* linux/s390x/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add them.
* signal.c (sys_sigreturn) [S390 || S390X]: Use s390_frame_ptr.
* syscall.c [S390 || S390X] (s390_regset, s390_frame_ptr): New variable.
[S390 || S390X] (ARCH_REGS_FOR_GETREGSET): New macro.
(print_pc) [S390 || S390X]: Use s390_regset.
(get_scno) [S390 || S390X]: Likewise.
(get_syscall_args) [S390 || S390X]: Likewise.
(get_error) [S390 || S390X]: Likewise.
(get_syscall_result) [S390 || S390X]: Remove.
2015-03-05 22:10:15 +00:00
07d70f03ee qemu_multiarch_testing: update
* qemu_multiarch_testing/README: Update statistics.
2015-03-05 19:36:52 +00:00
da66e25779 tests: robustify unix-yy.test
Implement additional synchronization between parent and child processes
to guarantee that the child starts closing connected socket only after
exiting of the parent's accept() syscall.
This guarantee seems to be necessary to reliably receive UNIX_DIAG_PEER
messages from NETLINK_SOCK_DIAG interface.

* tests/net-accept-connect.c: Implement additional synchronization
between parent and child processes.
* tests/unix-yy-connect.awk: Update.
2015-03-05 17:44:32 +00:00
59f63d3106 Use SIGRTMIN from kernel headers
* configure.ac (ASM_SIGRTMIN): Define to SIGRTMIN from <asm/signal.h>.
* signal.c: Use ASM_SIGRTMIN instead of constants provided by libc.
* tests/sigreturn.c: Use ASM_SIGRTMIN instead of hardcoded value.
Use lower RT_* numbers to support pre-3.18 hppa kernels.
* tests/sigreturn.test: Update regexp.
2015-03-05 05:42:30 +00:00
67dab706cf ppc64: fix compilation warning
Fix compilation warning introduced by commit
577be2593d

* signal.c (sys_sigreturn) [POWERPC64]: Fix initialization of signal
mask on 32bit personality.
2015-03-05 04:29:37 +00:00
47e289bb9c aarch64: fix compilation warnings
Fix compilation warnings introduced by commit
5b9b7e1d34:

signal.c:702:45: warning: signed and unsigned type in conditional expression [-Wsign-compare]
syscall.c:746:34: warning: initialization from incompatible pointer type [enabled by default]

* syscall.c [AARCH64] (aarch64_sp_ptr): Add explicit cast.
[AARCH64] (arm_sp_ptr): Change pointer type to unsigned.
* linux/aarch64/arch_regs.h (arm_sp_ptr): Update.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2015-03-05 04:10:52 +00:00
a1c5e0721f i386: simplify sigreturn decoding
* signal.c (sys_sigreturn) [X86_64 || X32 || I386]: Do not define
i386_sigcontext_struct and i386_fpstate structures.
2015-03-05 01:16:52 +00:00
30bcb792cf tests: add a test for sigreturn/rt_sigreturn decoding
Convert test/sigreturn.c into a regular test.

* test/Makefile (PROGS): Remove sigreturn.
* test/.gitignore: Likewise.
* test/sigreturn.c: Rewrite to ...
* tests/sigreturn.c: ... new file.
* tests/sigreturn.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sigreturn.
(TESTS): Add sigreturn.test.
* tests/.gitignore: Add sigreturn.
2015-03-05 00:05:27 +00:00
f3582cd204 sigreturn: print signal mask as a syscall argument
Although sigreturn takes signal mask via frame pointer,
it's more convenient to display signal mask as a syscall argument
rather than an outstanding object of unknown nature:

Before this change:
    sigreturn() (mask [USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]) = 0

After this change:
    sigreturn({mask=[USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]}) = 0

* signal.c (sys_sigreturn): Display signal mask as a syscall argument.
2015-03-04 23:55:25 +00:00
5b9b7e1d34 aarch64: implement rt_sigreturn decoding
* linux/64/syscallent.h (139): Use sys_sigreturn for rt_sigreturn
decoding.
* syscall.c [ARM] (arm_regs): Make static.
[ARM] (arm_sp_ptr): New variable.
[AARCH64] (aarch64_sp_ptr, arm_sp_ptr): New variables.
* linux/aarch64/arch_regs.h: New file.
* linux/arm/arch_regs.h (arm_regs): Remove.
(arm_sp_ptr): New declaration.
* signal.c (sys_sigreturn) [ARM]: Use arm_sp_ptr.
[AARCH64]: Print signal mask.
2015-03-04 23:05:53 +00:00
26d16c8ade arm: simplify sigreturn decoding
* signal.c (sys_sigreturn) [ARM]: Do not define sigcontext and ucontext
structures, fetch signal mask only, use print_sigset_addr_len.
2015-03-04 22:27:35 +00:00
085411b806 s390: fix sigreturn decoding
* signal.c (sys_sigreturn) [S390]: Fix signal mask decoding.
2015-03-04 21:48:44 +00:00
fd6d2072b1 mips o32: fix sigreturn decoding
* signal.c (sys_sigreturn) [LINUX_MIPSO32]: Fix the address of signal mask.
[MIPS] Use print_sigset_addr_len to print signal mask.
2015-03-04 21:48:44 +00:00
ccb4fdac43 x86_64, x32: implement rt_sigreturn decoding
* syscall.c [X86_64 || X32] (x86_64_rsp_ptr): New variable.
* linux/x86_64/arch_regs.h (x86_64_rsp_ptr): New declaration.
* linux/x86_64/syscallent.h (15): Use sys_sigreturn for rt_sigreturn
decoding.
* linux/x32/syscallent.h (513): Likewise.
* signal.c (sys_sigreturn) [X86_64 || X32]: Print signal mask
for non-i386 personalities.
2015-03-04 17:54:25 +00:00
db19936861 sparc, sparc64: fix sigreturn decoding
* linux/sparc/arch_regs.h (U_REG_FP): New macro.
* signal.c (sys_sigreturn) [SPARC || SPARC64]: Fix decoding
of upper 32 bits of the sigmask.
2015-03-04 17:54:25 +00:00
577be2593d ppc, ppc64: fix sigreturn decoding
* signal.c (sys_sigreturn) [POWERPC]: Fix decoding of upper 32 bits
of the sigmask.
2015-03-04 16:06:05 +00:00
d46899286e sigreturn: issue a less innocuous warning
* signal.c (sys_sigreturn): Issue a less innocuous warning on
architectures for which signal mask decoding is not implemented yet.
2015-03-04 14:52:56 +00:00
dca5110aaa bootstrap: do not link Makefile* files
* bootstrap: Do not symlink any Makefile* files, not just Makefile.am
and Makefile.in.

Reported-by: Christopher Covington <cov@codeaurora.org>
2015-03-04 14:52:56 +00:00
1e8a454474 ia64: fix sigreturn decoding
* signal.c (sys_sigreturn) [IA64]: Fix the address of signal mask.
Use print_sigset_addr_len to print signal mask.
2015-03-04 12:11:31 +00:00
7abfd29834 ia64: use generic signalent
This complements commit v4.9-321-gfcf7f8d.

* linux/ia64/signalent.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
2015-03-04 12:06:26 +00:00
Giedrius Statkevičius
6a63bfa160 Document that -k is available only with libunwind
Without this users might get confused why `man strace` describes
an option that doesn't work.

* strace.1: Note that -k is available only if strace is built
with libunwind.
2015-03-04 00:56:33 +00:00
fde8fac036 debian: update control file
* debian/control (strace, strace-udeb): Add mips64 and mips64el
to architecture list.
Patch by James Cowgill <james410@cowgill.org.uk>

This fixes Debian bug #773375.
2015-03-03 23:12:22 +00:00
f3f136cd4b debian: sync with 4.9-2 package
* debian/changelog: Sync with 4.9-2.
* debian/control: Likewise.
2015-03-03 23:12:22 +00:00
7e6556711e Add arch-specific PTRACE_* constants
* xlat/ptrace_cmds.in: Add arch-specific ptrace commands.
* xlat/ptrace_events.in: Add PTRACE_EVENT_MIGRATE for tile.
* xlat/ptrace_setoptions_flags.in: Add PTRACE_O_TRACEMIGRATE for tile.

This fixes Debian bug #734554.
2015-03-03 23:12:22 +00:00
Mike Frysinger
600eafb6ed Clarify bootstrap-vs-autoreconf usage
* README-hacking: Tell people to run ./bootstrap.
2015-03-03 01:45:30 +00:00
5a64656da6 mips n32: fix preadv/pwritev offset decoding
In mips n32 abi, like in most of 32-bit architectures, offset
is passed to preadv/pwritev syscalls using two syscall arguments.

* io.c (print_llu_from_low_high_val) [LINUX_MIPSN32]: Remove.
2015-03-03 01:36:29 +00:00
Mike Frysinger
d79ed12376 tests: skip ipc_sem.test on broken kernels
Rather than trigger an ERROR which fails `make check`, go with SKIP
instead.  We don't want the testsuite failing due to kernel bugs.

* tests/ipc_sem.c (main): Change 99 to 77.
2015-03-03 01:13:23 +00:00
Mike Frysinger
eb202baf41 tests: skip pc.test on s390
The s390 hardware can't support an exact si_addr, and the current kernels
don't handle text addresses correctly at all.  Until that improves, skip
the test on s390.

* tests/pc.c (main): Return 77 on s390 systems.
2015-03-03 01:13:10 +00:00
Mike Frysinger
90c80c46b8 tests: note the kernel configs for -yy options
* tests/net-yy.test: Note CONFIG_INET_TCP_DIAG.
* tests/unix-yy.test: Note CONFIG_UNIX_DIAG.
2015-03-03 01:12:18 +00:00
301c65cbf0 alpha: fix -yy decoding
* socketutils.c (receive_responses): Align buffer on a sizeof(long) boundary.

Reported-and-tested-by: Mike Frysinger <vapier@gentoo.org>
2015-03-02 23:39:41 +00:00
d50949d21c aarch64, x32: fix decoding of compat personality statfs64/fstatfs64
* statfs.c (struct compat_statfs64) [AARCH64 || X32]: Apply the same
attributes as on X86_64.
2015-03-02 21:34:02 +00:00
f677715a9b mips: fix compilation warning
* syscall.c (get_scno) [MIPS]: Fix harmless compilation warning
about comparison between signed and unsigned integer expressions.
2015-03-02 15:06:51 +00:00
822892ba45 x32: fix compilation warnings
* sysinfo.c (sys_sysinfo): Use ll length format modifier
instead of l and cast kernel ulong types to unsigned long long.
2015-03-02 14:59:20 +00:00
d819fe88fb aarch64: add -i option support
* syscall.c (print_pc): Add aarch64 support.
2015-03-02 03:42:21 +00:00
4341373f2c ioctl: use x32 specific ioctl entries on x32 personality
As ioctls_inc.h generated natively on x32 differs both from 32/ioctls_inc.h
(by 45 entries) and from linux/64/ioctls_inc.h (by 322 entries), use x32
specific ioctl entries on x32 personality.

* linux/x32/ioctls_inc0.h: Generate from linux v3.19 using ioctls_gen.sh.
* linux/x86_64/ioctlent2.h: Remove.
* linux/x86_64/ioctls_arch2.h: New file.
* linux/x86_64/ioctls_inc2.h: New file.
* Makefile.am (EXTRA_DIST): Remove linux/x86_64/ioctlent2.h, add
linux/x86_64/ioctls_arch2.h and linux/x86_64/ioctls_inc2.h.
2015-03-02 02:55:14 +00:00
77e0d2dccc tests/uid16: skip if real uid is larger than 16bit
* tests/uid16.c (main): Skip if the uid returned by getuid matches
/proc/sys/kernel/overflowuid.
2015-03-02 02:26:02 +00:00
3a15bc8adf tests: fix uid tests on big endian architectures
* tests/uid.c (main): Ignore uids returned by getresuid to avoid
16bit vs 32bit issues on big endian architectures.
Change real UID instead of effective UID in setresuid test.
* tests/uid16.c (main): Likewise.
* tests/uid32.c (main): Change real UID instead of effective UID
in setresuid test to match uid.c
* tests/uid.awk: Update setresuid regexp.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2015-03-02 02:23:55 +00:00
Mike Frysinger
a8dcf253fa tests/getdents: handle older getdents calls
If the tools we use call older getdents syscalls where d_type isn't
passed back, or the arch is old (like Alpha) and can't pass back in
either version, make sure we don't fail.

* tests/getdents.awk (d_type_dir, d_type_reg): Accept DT_UNKNOWN.
2015-03-01 21:42:08 +00:00
d93d9f8d7f Fix multiple personalities support in decoding syscall return values
* syscall.c (trace_syscall_exiting): When current personality is 32bit,
print 32bit return code.
2015-02-28 23:58:08 +00:00
a4c9512294 Update generic 64-bit ioctlent from linux v3.19
* linux/64/ioctls_inc.h: Update from linux v3.19 using ioctls_gen.sh.
2015-02-28 18:52:02 +00:00
24b8eb0dee sparc, sparc64: fix rt_sigaction decoding
Fix regression introduced by commit v4.9-9-gc3a5c01.

* signal.c (HAVE_SA_RESTORER): New macro.
[HPPA || IA64]: Do not undefine SA_RESTORER.
(old_sigaction, old_sigaction32, new_sigaction): Use HAVE_SA_RESTORER
instead of SA_RESTORER to check whether to define sa_restorer.
(decode_old_sigaction, decode_new_sigaction): Use HAVE_SA_RESTORER in
addition to SA_RESTORER to check whether to use sa_restorer.
2015-02-28 17:55:25 +00:00
1dbd39e85f Fix stack buffer overflow when specified command is too long
* strace.c (startup_child): Check that the length of the command strace
is going to execute does not exceed PATH_MAX limit.

Reported-by: Cheolung Lee <chpie@grayhash.com>
2015-02-28 14:50:09 +00:00
7211dbcb2f build: include ptrace.h after regs.h
Restore the order of including <sys/reg.h> and <linux/ptrace.h>
headers that was inadvertently changed by commit v4.9-280-g5503dd2.

This should fix build on platforms like m68k where some constants
are defined simultaneously as enums by <sys/reg.h> and as macros
by <asm/ptrace.h>.

* process.c: Include "ptrace.h" after "regs.h".
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2015-02-28 12:20:21 +00:00
e61086ff77 x32: fix decoding of timeval, timespec, and timex structures
As time_t is a 64-bit type in x32 personality, it is not correct to
treat it as a long int type.

* time.c (current_time_t_is_compat): New macro.
(sprinttv, sprint_timespec, printitv_bitness, tprint_timex): Use it.
(tprint_timeval, do_sprinttv, sprint_timespec): Use j and uintmax_t
when printing tv_sec/tv_usec.
(tprint_timex): Use j and intmax_t/uintmax_t when printing struct timex
members of type kernel_long_t.
2015-02-28 12:10:39 +00:00
Mike Frysinger
4ed340bae6 tests/ipc_sem: detect broken kernels
When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
logic wrongly returns errors.  Detect that and throw an error.

* tests/ipc_sem.c: Return 99 when errno is EFAULT.
* tests/ipc_sem.test: Save output to $OUT and show it when failing.
Handle exit status 99 to throw an ERROR.
2015-02-28 12:10:39 +00:00
856b7596b8 build: do not link strace with -ldl
* configure.ac: Fix dladdr check.
2015-02-27 05:01:25 +00:00
Mike Frysinger
d32e1b9dde Handle broken PTRACE_EVENT_STOP values
For a few linux releases (3.1 through 3.3), this define in the exported
headers were broken.  Redefine if that's the case.

* ptrace.h [PTRACE_EVENT_STOP]: Redefine if PTRACE_EVENT_STOP is 7.
2015-02-27 04:43:11 +00:00
Mike Frysinger
11cb0da472 bootstrap: always set up test dirs
When files get updated, the bootstrap script should make sure the
parallel dirs are kept in sync.

* bootstrap: Always generate the test$m.  Clean up symlinks first.
Don't link in Makefile.in files.
2015-02-27 04:43:11 +00:00
Mike Frysinger
58c7fe9903 Fix cross-compiling of ioctlsort
Use the AX_PROG_CC_FOR_BUILD helper to set up build settings when cross
compiling.  This way ioctlsort uses the build tools all the time.

* configure.ac: Call AX_PROG_CC_FOR_BUILD.
* Makefile.am (ioctlsort_CC): Set to CC_FOR_BUILD.
(ioctlsort_CPPFLAGS): Change CPPFLAGS to CPPFLAGS_FOR_BUILD.
(ioctlsort_CFLAGS): Change CFLAGS to CFLAGS_FOR_BUILD.
(ioctlsort_LDFLAGS): Change LDFLAGS to LDFLAGS_FOR_BUILD.
(ioctlsort_LD): Delete.
(ioctlsort%): Change to ioctlsort%$(BUILD_EXEEXT).  Use ioctlsort_CFLAGS.
* m4/ax_prog_cc_for_build.m4: Import from the autoconf-archive package.
2015-02-27 04:43:06 +00:00