Skip to content

Commit b4aa82d

Browse files
committed
target/ppc: Avoid warning message for zero process table entries
A translation that encounters a process table entry that is zero is something that Linux does to cause certain kernel NULL pointer dereferences to fault. It is not itself a programming error, so avoid the guest error log. Message-ID: <[email protected]> Signed-off-by: Nicholas Piggin <[email protected]>
1 parent d8a6245 commit b4aa82d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

target/ppc/mmu-radix64.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,20 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU *cpu,
571571
prtbe0 = ldq_phys(cs->as, h_raddr);
572572
}
573573

574+
/*
575+
* Some Linux uses a zero process table entry in PID!=0 for kernel context
576+
* without userspace in order to fault on NULL dereference, because using
577+
* PIDR=0 for the kernel causes the Q0 page table to be used to translate
578+
* Q3 as well. Check for that case here to avoid the invalid configuration
579+
* message.
580+
*/
581+
if (unlikely(!prtbe0)) {
582+
if (guest_visible) {
583+
ppc_radix64_raise_si(cpu, access_type, eaddr, DSISR_R_BADCONFIG);
584+
}
585+
return 1;
586+
}
587+
574588
/* Walk Radix Tree from Process Table Entry to Convert EA to RA */
575589
*g_page_size = PRTBE_R_GET_RTS(prtbe0);
576590
base_addr = prtbe0 & PRTBE_R_RPDB;

0 commit comments

Comments
 (0)