blob: 520897061ee09e1fe549c44b957ca6d1a1acc111 [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001// SPDX-License-Identifier: GPL-2.0
2
Olivier Deprez92d4c212022-12-06 15:05:30 +01003#include <linux/linkage.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004#include <linux/error-injection.h>
5#include <linux/kprobes.h>
6
7asmlinkage void just_return_func(void);
8
9asm(
David Brazdil0f672f62019-12-10 10:32:29 +000010 ".text\n"
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011 ".type just_return_func, @function\n"
12 ".globl just_return_func\n"
13 "just_return_func:\n"
Olivier Deprez92d4c212022-12-06 15:05:30 +010014 ASM_RET
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000015 ".size just_return_func, .-just_return_func\n"
16);
17
18void override_function_with_return(struct pt_regs *regs)
19{
20 regs->ip = (unsigned long)&just_return_func;
21}
22NOKPROBE_SYMBOL(override_function_with_return);