-
Inspired by the commit 42d038c4fb00 ("arm64: Add support for function
error injection"), this patch supports function error injection for
csky.This patch mainly support two functions: one is regs_set_return_value()
which is used to overwrite the return value; the another function is
override_function_with_return() which is to override the probed
function returning and jump to its caller.Test log:
cd /sys/kernel/debug/fail_function/
echo sys_clone > inject
echo 100 > probability
echo 1 > interval
ls /
[ 108.644163] FAULT_INJECTION: forcing a failure.
[ 108.644163] name fail_function, interval 1, probability 100, space 0, times 1
[ 108.647799] CPU: 0 PID: 104 Comm: sh Not tainted 5.8.0-rc5+ #46
[ 108.648384] Call Trace:
[ 108.649339] [] walk_stackframe+0x0/0xf0
[ 108.649679] [] show_stack+0x32/0x5c
[ 108.649927] [] dump_stack+0x6e/0x9c
[ 108.650271] [] should_fail+0x15e/0x1ac
[ 108.650720] [] fei_kprobe_handler+0x28/0x5c
[ 108.651519] [] kprobe_breakpoint_handler+0x144/0x1cc
[ 108.652289] [] trap_c+0x8e/0x110
[ 108.652816] [] csky_trap+0x5c/0x70
-sh: can't fork: Invalid argumentSigned-off-by: Guo Ren
Cc: Arnd Bergmann