]> www.infradead.org Git - users/hch/misc.git/commit
riscv: Disallow PR_GET_TAGGED_ADDR_CTRL without Supm
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 7 May 2025 14:52:18 +0000 (07:52 -0700)
committerAlexandre Ghiti <alexghiti@rivosinc.com>
Thu, 8 May 2025 12:01:01 +0000 (12:01 +0000)
commit7f1c3de1370bc6a8ad5157336b258067dac0ae9c
tree40bce945112ae5dd72edf24f2d951b2e27c765f6
parente9d86b8e17e725ee6088970981ab99f29abd1997
riscv: Disallow PR_GET_TAGGED_ADDR_CTRL without Supm

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: 09d6775f503b ("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>
arch/riscv/kernel/process.c