]> granicus.if.org Git - strace/log
strace
7 years agoUpdate fs *_MAGIC constants
Dmitry V. Levin [Wed, 14 Sep 2016 23:41:19 +0000 (23:41 +0000)]
Update fs *_MAGIC constants

Add fs *_MAGIC constants exported by linux uapi.

* xlat/fsmagic.in: Add BFS_MAGIC, GFS2_MAGIC, and ROMFS_MAGIC constants
defined in linux/bfs_fs.h, linux/gfs2_ondisk.h, and linux/romfs_fs.h,
respectively.

7 years agotests: workaround limited semctl implementation in musl
Dmitry V. Levin [Tue, 13 Sep 2016 20:33:04 +0000 (20:33 +0000)]
tests: workaround limited semctl implementation in musl

musl libc forwards semctl command argument for 8 known commands only,
for all the rest it passes 0 instead.

* tests/ipc_sem.c (main): Update semctl expected output.

7 years agotests: add more IPC decoding checks
Eugene Syromyatnikov [Tue, 13 Sep 2016 16:18:42 +0000 (19:18 +0300)]
tests: add more IPC decoding checks

* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
commands) checks.
* tests/ipc_sem.c: Additional semget and semctl checks.
* tests/ipc_shm.c: Additional shmget and shmctl checks.
* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
* tests/semop.test: Add explicit -e parameter in order to trace both
semop and semtimedop.
* tests/shmxt.c: Additional shmat and shmdt checks.

7 years ago.mailmap: add addresses of Dr. David Alan Gilbert
Dmitry V. Levin [Mon, 12 Sep 2016 23:38:20 +0000 (23:38 +0000)]
.mailmap: add addresses of Dr. David Alan Gilbert

* .mailmap: Add both addresses of Dr. David Alan Gilbert here to avoid
duplications in CREDITS file.

7 years ago.mailmap: add canonical name for Eugene Syromyatnikov
Eugene Syromyatnikov [Mon, 12 Sep 2016 23:10:53 +0000 (02:10 +0300)]
.mailmap: add canonical name for Eugene Syromyatnikov

This is needed due to apparent deviation in spelling of commit author
name in several commits.

* .mailmap: Add canonical name for Eugene Syromyatnikov.

7 years agoUpdate generic ioctl entries from linux 4.8
Dmitry V. Levin [Mon, 12 Sep 2016 15:19:31 +0000 (15:19 +0000)]
Update generic ioctl entries from linux 4.8

* linux/64/ioctls_inc.h: Update from linux v4.8 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.

7 years agox32: update ioctl entries from linux 4.8
Gleb Fotengauer-Malinovskiy [Mon, 12 Sep 2016 13:30:18 +0000 (16:30 +0300)]
x32: update ioctl entries from linux 4.8

* linux/x32/ioctls_inc0.h: Update from linux v4.8 using ioctls_gen.sh.

7 years agomaint: update for linux 4.8
Gleb Fotengauer-Malinovskiy [Mon, 12 Sep 2016 13:29:38 +0000 (16:29 +0300)]
maint: update for linux 4.8

* maint/ioctls_sym.sh: Add workarounds for linux/atm_zatm.h and
xen/evtchn.h files.

7 years agotests: use sprintrc_grep in tests/ipc_shm.c
Dmitry V. Levin [Mon, 12 Sep 2016 10:30:22 +0000 (10:30 +0000)]
tests: use sprintrc_grep in tests/ipc_shm.c

* tests/ipc_shm.c (main): Use sprintrc_grep.

7 years agotests: use sprintrc_grep in tests/ipc_sem.c
Dmitry V. Levin [Mon, 12 Sep 2016 09:27:58 +0000 (09:27 +0000)]
tests: use sprintrc_grep in tests/ipc_sem.c

* tests/ipc_sem.c (main): Use sprintrc_grep.

7 years agotests: use sprintrc_grep in tests/ipc_msg.c
Dmitry V. Levin [Sun, 11 Sep 2016 00:04:16 +0000 (00:04 +0000)]
tests: use sprintrc_grep in tests/ipc_msg.c

* tests/ipc_msg.c (main): Use sprintrc_grep.

7 years agotests: use sprintrc in tests/chmod.c
Dmitry V. Levin [Sat, 10 Sep 2016 22:58:40 +0000 (22:58 +0000)]
tests: use sprintrc in tests/chmod.c

* tests/chmod.c (main): Use sprintrc.  Add more chmod decoding tests.

7 years agoipc: fix printing of nsops argument of semop and semtimedop syscalls
Dmitry V. Levin [Fri, 9 Sep 2016 19:13:54 +0000 (19:13 +0000)]
ipc: fix printing of nsops argument of semop and semtimedop syscalls

According to POSIX, nsops argument of semop syscall has type size_t,
but the kernel treats nsops argument of semop and semtimedop syscalls
as unsigned int.

* ipc_sem.c (tprint_sembuf_array): Change type of "count" argument
from unsigned long to unsigned int, print it using %u format.

7 years agotests/aio.c: bring indentation in conformance with the rest of the file
Eugene Syromyatnikov [Fri, 9 Sep 2016 07:54:54 +0000 (10:54 +0300)]
tests/aio.c: bring indentation in conformance with the rest of the file

7 years agotests: use predefined constant in aio_context_t checks in aio test
Eugene Syromyatnikov [Fri, 9 Sep 2016 07:54:38 +0000 (10:54 +0300)]
tests: use predefined constant in aio_context_t checks in aio test

Also fix io_cancel and io_destroy checks which did not check correct
printing of context argument properly.

* tests/aio.c (main): Update syscall checks in order to use newly
defined bogus_ctx constant.

7 years agoMark io_setup and io_destroy as memory mapping related syscalls
Dmitry V. Levin [Fri, 9 Sep 2016 02:38:32 +0000 (02:38 +0000)]
Mark io_setup and io_destroy as memory mapping related syscalls

As io_setup syscall allocates some memory using do_mmap_pgoff, and
io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
flag for all sysentries of io_setup and io_destroy using the following
oneliner:
sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h

* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.

7 years agotravis: add x86 musl
Dmitry V. Levin [Thu, 8 Sep 2016 17:11:51 +0000 (17:11 +0000)]
travis: add x86 musl

* .travis.yml (matric): Add musl-gcc/x86.
* travis-build.sh [TARGET == x86]: Specify --target along with --build
to configure.
* travis-install.sh [CC == musl-gcc && TARGET == x32]: Add -mx32 to $CC.
[CC == musl-gcc && TARGET == x86]: Add -m32 to $CC.  Specify --build
and --target to musl configure invocation.

7 years agotests: use PRI__*64 macros in aio test
Eugene Syromyatnikov [Thu, 8 Sep 2016 18:26:17 +0000 (21:26 +0300)]
tests: use PRI__*64 macros in aio test

It was incorrectly assumed that __*64 types are long long on all
platforms, despite strace having specially crafted macros in order
to handle precisely this architecture discrepancy.
The commit fixes this oversight.

* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
specifiers for __*64-typed values.

7 years agoipc: fix printing of integer arguments
Eugene Syromyatnikov [Wed, 7 Sep 2016 12:41:17 +0000 (15:41 +0300)]
ipc: fix printing of integer arguments

* ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int
by the kernel, cast it to int and print it using %d format.
* ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise,
for semid argument.
(SYS_FUNC(semget)): Likewise, for nsems argument.
(SYS_FUNC(semctl)): Likewise, for semid and semnum arguments.
* ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument.
* ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise.

7 years agoipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
Dmitry V. Levin [Thu, 8 Sep 2016 12:49:35 +0000 (12:49 +0000)]
ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls

* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
is __kernel_key_t (i.e. int), cast key_t argument to int
and print it using %#x format.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* tests/ipc_msg.c (main): Test it.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.

7 years agotests: add more sched_getattr and sched_setattr decoding checks
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:09:10 +0000 (05:09 +0300)]
tests: add more sched_getattr and sched_setattr decoding checks

* tests/sched_xetattr.c (main): Add more sched_getattr and sched_setattr
decoding checks.

7 years agotests: change type of sched_nice field to signed in sched_xetattr test
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:08:47 +0000 (05:08 +0300)]
tests: change type of sched_nice field to signed in sched_xetattr test

Kernel headers declare this field as s32, and strace prints it with %d
specifier.

* tests/sched_xetattr.c (main): Change type of sched_nice field of struct
sched_attr to int32_t, update format specifiers accordingly.

7 years agotests: add sprintrc_grep function to libtests
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:08:24 +0000 (05:08 +0300)]
tests: add sprintrc_grep function to libtests

New sprintrc_grep function is sprintrc function equivalent suitable for
tests where grep-base pattern matching is employed.

* tests/tests.h (sprintrc_grep): New prototype.
* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
(sprintrc_ex): New function, renamed from sprintrc and updated to
support different formats.
(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.

7 years agotests: perform more strict structure allocation in sched_xetattr test
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:08:10 +0000 (05:08 +0300)]
tests: perform more strict structure allocation in sched_xetattr test

Use tail_alloc with precise size of the structure.

* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
Rename sched to sched_attr.  Change type of sched_attr to struct
pointer.  Use tail_alloc for sched_attr allocation, update printf
statements accrodingly.

7 years agotests: split long lines in sched_xetattr test
Eugene Syromyatnikov [Tue, 6 Sep 2016 02:07:57 +0000 (05:07 +0300)]
tests: split long lines in sched_xetattr test

* tests/sched_xetattr.c (main): Split long lines.

7 years agotests/aio.c: fix for x32 personality
Dmitry V. Levin [Wed, 7 Sep 2016 13:17:59 +0000 (13:17 +0000)]
tests/aio.c: fix for x32 personality

* tests/aio.c (main): Do not pass 64-bit aio_context_t to io_submit
and io_getevents until strace learns how to print 64-bit pointers on x32
and on x86_64 for x32 personality.

7 years agoaio: print aio_context_t as a pointer type
Dmitry V. Levin [Wed, 7 Sep 2016 11:22:51 +0000 (11:22 +0000)]
aio: print aio_context_t as a pointer type

As aio_context_t is treated by the kernel as a pointer,
print it using printaddr.

* aio.c (SYS_FUNC(io_setup)): Print the pointer to aio_context_t
argument using printnum_ptr.
(SYS_FUNC(io_destroy), SYS_FUNC(io_submit), SYS_FUNC(io_cancel),
SYS_FUNC(io_getevents)): Print aio_context_t argument using printaddr.
* tests/aio.c (sprint_aio_context_t): Remove.
(main): Update expected output.

7 years agotests/aio.c: rewrite without assert
Dmitry V. Levin [Tue, 6 Sep 2016 16:11:51 +0000 (16:11 +0000)]
tests/aio.c: rewrite without assert

* tests/aio.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.

7 years agotests: add more aio decoding checks
Eugene Syromyatnikov [Tue, 6 Sep 2016 09:03:14 +0000 (12:03 +0300)]
tests: add more aio decoding checks

* tests/aio.c (sprint_aio_context_t): New function.
(main): Use it; add more checks.

7 years agotests: add suffix and cast to 64-bit constants in aio test
Eugene Syromyatnikov [Tue, 6 Sep 2016 09:02:44 +0000 (12:02 +0300)]
tests: add suffix and cast to 64-bit constants in aio test

This helps to avoid warnings like
"integer constant is too large for ‘long’ type"
reported by some versions of gcc on 32-bit platforms.

* tests/aio.c (main): Add ULL suffix to 64-bit constants
and cast them to unsigned long.

7 years agotests: check decoding of perf_event_open syscall
Eugene Syromyatnikov [Mon, 5 Sep 2016 17:39:04 +0000 (20:39 +0300)]
tests: check decoding of perf_event_open syscall

* tests/perf_event_open.c: New file.
* tests/perf_event_open.test: New test.
* tests/.gitignore: Add perf_event_open.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add perf_event_open.test.

7 years agoMakefile.am: use pwd instead of realpath
Eugene Syromyatnikov [Mon, 5 Sep 2016 17:35:20 +0000 (20:35 +0300)]
Makefile.am: use pwd instead of realpath

* Makefile.am (CODE_COVERAGE_GENHTML_OPTIONS): Use standard pwd(1)
instead of less widespread realpath(1) utility from GNU coreutils.

7 years agotests: use sprintrc in tests/xetpriority.c
Dmitry V. Levin [Mon, 5 Sep 2016 14:00:46 +0000 (14:00 +0000)]
tests: use sprintrc in tests/xetpriority.c

* tests/xetpriority.c (main): Use sprintrc.

7 years agotests: use sprintrc in vhangup.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:59:08 +0000 (13:59 +0000)]
tests: use sprintrc in vhangup.test

* tests/vhangup.c (main): Use sprintrc.

7 years agotests: use sprintrc in tests/sockname.c
Dmitry V. Levin [Mon, 5 Sep 2016 13:58:02 +0000 (13:58 +0000)]
tests: use sprintrc in tests/sockname.c

* tests/sockname.c (test_sockname_syscall): Use sprintrc.

7 years agotests: use sprintrc in signalfd4.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:53:52 +0000 (13:53 +0000)]
tests: use sprintrc in signalfd4.test

* tests/signalfd4.c (main): Use sprintrc.

7 years agotests: use sprintrc in setrlimit.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:50:39 +0000 (13:50 +0000)]
tests: use sprintrc in setrlimit.test

* tests/setrlimit.c (main): Use sprintrc.

7 years agotests: use sprintrc in set_mempolicy.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:43:36 +0000 (13:43 +0000)]
tests: use sprintrc in set_mempolicy.test

* tests/set_mempolicy.c (main, print_nodes): Use sprintrc.

7 years agotests: use sprintrc in openat.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:37:33 +0000 (13:37 +0000)]
tests: use sprintrc in openat.test

* tests/openat.c (main): Use sprintrc.

7 years agotests: use sprintrc in open.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:34:06 +0000 (13:34 +0000)]
tests: use sprintrc in open.test

* tests/open.c (main): Use sprintrc.

7 years agotests: use sprintrc in move_pages.test
Dmitry V. Levin [Mon, 5 Sep 2016 13:30:06 +0000 (13:30 +0000)]
tests: use sprintrc in move_pages.test

* tests/move_pages.c (print_stat_pages, print_move_pages): Use sprintrc.

7 years agotests: use sprintrc in mlockall.test
Dmitry V. Levin [Sun, 4 Sep 2016 22:24:03 +0000 (22:24 +0000)]
tests: use sprintrc in mlockall.test

* tests/mlockall.c (main): Use sprintrc.

7 years agotests: use sprintrc in mlock.test
Dmitry V. Levin [Sun, 4 Sep 2016 22:22:37 +0000 (22:22 +0000)]
tests: use sprintrc in mlock.test

* tests/mlock.c (main): Use sprintrc.

7 years agotests: use sprintrc in epoll_create1.test
Dmitry V. Levin [Sun, 4 Sep 2016 22:16:46 +0000 (22:16 +0000)]
tests: use sprintrc in epoll_create1.test

* tests/epoll_create1.c (main): Use sprintrc.

7 years agotests: fix printing of min_nr and nr arguments of io_getevents syscall
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:40 +0000 (04:32 +0300)]
tests: fix printing of min_nr and nr arguments of io_getevents syscall

* tests/aio.c (main): Change output format for min_nr and nr arguments
in io_getevents check to %ld, cast these arguments to long.

7 years agotests: use sprintrc for return code output in aio test
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:29 +0000 (04:32 +0300)]
tests: use sprintrc for return code output in aio test

* tests/aio.c (main): Use sprintrc for return code output.

7 years agotests: add more tests for ched_rr_get_interval decoding
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:02 +0000 (04:32 +0300)]
tests: add more tests for ched_rr_get_interval decoding

* tests/sched_rr_get_interval.c (main): Check decoding of invalid
timespec pointer and successful syscall invocation.

7 years agotests: use sprintrc for return code output in sched_rr_get_interval test
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:31:48 +0000 (04:31 +0300)]
tests: use sprintrc for return code output in sched_rr_get_interval test

* tests/sched_rr_get_interval.c (main): Use sprintrc for return code
output.

7 years agotests: add more tests for sched_getscheduler and sched_xetscheduler
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:31:35 +0000 (04:31 +0300)]
tests: add more tests for sched_getscheduler and sched_xetscheduler

* tests/sched_xetscheduler.c (main): Check for decoding of invalid PID
in sched_getscheduler and sched_setscheduler, invalid address
of sched_param structure, and invalid policy value.

7 years agotests: use sprintrc for return code output in sched_xetscheduler test
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:33:16 +0000 (04:33 +0300)]
tests: use sprintrc for return code output in sched_xetscheduler test

* tests/sched_xetscheduler.c (main): Use sprintrc for return code output.

7 years agoaio: use printfd for fd printing
Eugene Syromyatnikov [Mon, 5 Sep 2016 01:32:16 +0000 (04:32 +0300)]
aio: use printfd for fd printing

struct iocb contains two fields with fd semantics: aio_fildes and
aio_resfd.  It is quite reasonable to use the appropriate function for
printing them (apart from just "%d").

* aio.c (print_common_flags): Add struct tcb pointer to parameter list;
use printfd for printing aio_resfd field.
(print_iocb_header): Add struct tcb pointer to parameter list;
use printfd for printing aio_fildes field.
(print_iocb): Provide tcp argument to print_iocb_header
and print_common_flags.
(SYS_FUNC(io_cancel)): Likewise.

7 years agosh64: wire up new syscalls
Dmitry V. Levin [Sat, 3 Sep 2016 22:05:10 +0000 (22:05 +0000)]
sh64: wire up new syscalls

* linux/sh64/syscallent.h [380..393]: New entries.

7 years agosh: wire up new syscalls
Dmitry V. Levin [Fri, 2 Sep 2016 21:04:49 +0000 (21:04 +0000)]
sh: wire up new syscalls

* linux/sh/syscallent.h [369..382]: New entries.

7 years agoavr32: wire up preadv2 and pwritev2 syscalls
Dmitry V. Levin [Thu, 1 Sep 2016 22:04:08 +0000 (22:04 +0000)]
avr32: wire up preadv2 and pwritev2 syscalls

* linux/avr32/syscallent.h [326]: Add preadv2 entry.
[327]: Add pwritev2 entry.

7 years agotests: check decoding of readahead syscall
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:28:24 +0000 (18:28 +0300)]
tests: check decoding of readahead syscall

* configure.ac (AC_CHECK_FUNCS): Add readahead.
* tests/readahead.c: New file.
* tests/readahead.test: New test.
* tests/.gitignore: Add readahead.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add readahead.test.

7 years agotests: move sprintrc function to libtests
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:28:02 +0000 (18:28 +0300)]
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.

7 years agotests/futex: add support to sprintrc for return codes other than 0 and -1
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:27:18 +0000 (18:27 +0300)]
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.

7 years agotests/futex: increase sprintrc static buffer size
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:25:56 +0000 (18:25 +0300)]
tests/futex: increase sprintrc static buffer size

* tests/futex.c (sprintrc): Increase buffer size from 256 to 4096.

7 years agotests/futex: rename retstr to sprintrc
Eugene Syromyatnikov [Fri, 2 Sep 2016 15:25:35 +0000 (18:25 +0300)]
tests/futex: rename retstr to sprintrc

* tests/futex.c (retstr): Rename to sprintrc.
(main): Convert all retstr calls to sprintrc.

7 years agoreadahead: fix print format for the "count" argument
Eugene Syromyatnikov [Wed, 31 Aug 2016 23:42:48 +0000 (02:42 +0300)]
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.

7 years agotests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll
Dmitry V. Levin [Wed, 31 Aug 2016 16:31:53 +0000 (16:31 +0000)]
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.

7 years agotests: add sign_extend_unsigned_to_ll macro
Dmitry V. Levin [Wed, 31 Aug 2016 16:09:24 +0000 (16:09 +0000)]
tests: add sign_extend_unsigned_to_ll macro

* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.

7 years agoRefactor common sa_handler printing code
Eugene Syromiatnikov [Wed, 17 Aug 2016 01:08:49 +0000 (01:08 +0000)]
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.

7 years agoUpdate TCP* constants
Dmitry V. Levin [Wed, 31 Aug 2016 08:49:31 +0000 (08:49 +0000)]
Update TCP* constants

* xlat/socktcpoptions.in: Add TCP_REPAIR_WINDOW introduced by linux
kernel commit v4.8-rc1~140^2~226.

7 years agoUpdate SCTP_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:22:41 +0000 (18:22 +0000)]
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.

7 years agoUpdate fs *_MAGIC constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:16:53 +0000 (18:16 +0000)]
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.

7 years agoUpdate KEXEC_ARCH_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:13:38 +0000 (18:13 +0000)]
Update KEXEC_ARCH_* constants

* xlat/kexec_arch_values.in: Add KEXEC_ARCH_AARCH64 introduced by linux
kernel commit v4.8-rc1~16^2~41.

7 years agoUpdate ETH_P_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:11:13 +0000 (18:11 +0000)]
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.

7 years agoUpdate BPF_* constants
Dmitry V. Levin [Tue, 30 Aug 2016 18:01:50 +0000 (18:01 +0000)]
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.

7 years agoRemove HAVE_SIGACTION checks
Dmitry V. Levin [Tue, 30 Aug 2016 17:44:33 +0000 (17:44 +0000)]
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.

7 years agoRemove obsolescent autoconf macro AC_TYPE_SIGNAL
Dmitry V. Levin [Tue, 30 Aug 2016 16:32:29 +0000 (16:32 +0000)]
Remove obsolescent autoconf macro AC_TYPE_SIGNAL

All supported systems are expected to have C89 conforming sematics.

* configure.ac (AC_TYPE_SIGNAL): Remove.

7 years agoRemove obsolescent autoconf macro AC_C_CONST
Dmitry V. Levin [Tue, 30 Aug 2016 16:23:46 +0000 (16:23 +0000)]
Remove obsolescent autoconf macro AC_C_CONST

All supported systems are expected to have the 'const' keyword.

* configure.ac (AC_C_CONST): Remove.

7 years agotests: check decoding of futex syscall
Eugene Syromiatnikov [Tue, 30 Aug 2016 13:30:37 +0000 (16:30 +0300)]
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.

7 years agofutex: do not pretend <linux/futex.h> is included
Eugene Syromyatnikov [Tue, 30 Aug 2016 13:24:37 +0000 (16:24 +0300)]
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.

7 years agofutex: avoid printing val when it is not used by the futex command
Eugene Syromyatnikov [Mon, 29 Aug 2016 21:01:45 +0000 (00:01 +0300)]
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.

7 years agoxlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:59:51 +0000 (23:59 +0300)]
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.

7 years agofutex: fix formatting of unknown command argument
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:59:01 +0000 (23:59 +0300)]
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.

7 years agofutex: add handling of FUTEX_FD command
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:57:38 +0000 (23:57 +0300)]
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.

7 years agofutex: fix formatting of val3 hexadecimal argument
Eugene Syromyatnikov [Mon, 29 Aug 2016 21:00:58 +0000 (00:00 +0300)]
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.

7 years agofutex: fix FUTEX_WAKE_OP compare function mask
Eugene Syromyatnikov [Mon, 29 Aug 2016 20:56:24 +0000 (23:56 +0300)]
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.

7 years agotests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c
Dmitry V. Levin [Tue, 30 Aug 2016 12:43:09 +0000 (12:43 +0000)]
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>.

7 years agoRemove redundant check for PTRACE_LISTEN availability
Dmitry V. Levin [Tue, 30 Aug 2016 09:12:06 +0000 (09:12 +0000)]
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.

7 years agoRemove unused autoconf macro AC_TYPE_GETGROUPS
Dmitry V. Levin [Tue, 30 Aug 2016 00:55:07 +0000 (00:55 +0000)]
Remove unused autoconf macro AC_TYPE_GETGROUPS

strace code does not use GETGROUPS_T.

* configure.ac (AC_TYPE_GETGROUPS): Remove.

7 years agoRemove unused autoconf macro AC_TYPE_MODE_T
Dmitry V. Levin [Tue, 30 Aug 2016 00:53:12 +0000 (00:53 +0000)]
Remove unused autoconf macro AC_TYPE_MODE_T

strace code already redefines mode_t.

* configure.ac (AC_TYPE_MODE_T): Remove.

7 years agoUse PTRACE_SUNDETACH everywhere on SPARC and SPARC64
James Clarke [Mon, 29 Aug 2016 23:50:33 +0000 (00:50 +0100)]
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.

7 years agoRemove obsolescent autoconf macro AC_HEADER_STDC
Dmitry V. Levin [Mon, 29 Aug 2016 16:18:11 +0000 (16:18 +0000)]
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.

7 years agoRemove unneeded autoconf macro AC_HEADER_DIRENT
Dmitry V. Levin [Mon, 29 Aug 2016 16:09:57 +0000 (16:09 +0000)]
Remove unneeded autoconf macro AC_HEADER_DIRENT

strace code already includes <dirent.h> unconditionally.

* configure.ac (AC_HEADER_DIRENT): Remove.

7 years agoRemove unneeded autoconf macro AC_HEADER_STDBOOL
Dmitry V. Levin [Sun, 28 Aug 2016 00:03:14 +0000 (00:03 +0000)]
Remove unneeded autoconf macro AC_HEADER_STDBOOL

strace code assumes C99.

* configure.ac (AC_HEADER_STDBOOL): Remove.
* defs.h: Include <stdbool.h> unconditionally.

7 years agoRemove obsolescent autoconf macro AC_HEADER_STAT
Dmitry V. Levin [Sat, 27 Aug 2016 23:42:29 +0000 (23:42 +0000)]
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.

7 years agoDo not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally
Dmitry V. Levin [Fri, 26 Aug 2016 21:32:53 +0000 (21:32 +0000)]
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.

7 years agobtrfs: mpersify struct btrfs_ioctl_vol_args_v2
Dmitry V. Levin [Thu, 25 Aug 2016 21:24:33 +0000 (21:24 +0000)]
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.

7 years agompers.awk: relax union member name absence check
Elvira Khabirova [Mon, 29 Aug 2016 13:22:47 +0000 (13:22 +0000)]
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.

7 years agoRevert "tests/xstatx.c: fix stat syscall tests on mips64"
Dmitry V. Levin [Wed, 24 Aug 2016 00:29:47 +0000 (00:29 +0000)]
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 3fb84bfc79949c145197c61fbf04ce18464e9112.

* tests/xstatx.c (create_sample) [__mips64]: Remove.

7 years agoMpersify parsers of struct stat and struct stat64
Dmitry V. Levin [Wed, 24 Aug 2016 00:29:40 +0000 (00:29 +0000)]
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.

7 years agompers.m4: check for struct stat64, struct stat, and their members
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:37 +0000 (14:27 +0000)]
mpers.m4: check for struct stat64, struct stat, and their members

* m4/mpers.m4 (st_MPERS_STRUCT_STAT): New macro.
(st_MPERS): Use it.

7 years agompers: add MPERS_IS_* to CFLAGS passed to mpers.sh
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:19 +0000 (14:27 +0000)]
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.

7 years agoMove redefinition of stat types to asm_stat.h
Dmitry V. Levin [Tue, 23 Aug 2016 23:39:45 +0000 (23:39 +0000)]
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.

7 years agox86_64: provide a replacement of <asm/stat.h> for x32 personality
Dmitry V. Levin [Tue, 23 Aug 2016 14:49:20 +0000 (14:49 +0000)]
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".

7 years agox32/asm_stat.h: provide definitions for i386 personality
Dmitry V. Levin [Tue, 23 Aug 2016 14:49:20 +0000 (14:49 +0000)]
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.

7 years agoIntroduce a separate SEN entry for fstatat64 syscall
Dmitry V. Levin [Tue, 23 Aug 2016 14:27:49 +0000 (14:27 +0000)]
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.