Message ID | 4fd69ef7945518c3e27f96b95046a5c1468d35bf.1675245773.git.christophe.leroy@csgroup.eu (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v2,1/9] powerpc: Remove __kernel_text_address() in show_instructions() | expand |
On Wed, 1 Feb 2023 11:04:23 +0100, Christophe Leroy wrote: > 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. > > [...] Applied to powerpc/next. [1/9] powerpc: Remove __kernel_text_address() in show_instructions() https://git.kernel.org/powerpc/c/d9ab6da64fd15608c9feb20d769d8df1a32fe212 [2/9] powerpc/bpf/32: No need to zeroise r4 when not doing tail call https://git.kernel.org/powerpc/c/6376ed8feca829039d31a208216b958f0e439d87 [3/9] powerpc/bpf/32: Only set a stack frame when necessary https://git.kernel.org/powerpc/c/d084dcf256bc4565b4b1af9b00297ac7b51c7049 [4/9] powerpc/bpf/32: BPF prog is never called with more than one arg https://git.kernel.org/powerpc/c/7dd0e2848764306d7a70943b97584ffdc7754708 [5/9] powerpc/bpf: Perform complete extra passes to update addresses https://git.kernel.org/powerpc/c/85e031154c7c14edee0705532a9ffc8a2fe591d0 [6/9] powerpc/bpf: Only pad length-variable code at initial pass https://git.kernel.org/powerpc/c/d3921cbb6cd663193cecf04f0b170a30c6d0e390 [7/9] powerpc/bpf/32: Optimise some particular const operations https://git.kernel.org/powerpc/c/8616045fe785229b53a24b8698631826298d1500 [8/9] powerpc/bpf/32: introduce a second source register for ALU operations https://git.kernel.org/powerpc/c/c88da29b4d2ce8d0070646b8f99729e9b355a4bf [9/9] powerpc/bpf/32: perform three operands ALU operations https://git.kernel.org/powerpc/c/19daf0aef84f33bde9c742ed41b4ded567b8dfbf cheers
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)
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(-)