error-inject.c 484 B

12345678910111213141516
  1. // SPDX-License-Identifier: GPL-2.0+
  2. #include <linux/error-injection.h>
  3. #include <linux/kprobes.h>
  4. #include <linux/uaccess.h>
  5. void override_function_with_return(struct pt_regs *regs)
  6. {
  7. /*
  8. * Emulate 'blr'. 'regs' represents the state on entry of a predefined
  9. * function in the kernel/module, captured on a kprobe. We don't need
  10. * to worry about 32-bit userspace on a 64-bit kernel.
  11. */
  12. regs_set_return_ip(regs, regs->link);
  13. }
  14. NOKPROBE_SYMBOL(override_function_with_return);