]> www.infradead.org Git - users/dwmw2/linux.git/commit
riscv: Add support for userspace pointer masking
authorSamuel Holland <samuel.holland@sifive.com>
Wed, 16 Oct 2024 20:27:45 +0000 (13:27 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 24 Oct 2024 21:12:55 +0000 (14:12 -0700)
commit09d6775f503b393d0457c7126aa43208e1724004
tree87c43823074a94f43def3320e1169d059818ff8c
parent29eedc7d1587f42f33ae209be45c89c424ee9c00
riscv: Add support for userspace pointer masking

RISC-V supports pointer masking with a variable number of tag bits
(which is called "PMLEN" in the specification) and which is configured
at the next higher privilege level.

Wire up the PR_SET_TAGGED_ADDR_CTRL and PR_GET_TAGGED_ADDR_CTRL prctls
so userspace can request a lower bound on the number of tag bits and
determine the actual number of tag bits. As with arm64's
PR_TAGGED_ADDR_ENABLE, the pointer masking configuration is
thread-scoped, inherited on clone() and fork() and cleared on execve().

Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Charlie Jenkins <charlie@rivosinc.com>
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20241016202814.4061541-5-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Documentation/arch/riscv/uabi.rst
arch/riscv/Kconfig
arch/riscv/include/asm/processor.h
arch/riscv/include/asm/switch_to.h
arch/riscv/kernel/process.c
include/uapi/linux/prctl.h