Commit Graph

6515 Commits

Author SHA1 Message Date
2dad13a0bd debian: enable mpers support for ppc64el and s390x
* debian/control (Build-Depends) [ppc64el, s390x]: Add gcc-multilib.
2018-04-05 19:35:58 +00:00
3154e6de55 Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.22-1.
* strace.spec.in: Likewise.
2018-04-05 12:13:14 +00:00
9630646cfa Prepare for 4.22 release
* NEWS: Update for 4.22 release.
2018-04-05 04:05:06 +00:00
6bc832e2bc Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-04-05 01:40:00 +00:00
Eugene Syromyatnikov
3b01ac5cd3 Update NEWS 2018-04-05 01:40:00 +00:00
Masatake YAMATO
dd7e62f1e7 unwind: split unwind code into front-end and back-end
This opens the way for alternative unwinder back-ends.

* unwind.h: New file, defines the unwinder back-end interface.
* unwind.c: Move all libunwind related code ...
* unwind-libunwind.c: ... here.
* Makefile.am [USE_LIBUNWIND] (strace_SOURCES): Add unwind.h
and unwind-libunwind.c.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-05 01:40:00 +00:00
Masatake YAMATO
6b94271548 unwind: rename public functions in an object-oriented fashion
This change renames functions exported to strace core part from unwind
subsystem.

The new names imply that unwind subsystem exports two types of
functions.  One is for manipulating back-end itself, "unwind_" prefix
is used for this type.  Another is for manipulating back-end private data
structure (unwind_ctx) attached to tcb, "unwind_tcb_" is used for this
type.

This naming should help people to understand unwind subsystem
and the relation between unwind subsystem and back-ends.

* defs.h (unwind_print_stacktrace): Rename to unwind_tcb_print.
(unwind_capture_stacktrace): Rename to unwind_tcb_capture.
* unwind.c: Ditto.
* syscall.c (syscall_entering_trace, syscall_exiting_trace): Use
new names.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-05 01:40:00 +00:00
Masatake YAMATO
9f5e1d113e unwind: add unwind_ prefix to struct tcb.queue field and its type
The names given to struct tcb.queue field and its type are too common,
this may cause conflicts in the future if new fields are added
to struct tcb.

* defs.h (struct tcb): Rename queue field to unwind_queue,
rename its type queue_t to unwind_queue_t.
* unwind.c (struct unwind_queue_t): Rename to unwind_queue_t.
All users updated.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-05 01:40:00 +00:00
Masatake YAMATO
51e81014e9 unwind: make the field type of struct tcb independent from libunwind
Narrowing the area where the code refers to names associated with
libunwind is needed to utilize libdw of elfutils as an alternative
unwinder.

* defs.h (struct tcb): Rename libunwind_ui field to unwind_ctx, change
its type to "void *".
* unwind.c (unwind_tcb_init, unwind_tcb_fin, stracetrace_walk): Reflect
* the above field renaming.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-05 01:40:00 +00:00
4eeba4e60f tests: robustify options-syntax.test against ash
* tests/options-syntax.test: Do not assume that shell provides $UID,
use "id -u" if it doesn't.
2018-04-04 21:36:07 +00:00
Eugene Syromyatnikov
be55c1c61a strace.c: add support for opening output file in append mode
* strace.c (open_append): New variable.
(init): Handle -A option.
(strace_fopen): Open file in "a" mode if open_append is set to true.
* strace.1.in: Document this.
* NEWS: Mention this.

Suggested-by: Philipp Marek <philipp.marek@emerion.com>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528488
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
698e9c30d4 strace.c: support simultaneous usage of -r and -t options
* strace.c (init): Do not set tflag when rflag is set.
(printleader): Handle rflag and tflag separately.
* strace.1.in (.SH OPTIONS): Add a note about differences between
the monotonic clock time  and the wall clock time.
* tests/options-syntax.test: Remove the check for
"-tt has no effect with -r" warning.
* NEWS: Mention this.

Suggested-by: Josh Triplett <josh@freedesktop.org>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466195
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
bed7622d49 syscall.c: dump write I/O even if error is returned
It makes sense to try to dump the argument of write syscalls as they can
be readily available despite the fact that error has been returned.

* syscall.c (dumpio): Move check for syserror and check for fd in
read_set to the end of the function.
* tests/read-write.c: Add a check for this behaviour.
* tests/pread64-pwrite64.c: Update expected output.
* NEWS: Mention this.

Suggested-by: J. Bruce Fields <bfields@fieldses.org>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=436284
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
a02a583b3f strace: handle possible NULL from localtime() call
* strace.c (printleader): Print raw tv_sec value if localtime() returned
NULL.
* tests/localtime.c: New file.
* tests/localtime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add localtime.
(MISC_TESTS): Add localtime.test.
(localtime_LDADD): New variable.
* tests/.gitignore: Add localtime.
* ci/install-dependencies.sh (common_packages): Add faketime.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Closes: https://github.com/strace/strace/issues/42
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
b7154bf146 Return RVAL_STR unconditionally
There is no reason to check for auxstr being non-NULL
because syscall_exiting_trace already does the check.

* sched.c (SYS_FUNC(sched_getscheduler)): Do not check tcp->auxstr,
return RVAL_STR unconditionally.
* time.c (do_adjtimex): Likewise.
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
0f368cd8cb dist/README: s/linux/Linux/
* dist/README: Replace "linux" with "Linux".
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
8ef2b2ad6e strace.1.in: fix formatting of -e trace class descriptions
Use .TP instead .PP as it is ought to be.

* strace.1.in (.SS Filtering): Use .TP instead .PP as it is ought to be.
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
834318eb15 nlattr: check NLA_TYPE_MASK at compile time
* nlattr.c: Include "static_assert.h"
(print_nlattr): Check the expectations about NLA_TYPE_MASK.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-04 20:32:42 +00:00
Eugene Syromyatnikov
b10995d982 bpf: add a comment about bpf_attr decoding
* bpf.c: Add comment.
2018-04-04 20:32:42 +00:00
a2e4217c95 tests: check decoding of bpf_attr of size 1
* tests/bpf.c (BPF_PROG_GET_NEXT_ID_checks): New entry.
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
c5efe0a896 bpf: use print_big_u64_addr
Since pointers stored in the bpf_attr union are 64-bit regardless
of architecture bitness.

* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Call print_big_u64_addr
for attr.license.
(DEF_BPF_CMD_DECODER(BPF_OBJ_PIN)): Call print_big_u64_addr
for attr.pathname.
* tests/bpf.c (BPF_OBJ_PIN_checks): Check it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
8e439e10f0 bpf: add support for file mode flags
These were introduced by Linux commit v4.15-rc1~84^2~384^2~4.

* bpf_attr.h (struct BPF_OBJ_PIN_struct): Add file_flags field.
(struct BPF_PROG_GET_NEXT_ID_struct, struct BPF_PROG_GET_FD_BY_ID_struct,
struct BPF_MAP_GET_FD_BY_ID_struct): Add open_flags field.
(BPF_OBJ_PIN_struct_size, expected_BPF_OBJ_PIN_struct_size,
expected_BPF_PROG_GET_NEXT_ID_struct_size,
expected_BPF_PROG_GET_FD_BY_ID_struct_size,
expected_BPF_MAP_GET_FD_BY_ID_struct_size): Update.
* bpf.c (DEF_BPF_CMD_DECODER(BPF_OBJ_PIN)): Check the length, skip
printing the rest of attributes if it is less than offset of the
end of the bpf_fd field, print file_flags field otherwise.
(DEF_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID),
DEF_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID),
DEF_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)): Check the length, skip
printing the rest of attributes if it is less than offset of the
end of the next_id field, print open_flags field otherwise.
* xlat/bpf_file_mode_flags.in: New file.
* tests/bpf.c (BPF_OBJ_PIN_checks, BPF_PROG_GET_NEXT_ID_checks,
BPF_PROG_GET_FD_BY_ID_checks, BPF_MAP_GET_FD_BY_ID_checks): Check it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
737762cb85 tests: refactor bpf test
The aim of this change is to introduce an ability to perform multiple
checks for a specific bpf command.  In order to achieve so, all the
related data is stored in check descriptor, and test_bpf iterates over
it.  There are also some provisions made in regard to future changes
(specifically, the way bpf_attr_data union is defined).

* tests/bpf.c (print_bpf_attr): New function, a wrapper around
struct bpf_check.printer.
(test_bpf_): Rename to...
(test_bpf): ...this.  Replace arguments with struct bpf_check pointer.
Iterate over possible attribute variants. Account for changes in
attribute initialisation routine: provide a pointer to locally defined
union bpf_attr_data and perform memcpy afterwards. Initialise memory
from data each time before a bpf call.
(TEST_BPF, DEF_*, init_*, print_*): Remove.
(init_BPF_PROG_LOAD_attr, print_BPF_PROG_LOAD_attr,
init_BPF_OBJ_PIN_attr): New functions.
(license, pathname): New variables.
(BPF_MAP_CREATE_checks, BPF_MAP_LOOKUP_ELEM_checks,
BPF_MAP_UPDATE_ELEM_checks, BPF_MAP_DELETE_ELEM_checks,
BPF_MAP_GET_NEXT_KEY_checks, BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
BPF_PROG_ATTACH_checks, BPF_PROG_DETACH_checks,
BPF_PROG_TEST_RUN_checks, BPF_PROG_GET_NEXT_ID_checks,
BPF_PROG_GET_FD_BY_ID_checks, BPF_MAP_GET_FD_BY_ID_checks,
BPF_OBJ_GET_INFO_BY_FD_checks): New arrays.
(BPF_OBJ_GET_checks, BPF_MAP_GET_NEXT_ID_checks): New macros.
(CHK): New macro, a shorthand for initialising array of struct bpf_check.
(main): New static constant checks, iterate over checks and run test_bpf
with each element.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
82120681e3 print_fields.h: introduce PRINT_FIELD_ADDR and PRINT_FIELD_ADDR64 macros
* print_fields.h (PRINT_FIELD_ADDR, PRINT_FIELD_ADDR64): New macro.
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
f54ab2c24a print_fields.h: introduce PRINT_FIELD_CSTRING_SZ macro
A variant of PRINT_FIELD_CSTRING with an ability to pass string size
explicitly.

* print_fields.h (PRINT_FIELD_CSTRING_SZ): New macro.
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
a24f675e1d print_fields.h: check whether passed field is an array in PRINT_FIELD_CSTRING
* print_fields.h (PRINT_FIELD_CSTRING): Add MUST_BE_ARRAY to the size
value in order to check whether (where_).field_ is an array in compile
time.
2018-04-04 16:33:19 +00:00
Eugene Syromyatnikov
988cace650 print_fields.h: whitespace fix in PRINT_FIELD_HEX_ARRAY 2018-04-04 16:33:19 +00:00
995ae92b50 bpf_attr: add more size checks
* bpf_attr.h: Add expected sizes of structures.
* gen_bpf_attr_check.sh: Check them.
2018-04-04 14:50:07 +00:00
3428c8b164 tests: check bpf syscall decoder unconditionally
* configure.ac (AC_CHECK_HEADERS([linux/bpf.h])): Check for
struct bpf_insn.
* tests/bpf.c: Remove the test guard, include "scno.h", "bpf_attr.h",
"xlat.h", and "xlat/bpf_commands.h".  Conditionalize inclusion of
<linux/bpf.h> on HAVE_LINUX_BPF_H.  Remove all HAVE_UNION_* checks.
(BPF_ATTR_DATA_FIELD): New macro.
(bpf_attr_data): New union.  Note that it is larger than modern
union bpf_attr, this allows more checks to be implemented in the future.
(sizeof_attr, test_bpf_): Replace union bpf_attr with
union bpf_attr_data.
(DEF_BPF_INIT_FIRST): Replace union bpf_attr with the corresponding
structure.
(init_BPF_MAP_CREATE_attr): Replace union bpf_attr with
struct BPF_MAP_CREATE_struct.
(init_BPF_MAP_LOOKUP_ELEM_attr): Replace union bpf_attr with
struct BPF_MAP_LOOKUP_ELEM_struct.
(init_BPF_MAP_UPDATE_ELEM_attr): Replace union bpf_attr with
struct BPF_MAP_UPDATE_ELEM_struct.
(init_BPF_MAP_DELETE_ELEM_attr): Replace union bpf_attr with
struct BPF_MAP_DELETE_ELEM_struct.
(init_BPF_MAP_GET_NEXT_KEY_attr): Replace union bpf_attr with
struct BPF_MAP_GET_NEXT_KEY_struct.
(init_BPF_PROG_LOAD_attr): Replace union bpf_attr with
struct BPF_PROG_LOAD_struct.
(init_BPF_OBJ_PIN_attr): Replace union bpf_attr with
struct BPF_OBJ_PIN_struct.
(init_BPF_PROG_ATTACH_attr): Replace union bpf_attr with
struct BPF_PROG_ATTACH_struct.
(init_BPF_PROG_DETACH_attr): Replace union bpf_attr with
struct BPF_PROG_DETACH_struct.
(init_BPF_PROG_GET_NEXT_ID_attr): Replace union bpf_attr with
struct BPF_PROG_GET_NEXT_ID_struct.
(sample_BPF_PROG_TEST_RUN_attr): Change type from union bpf_attr to
struct BPF_PROG_TEST_RUN_struct, all users updated.
(sample_BPF_OBJ_GET_INFO_BY_FD_attr): Change type from union bpf_attr
to struct BPF_OBJ_GET_INFO_BY_FD_struct, all users updated.
2018-04-04 12:24:19 +00:00
1802fe1ea6 Check that structures defined by bpf_attr.h match system union bpf_attr
* gen_bpf_attr_check.sh: New file.
* Makefile.am (EXTRA_DIST): Add it.
(strace_SOURCES_check): New variable.
(strace_SOURCES): Add $(strace_SOURCES_check).
(BUILT_SOURCES, CLEANFILES): Add bpf_attr_check.c.
(bpf_attr_check.c): New rule.
(sys_func_h_sources): New variable.
(sys_func.h): Use it instead of strace_SOURCES_c.
* .gitignore: Add /bpf_attr_check.c.
2018-04-04 12:24:19 +00:00
442560c875 build: generate all union bpf_attr checks automatically
Rather than list by hand some members of union bpf_attr that we check
for availability, automatically list all members of union bpf_attr we
are aware of.

* m4/gen_bpf_attr_m4.sh: New file.
* bootstrap: Invoke it.
* configure.ac (AC_CHECK_HEADERS([linux/bpf.h])): Use st_BPF_ATTR.
* m4/.gitignore: New file.
2018-04-04 12:24:19 +00:00
b93c952ba5 bpf: move definitions of bpf_attr structures to separate header file
This also unifies decoders of bpf commands by moving common code
to new macros.

* bpf_attr.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* bpf.c: Include it.
(DEF_BPF_CMD_DECODER): Rename to BEGIN_BPF_CMD_DECODER, add code common
to all decoders.  All users updated.
(END_BPF_CMD_DECODER): New macro, add its invocation to all users
of BEGIN_BPF_CMD_DECODER macro.
2018-04-04 12:24:19 +00:00
Eugene Syromyatnikov
7eac1da9be Introduce print_big_u64_addr
This is needed at least for bpf, btrfs, and sg_io, as 32-bit tracer
cannot figure out whether the kernel is 32-bit or 64-bit,
and its behaviour differs when it handles u64 as a pointer.

* linux/arch_defs_.h [!CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL]
(CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL): New definition, default to 0.
* linux/arm/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Define to 1.
* linux/i386/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* linux/mips/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* linux/powerpc/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* linux/riscv/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* linux/s390/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* linux/sparc/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* linux/tile/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
Likewise.
* defs.h (print_big_u64_addr): New function.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-04 12:24:19 +00:00
Eugene Syromyatnikov
d5e7532581 defs.h: introduce max_addr and max_kaddr macros
In order to check an address against maximum addr/kaddr value
for the current personality.

* degs.h (max_addr, max_kaddr): New macros.
2018-04-04 12:24:19 +00:00
a781408bd4 Introduce static_assert
We are going to use static_assert provided by <assert.h> or,
if it doesn't work, our cheap imitation that doesn't display
the message specified as the second argument of static_assert.

* configure.ac (AC_CACHE_CHECK): Check for static_assert in <assert.h>,
define HAVE_STATIC_ASSERT if it is available.
* static_assert.h: New file.
* Makefile.am (strace_SOURCES): Add it.
2018-04-04 12:24:19 +00:00
074f49451c tests: forward SIZEOF_KERNEL_LONG_T and SIZEOF_LONG to C preprocessor
* tests/Makefile.am (AM_CPPFLAGS): Forward SIZEOF_KERNEL_LONG_T
and SIZEOF_LONG as TESTS_SIZEOF_KERNEL_LONG_T and TESTS_SIZEOF_LONG.
* tests/tests.h [TESTS_SIZEOF_KERNEL_LONG_T] (SIZEOF_KERNEL_LONG_T):
Redefine to TESTS_SIZEOF_KERNEL_LONG_T.
[TESTS_SIZEOF_LONG] (SIZEOF_LONG): Redefine to TESTS_SIZEOF_LONG.

Complements: v4.21~5 ("Export SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests")
2018-04-04 12:24:19 +00:00
ef1013795c tests/tests.h: fix indentation 2018-04-04 12:24:19 +00:00
d453156784 tests: fix potential errno clobbering in netlink_kobject_uevent.test
* tests/netlink_kobject_uevent.c (errstr): New variable.
(sys_send): New function.
(main): Use them.
2018-04-04 12:24:19 +00:00
Gleb Fotengauer-Malinovskiy
54fab3cd0c Restore kvm ioctl definitions for aarch64 and mips architectures
* maint/ioctls_sym.sh: Add aarch64 and mips architectures to the list
of kvm-capable architectures.
* linux/aarch64/ioctls_arch0.h: Regenerate.
* linux/mips/ioctls_arch0.h: Regenerate.

Fixes: v4.15~92 ("Move KVM_* ioctl entries from ioctls_inc*.h to ioctls_arch*.h")
2018-04-03 18:11:25 +00:00
Gleb Fotengauer-Malinovskiy
c5bc24a778 Update ioctl entries from linux v4.16
* linux/32/ioctls_inc_align16.h: Update from linux v4.16
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.
* linux/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.
2018-04-03 18:11:25 +00:00
Gleb Fotengauer-Malinovskiy
dca8686052 maint: update for linux 4.16
* maint/ioctls_sym.sh: Add workaround for linux/ndctl.h file.
Update workaround for media/v4l2-common.h file.
(x86_list): Add KVM_GET_MSR_FEATURE_INDEX_LIST.
2018-04-03 18:11:24 +00:00
Eugene Syromyatnikov
b5a02fe645 util.c: amend sprinttime_ex description a bit
* util.c (sprinttime_ex): Document return value.
2018-04-01 13:14:15 +00:00
Eugene Syromyatnikov
6d0b564103 tests/bpf.c: add a check for NULL bpf_attr pointer
* tests/bpf.c (main): Add a check with 0 passed in the third argument.
2018-04-01 13:14:15 +00:00
Eugene Syromyatnikov
ca6e35dc6e bpf: print byte range for extra data
As it could be not entirely clear what bytes are printed.

* bpf.c (decode_attr_extra_data): Print a comment about the byte range
to be printed.
* tests/bpf.c: Update expected output.
2018-04-01 13:14:15 +00:00
Eugene Syromyatnikov
3744bc73f7 Remove addflags
It has only single user and implementation of xlat styles for it would
lead to lots of code duplication.

* defs.h (addflags): Remove declaration.
* mem.c (print_mmap_flags): Convert addflags call into printflags64 with
non-zeroeness flags check.
* xlat.c (addflags): Remove.
2018-04-01 13:14:15 +00:00
53b0d9c438 Add i18n support
Let's make a step towards the growing strace userbase all around
the world and translate something to the language of their choice.

This change enables translation of error messages corresponding
to errno codes, making it consistent with error diagnostics of other
i18n-aware tools, e.g.

$ LANG=es_ES strace -qq -a38 -P /missing unlink /missing
unlink("/missing")                    = -1 ENOENT (No existe el fichero o el directorio)
unlink: no se puede deshacer el enlace '/missing': No existe el fichero o el directorio

* strace.c: Include <locale.h>.
(main): Invoke setlocale.
* tests/init.sh: Export LC_ALL=C.
* NEWS: Mention this enhancement.
2018-04-01 13:14:15 +00:00
884d3ae479 Remove RVAL_PRINT_ERR_VAL
* defs.h (RVAL_PRINT_ERR_VAL): Remove.
* ldt.c (SYS_FUNC(modify_ldt)): Return 0.
* syscall.c (syscall_exiting_trace): When printing an error,
always print struct tcb.u_rval as if RVAL_PRINT_ERR_VAL was set.
2018-03-29 16:00:18 +00:00
92d7499fbf Treat RVAL_DECIMAL the same way as RVAL_UDECIMAL
Assuming that syscalls may return negative values only as error codes,
always print non-error syscall return codes as unsigned.

* defs.h (RVAL_UDECIMAL): Remove.
(RVAL_DECIMAL): Rename to RVAL_UDECIMAL.
* syscall.c (syscall_exiting_trace) <case RVAL_DECIMAL>: Remove.
* clone.c (SYS_FUNC(fork)): Remove RVAL_UDECIMAL.
* lseek.c (SYS_FUNC(lseek)): Likewise.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Likewise.
* times.c (SYS_FUNC(times)): Always return 0.
* tests/inject-nf.c (main): Update expected output.
2018-03-29 16:00:18 +00:00
fc56ecefd1 tests: check handling of some invalid delay injection parameters
* tests/qual_inject-syntax.test: Check for negative delay injection
parameters.  Check for overriding delay injection parameters.
2018-03-29 01:30:09 +00:00
Eugene Syromyatnikov
4c9ed3f146 Implement injection of negative return values
Extend the range of injected return value to the maximum, print warnings
if negative injection value can be clipped in compat personality or can
inadvertently turn into a fault injection.

* defs.h (INJECT_F_ERROR): New macro.
* filter_qualify.c (parse_inject_token): Revert type of intval local
variable back to int, check INJECT_F_ERROR along with INJECT_F_RETVAL,
use strtoull to parse retval argument, print warnings in case of retval
clipping and inadvertent fault injection.
(qualify_inject_common): Set INJECT_F_ERROR instead of INJECT_F_RETVAL.
* syscall.c (tamper_with_syscall_exiting): Check inject_data.flags
to determine whether a fault injection or retval injection has to be
performed.
(syscall_exiting_trace) <case RVAL_DECIMAL>: Explicitly print
tcp->u_rval as int if current_klongsize < sizeof(tcp->u_rval).
* tests/inject-nf.c (main): Update.
* tests/inject-nf.test: Test injection of negative return values.
* tests/qual_inject-syntax.test: Remove retval=-1 check as it is now
allowed, add checks for invalid retval parameters.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-03-29 01:30:09 +00:00