summaryrefslogtreecommitdiff
path: root/ipc.c
Commit message (Collapse)AuthorAge
* Fix sys_semtimedop decoding on s390xStanislav Brabec2012-12-15
| | | | | | | | | | The s390 and s390x pass semtimedop arguments differently from other architectures. sys_semtimedop parser was fixed for s390 by commit v4.6-177-ge0f5fd8, and s390x requires the same fix. * linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390x. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* sys_semtimedop: fix timeval argument index in wrapped callStanislav Brabec2012-12-08
| | | | | | | | | | | | | | | | | | | | | | | | Looking at the implementation of wrapped semtimedop() call inside glibc and kernel, I started to believe that timeval should be located in tcp->u_arg[4] and not tcp->u_arg[5]. Fortunately, tcp->u_arg[5] now works correctly as well, due to side effects of decode_ipc_subcall(). declaration in header: int semtimedop(semid, *sops, nsops, *timeout); 0 1 2 3 sys_ipc arguments in glibc on all patforms except s390*: semid, (int) nsops, 0, CHECK_N (sops, nsops), timeout 0 1 2 3 4 We have to use indexes: 0 3 1 4 sys_ipc arguments on s390*: semid, (int) nsops, timeout, sops 0 1 2 3 We have to use indexes: 0 3 1 2 * ipc.c (sys_semtimedop) [!S390]: Fix timeval argument index in indirect_ipccall case.
* Add AArch64 support to straceSteve McIntyre2012-10-26
| | | | | | | | | | | | | | | | | | | AArch64 has been included in linux from 3.7 onwards. Add support for AArch64 in strace, tested on linux in a simulator. * configure.ac: Support AArch64. * defs.h [AARCH64]: Include <sys/ptrace.h>, define TCB_WAITEXECVE. * ipc.c (indirect_ipccall): Support AArch64. * process.c (struct_user_offsets): Likewise. * syscall.c [AARCH64]: Include <asm/ptrace.h>, <sys/uio.h>, and <elf.h>. Define struct user_pt_regs regs. (get_scno, get_syscall_result): Support AArch64 using PTRACE_GETREGSET. (get_syscall_args, get_error): Support AArch64. * linux/aarch64/ioctlent.h.in: New file. * linux/aarch64/syscallent.h: New file, based on linux 3.7 version of asm-generic/unistd.h. Signed-off-by: Steve McIntyre <steve.mcintyre@linaro.org>
* 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>
* 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>
* Fix IPC decoding on alpha and armDmitry V. Levin2012-03-15
| | | | | * ipc.c (indirect_ipccall): Return 0 on ALPHA and ARM EABI. (sys_shmat): Use indirect_ipccall for proper return value decoding.
* Compress blank linesDmitry V. Levin2012-02-25
| | | | | | Suppress repeated empty lines left after automated code removal. This change was made by filtering every source code file through "cat -s".
* Cleanup after non-Linux code removal.Denys Vlasenko2012-02-25
| | | | | | | | | Conditions such as defined(LINUX) are always true now, defined(FREEBSD) etc are always false. When if directive has them as subexpressions, it can be simplified. Another trivial changes here are fixes for directive indentation. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Automated removal of non-Linux codeDenys Vlasenko2012-02-25
| | | | | | | | | | This change is generated by running every source through the following command: unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD -USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS -UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Do not use SYS_ipc and SYS_socketcallDmitry V. Levin2012-02-20
| | | | | | | | | | | | | | | | * linux/dummy.h (sys_ipc, sys_socketcall): Remove redirections to printargs. * linux/ia64/syscallent.h: Likewise. * linux/i386/syscallent.h: Remove native_scno initialization for "ipc" and "socketcall". * linux/syscall.h (sys_ipc, sys_socketcall): New prototypes. (SYS_ipc, SYS_socketcall): Remove no longer used constants. [IA64]: Remove undefining of ipc and socket SYS_* constants. [SPARC || SPARC64]: Remove unused ipc SYS_* constants. * ipc.c (sys_ipc): New function. * sock.c (sys_socketcall): Likewise. * syscall.c (trace_syscall_entering): Use sys_func to check for ipc and socket subcalls.
* Cast to long for %l in printfH.J. Lu2012-02-06
| | | | | | | | | | | Cast a value to long for %l in printf to avoid compiler warning on systems where it may be long long. * count.c (call_summary_pers): Cast to long. * ipc.c (sys_mq_open, printmqattr): Likewise. * quota.c (decode_cmd_data): Likewise. * resource.c (sys_sysinfo): Likewise. * time.c (tprint_timex): Likewise.
* Fix sys_ipc/sys_semtimedop decoding on s390Heiko Carstens2011-12-01
| | | | | | | | | | | | | | | | | | The s390 kernel sys_ipc system call only takes five arguments instead of six arguments which the common code sys_ipc implementation takes. One of the arguments of the sys_semtimedop subcall is therefore passed in a different register than in the common code implementation. This leads to broken decoding of the timespec argument: semtimedop(0, 0x3ffffb43832, 1, {...}) = -1 EAGAIN Fixed it looks like this: semtimedop(0, 0x3ffffc2c842, 1, {0, 10000000}) = -1 EINTR * linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
* Use tprints with literal strings, it may be faster than tprintfDenys Vlasenko2011-09-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | * bjm.c: Replace tprintf("str") with tprints("str"). * block.c: Likewise. * desc.c: Likewise. * file.c: Likewise. * io.c: Likewise. * ipc.c: Likewise. * mem.c: Likewise. * net.c: Likewise. * proc.c: Likewise. * process.c: Likewise. * quota.c: Likewise. * resource.c: Likewise. * scsi.c: Likewise. * signal.c: Likewise. * sock.c: Likewise. * strace.c: Likewise. * stream.c: Likewise. * syscall.c: Likewise. * system.c: Likewise. * term.c: Likewise. * time.c: Likewise. * util.c: Likewise. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Whitespace cleanups. no code changes.Denys Vlasenko2011-06-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bjm.c: Fix tabulation (such as extra spaces before tabs), convert punctuation where it deviates from prevalent form elsewhere in strace code, convert sizeof and offsetof where it deviates from from prevalent form, remove space between function/macro/array names and (parameters) or [index], add space between "if" and (condition), correct non-standard or wrong indentaion. * defs.h: Likewise * desc.c: Likewise * file.c: Likewise * ipc.c: Likewise * linux/arm/syscallent.h: Likewise * linux/avr32/syscallent.h: Likewise * linux/hppa/syscallent.h: Likewise * linux/i386/syscallent.h: Likewise * linux/ioctlsort.c: Likewise * linux/m68k/syscallent.h: Likewise * linux/microblaze/syscallent.h: Likewise * linux/powerpc/syscallent.h: Likewise * linux/s390/syscallent.h: Likewise * linux/s390x/syscallent.h: Likewise * linux/sh/syscallent.h: Likewise * linux/sh64/syscallent.h: Likewise * linux/tile/syscallent.h: Likewise * linux/x86_64/syscallent.h: Likewise * mem.c: Likewise * net.c: Likewise * pathtrace.c: Likewise * process.c: Likewise * signal.c: Likewise * sock.c: Likewise * strace.c: Likewise * stream.c: Likewise * sunos4/syscall.h: Likewise * sunos4/syscallent.h: Likewise * svr4/syscall.h: Likewise * svr4/syscallent.h: Likewise * syscall.c: Likewise * system.c: Likewise * test/childthread.c: Likewise * test/leaderkill.c: Likewise * test/skodic.c: Likewise * time.c: Likewise * util.c: Likewise Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* "Modernize" all old-style function parameter declarationsDenys Vlasenko2011-05-30
| | | | | | | | | | | | | | | | | | | | * bjm.c: Convert all remaining old-style C function definitions to a "modern" form. This does not change any actual code. * io.c: Likewise * ioctl.c: Likewise * net.c: Likewise * proc.c: Likewise * process.c: Likewise * signal.c: Likewise * sock.c: Likewise * strace.c: Likewise * stream.c: Likewise * syscall.c: Likewise * system.c: Likewise * time.c: Likewise * util.c: Likewise Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Fix msgsnd indirect ipccall decodingDmitry V. Levin2010-03-31
| | | | | | | This regression was introduced by commit v4.5.18-136-g783f5bc. * ipc.c (tprint_msgsnd): Add and use "flags" argument. (sys_msgsnd): Pass "flags" argument to tprint_msgsnd(). Patch by Anton Blanchard.
* Check umove() return codeDmitry V. Levin2009-11-06
| | | | | | | | | | | | | * bjm.c (sys_query_module): Print input parameters when entering syscall. Fix handling of syscall error. Handle unlikely umove() failures. * ipc.c (tprint_msgrcv): New function. Move part of msgrcv parser code here, add check umove() return code. (sys_msgsnd): Print msqid parameter as int instead of long. (sys_msgrcv): Likewise. Use tprint_msgrcv(). * process.c (print_affinitylist): Check umove() return code. * sock.c (sock_ioctl): Handle unlikely umove() failure in the SIOCGIFCONF parser.
* Enhance msgsnd() parserDmitry V. Levin2009-10-08
| | | | | | * ipc.c (tprint_msgsnd): New function. Move msgsnd parser code here, add check for umove() return code. (sys_msgsnd): Use tprint_msgsnd().
* Enhance semop()/semtimedop() sembuf parserDmitry V. Levin2009-10-08
| | | | | | * ipc.c (tprint_sembuf): New function. Move sembuf parser code here, add abbrev() support. (sys_semop, sys_semtimedop): Use tprint_sembuf().
* Add pretty printing of sembuf argument to semop() and semtimedop()Jakub Bogusz2009-10-08
| | | | | * ipc.c (semop_flags): New xlat structure. (sys_semop, sys_semtimedop): Add pretty printing of sembuf argument.
* * ipc.c [LINUX] (sys_shmat): HPPA does not use an IPC multiplexer.Dmitry V. Levin2009-10-05
| | | | Based on patch from Carlos O'Donell.
* Decode fcntl's F_{GET,SET}LEASE, F_NOTIFY, and F_DUPFD_CLOEXEC.Denys Vlasenko2009-03-10
| | | | | | | | | | | | | | | | | By Mike Frysinger (vapier AT gentoo.org) * desc.c: Add F_SETLEASE, F_GETLEASE, F_NOTIFY, F_DUPFD_CLOEXEC to fcntlcmds[]. Create notifyflags[] array. (sys_fcntl): Handle new flags. Optimize printing of open modes. * defs.h: Declare sprint_open_modes(), remove unused parameter in tprint_open_modes(). * desc.c (sprint_open_modes): Move fuction definition from here... * file.c (sprint_open_modes): To here. (tprint_open_modes): Use sprint_open_modes(), it already generates needed string. * ipc.c: Remove unused parameter from calls to tprint_open_modes().
* 2007-01-11 Dmitry V. Levin <ldv@altlinux.org>Dmitry V. Levin2007-01-11
| | | | | | | | | | | | | Fix open(2) flags parser. * defs.h (tprint_open_modes): New function. * desc.c (sprint_open_modes): New function. (sys_fcntl): Use tprint_open_modes() and sprint_open_modes(). * file.c (openmodes): Split xlat into open_access_modes and open_mode_flags. (tprint_open_modes): New function. (decode_open): Use it. * ipc.c (sys_mq_open, printmqattr): Likewise. Fixes RH#222385.
* 2006-08-22 Roland McGrath <roland@redhat.com>Roland McGrath2006-08-22
| | | | | * ipc.c (sys_msgget, sys_semget, sys_shmget): Show key values in hex. Fixes RH#198179.
* 2006-04-25 Roland McGrath <roland@redhat.com>Roland McGrath2006-04-25
| | | | | | | * ipc.c (sys_semtimedop): Fixed inverted indirect_ipccall test. * linux/hppa/syscallent.h: Fixed semtimedop entry. From Mike Stroyan <mike.stroyan@hp.com>. Fixes Debian#340239.
* 2005-12-01 Roland McGrath <roland@redhat.com>Roland McGrath2005-12-02
| | | | | * ipc.c (indirect_ipccall) [MIPS || HPPA]: Return false. Fixes Debian#340239.
* 2005-12-01 Roland McGrath <roland@redhat.com>Roland McGrath2005-12-02
| | | | | * ipc.c (indirect_ipccall) [IA64]: Return false unless the syscall number is in the low range of IA32 syscalls.
* 2005-12-01 Roland McGrath <roland@redhat.com>Roland McGrath2005-12-02
| | | | | | | | | * ipc.c (indirect_ipccall): New function. (sys_msgctl, sys_msgsnd, sys_msgrcv, sys_semop): Use that predicate instead of #ifdef LINUX test. [LINUX] (sys_semtimedop): Likewise. (sys_shmctl, sys_shmat, sys_shmdt): Likewise. Fixes RH#164755.
* 2005-07-31 Ulrich Drepper <drepper@redhat.com>Roland McGrath2005-12-02
| | | | | | * ipc.c (sys_msgrcv): Add entering handling and print first parameter there. Fixes RH#164757.
* 2005-05-31 Dmitry V. Levin <ldv@altlinux.org>Roland McGrath2005-06-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * util.c (printxval): Change third argument from "char *" to "const char *". (printflags): Add third argument, "const char *", with similar meaning to the third argument of printxval(). * defs.h (printxval): Change third argument from "char *" to "const char *". (printflags): Add third argument. * bjm.c (sys_query_module) [LINUX]: Pass third argument to printflags(). * desc.c (sys_fcntl): Likewise. (sys_flock) [LOCK_SH]: Likewise. (print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise. * file.c (sys_open): Likewise. (solaris_open) [LINUXSPARC]: Likewise. (sys_access): Likewise. (sys_chflags, sys_fchflags) [FREEBSD]: Likewise. (realprintstat) [HAVE_LONG_LONG_OFF_T && HAVE_STRUCT_STAT_ST_FLAGS]: Likewise. (printstat64) [HAVE_STAT64 && HAVE_STRUCT_STAT_ST_FLAGS]: Likewise. (sys_setxattr, sys_fsetxattr): Likewise. * ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget, sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise. (sys_mq_open) [LINUX]: Likewise. (printmqattr) [HAVE_MQUEUE_H]: Likewise. * mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise. (sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise. (sys_mprotect): Likewise. (sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise. (sys_msync) [MS_ASYNC]: Likewise. (sys_mctl) [MC_SYNC]: Likewise. (sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]: Likewise. * net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise. (sys_send, sys_sendto): Likewise. (sys_sendmsg) [HAVE_SENDMSG]: Likewise. (sys_recv, sys_recvfrom): Likewise. (sys_recvmsg) [HAVE_SENDMSG]: Likewise. (printicmpfilter) [ICMP_FILTER]: Likewise. * proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise. * process.c (sys_clone) [LINUX]: Likewise. (printwaitn): Likewise. (sys_waitid) [SVR4 || LINUX]: Likewise. * signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise. (sys_sigaction): Likewise. (printcontext) [SVR4]: Likewise. (print_stack_t) [LINUX) || FREEBSD]: Likewise. (sys_rt_sigaction) [LINUX]: Likewise. * sock.c (sock_ioctl) [LINUX]: Likewise. * stream.c (sys_putmsg, sys_getmsg): Likewise. (sys_putpmsg) [SYS_putpmsg]: Likewise. (sys_getpmsg) [SYS_getpmsg]: Likewise. (sys_poll): Likewise. (print_transport_message) [TI_BIND]: Likewise. (stream_ioctl): Likewise. * system.c (sys_mount, sys_reboot): Likewise. (sys_cacheflush) [LINUX && M68K]: Likewise. (sys_capget, sys_capset) [SYS_capget]: Likewise. * term.c (term_ioctl) [TIOCMGET]: Likewise. * time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]: Likewise. Fixes RH#159310.
* 2005-04-05 Anton Blanchard <anton@samba.org>Roland McGrath2005-05-09
| | | | | | * ipc.c (shm_resource_flags): New variable, table has SHM_HUGETLB but not IPC_NOWAIT, which have the same value. (sys_shmget): Use that instead of resource_flags.
* 2004-09-03 Roland McGrath <roland@redhat.com>Roland McGrath2004-09-04
| | | | | | | | | | | | | | | | | | | | | | * util.c (xlookup, printxval, addflags, printflags): Use const for struct xlat * argument. * defs.h (xlookup, printxval, addflags, printflags): Update decls. * bjm.c: Add const to all struct xlat defns. * desc.c: Likewise. * file.c: Likewise. * ipc.c: Likewise. * mem.c: Likewise. * net.c: Likewise. * proc.c: Likewise. * process.c: Likewise. * resource.c: Likewise. * signal.c: Likewise. * sock.c: Likewise. * stream.c: Likewise. * system.c: Likewise. * term.c: Likewise. * time.c: Likewise. * util.c: Likewise.
* 2004-04-16 Roland McGrath <roland@redhat.com>Roland McGrath2004-04-16
| | | | | | | | | | | | | * configure.ac: Check for <mqueue.h>. * ipc.c (sys_mq_open, printmqattr) [! HAVE_MQUEUE_H]: Don't try to decode struct mq_attr. * linux/syscall.h: Support new mq_* syscalls on Linux. * linux/syscallent.h: Likewise. * linux/dummy.h: Likewise. * ipc.c: Likewise. * time.c (printsigevent): Handle SIGEV_THREAD. From Ulrich Drepper <drepper@redhat.com>. Fixes RH#120701.
* 2003-07-15 Anton Blanchard <anton@samba.org>Roland McGrath2003-07-17
| | | | | | | | * ipc.c: Add SHM_HUGETLB field. Mask out permission bits in msgget, semget and shmget before printing resource_flags. Mask execute permission bits (even though we dont currently use them).
* 2003-04-07 Roland McGrath <roland@redhat.com>Roland McGrath2003-04-08
| | | | | | | | | * linux/syscallent.h: Handle semtimedop subcall of ipc syscall. * linux/syscall.h: Likewise. * ipc.c [LINUX] (sys_semtimedop): New function. From Ulrich Drepper <drepper@redhat.com>. * ipc.c (sys_semget): Mask off permission bits for resource_flags. From Ulrich Drepper <drepper@redhat.com>.
* 2003-01-14 Roland McGrath <roland@redhat.com>Roland McGrath2003-01-14
| | | | | | * ipc.c (PRINTCTL): New macro. #ifdef IPC_64, factor out the flag and print it before using printxval. (sys_msgctl, sys_semctl, sys_shmctl): Use it.
* Add FreeBSD supportWichert Akkerman2000-09-01
|
* Bunch of stuffWichert Akkerman1999-12-23
|
* Initial revisionWichert Akkerman1999-02-19