[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 65/72] target/ppc: Avoid warning message for zero process table en
From: |
Nicholas Piggin |
Subject: |
[PULL 65/72] target/ppc: Avoid warning message for zero process table entries |
Date: |
Tue, 11 Mar 2025 22:57:59 +1000 |
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: <20241219034035.1826173-5-npiggin@gmail.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
target/ppc/mmu-radix64.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c
index 1d3d9e1be7..461eda4a3d 100644
--- a/target/ppc/mmu-radix64.c
+++ b/target/ppc/mmu-radix64.c
@@ -571,6 +571,20 @@ static int ppc_radix64_process_scoped_xlate(PowerPCCPU
*cpu,
prtbe0 = ldq_phys(cs->as, h_raddr);
}
+ /*
+ * Some Linux uses a zero process table entry in PID!=0 for kernel context
+ * without userspace in order to fault on NULL dereference, because using
+ * PIDR=0 for the kernel causes the Q0 page table to be used to translate
+ * Q3 as well. Check for that case here to avoid the invalid configuration
+ * message.
+ */
+ if (unlikely(!prtbe0)) {
+ if (guest_visible) {
+ ppc_radix64_raise_si(cpu, access_type, eaddr, DSISR_R_BADCONFIG);
+ }
+ return 1;
+ }
+
/* Walk Radix Tree from Process Table Entry to Convert EA to RA */
*g_page_size = PRTBE_R_GET_RTS(prtbe0);
base_addr = prtbe0 & PRTBE_R_RPDB;
--
2.47.1
- [PULL 41/72] hw/ppc/spapr: Restrict CONFER hypercall to TCG, (continued)
- [PULL 41/72] hw/ppc/spapr: Restrict CONFER hypercall to TCG, Nicholas Piggin, 2025/03/11
- [PULL 44/72] target/ppc: Move TCG specific exception handlers to tcg-excp_helper.c, Nicholas Piggin, 2025/03/11
- [PULL 38/72] hw/ssi/pnv_spi: Use local var seq_index instead of get_seq_index()., Nicholas Piggin, 2025/03/11
- [PULL 43/72] target/ppc: Make ppc_ldl_code() declaration public, Nicholas Piggin, 2025/03/11
- [PULL 49/72] target/ppc: Restrict exception helpers to TCG, Nicholas Piggin, 2025/03/11
- [PULL 52/72] target/ppc: Make powerpc_excp() prototype public, Nicholas Piggin, 2025/03/11
- [PULL 53/72] target/ppc: Restrict ATTN / SCV / PMINSN helpers to TCG, Nicholas Piggin, 2025/03/11
- [PULL 54/72] hw/ppc/spapr: Convert HPTE() macro as hpte_get_ptr() method, Nicholas Piggin, 2025/03/11
- [PULL 55/72] hw/ppc/spapr: Convert HPTE_VALID() macro as hpte_is_valid() method, Nicholas Piggin, 2025/03/11
- [PULL 56/72] hw/ppc/spapr: Convert HPTE_DIRTY() macro as hpte_is_dirty() method, Nicholas Piggin, 2025/03/11
- [PULL 65/72] target/ppc: Avoid warning message for zero process table entries,
Nicholas Piggin <=
- [PULL 63/72] target/ppc: fix timebase register reset state, Nicholas Piggin, 2025/03/11
- [PULL 72/72] docs/system/ppc/amigang.rst: Update for NVRAM emulation, Nicholas Piggin, 2025/03/11
- [PULL 67/72] ppc/amigaone: Simplify replacement dummy_fw, Nicholas Piggin, 2025/03/11
- [PULL 40/72] hw/ssi/pnv_spi: Put a limit to RDR match failures, Nicholas Piggin, 2025/03/11
- [PULL 50/72] target/ppc: Restrict various common helpers to TCG, Nicholas Piggin, 2025/03/11
- [PULL 57/72] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clean() method, Nicholas Piggin, 2025/03/11
- [PULL 61/72] ppc: spapr: Enable 2nd DAWR on Power10 pSeries machine, Nicholas Piggin, 2025/03/11
- [PULL 62/72] spapr: nested: Add support for reporting Hostwide state counter, Nicholas Piggin, 2025/03/11
- [PULL 39/72] hw/ssi/pnv_spi: Make bus names distinct for each controllers of a socket, Nicholas Piggin, 2025/03/11
- [PULL 69/72] ppc/amigaone: Add default environment, Nicholas Piggin, 2025/03/11