Commit Graph

2795 Commits

Author SHA1 Message Date
5b05361dcd Fix lookup_dcookie syscall entries
* linux/s390/syscallent.h (lookup_dcookie): Add syscall entry.
* linux/s390x/syscallent.h (lookup_dcookie): Likewise.
* linux/tile/syscallent.h (lookup_dcookie): Change nargs to 3.
* linux/x32/syscallent.h (lookup_dcookie): Likewise.
2015-01-12 17:32:16 +00:00
f8b7994900 aarch64: fix syscall names for statfs, fstatfs, truncate, and ftruncate
* linux/aarch64/syscallent1.h (statfs, fstatfs, truncate, ftruncate):
Use correct syscall names.
2015-01-12 17:32:16 +00:00
83eaf7b87f aarch64: fix mlock syscall entry
* linux/aarch64/syscallent1.h (mlock): Change to mlock entry.
2015-01-12 17:32:16 +00:00
41eb00de4c sh, sh64: fix mlock syscall entry
* linux/sh/syscallent.h (mlock): Change nargs to 2.
* linux/sh64/syscallent.h (mlock): Likewise.
2015-01-12 17:32:16 +00:00
7f31c22c2b tile: fix swapon syscall entries
* linux/tile/syscallent.h (swapon): Change nargs to 2.
* linux/tile/syscallent1.h (swapon): Likewise.
2015-01-12 17:32:16 +00:00
48ce4a3a52 ARM EABI: reserve some space for new syscalls
Reserve the same space for new syscalls on EABI as it is already
reserved on OABI.

* linux/arm/syscallent.h [__ARM_EABI__] (ARM_FIRST_SHUFFLED_SYSCALL):
Raise to 400.
2015-01-12 17:32:16 +00:00
cf7248d004 arm: rewrite shuffle_scno in a bit more readable way
* linux/arm/syscallent.h: Define ARM_FIRST_SHUFFLED_SYSCALL instead of
ARM_LAST_ORDINARY_SYSCALL.
* syscall.c [ARM || AARCH64] (shuffle_scno): Update.
2015-01-12 17:32:09 +00:00
12e2442784 tests: add tests for ipc syscalls decoding
* tests/ipc_msg.c: New file.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.
* tests/ipc_msg.test: New test.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add ipc_msg, ipc_sem, and ipc_shm.
(TESTS): Add ipc_msg.test, ipc_sem.test, and ipc_shm.test.
* tests/.gitignore: Add ipc_msg, ipc_sem, and ipc_shm.
2015-01-12 16:24:20 +00:00
3b499ca870 Fix indirect ipc subcall handling
indirect_ipccall used to guess whether currently decoded ipc syscall is
an indirect subcall or not based on generic knowledge, while there is a
robust method to identify indirect ipc subcalls.

* defs.h (TRACE_INDIRECT_SUBCALL): New flag.
* ipc.c (indirect_ipccall): Check it.
* linux/subcall.h: Set it.
2015-01-12 14:27:11 +00:00
7c524f420f Move socket and ipc subcall entries to subcall.h
Syscall entries for socket and ipc subcalls are the same on all
architectures, or at least they should be the same, so move them
to the single file.

* linux/subcall.h: Add syscall entries for socket and ipc subcalls.
* linux/arm/syscallent.h: Remove entries for socket and ipc subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/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/sparc/syscallent.h: Likewise.
2015-01-12 14:27:11 +00:00
cf4b7bba6c sh: fix typo introduced by commit v4.9-121-gd535b8b
* linux/sh/syscallent.h (getresgid32): Fix typo in sys_func and sys_name.
2015-01-12 14:24:44 +00:00
1ea64735fc Fix fanotify_mark decoding on 32-bit architectures
The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
architectures it is split up into two syscall arguments.

* configure.ac (AC_CHECK_FUNCS): Add fanotify_mark.
(AC_CHECK_HEADERS): Add sys/fanotify.h.
* defs.h (getllval): New prototype.
* util.c (getllval): New function based on printllval.
(printllval): Use getllval.
* fanotify.c (sys_fanotify_mark): Use getllval to properly decode
64-bit mask and two syscall arguments followed by it.
* tests/fanotify_mark.c: New file.
* tests/fanotify_mark.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add fanotify_mark.
(TESTS): Add fanotify_mark.test.
* tests/.gitignore: Add fanotify_mark.
2015-01-10 00:40:10 +00:00
197db577e8 v4l2: fix build on systems with older kernel headers
* v4l2.c (print_v4l2_format_fmt): Do not use
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY unless it is defined.
(v4l2_ioctl): Do not use VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS unless they are defined.
2015-01-09 04:53:19 +00:00
08b6397d13 tests: fix build with awk that does not support switch-case
The switch-case statement is a gawk-specific feature which is not
necessarily available, let's use traditional if-else statements instead.

* tests/uid.awk: Rewrite without switch-case statements.
2015-01-09 04:10:54 +00:00
75023a9381 Fix build on systems that lack O_CLOEXEC definition
* xlat/timerfdflags.in [!TFD_CLOEXEC]: Check that O_CLOEXEC is defined.
2015-01-09 03:47:23 +00:00
d9f7e7a439 Fix build on systems that lack NETLINK_SOCK_DIAG definition
NETLINK_INET_DIAG was introduced in linux v2.6.14,
NETLINK_SOCK_DIAG was added much later in linux v3.3.

* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]
(NETLINK_SOCK_DIAG): Define.
* socketutils.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
2015-01-09 03:05:56 +00:00
75d62047ad Cleanup local copy of linux/fanotify.h
* linux/fanotify.h: Remove macros and structures not used by
fanotify_init and fanotify_mark parsers.
2015-01-09 02:27:57 +00:00
ce21ef02da Fix "make dist" regression introduced by commit v4.9-125-g120e5db
* Makefile.am (EXTRA_DIST): Add linux/unix_diag.h.
2015-01-09 02:02:39 +00:00
b653509746 tests: fix build with fresh glibc
* tests/netlink_unix_diag.c: Include <stdint.h>.
2015-01-08 22:29:12 +00:00
e11169a5ba ioctlent.sh: handle linux/aufs_type.h properly
Before this change, ioctlent.sh could not recognize unusual constants
defined by linux/aufs_type.h, resulting to ioctls.h with references to
these constants without appropriate definitions in ioctldefs.h.

* linux/ioctlent.sh: Update the regexp that is used to lookup constants
referenced by generated ioctls.h.
2015-01-08 20:59:44 +00:00
60cb10dd8f tests: fix distcheck
* tests/stat32-v.test: Remove work files if the test is skipped.
2015-01-08 18:46:30 +00:00
d4a9d83235 Fix printing of time_t values set in the distant future
* util.c (sprinttime): Increase buffer size.
* tests/stat64-v.test: Try to set modification time of the sample file
to a value set in the distant future.
2015-01-08 15:34:43 +00:00
9e6a7bf202 Use AC_CHECK_TYPES to check for struct statfs64
* m4/statfs.m4: Remove.
* configure.ac (AC_STATFS64): Remove.
(AC_CHECK_TYPES): Add struct statfs64.
* statfs.c: Replace HAVE_STATFS64 with HAVE_STRUCT_STATFS64.
2015-01-08 04:12:29 +00:00
7b9bc44e63 Use AC_CHECK_TYPES to check for struct stat64
* m4/stat.m4: Remove.
* configure.ac (AC_STAT64): Remove.
(AC_CHECK_TYPES): Add struct stat64.
* file.c: Replace HAVE_STAT64 with HAVE_STRUCT_STAT64.
2015-01-08 04:06:06 +00:00
f19836be02 file.c: fix 32-bit stat decoding on 64-bit architectures
* file.c [SPARC || SPARC64] (struct stat): Remove, use generic
definition from <asm/stat.h>.
[SPARC64] (struct stat_sparc64, printstat_sparc64): Remove.
[AARCH64 || X86_64 || X32 || POWERPC64 || SPARC64] (struct stat32,
STAT32_PERSONALITY): Define.
[STAT32_PERSONALITY] (struct stat_powerpc32): Rename to struct stat32.
[STAT32_PERSONALITY] (printstat_powerpc32): Rename to printstat32.
(printstat) [STAT32_PERSONALITY]: Call printstat32 when
current_personality == STAT32_PERSONALITY.
[HAVE_STAT64] (printstat64) [STAT32_PERSONALITY]: Call printstat when
current_personality != STAT32_PERSONALITY.
[!HAVE_STAT64] (sys_stat64): Fallback to sys_stat.
[!HAVE_STAT64] (sys_fstat64): Fallback to sys_fstat.
2015-01-08 03:34:04 +00:00
e6e475c60e sparc: reuse struct stat parser code for struct solstat decoding
* printstat.h: Parametrize major() and minor().
* file.c [SPARC || SPARC64]: Define do_printstat_sol by instantiating
printstat.h template.
[SPARC || SPARC64] (printstatsol): Use do_printstat_sol.
2015-01-08 03:17:53 +00:00
721de7887a ppc64: reuse struct stat parser code for struct stat_powerpc32 decoding
* file.c [POWERPC64]: Define do_printstat32 by instantiating printstat.h
template.
[POWERPC64] (printstat_powerpc32): Use do_printstat32.
2015-01-08 03:17:28 +00:00
c6ee0ecb5a file.c: group related parsers together
* file.c (sys_stat, sys_fstat): Collect in one place right before
the definition of printstat64.
(sys_stat64, sys_fstat64): Collect in one place right after the
definition of printstat64.
2015-01-08 01:14:53 +00:00
1fb1c13910 file.c: collect scattered __old_kernel_stat related code
* file.c [HAVE_STRUCT___OLD_KERNEL_STAT] (convertoldstat, printoldstat,
sys_oldstat, sys_oldfstat): Collect functions in one place.
2015-01-08 01:14:53 +00:00
b8ad393cec Use the same source code for struct stat/stat64 decoding
* file.c: Define do_printstat64 by instantiating printstat.h template.
(printstat64): Use do_printstat64.
2015-01-08 01:14:53 +00:00
553d8a2ae6 x32: use generic printstat/printstat64 parsers
* file.c (printstat) [X32]: Define.
(printstat64) [X32]: Use "struct stat64" instead of "struct stat".
Use printstat for x32 personality processes.
(printstat64_x32): Remove.
(sys_stat64, sys_fstat64) [X32]: Use printstat64 instead of
printstat64_x32.
2015-01-08 01:14:53 +00:00
8d411080ed x32: remove redundant definitions
* file.c [X32]: Do not define "struct stat" and "struct
__old_kernel_stat" locally, use definitions provided by <asm/stat.h>.
Do not define "struct stat64" exclusively, reuse another definition
added earlier for X86_64.
2015-01-08 01:14:53 +00:00
ab21a9489f Convert do_printstat to a template function
* printstat.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Include "printstat.h".
(do_printstat): Move to printstat.h, parametrize its name
and struct stat.
2015-01-08 01:14:53 +00:00
d01f0a85bc file.c: prepare realprintstat for parametrization
* file.c (realprintstat): Adjust format strings so that all 64-bit
integer fields are printed with %llu format, and %u format is used for
all the rest.  Rename to do_printstat.
(printstat, printoldstat): Update callers.
2015-01-08 01:14:53 +00:00
655633e6f9 tests: cleanup stat.test
* tests/stat.test: Rewrite in a more readable way.
2015-01-08 00:59:44 +00:00
7b01014080 tests: check verbose decoding of 32-bit and 64-bit struct stat
* tests/stat.c: New file.
* tests/stat32.c: Likewise.
* tests/stat32-v.test: New file.
* tests/stat64-v.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add stat and stat32.
(stat_CFLAGS): Define.
(TESTS): Add stat32-v.test and stat64-v.test.
* tests/.gitignore: Add stat and stat32.
2015-01-08 00:59:42 +00:00
2928afe3b4 Cleanup struct stat.st_flags decoding
There are no symbolic constants defined for struct stat.st_flags,
so decode this rare field as unsigned int.

* xlat/fileflags.in: Remove.
* file.c (realprintstat, printstat64) [HAVE_STRUCT_STAT_ST_FLAGS]:
Decode struct stat.st_flags as unsigned int.
2015-01-07 22:05:38 +00:00
65ea0d0647 Drop struct stat.st_aclcnt and stat.st_level support
Remove the code that supports struct stat.st_aclcnt and stat.st_level
decoding -- these fields are not defined in system headers.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_aclcnt and
struct stat.st_level.
* file.c (realprintstat, printstat64)
[HAVE_STRUCT_STAT_ST_ACLCNT || HAVE_STRUCT_STAT_ST_LEVEL]: Remove.
2015-01-07 22:05:38 +00:00
c9cc4cbc50 tests: fix race condition in net-accept-connect based tests
Change all net-accept-connect based tests to use different unix domain
socket addresses, so that these tests could be safely run in parallel.

* tests/net-accept-connect.c: Parametrize unix domain socket address.
* tests/net-fd.test: Pass socket address to net-accept-connect.
* tests/net.test: Likewise.
* tests/unix-yy.test: Likewise.
* tests/unix-yy-accept.awk: Update regexps.
* tests/unix-yy-connect.awk: Likewise.
2015-01-07 22:05:38 +00:00
Mike Frysinger
f1639d8f51 timerfd: update flags decoding
The current code only decodes TFD_TIMER_ABSTIME when the kernel has
a bunch of newer flags.  We have to handle fallbacks for all of them
since the kernel doesn't currently export things to userspace.

* time.c: Include fcntl.h for O_* defines.
(TFD_TIMER_ABSTIME): Move to xlat/timerfdflags.in.
* xlat/timerfdflags.in: Add more definitions.
2014-12-31 00:27:57 +00:00
e00a9571d4 sparc: fix fxstat decoding
* file.c [SPARC || SPARC64] (sys_fxstat): Print file descriptor
using printfd.
2014-12-29 03:18:36 +00:00
e6219fbdb1 sparc: drop _STAT64_VER support
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* file.c [SPARC || SPARC64] (sys_xstat, sys_fxstat): Remove
_STAT64_VER code.
2014-12-29 03:08:53 +00:00
55ba9b30f0 sparc: remove redundant sys_lxstat
* file.c [SPARC || SPARC64] (sys_lxstat): Remove.
* linux/sparc/dummy2.h (solaris_lxstat): Alias to sys_xstat.
* linux/sparc64/dummy2.h (solaris_lxstat): Likewise.
2014-12-29 03:04:11 +00:00
ea77892aaa file.c: do not include unused headers
* file.c: Do not include <fcntl.h>.
2014-12-28 15:24:21 +00:00
ee21a5ba35 Cleanup UTIME_NOW/UTIME_OMIT decoding
Move the code that's present in two copies from sprinttv()
to a new helper function.

* time.c (do_sprinttv): New function.
(sprinttv): Use it.
2014-12-27 00:39:21 +00:00
Elliott Hughes
6d5abd33ed Fix UTIME_NOW/UTIME_OMIT decoding
The kernel doesn't actually care what tv_sec is set to --- it only checks
tv_nsec when looking for the special values.
2014-12-27 00:39:20 +00:00
959205c2a8 Make -yy output for inet sockets consistent with unix domain sockets
Prepend -yy output generated for INET/INET6 TCP/UDP sockets with their
protocol name obtained using getxattr.

* socketutils.c (inet_parse_response): Add proto_name argument.
Print proto_name for connected and unconnected sockets.
(receive_responses): Add proto_name argument, pass it to the parser.
(inet_print): Add proto_name argument, pass it to receive_responses.
(unix_parse_response): Add proto_name argument.
(print_sockaddr_by_inode): Pass protocol name to inet_print calls.
* tests/net-yy-accept.awk: Update to match new output format.
* tests/net-yy-connect.awk: Likewise.
2014-12-26 23:29:26 +00:00
f0ed167ecc tests: robustify unix domain socket decoding test
Unix domain socket address family name is not universally decoded as
AF_LOCAL, other names like AF_UNIX and AF_FILE are valid synonyms.
Similarly, PF_UNIX and PF_FILE are valid synonyms for PF_LOCAL.

Some test regexps have to be properly initialized before they could
be used, so make sure they are initialized before use.
2014-12-25 01:13:33 +00:00
6b5df32955 tests: fix unix domain socket decoding availability test
Since inet_diag and unix_diag interfaces are implemented by different
kernel modules, they have to be tested separately.

* tests/netlink_unix_diag.c: New file.
* tests/unix-yy.test: Use it.
* tests/Makefile.am (check_PROGRAMS): Add it.
* tests/.gitignore: Likewise.
2014-12-25 01:01:13 +00:00
Masatake YAMATO
6077ad8cc6 tests: add a test for decoding unix domain socket addresses
* tests/unix-yy-accept.awk: New file.
* tests/unix-yy-connect.awk: New file.
* tests/unix-yy.test: New test.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add unix-yy-accept.awk and unix-yy-connect.awk.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-12-25 01:01:11 +00:00