Skip to content

Commit e6c4dcb

Browse files
rnavmpe
authored andcommitted
powerpc/kprobes: Dereference function pointers only if the address does not belong to kernel text
This makes the changes introduced in commit 83e840c ("powerpc64/elfv1: Only dereference function descriptor for non-text symbols") to be specific to the kprobe subsystem. We previously changed ppc_function_entry() to always check the provided address to confirm if it needed to be dereferenced. This is actually only an issue for kprobe blacklisted asm labels (through use of _ASM_NOKPROBE_SYMBOL) and can cause other issues with ftrace. Also, the additional checks are not really necessary for our other uses. As such, move this check to the kprobes subsystem. Fixes: 83e840c ("powerpc64/elfv1: Only dereference function descriptor for non-text symbols") Cc: stable@vger.kernel.org # v4.13+ Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 63be1a8 commit e6c4dcb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

arch/powerpc/kernel/kprobes.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,12 @@ NOKPROBE_SYMBOL(kprobe_fault_handler);
600600

601601
unsigned long arch_deref_entry_point(void *entry)
602602
{
603-
return ppc_global_function_entry(entry);
603+
#ifdef PPC64_ELF_ABI_v1
604+
if (!kernel_text_address((unsigned long)entry))
605+
return ppc_global_function_entry(entry);
606+
else
607+
#endif
608+
return (unsigned long)entry;
604609
}
605610
NOKPROBE_SYMBOL(arch_deref_entry_point);
606611

0 commit comments

Comments
 (0)