]>
granicus.if.org Git - strace/log
Dmitry V. Levin [Tue, 3 May 2016 22:30:41 +0000 (22:30 +0000)]
Mpersify VIDIOC_* ioctl parser
* v4l2.c: Mpersify arch-specific structures.
(v4l2_ioctl): Mpersify.
* tests/ioctl_v4l2.c: New file.
* tests/ioctl_v4l2.test: New test.
* tests/.gitignore: Add ioctl_v4l2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_v4l2.test.
Dmitry V. Levin [Mon, 2 May 2016 22:06:56 +0000 (22:06 +0000)]
Mpersify ioctl macros
As values of some ioctl macros differ between personalities, these
personality specific ioctl macros should be properly defined for
mpersified code. Implement this by redefining personality specific
ioctl macros from ioctlent*.h for each file that includes MPERS_DEFS.
* Makefile.am (ioctl_macros_h): New variable.
(ioctl_macros%.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add $(ioctl_macros_h).
(m%_type_defs.h): #include MPERS_$(mpers_PREFIX)IOCTL_MACROS.
* defs.h [HAVE_M32_MPERS] (MPERS_m32_IOCTL_MACROS): New macro.
[HAVE_MX32_MPERS] (MPERS_mx32_IOCTL_MACROS): Likewise.
Acked-by: Elvira Khabirova <lineprinter0@gmail.com>
Dmitry V. Levin [Sun, 1 May 2016 17:25:24 +0000 (17:25 +0000)]
Fix decoding of VIDIOC_* ioctls
* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
* tests/ioctl.c (main): Update.
Dmitry V. Levin [Sat, 30 Apr 2016 17:15:04 +0000 (17:15 +0000)]
nsyscalls.test: add mips o32 support
Out-of-range syscalls looks differently on mips o32.
* tests/nsyscalls.c (main): Handle LINUX_MIPSO32.
* tests/nsyscalls.test: Trace syscall called "syscall" on mips.
Dmitry V. Levin [Fri, 29 Apr 2016 21:31:08 +0000 (21:31 +0000)]
Remove initialization of big holes in syscallent.h files
There is no need to explicitly initialize big holes after conversion
of syscallent.h files to use designated initializers. For architectures
that have some data at the end of syscallent.h this initialization of
big holes is no-op, for others it just inflates the table unnecessarily.
* linux/arc/syscallent.h: Remove initialization of arch specific block
at the end of table.
* linux/metag/syscallent.h: Likewise.
* linux/nios2/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
* linux/arm/syscallent.h: Remove explicit initialization of a big hole
before socket subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/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.
* linux/sparc64/syscallent.h: Likewise.
* linux/mips/syscallent-compat.h: Remove explicit initialization
of big holes between different mips ABIs.
* linux/mips/syscallent-n64.h: Remove explicit initialization
of big holes before socket subcalls and between different mips ABIs.
* linux/mips/syscallent-o32.h: Likewise.
Dmitry V. Levin [Fri, 29 Apr 2016 20:12:54 +0000 (20:12 +0000)]
xlat: make "1<<val" syntax work with 64-bit values
* xlat/gen.sh(cond_xlat, gen_header): Generate 1UUL<<val
for 1<<val syntax.
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Dmitry V. Levin [Fri, 29 Apr 2016 20:04:38 +0000 (20:04 +0000)]
Fix typo in XLAT_TYPE_PAIR
* xlat.h (XLAT_TYPE_PAIR): Take "type" parameter.
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Dmitry V. Levin [Fri, 29 Apr 2016 17:26:56 +0000 (17:26 +0000)]
Fix decoding of move_pages syscall
* numa.c (print_page_array, print_status, print_int, print_int_array):
New functions.
(SYS_FUNC(move_pages)): Rewrite using these functions.
* tests/move_pages.c: New file.
* tests/move_pages.test: New test.
* tests/.gitignore: Add move_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add move_pages.test.
Dmitry V. Levin [Fri, 29 Apr 2016 14:06:45 +0000 (14:06 +0000)]
tests: check decoding of mbind syscall
* tests/mbind.c: New file.
* tests/mbind.test: New test.
* tests/.gitignore: Add mbind.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mbind.test.
Jeff Mahoney [Thu, 28 Apr 2016 15:26:59 +0000 (11:26 -0400)]
Change type of struct xlat.val to uint64_t
Some ioctls have flags fields that are 64-bit. A 32-bit val means
these flags will never be matched or printed.
* xlat.h: Include <stdint.h>.
(struct xlat): Change type of val to uint64_t.
Dmitry V. Levin [Fri, 29 Apr 2016 01:02:13 +0000 (01:02 +0000)]
xlat: extend syntax with #val_type directive
When #val_type directive is encountered, gen.sh starts using
XLAT_TYPE/XLAT_TYPE_PAIR macros instead of XLAT/XLAT_PAIR,
with #val_type's argument as a type.
For example, "#val_type uint64_t" means values of type uint64_t.
* xlat/gen.sh (gen_header, print_xlat, print_xlat_pair):
Add val_type support.
Dmitry V. Levin [Fri, 29 Apr 2016 01:02:13 +0000 (01:02 +0000)]
xlat/gen.sh: prepare for adding #val_type directive support
This is essentially a no-op change that makes the following change
easier to read.
* xlat/gen.sh (print_xlat, print_xlat_pair): New functions.
(cond_xlat, gen_header): Use them.
Dmitry V. Levin [Fri, 29 Apr 2016 00:03:48 +0000 (00:03 +0000)]
Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros
* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
to the specified type instead of unsigned int.
(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
to the specified type instead of unsigned int.
Dmitry V. Levin [Thu, 28 Apr 2016 23:58:34 +0000 (23:58 +0000)]
xlat: generate xlat pairs using new XLAT_PAIR macro
Before this change there were two forms of xlat entries: those that use XLAT
or XLAT_END macros, and others verbatim entries. This change converts
the latter to use new XLAT_PAIR macro.
This is necessary for the upcoming change of xlat.val type.
* xlat.h (XLAT_PAIR): New macro.
* xlat/gen.sh (cond_xlat, gen_header): Use it.
Dmitry V. Levin [Thu, 28 Apr 2016 23:52:28 +0000 (23:52 +0000)]
Explicitly cast argument of XLAT macro to unsigned int
This is necessary for the upcoming change of xlat.val type.
* xlat.h (XLAT): Cast the argument to unsigned int.
Dmitry V. Levin [Thu, 28 Apr 2016 23:40:37 +0000 (23:40 +0000)]
Change type of {s,t}print_open_modes's argument to unsigned
As "flags" argument of sprint_open_modes and tprint_open_modes is
involved only in bit operations, change its type to unsigned.
* defs.h.c (sprint_open_modes, tprint_open_modes): Change type
to unsigned int.
* open.c (sprint_open_modes, tprint_open_modes): Likewise.
Dmitry V. Levin [Thu, 28 Apr 2016 21:10:59 +0000 (21:10 +0000)]
tests/remap_file_pages.c: fix for the upcoming change of xlat.val type
The "flags" argument of remap_file_page syscall has type "unsigned
long", so it is not correct to load most significant bits with garbage
ans assume they are going to be ignored.
* tests/remap_file_pages.c (main): Remove artificial garbage from flags.
Dmitry V. Levin [Thu, 28 Apr 2016 18:55:18 +0000 (18:55 +0000)]
Introduce printflags64 function
This is necessary for the upcoming change of xlat.val type.
* defs.h (printflags): Rename to printflags64, change type of integer
argument to uint64_t.
(printflags): New static inline function.
* util.c (printflags): Rename to printflags64, change type of integer
argument to uint64_t. Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
Dmitry V. Levin [Thu, 28 Apr 2016 18:49:36 +0000 (18:49 +0000)]
Introduce sprintflags64 function
This is necessary for the upcoming change of xlat.val type.
* defs.h (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t.
(sprintflags): New static inline function.
* util.c (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t. Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
Dmitry V. Levin [Thu, 28 Apr 2016 18:42:10 +0000 (18:42 +0000)]
printxvals: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of printxvals are already prepared for this change.
* defs.h (printxvals): Change type of integer argument to uint64_t.
* util.c (printxvals): Likewise. Print it using PRIx64 format.
Patch by Jeff Mahoney <jeffm@suse.com>.
Dmitry V. Levin [Thu, 28 Apr 2016 18:37:54 +0000 (18:37 +0000)]
xlat_search: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.
* defs.h (xlat_search): Change type of integer argument to uint64_t.
* util.c (xlat_search): Likewise. Pass it by pointer.
(xlat_bsearch_compare): Treat first argument as a pointer.
Patch by Jeff Mahoney <jeffm@suse.com>.
Dmitry V. Levin [Thu, 28 Apr 2016 18:32:45 +0000 (18:32 +0000)]
Introduce xlookup64 function
This is necessary for the upcoming change of xlat.val type.
* defs.h (xlookup): Rename to xlookup64, change type of integer argument
to uint64_t.
(xlookup): New static inline function.
* util.c (xlookup): Rename to xlookup64, change type of integer
argument to uint64_t.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
Dmitry V. Levin [Thu, 28 Apr 2016 18:19:27 +0000 (18:19 +0000)]
addflags: change type of integer argument to uint64_t
This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.
* defs.h (addflags): Change type of integer argument to uint64_t.
* util.c (addflags): Likewise. Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
Dmitry V. Levin [Thu, 28 Apr 2016 18:15:20 +0000 (18:15 +0000)]
Introduce printxval64 wrapper
This is necessary for the upcoming change of xlat.val type.
* defs.h (printxval64): New static inline function.
Dmitry V. Levin [Thu, 28 Apr 2016 17:50:51 +0000 (17:50 +0000)]
Turn printxval macro into a static inline function
This is necessary for the upcoming change of xlat.val type.
* defs.h (printxval): Change to static inline function.
Dmitry V. Levin [Thu, 28 Apr 2016 01:09:59 +0000 (01:09 +0000)]
tests: check decoding of migrate_pages syscall
* tests/migrate_pages.c: New file.
* tests/migrate_pages.test: New test.
* tests/.gitignore: Add migrate_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add migrate_pages.test.
Dmitry V. Levin [Thu, 28 Apr 2016 01:19:19 +0000 (01:19 +0000)]
Fix decoding of migrate_pages syscall
* numa.c (SYS_FUNC(migrate_pages)): Print syscall arguments
in the right order.
Dmitry V. Levin [Wed, 27 Apr 2016 23:43:24 +0000 (23:43 +0000)]
tests: check decoding of set_mempolicy syscall
* tests/set_mempolicy.c: New file.
* tests/set_mempolicy.test: New test.
* tests/.gitignore: Add set_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add set_mempolicy.test.
Dmitry V. Levin [Wed, 27 Apr 2016 21:58:43 +0000 (21:58 +0000)]
tests: check decoding of get_mempolicy syscall
* tests/get_mempolicy.c: New file.
* tests/get_mempolicy.test: New test.
* tests/.gitignore: Add get_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add get_mempolicy.test.
Dmitry V. Levin [Wed, 27 Apr 2016 22:02:26 +0000 (22:02 +0000)]
numa: fix decoding of nodemask arrays
* numa.c (get_nodes): Rewrite an rename to print_nodemask.
All callers updated.
(SYS_FUNC(mbind), SYS_FUNC(set_mempolicy), SYS_FUNC(get_mempolicy)):
Print a delimiter before nodemask argument.
Dmitry V. Levin [Wed, 27 Apr 2016 22:36:07 +0000 (22:36 +0000)]
Fix decoding of policy argument of get_mempolicy syscall
* numa.c (SYS_FUNC(get_mempolicy)): Print policy argument in square
brackets to indicate indirect access.
Dmitry V. Levin [Wed, 27 Apr 2016 22:08:21 +0000 (22:08 +0000)]
Fix decoding of pid_t argument of migrate_pages syscall
* numa.c (SYS_FUNC(migrate_pages)): Print pid_t syscall
argument using %d format.
Dmitry V. Levin [Wed, 27 Apr 2016 20:29:46 +0000 (20:29 +0000)]
tests: add printxval function to libtests
* tests/tests.h (printxval): New prototype.
* tests/printxval.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
Dmitry V. Levin [Wed, 27 Apr 2016 16:04:01 +0000 (16:04 +0000)]
tests: check decoding of remap_file_pages syscall
* tests/remap_file_pages.c: New file.
* tests/remap_file_pages.test: New test.
* tests/.gitignore: Add remap_file_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add remap_file_pages.test.
Fei Jie [Wed, 27 Apr 2016 08:54:21 +0000 (16:54 +0800)]
tests: add pause.test
* tests/pause.c: New file.
* tests/pause.test: New test.
* tests/.gitignore: Add pause.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pause.test.
Fei Jie [Wed, 27 Apr 2016 08:54:20 +0000 (16:54 +0800)]
tests: add kill.test
* tests/kill.c: New file.
* tests/kill.test: New test.
* tests/.gitignore: Add kill.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kill.test.
Dmitry V. Levin [Wed, 27 Apr 2016 11:49:38 +0000 (11:49 +0000)]
Fix decoding of pid_t arguments of kill and tgkill syscalls
* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Print pid_t syscall
arguments using %d format.
Fei Jie [Wed, 27 Apr 2016 08:54:19 +0000 (16:54 +0800)]
tests: add mlock.test
* tests/mlock.c: New file.
* tests/mlock.test: New test.
* tests/.gitignore: Add mlock.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mlock.test.
Dmitry V. Levin [Wed, 27 Apr 2016 05:06:06 +0000 (05:06 +0000)]
Move parsers of NUMA related syscalls to numa.c
* mem.c (get_nodes, SYS_FUNC(mbind), SYS_FUNC(set_mempolicy),
SYS_FUNC(get_mempolicy), SYS_FUNC(migrate_pages), SYS_FUNC(move_pages)):
Move ...
* numa.c: ... here.
* Makefile.am (strace_SOURCES): Add numa.c
Dmitry V. Levin [Wed, 27 Apr 2016 03:18:44 +0000 (03:18 +0000)]
tests/umovestr3.c: robustify against os specific issues
* tests/umovestr3.c (main): Create extra gap before unreadable page.
Dmitry V. Levin [Wed, 27 Apr 2016 00:08:06 +0000 (00:08 +0000)]
tests: extend test coverage of umovestr short read condition
* tests/umovestr3.c: New file.
* tests/umovestr3.test: New test.
* tests/.gitignore: Add umovestr3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr3.test.
Dmitry V. Levin [Tue, 26 Apr 2016 23:17:17 +0000 (23:17 +0000)]
tests: check decoding of out-of-range syscalls
* tests/nsyscalls.c: New file.
* tests/nsyscalls.test: New test.
* tests/.gitignore: Add nsyscalls.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add nsyscalls.test.
Dmitry V. Levin [Tue, 26 Apr 2016 22:38:10 +0000 (22:38 +0000)]
Fix decoding of 3rd argument of getdents/getdents64 syscalls
* dirent.c (SYS_FUNC(getdents)): Always print 3rd syscall argument
as unsigned int.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* tests/getdents.c (main): Check it.
* tests/getdents64.c (main): Likewise.
Dmitry V. Levin [Tue, 26 Apr 2016 17:41:44 +0000 (17:41 +0000)]
Fix decoding of LINUX_REBOOT_CMD_RESTART2 argument
* reboot.c (SYS_FUNC(reboot)): Cast numeric arguments to unsigned int.
Dmitry V. Levin [Tue, 26 Apr 2016 16:46:20 +0000 (16:46 +0000)]
.travis.yml: raise sleep delay
Previous sleep delay value seems to be not enough nowadays.
.travis.yml (SLEEP_A_BIT): Raise sleep delay.
Dmitry V. Levin [Tue, 26 Apr 2016 16:36:30 +0000 (16:36 +0000)]
Move definitions of MPOL_* constants to xlat files
* mem.c (MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, MPOL_INTERLEAVE):
Move to xlat/policies.in.
(MPOL_F_NODE, MPOL_F_ADDR): Move to xlat/mempolicyflags.in.
(MPOL_MF_STRICT, MPOL_MF_MOVE, MPOL_MF_MOVE_ALL): Move
to xlat/mbindflags.in.
Dmitry V. Levin [Tue, 26 Apr 2016 16:11:48 +0000 (16:11 +0000)]
tests: check decoding of renameat2 syscall
* tests/renameat2.c: New file.
* tests/renameat2.test: New test.
* tests/.gitignore: Add renameat2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add renameat2.test.
Dmitry V. Levin [Tue, 26 Apr 2016 16:30:13 +0000 (16:30 +0000)]
Add default values for RENAME_* constants
* xlat/rename_flags.in: Add default values.
Dmitry V. Levin [Tue, 26 Apr 2016 15:35:57 +0000 (15:35 +0000)]
tests: check decoding of utimes syscall
* tests/utimes.c: New file.
* tests/utimes.test: New test.
* tests/.gitignore: Add utimes.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add utimes.test.
Dmitry V. Levin [Tue, 26 Apr 2016 15:34:03 +0000 (15:34 +0000)]
tests: check decoding of futimesat syscall
* tests/futimesat.c: New file.
* tests/futimesat.test: New test.
* tests/.gitignore: Add futimesat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add futimesat.test.
Dmitry V. Levin [Tue, 26 Apr 2016 11:00:51 +0000 (11:00 +0000)]
tests: extend test coverage of mknod syscall
* mknod.c (main): Check more corner cases of mode_t parser.
* mknod.test: Update.
Fei Jie [Tue, 26 Apr 2016 08:03:11 +0000 (16:03 +0800)]
tests: add sched_yield.test
* tests/sched_yield.c: New file.
* tests/sched_yield.test: New test.
* tests/.gitignore: Add sched_yield.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add sched_yield.test.
Fei Jie [Tue, 26 Apr 2016 08:03:10 +0000 (16:03 +0800)]
tests: add sync.test
* tests/sync.c: New file.
* tests/sync.test: New test.
* tests/.gitignore: Add sync.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add sync.test.
Fei Jie [Tue, 26 Apr 2016 08:03:09 +0000 (16:03 +0800)]
tests: add mknodat.test
* tests/mknodat.c: New file.
* tests/mknodat.test: New test.
* tests/.gitignore: Add mknodat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mknodat.test.
Fei Jie [Tue, 26 Apr 2016 08:03:08 +0000 (16:03 +0800)]
tests: add unlink.test
* tests/unlink.c: New file.
* tests/unlink.test: New test.
* tests/.gitignore: Add unlink.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unlink.test.
Fei Jie [Tue, 26 Apr 2016 08:03:07 +0000 (16:03 +0800)]
tests: add reboot.test
* tests/reboot.c: New file.
* tests/reboot.test: New test.
* tests/.gitignore: Add reboot.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add reboot.test.
Dmitry V. Levin [Tue, 26 Apr 2016 00:21:26 +0000 (00:21 +0000)]
Fix decoding of statfs family syscalls
Fix decoders of fstatfs, fstatfs64, statfs, and statfs64 syscalls
by rewriting them using mpers infrastructure.
* fetch_struct_statfs.c: New file.
* fstatfs.c: Likewise.
* fstatfs64.c: Likewise.
* print_statfs.c: Likewise.
* statfs.h: Likewise.
* statfs64.c: Likewise.
* statfs.c: Remove everything except SYS_FUNC(statfs).
* configure.ac: Remove the check for struct statfs64 in <sys/vfs.h>.
Add checks for struct statfs and struct statfs64 in <asm/statfs.h>.
Add checks for f_frsize and f_flags members of these structures.
* defs.h (struct strace_statfs): New forward declaration.
(print_struct_statfs, print_struct_statfs64): New prototypes.
* Makefile.am (libstrace_a_SOURCES): Add fstatfs.c, fstatfs64.c,
statfs.c, and statfs64.c.
(strace_SOURCES): Add fetch_struct_statfs.c, print_statfs.c,
and statfs.h.
* NEWS: Mention this fix.
* tests/fstatfs.c: New file.
* tests/fstatfs64.c: Likewise.
* tests/statfs64.c: Likewise.
* tests/xstatfs.c: Likewise.
* tests/xstatfs64.c: Likewise.
* tests/xstatfsx.c: Likewise.
* tests/fstatfs.test: New test.
* tests/fstatfs64.test: Likewise.
* tests/statfs64.test: Likewise.
* tests/statfs.c: Rewrite using xstatfs.c.
* tests/statfs.test: Update.
* tests/.gitignore: Add fstatfs, fstatfs64, and statfs64.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fstatfs.test, fstatfs64.test, and statfs64.test.
(EXTRA_DIST): Add xstatfs.c, xstatfs64.c, and xstatfsx.c.
Dmitry V. Levin [Tue, 26 Apr 2016 00:13:47 +0000 (00:13 +0000)]
tests: add printflags function to libtests
* tests/printflags.c: New file.
* tests/tests.h (printflags): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
Dmitry V. Levin [Tue, 26 Apr 2016 00:08:16 +0000 (00:08 +0000)]
Move definition of struct xlat to a separate header file
Define struct xlat in a separate file so that it could be used later by
tests without inclusion of defs.h header file.
* defs.h (struct xlat, XLAT, XLAT_END): Move ...
* xlat.h: ... here.
* Makefile.am (strace_SOURCES): Add xlat.h.
Dmitry V. Levin [Mon, 25 Apr 2016 23:52:03 +0000 (23:52 +0000)]
alpha: decode osf_statfs64 and osf_fstatfs64 syscalls
* linux/alpha/syscallent.h (osf_statfs64, osf_fstatfs64): Set nargs
and handler.
Dmitry V. Levin [Mon, 25 Apr 2016 23:52:03 +0000 (23:52 +0000)]
alpha: fix decoding of osf_statfs and osf_fstatfs syscalls
Do not attempt to print struct osf_statfs as if it was the same as
struct statfs. Since struct osf_statfs has never been decoded properly,
it is probably too late to implement a decoder, so let's just print the
pointer.
* statfs.c [ALPHA] (SYS_FUNC(osf_statfs), SYS_FUNC(osf_fstatfs)): Move ...
* alpha.c: ... here. Replace printstatfs with printaddr.
Dmitry V. Levin [Mon, 25 Apr 2016 10:15:14 +0000 (10:15 +0000)]
statfs: print f_flags field only when ST_VALID flag is set
* statfs.c (print_statfs_flags): New function.
(printstatfs, printstatfs64, printcompat_statfs64): Use it.
* xlat/statfs_flags.in (ST_VALID): Move to the head of the list.
* tests/statfs.expected: Update.
Fei Jie [Mon, 25 Apr 2016 08:18:23 +0000 (16:18 +0800)]
tests: add symlink.test
* tests/symlink.c: New file.
* tests/symlink.test: New test.
* tests/.gitignore: Add symlink.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add symlink.test.
Fei Jie [Mon, 25 Apr 2016 08:18:22 +0000 (16:18 +0800)]
tests: add rmdir.test
* tests/rmdir.c: New file.
* tests/rmdir.test: New test.
* tests/.gitignore: Add rmdir.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add rmdir.test.
Fei Jie [Mon, 25 Apr 2016 08:18:21 +0000 (16:18 +0800)]
tests: add setdomainname.test
* tests/setdomainname.c: New file.
* tests/setdomainname.test: New test.
* tests/.gitignore: Add setdomainname.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setdomainname.test.
Fei Jie [Mon, 25 Apr 2016 08:18:20 +0000 (16:18 +0800)]
tests: add sched_rr_get_interval.test
* tests/sched_rr_get_interval.c: New file.
* tests/sched_rr_get_interval.test: New test.
* tests/.gitignore: Add sched_rr_get_interval.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add sched_rr_get_interval.test.
Dmitry V. Levin [Sun, 24 Apr 2016 23:54:52 +0000 (23:54 +0000)]
statfs: decode f_flags field of struct statfs
* xlat/statfs_flags.in: New file.
* statfs.c: Include "xlat/statfs_flags.h".
(printstatfs) [_STATFS_F_FLAGS]: Print statbuf.f_flags as flags.
(printstatfs64) [_STATFS_F_FLAGS]: Likewise.
(printcompat_statfs64): Likewise.
* tests/statfs.expected: Update.
Zev Weiss [Sun, 24 Apr 2016 23:32:33 +0000 (18:32 -0500)]
statfs: don't quote f_type macro names
* statfs.c (sprintfstype): Don't add double-quotes to fs magic macros.
* tests/statfs.expected: Remove double-quotes.
Dmitry V. Levin [Sat, 23 Apr 2016 01:53:43 +0000 (01:53 +0000)]
tests/shmxt.c: robustify against arch specific issues
Do not treat failed shmat(SHM_RND) as a test failure.
This change partially reverts commit
bea707377d2ee3e1950bfa43537ef928163a5fa6 .
* tests/shmxt.c (main): Use SHM_RND in the second shmat call,
do not treat its potential error as a test failure.
Dmitry V. Levin [Fri, 22 Apr 2016 23:54:58 +0000 (23:54 +0000)]
Rename PRI__s64 to PRI__d64
As PRI__*64 macros mirror PRI*64 macros from inttypes.h, follow the
principle of least astonishment and name these macros the same way.
* defs.h (PRI__s64): Rename to PRI__d64.
Dmitry V. Levin [Fri, 22 Apr 2016 23:41:36 +0000 (23:41 +0000)]
Fix old_mmap output when mmap arguments are unfetchable
* mem.c (SYS_FUNC(old_mmap)): Use umove_or_printaddr instead of umoven
to fetch mmap arguments, return RVAL_DECODED when umove_or_printaddr
fails.
* tests/old_mmap.c (main): Check it.
Dmitry V. Levin [Fri, 22 Apr 2016 23:47:46 +0000 (23:47 +0000)]
aarch64: fix old_mmap output for arm personality
* mem.c (SYS_FUNC(old_mmap)) [AARCH64]: Fetch mmap arguments
as 32-bit integers.
Dmitry V. Levin [Fri, 22 Apr 2016 23:36:26 +0000 (23:36 +0000)]
Define old_mmap parser only on architectures that use it
* mem.c (SYS_FUNC(old_mmap)): Define only on AARCH64, ARM, I386, X86_64,
X32, M68K, S390, and S390X.
Dmitry V. Levin [Fri, 22 Apr 2016 20:37:19 +0000 (20:37 +0000)]
tests: extend test coverage of mmap syscall
Check decoding of "old mmap" edition of mmap syscall
on those architectures that define it.
* tests/old_mmap.c: New file.
* tests/old_mmap.test: New test.
* tests/.gitignore: Add old_mmap.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add old_mmap.test.
Dmitry V. Levin [Fri, 22 Apr 2016 14:14:39 +0000 (14:14 +0000)]
tests: extend test coverage of mincore syscall
* tests/mincore.c (print_mincore): New function.
(test_mincore): Use it. Check mincore with invalid vec address.
Check mincore with length argument not a multiple of the page size.
(main): Check with DEFAULT_STRLEN pages.
Dmitry V. Levin [Fri, 22 Apr 2016 04:17:06 +0000 (04:17 +0000)]
Move parsers of sync_file_range and sync_file_range2 syscalls to libstrace
For each given architecture only one of these two syscalls has a
syscallent entry. When each parser is placed into a separate file,
moving to libstrace ensures that only one of them that is need
is linked into strace executable.
* sync_file_range.c (SYS_FUNC(sync_file_range2)): Move ...
* sync_file_range2.c: ... here.
* Makefile.am (strace_SOURCES): Move sync_file_range.c ...
(libstrace_a_SOURCES): ... here. Add sync_file_range2.c.
(strace_SOURCES_c): Add filtered libstrace_a_SOURCES.
Dmitry V. Levin [Fri, 22 Apr 2016 01:13:27 +0000 (01:13 +0000)]
tests: check decoding of clock_adjtime syscall
* tests/clock_adjtime.c: New file.
* tests/clock_adjtime.test: New test.
* tests/.gitignore: Add clock_adjtime.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add clock_adjtime.test.
Dmitry V. Levin [Thu, 21 Apr 2016 18:20:47 +0000 (18:20 +0000)]
tests: do not include <assert.h> unnecessarily
Automatically change tests/*.c files using the following script:
for f in tests/*.c; do
grep -q '\<assert(' "$f" ||
sed -i '/# *include *<assert\.h>/d' "$f"
done
Dmitry V. Levin [Thu, 21 Apr 2016 18:20:47 +0000 (18:20 +0000)]
tests: do not include <errno.h> unnecessarily
Automatically change tests/*.c files using the following script:
for f in tests/*.c; do
grep -Fv errno.h "$f" |
grep -Ewq '(si_)?errno|SOCK_FILTER_DENY_SYSCALL' ||
sed -i '/# *include *<errno\.h>/d' "$f"
done
Dmitry V. Levin [Thu, 21 Apr 2016 21:34:19 +0000 (21:34 +0000)]
tests/xetpriority.c: print syscall() result using %ld format
Dmitry V. Levin [Thu, 21 Apr 2016 21:33:43 +0000 (21:33 +0000)]
tests/xetpgid.c: print syscall() result using %ld format
Dmitry V. Levin [Thu, 21 Apr 2016 21:33:24 +0000 (21:33 +0000)]
tests/xchownx.c: use errno2name
Dmitry V. Levin [Thu, 21 Apr 2016 21:32:52 +0000 (21:32 +0000)]
tests/userfaultfd.c: stop using assert
Dmitry V. Levin [Thu, 21 Apr 2016 21:32:28 +0000 (21:32 +0000)]
tests/unlinkat.c: print syscall() result using %ld format
Dmitry V. Levin [Thu, 21 Apr 2016 21:32:00 +0000 (21:32 +0000)]
tests/umount.c: use errno2name
Dmitry V. Levin [Thu, 21 Apr 2016 21:28:30 +0000 (21:28 +0000)]
tests/truncate64.c: cleanup
* tests/truncate64.c (main): Use errno2name, stop using assert.
Dmitry V. Levin [Thu, 21 Apr 2016 21:28:03 +0000 (21:28 +0000)]
tests/truncate.c: cleanup
* tests/truncate.c (main): Use errno2name, stop using assert.
Dmitry V. Levin [Thu, 21 Apr 2016 21:27:19 +0000 (21:27 +0000)]
tests/tee.c: stop using assert
Dmitry V. Levin [Thu, 21 Apr 2016 21:26:52 +0000 (21:26 +0000)]
tests/syslog.c: use errno2name
Dmitry V. Levin [Thu, 21 Apr 2016 21:26:16 +0000 (21:26 +0000)]
tests/sync_file_range2.c: stop using assert
Dmitry V. Levin [Thu, 21 Apr 2016 21:25:55 +0000 (21:25 +0000)]
tests/sync_file_range.c: stop using assert
Dmitry V. Levin [Thu, 21 Apr 2016 21:25:29 +0000 (21:25 +0000)]
tests/symlinkat.c: cleanup
Dmitry V. Levin [Thu, 21 Apr 2016 21:24:43 +0000 (21:24 +0000)]
tests/swap.c: cleanup
* tests/swap.c (error_msg): Remove.
(main): Use errno2name.
Dmitry V. Levin [Thu, 21 Apr 2016 21:24:01 +0000 (21:24 +0000)]
tests/splice.c: stop using assert
Dmitry V. Levin [Thu, 21 Apr 2016 21:23:34 +0000 (21:23 +0000)]
tests/setugid.c: cleanup
Dmitry V. Levin [Thu, 21 Apr 2016 21:22:50 +0000 (21:22 +0000)]
tests/sethostname.c: use errno2name
Dmitry V. Levin [Thu, 21 Apr 2016 21:21:37 +0000 (21:21 +0000)]
tests/setgroups.c: use errno2name
* tests/setgroups.c (errno2str): Remove.
(main): Use errno2name.
Dmitry V. Levin [Thu, 21 Apr 2016 21:20:31 +0000 (21:20 +0000)]
tests/seccomp-strict.c: cleanup
* tests/seccomp-strict.c (main): Use errno2name, stop using assert.
Dmitry V. Levin [Thu, 21 Apr 2016 21:19:30 +0000 (21:19 +0000)]
tests/seccomp-filter.c: cleanup
* tests/seccomp-filter.c (main): Use errno2name, stop using assert.
Dmitry V. Levin [Thu, 21 Apr 2016 21:18:14 +0000 (21:18 +0000)]
tests/sched_xetscheduler.c: print syscall() result using %ld format