blob: be5b5fb1598bd81cbfa9fd3b05944a7804e22ee9 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001// 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(
David Brazdil0f672f62019-12-10 10:32:29 +00009 ".text\n"
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010 ".type just_return_func, @function\n"
11 ".globl just_return_func\n"
12 "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);