strace/linux/riscv
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 Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
errnoent1.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
get_error.c Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
get_scno.c Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
get_syscall_args.c Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
ioctls_arch0.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
ioctls_arch1.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
ioctls_inc0.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
ioctls_inc1.h Add RISC-V architecture support 2016-08-21 22:03:05 +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
signalent1.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
syscallent1.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00
syscallent.h Add RISC-V architecture support 2016-08-21 22:03:05 +00:00