6229 Commits

Author SHA1 Message Date
3c5aaa643b Fix ANY_WORDSIZE_LESS_THAN_KERNEL_LONG definition
* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): Rewrite without undefined
behaviour.

Fixes: f916793 ("Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro")
2018-01-19 23:02:17 +00:00
Eugene Syromyatnikov
b96c599af8 util: return string size in printstr
As umovestr now returns something useful, let's propagate it further.

* defs.h (printstr_ex, printpathn, printpath): Change return type from
void to int.
(printstrn, printstr): Change return type from void to int, return
printstr_ex result.
* util.c (printpathn): Return -1 on NULL addr, nul_seen (exit code of
umovestr) on success.
(printpath): Return printpathn result.
(printstr_ex): Return -1 on NULL addr, umoven/umovestr result otherwise.
2018-01-19 22:45:34 +00:00
Eugene Syromyatnikov
7ead136575 ucopy: return string size in umovestr
We return the size that includes \0 in order to preserve existing
behaviour (return 0 when \0 haven't been seen, return positive number
when it has been seen).

* ucopy.c (umovestr_peekdata, umovestr): Return string length
including \0 instead of 1 when \0 is found.
2018-01-19 22:45:34 +00:00
03766d6640 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.
2018-01-19 17:50:09 +00:00
Eugene Syromyatnikov
b2fe2a60ac 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>
2018-01-19 17:50:09 +00:00
Eugene Syromyatnikov
b3d691efe4 tests: improve setugid error diagnostics a bit
* tests/setugid.c (main): Print unexpected code returned by syscall.
2018-01-19 17:50:09 +00:00
457ad95b7f 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].
2018-01-19 17:50:09 +00:00
e05a4be54b 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.
2018-01-18 17:44:56 +00:00
Eugene Syromyatnikov
488110f800 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.
2018-01-19 01:04:37 +00:00
Eugene Syromyatnikov
d9f6166f0c 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.
2018-01-19 02:04:37 +01:00
Eugene Syromyatnikov
6850ddbc42 Update NEWS 2018-01-18 02:17:12 +01:00
119b6a1a1d 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.
2018-01-17 21:31:07 +00:00
96dbdc342d 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.
2018-01-17 21:31:07 +00:00
Eugene Syromyatnikov
89b39224fd 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>
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
afd9e5e801 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.
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
d3890c53c8 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.
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
4c34c65d97 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.
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
187c8dd975 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.
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
52314cc9a4 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>
2018-01-17 04:34:49 +00:00
Eugene Syromyatnikov
408ce203da 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>
2018-01-17 04:34:49 +00:00
16046f7773 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>
2018-01-17 03:22:07 +00:00
Eugene Syromyatnikov
0918b3145c 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
4af6378100 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
64fd0ce626 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
a4886a7f99 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
1fd3b7e30a 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
7d9a21fcba 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
396961b1b4 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.
2018-01-16 22:54:38 +00:00
Eugene Syromyatnikov
558ece68c8 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.
2018-01-16 23:02:35 +01:00
114c7d3e80 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>
2018-01-16 04:34:25 +00:00
69bd90eb80 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.
2018-01-16 04:34:25 +00:00
e6d3c79d60 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.
2018-01-16 01:09:14 +00:00
f31ef8f967 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.
2018-01-16 01:09:14 +00:00
376cf85efe configure: try to set the C compiler mode to accept ISO Standard C
* configure.ac: Use AC_PROG_CC_STDC.
* NEWS: Mention this.
2018-01-16 01:09:14 +00:00
4ab21ae0b8 pathtrace: update the list of unrelated syscalls
* pathtrace.c (pathtrace_match_set) <SEN_accept4, SEN_accept,
SEN_signalfd4, SEN_signalfd>: Skip matching.
2018-01-15 23:33:18 +00:00
3782831620 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.
2018-01-15 22:58:48 +00:00
8672a7189d 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.
2018-01-15 22:47:38 +00:00
24d48dde06 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.
2018-01-15 18:16:31 +00:00
7ef06058e2 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.
2018-01-15 16:23:54 +00:00
5f2597ef21 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.
2018-01-15 16:23:54 +00:00
79a08404d8 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".
2018-01-15 16:23:54 +00:00
Eugene Syromyatnikov
4e5033c8d2 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.
2018-01-14 23:08:10 +00:00
752e6b4792 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.
2018-01-13 13:46:45 +00:00
Eugene Syromyatnikov
3eb199a29d 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>
2018-01-11 23:09:56 +00:00
Gleb Fotengauer-Malinovskiy
649dd83545 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.
2018-01-11 19:24:15 +00:00
Eugene Syromyatnikov
88fa069e35 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>
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
671f2ffcdc 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.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
ce98c7b297 tests: use sprintrc in reboot.test
* test/reboot.c (main): Use sprintrc instead of old-style manual
printing of return code.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
395c90f71c 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.
2018-01-11 15:54:33 +00:00
Eugene Syromyatnikov
92eb77e8c3 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.
2018-01-11 15:54:33 +00:00