]> granicus.if.org Git - strace/log
strace
9 years agonet: move fallback definitions of SOL_* constants to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 19:22:10 +0000 (19:22 +0000)]
net: move fallback definitions of SOL_* constants to xlat/

* net.c: Move definitions of SOL_* constants ...
* xlat/socketlayers.in: ... here.

9 years agofutex: move fallback definitions of futex constants to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 19:00:17 +0000 (19:00 +0000)]
futex: move fallback definitions of futex constants to xlat/

* futex.c: Move definitions of FUTEX_OP_CMP_* constants ...
* xlat/futexwakecmps.in: ... here.
* futex.c: Move definitions of other FUTEX_OP_* constants ...
* xlat/futexwakeops.in: ... here.
* futex.c: Move definitions of remaining FUTEX_* constants except
FUTEX_PRIVATE_FLAG and FUTEX_CLOCK_REALTIME flags ...
* xlat/futexops.in: ... here.

9 years agoclone: move definitions of cloning flags to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 18:36:53 +0000 (18:36 +0000)]
clone: move definitions of cloning flags to xlat/

* clone.c: Include <sched.h>.  Move definitions of CLONE_* flags ...
* xlat/clone_flags.in: ... here.

9 years agoUpdate mount flags constants
Dmitry V. Levin [Tue, 16 Jun 2015 00:31:45 +0000 (00:31 +0000)]
Update mount flags constants

* mount.c: Remove definitions of mount flags constants.
* xlat/mount_flags.in: Update from linux v4.0, add default values.

9 years agomount: update parser to match kernel behaviour
Dmitry V. Levin [Tue, 16 Jun 2015 10:53:25 +0000 (10:53 +0000)]
mount: update parser to match kernel behaviour

* mount.c (sys_mount): Do not decode type and data strings for
MS_SHARED, MS_PRIVATE, MS_SLAVE, and MS_UNBINDABLE mount flags
that do not imply valid strings.

9 years agomount: robustify MS_MGC_VAL decoding
Dmitry V. Levin [Tue, 16 Jun 2015 01:28:34 +0000 (01:28 +0000)]
mount: robustify MS_MGC_VAL decoding

* mount.c (sys_mount): When printing mount flags, do not assume that
(flags & MS_MGC_MSK) == MS_MGC_VAL.

9 years agonet: decode setsockopt() multicast arguments
Dmitry V. Levin [Mon, 8 Jun 2015 14:19:46 +0000 (14:19 +0000)]
net: decode setsockopt() multicast arguments

* configure.ac (AC_CHECK_FUNCS): Add inet_pton.
* net.c (print_mreq, print_mreq6): New functions.
(print_setsockopt): Use them to decode IP_ADD_MEMBERSHIP,
IP_DROP_MEMBERSHIP, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP,
IPV6_JOIN_ANYCAST, and IPV6_LEAVE_ANYCAST.
* tests/ip_mreq.c: New file.
* tests/ip_mreq.expected: Likewise.
* tests/ip_mreq.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ip_mreq.
(TESTS): Add ip_mreq.test.
(EXTRA_DIST): ip_mreq.expected.
* tests/.gitignore: Add ip_mreq.

Based on patch by Ben Noordhuis <info@bnoordhuis.nl>.

9 years agoUpdate IPV6 socket options constants
Dmitry V. Levin [Mon, 8 Jun 2015 23:01:09 +0000 (23:01 +0000)]
Update IPV6 socket options constants

* xlat/sockipv6options.in: Update from linux v4.0.

9 years agonet: factor out interface index printing code
Dmitry V. Levin [Fri, 5 Jun 2015 20:13:21 +0000 (20:13 +0000)]
net: factor out interface index printing code

* net.c (print_ifindex): New function.
(printsock) [HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID]: Use it.

9 years agoConsistently use error_msg instead of fprintf(stderr)
Dmitry V. Levin [Mon, 25 May 2015 22:51:19 +0000 (22:51 +0000)]
Consistently use error_msg instead of fprintf(stderr)

* linux/alpha/get_scno.c: Use error_msg.
* linux/arm/get_scno.c: Likewise.
* linux/mips/get_scno.c: Likewise.
* linux/sh/get_scno.c: Likewise.
* linux/x86_64/get_scno.c: Likewise.
* exit.c (sys_exit): Likewise.
* pathtrace.c (pathtrace_select, pathtrace_match): Likewise.
* strace.c (alloctcb, droptcb, detach, startup_attach,
test_ptrace_seize, init, cleanup, print_debug_info,
maybe_allocate_tcb, startup_tcb, trace): Likewise.
* syscall.c (update_personality, trace_syscall_exiting,
get_scno): Likewise.
* unwind.c (DPRINTF): Likewise.
* tests/bexecve.test: Update patterns.
* tests/detach-stopped.test: Likewise.

9 years agoConsistently print OOM diagnostic messages
Dmitry V. Levin [Mon, 25 May 2015 20:33:31 +0000 (23:33 +0300)]
Consistently print OOM diagnostic messages

* bjm.c (sys_query_module): Use error_msg to print OOM diagnostics.
* util.c (dumpiov, dumpstr): Likewise.

9 years agoIntroduce memory allocation wrappers
Dmitry V. Levin [Mon, 25 May 2015 20:41:02 +0000 (20:41 +0000)]
Introduce memory allocation wrappers

Introduce wrappers to the following functions that do memory allocation:
malloc, calloc, realloc, strdup.

This commit is a follow-up to the related discussions in strace-devel ML:
http://sourceforge.net/p/strace/mailman/message/33618180/
http://sourceforge.net/p/strace/mailman/message/33733470/

* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
* xmalloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* count.c (count_syscall, call_summary_pers): Use xcalloc.
* desc.c (decode_select): Use xmalloc.
* dirent.c (sys_getdents, sys_getdents64): Likewise.
* net.c (sys_recvmmsg): Use xstrdup.
* pathtrace.c (storepath): Use xreallocarray.
(pathtrace_match): Use xmalloc.
* strace.c (die_out_of_memory): Move to xmalloc.c.
(expand_tcbtab): Use xcalloc and xreallocarray.
(startup_child): Use xstrdup.
(init): Use xmalloc, xcalloc, and xstrdup.
* syscall.c (reallocate_qual): Use xreallocarray.
(qualify): Use xstrdup.
* unwind.c (unwind_tcb_init): Use xmalloc.
(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
(get_symbol_name): Use xreallocarray.
(stacktrace_walk, queue_put): Use xmalloc.
* util.c (printstr): Use xmalloc.
* vsprintf.c (strace_vfprintf): Likewise.

9 years agoFix ioctl entries on 32-bit architectures with 64-bit aligned structures
Dmitry V. Levin [Thu, 21 May 2015 16:19:40 +0000 (16:19 +0000)]
Fix ioctl entries on 32-bit architectures with 64-bit aligned structures

Some ioctl constants are defined to different values on those 32-bit
architectures where structures containing a 64-bit field are aligned on
a 8-byte boundary and have a size multiple of 8 bytes, and on other
32-bit architectures.

* configure.ac: Check the size of a structure containing a 64-bit field.
* linux/32/ioctls_inc.h: Rename to ...
* linux/32/ioctls_inc_align32.h: ... this.
* linux/32/ioctls_inc_align64.h: New file.
* linux/32/ioctls_inc.h: Include either 32/ioctls_inc_align32.h
or ioctls_inc_align64.h depending on SIZEOF_STRUCT_I64_I32.
* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align32.h and
* linux/32/ioctls_inc_align64.h.
* tests/ioctl.c (main): Test for VIDIOC_ENUMINPUT.
* tests/ioctl.expected: Check VIDIOC_ENUMINPUT decoding.

Reported-by: Philippe De Muyter <phdm@macqel.be>
9 years agomaint: make linux/kvm.h parseable on arm
Dmitry V. Levin [Thu, 21 May 2015 16:12:31 +0000 (16:12 +0000)]
maint: make linux/kvm.h parseable on arm

* maint/ioctls_sym.sh [AARCH64 || ARM]: Add missing definitions for
structures referenced from linux/kvm.h.

9 years agov4l2: add decoding for VIDIOC_S_CROP's arg
Philippe De Muyter [Wed, 20 May 2015 15:50:21 +0000 (17:50 +0200)]
v4l2: add decoding for VIDIOC_S_CROP's arg

* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_S_CROP's arg.

9 years agoAdd support for Altera's Nios-II softcore architecture
Ezequiel Garcia [Sat, 18 Apr 2015 20:33:27 +0000 (17:33 -0300)]
Add support for Altera's Nios-II softcore architecture

This commit adds strace support for Altera's Nios-II.  The architecture
is supported by Linux since v3.19, and it implements the generic syscall
ABI.

* configure.ac: Add nios2 support.
* cacheflush.c [NIOS2] (sys_cacheflush): New function.
* linux/nios2/*: New Nios-II specific files.
* Makefile.am (EXTRA_DIST): Add them.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
9 years agov4l2: VIDIOC_CROPCAP: add missing braces around arg printout
Philippe De Muyter [Tue, 19 May 2015 21:54:21 +0000 (23:54 +0200)]
v4l2: VIDIOC_CROPCAP: add missing braces around arg printout

* v4l2.c (v4l2_ioctl): case VIDIOC_CROPCAP: add missing braces around arg
printout.

9 years agomaint: avoid effects of locale when sorting files
Dmitry V. Levin [Tue, 19 May 2015 18:00:07 +0000 (18:00 +0000)]
maint: avoid effects of locale when sorting files

* maint/ioctls_gen.sh: Invoke sort with LC_COLLATE=C.
* maint/ioctls_hex.sh: Likewise.
* maint/ioctls_sym.sh: Likewise.

Reported-by: Philippe De Muyter <phdm@macqel.be>
9 years agov4l2: add decoding for VIDIOC_CREATE_BUFS's arg.
Philippe De Muyter [Sat, 18 Apr 2015 13:06:43 +0000 (15:06 +0200)]
v4l2: add decoding for VIDIOC_CREATE_BUFS's arg.

* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_CREATE_BUFS's arg.

9 years agomips o32: decode indirect syscall
Dmitry V. Levin [Fri, 17 Apr 2015 09:14:19 +0000 (09:14 +0000)]
mips o32: decode indirect syscall

Implement decoding of MIPS O32 specific indirect syscall.

* syscall.c [LINUX_MIPSO32] (decode_mips_subcall, sys_syscall):
New functions.
(trace_syscall_entering) [LINUX_MIPSO32]: Use decode_mips_subcall.
* linux/mips/syscallent-o32.h (4000): Change sys_func to sys_syscall.

Reported-and-tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
9 years agodebian: add gawk to Build-Depends
Dmitry V. Levin [Tue, 14 Apr 2015 17:22:54 +0000 (17:22 +0000)]
debian: add gawk to Build-Depends

* debian/control (Build-Depends): Add gawk.
Patch by Reiner Herrmann <reiner@reiner-h.de>.

This fixes Debian bug #780992.

9 years agotests: fix bexecve.test for the case of mixed personalities
Dmitry V. Levin [Tue, 14 Apr 2015 16:04:08 +0000 (16:04 +0000)]
tests: fix bexecve.test for the case of mixed personalities

Fix bexecve.test when the executable being run does not match the
native architecture.

* tests/bexecve.test: Use "set_ptracer_any" instead of "sh".
Allow for a personality switch notification in the strace output.

9 years agotests: add a test for "resuming interrupted nanosleep"
Dmitry V. Levin [Tue, 7 Apr 2015 21:18:23 +0000 (21:18 +0000)]
tests: add a test for "resuming interrupted nanosleep"

* tests/restart_syscall.test: New test.
* tests/restart_syscall.expected: New file.
* tests/restart_syscall_unknown.expected: Likewise.
* tests/Makefile.am (TESTS): Add restart_syscall.test.
(EXTRA_DIST): Add restart_syscall.expected
(TEST_LOG_COMPILER): Change to "env".
(OS, ARCH, AM_TEST_LOG_FLAGS): Define.
and restart_syscall_unknown.expected.

9 years agotests: strip executable bit from *.expected files
Dmitry V. Levin [Tue, 7 Apr 2015 21:11:50 +0000 (21:11 +0000)]
tests: strip executable bit from *.expected files

9 years agoDeclare syscall parsers using SYS_FUNC macro
Dmitry V. Levin [Tue, 7 Apr 2015 01:36:50 +0000 (01:36 +0000)]
Declare syscall parsers using SYS_FUNC macro

Introduce SYS_FUNC macro to declare and define all syscall parsers.

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
(sys_func.h): New rule.
* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
* linux/syscall.h: Include "sys_func.h".
[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
Remove other declarations.
* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
and osf_fstatfs syscall parsers.
* *.c: Use SYS_FUNC to define syscall parsers.

9 years agoFix confusing "resuming interrupted unknown" message
Denys Vlasenko [Tue, 7 Apr 2015 10:46:59 +0000 (12:46 +0200)]
Fix confusing "resuming interrupted unknown" message

Dmitry reported seeing the following:

    $ sleep 2 & sleep 1; ./strace -erestart_syscall -p $!
    [1] 12345
    Process 12345 attached
    restart_syscall(<... resuming interrupted unknown ...>) = 0

Fixing it by replacing "unknown" with "system call".

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agotests: workaround old gawk versions that do not provide @include support
Dmitry V. Levin [Mon, 6 Apr 2015 23:40:13 +0000 (23:40 +0000)]
tests: workaround old gawk versions that do not provide @include support

Some of our tests use GNU awk @include extension, but not all currently
used versions of GNU awk support it.  Skip these tests if gawk does not
provide @include support.

* tests/init.sh (check_gawk): New function.
(match_awk): Use it.

9 years agotests: rewrite umovestr2.test without using grep
Dmitry V. Levin [Mon, 6 Apr 2015 22:17:28 +0000 (22:17 +0000)]
tests: rewrite umovestr2.test without using grep

The regular expression generated by umovestr2.c on systems with large
page size is too big for GNU grep.  Rewrite the test to use diff
instead of grep.

* tests/umovestr2.test: Use match_diff instead of match_grep.
* tests/umovestr2.c (main): Convert output from regexp to plain text.

9 years agoCleanup process_vm_writev syscall decoding
Dmitry V. Levin [Tue, 31 Mar 2015 21:00:39 +0000 (21:00 +0000)]
Cleanup process_vm_writev syscall decoding

* process_vm.c (sys_process_vm_writev): Do not check for syserror,
it is not applicable on entering syscall.

9 years agoumovestr: read chunks of memory up to pagesize at a time
Dmitry V. Levin [Tue, 31 Mar 2015 19:45:08 +0000 (19:45 +0000)]
umovestr: read chunks of memory up to pagesize at a time

* defs.h (get_pagesize): New prototype.
* mem.c (get_pagesize) Make global.
* util.c (PAGMASK): Remove.
(vm_read_mem): New process_vm_readv proxy function.
(umoven, umovestr): Use it.
(umovestr): Read chunks up to pagesize at a time.

9 years agoumovestr: fix short read bug
Dmitry V. Levin [Tue, 31 Mar 2015 18:52:57 +0000 (18:52 +0000)]
umovestr: fix short read bug

* util.c (umovestr): Check the right address.
* tests/umovestr.c: New file.
* tests/umovestr2.c: Likewise.
* tests/umovestr.expected: Likewise.
* tests/umovestr.test: New test.
* tests/umovestr2.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add umovestr and umovestr2.
(TESTS): Add umovestr.test and umovestr2.test.
(EXTRA_DIST): Add umovestr.expected.
* tests/.gitignore: Add umovestr and umovestr2.

Reported-by: Josef T. Burger <bolo@cs.wisc.edu>
9 years agoWhen process_vm_readv fails with EPERM, try PTRACE_PEEKDATA
Dmitry V. Levin [Mon, 30 Mar 2015 15:21:55 +0000 (15:21 +0000)]
When process_vm_readv fails with EPERM, try PTRACE_PEEKDATA

process_vm_readv() and ptrace(PTRACE_PEEKDATA) have inconsistent access
control rules wrt traced processes: process_vm_readv() is more likely to
fail with EPERM than ptrace(PTRACE_PEEKDATA) when tracing a process that
has execve'd a privileged executable.

* util.c (umoven, umovestr): If process_vm_readv returned EPERM,
fall back to ptrace(PTRACE_PEEKDATA).

Reported-by: Andrew Guertin <lists@dolphinling.net>
9 years agoUse macros for gcc attributes
Dmitry V. Levin [Sun, 29 Mar 2015 22:45:03 +0000 (22:45 +0000)]
Use macros for gcc attributes

* defs.h (error_msg, perror_msg, error_msg_and_die, perror_msg_and_die,
die_out_of_memory, printllval, printnum_int, printnum_long, tprintf):
Use ATTRIBUTE_* macros for gcc attributes.
* file.c (struct stat64): Likewise.
* statfs.c (struct compat_statfs64): Likewise.
* strace.c (die, exec_or_die, init): Likewise.
* linux/sparc/arch_sigreturn.c: Likewise.
* linux/ubi-user.h: Likewise.

9 years agoIntroduce macros for gcc attributes
Dmitry V. Levin [Sun, 29 Mar 2015 22:42:55 +0000 (22:42 +0000)]
Introduce macros for gcc attributes

Define macros for gcc attributes that are already in use
or going to be used soon.

* defs.h (GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): New macros.

9 years agoInclude <linux/ioctl.h> for _IOC_* macros
Felix Janda [Sat, 28 Mar 2015 17:40:13 +0000 (18:40 +0100)]
Include <linux/ioctl.h> for _IOC_* macros

Fix a compilation failure with musl libc.

* evdev.c: Include <linux/ioctl.h>.
* ioctl.c: Include <linux/ioctl.h> instead of <asm/ioctl.h>.
* ioctlsort.c: Likewise.

Reported-by: Dima Krasner <dima@dimakrasner.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
9 years agoInclude <sys/stat.h> for S_I* macros
Felix Janda [Sat, 28 Mar 2015 17:21:09 +0000 (18:21 +0100)]
Include <sys/stat.h> for S_I* macros

Fix a compilation failure with musl libc.

* mknod.c: Include <sys/stat.h>.
* printmode.c: Likewise.

Reported-by: Dima Krasner <dima@dimakrasner.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
9 years agosignal.c: move siginfo_t parsers to a separate file
Dmitry V. Levin [Fri, 27 Mar 2015 23:28:15 +0000 (23:28 +0000)]
signal.c: move siginfo_t parsers to a separate file

* printsiginfo.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (printsiginfo): Change second argument's type from int to bool.
* signal.c: Stop defining siginfo_t related constants.
Move inclusion of xlat/sig*_codes.h files to printsiginfo.c
(printsigsource, printsigval, printsiginfo_at): Move to printsiginfo.c.
(printsiginfo): Change second argument's type from int to bool,
split, and move to printsiginfo.c.

9 years agoUpdate siginfo_t constants
Dmitry V. Levin [Fri, 27 Mar 2015 22:51:51 +0000 (22:51 +0000)]
Update siginfo_t constants

* xlat/sigbus_codes.in: Add BUS_MCEERR_AR and BUS_MCEERR_AO,
add default values.
* xlat/sigtrap_codes.in: Add TRAP_BRANCH and TRAP_HWBKPT,
add default values.
* xlat/sigsegv_codes.in: Add SEGV_BNDERR, add default values.
* xlat/sigchld_codes.in: Add default values.
* xlat/sigemt_codes.in: Likewise.
* xlat/sigfpe_codes.in: Likewise.
* xlat/sigill_codes.in: Likewise.
* xlat/siginfo_codes.in: Likewise.
* xlat/sigpoll_codes.in: Likewise.
* xlat/sigsys_codes.in: Likewise.

9 years agosignal.c: move sigaltstack parser to a separate file
Dmitry V. Levin [Thu, 26 Mar 2015 13:03:25 +0000 (13:03 +0000)]
signal.c: move sigaltstack parser to a separate file

* sigaltstack.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (print_stack_t, sys_sigaltstack): Move to sigaltstack.c.
* xlat/sigaltstack_flags.in: Add default values.

9 years agoMove sparc64 get_scno() code where it belongs
Denys Vlasenko [Wed, 25 Mar 2015 14:22:49 +0000 (15:22 +0100)]
Move sparc64 get_scno() code where it belongs

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agosparc: rename personality 2 files to personality 1
Denys Vlasenko [Wed, 25 Mar 2015 14:11:36 +0000 (15:11 +0100)]
sparc: rename personality 2 files to personality 1

Run-tested in qemu 32-bit sparc.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agosparc: delete personality 1
Denys Vlasenko [Wed, 25 Mar 2015 13:16:08 +0000 (14:16 +0100)]
sparc: delete personality 1

Personality 1 for sparc and sparc64 appears to be an old attempt
to support stracing Solaris binaries.

It stalled after the only syscall, solaris_open, was covered:
all other solaris_foo's are printargs.

This change deletes personality 1. Now sparc is an one-personality
arch, and sparc64 is a two-personality one.

For clarity, pure renaming of personality 2 files to personality 1 for sparc64
is performed in the next commit - this prevents a state where syscallent1.h
seems to indergo a lot of changes, where in fact in is deleted, and then
replaced by syscallent2.h

Therefore, tree at this commit will not build.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoqemu_multiarch_testing/*: make it easier to do debug in sandboxes
Denys Vlasenko [Tue, 24 Mar 2015 19:54:26 +0000 (20:54 +0100)]
qemu_multiarch_testing/*: make it easier to do debug in sandboxes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agosparc: fix v4.10-25-g8497b62 fallout
Denys Vlasenko [Tue, 24 Mar 2015 18:39:47 +0000 (19:39 +0100)]
sparc: fix v4.10-25-g8497b62 fallout

Before:

$ sleep 3 & ./strace -p $!
Process 8703 attached
syscall: unknown syscall trap 1a800003 00025d58
syscall_516(0, 0x40080000, 0, 0xfc000f00, 0x28, 0xefc03b18) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

After:

$ sleep 3 & ./strace -p $!
Process 8725 attached
restart_syscall(<... resuming interrupted nanosleep ...>) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoget_scno: add diagnostics for invalid syscall numbers
Dmitry V. Levin [Tue, 24 Mar 2015 01:59:07 +0000 (01:59 +0000)]
get_scno: add diagnostics for invalid syscall numbers

* syscall.c (get_scno): Print a debug level message
for !SCNO_IS_VALID syscall numbers.

9 years agoarm: fix v4.10-25-g8497b62 fallout
Dmitry V. Levin [Mon, 23 Mar 2015 23:00:37 +0000 (23:00 +0000)]
arm: fix v4.10-25-g8497b62 fallout

Starting with commit v4.10-25-g8497b62,

arm$ ./strace true
pid 1234 stray syscall exit
Segmentation fault

Fix this by updating ARM syscall sanity check.
In particular, get_scno() should not set TCB_INSYSCALL flag because
other code assumes that s_ent is properly initialized when this flag
is set.

* linux/arm/get_scno.c: Check syscall number after fetching.
Do not apply the check to SCNO_IN_RANGE syscalls.
Do not set TCB_INSYSCALL flag.
Extend diagnostics and move it to debug level.

9 years agomips: fix pipe syscall decoding
Dmitry V. Levin [Mon, 23 Mar 2015 23:14:08 +0000 (23:14 +0000)]
mips: fix pipe syscall decoding

* linux/mips/arch_getrval2.c: New file.
* Makefile.am (EXTRA_DIST): Add it.
* defs.h [MIPS] (HAVE_GETRVAL2): Define.

9 years agosigreturn.c: split arch specific code into separate arch files
Dmitry V. Levin [Mon, 23 Mar 2015 21:16:07 +0000 (21:16 +0000)]
sigreturn.c: split arch specific code into separate arch files

Split code that use arch-specific registers to separate arch files.

* sigreturn.c (sys_sigreturn): Move arch-specific code
to linux/*/arch_sigreturn.c, include "arch_sigreturn.c".
* linux/arch_sigreturn.c: New file.
* Makefile.am (EXTRA_DIST): Add linux/arch_sigreturn.c
and linux/*/arch_sigreturn.c files.

9 years agosyscall.c: split arch specific code into separate arch files
Dmitry V. Levin [Sun, 22 Mar 2015 22:13:55 +0000 (22:13 +0000)]
syscall.c: split arch specific code into separate arch files

Split code that use arch-specific registers to separate arch files.

* syscall.c: Move definitions of variables containing fetched registers
to linux/*/arch_regs.c files.
[HAVE_GETRVAL2] (getrval2): Move arch-specific code
to linux/*/arch_getrval2.c, include "arch_getrval2.c".
(print_pc): Move arch-specific code to linux/*/print_pc.c files,
include "print_pc.c".
[X86_64] (x86_64_getregs_old): Rename to getregs_old, move to
linux/x86_64/getregs_old.c, include "getregs_old.c".
[POWERPC] (powerpc_getregs_old): Rename to getregs_old, move to
linux/powerpc/getregs_old.c, include "getregs_old.c".
(get_regs) [X86_64, POWERPC]: Update callers.
(get_scno): Move arch-specific code to linux/*/get_scno.c,
include "get_scno.c".
(get_syscall_args): Move arch-specific code
to linux/*/get_syscall_args.c, include "get_syscall_args.c".
(get_error): Move arch-specific code to linux/*/get_error.c,
include "get_error.c".
(get_syscall_result): Move arch-specific code
to linux/*/get_syscall_result.c, include "get_syscall_result.c".
* Makefile.am (EXTRA_DIST): Add new linux/*/*.c files.

9 years agosyscall.c: prepare for the split
Dmitry V. Levin [Sun, 22 Mar 2015 18:09:55 +0000 (18:09 +0000)]
syscall.c: prepare for the split

Move functions that use arch-specific registers to the end of file.

9 years agoMove get_regs error check from trace_syscall_entering to get_scno
Dmitry V. Levin [Mon, 23 Mar 2015 18:48:32 +0000 (18:48 +0000)]
Move get_regs error check from trace_syscall_entering to get_scno

Starting with commit v4.10-25-g8497b62, get_scno() can be called outside
trace_syscall_entering(), so move the get_regs_error check from
trace_syscall_entering() to get_scno().

* syscall.c (trace_syscall_entering): Move get_regs_error check ...
(get_scno): ... here.

9 years agoalpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding
Dmitry V. Levin [Mon, 23 Mar 2015 00:04:27 +0000 (00:04 +0000)]
alpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding

Fix pipe syscall decoding on alpha.
Fix pipe2 syscall decoding on ia64, sh, sparc, and sparc64.

* configure.ac (AC_CHECK_FUNCS): Add pipe2.
* defs.h [ALPHA || IA64 || SH || SPARC || SPARC64] (HAVE_GETRVAL2):
Define.
* net.c (do_pipe): Check HAVE_GETRVAL2 instead of architecture macros.
Do not use getrval2 for pipe2 decoding.
Print address if umove call fails.
* syscall.c (getrval2): Check HAVE_GETRVAL2 instead of architecture
macros.  Implement for [ALPHA].
* tests/pipe.c: New file.
* tests/pipe.expected: New file.
* tests/pipe.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pipe.
(TESTS): Add pipe.test.
(EXTRA_DIST): Add pipe.expected.
* tests/.gitignore: Add pipe.

9 years agodecode_socket_subcall: fetch all arguments with a single umoven call
Dmitry V. Levin [Sun, 22 Mar 2015 15:52:40 +0000 (15:52 +0000)]
decode_socket_subcall: fetch all arguments with a single umoven call

* syscall.c (decode_socket_subcall): Replace umoven fetch loop
with a single umoven call.

9 years agoNew test: test/many_looping_threads.c
Denys Vlasenko [Sat, 21 Mar 2015 19:59:39 +0000 (20:59 +0100)]
New test: test/many_looping_threads.c

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agotest/.gitignore: add missing test targets
Denys Vlasenko [Sat, 21 Mar 2015 19:19:02 +0000 (20:19 +0100)]
test/.gitignore: add missing test targets

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoTrivial optimization in sys_sigreturn()
Denys Vlasenko [Sat, 21 Mar 2015 19:11:53 +0000 (20:11 +0100)]
Trivial optimization in sys_sigreturn()

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoChange last parameter of umoven() from char* to void*
Denys Vlasenko [Sat, 21 Mar 2015 18:50:53 +0000 (19:50 +0100)]
Change last parameter of umoven() from char* to void*

Saves tons of casts.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoRemove unused struct tcb::inst field
Denys Vlasenko [Sat, 21 Mar 2015 18:30:53 +0000 (19:30 +0100)]
Remove unused struct tcb::inst field

It is unused since we dropped support for kernels without PTRACE_SETOPTIONS.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agotest/Makefile: add missing test targets
Denys Vlasenko [Sat, 21 Mar 2015 17:54:16 +0000 (18:54 +0100)]
test/Makefile: add missing test targets

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoMove the comment about termination logic where it belongs
Denys Vlasenko [Sat, 21 Mar 2015 17:40:53 +0000 (18:40 +0100)]
Move the comment about termination logic where it belongs

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agostartup_tcb() never fails, remove code which checks for failures
Denys Vlasenko [Sat, 21 Mar 2015 17:13:45 +0000 (18:13 +0100)]
startup_tcb() never fails, remove code which checks for failures

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agoShow the syscall name in "resuming interrupted call" message
Denys Vlasenko [Sat, 21 Mar 2015 16:51:52 +0000 (17:51 +0100)]
Show the syscall name in "resuming interrupted call" message

When signal is received, or if we have attached to a process,
current syscall (if process is in one) gets restarted.

Some syscalls are restarted via "restart_syscall()" mechanism.
On such sycalls, we don't show _which_ syscall gets restarted.

IOW: users want to see "resuming interrupted nanosleep"
instead of "resuming interrupted call" when they attach to "sleep 999".

Kernel does expose this information. The only thing we need is
to fetch syscall# on attach, and save it.

This patch does this. It adds tcp->s_prev_ent, which is
a pointer to struct_sysent of the previous syscall of this tracee.
It can be NULL.

sys_restart_syscall() is made to use it when the message is generated.

To similarly handle restart_syscall() *after signals*, not just
on attach, on each syscall exit patch saves exited syscall's data
in the same member (tcp->s_prev_ent).

Example:

    $ sleep 3 & strace -p $!
    Process 8728 attached
    restart_syscall(<... resuming interrupted nanosleep ...>) = 0
    _exit(0)                                = ?
    +++ exited with 0 +++

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
9 years agotests: add a test for mmap/mprotect/munmap decoding
Dmitry V. Levin [Thu, 19 Mar 2015 22:03:32 +0000 (22:03 +0000)]
tests: add a test for mmap/mprotect/munmap decoding

* tests/mmap.c: New file.
* tests/mmap64.c: New file.
* tests/mmap.test: New test.
* tests/mmap64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mmap and mmap64.
(mmap64_CFLAGS): Define.
(TESTS): Add mmap.test and mmap64.test.
* tests/.gitignore: Add mmap and mmap64.

9 years agosparc, sparc64: fix decoding of mmap2
Dmitry V. Levin [Thu, 19 Mar 2015 22:58:22 +0000 (22:58 +0000)]
sparc, sparc64: fix decoding of mmap2

* linux/sparc/syscallent.h (mmap2): Decode with sys_mmap_4koff,
not sys_mmap.
* linux/sparc64/syscallent2.h (mmap2): Decode with sys_mmap_pgoff,
not sys_mmap.

9 years agotests: add a test for SECCOMP_MODE_FILTER decoding
Dmitry V. Levin [Thu, 19 Mar 2015 00:40:49 +0000 (00:40 +0000)]
tests: add a test for SECCOMP_MODE_FILTER decoding

* tests/seccomp.c: New file.
* tests/seccomp.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add seccomp.
(TESTS): Add seccomp.test.
* tests/.gitignore: Add seccomp.

9 years agotests: factor out common awk code
Dmitry V. Levin [Wed, 18 Mar 2015 19:14:02 +0000 (19:14 +0000)]
tests: factor out common awk code

Factor out awk code used in several tests to match.awk.

* tests/match.awk: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/caps.awk: Use it.
* tests/getdents.awk: Likewise.
* tests/getrandom.awk: Likewise.
* tests/select.awk: Likewise.
* tests/sigaction.awk: Likewise.
* tests/init.sh (match_awk): Use gawk not awk.  Define AWKPATH.
* tests/getdents.test: Likewise.

9 years agotests: skip netlink based tests when resources are not available
Dmitry V. Levin [Wed, 18 Mar 2015 20:18:27 +0000 (20:18 +0000)]
tests: skip netlink based tests when resources are not available

* tests/netlink_inet_diag.c (main): Return 77 if socket, bind,
or listen syscall fail.
* tests/netlink_unix_diag.c (main): Likewise.

9 years agoaarch64, arm: decode extra padded compat struct statfs64
Dmitry V. Levin [Wed, 18 Mar 2015 16:32:04 +0000 (16:32 +0000)]
aarch64, arm: decode extra padded compat struct statfs64

According to arch/arm/kernel/sys_oabi-compat.c,
struct statfs64 has extra padding with EABI.

* statfs.c [AARCH64 || defined ARM] (COMPAT_STATFS64_PADDED_SIZE):
Define.
(do_statfs64_fstatfs64): New function, factored out from sys_statfs64.
[COMPAT_STATFS64_PADDED_SIZE]: Check it in addition to
sizeof(struct compat_statfs64).
(sys_statfs64, sys_fstatfs64): Use do_statfs64_fstatfs64.

Reported-and-tested-by: Elliott Hughes <enh@google.com>
9 years agotests: factor out common shell code to functions
Dmitry V. Levin [Tue, 17 Mar 2015 17:07:57 +0000 (17:07 +0000)]
tests: factor out common shell code to functions

Factor out shell code used in several tests to common functions.

* tests/fanotify_mark.expected: New file.
* tests/ioctl.expected: New file.
* tests/net-fd.expected: New file.
* tests/net.expected: New file.
* tests/statfs.expected: New file.
* tests/sun_path.expected: New file.
* tests/uio.expected: New file.
* tests/ipc.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add them.
* tests/init.sh (dump_log_and_fail_with, run_prog,
run_prog_skip_if_failed, run_strace, run_strace_merge,
match_awk, match_diff, match_grep): New functions.
* tests/*.test: Use them.

9 years agoShow f_flags field in printstatfs
Elliott Hughes [Tue, 17 Mar 2015 23:00:31 +0000 (16:00 -0700)]
Show f_flags field in printstatfs

printstatfs64 was right, but printstatfs was missing f_flags.
Noticed on aarch64.

* statfs.c (printstatfs) [_STATFS_F_FLAGS]: Print statfs.f_flags.

Signed-off-by: Elliott Hughes <enh@google.com>
9 years agotests/uid*: use fchown* instead of chown*
Dmitry V. Levin [Mon, 16 Mar 2015 18:10:21 +0000 (18:10 +0000)]
tests/uid*: use fchown* instead of chown*

Newer architectures have no chown syscall, so use fchown* syscalls
for testing printuid.

* tests/uid.test: Use fchown instead of chown.
* tests/uid.c: Test __NR_fchown instead of __NR_chown.
(main): Use __NR_fchown instead of __NR_chown.
* tests/uid32.c: Test __NR_fchown32 instead of __NR_chown32.
(main): Use __NR_fchown32 instead of __NR_chown32.
* tests/uid16.c: Test __NR_fchown and __NR_fchown32 instead
of __NR_chown and __NR_chown32.
(main): Use __NR_fchown instead of __NR_chown.
* tests/uid.awk: Update regexp.

9 years agostat64-v.test: add newfstatat syscall support
Dmitry V. Levin [Mon, 16 Mar 2015 17:18:40 +0000 (17:18 +0000)]
stat64-v.test: add newfstatat syscall support

Newer architectures have no stat syscall, so stat() is implemented there
using newfstatat syscall.

* tests/stat.c (STAT_FNAME): Rename to STAT_PREFIX.  Update callers.
[_FILE_OFFSET_BITS == 64] (STAT_PREFIX): Add newfstatat support.
(main) [!NR_stat]: Add newfstatat support.

Reported-by: Andreas Schwab <schwab@suse.de>
9 years agoaarch64: properly decode generic syscalls
Andreas Schwab [Thu, 12 Mar 2015 15:17:45 +0000 (16:17 +0100)]
aarch64: properly decode generic syscalls

* linux/aarch64/syscallent1.h: Don't override entries 277 to 1023.

9 years agotests: verify that all patterns match
Andreas Schwab [Wed, 11 Mar 2015 16:49:06 +0000 (17:49 +0100)]
tests: verify that all patterns match

* tests/ipc_msg.test: Count matches to verify that all patterns match.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.

9 years agoFix stat64 st_[acm]time decoding for personalities with 32-bit time_t
Dmitry V. Levin [Thu, 12 Mar 2015 16:59:01 +0000 (16:59 +0000)]
Fix stat64 st_[acm]time decoding for personalities with 32-bit time_t

STRUCT_STAT.st_[acm]time are declared as unsigned int for some
personalities, while time_t is signed.

* printstat.h (DO_PRINTSTAT): If st_[acm]time have the same size as int,
explicitly cast them to int.
* tests/stat64-v.test: Test that negative time_t is decoded properly.

Reported-by: Andreas Schwab <schwab@suse.de>
9 years agosemctl: fix indirect syscall decoding
Dmitry V. Levin [Wed, 11 Mar 2015 14:57:57 +0000 (14:57 +0000)]
semctl: fix indirect syscall decoding

On architectures where the semctl call is implemented by the ipc syscall
the 4th argument is passed by reference.

* ipc.c (sys_semctl): Handle the indirect ipc subcall case.
* tests/ipc_sem.c (main): Optionally match indirection
in the 4th argument of semctl calls.

Reported-by: Andreas Schwab <schwab@suse.de>
9 years agotests/ipc_*: match IPC_64 flag
Andreas Schwab [Wed, 11 Mar 2015 16:47:56 +0000 (17:47 +0100)]
tests/ipc_*: match IPC_64 flag

* tests/ipc_msg.c (main): Optionally match "IPC_64|" in the third
argument of the ipc call.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.

9 years agoFix crash in ipc_sem test
Andreas Schwab [Wed, 11 Mar 2015 11:33:30 +0000 (12:33 +0100)]
Fix crash in ipc_sem test

Properly use union semun as argument of semctl.

* tests/ipc_sem.c (main): Properly use union semun as argument of
semctl.  Don't handle EFAULT specially.
* tests/ipc_sem.test: Revert last change.

9 years agom68k: fix sigreturn decoding
Andreas Schwab [Wed, 11 Mar 2015 14:08:42 +0000 (15:08 +0100)]
m68k: fix sigreturn decoding

* sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
signal mask from the proper place.

9 years agoaarch64: fix ioctl decoding
Andreas Schwab [Thu, 12 Mar 2015 17:07:00 +0000 (18:07 +0100)]
aarch64: fix ioctl decoding

* linux/aarch64/ioctls_inc0.h: Rename from ioctls_inc1.h.
* linux/aarch64/ioctls_inc1.h: Rename from ioctls_inc0.h.
* linux/aarch64/ioctls_arch0.h: Rename from ioctls_arch1.h.
* linux/aarch64/ioctls_arch1.h: Rename from ioctls_arch0.h.

9 years agotests/select.test: handle architectures using pselect6 syscall
Andreas Schwab [Thu, 12 Mar 2015 15:47:38 +0000 (16:47 +0100)]
tests/select.test: handle architectures using pselect6 syscall

* tests/select.awk (BEGIN): Update regexps to match both select
and pselect6 syscalls.
* tests/select.test: Probe for both select and pselect6 syscall.

9 years agoDistribute linux/aarch64/arch_regs.h
Andreas Schwab [Thu, 12 Mar 2015 10:54:08 +0000 (11:54 +0100)]
Distribute linux/aarch64/arch_regs.h

* Makefile.am (EXTRA_DIST): Add linux/aarch64/arch_regs.h.

9 years agoFix decoding of mmap2 for arm
Andreas Schwab [Mon, 9 Mar 2015 15:55:06 +0000 (16:55 +0100)]
Fix decoding of mmap2 for arm

* syscallent.h (mmap2): Decode with sys_mmap_4koff, not
sys_mmap_pgoff.

9 years agom68k: define HAVE_SA_RESTORER
Andreas Schwab [Wed, 11 Mar 2015 13:15:34 +0000 (14:15 +0100)]
m68k: define HAVE_SA_RESTORER

On m68k the kernel sigaction structure has the sa_restorer member for
historical reasons.

* signal.c (HAVE_SA_RESTORER): Define for M68K.

9 years agoaarch64: fix rt_sigreturn decoding
Dmitry V. Levin [Wed, 11 Mar 2015 14:32:25 +0000 (14:32 +0000)]
aarch64: fix rt_sigreturn decoding

* sigreturn.c (sys_sigreturn) [AARCH64]: Fix personality check.

9 years agomaint: post-release administrivia
Dmitry V. Levin [Mon, 9 Mar 2015 22:05:40 +0000 (22:05 +0000)]
maint: post-release administrivia

* NEWS: Add header line for next release.

9 years agoPrepare for 4.10 release v4.10
Dmitry V. Levin [Fri, 6 Mar 2015 13:14:15 +0000 (13:14 +0000)]
Prepare for 4.10 release

* NEWS: Update for 4.10 release.
* debian/changelog: 4.10-1.
* strace.spec: 4.10-1.

9 years agoMove sigreturn/rt_sigreturn parser to a separate file
Dmitry V. Levin [Fri, 6 Mar 2015 01:47:18 +0000 (01:47 +0000)]
Move sigreturn/rt_sigreturn parser to a separate file

* sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprintsigmask_n): New prototype.
(tprintsigmask_addr): New macro.
* signal.c (sprintsigmask_n): Make global.
(tprintsigmask_addr): Remove.
(sys_sigreturn): Move to sigreturn.c.

9 years agoia64: use PTRACE_GETREGS to fetch registers
Dmitry V. Levin [Thu, 5 Mar 2015 23:30:02 +0000 (23:30 +0000)]
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.

9 years agos390, s390x: use PTRACE_GETREGSET to fetch registers
Dmitry V. Levin [Thu, 5 Mar 2015 22:10:15 +0000 (22:10 +0000)]
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.

9 years agoqemu_multiarch_testing: update
Dmitry V. Levin [Thu, 5 Mar 2015 19:36:52 +0000 (19:36 +0000)]
qemu_multiarch_testing: update

* qemu_multiarch_testing/README: Update statistics.

9 years agotests: robustify unix-yy.test
Dmitry V. Levin [Thu, 5 Mar 2015 17:30:23 +0000 (17:30 +0000)]
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.

9 years agoUse SIGRTMIN from kernel headers
Dmitry V. Levin [Thu, 5 Mar 2015 05:03:41 +0000 (05:03 +0000)]
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.

9 years agoppc64: fix compilation warning
Dmitry V. Levin [Thu, 5 Mar 2015 04:29:37 +0000 (04:29 +0000)]
ppc64: fix compilation warning

Fix compilation warning introduced by commit
577be2593d4895ef941e1c4e5e1608f7dd13610d

* signal.c (sys_sigreturn) [POWERPC64]: Fix initialization of signal
mask on 32bit personality.

9 years agoaarch64: fix compilation warnings
Dmitry V. Levin [Thu, 5 Mar 2015 04:10:52 +0000 (04:10 +0000)]
aarch64: fix compilation warnings

Fix compilation warnings introduced by commit
5b9b7e1d347eb4556084cdccad75e8247c535ed5:

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>
9 years agoi386: simplify sigreturn decoding
Dmitry V. Levin [Thu, 5 Mar 2015 01:14:33 +0000 (01:14 +0000)]
i386: simplify sigreturn decoding

* signal.c (sys_sigreturn) [X86_64 || X32 || I386]: Do not define
i386_sigcontext_struct and i386_fpstate structures.

9 years agotests: add a test for sigreturn/rt_sigreturn decoding
Dmitry V. Levin [Wed, 4 Mar 2015 12:31:18 +0000 (12:31 +0000)]
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.

9 years agosigreturn: print signal mask as a syscall argument
Dmitry V. Levin [Wed, 4 Mar 2015 23:55:25 +0000 (23:55 +0000)]
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.

9 years agoaarch64: implement rt_sigreturn decoding
Dmitry V. Levin [Wed, 4 Mar 2015 23:05:53 +0000 (23:05 +0000)]
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.

9 years agoarm: simplify sigreturn decoding
Dmitry V. Levin [Wed, 4 Mar 2015 22:27:35 +0000 (22:27 +0000)]
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.