Commit Graph

4505 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
6f9aefde21 tests: move sprintrc function to libtests
* tests/tests.h (sprintrc): New prototype.
* tests/futex.c (sprintrc): Move to ...
* tests/sprintrc.c: ... new file.
* tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c.
2016-09-02 17:42:42 +00:00
Eugene Syromyatnikov
8bb9f473e4 tests/futex: add support to sprintrc for return codes other than 0 and -1
* tests/futex.c (sprintrc): Print the actual return code provided,
not just "0".  Check snprintf return code.
2016-09-02 17:21:14 +00:00
Eugene Syromyatnikov
243e1a909c tests/futex: increase sprintrc static buffer size
* tests/futex.c (sprintrc): Increase buffer size from 256 to 4096.
2016-09-02 17:20:04 +00:00
Eugene Syromyatnikov
100a7f2f8d tests/futex: rename retstr to sprintrc
* tests/futex.c (retstr): Rename to sprintrc.
(main): Convert all retstr calls to sprintrc.
2016-09-02 17:19:17 +00:00
Eugene Syromyatnikov
680d0e960c readahead: fix print format for the "count" argument
According to documentation and kernel's syscalls.h, its type is size_t,
so "%lu" format should be used instead of "%ld".

* readahead.c (SYS_FUNC(readahead)): Fix conversion specifier
for the "count" argument.
2016-09-01 15:18:11 +00:00
db4ef238bd tests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll
Use zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
instead of explicit casts with unpredictable sign extension semantics.

* tests/xstatx.c (print_time, main): Use zero_extend_signed_to_ull
instead of explicit cast.
(print_stat): Use zero_extend_signed_to_ull and
sign_extend_unsigned_to_ll instead of explicit casts.
2016-08-31 16:31:53 +00:00
ca7c8952ea tests: add sign_extend_unsigned_to_ll macro
* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.
2016-08-31 16:09:24 +00:00
Eugene Syromiatnikov
2909c7c1d8 Refactor common sa_handler printing code
* xlat/sa_handler_values.in: New file.
* signal.c: Include "xlat/sa_handler_values.h".
(get_sa_handler_str, print_sa_handler): New functions.
(SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them.
2016-08-31 15:41:41 +00:00
e31e2c0e57 Update TCP* constants
* xlat/socktcpoptions.in: Add TCP_REPAIR_WINDOW introduced by linux
kernel commit v4.8-rc1~140^2~226.
2016-08-31 08:49:31 +00:00
80b49fb4dc Update SCTP_* constants
* xlat/socksctpoptions.in: Add SCTP_PR_SUPPORTED, SCTP_DEFAULT_PRINFO,
and SCTP_PR_ASSOC_STATUS introduced by linux kernel commits
v4.8-rc1~140^2~148^2~5, v4.8-rc1~140^2~148^2~4, and
v4.8-rc1~140^2~148^2~3, respectively.
2016-08-30 18:22:41 +00:00
9c3f5daa16 Update fs *_MAGIC constants
* xlat/fsmagic.in: Add BALLOON_KVM_MAGIC and ZSMALLOC_MAGIC introduced
by linux kernel commits v4.8-rc1~147^2~82 and v4.8-rc1~147^2~74,
respectively.
2016-08-30 18:19:16 +00:00
6d68e0d4dd Update KEXEC_ARCH_* constants
* xlat/kexec_arch_values.in: Add KEXEC_ARCH_AARCH64 introduced by linux
kernel commit v4.8-rc1~16^2~41.
2016-08-30 18:13:38 +00:00
788e5f37d3 Update ETH_P_* constants
* xlat/ethernet_protocols.in: Add ETH_P_NCSI introduced by linux kernel
commit v4.8-rc1~140^2~65^2~8.
2016-08-30 18:11:13 +00:00
3b9e6a34b8 Update BPF_* constants
* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_CGROUP_ARRAY introduced
by linux kernel commit v4.8-rc1~140^2~212^2~2.
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_XDP introduced
by linux kernel commit v4.8-rc1~140^2~64^2~10.
2016-08-30 18:01:50 +00:00
78b0755828 Remove HAVE_SIGACTION checks
The syscall parsers guarded by HAVE_SIGACTION check have to be compiled
regardless of libc sigaction function availability.

* configure.ac (AC_CHECK_FUNCS): Remove sigaction.
* signal.c: Remove HAVE_SIGACTION checks.
2016-08-30 17:44:33 +00:00
c47beb7091 Remove obsolescent autoconf macro AC_TYPE_SIGNAL
All supported systems are expected to have C89 conforming sematics.

* configure.ac (AC_TYPE_SIGNAL): Remove.
2016-08-30 17:38:37 +00:00
a7857e50e4 Remove obsolescent autoconf macro AC_C_CONST
All supported systems are expected to have the 'const' keyword.

* configure.ac (AC_C_CONST): Remove.
2016-08-30 17:38:37 +00:00
Eugene Syromiatnikov
c965bec3a1 tests: check decoding of futex syscall
* tests/futex.c: New file.
* tests/futex.test: New test.
* tests/.gitignore: Add futex.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add futex.test.
2016-08-30 17:38:26 +00:00
Eugene Syromyatnikov
d02a91dd2c futex: do not pretend <linux/futex.h> is included
As configure.ac does not check for linux/futex.h, HAVE_LINUX_FUTEX_H is
never defined and therefore the inclusion of <linux/futex.h> guarded by
HAVE_LINUX_FUTEX_H makes no sense.

Moreover, <linux/futex.h> used to have an incorrect definition
of FUTEX_WAIT_BITSET_PRIVATE and FUTEX_WAKE_BITSET_PRIVATE:
since kernel commit v2.6.24-6320-gcd68998 where these definitions
were initially introduced and up to v2.6.31-7082-gf8d1e54 where they
were finally fixed these macros had been incorrectly defined via
FUTEX_WAIT_BITS and FUTEX_WAKE_BITS instead of FUTEX_WAIT_BITSET
and FUTEX_WAKE_BITSET, and these incorrect definitions made their way
into some distributions still in use.

* futex.c [HAVE_LINUX_FUTEX_H]: Remove.
2016-08-30 17:29:28 +00:00
Eugene Syromyatnikov
110da33aff futex: avoid printing val when it is not used by the futex command
This is analogous to timeout argument omitting in FUTEX_WAKE_BITSET
command.

* futex.c (SYS_FUNC(futex)): Remove common printing of val argument.
Add printing of val argument for all futex commands except
FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI.
2016-08-30 17:29:28 +00:00
Eugene Syromyatnikov
606d4b2d54 xlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set
* xlat/futexops.in: Add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and
FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME values supported by linux kernel
since commit v4.5-rc1~172^2.
2016-08-30 17:26:58 +00:00
Eugene Syromyatnikov
ebeae24de4 futex: fix formatting of unknown command argument
Use alternate form for printing hexadecimal numbers to avoid confusion.
Use printaddr to print uaddr as the latter is interpreted as a pointer
in all currently supported futex operations.

* futex.c (SYS_FUNC(futex)): Fix formatting of unknown command
argument.
2016-08-30 15:53:51 +00:00
Eugene Syromyatnikov
3e0e10532d futex: add handling of FUTEX_FD command
Since obsolete FUTEX_FD command is known and used to have some expected
argument format, print FUTEX_FD using that format.

* futex.c (SYS_FUNC(futex)): Handle FUTEX_FD command.
2016-08-30 15:53:51 +00:00
Eugene Syromyatnikov
a3e1ad344b futex: fix formatting of val3 hexadecimal argument
* futex.c (SYS_FUNC(futex)): In FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET,
print hexadecimal val3 argument in alternate form to avoid confusion.
2016-08-30 15:53:51 +00:00
Eugene Syromyatnikov
bfa22a596f futex: fix FUTEX_WAKE_OP compare function mask
According to the initial and current (v4.7) kernel implementations,
in FUTEX_WAKE_OP case the compare function does not have
FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits starting with bit 24.

* futex.c (SYS_FUNC(futex)): Do not print FUTEX_OP_OPARG_SHIFT
for 27th bit of val3 in FUTEX_WAKE_OP case.
2016-08-30 15:53:51 +00:00
b80894cf07 tests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c
* bootstrap: Add -DMPERS_IS_$(MPERS_NAME) to ARCH_MFLAGS.
* tests/xstatx.c [USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC.
[USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC.
[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC.
[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
to HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC.

Based on patch by James Clarke <jrtc27@jrtc27.com>.
2016-08-30 15:50:36 +00:00
ae914db459 Remove redundant check for PTRACE_LISTEN availability
As ptrace.h already ensures that PTRACE_LISTEN is defined,
there is no need to check this fact in other places.

* strace.c (ptrace_restart): Do not check that PTRACE_LISTEN is defined.
2016-08-30 09:12:06 +00:00
e2ea606a60 Remove unused autoconf macro AC_TYPE_GETGROUPS
strace code does not use GETGROUPS_T.

* configure.ac (AC_TYPE_GETGROUPS): Remove.
2016-08-30 00:56:13 +00:00
730c49fb2a Remove unused autoconf macro AC_TYPE_MODE_T
strace code already redefines mode_t.

* configure.ac (AC_TYPE_MODE_T): Remove.
2016-08-30 00:56:04 +00:00
James Clarke
b4a32f9e57 Use PTRACE_SUNDETACH everywhere on SPARC and SPARC64
SPARC has a different PTRACE_DETACH value correctly defined in
sys/ptrace.h, but linux/ptrace.h clobbers it with the standard one.
PTRACE_SUNDETACH is also defined to the correct value by sys/ptrace.h,
so use that instead.

* strace.c (detach) [SPARC]: Move redefinition of PTRACE_DETACH
to PTRACE_SUNDETACH ...
* ptrace.h [SPARC || SPARC64]: ... here.
2016-08-30 00:48:36 +00:00
fcfdf89b8e Remove obsolescent autoconf macro AC_HEADER_STDC
All systems supported by strace are expected to have C89 conforming
header files.

* configure.ac (AC_HEADER_STDC): Remove.
2016-08-29 16:18:11 +00:00
79396167dd Remove unneeded autoconf macro AC_HEADER_DIRENT
strace code already includes <dirent.h> unconditionally.

* configure.ac (AC_HEADER_DIRENT): Remove.
2016-08-29 16:09:57 +00:00
39888f9358 Remove unneeded autoconf macro AC_HEADER_STDBOOL
strace code assumes C99.

* configure.ac (AC_HEADER_STDBOOL): Remove.
* defs.h: Include <stdbool.h> unconditionally.
2016-08-28 00:03:14 +00:00
5670786bcd Remove obsolescent autoconf macro AC_HEADER_STAT
No systems supported by strace are expected to have the bug workarounded
by AC_HEADER_STAT macro.

* configure.ac (AC_HEADER_STAT): Remove.
2016-08-27 23:42:29 +00:00
50608a4098 Do not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally
glibc, starting with commit glibc-2.24-28-gdbab657, has deprecated
inclusion of <sys/sysmacros.h> by <sys/types.h>.  The method used
for deprecation breaks AC_HEADER_MAJOR: this autoconf macro no longer
defines MAJOR_IN_SYSMACROS, which consequently breaks build.

Let's assume that all systems supported by strace provide major, minor,
and makedev macros via <sys/sysmacros.h>.

* configure.ac (AC_HEADER_MAJOR): Remove.
* mknod.c [MAJOR_IN_SYSMACROS, MAJOR_IN_MKDEV]: Remove.
Include <sys/sysmacros.h> unconditionally.
* print_struct_stat.c: Likewise.
* tests/mknod.c: Likewise.
* tests/mknodat.c: Likewise.
* tests/xstatx.c: Likewise.
2016-08-29 15:36:02 +00:00
e7d3d645ae btrfs: mpersify struct btrfs_ioctl_vol_args_v2
This complements commit v4.11-719-gfb0c609.

* btrfs.c (struct_btrfs_ioctl_vol_args_v2): New type.  Mpersify it.
(btrfs_print_qgroup_inherit): Change qgi_addr type to unsigned long.
(btrfs_ioctl): Replace struct btrfs_ioctl_vol_args_v2 with
struct_btrfs_ioctl_vol_args_v2.
2016-08-29 15:30:45 +00:00
Elvira Khabirova
27a1a3f3eb mpers.awk: relax union member name absence check
This fixes mpersing of unions containing nameless members,
e.g. struct btrfs_ioctl_vol_args_v2.

* mpers.awk (what_is): Print names of union_type members as is.
2016-08-29 15:30:21 +00:00
6fc53380c6 Revert "tests/xstatx.c: fix stat syscall tests on mips64"
Previous commit effectively changed types of st_atime, st_ctime, and
st_mtime members of struct stat and struct stat64 to signed integers,
making the mips64 workaround obsolete.

This reverts commit 3fb84bfc79.

* tests/xstatx.c (create_sample) [__mips64]: Remove.
2016-08-24 15:33:34 +00:00
a7c4ee41ff Mpersify parsers of struct stat and struct stat64
On many architectures that support multiple personalities,
struct stat differ between personalities.  While old code could handle
these differences, there are some architectures, e.g. sparc64, that also
have different struct stat64.  Rewrite parsers using mpers functionality
to fix these issues.

* fetch_struct_stat.c: New file.
* fetch_struct_stat64.c: Likewise.
* print_struct_stat.c: Likewise.
* oldstat.c: Likewise.
* stat.c: Likewise.
* stat.h: Likewise.
* stat64.c: Likewise.
* file.c: Remove.
* printstat.h: Likewise.
* linux/aarch64/stat32.h: Likewise.
* linux/powerpc64/stat32.h: Likewise.
* linux/riscv/stat32.h: Likewise.
* linux/sparc64/stat32.h: Likewise.
* linux/tile/stat32.h: Likewise.
* linux/x32/stat32.h: Likewise.
* linux/x86_64/stat32.h: Likewise.
* Makefile.am (strace_SOURCES): Add fetch_struct_stat.c,
fetch_struct_stat64.c, print_struct_stat.c, oldstat.c, stat.c, stat.h,
and stat64.c.  Remove file.c, printstat.h, linux/aarch64/stat32.h,
linux/powerpc64/stat32.h, linux/riscv/stat32.h, linux/sparc64/stat32.h,
linux/tile/stat32.h, linux/x32/stat32.h, and linux/x86_64/stat32.h.
* configure.ac (AC_CHECK_MEMBERS): Add struct stat64.st_mtime_nsec.
* defs.h (struct strace_stat): New declaration.
(print_struct_stat): New prototype.
* linux/dummy.h (sys_fstatat64): Remove.
2016-08-24 15:32:10 +00:00
c778f7aff6 mpers.m4: check for struct stat64, struct stat, and their members
* m4/mpers.m4 (st_MPERS_STRUCT_STAT): New macro.
(st_MPERS): Use it.
2016-08-24 12:10:55 +00:00
a27c47b2c4 mpers: add MPERS_IS_* to CFLAGS passed to mpers.sh
This allows testing of MPERS_IS_* macros in pre-MPERS_DEFS parts
of source code.

* Makefile.am (mpers-m%.stamp): Add -DMPERS_IS_$(mpers_NAME) to CFLAGS
passed to mpers.sh.
* mpers_test.sh: Likewise.
2016-08-24 12:10:55 +00:00
1aae061d4d Move redefinition of stat types to asm_stat.h
* file.c: Move redefinition of types that might be used
to define struct stat ...
* linux/asm_stat.h: ... here.
* tests/xstatx.c: Remove redefinition of stat types.
2016-08-24 12:10:55 +00:00
1d81b3b35f x86_64: provide a replacement of <asm/stat.h> for x32 personality
For the reason described in commit v4.10-517-gcfde1e3, a correct
definition of struct stat for x32 personality is necessary to enable
"asm_stat.h" with -mx32 on x86_64.

* linux/x32/asm_stat.h: Rename to ...
* linux/x86_64/asm_stat.h: ... new file.
* Makefile.am (strace_SOURCES): Add it.
* linux/x32/asm_stat.h: New file, include "x86_64/asm_stat.h".
2016-08-24 12:10:50 +00:00
cbb95b6c6a x32/asm_stat.h: provide definitions for i386 personality
This enables x32/asm_stat.h with -m32.

* linux/x32/asm_stat.h [__x86_64__ && __ILP32__]: Redirect stat.
Include "linux/asm_stat.h".
(struct stat): Define for [__x86_64__ && __ILP32__] only.
(struct __old_kernel_stat): Remove.
2016-08-24 12:09:59 +00:00
c4da489a74 Introduce a separate SEN entry for fstatat64 syscall
* linux/dummy.h (sys_fstatat64): Redirect to sys_newfstatat.
* linux/32/syscallent.h: Replace SEN(newfstatat) with SEN(fstatat64).
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* pathtrace.c (pathtrace_match): Handle SEN_fstatat64.
2016-08-23 15:06:34 +00:00
788939b4a7 Do not check for struct stat.st_{a,c}time_nsec
Assume that the check for struct stat.st_mtime_nsec is enough.
Likewise, do not check for struct stat.st_{a,c}tim.tv_nsec.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_atime_nsec,
struct stat.st_ctime_nsec, struct stat.st_atim.tv_nsec,
and struct stat.st_ctim.tv_nsec.
* file.c (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Remove.
* printstat.h (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC): Replace with
HAVE_STRUCT_STAT_ST_MTIME_NSEC.
* tests/xstatx.c: Likewise.
2016-08-23 15:06:34 +00:00
b685f90eb7 Add sign_extend_unsigned_to_ll macro
* defs.h (sign_extend_unsigned_to_ll): New macro, mirrors
zero_extend_signed_to_ull.
2016-08-23 00:24:22 +00:00
b2dd46398f zero_extend_signed_to_ull: add short int support
* defs.h (zero_extend_signed_to_ull): Add short int support.
* tests/tests.h: Likewise.
2016-08-23 00:24:17 +00:00
031fc80059 Rename widen_to_ull to zero_extend_signed_to_ull
* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
All callers changed.
* tests/tests.h: Likewise.
2016-08-23 00:24:10 +00:00
3cac5ddd01 sparc, sparc64: remove obsolete code
Remove remains of solaris personality support.
This complements commit v4.10-45-gdf4dd8b.

* file.c [SPARC || SPARC64] (SYS_FUNC(xstat), SYS_FUNC(fxstat)): Remove.
2016-08-23 00:24:03 +00:00