Commit d9ab6da6 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc: Remove __kernel_text_address() in show_instructions()

That test was introducted in 2006 by
commit 00ae36de ("[POWERPC] Better check in show_instructions").
At that time, there was no BPF progs.

As seen in message of commit 89d21e25 ("powerpc/bpf/32: Fix Oops
on tail call tests"), when a page fault occurs in test_bpf.ko for
instance, the code is dumped as XXXXXXXXs. Allthough
__kernel_text_address() checks is_bpf_text_address(), it seems it is
not enough.

Today, show_instructions() uses get_kernel_nofault() to read the code,
so there is no real need for additional verifications.

ARM64 and x86 don't do any additional check before dumping
instructions. Do the same and remove __kernel_text_address()
in show_instructions().
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4fd69ef7945518c3e27f96b95046a5c1468d35bf.1675245773.git.christophe.leroy@csgroup.eu
parent 2115732e
...@@ -1405,8 +1405,7 @@ static void show_instructions(struct pt_regs *regs) ...@@ -1405,8 +1405,7 @@ static void show_instructions(struct pt_regs *regs)
for (i = 0; i < NR_INSN_TO_PRINT; i++) { for (i = 0; i < NR_INSN_TO_PRINT; i++) {
int instr; int instr;
if (!__kernel_text_address(pc) || if (get_kernel_nofault(instr, (const void *)pc)) {
get_kernel_nofault(instr, (const void *)pc)) {
pr_cont("XXXXXXXX "); pr_cont("XXXXXXXX ");
} else { } else {
if (nip == pc) if (nip == pc)
......
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