#include <linux/kprobes.h>
#include <linux/perf_event.h>
#include <linux/ptrace.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/hardirq.h>
#include <linux/preempt.h>
#include <linux/extable.h>
#include <linux/kdebug.h>
#include <linux/kallsyms.h>
#include <linux/kgdb.h>
#include <linux/ftrace.h>
#include <linux/objtool.h>
#include <linux/pgtable.h>
#include <linux/static_call.h>
#include <asm/text-patching.h>
#include <asm/cacheflush.h>
#include <asm/desc.h>
#include <linux/uaccess.h>
#include <asm/alternative.h>
#include <asm/insn.h>
#include <asm/debugreg.h>
#include <asm/set_memory.h>
#include <asm/sections.h>
#include <asm/nospec-branch.h>
#include "common.h"
unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsigned long addr)
{ … }
static void synthesize_clac(kprobe_opcode_t *addr)
{ … }
static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val)
{ … }
asm …;
void optprobe_template_func(void);
STACK_FRAME_NON_STANDARD(…);
#define TMPL_CLAC_IDX …
#define TMPL_MOVE_IDX …
#define TMPL_CALL_IDX …
#define TMPL_END_IDX …
static void
optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
{ … }
NOKPROBE_SYMBOL(optimized_callback);
static int copy_optimized_instructions(u8 *dest, u8 *src, u8 *real)
{ … }
static int insn_is_indirect_jump(struct insn *insn)
{ … }
static int insn_jump_into_range(struct insn *insn, unsigned long start, int len)
{ … }
static int can_optimize(unsigned long paddr)
{ … }
int arch_check_optimized_kprobe(struct optimized_kprobe *op)
{ … }
int arch_within_optimized_kprobe(struct optimized_kprobe *op,
kprobe_opcode_t *addr)
{ … }
static
void __arch_remove_optimized_kprobe(struct optimized_kprobe *op, int dirty)
{ … }
void arch_remove_optimized_kprobe(struct optimized_kprobe *op)
{ … }
int arch_prepare_optimized_kprobe(struct optimized_kprobe *op,
struct kprobe *__unused)
{ … }
void arch_optimize_kprobes(struct list_head *oplist)
{ … }
void arch_unoptimize_kprobe(struct optimized_kprobe *op)
{ … }
extern void arch_unoptimize_kprobes(struct list_head *oplist,
struct list_head *done_list)
{ … }
int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
{ … }
NOKPROBE_SYMBOL(setup_detour_execution);