0001
0002
0003 #include <linux/linkage.h>
0004 #include <linux/error-injection.h>
0005 #include <linux/kprobes.h>
0006 #include <linux/objtool.h>
0007
0008 asmlinkage void just_return_func(void);
0009
0010 asm(
0011 ".text\n"
0012 ".type just_return_func, @function\n"
0013 ".globl just_return_func\n"
0014 "just_return_func:\n"
0015 ANNOTATE_NOENDBR
0016 ASM_RET
0017 ".size just_return_func, .-just_return_func\n"
0018 );
0019
0020 void override_function_with_return(struct pt_regs *regs)
0021 {
0022 regs->ip = (unsigned long)&just_return_func;
0023 }
0024 NOKPROBE_SYMBOL(override_function_with_return);