]> granicus.if.org Git - strace/log
strace
9 years agoprocess.c: move sched_setaffinity and sched_getaffinity parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move sched_setaffinity and sched_getaffinity parsers to a separate file

* affinity.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_sched_setaffinity, sys_sched_getaffinity): Move
to affinity.c.

9 years agoprocess.c: move prctl and arch_prctl parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move prctl and arch_prctl parsers to a separate file

* prctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_prctl, sys_arch_prctl, and related code to prctl.c.

9 years agoprocess.c: move getcpu parser to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)]
process.c: move getcpu parser to a separate file

* getcpu.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getcpu): Move to getcpu.c.

9 years agoprocess.c: move process_vm_readv and process_vm_writev parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)]
process.c: move process_vm_readv and process_vm_writev parsers to a separate file

* process_vm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_process_vm_readv, sys_process_vm_writev): Move
to process_vm.c.

9 years agoImplement decoding of fallocate FALLOC_FL_* flags
Dmitry V. Levin [Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)]
Implement decoding of fallocate FALLOC_FL_* flags

* xlat/falloc_flags.in: New file.
* configure.ac (AC_CHECK_HEADERS): Add linux/falloc.h.
* fallocate.c [HAVE_LINUX_FALLOC_H]: Include <linux/falloc.h>.
Include xlat/falloc_flags.h.
(sys_fallocate): Decode flags.

9 years agoFix decoding of renameat2 RENAME_* flags
Dmitry V. Levin [Thu, 11 Dec 2014 18:55:43 +0000 (18:55 +0000)]
Fix decoding of renameat2 RENAME_* flags

* renameat.c: Include <linux/fs.h> where RENAME_NOREPLACE,
RENAME_EXCHANGE, and RENAME_WHITEOUT are usually defined.

9 years agofile.c: move open, openat, and creat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move open, openat, and creat parsers to a separate file

* open.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_open, sys_openat, sys_creat, and related code
to open.c.

9 years agofile.c: move access and faccessat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move access and faccessat parsers to a separate file

* access.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_access, sys_faccessat and related code to access.c.

9 years agofile.c: move umask parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move umask parser to a separate file

* umask.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_umask): Move to umask.c.

9 years agofile.c: move lseek and llseek parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move lseek and llseek parsers to a separate file

* lseek.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_lseek, sys_llseek, and related code to lseek.c.

9 years agofile.c: move readahead parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move readahead parser to a separate file

* readahead.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_readahead): Move to readahead.c.

9 years agofile.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate...
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file

* truncate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64):
Move to truncate.c.

9 years agofile.c: move chdir parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move chdir parser to a separate file

* chdir.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chdir): Move to chdir.c.

9 years agofile.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file

* link.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_link, sys_linkat, sys_unlinkat, sys_symlinkat, and
related code to link.c.

9 years agofile.c: move readlink and readlinkat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move readlink and readlinkat parsers to a separate file

* readlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_readlink, sys_readlink, sys_readlinkat): Move
to readlink.c.

9 years agofile.c: move renameat and renameat2 parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move renameat and renameat2 parsers to a separate file

* renameat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_renameat, sys_renameat2, and related code
to renameat.c.

9 years agofile.c: move chown, fchown, and fchownat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move chown, fchown, and fchownat parsers to a separate file

* chown.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chown, sys_fchownat, sys_fchown): Move to chown.c.

9 years agoExport at_flags
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
Export at_flags

* defs.h (at_flags): New prototype.

9 years agofile.c: move chmod, fchmod, and fchmodat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move chmod, fchmod, and fchmodat parsers to a separate file

* chmod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chmod, sys_fchmodat, sys_fchmod): Move to chmod.c.

9 years agofile.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file

* utimes.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_utimes, sys_utimes, sys_futimesat, sys_utimensat,
sys_osf_utimes): Move to utimes.c.

9 years agofile.c: move utime parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move utime parser to a separate file

* utime.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_utime): Move to utime.c.

9 years agoExport sprinttime
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
Export sprinttime

* defs.h (sprinttime): New prototype.
* file.c (sprinttime): Make global and move to util.c.

9 years agofile.c: move mknod, mknodat, and xmknod parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move mknod, mknodat, and xmknod parsers to a separate file

* mknod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_mknod, sys_mknodat, sys_xmknod, and related code
to mknod.c.

9 years agofile.c: export sprintmode and move it to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: export sprintmode and move it to a separate file

* printmode.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprintmode): New prototype.
* file.c (sprintmode): Make global and move to printmode.c.

9 years agofile.c: move getcwd parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move getcwd parser to a separate file

* getcwd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_getcwd): Move to getcwd.c.

9 years agofile.c: move *xattr parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move *xattr parsers to a separate file

* xattr.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr,
sys_listxattr, sys_flistxattr, sys_removexattr, sys_fremovexattr,
and related code to xattr.c.

9 years agofile.c: move fadvise64 and fadvise64_64 parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move fadvise64 and fadvise64_64 parsers to a separate file

* fadvise.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_fadvise64, sys_fadvise64_64, and related code
to fadvise.c.

9 years agofile.c: move sync_file_range and sync_file_range2 parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move sync_file_range and sync_file_range2 parsers to a separate file

* sync_file_range.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_sync_file_range, sys_sync_file_range2, and related
code to sync_file_range.c.

9 years agofile.c: move fallocate parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move fallocate parser to a separate file

* fallocate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_fallocate): Move to fallocate.c.

9 years agofile.c: move swapon parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move swapon parser to a separate file

* swapon.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_swapon and related code to swapon.c.

9 years agoImplement full decoding of 64-bit capabilities
Dmitry V. Levin [Fri, 5 Dec 2014 00:21:23 +0000 (00:21 +0000)]
Implement full decoding of 64-bit capabilities

Unlike v1 capabilities which are 32-bit, v2 and v3 are 64-bit, but
before this change only lower 32 capability bits were decoded for
v2 and v3.

* xlat/capabilities1.in: New file.
* capability.c: Define v2/v3 CAP_* constants.
Include xlat/capabilities1.h.
(get_cap_header): New function.
(print_cap_header): Update to use get_cap_header result.
(print_cap_data): Decoder higher capability bits for v2 and v3.
(sys_capget, sys_capset): Use get_cap_header, update print_cap_header
and print_cap_data calls.
* tests/caps.c: New file.
* tests/caps.awk: New file.
* tests/caps.test: New test.
* tests/Makefile.am (CHECK_PROGRAMS): Add caps.
(TESTS): Add caps.test.
(EXTRA_DIST): Add caps.awk.

9 years agoMake parsers of capget and capset syscalls self-contained
Dmitry V. Levin [Wed, 3 Dec 2014 20:39:20 +0000 (20:39 +0000)]
Make parsers of capget and capset syscalls self-contained

Various versions of <linux/capability.h> used to require different
workarounds to avoid conflicts with types defined by libc headers.
Define all required types and constants locally to fix this issue.

* configure.ac (AC_CHECK_HEADERS): Remove linux/capability.h.
* capability.c: Do not include <linux/capability.h>, remove workarounds
for problematic versions of <linux/capability.h> file.
Define CAP_* and _LINUX_CAPABILITY_VERSION_* constants as enums.
(struct __user_cap_header_struct, struct __user_cap_data_struct): Define.
* xlat/cap_version.in: Add #unconditional.
* xlat/capabilities.in: Likewise.

9 years agoRemove system.c
Dmitry V. Levin [Wed, 3 Dec 2014 21:17:01 +0000 (21:17 +0000)]
Remove system.c

All disjoint parts of system.c have been moved to separate files.

* system.c: Remove.
* Makefile.am (strace_SOURCES): Remove it.

9 years agoMove mount parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:12:07 +0000 (21:12 +0000)]
Move mount parser to a separate file

* mount.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_mount and related code to mount.c.

9 years agoMove umount2 parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:09:26 +0000 (21:09 +0000)]
Move umount2 parser to a separate file

* umount.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_umount2 and related code to umount.c.

9 years agoMove personality parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:06:11 +0000 (21:06 +0000)]
Move personality parser to a separate file

* personality.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_personality and related code to personality.c.

9 years agoMove syslog parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:01:35 +0000 (21:01 +0000)]
Move syslog parser to a separate file

* syslog.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_syslog and related code to syslog.c.

9 years agoMove cacheflush parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:50:08 +0000 (20:50 +0000)]
Move cacheflush parser to a separate file

* cacheflush.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move inclusion of <asm/cachectl.h> to cacheflush.c.
[M68K, BFIN, SH]: Move to cacheflush.c.

9 years agobfin: move sram_alloc parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:56:36 +0000 (20:56 +0000)]
bfin: move sram_alloc parser to a separate file

* sram_alloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c [BFIN]: Move sys_sram_alloc and related code to sram_alloc.c.

9 years agoMove capget and capset parsers to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:30:15 +0000 (20:30 +0000)]
Move capget and capset parsers to a separate file

* capability.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move inclusion of headers and macro definitions related
to capget and capset decoding to capability.c.
(print_cap_header, print_cap_data, sys_capget, sys_capset): Move
to capability.c.

9 years agoMove sysctl parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:20:52 +0000 (20:20 +0000)]
Move sysctl parser to a separate file

* sysctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_sysctl and related code to sysctl.c.

9 years agomips: move sysmips parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:08:44 +0000 (20:08 +0000)]
mips: move sysmips parser to a separate file

* sysmips.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Fix typo in the check for <linux/utsname.h>.
Move inclusions of <linux/utsname.h> and <asm/sysmips.h> to sysmips.c.
[MIPS]: Likewise.

9 years agoor1k: move or1k_atomic parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:00:42 +0000 (20:00 +0000)]
or1k: move or1k_atomic parser to a separate file

* or1k_atomic.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c [OR1K]: Move to or1k_atomic.c.

9 years agoAlias sys_setdomainname to sys_sethostname
Dmitry V. Levin [Tue, 2 Dec 2014 21:42:34 +0000 (21:42 +0000)]
Alias sys_setdomainname to sys_sethostname

Since parsers for setdomainname and sethostname syscalls are identical,
replace sys_setdomainname with an alias to sys_sethostname.

* linux/dummy.h (sys_setdomainname): Alias to sys_sethostname.
* linux/syscall.h (sys_setdomainname): Remove.
* process.c (sys_setdomainname): Remove.

9 years agoAlias sys_getpeername to sys_getsockname
Dmitry V. Levin [Tue, 2 Dec 2014 21:36:04 +0000 (21:36 +0000)]
Alias sys_getpeername to sys_getsockname

Since parsers for getpeername and getsockname syscalls are identical,
replace sys_getpeername with an alias to sys_getsockname.

* linux/dummy.h (sys_getpeername): Alias to sys_getsockname.
* linux/syscall.h (sys_getpeername): Remove.
* net.c (sys_getpeername): Remove.

9 years agoAlias sys_stime to sys_time
Dmitry V. Levin [Tue, 2 Dec 2014 20:47:30 +0000 (20:47 +0000)]
Alias sys_stime to sys_time

Since parsers for stime and time syscalls are identical,
replace sys_stime with an alias to sys_time.

* linux/dummy.h (sys_stime): Alias to sys_time.
* linux/syscall.h (sys_stime): Remove.
* time.c (sys_stime): Remove.

9 years agoRemove unused sys_mctl
Dmitry V. Levin [Tue, 2 Dec 2014 16:00:58 +0000 (16:00 +0000)]
Remove unused sys_mctl

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* mem.c [MC_SYNC]: Remove.
* xlat/mctl_funcs.in: Remove.
* xlat/mctl_lockas.in: Remove.

9 years agoAlias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat
Dmitry V. Levin [Mon, 1 Dec 2014 18:24:55 +0000 (18:24 +0000)]
Alias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat

Special parsers for mkdir and mkdirat are redundant because
sys_chmod and sys_fchmodat implement the same decoding.

* file.c (decode_mkdir, sys_mkdir, sys_mkdirat): Remove.
* linux/dummy.h (sys_mkdir): Alias to sys_chmod.
(sys_mkdirat): Alias to sys_fchmodat.
* linux/syscall.h (sys_mkdir, sys_mkdirat): Remove.
* pathtrace.c (pathtrace_match): Do not check for sys_mkdirat.

9 years agoRemove unused <sys/acl.h> based code
Dmitry V. Levin [Mon, 1 Dec 2014 19:08:44 +0000 (19:08 +0000)]
Remove unused <sys/acl.h> based code

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/acl.h.
* file.c [HAVE_SYS_ACL_H]: Remove.
* xlat/aclcmds.in: Remove.

9 years agoRemove unused <sys/asynch.h> based code
Dmitry V. Levin [Mon, 1 Dec 2014 17:08:50 +0000 (17:08 +0000)]
Remove unused <sys/asynch.h> based code

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/asynch.h.
* file.c [HAVE_SYS_ASYNCH_H]: Remove.

9 years agoPrint protocol name of socket descriptors with -yy option
Masatake YAMATO [Sat, 22 Nov 2014 10:03:33 +0000 (19:03 +0900)]
Print protocol name of socket descriptors with -yy option

For those socket descriptors that have no associated ip:port pairs
(or when this information is not available), -yy option prints
the same <socket:[INODE]> information as -y option, e.g.

$ strace -e sendto -yy ip l > /dev/null
sendto(3<socket:[23456789]>, ...

This change makes -yy output more informative: instead of just
printing "socket", the name of protocol behind the socket descriptor
will be printed, e.g.

sendto(3<NETLINK:[23456789]>, ...

* configure.ac (AC_CHECK_HEADERS): Add sys/xattr.h.
* tests/net-yy-accept.awk: Update to support protocol names.
* tests/net-yy-connect.awk: Likewise.
* util.c [HAVE_SYS_XATTR_H]: Include <sys/xattr.h>.
(getfdproto): New function.
(printfd): Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoReplace MAXPATHLEN with PATH_MAX
Dmitry V. Levin [Fri, 21 Nov 2014 22:28:34 +0000 (22:28 +0000)]
Replace MAXPATHLEN with PATH_MAX

MAXPATHLEN is defined to PATH_MAX, so replace the former with the latter.

* strace.c (startup_child): Replace MAXPATHLEN with PATH_MAX.
* util.c (printpathn, printpath): Likewise.

9 years agoDecode FIFREEZE/FITHAW/FITRIM ioctls
Mike Frysinger [Fri, 21 Nov 2014 21:13:16 +0000 (16:13 -0500)]
Decode FIFREEZE/FITHAW/FITRIM ioctls

The freeze/thaw ones are simple, but the trim is an interesting struct.

* block.c (block_ioctl): Handle FIFREEZE/FITHAW/FITRIM.
* ioctl.c (ioctl_decode): Pass 'X' ioctls to block_ioctl.

9 years agoInclude <sys/uio.h> unconditionally
Dmitry V. Levin [Fri, 21 Nov 2014 20:46:16 +0000 (20:46 +0000)]
Include <sys/uio.h> unconditionally

Since <sys/uio.h> is standardized by POSIX and is present in all
available versions of glibc, it's safe to assume that any usable
libc implementation provides this header file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h.
* io.c: Include <sys/uio.h> unconditionally.
(tprint_iov_upto, tprint_iov, sys_readv, sys_writev,
print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define
unconditionally.
* net.c: Include <sys/uio.h> unconditionally.
* util.c: Include <sys/uio.h> unconditionally.
(dumpiov): Define unconditionally.

9 years agoConsistently use C99 designated initializers in the new netlink code
Dmitry V. Levin [Fri, 21 Nov 2014 19:59:16 +0000 (19:59 +0000)]
Consistently use C99 designated initializers in the new netlink code

* socketutils.c (send_query, receive_responses): Use designated
initializers for sockaddr_nl, nlmsghdr, and inet_diag_req_v2 structures.
* tests/netlink_inet_diag.c (send_query, check_responses): Likewise.

9 years agoDecode open's O_TMPFILE
Mike Frysinger [Thu, 20 Nov 2014 00:19:56 +0000 (19:19 -0500)]
Decode open's O_TMPFILE

* xlat/open_mode_flags.in: Add O_TMPFILE definition.

9 years agohppa: update error codes and signal numbers
Helge Deller [Sat, 8 Nov 2014 21:52:44 +0000 (22:52 +0100)]
hppa: update error codes and signal numbers

There are two important changes in here:

1. EWOULDBLOCK has been up to kernel 3.14 errorcode #246. Since hppa
folks had problems with EWOULDBLOCK != EAGAIN, this was changed in
kernel 3.14.

2. Starting with kernel 3.18, hppa folks changed some signal numbers in
such a way that we end up with SIGRTMIN == 32, which brings hppa in sync
with other linux ports.

Both were incompatible changes which basically broke hppa ABI, but since
they have been merged into the kernel, we have to follow.

9 years agostack trace support: fix check on symbol name presence
Thomas De Schampheleire [Thu, 6 Nov 2014 12:59:04 +0000 (13:59 +0100)]
stack trace support: fix check on symbol name presence

The output format of the stack trace is supposed to be different
depending on whether symbol names are available in the build.

However, the check only verified the validity of the pointer, not of the
string pointed to (which could be empty).

This commit fixes the check so that the original output:

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
 > /bin/busybox(+0x0) [0x62c60]
 > /bin/busybox(+0x0) [0x4940]
 > /bin/busybox(+0x0) [0x499c]
 > /bin/busybox(+0x0) [0x4e08]
 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

becomes:

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
 > /bin/busybox() [0x62c60]
 > /bin/busybox() [0x4940]
 > /bin/busybox() [0x499c]
 > /bin/busybox() [0x4e08]
 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Masatake YAMATO <yamato@redhat.com>
9 years agotests: add a test for decoding and dumping of recvmmsg/sendmmsg
Masatake YAMATO [Thu, 6 Nov 2014 16:23:27 +0000 (01:23 +0900)]
tests: add a test for decoding and dumping of recvmmsg/sendmmsg

* configure (AC_CHECK_FUNCS): Add sendmmsg.
* tests/mmsg.c: New file.
* tests/mmsg.expected: New file.
* tests/mmsg.test: New test.
* tests/.gitignore: Add mmsg.
* tests/Makefile.am (CHECK_PROGRAMS): Add mmsg.
(TESTS): Add mmsg.test.
(EXTRA_DIST): Add mmsg.expected.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoAdd functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg
Masatake YAMATO [Thu, 6 Nov 2014 16:23:26 +0000 (01:23 +0900)]
Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg

This patch is similar to what I did in commit
02f9f6b386741a52f58e1b31ad4e7fff60781ef8.
That commit was for sendmsg and recvmsg system calls.
This one is for sendmmsg and recvmmsg system calls.

* defs.h (dumpiov_in_mmsghdr): New declaration.
* net.c (extractmmsghdr): New function derived from printmmsghdr.
(printmmsghdr): Use it.
(dumpiov_in_mmsghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_mmsghdr
for recvmmsg and sendmmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoUse the definition of struct mmsghdr if it is defined in build environment
Masatake YAMATO [Thu, 6 Nov 2014 16:23:25 +0000 (01:23 +0900)]
Use the definition of struct mmsghdr if it is defined in build environment

mmsghrd structure type is defined locally in printmmsghdr function.

However, more functions will refer the definition in modifications for
supporting "-e write=set" and "-e read=set" option for sendmmsg and
recvmmsg system calls.

After this change, the system definition of struct mmsghdr will be used
if configure reports it is available, falling back to the old local
definition.

* configure.ac (AC_CHECK_TYPES): Add struct mmsghdr.
* net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(printmmsghdr): Use previously defined struct mmsghdr.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoIntroduce a separate function to copy from msghdr32 to msghdr
Masatake YAMATO [Thu, 6 Nov 2014 16:23:24 +0000 (01:23 +0900)]
Introduce a separate function to copy from msghdr32 to msghdr

This patch is an initial step for supporting "-e write=set" and
"-e read=set" option for sendmmsg and recvmmsg system calls.

Coverting a data of msghdr32 to msghdr is needed both for
{send,recv}msg and {send,recv}mmsg to decode parameters.
To share the copying code in both decoders, a separate
function named copy_from_msghdr32 is introduced.

* net.c [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]
(copy_from_msghdr32): New function.
(extractmsghdr) [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoioctlsort: rewrite build rules using noinst_PROGRAMS
Dmitry V. Levin [Tue, 4 Nov 2014 01:40:42 +0000 (01:40 +0000)]
ioctlsort: rewrite build rules using noinst_PROGRAMS

* linux/ioctlsort.c: Rename to ioctlsort.c
* Makefile.am (EXTRA_DIST): Rename linux/ioctlsort.c to ioctlsort.c.
[MAINTAINER_MODE] (noinst_PROGRAMS): Add ioctlsort.
(ioctlsort_SOURCES): Add ioctlsort.c.
(nodist_ioctlsort_SOURCES): Add ioctls.h and ioctldefs.h.
(CLEANFILES): Add $(nodist_ioctlsort_SOURCES).
(ioctlsort.$(OBJEXT)): Likewise.
(ioctlsort): Remove.

9 years agoMakefile.am: look for ioctl definitions in the kernel build tree by default
Lubomir Rintel [Thu, 16 Oct 2014 10:05:43 +0000 (12:05 +0200)]
Makefile.am: look for ioctl definitions in the kernel build tree by default

While most of ioctl-related kernel headers are now exported by kernel's
headers_install, some are still modules_install only.  The kernel's
headers installed into /usr/include/ are usually headers_install'ed and
therefore don't contain some internal headers we need.  The solution is
to look for modules_install'ed headers for the running kernel, and fall
back to old behavior if they aren't found.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoDump details for Bluetooth socket operations
Lubomir Rintel [Fri, 3 Oct 2014 09:40:28 +0000 (11:40 +0200)]
Dump details for Bluetooth socket operations

* configure.ac (AC_CHECK_HEADERS): Add bluetooth/bluetooth.h.
* xlat/bt_protocols.in: New file.
* net.c [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include bluetooth
headers.
[PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
(printsock) [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Dump details
for AF_BLUETOOTH sockets.
(sys_socket) [PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Decode
protocol for PF_BLUETOOTH sockets.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoImplement Video4Linux video-input ioctls decoder
Philippe De Muyter [Mon, 3 Nov 2014 20:27:40 +0000 (21:27 +0100)]
Implement Video4Linux video-input ioctls decoder

Introduce v4l2.c, a decoder for the arguments of the video-input subset
of the v4l2 ioctl's.  This is a combination of
- previous work by Peter Zotov <whitequark@whitequark.org>, found at
https://gist.githubusercontent.com/whitequark/1263207/raw/strace-4.6-v4l2-ioctls.patch
- previous work by William Manley <will@williammanley.net>, found at
http://marc.info/?l=strace&m=139395588520675
- forward port, additions and fixes by Philippe De Muyter <phdm@macqel.be>

As v4l2 is a moving target, I have made v4l2.c compilable with ancient
linux kernels by testing the availability of some macros.  It has been
succesfully compiled on linux 3.10, 3.1, 2.6.31 and 2.6.22, and
succesfully used on linux 3.10 with a camera device.

* configure.ac: Check for availabilty of V4L2_* enum constants.
* Makefile.am (strace_SOURCES): Add v4l2.c.
* defs.h (v4l2_ioctl): New prototype.
* ioctl.c (ioctl_decode): Use v4l2_ioctl.
* v4l2.c: New file.
* xlat/v4l2_*.in: New files.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Peter Zotov <whitequark@whitequark.org>
Cc: William Manley <will@williammanley.net>
9 years agoUpdate ioctl entries
Dmitry V. Levin [Mon, 3 Nov 2014 21:08:44 +0000 (21:08 +0000)]
Update ioctl entries

* linux/ioctlent.h.in: Regenerate from v3.17 headers.

9 years agoRemove ioctl header file names from the executable
Dmitry V. Levin [Mon, 3 Nov 2014 20:37:39 +0000 (20:37 +0000)]
Remove ioctl header file names from the executable

* defs.h (struct ioctlent): Remove "doth" field.
* Makefile.am ($(ioctlent_h)): Remove 1st field.

9 years agoFilter out redundant ioctl entries early
Dmitry V. Levin [Mon, 3 Nov 2014 20:14:31 +0000 (20:14 +0000)]
Filter out redundant ioctl entries early

For two ioctl entries with the same code, if one's name is a prefix
to another's name, keep the entry with a shorter name.  Filter out
redundant ioctl entries at ioctlsort stage so that distributed
ioctlent.h.in files will be already filtered.

* linux/ioctlsort.c (is_not_prefix): New function.
(main): Use it.
* linux/ioctlent-filter.awk: Remove.
* Makefile.am (EXTRA_DIST): Remove linux/ioctlent-filter.awk.
($(ioctlent_h)): Don't use linux/ioctlent-filter.awk.

9 years agoioctlent.sh: update the list of directories exported by headers_install
Dmitry V. Levin [Mon, 3 Nov 2014 18:38:51 +0000 (18:38 +0000)]
ioctlent.sh: update the list of directories exported by headers_install

* linux/ioctlent.sh: Add drm, mtd, rdma, video, and xen directories.

9 years agoAdd a function for dumping iovec in msghdr used in sendmsg and recvmsg
Masatake YAMATO [Wed, 15 Oct 2014 13:11:43 +0000 (22:11 +0900)]
Add a function for dumping iovec in msghdr used in sendmsg and recvmsg

Here is an example session:

    $ ./strace -e write=all ip link change dev enp0s25 mtu 1501 > /dev/null
    sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"(...
     * 40 bytes in buffer 0
     | 00000  28 00 00 00 10 00 05 00  d0 d9 aa 53 00 00 00 00  (..........S.... |
     | 00010  00 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  ................ |
     | 00020  08 00 04 00 dd 05 00 00                           ........         |
    ...

    $ ./strace -e read=all ip link show > /dev/null
    recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"...
     * 8192 bytes in buffer 0
     | 00000  34 00 00 00 02 00 00 00  00 00 00 00 ff 23 00 00  4............#.. |
     | 00010  ff ff ff ff 20 00 00 00  10 00 05 00 00 00 00 00  .... ........... |
    ...

* defs.h (dumpiov_in_msghdr): New prototype.
* net.c (extractmsghdr): New function derived from printmsghdr.
(printmsghdr): Use extractmsghdr.
(dumpiov_in_msghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_msghdr for recvmsg
and sendmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoInclude <linux/ptrace.h> regardless of <sys/reg.h> existence
Maarten ter Huurne [Sun, 19 Oct 2014 23:02:48 +0000 (01:02 +0200)]
Include <linux/ptrace.h> regardless of <sys/reg.h> existence

This fixes compilation with musl libc.
This approach was already used in process.c, so I assume it is safe.

* signal.c: Move [HAVE_LINUX_PTRACE_H] code out of [HAVE_SYS_REG_H] check.
* syscall.c: Likewise.
* util.c: Likewise.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
9 years agosock: decode SIOCSIFNAME on entering syscall
Dmitry V. Levin [Fri, 31 Oct 2014 19:36:01 +0000 (19:36 +0000)]
sock: decode SIOCSIFNAME on entering syscall

* sock.c (sock_ioctl): Handle SIOCSIFNAME on entering syscall.

9 years agosock: fix decoding of SIOCSIFNAME
Mike Frysinger [Tue, 21 Oct 2014 12:34:08 +0000 (08:34 -0400)]
sock: fix decoding of SIOCSIFNAME

The decoding of SIOCSIFNAME is incorrect.  It does not use
the ifr_index field to look things up, but ifr_newname.

* sock.c (sock_ioctl): Split out SIOCSIFNAME from SIOCGIFNAME and
display ifr_newname.

9 years agosock: fix decoding of struct ifreq.ifr_name
Mike Frysinger [Tue, 21 Oct 2014 12:34:08 +0000 (08:34 -0400)]
sock: fix decoding of struct ifreq.ifr_name

The ifr name fields of the ifreq structure might not be NUL terminated.
If the user makes an ioctl call where they aren't, then strace ends up
reading random content from its own stack.  Limit the printf lengths.

* sock.c (sock_ioctl): Add explicit length limits to ifr_name printfs.

9 years agoDon't risk truncating open flags by using mode_t
Elliott Hughes [Wed, 24 Sep 2014 02:09:50 +0000 (19:09 -0700)]
Don't risk truncating open flags by using mode_t

On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
as their mode_t.  The open(2) flags are actually an int, so high ones
like O_CLOEXEC get truncated if you coerce them to mode_t.

* defs.h (tprint_open_modes, sprint_open_modes): Change argument type
from mode_t to int.
* file.c (tprint_open_modes, sprint_open_modes): Likewise.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoEnhance sysinfo decoding
Dmitry V. Levin [Mon, 29 Sep 2014 23:29:56 +0000 (23:29 +0000)]
Enhance sysinfo decoding

* configure.ac (AC_CHECK_MEMBERS): Check for struct sysinfo.totalhigh,
struct sysinfo.freehigh, and struct sysinfo.mem_unit.
* sysinfo.c (sys_sysinfo): Treat failed umove() call as syserror().
Print totalhigh, freehigh, and mem_unit members when struct sysinfo
supports them.

9 years agoMove sysinfo parser to a separate file
Dmitry V. Levin [Mon, 29 Sep 2014 23:13:05 +0000 (23:13 +0000)]
Move sysinfo parser to a separate file

* sysinfo.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_sysinfo): Move to sysinfo.c.

9 years agoFix build with musl libc
Dmitry V. Levin [Mon, 29 Sep 2014 23:09:22 +0000 (23:09 +0000)]
Fix build with musl libc

* resource.c: Include <sys/sysinfo.h> for struct sysinfo definition.

Reported-by: Steven Honeyman <stevenhoneyman@gmail.com>
9 years agotests: cleanup checks for basic programs
Dmitry V. Levin [Tue, 23 Sep 2014 01:51:05 +0000 (01:51 +0000)]
tests: cleanup checks for basic programs

* tests/init.sh: Check for cat and rm.
* tests/getdents.test: Check for awk.
* tests/ptrace_setoptions.test: Check for grep.
* tests/net-fd.test: Do not check for rm.
* tests/net.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/stat.test: Likewise.
* tests/uio.test: Likewise.

9 years agotests: add a test for -yy option
Dmitry V. Levin [Tue, 23 Sep 2014 00:14:04 +0000 (00:14 +0000)]
tests: add a test for -yy option

* tests/net-yy.test: New test.
* tests/inet-accept-connect-send-recv.c: New file.
* tests/netlink_inet_diag.c: Likewise.
* tests/net-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Likewise.
* tests/.gitignore: Add inet-accept-connect-send-recv,
netlink_inet_diag, *.tmp-*, and *.tmp.*.
* tests/Makefile.am (check_PROGRAMS): Add inet-accept-connect-send-recv
and netlink_inet_diag.
(TESTS): Add net-yy.test.
(EXTRA_DIST): Add net-yy-accept.awk and net-yy-connect.awk.

9 years agoMove statfs related parsers to a separate file
Dmitry V. Levin [Mon, 22 Sep 2014 00:17:42 +0000 (00:17 +0000)]
Move statfs related parsers to a separate file

* statfs.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sprintfstype, printstatfs, sys_statfs, sys_fstatfs): Move
to statfs.c.
[HAVE_STATFS64] (printstatfs64, printcompat_statfs64, sys_statfs64,
sys_fstatfs64): Likewise.
[ALPHA] (osf_statfs, osf_fstatfs): Likewise.

9 years agofsmagic: sort array by value and use bsearch for faster lookup
Dmitry V. Levin [Sun, 21 Sep 2014 22:42:45 +0000 (22:42 +0000)]
fsmagic: sort array by value and use bsearch for faster lookup

* defs.h (xlat_search): New prototype.
* util.c (xlat_bsearch_compare, xlat_search): New functions.
* file.c (sprintfstype): Use xlat_search for fsmagic lookup.
* xlat/fsmagic.in: Sort by value and mark as not NULL-terminated.
* tests/statfs.c: New file.
* tests/statfs.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add statfs.
(statfs_CFLAGS): Define.
(TESTS): Add statfs.test.
* tests/.gitignore: Add statfs.

9 years agofsmagic: update from <linux/magic.h>
Dmitry V. Levin [Sun, 21 Sep 2014 20:31:16 +0000 (20:31 +0000)]
fsmagic: update from <linux/magic.h>

* xlat/fsmagic.in: Add new constants from <linux/magic.h>.
Reported by Elliott Hughes.

9 years agoAdd -yy option: print ip and port associated with socket descriptors
Dmitry V. Levin [Thu, 21 Aug 2014 03:17:48 +0000 (03:17 +0000)]
Add -yy option: print ip and port associated with socket descriptors

When two ore more -y options are given, print local and remote ip:port
pairs associated with socket descriptors.  This implementation uses
NETLINK_INET_DIAG for sockaddr lookup; it's based on the patch
prepared by Zubin Mithra as a part of his GSoC 2014 strace project.

* Makefile.am (strace_SOURCES): Add socketutils.c
(EXTRA_DIST): Add linux/inet_diag.h and linux/sock_diag.h.
* defs.h (print_sockaddr_by_inode): New prototype.
* linux/inet_diag.h: New file.
* linux/sock_diag.h: Likewise.
* socketutils.c: Likewise.
* strace.1: Document -yy option.
* strace.c (usage): Likewise.
* util.c (printfd): Use print_sockaddr_by_inode.

9 years agosigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently
Vicente Olivert Riera [Thu, 11 Sep 2014 19:05:18 +0000 (20:05 +0100)]
sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently

Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.

This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'

* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.

Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
9 years agoFix compilation warnings reported by gcc -Wsign-compare
Dmitry V. Levin [Wed, 10 Sep 2014 13:46:04 +0000 (13:46 +0000)]
Fix compilation warnings reported by gcc -Wsign-compare

* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
* defs.h (struct tcb): Change 'currpers' type to unsigned.
(struct xlat): Change 'val' type to unsigned
(signame): Add 'const' qualifier to its argument.
(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
change its type to unsigned.
(printpathn): Change the 3rd argument type to unsigned.
(ioctl_lookup): Change 1st argument type to unsigned.
* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
* file.c (print_xattr_list): Fix comparisons between signed and unsigned
long values.
* ioctl.c (compare): Fix cast.
(ioctl_lookup): Change 1st argument type to to unsigned.
(ioctl_next_match): Change 'code' type to unsigned.
* mem.c (sys_move_pages): Change 'i' type to unsigned.
* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
Print 'i' using %u format string.
* process.c (sys_prctl): Change 'i' type to unsigned.
(printargv): Change 'n' type to unsigned.
(sys_ptrace): Change 'addr' type to unsigned.
* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
and change its type to unsigned.  Change 'i' and 'allocated' types
to unsigned.
* signal.c (signame): Add 'const' qualifier to its argument.
Fix comparisons between signed and unsigned values.
(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
unsigned values.
* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
(detach): Change 'sig' type to unsigned.
(startup_attach): Change 'tcbi' type to unsigned.
(startup_child): Change 'm', 'n', and 'len' types to unsigned.
(init): Use new variable to iterate 'tcbtab'.
(pid2tcb): Change 'i' type to unsigned.
(cleanup): Change 'i' and 'sig' types to unsigned.
* syscall.c (update_personality): Change 'personality' argument type
to unsigned.
(struct qual_options): Change 'bitflag' type to unsigned.
(reallocate_qual): Add 'const' qualifier to its argument and change its
type to unsigned.
(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
Change 'p' type to signed int.
(qual_syscall): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'p' type to signed int.
(qual_signal): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'i' type to unsigned.
(qual_desc): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
(qualify): Change 'i' type to unsigned.
(get_scno): Change 'currpers' type to unsigned.
Fix a comparison between signed and unsigned values.
* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
Fix comparisons between signed and unsigned values.
* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
and change its type to unsigned.
(printuid): Fix a comparison between signed and unsigned values.
(printpathn): Change 'n' argument type to unsigned.
(printstr): Change 'size' type to unsigned.
Fix a comparison between signed and unsigned values.
(setbpt): Change 'i' type to unsigned.
* net.c (printsock): Silence a compilation warning.
* reboot.c (sys_reboot): Likewise.

9 years agoMove dirent related parsers to a separate file
Dmitry V. Levin [Thu, 11 Sep 2014 22:40:37 +0000 (22:40 +0000)]
Move dirent related parsers to a separate file

* dirent.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (print_old_dirent, sys_readdir, sys_getdents, sys_getdents64):
Move to dirent.c.

9 years agogetdents, getdents64: fix potential out-of-bounds read issues
Dmitry V. Levin [Wed, 10 Sep 2014 00:07:32 +0000 (00:07 +0000)]
getdents, getdents64: fix potential out-of-bounds read issues

* file.c (sys_getdents): Check for invalid d_reclen.
Avoid reading from uninitialized memory.
(sys_getdents64): Likewise.
* tests/getdents.awk: New file.
* tests/getdents.test: New test.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add getdents.awk.

9 years agotprint_sock_type: remove unused parameter
Dmitry V. Levin [Wed, 10 Sep 2014 17:48:28 +0000 (17:48 +0000)]
tprint_sock_type: remove unused parameter

* net.c (tprint_sock_type): Remove unused parameter 'tcp'.
(sys_socket, sys_socketpair): Update callers.

9 years agoprintsock: fix decoding of unrecognized AF_PACKET packet types
Dmitry V. Levin [Wed, 10 Sep 2014 00:13:56 +0000 (00:13 +0000)]
printsock: fix decoding of unrecognized AF_PACKET packet types

* net.c (printsock): Fix fallback string for AF_PACKET packet types.

9 years agodecode_select: fix potential use of an uninitialized variable
Dmitry V. Levin [Tue, 9 Sep 2014 22:42:12 +0000 (22:42 +0000)]
decode_select: fix potential use of an uninitialized variable

A pointer to fd_set was used uninitialized when nfds == 0.

* desc.c (decode_select): Initialize fds.

Reported-by: Zubin Mithra <zubin.mithra@gmail.com>
9 years agoUse external libaio.h
Dmitry V. Levin [Mon, 8 Sep 2014 15:20:10 +0000 (15:20 +0000)]
Use external libaio.h

Stop using an outdated partial copy of libaio.h, switch back to external
libaio.h from libaio.
This partially reverts commit 2df03c494eb3c36c4178eba35c374831031d1a58.

* aio.c: Drop a partial copy of libaio.h, include <libaio.h> instead.
(print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
HAVE_DECL_IO_CMD_PWRITEV.
* configure.ac: Check for libaio.h and declaration it provides.

9 years agomaint: post-release administrivia
Dmitry V. Levin [Tue, 19 Aug 2014 11:34:44 +0000 (11:34 +0000)]
maint: post-release administrivia

* NEWS: Add header line for next release.

9 years agoPrepare for 4.9 release v4.9
Dmitry V. Levin [Fri, 15 Aug 2014 13:14:15 +0000 (13:14 +0000)]
Prepare for 4.9 release

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

9 years agoSync strace.spec and debian/ with packages
Dmitry V. Levin [Fri, 15 Aug 2014 13:14:15 +0000 (13:14 +0000)]
Sync strace.spec and debian/ with packages

* debian/changelog: Sync with 4.8-1.1.
* debian/control: Likewise.
* debian/rules: Likewise.
* strace.spec: Sync with 4.8-5.

9 years agoNEWS: Update for 4.9 release
Dmitry V. Levin [Fri, 15 Aug 2014 00:36:36 +0000 (00:36 +0000)]
NEWS: Update for 4.9 release

9 years agoUpdate syscall tables to the point where they include renameat2
Mike Frysinger [Thu, 14 Aug 2014 08:05:41 +0000 (04:05 -0400)]
Update syscall tables to the point where they include renameat2

* linux/dummy.h: Add printargs aliases for sys_sched_getattr and
sys_sched_setattr.
* linux/aarch64/syscallent1.h: Add kcmp/finit_module/sched_setattr/
sched_getattr/renameat2.
* linux/alpha/syscallent.h: Add kcmp/finit_module.
* linux/arm/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/hppa/syscallent.h: Add sched_setattr/sched_getattr/utimes/renameat2.
* linux/i386/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Add getdents64/sched_setattr/sched_getattr/
renameat2.
* linux/mips/syscallent-o32.h: Add sched_setattr/sched_getattr/renameat2.
* linux/powerpc/syscallent.h: Fix finit_module/kcmp order.  Add sched_setattr/
sched_getattr/renameat2.
* linux/s390/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Add sched_setattr/sched_getattr.

9 years agorenameat2: add decoding support
Mike Frysinger [Thu, 14 Aug 2014 08:05:41 +0000 (04:05 -0400)]
renameat2: add decoding support

* file.c (decode_renameat, sys_renameat2): New functions.
(sys_renameat): Use decode_renameat.
* pathtrace.c (pathtrace_match): Handle sys_renameat2.
* linux/syscall.h (sys_renameat2): New prototype.
* xlat/rename_flags.in: New file.

10 years agoCREDITS: fix generation in out of tree builds
Mike Frysinger [Thu, 14 Aug 2014 08:05:37 +0000 (04:05 -0400)]
CREDITS: fix generation in out of tree builds

The {...} code changes the working dir with `cd`, but the commands outside
of that block expects to be in the original dir.  Change to a subshell so
the path outside of this block remains unchanged.

* Makefile.am ($(srcdir)/CREDITS): Change {...} to (...).