]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
ca452bbe8ae13602a5c21208b4b6d52544958abf
[thirdparty/kernel/stable-queue.git] /
1 From e6c4dcb308160115287afd87afb63b5684d75a5b Mon Sep 17 00:00:00 2001
2 From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
3 Date: Mon, 30 Oct 2017 20:42:09 +0530
4 Subject: powerpc/kprobes: Dereference function pointers only if the address does not belong to kernel text
5
6 From: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
7
8 commit e6c4dcb308160115287afd87afb63b5684d75a5b upstream.
9
10 This makes the changes introduced in commit 83e840c770f2c5
11 ("powerpc64/elfv1: Only dereference function descriptor for non-text
12 symbols") to be specific to the kprobe subsystem.
13
14 We previously changed ppc_function_entry() to always check the provided
15 address to confirm if it needed to be dereferenced. This is actually
16 only an issue for kprobe blacklisted asm labels (through use of
17 _ASM_NOKPROBE_SYMBOL) and can cause other issues with ftrace. Also, the
18 additional checks are not really necessary for our other uses.
19
20 As such, move this check to the kprobes subsystem.
21
22 Fixes: 83e840c770f2 ("powerpc64/elfv1: Only dereference function descriptor for non-text symbols")
23 Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
24 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 arch/powerpc/kernel/kprobes.c | 7 ++++++-
29 1 file changed, 6 insertions(+), 1 deletion(-)
30
31 --- a/arch/powerpc/kernel/kprobes.c
32 +++ b/arch/powerpc/kernel/kprobes.c
33 @@ -600,7 +600,12 @@ NOKPROBE_SYMBOL(kprobe_fault_handler);
34
35 unsigned long arch_deref_entry_point(void *entry)
36 {
37 - return ppc_global_function_entry(entry);
38 +#ifdef PPC64_ELF_ABI_v1
39 + if (!kernel_text_address((unsigned long)entry))
40 + return ppc_global_function_entry(entry);
41 + else
42 +#endif
43 + return (unsigned long)entry;
44 }
45 NOKPROBE_SYMBOL(arch_deref_entry_point);
46