summaryrefslogtreecommitdiff
path: root/signal.c
Commit message (Collapse)AuthorAge
* printsiginfo: add SIGSYS decodingDmitry V. Levin2014-03-11
| | | | | | | * configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_syscall. * signal.c (SYS_SECCOMP): Define if not yet defined. (sigsys_codes): new xlat structure. (printsiginfo): Decode SIGSYS.
* Update siginfo codesDmitry V. Levin2014-03-11
| | | | * signal.c (siginfo_codes): Add SI_DETHREAD.
* Factor out printing of si_pid and si_uid members of siginfo_tDmitry V. Levin2014-03-11
| | | | | * signal.c (printsigsource): New function. (printsiginfo): Use it.
* Improve SI_TIMER decodingElliott Hughes2014-03-10
| | | | | | | | | Decode siginfo_t more clearly for si_code SI_TIMER. The 'pid' is actually a POSIX timer id, and the 'uid' is actually the overrun. Also factor out the si_value dumping so it's the same for every si_code. Signed-off-by: Elliott Hughes <enh@google.com>
* Add multi-personality support to struct old_sigaction decodingElliott Hughes2014-02-28
| | | | | | | | | | | struct sigaction is another structure that contains members whose size differs between 32-bit and 64-bit personalities. * signal.c [HAVE_SIGACTION] (old_sigaction32): New structure. [HAVE_SIGACTION] (decode_old_sigaction): Decode 32-bit struct old_sigaction on a 64-bit host. Signed-off-by: Elliott Hughes <enh@google.com>
* Add multi-personality support to stack_t decodingDmitry V. Levin2014-02-27
| | | | | | | | | stack_t is one of many structures that contain members whose size differs between 32-bit and 64-bit personalities. * signal.c (print_stack_t): Decode 32-bit stack_t on a 64-bit host. Reported-by: Elliott Hughes <enh@google.com>
* Rewrite signal mask decoding without sigset_tDmitry V. Levin2014-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sigset_t provided by libc is not quite convenient. In glibc, sigset_t is an array with space for 1024 bits, which is much more than required: all architectures supported by Linux have only 64 signals except MIPS, which has 128. In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than necessary. With this change, signal mask is decoded without use of intermediate sigset_t structure, which saves us some cpu cycles in case of glibc with its inflated sigset_t, and enables build with libcs where sigset_t is broken. Old implementation used to check each signal number in the given signal mask twice using sigismember(). New implementation is based on popcount and next_set_bit() so it's noticeably faster. * configure.ac: Check for __builtin_popcount. * signal.c: Ensure that NSIG >= 32. (sprintsigmask, sprintsigmask_long, printsigmask): Remove. (popcount32, sprintsigmask_n): New functions. (tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros. (print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask, sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use new signal mask decoding interface. * tests/sigaction.c (main): Add a test with almost filled signal mask. * tests/sigaction.awk: Update.
* Fix sigaction reporting on non-x86 architecturesDmitry V. Levin2014-02-08
| | | | | | | | | If SA_RESTORER is not defined by libc headers but defined by kernel headers, use the definition provided by kernel headers for proper sigaction decoding. * signal.c [!SA_RESTORER]: Define to ASM_SA_RESTORER if the latter is defined, regardless of architecure.
* arm: fix compilation warningDmitry V. Levin2014-02-07
| | | | | | | Fix "dereferencing type-punned pointer will break strict-aliasing rules" warning introduced by commit v4.8-54-g670b21b. * signal.c (sys_sigreturn) [ARM]: Avoid dereferencing type-punned pointers.
* Use XLAT_END macroDmitry V. Levin2014-02-05
| | | | | Automatically update all xlat structures using the following sed regexp: s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
* Use XLAT macroDmitry V. Levin2014-02-05
| | | | | | Automatically convert all xlat structures to XLAT form using the following sed regexp: s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
* mips: fix sigaction reportingChris Dearman2014-01-08
| | | | | | | | | | | | | | | | MIPS userland uses the same sigaction structure with a full signal mask for old_sigaction and new_sigaction and does does not have an sa_restorer field. These changes have been tested on MIPS O32 big/little endian, MIPS N64 big endian and x86-64. * signal.c (old_sigaction) [MIPS]: Add definition for MIPS. (decode_old_sigaction) [MIPS]: Print sa_mask according to its definition. (new_sigaction) [MIPS]: Add definition for MIPS. Signed-off-by: Chris Dearman <chris.dearman@imgtec.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Factor out struct sigaction printing codeDmitry V. Levin2014-01-08
| | | | | | | * signal.c [HAVE_SIGACTION] (decode_old_sigaction): New function. [HAVE_SIGACTION] (sys_sigaction): Use it. (decode_new_sigaction): New function. (sys_rt_sigaction): Use it.
* Delete old PTRACE_{PEEK,POKE}USR logicMike Frysinger2013-12-31
| | | | | | | | | | | The code base has settled on PTRACE_{PEEK,POKE}USER (with an E) and has logic in defs.h to make sure it's set sanely. Delete this old logic as the defs.h takes care of it now. * process.c: Delete PTRACE_PEEKUSR/PTRACE_POKEUSR defines. * signal.c: Likewise. * syscall.c: Delete PTRACE_PEEKUSR define. * util.c: Likewise.
* Use struct sigcontext instead of struct sigcontext_structDmitry V. Levin2013-11-12
| | | | | | | | * configure.ac (AC_CHECK_TYPES): Remove struct sigcontext_struct. * signal.c (sys_sigreturn) [S390 || S390X || POWERPC || ALPHA): Replace struct sigcontext_struct with struct sigcontext. Reported by John Spencer.
* Work around conflict between <sys/ptrace.h> and <linux/ptrace.h>Ali Polatel2013-09-26
| | | | | | | | | | | | | | | Since glibc-2.18~39 <sys/ptrace.h> defines ptrace_peeksiginfo_args which collides with <linux/ptrace.h>. * configure.ac: Check for `struct ptrace_peeksiginfo_args' in <sys/ptrace.h>. * process.c: Work around potential conflict between <sys/ptrace.h> and <linux/ptrace.h> by redefining ptrace_peeksiginfo_args. * signal.c: Likewise. * syscall.c: Likewise. * util.c: Likewise. Signed-off-by: Ali Polatel <alip@exherbo.org>
* Add support for ARC Cores from SynopsysVineet Gupta2013-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | Take #2 on mainlining strace support for ARC (last one was 4.6 based back in March 2011), see http://sourceforge.net/p/strace/mailman/message/27210168/ The syscall ABI is asm-generic/unistd.h based (so no legacy syscalls), hence very similar to metag port. test/* all seem to work well. * linux/arc/ioctlent.h.in: New file. * linux/arc/syscallent.h: Likewise. * Makefile.am (EXTRA_DIST): Add linux/arc/ioctlent.h.in and linux/arc/syscallent.h. * configure.ac: Add ARC to the list of supported architectures. * defs.h: Add ARC support. * process.c (struct_user_offsets): Likewise. * signal.c (sys_sigreturn): Likewise. * syscall.c (print_pc, get_regset, get_regs, get_scno, get_syscall_args, get_syscall_result, get_error): Likewise. * util.c (change_syscall): Likewise. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* x86, x86_64: fix compilation warningsDmitry V. Levin2013-09-11
| | | | | | | Fix "dereferencing type-punned pointer will break strict-aliasing rules" warnings introduced by commit v4.8-52-gb51f364. * signal.c (sys_sigreturn): Avoid dereferencing type-punned pointers.
* Remove rt parameter from [s]printsigmask()Denys Vlasenko2013-07-18
| | | | | | | | | | | | | | | | In almost all cases, the parameter was 1 ("decode RT sigs too"). This change hardwires it to be 1. The cases where it was 0 are, and why the change to "decode RT sigs too" is fine: IA64: 64-bit arch, all 64 signals fit in one word in any case. S390[x]: sc.oldmask is a sigset_t on kernel side, (sigset_t *)&sc.oldmask[0] does contain all 64 signals. TILE: uc.uc_sigmask is a sigset_t on kernel side, memcpy(&sigm, &uc.uc_sigmask, NSIG / 8) copies all 64 signals. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Convert some uses of long_to_sigmask+printsigmask to sprintsigmask_longDenys Vlasenko2013-07-18
| | | | | | | This allows to drop long_to_sigmask function, and a whole bunch of sigset_t variables. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Simplify some sigmask manipulationsDenys Vlasenko2013-07-18
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Fix sigset printing via print_sigset().Denys Vlasenko2013-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace print_sigset() with print_sigset_addr_len(), which takes not only addr, but also len parameter. This allows us to drop "do we need to print RT signals?" parameter, and this fixes RT signals printing in many syscalls. sys_epoll_pwait: print RT signals too, print sigmask size argument. sys_sigprocmask: print_sigset -> print_sigset_addr_len(current_wordsize), no change in functionality. sys_sigpending: use print_sigset_addr_len(current_wordsize) instead of open-coding it. sys_rt_sigprocmask: use print_sigset_addr_len instead of open-coding it. sys_rt_sigpending: ditto. sys_rt_sigsuspend: ditto. sys_rt_sigtimedwait: ditto. do_signalfd: print_sigset -> print_sigset_addr_len. This fixes RT signals printing (wasn't showing them before). sys_ppoll: ditto. copy_sigset_len() is folded into its only user, print_sigset_addr_len(), and copy_sigset() is gone. While at it, checked kernel sources and noted where kernel enforces sigset_size == NSIG / 8 (== sizeof(kernel_sigset_t)), and where it allows word-sized sigset_size ([rt_]sigpending). Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* sys_rt_sigaction: fix sigset copyingDenys Vlasenko2013-07-18
| | | | | | | | | | | | In practice, we always copy as many bytes as syscall param says (8, or 16 on mips). However, malicious program can call sigaction with wrong sigset size. Such syscall will result in EINVAL, but we (strace) end up copying 128 bytes (sizeof(sigset_t)), which copyes some garbage from stack after struct sigaction. Now we always copy NSIG / 8 bytes (which is 8 bytes, or 16 on mips). Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* ARM: remove wrong NSIG = 32 defineDenys Vlasenko2013-07-18
| | | | | | | | | | | | | | | | | | | | | | | | ARM in fact has 64 signals (1..64), and NSIG should be 65 (as usual, rememebr that NSIG_libc == NSIG_kernel+1). I carefully reviewed all usages of NSIG. In syscall.c, the only usage is: for (i = 0; i <= NSIG; i++) if (strcasecmp(s, signame(i) + 3) == 0)... which is safe even if NSIG is way too big - signame(i) returns a well-formed string for any i. In signal.c, memcpy(&sigset, &sc.sc_mask, NSIG / 8) is used by IA64 and TILE code, so ARM change can't affect it. And final usage is: struct new_sigaction::unsigned long sa_mask[NSIG / sizeof(long)]; It will grow on ARM (and become correct in the process). Its only use is memcpy(&sigset, &sa.sa_mask, NSIG / 8); printsigmask(&sigset, 1); which used to copy garbage in high bits, now it will copy actual data. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* ARM: fix sigreturn decodingDenys Vlasenko2013-07-17
| | | | | | | | | | Decoding of test/sigreturn testcase: Was: sigreturn() (mask [QUIT TRAP ABRT BUS SEGV USR2 PIPE STKFLT STOP XCPU VTALRM PROF WINCH IO PWR RTMIN]) = 0 Now: sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Improve sigreturn decoding on x86 to show RT signal bits too.Denys Vlasenko2013-07-16
| | | | | | | | | This includes decoding of 32-bit sigreturn by 64-bit strace, which previously wasn't done. Added a test for it. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Change upeek() to take pid, not full tcp.Denys Vlasenko2013-06-28
| | | | | | This will be used by next change. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* powerpc: Use PTRACE_GETREGS to fetch all registersAnton Blanchard2013-06-26
| | | | | | | | | | | | * defs.h: declare ppc_regs and get_regs_error. * signal.c (sys_sigreturn): Use ppc_regs instead of upeek. * syscall.c: define ppc_regs. (printcall): Use ppc_regs instead of upeek. (get_scno): Replace multiple upeek calls with one PTRACE_GETREGS call. (get_syscall_result): Likewise. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* tile: use siginfo_t, not struct siginfoChris Metcalf2013-05-23
| | | | | | | | As of glibc 2.16, "struct siginfo" is no longer supported, and "siginfo_t" must be used instead. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Add support for the XTENSA architectureChris Zankel2013-03-25
| | | | | | | | | | | | | | * configure.ac: Add XTENSA to the list of supported architectures. * defs.h: Add XTENSA support. * linux/xtensa/syscallent.h: New file. * linux/xtensa/ioctlent.h.in: Likewise. * process.c (struct_user_offsets): Add XTENSA support. * signal.c (sys_sigreturn): Likewise. * syscall.c (printcall, get_scno, get_syscall_args, get_syscall_result, get_error): Likewise. * util.c (change_syscall): Likewise. Signed-off-by: Chris Zankel <chris@zankel.net>
* Mass replace error_msg("%s", "literal") -> error_msg("literal")Denys Vlasenko2013-02-26
| | | | | | | There is no need to print literal strings through "%s". Only untrusted strings such as filenames need that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Finish prefixing regs struct names with arch_Denys Vlasenko2013-02-16
| | | | | | | | | | * defs: Rename regs -> sparc_regs. * signal.c (sys_sigreturn): Use new variable name. * syscall.c: Rename regs -> sparc_regs, regs -> avr32_regs. (getrval2): Use new variable names. (printcall): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Macroize conditional signed widening operationDenys Vlasenko2013-02-15
| | | | | | | | | * defs.h: Define widen_to_long() macro. * signal.c (sys_kill): Use it instead of open-coding it. (sys_tgkill): Use widen_to_long() on pids. * resource.c (decode_rlimit): Formatting fix. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Factor out code to check addr, fetch and print siginfoDenys Vlasenko2013-02-13
| | | | | | | | | | | * defs.h: Declare new function printsiginfo_at(tcp, addr). * process.c (sys_waitid): Use printsiginfo_at(). (sys_ptrace): Likewise. * signal.c: (printsiginfo_at): Implement this new function. (sys_rt_sigsuspend): Use printsiginfo_at(). (sys_rt_sigtimedwait): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove unused / ambiguously used definesDenys Vlasenko2013-02-12
| | | | | | | | | | | | | | | | We sometimes use LINUXSPARC and sometimes (more often) use "defined(SPARC) || defined(SPARC64)". Better to use one construct consistently. LINUX_MIPS64 is altogether unused. * defs.h: Remove LINUXSPARC and LINUX_MIPS64 defines. Move PTRACE_xxx compat defines up, before arch-specific machinery. Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC. * file.c: Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC. * signal.c: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix sigaltstack decoderDmitry V. Levin2013-02-09
| | | | | | | | | | | strace used to hang when decoding sigaltstack called with invalid stack_t pointers because of mishandling umove() return code. * signal.c (print_stack_t): Handle unfetchable stack_t properly. Change return type to void. (sys_sigaltstack): Update print_stack_t() usage. Reported-by: kawillia@ucalgary.ca
* If we are on a glibc system, assume it's at least glibc 2.1Denys Vlasenko2013-02-08
| | | | | | | | | | | It is not likely anyone uses glibc older that that: glibc 2.1.1 was released in 1999 * net.c: Remove test for glibc >= 2.1. * signal.c: Remove code which is compiled only for glibc < 2.1. * util.c: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove vestigial hacks around non-Linux struct sigactionsDenys Vlasenko2013-02-08
| | | | | | | | | * signal.c: Stop using __sighandler_t glibc'ism. Remove SA_HANDLER macro. Explain why we can't use "sa_handler" as a field name. (sys_sigaction): Use __sa_handler instead of SA_HANDLER macro. (sys_rt_sigaction): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Rename ARM's regs structure to arm_regsDenys Vlasenko2013-02-06
| | | | | | | | | | | | | | | Compile-tested. * defs.h: Rename regs structure to arm_regs. * syscall.c: Likewise. (printcall): Use new name instead of old one. (get_regs): Likewise. (get_scno): Likewise. (get_syscall_args): Likewise. (get_error): Likewise. * signal.c (sys_sigreturn): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Add tilegx support to straceChris Metcalf2013-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tilegx support has been in the kernel since 3.0. In addition, fix some issues with the tilepro support already present in strace, primarily the decision to use the <asm/unistd.h> numbering space for system calls. * defs.h [TILE]: Include <asm/ptrace.h> and provide an extern struct pt_regs tile_regs for efficiency. Provide compat 32-bit personality via SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE, PERSONALITY1_WORDSIZE, and DEFAULT_PERSONALITY. * linux/tile/errnoent1.h: New file, includes linux/errnoent.h. * linux/tile/ioctlent1.h: New file, includes linux/ioctlent.h. * linux/tile/signalent1.h: New file, includes linux/signalent.h. * linux/tile/syscallent.h: Update with new asm-generic syscalls. The version previously committed was the from the first tile patch to LKML, which subsequently was changed to use <asm-generic/unistd.h>. * linux/tile/syscallent1.h: Copy from linux/tile/syscallent.h. * mem.c (addtileflags) [TILE]: use %ld properly for a "long" variable. * process.c [TILE]: Choose clone arguments correctly and properly suppress all "struct user" related offsets in user_struct_offsets. * signal.c [TILE]: Use tile_regs not upeek. * syscall.c (update_personality) [TILE]: Print mode. (PT_FLAGS_COMPAT) [TILE]: Provide if not in system headers. (tile_regs) [TILE]: Define 'struct pt_regs' variable to hold state. (get_regs) [TILE]: use PTRACE_GETREGS to set tile_regs rather than using upeek. (get_scno) [TILE]: Set personality. (get_syscall_args) [TILE]: Use tile_regs. (get_syscall_result) [TILE]: Update tile_regs. (get_error) [TILE]: Use tile_regs. (printcall) [TILE]: Print pc. (arg0_offset, arg1_offset, restore_arg0, restore_arg1) [TILE]: Properly handle tile call semantics and support tilegx. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Optimize out PTRACE_PEEKUSER with -iDenys Vlasenko2013-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strace -i was fetching PC with a separate PEEKUSER despite having GETREGS data: ptrace(PTRACE_GETREGS, 22331, 0, 0x8087f00) = 0 ptrace(PTRACE_PEEKUSER, 22331, 4*EIP, [0x80dd7b7]) = 0 write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82 ptrace(PTRACE_SYSCALL, 22331, 0, SIG_0) = 0 Now it does this: ptrace(PTRACE_GETREGS, 22549, 0, 0x8087ea0) = 0 write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82 ptrace(PTRACE_SYSCALL, 22549, 0, SIG_0) = 0 Analogous improvement in sys_sigreturn() is also implemented. * defs.h: Declare extern struct pt_regs regs for SPARC[64] and ARM. Declare clear_regs(), get_regs() and get_regs_error flag variable. * strace.c (trace): Call get_regs(pid) as soon as we know the tcb and that it is stopped. * syscall.c (get_regs): New function. Used to fetch registers early, just after tracee has stopped. (printcall): Move it here from util.c. Use global regs.REG data, if available on the arch, instead of re-fetching it. (get_scno): Use global regs.REG data. (get_syscall_result): Likewise. * signal.c (sys_sigreturn): Likewise. * util.c (printcall): Moved to syscall.c. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix glibc version checksJohn Spencer2012-12-06
| | | | | * util.c: Check if __GLIBC__ is defined before using it. * signal.c: Likewise. Fix __GLIBC_MINOR__ checks.
* Use perror_msg instead of perrorDmitry V. Levin2012-09-28
| | | | | | | * signal.c (sys_sigreturn): Use perror_msg instead of perror. * strace.c (tprintf, tprints, detach, startup_attach): Likewise. * syscall.c (get_scno): Likewise. * util.c (umoven, umovestr): Likewise.
* Make x86-64 build free of artificial warningsDmitry V. Levin2012-05-15
| | | | | * signal.c (sys_sigreturn): Do not issue "no sys_sigreturn" warning on X86_64.
* Cast clock_t type to unsigned long longH.J. Lu2012-04-17
| | | | | * resource.c (sys_times): Cast clock_t type to unsigned long long. * signal.c (printsiginfo): Likewise.
* Add x32 support to straceH.J. Lu2012-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with 32bit pointers. At system call level, x32 is also identical to x86-64, as shown by many changes like "defined(X86_64) || defined(X32)". The main differerence bewteen x32 and x86-64 is off_t in x32 is long long instead of long. This patch adds x32 support to strace. Tested on Linux/x32. * configure.ac: Support X32. * defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64, Set PERSONALITY2_WORDSIZE to 4 for X86_64. Add tcb::ext_arg for X32. * file.c (stat): New for X32. (sys_lseek): Use 64-bit version for X32. (printstat64): Check current_personality != 1 for X86_64. * ipc.c (indirect_ipccall): Check current_personality == 1 for X86_64. * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL for zero address. Call printllval for offset for X32. * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for X32. * process.c (ARG_FLAGS): Defined for X32. (ARG_STACK): Likewise. (ARG_PTID): Likewise. (change_syscall): Handle X32. (struct_user_offsets): Support X32. (sys_arch_prctl): Likewise. * signal.c: Include <asm/sigcontext.h> for X32. (SA_RESTORER): Also define for X32. * syscall.c (update_personality): Support X32 for X86_64. (is_restart_error): Likewise. (syscall_fixup_on_sysenter): Likewise. (get_syscall_args): Likewise. (get_syscall_result): Likewise. (get_error): Likewise. (__X32_SYSCALL_BIT): Define if not defined. (__X32_SYSCALL_MASK): Likewise. (get_scno): Check DS register value for X32. Use __X32_SYSCALL_MASK on X32 system calls. * util.c (printllval): Use ext_arg for X32. (printcall): Support X32. (change_syscall): Likewise. (arg0_offset): Likewise. (arg1_offset): Likewise. * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h, linux/x32/ioctlent.h.in, linux/x32/signalent.h, linux/x32/syscallent.h, linux/x86_64/errnoent2.h, linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and linux/x86_64/syscallent2.h. * linux/x32/errnoent.h: New. * linux/x32/ioctlent.h.in: Likewise. * linux/x32/signalent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/errnoent2.h: Likewise. * linux/x86_64/ioctlent2.h: Likewise. * linux/x86_64/signalent2.h: Likewise. * linux/x86_64/syscallent2.h: Likewise. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Optimize code if we have only one personalityDenys Vlasenko2012-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On i386: text data bss dec hex filename 238025 672 18980 257677 3ee8d strace.before 237389 704 18944 257037 3ec0d strace * defs.h: Define PERSONALITY0_WORDSIZE as sizeof(long) if not defined. Introduce new define, current_wordsize as (personality_wordsize[current_personality]). Make set_personality() no-op, current_personality constant zero, current_wordsize as PERSONALITY0_WORDSIZE if we have only one personality. * count.c (call_summary): Use current_wordsize instead of personality_wordsize[current_personality]. * desc.c (printflock): Likewise. * file.c (sys_utime): Likewise. * io.c (tprint_iov): Likewise. * process.c (printargv): Likewise. * resource.c (decode_rlimit): Likewise. * signal.c (sys_kill): Likewise. (sys_rt_sigaction): Likewise. * time.c (sprinttv): Likewise. (sprint_timespec): Likewise. (printitv_bitness): Likewise. (tprint_timex): Likewise. (printsigevent): Likewise. * util.c (dumpiov): Likewise. (umoven): Likewise. (umovestr): Likewise. * syscall.c: Initialize sysent to sysent0 etc. Make current_personality, personality_wordsize[], set_personality() conditional on SUPPORTED_PERSONALITIES > 1. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Reindent case labels. No code changesDenys Vlasenko2012-03-17
| | | | | | | * net.c (printsockopt): Reindent case labels. * signal.c (sys_signal): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Tidy up includes and copyright notices, fix indentationDenys Vlasenko2012-03-16
| | | | | | | | | | | | | | | The files not mentioned in changelog below had only copyright notices fixes and indentation fixes. * defs.h: Include <stdint.h> and <inttypes.h>. * file.c: Do not include <inttypes.h>. Move struct kernel_dirent declaration below top include block. * block.c: Do not include <stdint.h> and <inttypes.h>. * quota.c: Likewise. * desc.c: Likewise. * signal.c: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* arm: fix compilation warningsDmitry V. Levin2012-03-15
| | | | | | | * configure.ac: Define SIZEOF_LONG. * signal.c (sys_rt_sigaction) [SUPPORTED_PERSONALITIES > 1]: Help compiler to optimize out unreachable code that is not expected to work on platforms where sizeof(long) <= 4.