Implement signal injection
authorSeraphime Kirkovski <kirkseraph@gmail.com>
Tue, 27 Dec 2016 11:14:06 +0000 (12:14 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 28 Dec 2016 18:33:28 +0000 (18:33 +0000)
commita864a32a76a5adf29f8d728ba8c69b47b5daa902
tree845b35df383e782e8c660d323279755935222dce
parent22894ccff6f967a5a5d5f6efcadec226aa438dd4
Implement signal injection

This extends the fault injection capability with :signal=SIG option
which injects a signal on entering each syscall from the specified set.

:signal and :error options are complementary, if they are both specified
the syscall will be fault injected as usual and the specified signal
will be delivered to the tracee.

* defs.h (struct fault_opts): Change the type of err field to int16_t,
add signo field.
(trace_syscall): Add a pointer argument.
* qualify.c: Include "nsig.h".
(parse_fault_token): Handle signal= option.
(qualify_fault): Update default fault_opts.
* strace.c (trace): Forward signal number from trace_syscall
to ptrace_restart(PTRACE_SYSCALL).
* syscall.c (inject_syscall_fault_entering): Add pointer argument,
save there the signal number specified by fault options.  Do not inject
a syscall fault unless instructed by fault options.
(update_syscall_fault_exiting): Update the error code injection check.
(trace_syscall_entering): Add pointer argument, forward it to
inject_syscall_fault_entering.
(trace_syscall): Add pointer argument, forward it to
trace_syscall_entering.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
defs.h
qualify.c
strace.c
syscall.c