summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Fix {get,set}rlimit decoding with unreliable SIZEOF_RLIM_THEADmasterJames Hogan2014-05-21
| | | | | | | | | | | | | | When strace is built with large file support definitions in CFLAGS (as may be provided by buildroot) the C library headers may expose a 64-bit rlim_t even though the struct rlimit fields used by the system call interface are only 32-bit. The SIZEOF_RLIM_T will then be 8 which results in bad decoding of the getrlimit and setrlimit syscalls. This is fixed by replacing unreliable SIZEOF_RLIM_T based checks with checks for current_wordsize. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Enhance setns syscall decodingMasatake YAMATO2014-05-13
| | | | | | | | | | * process.c (sys_setns): New function. Decode the 2nd syscall argument using clone_flags. * linux/syscall.h (sys_setns): New prototype. * linux/dummy.h (sys_setns): Remove. Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* mips: fix syscall entries that should have TP flag setDmitry V. Levin2014-05-12
|
* xtensa: fix unshare syscall entryDmitry V. Levin2014-05-12
|
* alpha, hppa, mips n64: fix waitid syscall entryDmitry V. Levin2014-05-12
|
* Add TM flag to shmat and shmdt syscall entriesDmitry V. Levin2014-05-12
|
* Alias sys_vfork to sys_forkDmitry V. Levin2014-05-12
| | | | | | | | | * process.c (sys_vfork): Remove. * linux/syscall.h (sys_vfork): Likewise. * linux/dummy.h (sys_vfork): Alias to sys_fork. * linux/alpha/syscallent.h: Fix vfork entry. * util.c (setbpt): Do not check for sys_vfork. * syscall.c (syscall_fixup_for_fork_exec): Likewise.
* epoll_ctl: fix EPOLL_CTL_DEL argument decodingDmitry V. Levin2014-04-17
| | | | | | | * desc.c (sys_epoll_ctl): Do not parse the event structure for EPOLL_CTL_DEL operation. Reported-by: Марк Коренберг <socketpair@gmail.com>
* Update CLOCK_* constantsDmitry V. Levin2014-04-17
| | | | | | * time.c (clocknames): Add CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM, CLOCK_BOOTTIME_ALARM, CLOCK_SGI_CYCLE, and CLOCK_TAI. Fixes RH#1088455.
* Fix preadv/pwritev offset decodingDmitry V. Levin2014-04-17
| | | | | | | | | | | | | | | | | | | | * util.c (printllval): Add align argument. * defs.h (printllval): Update prototype. (printllval_aligned, printllval_unaligned): New macros. * file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64, sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2, sys_fallocate): Replace printllval call with printllval_aligned. * io.c (sys_pread, sys_pwrite): Likewise. (sys_preadv, sys_pwritev): Replace printllval call with printllval_unaligned. * linux/arm/syscallent.h: Set the number of preadv and pwritev arguments to 5. * linux/mips/syscallent-o32.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/sh/syscallent.h: Likewise. * linux/xtensa/syscallent.h: Likewise. Reported-by: Dima Kogan <dima@secretsauce.net>
* tests: add a test for pread/pwrite and preadv/pwritev offset decodingDmitry V. Levin2014-04-16
| | | | | | | | * tests/uio.c: New file. * tests/uio.test: New test. * tests/Makefile.am (check_PROGRAMS): Add uio. (uio_CFLAGS): Define. (TESTS): Add uio.test.
* Refactor LDT decodingDmitry V. Levin2014-04-10
| | | | | | | | | | | | * configure.ac (AC_CHECK_TYPES): Remove struct user_desc. * ldt.c: New file. * Makefile.am (strace_SOURCES): Add ldt.c. * mem.c: Do not include <asm/ldt.h>. (print_ldt_entry): Remove. (sys_modify_ldt, sys_set_thread_area, sys_get_thread_area): Move... * ldt.c: ... here. * process.c: Do not include <asm/ldt.h>. (sys_clone) [I386 || X86_64 || X32]: Use print_user_desc.
* Make int3 example in comments more cut-n-pastableDenys Vlasenko2014-04-10
| | | | | | | | | I found that I use it quite often. Lets make it so that after cut-n-pasting it into a file, there is no need to edit the result (e.g. no need to remove C comment chars from every line. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* mips: enable decoding of set_thread_areaDmitry V. Levin2014-04-09
| | | | | * linux/dummy.h [MIPS]: Do not redirect sys_set_thread_area to printargs. * mem.c [MIPS] (sys_set_thread_area): Define.
* x86_64, x32: enable decoding of modify_ldt, get_thread_area, and set_thread_areaDmitry V. Levin2014-04-09
| | | | | * linux/dummy.h [X86_64 || X32]: Do not redirect sys_modify_ldt, sys_get_thread_area, and sys_set_thread_area to printargs.
* x32: decode clone LDT user_desc entries for x86 processesDmitry V. Levin2014-04-09
| | | | | | | | * mem.c [X32]: Include asm/ldt.h. [X32] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area, sys_get_thread_area): Define. * process.c [X32]: Include asm/ldt.h. (sys_clone) [X32]: Decode LDT entry if current_personality == 1.
* x86-64: decode clone LDT user_desc entries for x86 processesElliott Hughes2014-04-09
| | | | | | | | | | | * mem.c [X86_64]: Include asm/ldt.h. [X86_64] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area, sys_get_thread_area): Define. * process.c [X86_64]: Include asm/ldt.h. (sys_clone) [X86_64]: Decode LDT entry if current_personality == 1. Signed-off-by: Elliott Hughes <enh@google.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* x32: fix clone(2) argument order for x86 processesDmitry V. Levin2014-04-09
| | | | | | | Apply the same fix that was made for x86_64. * process.c [X32] (ARG_CTID, ARG_TLS): Take current personality into account.
* x86-64: fix clone(2) argument order for x86 processesElliott Hughes2014-04-09
| | | | | | | | | | | Without this patch, strace claims that parent_tidptr == tls, which is clearly wrong. It is expected that parent_tidptr == child_tidptr. * process.c [X86_64] (ARG_CTID, ARG_TLS): Take current personality into account. Signed-off-by: Elliott Hughes <enh@google.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* aarch64: Fix decoding of arm struct stat64Elliott Hughes2014-04-06
| | | | | | | | We need to handle this situation more like x86-64. 32-bit arm and i386 actually have a common struct stat64, except the arm one must not be packed. Additionally, on aarch64 the 32-bit personality is personality 0. Signed-off-by: Elliott Hughes <enh@google.com>
* ARM EABI: disable OABI support by defaultDmitry V. Levin2014-03-20
| | | | | | | | | OABI is rarely used in ARM EABI systems nowadays, so disable its support by default. Add --enable-arm-oabi option to enable ARM OABI support. * configure.ac: New option --enable-arm-oabi. * syscall.c (get_scno) [ARM]: Check ENABLE_ARM_OABI macro defined by configure instead of undocumented STRACE_KNOWS_ONLY_EABI macro.
* Fix stat decoding for LP64 bionicElliott Hughes2014-03-12
| | | | | | | | | Patch fb642bb6d63f7ffe2228bf48a6008bc8f56f67ff fixed building with HAVE_STAT64 for aarch64 with uapi kernel headers but not x86_64. The workaround needed to be applied to all LP64 architectures, not just aarch64. This patch fixes that and adds an explanatory comment. Signed-off-by: Elliott Hughes <enh@google.com>
* Decode protocol argument for PF_NETLINK socketsMasatake YAMATO2014-03-11
| | | | | | | | | | | * net.c (protocols): Rename to inet_protocols. [PF_NETLINK] (netlink_protocols): New xlat structure. (sys_socket): Rename protocols to inet_protocols. [PF_NETLINK]: Decode protocol argument using netlink_protocols. Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Cleanup socketpair decodingDmitry V. Levin2014-03-11
| | | | | | | | The only supported domain for socketpair syscall is AF_UNIX, so no decoding related to other domains is required for socketpair. * net.c (sys_socketpair): Remove support for PF_INET and PF_IPX domains, print the protocol argument as is.
* 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>
* aarch64: fix decoding of arm syscall numbersElliott Hughes2014-03-03
| | | | | | | | | | | If an aarch64 strace is tracing a process using the arm personality, it also needs to call the shuffle_scno function for the ARM-specific syscalls. * syscall.c (shuffle_scno): Define on AARCH64. (get_scno) [AARCH64]: Call shuffle_scno when the tracee is in 32-bit mode. Signed-off-by: Elliott Hughes <enh@google.com>
* Fix fcntl decodingDmitry V. Levin2014-03-03
| | | | | | | | | | | | | | | | Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined or not defined altogether. Do not assume that sizeof(off_t) < sizeof(long long) when F_SETLK64 is undefined. This change fixes build with musl libc on x86. * configure.ac: Define SIZEOF_OFF_T. * desc.c (USE_PRINTFLOCK64): New macro. (struct flock64, printflock64): Do not define on X32. (printflock): Replace X32 specific workaround with SIZEOF_OFF_T check. Fix printing off_t members of struct flock. (sys_fcntl): Use USE_PRINTFLOCK64.
* sys_fcntl: remove F_FREESP and F_FREESP64 supportDmitry V. Levin2014-03-01
| | | | | | | | | | F_FREESP and F_FREESP64 fcntl commands are not available in Linux and therefore the code implementing their decoding is useless. Besides that, F_FREESP64 decoding is too complicated to support. * desc.c (fcntlcmds): Remove F_FREESP and F_FREESP64. Remove F_FREESP64 from the check whether to define struct flock64. (sys_fcntl): Remove F_FREESP and F_FREESP64 support.
* 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>
* Fix decoding of arm struct stat64 by aarch64 strace.Elliott Hughes2014-02-28
| | | | | | | | | | | | aarch64's uapi header files have a struct stat but no struct stat64. To correctly decode a 32-bit process' s struct stat64 we need HAVE_STAT64, but then the build fails because there is no struct stat64. Luckily, the aarch64 struct stat is structurally equivalent to the arm struct stat64, so we can just reuse that. * file.c [AARCH64] (stat64): Define to stat. Signed-off-by: Elliott Hughes <enh@google.com>
* Remove obsolete ioctlsort.cDmitry V. Levin2014-02-28
| | | | | | | | | | The generic version of ioctlsort.c became obsolete after commit v4.6-240-g5afdf12 that removed its last non-Linux users. * ioctlsort.c: Remove. * Makefile.am (EXTRA_DIST): Remove ioctlsort.c. Reported-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 build with Bionic libcDmitry V. Levin2014-02-26
| | | | | | | | | | | | | | Add generic tests for fopen64 and fputs_unlocked functions to fix build with Bionic libc that does not provide them. * configure.ac (AC_CHECK_FUNCS): Add fopen64 and fputs_unlocked. * strace.c [_LARGEFILE64_SOURCE]: Use fopen instead of fopen64 if !HAVE_FOPEN64. Use fputs instead of fputs_unlocked if !HAVE_FPUTS_UNLOCKED. * vsprintf.c: Use fputs instead of fputs_unlocked if !HAVE_FPUTS_UNLOCKED. Reported-by: Elliott Hughes <enh@google.com>
* powerpc64: fix 64-bit process detection on embeddedJames Yang2014-02-25
| | | | | | | | * syscall.c (get_scno) [POWERPC64]: Fix 64-bit process detection on embedded powerpc. Signed-off-by: James Yang <james.yang@freescale.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Do not compile scsi ioctl decoding if <scsi/sg.h> is not availableDmitry V. Levin2014-02-25
| | | | | | | | | | | Add a generic test for <scsi/sg.h> availability to fix build with Bionic libc that does not provide <scsi/sg.h>. * configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h. * ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H. * scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H. Reported-by: Elliott Hughes <enh@google.com>
* Revert "Add support for Altera's Nios-II softcore architecture"Dmitry V. Levin2014-02-14
| | | | | | | | | | The patch originally submitted by Ezequiel García was OK, but I somehow managed to mangle it so that most of the patch was not applied. According to Ezequiel García, an architecture port based on the generic syscall ABI is in progress. This reverts commit 61e426e87ac81be4b4ff9de581635b4ea585624f.
* tests: tighten sigaction checkDmitry V. Levin2014-02-08
| | | | * tests/sigaction.awk: Check that input conatins all expected lines.
* 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.
* Check for SA_RESTORER definition in <asm/signal.h>Dmitry V. Levin2014-02-08
| | | | | | | | | | Kernel header <asm/signal.h> cannot be included from regular code because it conflicts with libc headers, but SA_RESTORER is needed in signal.c, so SA_RESTORER value is forwarded from <asm/signal.h> to config.h using a configure check. * configure.ac (ASM_SA_RESTORER): Define if SA_RESTORER is defined in <asm/signal.h>.
* 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.
* kexec: fix typoDmitry V. Levin2014-02-06
| | | | * kexec.c (print_kexec_segments) [SUPPORTED_PERSONALITIES == 1]: Fix typo.
* Add support for Altera's Nios-II softcore architectureEzequiel Garcia2014-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds strace support for Altera's Nios-II official kernel port as found in git://git.rocketboards.org/linux-socfpga.git Notice that this an out-of-tree kernel architectural port, and uses the legacy (non-generic) system call ABI. In particular, the port doesn't support PTRACE_GETREGSET, so the implementation is based on PTRACE_GETREGS. Given it's mandatory for new architectures to support the generic syscall ABI and PTRACE_GETREGSET, if the nios2 architecure is ever mainlined, the strace support will have to be re-factored accordingly. * linux/nios2/ioctlent.h.in: New file. * linux/nios2/syscallent.h: Likewise. * Makefile.am (EXTRA_DIST): Add linux/nios2/ioctlent.h.in and linux/nios2/syscallent.h. * configure.ac: Add NIOS2 to the list of supported architectures. * defs.h [NIOS2]: Use register reading system. * process.c (struct_user_offsets): Add NIOS2 support. * syscall.c (get_regs, get_scno, get_syscall_args, get_syscall_result, get_error): Likewise. * util.c (change_syscall): Likewise. * mem.c (sys_getpagesize): Define on NIOS2. * system.c [NIOS2] (sys_cacheflush, sys_nios2cmpxchg): New functions. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Implement add_key, keyctl, and request_key decodingDmitry V. Levin2014-02-05
| | | | | | | | | | * keyctl.c: New file. * linux/keyctl.h: Likewise. * Makefile.am (strace_SOURCES): Add keyctl.c. (EXTRA_DIST): Add linux/keyctl.h. * linux/dummy.h (sys_add_key, sys_keyctl, sys_request_key): Remove. * linux/syscall.h (sys_add_key, sys_keyctl, sys_request_key): New prototypes.
* Implement ioprio_get and ioprio_set decodingDmitry V. Levin2014-02-05
| | | | | | | * ioprio.c: New file. * Makefile.am (strace_SOURCES): Add ioprio.c. * linux/dummy.h (sys_ioprio_get, sys_ioprio_set): Remove. * linux/syscall.h (sys_ioprio_get, sys_ioprio_set): New prototypes.
* Implement finit_module decodingDmitry V. Levin2014-02-05
| | | | | | | * bjm.c (module_init_flags): New xlat structure. (sys_finit_module): New function. * linux/dummy.h (sys_finit_module): Remove. * linux/syscall.h (sys_finit_module): New prototype.
* Cleanup inotify syscalls decodingDmitry V. Levin2014-02-05
| | | | | | | | | | | * linux/inotify.h: New file. * file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch, sys_inotify_rm_watch, sys_inotify_init1): Move... * inotify.c: ... here. (inotify_modes): Rename to inotify_flags, convert to XLAT form. (inotify_init_flags): Convert to XLAT form. * Makefile.am (strace_SOURCES): Add inotify.c. (EXTRA_DIST): Add linux/inotify.h.