[PATCH 1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX

Nam Cao namcao at linutronix.de
Fri Jul 17 03:46:37 PDT 2026


Xiaofeng Yuan <xiaofengmian at 163.com> writes:
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 5b1b3c88b..21794e7bb 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -1457,7 +1457,9 @@ struct execmem_info __init *execmem_arch_setup(void)
>  			[EXECMEM_KPROBES] = {
>  				.start	= VMALLOC_START,
>  				.end	= VMALLOC_END,
> -				.pgprot	= PAGE_KERNEL_READ_EXEC,
> +				.pgprot	= IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX) ?
> +					  PAGE_KERNEL_READ_EXEC :
> +					  PAGE_KERNEL_EXEC,
>  				.alignment = 1,
>  			},
>  			[EXECMEM_BPF] = {

CONFIG_ARCH_HAS_EXECMEM_ROX=n for RISC-V, so this is just

	.pgprot	= PAGE_KERNEL_EXEC,

Since this is only needed when CONFIG_STRICT_MODULE_RWX=n, shouldn't the
condition be based on that instead?

Nam



More information about the linux-riscv mailing list