From: Naveen N. Rao <hidden> Date: 2017-10-30 15:12:30
Chandan reported that trying to enable function_graph tracer on ppc64 BE
now locks up the system. This is due to prepare_ftrace_return() using
ppc_function_entry() for resolving return_to_handler(), which in turn
invokes kernel_text_address(), which also gets traced resulting in a
loop.
We added a check for kernel_text_address() in ppc_function_entry() to
guard all users in case we were called with a function, rather than a
function descriptor. In hindsight, I feel that this is inefficient since
we usually only pass function descriptors to ppc_function_entry() (and
ppc_global_function_entry()). So, I am proposing that we revert the
previous patch and instead implement the necessary checks in the kprobes
subsystem.
The other way to fix this is to simply guard the call to
kernel_text_address() within [un]pause_graph_tracing(), if you think
it's useful to have the check in ppc_function_entry() for all users.
- Naveen
Naveen N. Rao (2):
Revert "powerpc64/elfv1: Only dereference function descriptor for
non-text symbols"
powerpc/kprobes: Dereference function pointers only if the address
does not belong to kernel text
arch/powerpc/include/asm/code-patching.h | 10 +---------
arch/powerpc/kernel/kprobes.c | 7 ++++++-
2 files changed, 7 insertions(+), 10 deletions(-)
--
2.14.2
From: Naveen N. Rao <hidden> Date: 2017-10-30 15:12:41
This makes the changes introduced in commit 83e840c770f2c5
("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.
Signed-off-by: Naveen N. Rao <redacted>
---
arch/powerpc/kernel/kprobes.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
From: Michael Ellerman <hidden> Date: 2017-11-02 12:12:33
On Mon, 2017-10-30 at 15:12:09 UTC, "Naveen N. Rao" wrote:
This makes the changes introduced in commit 83e840c770f2c5
("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.
Signed-off-by: Naveen N. Rao <redacted>