]> granicus.if.org Git - strace/log
strace
6 years agompers.awk: avoid redefinition of mpers_ptr_t
Dmitry V. Levin [Fri, 19 Jan 2018 17:07:04 +0000 (17:07 +0000)]
mpers.awk: avoid redefinition of mpers_ptr_t

Older versions of gcc like those found in RHEL6 fail with the following
diagnostics:

  In file included from block.c:32:
  ./mpers-m32/struct_blk_user_trace_setup.h:2: error: redefinition of typedef ‘mpers_ptr_t’
  mpers_type.h:44: note: previous declaration of ‘mpers_ptr_t’ was here

* mpers.awk (END): Add #ifndef guard to mpers_ptr_t typedef.
* mpers_test.sh: Update expected output.

6 years agoAdd support for --enable-mpers=m32|mx32
Eugene Syromyatnikov [Fri, 19 Jan 2018 02:21:48 +0000 (03:21 +0100)]
Add support for --enable-mpers=m32|mx32

* configure.ac (AC_ARG_ENABLE([mpers])): Allow m32 and mx32 values
for --enable-mpers option.
* m4/mpers.m4 (st_MPERS): Check for personality support if personality
name is provided as an option.  Fail if the requested personality
support is not available.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: improve setugid error diagnostics a bit
Eugene Syromyatnikov [Fri, 19 Jan 2018 02:24:03 +0000 (03:24 +0100)]
tests: improve setugid error diagnostics a bit

* tests/setugid.c (main): Print unexpected code returned by syscall.

6 years agov4l2: do not mpersify struct v4l2_create unless it is used by other code
Dmitry V. Levin [Fri, 19 Jan 2018 17:50:09 +0000 (17:50 +0000)]
v4l2: do not mpersify struct v4l2_create unless it is used by other code

This fixes build with mpers support on older systems that lack
definition of struct v4l2_create.

* v4l2.c: Wrap references to struct v4l2_create with
[VIDIOC_CREATE_BUFS].

6 years agobtrfs: use uint32_t instead of __u32
Dmitry V. Levin [Thu, 18 Jan 2018 17:44:56 +0000 (17:44 +0000)]
btrfs: use uint32_t instead of __u32

* btrfs.c (btrfs_ioctl) [!HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE]:
Replace __u32 with uint32_t.  Remove useless cast.

6 years agostrace.1.in: clarify mpers flags in strace -V output
Eugene Syromyatnikov [Thu, 18 Jan 2018 12:16:35 +0000 (13:16 +0100)]
strace.1.in: clarify mpers flags in strace -V output

The previous description was a bit dated.

* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Remove "no-m32" and
"no-mx32", describe the situation when some of mpers flags are not
present in strace -V output.

6 years agoAdd compat support for s390x
Eugene Syromyatnikov [Wed, 10 Jan 2018 20:20:06 +0000 (20:20 +0000)]
Add compat support for s390x

By very popular demand.

While we are here, let's refactor the condition for old_mmap_pgoff into
an arch-specific one, as it is used more than in one place.

* NEWS: Mention this.
* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Likewise.
* configure.ac (case "$host_cpu" in) <s390x>: Set arch_m32 to s390, set
cc_flags_m32 to -m31.
(st_MPERS([m32])): Add s390x.
* defs.h [S390X]: Define NEED_UID16_PARSERS.
* linux/s390/arch_sigreturn.c [!S390_FRAME_PTR] (S390_FRAME_PTR): New
macro, define to s390_frame_ptr.
[!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE): New macro, define to
__SIGNAL_FRAMESIZE.
[!PTR_TYPE] (PTR_TYPE): New macro, define to unsigned long.
(arch_sigreturn): Use S390_FRAME_PTR, SIGNAL_FRAMESIZE, and PTR_TYPE
instead of s390_frame_ptr, __SIGNAL_FRAMESIZE, and pointer-sized type,
respectively.
* linux/s390/get_error.c [!ARCH_REGSET] (ARCH_REGSET): New macro, define
* to s390_regset.
(get_error): Use it instead of s390_regset.
* linux/s390/get_scno.c (arch_get_scno): Likewise.
* linux/s390/get_syscall_args.c (get_syscall_args): Likewise.
* linux/s390/set_error.c (arch_set_error, arch_set_success): Likewise.
* linux/s390/set_scno.c (arch_set_scno): Likewise.
* linux/s390x/arch_regs.c (psw_compat_t, s390_compat_regs,
s390x_regs_union, s390_frame_ptr, s390x_frame_ptr, s390x_io): New
variables.
(s390_regset, s390x_regset, ARCH_REGS_FOR_GETREGSET,
ARCH_IOVEC_FOR_GETREGSET, ARCH_PC_REG, ARCH_PERSONALITY_0_IOV_SIZE,
ARCH_PERSONALITY_1_IOV_SIZE): New macros.
* linux/s390x/arch_regs.h (s390_frame_ptr, s390x_frame_ptr): New
prototypes.
* linux/s390x/arch_rt_sigframe.c: Conditionalize on tcp->currpers.
* linux/s390x/arch_sigreturn.c: Likewise.
* linux/s390x/get_error.c: Likewise.
* linux/s390x/get_scno.c: Likewise.
* linux/s390x/get_syscall_args.c: Likewise.
* linux/s390x/set_error.c: Likewise.
* linux/s390x/set_scno.c: Likewise.
* linux/s390x/errnoent1.h: New file.
* linux/s390x/ioctls_arch1.h: Likewise.
* linux/s390x/ioctls_inc1.h: Likewise.
* linux/s390x/signalent1.h: Likewise.
* linux/s390x/syscallent1.h: Likewise.
* Makefile.am (EXTRA_DIST): Add new files added to linux/s390x.
* supported_personalities.h [S390X] (SUPPORTED_PERSONALITIES): Define
to 2.
* tests/strace-V.test: Add s390 to the list of architectures that have
m32 personality.
* linux/s390/arch_defs.h (HAVE_ARCH_OLD_MMAP_PGOFF): New macro.
* linux/s390x/arch_defs.h: Likewise.
* mem.c: Replace #ifdef S390 with #ifdef HAVE_ARCH_OLD_MMAP_PGOFF.
* pathtrace.c: Likewise.

6 years agoUpdate NEWS
Eugene Syromyatnikov [Thu, 18 Jan 2018 00:09:22 +0000 (01:09 +0100)]
Update NEWS

6 years agotests: check path tracing of ppoll syscall
Dmitry V. Levin [Wed, 17 Jan 2018 21:31:07 +0000 (21:31 +0000)]
tests: check path tracing of ppoll syscall

* tests/ppoll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add a test call that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/ppoll-P.c: New file.
* tests/pure_executables.list: Add ppoll-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (ppoll-P): New entry.

6 years agotests: check path tracing of poll syscall
Dmitry V. Levin [Wed, 17 Jan 2018 21:31:07 +0000 (21:31 +0000)]
tests: check path tracing of poll syscall

* tests/poll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
is not available.  Add tests calls that use PATH_TRACING_FD.
(main): Conditionalize expected output for those calls
that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
* tests/poll-P.c: New file.
* tests/pure_executables.list: Add poll-P.
* tests/.gitignore: Likewise.
* tests/poll-P.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add poll-P.test.

6 years agotests: enable old_mmap-P.test on s390x
Eugene Syromyatnikov [Wed, 17 Jan 2018 03:53:36 +0000 (04:53 +0100)]
tests: enable old_mmap-P.test on s390x

As s390x is the only 64-bit architecture that has old_mmap,
the test needs some adjustments there.

* tests/old_mmap.c: Update condition.
(main): Change int types to long, extend numerals to 64 bit, change
printing format qualifiers to corresponding long types.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: check path tracing of old mmap syscall
Eugene Syromyatnikov [Wed, 17 Jan 2018 01:39:21 +0000 (02:39 +0100)]
tests: check path tracing of old mmap syscall

* tests/old_mmap.c [!TEST_FD]: Define TEST_FD.
(main) <args1_c>: Replace 5th argument with TEST_FD.
(main): Wrap the output for the calls that do not use TEST_FD
with #ifndef PATH_TRACING.
* tests/old_mmap-P.c: New file.
* tests/pure_executables.list: Add old_mmap-P.
* tests/.gitignore: Likewise.
* tests/gen_tests.in: Add old_mmap-P test.

6 years agoFix pathtrace for old_mmap/old_mmap_pgoff
Eugene Syromyatnikov [Wed, 17 Jan 2018 01:38:55 +0000 (02:38 +0100)]
Fix pathtrace for old_mmap/old_mmap_pgoff

As these system calls have only one argument that points to the
location in memory containing actual arguments, current path tracing
implementation is incorrect.  In order to fix this, let's use recently
introduced fetch_old_mmap_args in order to get actual arguments suitable
for path matching.

* pathtrace.c [HAVE_ARCH_OLD_MMAP] <case SEN_old_mmap,
case SEN_old_mmap_pgoff>: Retrieve actual old_mmap arguments with
fetch_old_mmap_args, pass the value from the retrieved args if it's
available.

6 years agoTest non-verbose old_mmap output
Eugene Syromyatnikov [Wed, 17 Jan 2018 01:19:36 +0000 (02:19 +0100)]
Test non-verbose old_mmap output

* tests/old_mmap-v-none.c: New file.  Include old_mmap.c.
* tests/pure_executables.list: Add old_mmap-v-none.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (old_mmap-v-none): New entry.

6 years agomem.c: use runtime check in fetch_old_mmap_args
Eugene Syromyatnikov [Wed, 17 Jan 2018 02:29:17 +0000 (03:29 +0100)]
mem.c: use runtime check in fetch_old_mmap_args

This makes code a bit cleaner and makes it compatible with the upcoming
s390x compat support.

* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Replace
ANY_WORDSIZE_LESS_THAN_KERNEL_LONG check with current_wordsize == 4
check.

6 years agomem.c: introduce fetch_old_mmap_args
Eugene Syromyatnikov [Wed, 17 Jan 2018 01:18:45 +0000 (02:18 +0100)]
mem.c: introduce fetch_old_mmap_args

Move common old_mmap/old_mmap_pgoff argument fetching code into a
separate function.

As it is, it also fixes the case of non-verbose printing of old_mmap
arguments (see the new test in the next commit).  Also, it is a
preparation for the fix of path tracing for these syscalls.

* defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New prototype.
* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New function.
[HAVE_ARCH_OLD_MMAP] (old_mmap, old_mmap_pgoff): Use it.

Fixes: 3db07f11 "Fix old_mmap output when mmap arguments are unfetchable"
Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoIntroduce arch-specific define HAVE_ARCH_OLD_MMAP
Eugene Syromyatnikov [Wed, 17 Jan 2018 02:18:23 +0000 (03:18 +0100)]
Introduce arch-specific define HAVE_ARCH_OLD_MMAP

* linux/arch_defs.h: New file.
* linux/aarch64/arch_defs.h: New file.  Define HAVE_ARCH_OLD_MMAP.
* linux/arm/arch_defs.h: Likewise.
* linux/i386/arch_defs.h: Likewise.
* linux/m68k/arch_defs.h: Likewise.
* linux/s390/arch_defs.h: Likewise.
* linux/s390x/arch_defs.h: Likewise.
* linux/x32/arch_defs.h: Likewise.
* linux/x86_64/arch_defs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Include "arch_defs.h"
* mem.c: Replace condition for SYS_FUNC(old_mmap) with #ifdef
HAVE_ARCH_OLD_MMAP.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: improve descriptor set syntax testing
Dmitry V. Levin [Wed, 17 Jan 2018 03:22:07 +0000 (03:22 +0000)]
tests: improve descriptor set syntax testing

* tests/filtering_fd-syntax.test: New file.
* tests/options-syntax.test: Move descriptor set syntax testing
to filtering_fd-syntax.test.
* tests/Makefile.am (MISC_TESTS): Add filtering_fd-syntax.test.

Co-authored-by: Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
6 years agostrace.c: print correct out file name in error messages in case of -ff
Eugene Syromyatnikov [Tue, 16 Jan 2018 13:36:06 +0000 (14:36 +0100)]
strace.c: print correct out file name in error messages in case of -ff

* strace.c (outf_perror): New function.
(tvprintf, tprints, flush_tcp_output): Use it.

6 years agoaarch64: use ARCH_SET_PERSONALITY_FROM_IOV_SIZE
Eugene Syromyatnikov [Tue, 16 Jan 2018 14:10:53 +0000 (15:10 +0100)]
aarch64: use ARCH_SET_PERSONALITY_FROM_IOV_SIZE

* linux/aarch64/arch_regs.c (ARCH_PERSONALITY_0_IOV_SIZE,
ARCH_PERSONALITY_1_IOV_SIZE): New macros.
* linux/aarch64/get_scno.c (arch_get_scno): Do not call
update_personality as it is handled by the generic get_regs code now.

6 years agosyscall.c: add ability to set personality based on GETREGSET iov size
Eugene Syromyatnikov [Mon, 15 Jan 2018 20:49:14 +0000 (21:49 +0100)]
syscall.c: add ability to set personality based on GETREGSET iov size

Some architectures (aarch64, s390x) use only PTRACE_GETREGSET interface
and use its size to detect current personality. Let's generalise this
approach and also avoid subtle errors when we get register but forget to
update personality, at least for those architectures.

Note that in order to employ this behaviour, architecture has to use
PTRACE_GETREGSET exclusively (no HAVE_GETREGS_OLD) and should declare
appropriate ARCH_PERSONALITY_*_IOV_SIZE macros.

* syscall.c (get_regs) [ptrace_getregset_or_getregs &&
!HAVE_GETREGS_OLD]: Call update_personality based on the value returned
in the iov_len field by PTRACE_GETREGSET.  Warn once if the returned
iov_len is unknown.

6 years agosyscall.c: add sanity check for the target personality number
Eugene Syromyatnikov [Tue, 16 Jan 2018 16:38:35 +0000 (17:38 +0100)]
syscall.c: add sanity check for the target personality number

We can never be cautious enough.

* defs.h (set_personality): Change argument type to unsigned int.
* syscall.c (set_personality): Change argument type to unsigned int,
check whether requested personality is sane, die otherwise.

6 years agosyscall.c: move current_personality check to set_personality
Eugene Syromyatnikov [Tue, 16 Jan 2018 16:36:32 +0000 (17:36 +0100)]
syscall.c: move current_personality check to set_personality

As all the personality-dependent entries are initially in sync, we can
move the check whether we are setting the same personality as we
currently are inside set_personality out of update_personality.

* syscall.c (current_wordsize, current_klongsize): Initialise to 0'th
personality value in order to make the statement about "all the
personality-dependent entries are initially in sync" true.
(set_personality): Check whether requested personality differs from
current_personality.
(update_personality): Call set_personality unconditionally.

6 years agosyscall.c: always update tcp->currpers in update_personality
Eugene Syromyatnikov [Mon, 15 Jan 2018 17:55:48 +0000 (18:55 +0100)]
syscall.c: always update tcp->currpers in update_personality

Sometimes (for example, switching from a process with one personality
to a process that previously had different personality but returning
from execve to that same personality into) it is possible that
current_personality is not changed, but tcp->currpers is different.
So, let's not return from update_personality and always update
tcp->currpers if it differs from the target personality.

* syscall.c (update_personality): Do not exit early if personality ==
current_personality.

6 years agoUpdate current_personality on tcb switch
Eugene Syromyatnikov [Tue, 16 Jan 2018 16:26:22 +0000 (17:26 +0100)]
Update current_personality on tcb switch

* strace.c (set_current_tcp): New function.
(printleader, droptcb, print_event_exit, next_event, dispatch_event):
Call set_current_tcp instead of setting current_tcp manually.

6 years agoAdd support for specifying compiler options for mpers builds
Eugene Syromyatnikov [Wed, 10 Jan 2018 20:17:42 +0000 (20:17 +0000)]
Add support for specifying compiler options for mpers builds

Because some architectures are very, very special.

* configure.ac (cc_flags_m32, cc_flags_mx32): New variables. AC_SUBST
them.
* m4/mpers.m4 (MPERS_CFLAGS): Use instead of CFLAG, pushdef as
$cc_flags_$1.
Use mpers_name instead of CFLAG in AC_CACHE_CHECK messages.
Pass MPERS_CFLAGS as the second argument to mpers_test.sh
* mpers.sh: Add CC_ARCH_FLAGS as the second argument (PARSER_FILE
is moved to the third one). Do not expect leading dash in ARCH_FLAG
anymore.
* mpers_test.sh (mpers_cc_flags): New variable, initialise to the second
command line argument.
Pass $mpers_name without leading dash to mpers.sh.
Pass $mpers_cc_flags as the second argument to mpers.sh ($sample is
the third argument now).
* Makefile.am (mpers-m%.stamp:): Pass $(mpers_CC_FLAGS) as the second
argument to mpers.sh ($$f is now the third argument).
($(mpers_m32_targets)): Define target variable mpers_CC_FLAGS with the
value of @cc_flags_m32@
($(mpers_mx32_targets)): Define target variable mpers_CC_FLAGS with the
value of @cc_flags_mx32@
* tests/Makefile.am (MERS_CC_FLAGS): New variable.
* bootstrap: Append @cc_flags_$1@ to MPERS_CC_FLAGS. Append
$(MPERS_CC_FLAGS) to ARCH_MFLAGS.

6 years agotests: improve syscall set syntax testing
Dmitry V. Levin [Tue, 16 Jan 2018 04:34:25 +0000 (04:34 +0000)]
tests: improve syscall set syntax testing

* tests/filtering_syscall-syntax.test: New file.
* tests/options-syntax.test: Move syscall set syntax testing
to filtering_syscall-syntax.test.
* tests/qual_fault-syntax.test: Likewise.
* tests/qual_inject-syntax.test: Likewise.
* tests/Makefile.am (MISC_TESTS): Add filtering_syscall-syntax.test.

Co-authored-by: Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
6 years agoEnhance error diagnostics about invalid syscalls in fault injection syntax
Dmitry V. Levin [Tue, 16 Jan 2018 04:34:25 +0000 (04:34 +0000)]
Enhance error diagnostics about invalid syscalls in fault injection syntax

Validate syscall set before the whole fault injection syntax.

* filter_qualify.c (parse_inject_expression): Add const qualifier to
return type.  Return an empty string when no syscall set is specified.
(qualify_inject_common): Add const qualifier to "name".  Move
qualify_syscall_tokens invocation right after parse_inject_expression.
* tests/qual_fault-syntax.test: Update expected output.
* tests/qual_inject-syntax.test: Likewise.

6 years agobasic_filters: use loop initial declarations
Dmitry V. Levin [Tue, 16 Jan 2018 01:09:14 +0000 (01:09 +0000)]
basic_filters: use loop initial declarations

* basic_filters.c (qualify_syscall_number, qualify_syscall_regex,
lookup_class, qualify_syscall_class, qualify_syscall_tokens,
qualify_tokens): Use "for" loop initial declarations.

6 years agofilter_qualify: use loop initial declarations
Dmitry V. Levin [Tue, 16 Jan 2018 01:09:14 +0000 (01:09 +0000)]
filter_qualify: use loop initial declarations

* filter_qualify.c (sigstr_to_uint, find_errno_by_name,
parse_inject_expression, qualify_inject_common, qualify): Use "for" loop
initial declarations.

6 years agoconfigure: try to set the C compiler mode to accept ISO Standard C
Dmitry V. Levin [Tue, 16 Jan 2018 01:09:14 +0000 (01:09 +0000)]
configure: try to set the C compiler mode to accept ISO Standard C

* configure.ac: Use AC_PROG_CC_STDC.
* NEWS: Mention this.

6 years agopathtrace: update the list of unrelated syscalls
Dmitry V. Levin [Mon, 15 Jan 2018 23:33:18 +0000 (23:33 +0000)]
pathtrace: update the list of unrelated syscalls

* pathtrace.c (pathtrace_match_set) <SEN_accept4, SEN_accept,
SEN_signalfd4, SEN_signalfd>: Skip matching.

6 years agobasic_filters: move legacy tracing class names to the end of table
Dmitry V. Levin [Mon, 15 Jan 2018 22:58:48 +0000 (22:58 +0000)]
basic_filters: move legacy tracing class names to the end of table

* basic_filters.c (lookup_class) <syscall_class>: Move names that do not
start with % to the end of table.

6 years agoEnhance decoding of mq_* syscalls
Dmitry V. Levin [Mon, 15 Jan 2018 22:47:38 +0000 (22:47 +0000)]
Enhance decoding of mq_* syscalls

* mq.c (SYS_FUNC(mq_open)): Add RVAL_FD to return value.
(SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive), SYS_FUNC(mq_notify),
SYS_FUNC(mq_getsetattr)): Print the first argument using printfd.
* NEWS: Mention this change.
* pathtrace.c (pathtrace_match_set) <SEN_mq_getsetattr, SEN_mq_notify,
SEN_mq_open, SEN_mq_timedreceive, SEN_mq_timedsend>: Skip matching.
* linux/32/syscallent.h (mq_getsetattr, mq_notify, mq_open,
mq_timedreceive, mq_timedsend): Add TD flag.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.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/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.

6 years agoEnhance error diagnostics about invalid syscalls in fault injection syntax
Dmitry V. Levin [Mon, 15 Jan 2018 18:16:31 +0000 (18:16 +0000)]
Enhance error diagnostics about invalid syscalls in fault injection syntax

* basic_filters.c (qualify_syscall_tokens): Remove "name" argument,
assume its value is "system call".
* filter.h (qualify_syscall_tokens): Remove "name" argument.
All callers updated.
* tests/qual_fault-syntax.test: Update expected output.

6 years agobasic_filters: handle "all" in a more readable way
Dmitry V. Levin [Sun, 14 Jan 2018 20:17:27 +0000 (20:17 +0000)]
basic_filters: handle "all" in a more readable way

* basic_filters.c (qualify_syscall_tokens, qualify_tokens): Remove
handle_inversion label, handle "all" by invoking invert_number_set_array
directly.

6 years agofilter: remove redundant braces around single line expressions
Dmitry V. Levin [Sun, 14 Jan 2018 14:00:53 +0000 (14:00 +0000)]
filter: remove redundant braces around single line expressions

* basic_filters.c (qualify_syscall_class, qualify_syscall_name):
Rearrange the inner loop body.
(qualify_syscall_number, lookup_class, qualify_syscall_tokens,
qualify_tokens): Remove redundant braces around single line expressions.
* filter_qualify.c (qualify_inject_common): Likewise.

6 years agofilter_qualify: move memory allocation from parse_inject_expression
Dmitry V. Levin [Sun, 14 Jan 2018 00:43:12 +0000 (00:43 +0000)]
filter_qualify: move memory allocation from parse_inject_expression

* filter_qualify.c (parse_inject_expression): Replace "s" and "buf"
arguments with "str" argument, use it instead of "s" and "*buf".
(qualify_inject_common): Rename "buf" to "copy", initialize it to a copy
of "str", pass "copy" to parse_inject_expression instead of "str" and
"buf".

6 years agoxlat: update NT_* constants
Eugene Syromyatnikov [Sun, 14 Jan 2018 07:45:05 +0000 (08:45 +0100)]
xlat: update NT_* constants

Update NT_* descriptor types with the values borrowed from
kernel's include/uapi/linux/elf.h and glibc's elf.h.

* xlat/nt_descriptor_types.in (NT_PRSTATUS, NT_FPREGSET, NT_PRPSINFO,
NT_PRXREG, NT_TASKSTRUCT, NT_PLATFORM, NT_AUXV, NT_GWINDOWS, NT_ASRS,
NT_PSTATUS, NT_PSINFO, NT_PRCRED, NT_UTSNAME, NT_LWPSTATUS,
NT_LWPSINFO, NT_PRFPXREG, NT_PRXFPREG, NT_PPC_VMX, NT_PPC_SPE,
NT_PPC_VSX, NT_386_TLS, NT_386_IOPERM, NT_X86_XSTATE): Add fallback
definitions.
(NT_SIGINFO, NT_FILE, NT_PPC_*, NT_S390_*, NT_ARM_*, NT_METAG_*,
NT_ARC_V2): New constants.
* NEWS: Mention this.

6 years agoconfigure: use AC_MSG_ERROR and AC_MSG_FAILURE consistently
Dmitry V. Levin [Sat, 13 Jan 2018 13:46:45 +0000 (13:46 +0000)]
configure: use AC_MSG_ERROR and AC_MSG_FAILURE consistently

* configure.ac [$arch = mips]: Use AC_MSG_FAILURE instead of
AC_MSG_ERROR when _MIPS_SIM cannot be determined.  Use AC_MSG_ERROR
instead of AC_MSG_FAILURE when syscallent stubs cannot be generated.

6 years agoconfigure: add --disable-mpers and --enable-mpers=check options
Eugene Syromyatnikov [Wed, 10 Jan 2018 02:43:41 +0000 (03:43 +0100)]
configure: add --disable-mpers and --enable-mpers=check options

On architectures supporting multiple personalities, multiple
personalities support in strace is required for proper decoding of
structures used by tracees with personalities that differ from the
personality of strace.

New configure options control whether multiple personalities support
in strace is mandatory, optional, or disabled.

The default is changed from what is now equivalent of
--enable-mpers=check (automatically detect whether required mpers
support could be enabled) to --enable-mpers (terminate the build
if required mpers support could not be enabled).

* configure.ac (AC_ARG_ENABLE([mpers])): New option.
* m4/mpers.m4 (st_MPERS): Use enable_mpers.  Terminate the build
if mpers could not be enabled and enable_mpers==yes.
* strace.spec.in: Specify --enable-mpers=check to %configure.
* debian/rules (build/Makefile, build64/Makefile): Specify
--enable-mpers=check to configure.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
Suggested-by: DJ Delorie <dj@redhat.com>
6 years agoUpdate ioctl entries from linux v4.15-rc7
Gleb Fotengauer-Malinovskiy [Thu, 11 Jan 2018 19:03:34 +0000 (22:03 +0300)]
Update ioctl entries from linux v4.15-rc7

* linux/32/ioctls_inc_align16.h: Update from linux v4.15-rc7 using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* NEWS: Mention this.

6 years agoIssue a warning when strace lacks tracee personality support
Eugene Syromyatnikov [Wed, 10 Jan 2018 02:53:54 +0000 (03:53 +0100)]
Issue a warning when strace lacks tracee personality support

* defs.h (HAVE_PERSONALITY_1_MPERS, HAVE_PERSONALITY_2_MPERS): New
macros.
* syscall.c (update_personality): Add need_mpers_warning array
initialized with mpers support data.  Use it for printing the mpers
unavailability warning once per personality.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: add more checks of reboot syscall decoding
Eugene Syromyatnikov [Wed, 10 Jan 2018 04:31:15 +0000 (05:31 +0100)]
tests: add more checks of reboot syscall decoding

In particular, check for the recent fixes in reboot syscall decoder.

* tests/gen_tests.in (reboot): Provide -s 256 option.
* tests/reboot.c (STR32, STR128): New macros.
(main): Add more checks.

6 years agotests: use sprintrc in reboot.test
Eugene Syromyatnikov [Wed, 10 Jan 2018 04:30:27 +0000 (05:30 +0100)]
tests: use sprintrc in reboot.test

* test/reboot.c (main): Use sprintrc instead of old-style manual
printing of return code.

6 years agoreboot.c: limit printing of the fourth argument to 255 bytes
Eugene Syromyatnikov [Wed, 10 Jan 2018 04:27:49 +0000 (05:27 +0100)]
reboot.c: limit printing of the fourth argument to 255 bytes

The size of kernel buffer is 256 bytes and the last byte is always zero.

* reboot.c (SYS_FUNC(reboot)): Replace printstr call with printstr_ex
with size of 255 and style flag QUOTE_0_TERMINATED.

6 years agoreboot.c: use printxval instead of printflags
Eugene Syromyatnikov [Wed, 10 Jan 2018 04:25:40 +0000 (05:25 +0100)]
reboot.c: use printxval instead of printflags

Numeric arguments of reboot syscall are not flags but magic values.

* reboot.c (SYS_FUNC(reboot)): Replace printflags with printxval.

6 years agoSearch for <libiberty/demangle.h> in addition to <demangle.h>
Eugene Syromyatnikov [Tue, 9 Jan 2018 19:23:01 +0000 (20:23 +0100)]
Search for <libiberty/demangle.h> in addition to <demangle.h>

This is the location where this header is installed on Debian-based
systems.

* configure.ac: Check for libiberty/demangle.h in addition to
demangle.h.
* unwind.c [USE_DEMANGLE]: Include either <demangle.h> or
<libiberty_demangle.h> based on the presence of HAVE_DEMANGLE_H and
HAVE_LIBIBERTY_DEMANGLE_H macros.

6 years agostrace.1: fix typo
Dmitry V. Levin [Wed, 10 Jan 2018 01:57:53 +0000 (01:57 +0000)]
strace.1: fix typo

* strace.1.in (.SH NOTES): Replace prlimit with prlimit64.

6 years agoDocument multiple personalities support
Eugene Syromyatnikov [Tue, 9 Jan 2018 19:09:19 +0000 (20:09 +0100)]
Document multiple personalities support

* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): New section.

6 years agoAdd indication of mpers support to strace -V output
Eugene Syromyatnikov [Tue, 9 Jan 2018 19:09:05 +0000 (20:09 +0100)]
Add indication of mpers support to strace -V output

* strace.c (print_version): Append information about m32 and mx32
decoding support.
* tests/strace-V.test: Update expected output.

6 years agoProvide strace's native arch to the test framework
Eugene Syromyatnikov [Tue, 9 Jan 2018 19:04:30 +0000 (20:04 +0100)]
Provide strace's native arch to the test framework

* configure.ac (arch_native): New variable, set to arch.
* tests/Makefile.am (NATIVE_ARCH): New variable, set to @arch_native@.
(AM_TEST_LOG_FLAGS): Pass NATIVE_ARCH as STRACE_NATIVE_ARCH environment
variable.

6 years agoAdd indication of optional demangle feature strace -V output
Eugene Syromyatnikov [Tue, 9 Jan 2018 19:00:27 +0000 (20:00 +0100)]
Add indication of optional demangle feature strace -V output

* strace.c (print_version) [USE_DEMANGLE]: Append " stack-demangle"
to the features string.
* tests/strace-V.test: Update expected output.

6 years agoconfigure.ac: check for mpers support on RISC-V
Eugene Syromyatnikov [Tue, 9 Jan 2018 18:14:11 +0000 (19:14 +0100)]
configure.ac: check for mpers support on RISC-V

* confgure.ac (st_MPERS([m32])): Add riscv.

6 years agoUse xappendstr instead of xsnprintf where suitable
Eugene Syromyatnikov [Mon, 8 Jan 2018 20:03:24 +0000 (21:03 +0100)]
Use xappendstr instead of xsnprintf where suitable

Replace occurrences of

    outptr += xsnprintf(outptr, sizeof(outstr) - (outptr - outstr), ...)

with much more sleek

    outptr = xappendstr(outstr, outptr, ...)

* desc.c (decode_select): Replace xsnprintf with xappendstr.
* open.c (sprint_open_modes): Likewise.
* poll.c (decode_poll_exiting): Likewise.
* signal.c (sprintsigmask_n): Likewise.
* xlat.c (sprintflags): Likewise.

6 years agoxstring.h: add xappendstr
Eugene Syromyatnikov [Mon, 8 Jan 2018 20:00:39 +0000 (21:00 +0100)]
xstring.h: add xappendstr

Introduce a macro for handling common case of partial writes
to a character array.

* xstring.h (get_pos_diff_): New function.
(xappendstr): New macro.

6 years agoUpdate perf-related flags
Eugene Syromyatnikov [Mon, 8 Jan 2018 18:52:23 +0000 (19:52 +0100)]
Update perf-related flags

 - PERF_SAMPLE_BRANCH_TYPE_SAVE, added in v4.14-rc1~173^2~33^2~6
 - PERF_SAMPLE_PHYS_ADDR, added in v4.14-rc1~173^2~2

* xlat/perf_branch_sample_type.in (PERF_SAMPLE_BRANCH_TYPE_SAVE): New
flag.
* xlat/perf_event_sample_format.in (PERF_SAMPLE_PHYS_ADDR): Likewise.
* tests/perf_event_open.c: Update expected output.

6 years agoperf.c: add support for struct perf_event_attr.namespaces
Eugene Syromyatnikov [Mon, 8 Jan 2018 18:48:42 +0000 (19:48 +0100)]
perf.c: add support for struct perf_event_attr.namespaces

This field was introduced by linux kernel commit v4.12-rc1~152^2~42^2~10.

* configure.ac (AC_CHECK_MEMBERS): Add  perf_event_attr.namespaces.
* perf_event_struct.h (struct perf_event_attr): Add namespaces field.
* perf.c (print_perf_event_attr): Print namespaces field.
Update comment for __reserved_1 field.
* tests/perf_event_open.c (struct pea_flags): Add namespaces field.
(print_event_attr): Update expected output.

6 years agotests: check decoding of [gs]et_thread_area syscalls on x86
Eugene Syromyatnikov [Mon, 8 Jan 2018 17:48:48 +0000 (18:48 +0100)]
tests: check decoding of [gs]et_thread_area syscalls on x86

* tests/xet_thread_area_x86.c: New file.
* tests/xet_thread_area_x86.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/.gitignore: Add xet_thread_area_x86.
* tests/pure_executables.list: Likewise.

6 years agotests: check decoding of modify_ldt with for 4-byte-available user_desc
Eugene Syromyatnikov [Mon, 8 Jan 2018 17:46:32 +0000 (18:46 +0100)]
tests: check decoding of modify_ldt with for 4-byte-available user_desc

Since there is possibility now that strace read only entry_number field
of the user_desc struct, let's check that it doesn't do it with
modify_ldt syscall.

* tests/modify_ldt.c (main): Add 4-byte-sized tail_alloc'ed variable.
Try to provide it as an argument to modify_ldt.

6 years agoAllow separate printing of struct user_desc.entry_number
Eugene Syromyatnikov [Mon, 8 Jan 2018 17:41:30 +0000 (18:41 +0100)]
Allow separate printing of struct user_desc.entry_number

Kernel reads only entry_number field in the beginning of the
get_thread_area syscall handler.  Let's replicate this behaviour.

* defs.h (enum user_desc_print_filter): New enumeration.
(print_user_desc): Add an argument for signalling which part of the
structure should be printed.
* clone.c (print_tls_arg): Update print_user_desc call.
* ldt.c (print_user_desc): Add filter argument.  Print entry_number on
entering and the rest on exiting. Store entering value of the
entry_number field in order to print the updated value in the impossible
case of changed entry_number value.
(SYS_FUNC(modify_ldt), SYS_FUNC(set_thread_area)): Update
print_user_desc call.
(SYS_FUNC(get_thread_area)): Call print_user_desc with
USER_DESC_ENTERING format argument on entering and with
USER_DESC_EXITING on exiting.

6 years agotests: move struct user_desc printing function into a separate file
Eugene Syromyatnikov [Mon, 8 Jan 2018 17:38:17 +0000 (18:38 +0100)]
tests: move struct user_desc printing function into a separate file

As part of preparation for the introduction of [gs]et_thread_area test.

* tests/modify_ldt.c (print_user_desc): Move it ...
* tests/print_user_desc.c: ... to new file.
* tests/Makefile.am (EXTRA_DIST): Add print_user_desc.c.

6 years agotests: check decoding of modify_ldt syscall
Eugene Syromyatnikov [Fri, 5 Jan 2018 20:11:26 +0000 (21:11 +0100)]
tests: check decoding of modify_ldt syscall

* tests/modify_ldt.c: New file.
* tests/gen_tests.in: Add modify_ldt test.
* tests/pure_executables.list: Add modify_ldt.
* tests/.gitignore: Likewise.

6 years agoldt.c: manually set modify_ldt's error code
Eugene Syromyatnikov [Fri, 5 Jan 2018 20:09:48 +0000 (21:09 +0100)]
ldt.c: manually set modify_ldt's error code

* ldt.c (modify_ldt): Move parsing under entering(tcp). Check whether
return code is erroneous and set tcp->u_error appropriately along with
RVAL_PRINT_ERR_VAL flag.

6 years agosyscall.c: add support for printing return value and error code
Eugene Syromyatnikov [Sun, 7 Jan 2018 02:53:53 +0000 (03:53 +0100)]
syscall.c: add support for printing return value and error code

Some weird syscalls (like modify_ldt) return value that doesn't indicate
an error (less than -4096), but it is, in fact, erroneous (because they
decide to clip the return value to 32-bit, for example).

Add a flag to print decoded error code along with syscall return value.

* defs.h (RVAL_PRINT_ERR_VAL): New rval flag.
* syscall.c (syscall_exiting_trace): Handle it.

6 years agoldt.c: print the first argument of modify_ldt as int
Eugene Syromyatnikov [Fri, 5 Jan 2018 20:08:25 +0000 (21:08 +0100)]
ldt.c: print the first argument of modify_ldt as int

* ldt.c (SYS_FUNC(modify_ldt)): Print the first argument as %d.

6 years agoldt.c: print lm field for 64-bit tracees
Eugene Syromyatnikov [Fri, 5 Jan 2018 20:06:10 +0000 (21:06 +0100)]
ldt.c: print lm field for 64-bit tracees

* configure.ac (AC_CHECK_MEMBERS): Add struct user_desc.lm.
* ldt.c (print_user_desc) [HAVE_STRUCT_USER_DESC_LM]: Print lm field
for non-compat tracees (it is ignored for compat ones).

6 years agoldt.c: make struct user_desc output more structured
Eugene Syromyatnikov [Fri, 5 Jan 2018 20:05:38 +0000 (21:05 +0100)]
ldt.c: make struct user_desc output more structured

Also, while we are here, let's fix print qualifiers (which should be %u
and not %d).

* ldt.c (print_user_desc): Use PRINT_FIELD_* macros for printing
structure.
(SYS_FUNC(set_thread_area)): Change field key-value separator from ":"
to "=", change print format qualifier from %d to %u.

6 years agoprint_fields.h: add PRINT_FIELD_U_CAST
Eugene Syromyatnikov [Fri, 5 Jan 2018 19:59:04 +0000 (20:59 +0100)]
print_fields.h: add PRINT_FIELD_U_CAST

Add a macro for printing fields explicitly casted to specific type.
This is useful for bit fields, as otherwise the magic of *_extend_to_*
macros breaks.

* print_field.h (PRINT_FIELD_U_CAST): New macro.

6 years agoprint_fields.h: rename PRINT_FIELD_UID to PRINT_FIELD_ID
Eugene Syromyatnikov [Fri, 5 Jan 2018 19:57:57 +0000 (20:57 +0100)]
print_fields.h: rename PRINT_FIELD_UID to PRINT_FIELD_ID

As uid is not the only thing that has a special treatment of the -1
value (and, as a result, needs special care), let's rename
PRINT_FIELD_UID to PRINT_FIELD_ID and make PRINT_FIELD_UID its alias.

* print_fields.h (PRINT_FIELD_ID): Rename from PRINT_FIELD_UID.
(PRINT_FIELD_UID): Define to PRINT_FIELD_ID.

6 years agoFix build on systems without linux/genetlink.h
Dmitry V. Levin [Sun, 7 Jan 2018 23:23:01 +0000 (23:23 +0000)]
Fix build on systems without linux/genetlink.h

* socketutils.c [!HAVE_LINUX_GENETLINK_H] (genl_families_xlat): Add
tcp argument.

Fixes: v4.20-134-gc46fefc ("Add tcp arguments to netlink calls")
6 years agocount.c: whitespace
Eugene Syromyatnikov [Fri, 5 Jan 2018 03:07:09 +0000 (04:07 +0100)]
count.c: whitespace

6 years agocount.c: cleanup types and sizeof usage
Eugene Syromyatnikov [Fri, 5 Jan 2018 03:06:58 +0000 (04:06 +0100)]
count.c: cleanup types and sizeof usage

* count.c (call_summary_pers): Change the type of sorted_count
to "unsigned int *".  Replace sizeof(int) with  sizeof(sorted_count[0]).
Change the type of idx to unsigned int.

6 years agocount.c: collect definitions of format strings in one place
Eugene Syromyatnikov [Fri, 5 Jan 2018 03:06:37 +0000 (04:06 +0100)]
count.c: collect definitions of format strings in one place

In an attempt to make it more readable.

* count.c (call_summary_pers): Put all format strings in static
constants. Use them.

6 years agoAdd tcp arguments to netlink calls
Eugene Syromiatnikov [Mon, 25 Dec 2017 23:14:14 +0000 (00:14 +0100)]
Add tcp arguments to netlink calls

Since they call tracee-specific socket/sendmsg/recvmsg, we'd like to
pass tcp there.

* defs.h (genl_families_xlat): Add tcp argument.
* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_generic,
decode_nlmsg_type_netfilter, typedef nlmsg_types_decoder_t): Likewise.
(decode_nlmsg_type): Add tcp argument. Pass tcp to decoder call.
(print_nlmsghdr): Pass tcp to the decode_nlmsg_type call.
* socketutils.c (send_query, receive_responses): Add tcp argument.
(inet_send_query, unix_send_query, netlink_send_query, ): Add tcp argument.
Pass tcp to the send_query call.
(unix_get): Add tcp argument. Pass tcp to the unix_send_query and
receive_responses calls.
(inet_get): Add tcp argument. Pass tcp to the inet_send_query and
receive_responses calls.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Add tcp argument. Pass
tcp to the inet_get call.
(netlink_get): Add tcp argument. Pass tcp to the netlink_send_query and
receive_responses calls.
(protocols): Add tcp argument to the get field.
(get_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
the protocols[].get calls.
(print_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
the get_sockaddr_by_inode_uncached call.
(get_sockaddr_by_inode): Pass tcp to the get_sockaddr_by_inode_uncached
call.
(print_sockaddr_by_inode): Pass tcp to the
print_sockaddr_by_inode_uncached call.
(genl_send_dump_families): Add tcp argument. Pass tcp to the send_query
call.
(genl_families_xlat): Add tcp argument. Pass tcp to the
genl_send_dump_families and receive_responses calls.

6 years agoAdd tcp argument to clear_regs
Eugene Syromiatnikov [Mon, 25 Dec 2017 23:09:41 +0000 (00:09 +0100)]
Add tcp argument to clear_regs

* defs.h (clear_regs): Add argument struct tcb *tcp.
* syscall.c (clear_regs): Likewise.
* strace.c (next_event): Pass tcp to clear_regs() call.

6 years agoPass tcp argument to get_optmem_max/read_int_from_file
Eugene Syromiatnikov [Mon, 25 Dec 2017 22:55:22 +0000 (23:55 +0100)]
Pass tcp argument to get_optmem_max/read_int_from_file

In preparation to passing tcp to all tracee-related syscalls.

* defs.h (read_int_from_file): Add "struct tcb *" as the first argument.
* util.c (read_int_from_file): Likewise.
* msghdr.c (get_optmem_max): Add "struct tcb *tcp" as the first
argument, pass it to read_int_from_file call.
(decode_msg_control): Pass tcp to get_optmem_max.

6 years agoInclude paths.h if it is available
Eugene Syromiatnikov [Fri, 15 Dec 2017 11:38:59 +0000 (12:38 +0100)]
Include paths.h if it is available

Use the OS definition of _PATH_BSHELL macro if it is available.

* configure.ac (AC_CHECK_HEADERS): Add paths.h.
* strace.c [HAVE_PATHS_H]: Include paths.h.

6 years agostrace.c: avoid duplication of a format string in attach_tcb
Eugene Syromiatnikov [Fri, 4 Aug 2017 06:52:27 +0000 (08:52 +0200)]
strace.c: avoid duplication of a format string in attach_tcb

* strace.c (attach_tcb): Add task_path variable with the output format.
Use it for the procdir declaration and xsprintf format string argument.

6 years agoMove syscall_tampered to defs.h
Elvira Khabirova [Sun, 7 Jan 2018 02:38:46 +0000 (05:38 +0300)]
Move syscall_tampered to defs.h

* syscall.c (syscall_tampered): Move ...
* defs.h: ... here.

6 years agostrace.c: rename set_sigaction to set_sighandler
Elvira Khabirova [Sun, 7 Jan 2018 02:38:45 +0000 (05:38 +0300)]
strace.c: rename set_sigaction to set_sighandler

Since set_sigaction() actually specifies sa_handler and not sa_sigaction,
rename set_sigaction() to set_sighandler() for future definition of
set_sigaction() function as specifying sa_sigaction.

* strace.c (set_sigaction): Rename to set_sighandler.
All callers updated.

6 years ago.gitignore: ignore "gnu" directory created by st_MPERS m4 macro
Elvira Khabirova [Sun, 7 Jan 2018 02:38:44 +0000 (05:38 +0300)]
.gitignore: ignore "gnu" directory created by st_MPERS m4 macro

6 years agoUpdate .mailmap
Elvira Khabirova [Sun, 7 Jan 2018 02:38:49 +0000 (05:38 +0300)]
Update .mailmap

* .mailmap (Elvira Khabirova): Add @altlinux.org.

6 years ago.mailmap: add canonical name for Chen Jingpiao
Chen Jingpiao [Sat, 18 Nov 2017 15:48:52 +0000 (23:48 +0800)]
.mailmap: add canonical name for Chen Jingpiao

* .mailmap: Add canonical name for Chen Jingpiao.

6 years agopersonality.c: use sprintxval
Dmitry V. Levin [Sun, 7 Jan 2018 00:05:42 +0000 (00:05 +0000)]
personality.c: use sprintxval

* personality.c (SYS_FUNC(personality)): Use sprintxval instead of local
implementation.

6 years agoxlat.c: add sprintxval for printing xval to string
Eugene Syromiatnikov [Sat, 5 Aug 2017 14:19:15 +0000 (16:19 +0200)]
xlat.c: add sprintxval for printing xval to string

* defs.h (sprintxval): New declaration.
(sprintxval): New function.

6 years agodesc.c: use xsnprintf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
desc.c: use xsnprintf instead of sprintf

* desc.c: Include "xstring.h".
(decode_select): Replace sprintf with xsnprintf.

6 years agoxlat.c: use xsnprintf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
xlat.c: use xsnprintf instead of sprintf

* xlat.c: Include "xstring.h".
(sprintflags): Replace sprintf with xsnprintf.

6 years agoopen.c: use xsnprintf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
open.c: use xsnprintf instead of sprintf

* open.c: Include "xstring.h".
(sprint_open_modes): Replace sprintf with xsnprintf.

6 years agopoll.c: use xs*printf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
poll.c: use xs*printf instead of sprintf

* poll.c: Include "xstring.h".
(decode_poll_exiting): Replace sprintf with xsnprintf and xsprintf.

6 years agosignal.c: use xs*printf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
signal.c: use xs*printf instead of sprintf

* signal.c: Include "xstring.h".
(signame): Replace sprintf with xsprintf.
(sprintsigmask_n): Replace sprintf with xsnprintf.

6 years agoprint_timeval.c: use xsprintf instead of snprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
print_timeval.c: use xsprintf instead of snprintf

* print_timeval.c: Include "xstring.h".
(sprint_timeval, sprint_timeval32): Replace snprintf with xsprintf.

6 years agoprint_timespec.c: use xsprintf instead of snprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
print_timespec.c: use xsprintf instead of snprintf

* print_timespec.c: Include "xstring.h".
(sprint_timespec): Replace snprintf with xsprintf.

6 years agommsghdr.c: use xsprintf instead of snprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
mmsghdr.c: use xsprintf instead of snprintf

* mmsghdr.c: Include "xstring.h".
(SYS_FUNC(recvmmsg)): Replace snprintf with xsprintf.

6 years agosocketutils.c: use xsprintf instead of snprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
socketutils.c: use xsprintf instead of snprintf

* socketutils.c: Include "xstring.h".
(unix_parse_response): Replace snprintf with xsprintf.

6 years agoalpha.c: use xsprintf instead of snprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
alpha.c: use xsprintf instead of snprintf

* alpha.c: Include "xstring.h".
(decode_getxxid): Replace snprintf with xsprintf.

6 years agov4l2.c: use xsprintf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
v4l2.c: use xsprintf instead of sprintf

* v4l2.c: Include "xstring.h".
(print_v4l2_create_buffers): Replace sprintf with xsprintf.

6 years agoutil.c: use x*sprintf instead of s*printf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
util.c: use x*sprintf instead of s*printf

* util.c: Include "xstring.h".
(sprinttime_ex): Replace snprintf with xsnprintf.
(getfdproto): Replace sprintf with xsprintf.

6 years agounwind.c: use xsprintf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
unwind.c: use xsprintf instead of sprintf

* unwind.c: Include "xstring.h".
(build_mmap_cache): Replace sprintf with xsprintf.

6 years agosyscall.c: use xsprintf instead of sprintf
Dmitry V. Levin [Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)]
syscall.c: use xsprintf instead of sprintf

* syscall.c: Include "xstring.h".
(get_scno): Replace sprintf with xsprintf.