blob: be5b5fb1598bd81cbfa9fd3b05944a7804e22ee9 [file] [log] [blame]
Masami Hiramatsu540adea2018-01-13 02:55:03 +09001// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/error-injection.h>
4#include <linux/kprobes.h>
5
6asmlinkage void just_return_func(void);
7
8asm(
Andi Kleenc03e2752019-03-29 17:47:35 -07009 ".text\n"
Masami Hiramatsu540adea2018-01-13 02:55:03 +090010 ".type just_return_func, @function\n"
Arnd Bergmann01684e72018-02-02 15:56:19 +010011 ".globl just_return_func\n"
Masami Hiramatsu540adea2018-01-13 02:55:03 +090012 "just_return_func:\n"
13 " ret\n"
14 ".size just_return_func, .-just_return_func\n"
15);
16
17void override_function_with_return(struct pt_regs *regs)
18{
19 regs->ip = (unsigned long)&just_return_func;
20}
21NOKPROBE_SYMBOL(override_function_with_return);