diff options
Diffstat (limited to 'arch/x86/lib/error-inject.c')
-rw-r--r-- | arch/x86/lib/error-inject.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/lib/error-inject.c b/arch/x86/lib/error-inject.c new file mode 100644 index 000000000000..7b881d03d0dd --- /dev/null +++ b/arch/x86/lib/error-inject.c | |||
@@ -0,0 +1,19 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | |||
3 | #include <linux/error-injection.h> | ||
4 | #include <linux/kprobes.h> | ||
5 | |||
6 | asmlinkage void just_return_func(void); | ||
7 | |||
8 | asm( | ||
9 | ".type just_return_func, @function\n" | ||
10 | "just_return_func:\n" | ||
11 | " ret\n" | ||
12 | ".size just_return_func, .-just_return_func\n" | ||
13 | ); | ||
14 | |||
15 | void override_function_with_return(struct pt_regs *regs) | ||
16 | { | ||
17 | regs->ip = (unsigned long)&just_return_func; | ||
18 | } | ||
19 | NOKPROBE_SYMBOL(override_function_with_return); | ||