Skip to content

Commit b81330b

Browse files
SiFiveHollandSasha Levin
authored andcommitted
riscv: Disallow PR_GET_TAGGED_ADDR_CTRL without Supm
[ Upstream commit 7f1c3de ] When the prctl() interface for pointer masking was added, it did not check that the pointer masking ISA extension was supported, only the individual submodes. Userspace could still attempt to disable pointer masking and query the pointer masking state. commit 81de1afb2dd1 ("riscv: Fix kernel crash due to PR_SET_TAGGED_ADDR_CTRL") disallowed the former, as the senvcfg write could crash on older systems. PR_GET_TAGGED_ADDR_CTRL state does not crash, because it reads only kernel-internal state and not senvcfg, but it should still be disallowed for consistency. Fixes: 09d6775 ("riscv: Add support for userspace pointer masking") Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20250507145230.2272871-1-samuel.holland@sifive.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5147974 commit b81330b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/riscv/kernel/process.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ long get_tagged_addr_ctrl(struct task_struct *task)
333333
struct thread_info *ti = task_thread_info(task);
334334
long ret = 0;
335335

336+
if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_SUPM))
337+
return -EINVAL;
338+
336339
if (is_compat_thread(ti))
337340
return -EINVAL;
338341

0 commit comments

Comments
 (0)