Commit adf8a61a authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Steven Rostedt (VMware)

kprobes: treewide: Make it harder to refer kretprobe_trampoline directly

Since now there is kretprobe_trampoline_addr() for referring the
address of kretprobe trampoline code, we don't need to access
kretprobe_trampoline directly.

Make it harder to refer by renaming it to __kretprobe_trampoline().

Link: https://lkml.kernel.org/r/163163045446.489837.14510577516938803097.stgit@devnote2Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 96fed8ac
...@@ -46,7 +46,7 @@ struct kprobe_ctlblk { ...@@ -46,7 +46,7 @@ struct kprobe_ctlblk {
}; };
int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause); int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
void trap_is_kprobe(unsigned long address, struct pt_regs *regs); void trap_is_kprobe(unsigned long address, struct pt_regs *regs);
#else #else
#define trap_is_kprobe(address, regs) #define trap_is_kprobe(address, regs)
......
...@@ -363,8 +363,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, ...@@ -363,8 +363,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
static void __used kretprobe_trampoline_holder(void) static void __used kretprobe_trampoline_holder(void)
{ {
__asm__ __volatile__(".global kretprobe_trampoline\n" __asm__ __volatile__(".global __kretprobe_trampoline\n"
"kretprobe_trampoline:\n" "nop\n"); "__kretprobe_trampoline:\n"
"nop\n");
} }
void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
...@@ -375,7 +376,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -375,7 +376,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = NULL; ri->fp = NULL;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->blink = (unsigned long)&kretprobe_trampoline; regs->blink = (unsigned long)&__kretprobe_trampoline;
} }
static int __kprobes trampoline_probe_handler(struct kprobe *p, static int __kprobes trampoline_probe_handler(struct kprobe *p,
...@@ -390,7 +391,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, ...@@ -390,7 +391,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
} }
static struct kprobe trampoline_p = { static struct kprobe trampoline_p = {
.addr = (kprobe_opcode_t *) &kretprobe_trampoline, .addr = (kprobe_opcode_t *) &__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler .pre_handler = trampoline_probe_handler
}; };
...@@ -402,7 +403,7 @@ int __init arch_init_kprobes(void) ...@@ -402,7 +403,7 @@ int __init arch_init_kprobes(void)
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{ {
if (p->addr == (kprobe_opcode_t *) &kretprobe_trampoline) if (p->addr == (kprobe_opcode_t *) &__kretprobe_trampoline)
return 1; return 1;
return 0; return 0;
......
...@@ -373,7 +373,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, ...@@ -373,7 +373,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
* for kretprobe handlers which should normally be interested in r0 only * for kretprobe handlers which should normally be interested in r0 only
* anyway. * anyway.
*/ */
void __naked __kprobes kretprobe_trampoline(void) void __naked __kprobes __kretprobe_trampoline(void)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"stmdb sp!, {r0 - r11} \n\t" "stmdb sp!, {r0 - r11} \n\t"
...@@ -389,7 +389,7 @@ void __naked __kprobes kretprobe_trampoline(void) ...@@ -389,7 +389,7 @@ void __naked __kprobes kretprobe_trampoline(void)
: : : "memory"); : : : "memory");
} }
/* Called from kretprobe_trampoline */ /* Called from __kretprobe_trampoline */
static __used __kprobes void *trampoline_handler(struct pt_regs *regs) static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
{ {
return (void *)kretprobe_trampoline_handler(regs, (void *)regs->ARM_fp); return (void *)kretprobe_trampoline_handler(regs, (void *)regs->ARM_fp);
...@@ -402,7 +402,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -402,7 +402,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = (void *)regs->ARM_fp; ri->fp = (void *)regs->ARM_fp;
/* Replace the return addr with trampoline addr. */ /* Replace the return addr with trampoline addr. */
regs->ARM_lr = (unsigned long)&kretprobe_trampoline; regs->ARM_lr = (unsigned long)&__kretprobe_trampoline;
} }
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
......
...@@ -39,7 +39,7 @@ void arch_remove_kprobe(struct kprobe *); ...@@ -39,7 +39,7 @@ void arch_remove_kprobe(struct kprobe *);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr); int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
int kprobe_exceptions_notify(struct notifier_block *self, int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data); unsigned long val, void *data);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
void __kprobes *trampoline_probe_handler(struct pt_regs *regs); void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
#endif /* CONFIG_KPROBES */ #endif /* CONFIG_KPROBES */
......
...@@ -411,7 +411,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -411,7 +411,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = (void *)kernel_stack_pointer(regs); ri->fp = (void *)kernel_stack_pointer(regs);
/* replace return addr (x30) with trampoline */ /* replace return addr (x30) with trampoline */
regs->regs[30] = (long)&kretprobe_trampoline; regs->regs[30] = (long)&__kretprobe_trampoline;
} }
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
ldp x28, x29, [sp, #S_X28] ldp x28, x29, [sp, #S_X28]
.endm .endm
SYM_CODE_START(kretprobe_trampoline) SYM_CODE_START(__kretprobe_trampoline)
sub sp, sp, #PT_REGS_SIZE sub sp, sp, #PT_REGS_SIZE
save_all_base_regs save_all_base_regs
...@@ -79,4 +79,4 @@ SYM_CODE_START(kretprobe_trampoline) ...@@ -79,4 +79,4 @@ SYM_CODE_START(kretprobe_trampoline)
add sp, sp, #PT_REGS_SIZE add sp, sp, #PT_REGS_SIZE
ret ret
SYM_CODE_END(kretprobe_trampoline) SYM_CODE_END(__kretprobe_trampoline)
...@@ -41,7 +41,7 @@ void arch_remove_kprobe(struct kprobe *p); ...@@ -41,7 +41,7 @@ void arch_remove_kprobe(struct kprobe *p);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr); int kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr);
int kprobe_breakpoint_handler(struct pt_regs *regs); int kprobe_breakpoint_handler(struct pt_regs *regs);
int kprobe_single_step_handler(struct pt_regs *regs); int kprobe_single_step_handler(struct pt_regs *regs);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
void __kprobes *trampoline_probe_handler(struct pt_regs *regs); void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
#endif /* CONFIG_KPROBES */ #endif /* CONFIG_KPROBES */
......
...@@ -394,7 +394,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -394,7 +394,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
{ {
ri->ret_addr = (kprobe_opcode_t *)regs->lr; ri->ret_addr = (kprobe_opcode_t *)regs->lr;
ri->fp = NULL; ri->fp = NULL;
regs->lr = (unsigned long) &kretprobe_trampoline; regs->lr = (unsigned long) &__kretprobe_trampoline;
} }
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <abi/entry.h> #include <abi/entry.h>
ENTRY(kretprobe_trampoline) ENTRY(__kretprobe_trampoline)
SAVE_REGS_FTRACE SAVE_REGS_FTRACE
mov a0, sp /* pt_regs */ mov a0, sp /* pt_regs */
...@@ -16,4 +16,4 @@ ENTRY(kretprobe_trampoline) ...@@ -16,4 +16,4 @@ ENTRY(kretprobe_trampoline)
RESTORE_REGS_FTRACE RESTORE_REGS_FTRACE
rts rts
ENDPROC(kretprobe_trampoline) ENDPROC(__kretprobe_trampoline)
...@@ -392,7 +392,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, ...@@ -392,7 +392,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p,
__this_cpu_write(current_kprobe, p); __this_cpu_write(current_kprobe, p);
} }
void kretprobe_trampoline(void) void __kretprobe_trampoline(void)
{ {
} }
...@@ -414,7 +414,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -414,7 +414,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = NULL; ri->fp = NULL;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline); regs->b0 = (unsigned long)dereference_function_descriptor(__kretprobe_trampoline);
} }
/* Check the instruction in the slot is break */ /* Check the instruction in the slot is break */
...@@ -897,14 +897,14 @@ static struct kprobe trampoline_p = { ...@@ -897,14 +897,14 @@ static struct kprobe trampoline_p = {
int __init arch_init_kprobes(void) int __init arch_init_kprobes(void)
{ {
trampoline_p.addr = trampoline_p.addr =
dereference_function_descriptor(kretprobe_trampoline); dereference_function_descriptor(__kretprobe_trampoline);
return register_kprobe(&trampoline_p); return register_kprobe(&trampoline_p);
} }
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{ {
if (p->addr == if (p->addr ==
dereference_function_descriptor(kretprobe_trampoline)) dereference_function_descriptor(__kretprobe_trampoline))
return 1; return 1;
return 0; return 0;
......
...@@ -460,14 +460,14 @@ static void __used kretprobe_trampoline_holder(void) ...@@ -460,14 +460,14 @@ static void __used kretprobe_trampoline_holder(void)
/* Keep the assembler from reordering and placing JR here. */ /* Keep the assembler from reordering and placing JR here. */
".set noreorder\n\t" ".set noreorder\n\t"
"nop\n\t" "nop\n\t"
".global kretprobe_trampoline\n" ".global __kretprobe_trampoline\n"
"kretprobe_trampoline:\n\t" "__kretprobe_trampoline:\n\t"
"nop\n\t" "nop\n\t"
".set pop" ".set pop"
: : : "memory"); : : : "memory");
} }
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
struct pt_regs *regs) struct pt_regs *regs)
...@@ -476,7 +476,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -476,7 +476,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = NULL; ri->fp = NULL;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->regs[31] = (unsigned long)kretprobe_trampoline; regs->regs[31] = (unsigned long)__kretprobe_trampoline;
} }
/* /*
...@@ -496,14 +496,14 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, ...@@ -496,14 +496,14 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{ {
if (p->addr == (kprobe_opcode_t *)kretprobe_trampoline) if (p->addr == (kprobe_opcode_t *)__kretprobe_trampoline)
return 1; return 1;
return 0; return 0;
} }
static struct kprobe trampoline_p = { static struct kprobe trampoline_p = {
.addr = (kprobe_opcode_t *)kretprobe_trampoline, .addr = (kprobe_opcode_t *)__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler .pre_handler = trampoline_probe_handler
}; };
......
...@@ -175,7 +175,7 @@ int __kprobes parisc_kprobe_ss_handler(struct pt_regs *regs) ...@@ -175,7 +175,7 @@ int __kprobes parisc_kprobe_ss_handler(struct pt_regs *regs)
return 1; return 1;
} }
void kretprobe_trampoline(void) void __kretprobe_trampoline(void)
{ {
asm volatile("nop"); asm volatile("nop");
asm volatile("nop"); asm volatile("nop");
...@@ -217,6 +217,6 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p) ...@@ -217,6 +217,6 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p)
int __init arch_init_kprobes(void) int __init arch_init_kprobes(void)
{ {
trampoline_p.addr = (kprobe_opcode_t *) trampoline_p.addr = (kprobe_opcode_t *)
dereference_function_descriptor(kretprobe_trampoline); dereference_function_descriptor(__kretprobe_trampoline);
return register_kprobe(&trampoline_p); return register_kprobe(&trampoline_p);
} }
...@@ -51,7 +51,7 @@ extern kprobe_opcode_t optprobe_template_end[]; ...@@ -51,7 +51,7 @@ extern kprobe_opcode_t optprobe_template_end[];
#define flush_insn_slot(p) do { } while (0) #define flush_insn_slot(p) do { } while (0)
#define kretprobe_blacklist_size 0 #define kretprobe_blacklist_size 0
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
extern void arch_remove_kprobe(struct kprobe *p); extern void arch_remove_kprobe(struct kprobe *p);
/* Architecture specific copy of original instruction */ /* Architecture specific copy of original instruction */
......
...@@ -237,7 +237,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) ...@@ -237,7 +237,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs)
ri->fp = NULL; ri->fp = NULL;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->link = (unsigned long)kretprobe_trampoline; regs->link = (unsigned long)__kretprobe_trampoline;
} }
NOKPROBE_SYMBOL(arch_prepare_kretprobe); NOKPROBE_SYMBOL(arch_prepare_kretprobe);
...@@ -403,12 +403,12 @@ NOKPROBE_SYMBOL(kprobe_handler); ...@@ -403,12 +403,12 @@ NOKPROBE_SYMBOL(kprobe_handler);
* - When the probed function returns, this probe * - When the probed function returns, this probe
* causes the handlers to fire * causes the handlers to fire
*/ */
asm(".global kretprobe_trampoline\n" asm(".global __kretprobe_trampoline\n"
".type kretprobe_trampoline, @function\n" ".type __kretprobe_trampoline, @function\n"
"kretprobe_trampoline:\n" "__kretprobe_trampoline:\n"
"nop\n" "nop\n"
"blr\n" "blr\n"
".size kretprobe_trampoline, .-kretprobe_trampoline\n"); ".size __kretprobe_trampoline, .-__kretprobe_trampoline\n");
/* /*
* Called when the probe at kretprobe trampoline is hit * Called when the probe at kretprobe trampoline is hit
...@@ -427,7 +427,7 @@ static int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) ...@@ -427,7 +427,7 @@ static int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
* as it is used to determine the return address from the trap. * as it is used to determine the return address from the trap.
* For (2), since nip is not honoured with optprobes, we instead setup * For (2), since nip is not honoured with optprobes, we instead setup
* the link register properly so that the subsequent 'blr' in * the link register properly so that the subsequent 'blr' in
* kretprobe_trampoline jumps back to the right instruction. * __kretprobe_trampoline jumps back to the right instruction.
* *
* For nip, we should set the address to the previous instruction since * For nip, we should set the address to the previous instruction since
* we end up emulating it in kprobe_handler(), which increments the nip * we end up emulating it in kprobe_handler(), which increments the nip
...@@ -543,7 +543,7 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr) ...@@ -543,7 +543,7 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
NOKPROBE_SYMBOL(kprobe_fault_handler); NOKPROBE_SYMBOL(kprobe_fault_handler);
static struct kprobe trampoline_p = { static struct kprobe trampoline_p = {
.addr = (kprobe_opcode_t *) &kretprobe_trampoline, .addr = (kprobe_opcode_t *) &__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler .pre_handler = trampoline_probe_handler
}; };
...@@ -554,7 +554,7 @@ int __init arch_init_kprobes(void) ...@@ -554,7 +554,7 @@ int __init arch_init_kprobes(void)
int arch_trampoline_kprobe(struct kprobe *p) int arch_trampoline_kprobe(struct kprobe *p)
{ {
if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) if (p->addr == (kprobe_opcode_t *)&__kretprobe_trampoline)
return 1; return 1;
return 0; return 0;
......
...@@ -56,7 +56,7 @@ static unsigned long can_optimize(struct kprobe *p) ...@@ -56,7 +56,7 @@ static unsigned long can_optimize(struct kprobe *p)
* has a 'nop' instruction, which can be emulated. * has a 'nop' instruction, which can be emulated.
* So further checks can be skipped. * So further checks can be skipped.
*/ */
if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) if (p->addr == (kprobe_opcode_t *)&__kretprobe_trampoline)
return addr + sizeof(kprobe_opcode_t); return addr + sizeof(kprobe_opcode_t);
/* /*
......
...@@ -155,7 +155,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum ...@@ -155,7 +155,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
* Mark stacktraces with kretprobed functions on them * Mark stacktraces with kretprobed functions on them
* as unreliable. * as unreliable.
*/ */
if (ip == (unsigned long)kretprobe_trampoline) if (ip == (unsigned long)__kretprobe_trampoline)
return -EINVAL; return -EINVAL;
#endif #endif
......
...@@ -40,7 +40,7 @@ void arch_remove_kprobe(struct kprobe *p); ...@@ -40,7 +40,7 @@ void arch_remove_kprobe(struct kprobe *p);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr); int kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr);
bool kprobe_breakpoint_handler(struct pt_regs *regs); bool kprobe_breakpoint_handler(struct pt_regs *regs);
bool kprobe_single_step_handler(struct pt_regs *regs); bool kprobe_single_step_handler(struct pt_regs *regs);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
void __kprobes *trampoline_probe_handler(struct pt_regs *regs); void __kprobes *trampoline_probe_handler(struct pt_regs *regs);
#endif /* CONFIG_KPROBES */ #endif /* CONFIG_KPROBES */
......
...@@ -355,7 +355,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -355,7 +355,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
{ {
ri->ret_addr = (kprobe_opcode_t *)regs->ra; ri->ret_addr = (kprobe_opcode_t *)regs->ra;
ri->fp = NULL; ri->fp = NULL;
regs->ra = (unsigned long) &kretprobe_trampoline; regs->ra = (unsigned long) &__kretprobe_trampoline;
} }
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
REG_L x31, PT_T6(sp) REG_L x31, PT_T6(sp)
.endm .endm
ENTRY(kretprobe_trampoline) ENTRY(__kretprobe_trampoline)
addi sp, sp, -(PT_SIZE_ON_STACK) addi sp, sp, -(PT_SIZE_ON_STACK)
save_all_base_regs save_all_base_regs
...@@ -90,4 +90,4 @@ ENTRY(kretprobe_trampoline) ...@@ -90,4 +90,4 @@ ENTRY(kretprobe_trampoline)
addi sp, sp, PT_SIZE_ON_STACK addi sp, sp, PT_SIZE_ON_STACK
ret ret
ENDPROC(kretprobe_trampoline) ENDPROC(__kretprobe_trampoline)
...@@ -70,7 +70,7 @@ struct kprobe_ctlblk { ...@@ -70,7 +70,7 @@ struct kprobe_ctlblk {
}; };
void arch_remove_kprobe(struct kprobe *p); void arch_remove_kprobe(struct kprobe *p);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
int kprobe_fault_handler(struct pt_regs *regs, int trapnr); int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
int kprobe_exceptions_notify(struct notifier_block *self, int kprobe_exceptions_notify(struct notifier_block *self,
......
...@@ -242,7 +242,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) ...@@ -242,7 +242,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs)
ri->fp = NULL; ri->fp = NULL;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->gprs[14] = (unsigned long) &kretprobe_trampoline; regs->gprs[14] = (unsigned long) &__kretprobe_trampoline;
} }
NOKPROBE_SYMBOL(arch_prepare_kretprobe); NOKPROBE_SYMBOL(arch_prepare_kretprobe);
...@@ -334,8 +334,8 @@ NOKPROBE_SYMBOL(kprobe_handler); ...@@ -334,8 +334,8 @@ NOKPROBE_SYMBOL(kprobe_handler);
*/ */
static void __used kretprobe_trampoline_holder(void) static void __used kretprobe_trampoline_holder(void)
{ {
asm volatile(".global kretprobe_trampoline\n" asm volatile(".global __kretprobe_trampoline\n"
"kretprobe_trampoline: bcr 0,0\n"); "__kretprobe_trampoline: bcr 0,0\n");
} }
/* /*
...@@ -509,7 +509,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, ...@@ -509,7 +509,7 @@ int kprobe_exceptions_notify(struct notifier_block *self,
NOKPROBE_SYMBOL(kprobe_exceptions_notify); NOKPROBE_SYMBOL(kprobe_exceptions_notify);
static struct kprobe trampoline = { static struct kprobe trampoline = {
.addr = (kprobe_opcode_t *) &kretprobe_trampoline, .addr = (kprobe_opcode_t *) &__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler .pre_handler = trampoline_probe_handler
}; };
...@@ -520,6 +520,6 @@ int __init arch_init_kprobes(void) ...@@ -520,6 +520,6 @@ int __init arch_init_kprobes(void)
int arch_trampoline_kprobe(struct kprobe *p) int arch_trampoline_kprobe(struct kprobe *p)
{ {
return p->addr == (kprobe_opcode_t *) &kretprobe_trampoline; return p->addr == (kprobe_opcode_t *) &__kretprobe_trampoline;
} }
NOKPROBE_SYMBOL(arch_trampoline_kprobe); NOKPROBE_SYMBOL(arch_trampoline_kprobe);
...@@ -46,7 +46,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, ...@@ -46,7 +46,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry,
* Mark stacktraces with kretprobed functions on them * Mark stacktraces with kretprobed functions on them
* as unreliable. * as unreliable.
*/ */
if (state.ip == (unsigned long)kretprobe_trampoline) if (state.ip == (unsigned long)__kretprobe_trampoline)
return -EINVAL; return -EINVAL;
#endif #endif
......
...@@ -26,7 +26,7 @@ typedef insn_size_t kprobe_opcode_t; ...@@ -26,7 +26,7 @@ typedef insn_size_t kprobe_opcode_t;
struct kprobe; struct kprobe;
void arch_remove_kprobe(struct kprobe *); void arch_remove_kprobe(struct kprobe *);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
/* Architecture specific copy of original instruction*/ /* Architecture specific copy of original instruction*/
struct arch_specific_insn { struct arch_specific_insn {
......
...@@ -207,7 +207,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -207,7 +207,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = NULL; ri->fp = NULL;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->pr = (unsigned long)kretprobe_trampoline; regs->pr = (unsigned long)__kretprobe_trampoline;
} }
static int __kprobes kprobe_handler(struct pt_regs *regs) static int __kprobes kprobe_handler(struct pt_regs *regs)
...@@ -293,13 +293,13 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) ...@@ -293,13 +293,13 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
*/ */
static void __used kretprobe_trampoline_holder(void) static void __used kretprobe_trampoline_holder(void)
{ {
asm volatile (".globl kretprobe_trampoline\n" asm volatile (".globl __kretprobe_trampoline\n"
"kretprobe_trampoline:\n\t" "__kretprobe_trampoline:\n\t"
"nop\n"); "nop\n");
} }
/* /*
* Called when we hit the probe point at kretprobe_trampoline * Called when we hit the probe point at __kretprobe_trampoline
*/ */
int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
{ {
...@@ -442,7 +442,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, ...@@ -442,7 +442,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
} }
static struct kprobe trampoline_p = { static struct kprobe trampoline_p = {
.addr = (kprobe_opcode_t *)&kretprobe_trampoline, .addr = (kprobe_opcode_t *)&__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler .pre_handler = trampoline_probe_handler
}; };
......
...@@ -24,7 +24,7 @@ do { flushi(&(p)->ainsn.insn[0]); \ ...@@ -24,7 +24,7 @@ do { flushi(&(p)->ainsn.insn[0]); \
flushi(&(p)->ainsn.insn[1]); \ flushi(&(p)->ainsn.insn[1]); \
} while (0) } while (0)
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
/* Architecture specific copy of original instruction*/ /* Architecture specific copy of original instruction*/
struct arch_specific_insn { struct arch_specific_insn {
......
...@@ -440,7 +440,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -440,7 +440,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
regs->u_regs[UREG_RETPC] = regs->u_regs[UREG_RETPC] =
((unsigned long)kretprobe_trampoline) - 8; ((unsigned long)__kretprobe_trampoline) - 8;
} }
/* /*
...@@ -465,13 +465,13 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, ...@@ -465,13 +465,13 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
static void __used kretprobe_trampoline_holder(void) static void __used kretprobe_trampoline_holder(void)
{ {
asm volatile(".global kretprobe_trampoline\n" asm volatile(".global __kretprobe_trampoline\n"
"kretprobe_trampoline:\n" "__kretprobe_trampoline:\n"
"\tnop\n" "\tnop\n"
"\tnop\n"); "\tnop\n");
} }
static struct kprobe trampoline_p = { static struct kprobe trampoline_p = {
.addr = (kprobe_opcode_t *) &kretprobe_trampoline, .addr = (kprobe_opcode_t *) &__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler .pre_handler = trampoline_probe_handler
}; };
...@@ -482,7 +482,7 @@ int __init arch_init_kprobes(void) ...@@ -482,7 +482,7 @@ int __init arch_init_kprobes(void)
int __kprobes arch_trampoline_kprobe(struct kprobe *p) int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{ {
if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) if (p->addr == (kprobe_opcode_t *)&__kretprobe_trampoline)
return 1; return 1;
return 0; return 0;
......
...@@ -809,7 +809,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) ...@@ -809,7 +809,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs)
ri->fp = sara; ri->fp = sara;
/* Replace the return addr with trampoline addr */ /* Replace the return addr with trampoline addr */
*sara = (unsigned long) &kretprobe_trampoline; *sara = (unsigned long) &__kretprobe_trampoline;
} }
NOKPROBE_SYMBOL(arch_prepare_kretprobe); NOKPROBE_SYMBOL(arch_prepare_kretprobe);
...@@ -1019,9 +1019,9 @@ NOKPROBE_SYMBOL(kprobe_int3_handler); ...@@ -1019,9 +1019,9 @@ NOKPROBE_SYMBOL(kprobe_int3_handler);
*/ */
asm( asm(
".text\n" ".text\n"
".global kretprobe_trampoline\n" ".global __kretprobe_trampoline\n"
".type kretprobe_trampoline, @function\n" ".type __kretprobe_trampoline, @function\n"
"kretprobe_trampoline:\n" "__kretprobe_trampoline:\n"
/* We don't bother saving the ss register */ /* We don't bother saving the ss register */
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
" pushq %rsp\n" " pushq %rsp\n"
...@@ -1045,14 +1045,14 @@ asm( ...@@ -1045,14 +1045,14 @@ asm(
" popfl\n" " popfl\n"
#endif #endif
" ret\n" " ret\n"
".size kretprobe_trampoline, .-kretprobe_trampoline\n" ".size __kretprobe_trampoline, .-__kretprobe_trampoline\n"
); );
NOKPROBE_SYMBOL(kretprobe_trampoline); NOKPROBE_SYMBOL(__kretprobe_trampoline);
STACK_FRAME_NON_STANDARD(kretprobe_trampoline); STACK_FRAME_NON_STANDARD(__kretprobe_trampoline);
/* /*
* Called from kretprobe_trampoline * Called from __kretprobe_trampoline
*/ */
__used __visible void *trampoline_handler(struct pt_regs *regs) __used __visible void *trampoline_handler(struct pt_regs *regs)
{ {
...@@ -1061,7 +1061,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs) ...@@ -1061,7 +1061,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs)
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
regs->gs = 0; regs->gs = 0;
#endif #endif
regs->ip = (unsigned long)&kretprobe_trampoline; regs->ip = (unsigned long)&__kretprobe_trampoline;
regs->orig_ax = ~0UL; regs->orig_ax = ~0UL;
return (void *)kretprobe_trampoline_handler(regs, &regs->sp); return (void *)kretprobe_trampoline_handler(regs, &regs->sp);
......
...@@ -188,14 +188,14 @@ extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, ...@@ -188,14 +188,14 @@ extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
struct pt_regs *regs); struct pt_regs *regs);
extern int arch_trampoline_kprobe(struct kprobe *p); extern int arch_trampoline_kprobe(struct kprobe *p);
void kretprobe_trampoline(void); void __kretprobe_trampoline(void);
/* /*
* Since some architecture uses structured function pointer, * Since some architecture uses structured function pointer,
* use dereference_function_descriptor() to get real function address. * use dereference_function_descriptor() to get real function address.
*/ */
static nokprobe_inline void *kretprobe_trampoline_addr(void) static nokprobe_inline void *kretprobe_trampoline_addr(void)
{ {
return dereference_kernel_function_descriptor(kretprobe_trampoline); return dereference_kernel_function_descriptor(__kretprobe_trampoline);
} }
/* If the trampoline handler called from a kprobe, use this version */ /* If the trampoline handler called from a kprobe, use this version */
......
...@@ -349,7 +349,7 @@ EXPORT_SYMBOL_GPL(trace_output_call); ...@@ -349,7 +349,7 @@ EXPORT_SYMBOL_GPL(trace_output_call);
#ifdef CONFIG_KRETPROBES #ifdef CONFIG_KRETPROBES
static inline const char *kretprobed(const char *name) static inline const char *kretprobed(const char *name)
{ {
static const char tramp_name[] = "kretprobe_trampoline"; static const char tramp_name[] = "__kretprobe_trampoline";
int size = sizeof(tramp_name); int size = sizeof(tramp_name);
if (strncmp(tramp_name, name, size) == 0) if (strncmp(tramp_name, name, size) == 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment