blob: 407b992fb02fd5fff78db6f590e3462963beb2cd [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0+
2
3#include <linux/error-injection.h>
4#include <linux/kprobes.h>
5#include <linux/uaccess.h>
6
7void override_function_with_return(struct pt_regs *regs)
8{
9 /*
10 * Emulate 'blr'. 'regs' represents the state on entry of a predefined
11 * function in the kernel/module, captured on a kprobe. We don't need
12 * to worry about 32-bit userspace on a 64-bit kernel.
13 */
14 regs->nip = regs->link;
15}
16NOKPROBE_SYMBOL(override_function_with_return);