target/riscv: reject shadow-stack accesses in Bare-mode translation
PATCH 2/2 target/riscv: reject shadow-stack accesses in Bare-mode translation
Hello,
In VM_1_10_MBARE the translation returns physical == virtual with full permissions for every access, including shadow-stack accesses (is_sstack_idx). With satp disabled, sspush/sspopchk/ssamoswap then operate on ordinary physical memory, so the same ROP+1 pivot as the page-type issue is available without any page tables at all (probe T27 exits "full pass" on unpatched Bare).
The Zicfiss spec permits shadow-stack storage only on shadow-stack pages; Bare mode has no page types, so all SS accesses must fault.
Fixes 669b4867495c ("target/riscv: mmu changes for zicfiss shadow stack protection")
Reported-by <SENDER>
Signed-off-by <SENDER>
--- target/riscv/tcg/cpu_helper.c | 3 +++ 1 file changed, 3 insertions(+)
target/riscv/tcg/cpu_helper.c +3 -0
@@ -1088,6 +1088,9 @@ static int get_physical_address(CPURISCVState *env, hwaddr addr,case VM_1_10_SV57 : levels =5 ; ptidxbits =9 ; ptesize =8 ;break ;case VM_1_10_MBARE : +if (is_sstack_idx) { +return TRANSLATE_FAIL ; + } *physical = addr; *ret_prot =PAGE_READ |PAGE_WRITE |PAGE_EXEC ;return TRANSLATE_SUCCESS ;
--
2.43.0
Thanks,
Looking forward to your reply!