From 1479eca38f15f7655eb21b1d6c330e10229bb805 Mon Sep 17 00:00:00 2001 From: panciyan Date: Thu, 23 Mar 2023 02:45:42 +0000 Subject: [PATCH] target/riscv: leaf PTE check PTE_W missing When permission bits R, W, and X in PTE all three are zero, the PTE is a pointter to the next level of the page table; otherwise, it is a leaf PTE. Here PTE_W is missed. Change-Id: I82a4cc4e64280f0fcad75b20e51b617520aff29b Signed-off-by: panciyan --- src/target/riscv/riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 3c91526cd..7f05b0cc5 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1975,7 +1975,7 @@ static int riscv_address_translate(struct target *target, if (!(pte & PTE_V) || (!(pte & PTE_R) && (pte & PTE_W))) return ERROR_FAIL; - if ((pte & PTE_R) || (pte & PTE_X)) /* Found leaf PTE. */ + if ((pte & PTE_R) || (pte & PTE_W) || (pte & PTE_X)) /* Found leaf PTE. */ break; i--;