Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 2e1743085887 ("riscv: Add support for the tagged address ABI")
Signed-off-by: Zishun Yi <vulab@iscas.ac.cn>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://patch.msgid.link/20260322160022.21908-1-vulab@iscas.ac.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>

authored by

Zishun Yi and committed by
Paul Walmsley
3033b2b1 57f0253b

+3 -1
+3 -1
arch/riscv/kernel/process.c
··· 347 347 if (arg & PR_TAGGED_ADDR_ENABLE && (tagged_addr_disabled || !pmlen)) 348 348 return -EINVAL; 349 349 350 - if (!(arg & PR_TAGGED_ADDR_ENABLE)) 350 + if (!(arg & PR_TAGGED_ADDR_ENABLE)) { 351 351 pmlen = PMLEN_0; 352 + pmm = ENVCFG_PMM_PMLEN_0; 353 + } 352 354 353 355 if (mmap_write_lock_killable(mm)) 354 356 return -EINTR;