Skip to content

Commit 3033b2b

Browse files
ISCAS-VulabPaul Walmsley
authored andcommitted
riscv: Reset pmm when PR_TAGGED_ADDR_ENABLE is not set
In set_tagged_addr_ctrl(), when PR_TAGGED_ADDR_ENABLE is not set, pmlen is correctly set to 0, but it forgets to reset pmm. This results in the CPU pmm state not corresponding to the software pmlen state. Fix this by resetting pmm along with pmlen. Fixes: 2e17430 ("riscv: Add support for the tagged address ABI") Signed-off-by: Zishun Yi <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paul Walmsley <[email protected]>
1 parent 57f0253 commit 3033b2b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

arch/riscv/kernel/process.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,10 @@ long set_tagged_addr_ctrl(struct task_struct *task, unsigned long arg)
347347
if (arg & PR_TAGGED_ADDR_ENABLE && (tagged_addr_disabled || !pmlen))
348348
return -EINVAL;
349349

350-
if (!(arg & PR_TAGGED_ADDR_ENABLE))
350+
if (!(arg & PR_TAGGED_ADDR_ENABLE)) {
351351
pmlen = PMLEN_0;
352+
pmm = ENVCFG_PMM_PMLEN_0;
353+
}
352354

353355
if (mmap_write_lock_killable(mm))
354356
return -EINTR;

0 commit comments

Comments
 (0)