Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/linkage.h>
4#include <linux/error-injection.h>
5#include <linux/kprobes.h>
6#include <linux/objtool.h>
7
8asmlinkage void just_return_func(void);
9
10asm(
11 ".text\n"
12 ".type just_return_func, @function\n"
13 ".globl just_return_func\n"
14 "just_return_func:\n"
15 ANNOTATE_NOENDBR
16 ASM_RET
17 ".size just_return_func, .-just_return_func\n"
18);
19
20void override_function_with_return(struct pt_regs *regs)
21{
22 regs->ip = (unsigned long)&just_return_func;
23}
24NOKPROBE_SYMBOL(override_function_with_return);