As same as kretprobe_trampoline, move the optprobe template code in the text for making ORC information on that. Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> --- arch/x86/kernel/kprobes/opt.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index 4299fc865732..6d26e5cf2ba2 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -100,9 +100,13 @@ static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val) *(unsigned long *)addr = val; } +static void +optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs); + asm ( - ".pushsection .rodata\n" + ".text\n" "optprobe_template_func:\n" + ".type optprobe_template_func, @function\n" ".global optprobe_template_entry\n" "optprobe_template_entry:\n" #ifdef CONFIG_X86_64 @@ -120,7 +124,8 @@ asm ( ASM_NOP5 ".global optprobe_template_call\n" "optprobe_template_call:\n" - ASM_NOP5 + /* Dummy call for ORC */ + " callq optimized_callback\n" /* Move flags to rsp */ " movq 18*8(%rsp), %rdx\n" " movq %rdx, 19*8(%rsp)\n" @@ -141,7 +146,8 @@ asm ( ASM_NOP5 ".global optprobe_template_call\n" "optprobe_template_call:\n" - ASM_NOP5 + /* Dummy call for ORC */ + " call optimized_callback\n" /* Move flags into esp */ " movl 14*4(%esp), %edx\n" " movl %edx, 15*4(%esp)\n" @@ -152,10 +158,12 @@ asm ( #endif ".global optprobe_template_end\n" "optprobe_template_end:\n" - ".popsection\n"); + /* Dummy return for objtool */ + " ret\n" + ".size optprobe_template_func, .-optprobe_template_func\n" +); void optprobe_template_func(void); -STACK_FRAME_NON_STANDARD(optprobe_template_func); #define TMPL_CLAC_IDX \ ((long)optprobe_template_clac - (long)optprobe_template_entry)