strace/linux/nios2
Elvira Khabirova 41d647ce67 Implement success injection
This extends fault injection syntax with :retval= option.
When :retval=VALUE is specified, the syscall number is replaced by -1
and a bogus success VALUE is returned to the callee.

* defs.h (fault_opts): Remove err field, add rval field.
(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
New macros.
* qualify.c (parse_fault_token): Handle retval= token.
(qualify_fault): Update fault_opts initialization after the move
from struct fault_opts.err to struct fault_opts.rval.
* syscall.c (arch_set_success): New prototype.
(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
(update_syscall_fault_exiting): Implement retval injection.
* strace.1: Update the section on fault injection.
* NEWS: Mention retval= option.
* linux/aarch64/set_error.c (arch_set_success): New function.
* linux/alpha/set_error.c: Likewise.
* linux/arc/set_error.c: Likewise.
* linux/arm/set_error.c: Likewise.
* linux/avr32/set_error.c: Likewise.
* linux/bfin/set_error.c: Likewise.
* linux/crisv10/set_error.c: Likewise.
* linux/hppa/set_error.c: Likewise.
* linux/i386/set_error.c: Likewise.
* linux/ia64/set_error.c: Likewise.
* linux/m68k/set_error.c: Likewise.
* linux/metag/set_error.c: Likewise.
* linux/microblaze/set_error.c: Likewise.
* linux/mips/set_error.c: Likewise.
* linux/nios2/set_error.c: Likewise.
* linux/or1k/set_error.c: Likewise.
* linux/powerpc/set_error.c: Likewise.
* linux/riscv/set_error.c: Likewise.
* linux/s390/set_error.c: Likewise.
* linux/sh/set_error.c: Likewise.
* linux/sh64/set_error.c: Likewise.
* linux/sparc/set_error.c: Likewise.
* linux/sparc64/set_error.c: Likewise.
* linux/tile/set_error.c: Likewise.
* linux/x86_64/set_error.c: Likewise.
* linux/xtensa/set_error.c: Likewise.

Closes: https://github.com/strace/strace/issues/3
2017-01-28 09:47:00 +00:00
..
arch_regs.c Cleanup print_pc 2015-11-30 03:30:51 +00:00
get_error.c alpha, ia64, mips, nios2, powerpc, sparc: always check for syscall error 2015-12-27 01:02:53 +00:00
get_scno.c cleanup: make get_scno.c files more readable 2015-11-30 01:46:52 +00:00
get_syscall_args.c cleanup: make get_syscall_args.c files more readable 2015-11-30 00:57:14 +00:00
ioctls_arch0.h Add support for Altera's Nios-II softcore architecture 2015-05-19 22:41:49 +00:00
ioctls_inc0.h Add support for Altera's Nios-II softcore architecture 2015-05-19 22:41:49 +00:00
set_error.c Implement success injection 2017-01-28 09:47:00 +00:00
set_scno.c Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t 2016-12-26 10:43:34 +00:00
syscallent.h Remove initialization of big holes in syscallent.h files 2016-04-29 21:51:00 +00:00