cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

error-inject.c (563B)


      1// SPDX-License-Identifier: GPL-2.0
      2
      3#include <linux/error-injection.h>
      4#include <linux/kprobes.h>
      5
      6void override_function_with_return(struct pt_regs *regs)
      7{
      8	/*
      9	 * 'regs' represents the state on entry of a predefined function in
     10	 * the kernel/module and which is captured on a kprobe.
     11	 *
     12	 * When kprobe returns back from exception it will override the end
     13	 * of probed function and directly return to the predefined
     14	 * function's caller.
     15	 */
     16	instruction_pointer_set(regs, procedure_link_pointer(regs));
     17}
     18NOKPROBE_SYMBOL(override_function_with_return);