Masami Hiramatsu | 540adea | 2018-01-13 02:55:03 +0900 | [diff] [blame] | 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( |
Andi Kleen | c03e275 | 2019-03-29 17:47:35 -0700 | [diff] [blame] | 9 | ".text\n" |
Masami Hiramatsu | 540adea | 2018-01-13 02:55:03 +0900 | [diff] [blame] | 10 | ".type just_return_func, @function\n" |
Arnd Bergmann | 01684e7 | 2018-02-02 15:56:19 +0100 | [diff] [blame] | 11 | ".globl just_return_func\n" |
Masami Hiramatsu | 540adea | 2018-01-13 02:55:03 +0900 | [diff] [blame] | 12 | "just_return_func:\n" |
| 13 | " ret\n" |
| 14 | ".size just_return_func, .-just_return_func\n" |
| 15 | ); |
| 16 | |
| 17 | void override_function_with_return(struct pt_regs *regs) |
| 18 | { |
| 19 | regs->ip = (unsigned long)&just_return_func; |
| 20 | } |
| 21 | NOKPROBE_SYMBOL(override_function_with_return); |