162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci#include <linux/error-injection.h>
462306a36Sopenharmony_ci#include <linux/kprobes.h>
562306a36Sopenharmony_ci#include <linux/uaccess.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_civoid override_function_with_return(struct pt_regs *regs)
862306a36Sopenharmony_ci{
962306a36Sopenharmony_ci	/*
1062306a36Sopenharmony_ci	 * Emulate 'blr'. 'regs' represents the state on entry of a predefined
1162306a36Sopenharmony_ci	 * function in the kernel/module, captured on a kprobe. We don't need
1262306a36Sopenharmony_ci	 * to worry about 32-bit userspace on a 64-bit kernel.
1362306a36Sopenharmony_ci	 */
1462306a36Sopenharmony_ci	regs_set_return_ip(regs, regs->link);
1562306a36Sopenharmony_ci}
1662306a36Sopenharmony_ciNOKPROBE_SYMBOL(override_function_with_return);
17