<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/csky/lib/error-inject.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/csky/lib/error-inject.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/csky/lib/error-inject.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2020-07-31T01:52:07Z</updated>
<entry>
<title>csky: Add support for function error injection</title>
<updated>2020-07-31T01:52:07Z</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-07-28T16:30:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=71e193d7cbcfc988c3802e15261bd807171adb6b'/>
<id>urn:sha1:71e193d7cbcfc988c3802e15261bd807171adb6b</id>
<content type='text'>
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 &gt; inject
 echo 100 &gt; probability
 echo 1 &gt; 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] [&lt;8005eed4&gt;] walk_stackframe+0x0/0xf0
[  108.649679] [&lt;8005f16a&gt;] show_stack+0x32/0x5c
[  108.649927] [&lt;8040f9d2&gt;] dump_stack+0x6e/0x9c
[  108.650271] [&lt;80406f7e&gt;] should_fail+0x15e/0x1ac
[  108.650720] [&lt;80118ba8&gt;] fei_kprobe_handler+0x28/0x5c
[  108.651519] [&lt;80754110&gt;] kprobe_breakpoint_handler+0x144/0x1cc
[  108.652289] [&lt;8005d6da&gt;] trap_c+0x8e/0x110
[  108.652816] [&lt;8005ce8c&gt;] csky_trap+0x5c/0x70
-sh: can't fork: Invalid argument

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
</content>
</entry>
</feed>
