kprobes: treewide: Replace arch_deref_entry_point() with dereference_symbol_descriptor()
~15 years ago kprobes grew the 'arch_deref_entry_point()' __weak function: 3d7e33825d87: ("jprobes: make jprobes a little safer for users") But this is just open-coded dereference_symbol_descriptor() in essence, and its obscure nature was causing bugs. Just use the real thing and remove arch_deref_entry_point(). Link: https://lkml.kernel.org/r/163163043630.489837.7924988885652708696.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Tested-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
a7fe237845
commit
f2ec8d9a3b
|
@ -891,11 +891,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned long arch_deref_entry_point(void *entry)
|
||||
{
|
||||
return ((struct fnptr *)entry)->ip;
|
||||
}
|
||||
|
||||
static struct kprobe trampoline_p = {
|
||||
.pre_handler = trampoline_probe_handler
|
||||
};
|
||||
|
|
|
@ -542,17 +542,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
|
|||
}
|
||||
NOKPROBE_SYMBOL(kprobe_fault_handler);
|
||||
|
||||
unsigned long arch_deref_entry_point(void *entry)
|
||||
{
|
||||
#ifdef PPC64_ELF_ABI_v1
|
||||
if (!kernel_text_address((unsigned long)entry))
|
||||
return ppc_global_function_entry(entry);
|
||||
else
|
||||
#endif
|
||||
return (unsigned long)entry;
|
||||
}
|
||||
NOKPROBE_SYMBOL(arch_deref_entry_point);
|
||||
|
||||
static struct kprobe trampoline_p = {
|
||||
.addr = (kprobe_opcode_t *) &kretprobe_trampoline,
|
||||
.pre_handler = trampoline_probe_handler
|
||||
|
|
|
@ -381,7 +381,6 @@ int register_kprobe(struct kprobe *p);
|
|||
void unregister_kprobe(struct kprobe *p);
|
||||
int register_kprobes(struct kprobe **kps, int num);
|
||||
void unregister_kprobes(struct kprobe **kps, int num);
|
||||
unsigned long arch_deref_entry_point(void *);
|
||||
|
||||
int register_kretprobe(struct kretprobe *rp);
|
||||
void unregister_kretprobe(struct kretprobe *rp);
|
||||
|
|
|
@ -1861,11 +1861,6 @@ static struct notifier_block kprobe_exceptions_nb = {
|
|||
.priority = 0x7fffffff /* we need to be notified first */
|
||||
};
|
||||
|
||||
unsigned long __weak arch_deref_entry_point(void *entry)
|
||||
{
|
||||
return (unsigned long)entry;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KRETPROBES
|
||||
|
||||
unsigned long __kretprobe_trampoline_handler(struct pt_regs *regs,
|
||||
|
@ -2327,7 +2322,7 @@ static int __init populate_kprobe_blacklist(unsigned long *start,
|
|||
int ret;
|
||||
|
||||
for (iter = start; iter < end; iter++) {
|
||||
entry = arch_deref_entry_point((void *)*iter);
|
||||
entry = (unsigned long)dereference_symbol_descriptor((void *)*iter);
|
||||
ret = kprobe_add_ksym_blacklist(entry);
|
||||
if (ret == -EINVAL)
|
||||
continue;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
#include <asm/sections.h>
|
||||
|
||||
/* Whitelist of symbols that can be overridden for error injection. */
|
||||
static LIST_HEAD(error_injection_list);
|
||||
|
@ -64,7 +65,7 @@ static void populate_error_injection_list(struct error_injection_entry *start,
|
|||
|
||||
mutex_lock(&ei_mutex);
|
||||
for (iter = start; iter < end; iter++) {
|
||||
entry = arch_deref_entry_point((void *)iter->addr);
|
||||
entry = (unsigned long)dereference_symbol_descriptor((void *)iter->addr);
|
||||
|
||||
if (!kernel_text_address(entry) ||
|
||||
!kallsyms_lookup_size_offset(entry, &size, &offset)) {
|
||||
|
|
Loading…
Reference in New Issue