18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#include <linux/error-injection.h>
48c2ecf20Sopenharmony_ci#include <linux/kprobes.h>
58c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_civoid override_function_with_return(struct pt_regs *regs)
88c2ecf20Sopenharmony_ci{
98c2ecf20Sopenharmony_ci	/*
108c2ecf20Sopenharmony_ci	 * Emulate 'blr'. 'regs' represents the state on entry of a predefined
118c2ecf20Sopenharmony_ci	 * function in the kernel/module, captured on a kprobe. We don't need
128c2ecf20Sopenharmony_ci	 * to worry about 32-bit userspace on a 64-bit kernel.
138c2ecf20Sopenharmony_ci	 */
148c2ecf20Sopenharmony_ci	regs->nip = regs->link;
158c2ecf20Sopenharmony_ci}
168c2ecf20Sopenharmony_ciNOKPROBE_SYMBOL(override_function_with_return);
17