All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/9] powerpc: Remove __kernel_text_address() in show_instructions()
@ 2023-02-01 10:04 ` Christophe Leroy
  0 siblings, 0 replies; 20+ messages in thread
From: Christophe Leroy @ 2023-02-01 10:04 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Naveen N. Rao
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev, bpf,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa

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

As seen in message of commit 89d21e259a94 ("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: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/kernel/process.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index c22cc234672f..effe9697905d 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1405,8 +1405,7 @@ static void show_instructions(struct pt_regs *regs)
 	for (i = 0; i < NR_INSN_TO_PRINT; i++) {
 		int instr;
 
-		if (!__kernel_text_address(pc) ||
-		    get_kernel_nofault(instr, (const void *)pc)) {
+		if (get_kernel_nofault(instr, (const void *)pc)) {
 			pr_cont("XXXXXXXX ");
 		} else {
 			if (nip == pc)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-02-15 12:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 10:04 [PATCH v2 1/9] powerpc: Remove __kernel_text_address() in show_instructions() Christophe Leroy
2023-02-01 10:04 ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 2/9] powerpc/bpf/32: No need to zeroise r4 when not doing tail call Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 3/9] powerpc/bpf/32: Only set a stack frame when necessary Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 4/9] powerpc/bpf/32: BPF prog is never called with more than one arg Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 5/9] powerpc/bpf: Perform complete extra passes to update addresses Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 6/9] powerpc/bpf: Only pad length-variable code at initial pass Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 7/9] powerpc/bpf/32: Optimise some particular const operations Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 8/9] powerpc/bpf/32: introduce a second source register for ALU operations Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-01 10:04 ` [PATCH v2 9/9] powerpc/bpf/32: perform three operands " Christophe Leroy
2023-02-01 10:04   ` Christophe Leroy
2023-02-15 12:40 ` [PATCH v2 1/9] powerpc: Remove __kernel_text_address() in show_instructions() Michael Ellerman
2023-02-15 12:40   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.