strace/linux/hppa/set_error.c

14 lines
227 B
C
Raw Normal View History

Implement arch specific methods of changing syscall number and error code This introduces arch_set_error and arch_set_scno functions for each supported architecture, needed to implement syscall fault injection. * linux/aarch64/set_error.c: New file. * linux/aarch64/set_scno.c: Likewise. * linux/alpha/set_error.c: Likewise. * linux/alpha/set_scno.c: Likewise. * linux/arc/set_error.c: Likewise. * linux/arc/set_scno.c: Likewise. * linux/arm/set_error.c: Likewise. * linux/arm/set_scno.c: Likewise. * linux/avr32/set_error.c: Likewise. * linux/avr32/set_scno.c: Likewise. * linux/bfin/set_error.c: Likewise. * linux/bfin/set_scno.c: Likewise. * linux/crisv10/set_error.c: Likewise. * linux/crisv10/set_scno.c: Likewise. * linux/crisv32/set_error.c: Likewise. * linux/crisv32/set_scno.c: Likewise. * linux/hppa/set_error.c: Likewise. * linux/hppa/set_scno.c: Likewise. * linux/i386/set_error.c: Likewise. * linux/i386/set_scno.c: Likewise. * linux/ia64/set_error.c: Likewise. * linux/ia64/set_scno.c: Likewise. * linux/m68k/set_error.c: Likewise. * linux/m68k/set_scno.c: Likewise. * linux/metag/set_error.c: Likewise. * linux/metag/set_scno.c: Likewise. * linux/microblaze/set_error.c: Likewise. * linux/microblaze/set_scno.c: Likewise. * linux/mips/set_error.c: Likewise. * linux/mips/set_scno.c: Likewise. * linux/nios2/set_error.c: Likewise. * linux/nios2/set_scno.c: Likewise. * linux/or1k/set_error.c: Likewise. * linux/or1k/set_scno.c: Likewise. * linux/powerpc/set_error.c: Likewise. * linux/powerpc/set_scno.c: Likewise. * linux/powerpc64/set_error.c: Likewise. * linux/powerpc64/set_scno.c: Likewise. * linux/riscv/set_error.c: Likewise. * linux/riscv/set_scno.c: Likewise. * linux/s390/set_error.c: Likewise. * linux/s390/set_scno.c: Likewise. * linux/s390x/set_error.c: Likewise. * linux/s390x/set_scno.c: Likewise. * linux/sh/set_error.c: Likewise. * linux/sh/set_scno.c: Likewise. * linux/sh64/set_error.c: Likewise. * linux/sh64/set_scno.c: Likewise. * linux/sparc/set_error.c: Likewise. * linux/sparc/set_scno.c: Likewise. * linux/sparc64/set_error.c: Likewise. * linux/sparc64/set_scno.c: Likewise. * linux/tile/set_error.c: Likewise. * linux/tile/set_scno.c: Likewise. * linux/x32/set_error.c: Likewise. * linux/x32/set_scno.c: Likewise. * linux/x86_64/set_error.c: Likewise. * linux/x86_64/set_scno.c: Likewise. * linux/xtensa/set_error.c: Likewise. * linux/xtensa/set_scno.c: Likewise. * Makefile.am (EXTRA_DIST): Add them.
2016-11-15 17:38:21 +00:00
static int
arch_set_error(struct tcb *tcp)
{
hppa_r28 = -tcp->u_error;
Change the first argument of upoke from pid to tcp Users were updated automatically by: for i in `git grep -l 'upoke(tcp->pid'`; do \ sed -i 's/upoke(tcp->pid/upoke(tcp/g' "$i"; \ done * upoke.c (upoke): Change the first argument from pid_t pid to struct tcb *tcp. Use tcp->pid instead of pid in the function's body. * defs.h (upoke): Update declaration. * linux/alpha/set_error.c (arch_set_error, arch_set_success): Provide tcp in the first argument of the upoke call instead of tcp->pid. * linux/alpha/set_scno.c (arch_set_scno): Likewise. * linux/bfin/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/bfin/set_scno.c (arch_set_scno): Likewise. * linux/crisv10/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/crisv10/set_scno.c (arch_set_scno): Likewise. * linux/hppa/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/hppa/set_scno.c (arch_set_scno): Likewise. * linux/i386/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/i386/set_scno.c (arch_set_scno): Likewise. * linux/microblaze/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/microblaze/set_scno.c (arch_set_scno): Likewise. * linux/powerpc/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/powerpc/set_scno.c (arch_set_scno): Likewise. * linux/sh/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/sh/set_scno.c (arch_set_scno): Likewise. * linux/sh64/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/sh64/set_scno.c (arch_set_scno): Likewise. * linux/x86_64/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/x86_64/set_scno.c (arch_set_scno): Likewise. * linux/xtensa/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/xtensa/set_scno.c (arch_set_scno): Likewise.
2017-12-25 23:45:04 +01:00
return upoke(tcp, PT_GR28, hppa_r28);
Implement arch specific methods of changing syscall number and error code This introduces arch_set_error and arch_set_scno functions for each supported architecture, needed to implement syscall fault injection. * linux/aarch64/set_error.c: New file. * linux/aarch64/set_scno.c: Likewise. * linux/alpha/set_error.c: Likewise. * linux/alpha/set_scno.c: Likewise. * linux/arc/set_error.c: Likewise. * linux/arc/set_scno.c: Likewise. * linux/arm/set_error.c: Likewise. * linux/arm/set_scno.c: Likewise. * linux/avr32/set_error.c: Likewise. * linux/avr32/set_scno.c: Likewise. * linux/bfin/set_error.c: Likewise. * linux/bfin/set_scno.c: Likewise. * linux/crisv10/set_error.c: Likewise. * linux/crisv10/set_scno.c: Likewise. * linux/crisv32/set_error.c: Likewise. * linux/crisv32/set_scno.c: Likewise. * linux/hppa/set_error.c: Likewise. * linux/hppa/set_scno.c: Likewise. * linux/i386/set_error.c: Likewise. * linux/i386/set_scno.c: Likewise. * linux/ia64/set_error.c: Likewise. * linux/ia64/set_scno.c: Likewise. * linux/m68k/set_error.c: Likewise. * linux/m68k/set_scno.c: Likewise. * linux/metag/set_error.c: Likewise. * linux/metag/set_scno.c: Likewise. * linux/microblaze/set_error.c: Likewise. * linux/microblaze/set_scno.c: Likewise. * linux/mips/set_error.c: Likewise. * linux/mips/set_scno.c: Likewise. * linux/nios2/set_error.c: Likewise. * linux/nios2/set_scno.c: Likewise. * linux/or1k/set_error.c: Likewise. * linux/or1k/set_scno.c: Likewise. * linux/powerpc/set_error.c: Likewise. * linux/powerpc/set_scno.c: Likewise. * linux/powerpc64/set_error.c: Likewise. * linux/powerpc64/set_scno.c: Likewise. * linux/riscv/set_error.c: Likewise. * linux/riscv/set_scno.c: Likewise. * linux/s390/set_error.c: Likewise. * linux/s390/set_scno.c: Likewise. * linux/s390x/set_error.c: Likewise. * linux/s390x/set_scno.c: Likewise. * linux/sh/set_error.c: Likewise. * linux/sh/set_scno.c: Likewise. * linux/sh64/set_error.c: Likewise. * linux/sh64/set_scno.c: Likewise. * linux/sparc/set_error.c: Likewise. * linux/sparc/set_scno.c: Likewise. * linux/sparc64/set_error.c: Likewise. * linux/sparc64/set_scno.c: Likewise. * linux/tile/set_error.c: Likewise. * linux/tile/set_scno.c: Likewise. * linux/x32/set_error.c: Likewise. * linux/x32/set_scno.c: Likewise. * linux/x86_64/set_error.c: Likewise. * linux/x86_64/set_scno.c: Likewise. * linux/xtensa/set_error.c: Likewise. * linux/xtensa/set_scno.c: Likewise. * Makefile.am (EXTRA_DIST): Add them.
2016-11-15 17:38:21 +00:00
}
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-25 02:59:16 +03:00
static int
arch_set_success(struct tcb *tcp)
{
hppa_r28 = tcp->u_rval;
Change the first argument of upoke from pid to tcp Users were updated automatically by: for i in `git grep -l 'upoke(tcp->pid'`; do \ sed -i 's/upoke(tcp->pid/upoke(tcp/g' "$i"; \ done * upoke.c (upoke): Change the first argument from pid_t pid to struct tcb *tcp. Use tcp->pid instead of pid in the function's body. * defs.h (upoke): Update declaration. * linux/alpha/set_error.c (arch_set_error, arch_set_success): Provide tcp in the first argument of the upoke call instead of tcp->pid. * linux/alpha/set_scno.c (arch_set_scno): Likewise. * linux/bfin/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/bfin/set_scno.c (arch_set_scno): Likewise. * linux/crisv10/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/crisv10/set_scno.c (arch_set_scno): Likewise. * linux/hppa/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/hppa/set_scno.c (arch_set_scno): Likewise. * linux/i386/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/i386/set_scno.c (arch_set_scno): Likewise. * linux/microblaze/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/microblaze/set_scno.c (arch_set_scno): Likewise. * linux/powerpc/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/powerpc/set_scno.c (arch_set_scno): Likewise. * linux/sh/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/sh/set_scno.c (arch_set_scno): Likewise. * linux/sh64/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/sh64/set_scno.c (arch_set_scno): Likewise. * linux/x86_64/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/x86_64/set_scno.c (arch_set_scno): Likewise. * linux/xtensa/set_error.c (arch_set_error, arch_set_success): Likewise. * linux/xtensa/set_scno.c (arch_set_scno): Likewise.
2017-12-25 23:45:04 +01:00
return upoke(tcp, PT_GR28, hppa_r28);
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-25 02:59:16 +03:00
}