Re: [PATCH] riscv: mm: Pre-allocate module page tables for execmem

From: Björn Töpel

Date: Thu Oct 15 2026 - 12:38:42 EST


Karl Mehltretter <kmehltretter@xxxxxxxxx> writes:

> RV64 pre-allocates page-table levels for late kernel mappings. The module
> range is guarded by CONFIG_MODULES, although execmem can use it without
> modules.
>
> With CONFIG_BPF_JIT=y and CONFIG_MODULES=n, execmem adds a mapping to
> init_mm while the current process retains an empty PGD entry. Initializing
> a BPF program pack then faults:
>
> Unable to handle kernel paging request ...
> [ffffffff78000000] pgd=0000000000000000
> ...
> bpf_jit_fill_hole_with_zero
> bpf_prog_pack_alloc
>
> Use CONFIG_EXECMEM for the module-range pre-allocation, as powerpc does
> for its execmem page-table setup. Both CONFIG_MODULES and CONFIG_BPF_JIT
> select it.
>
> Fixes: 2c9e5d4a0082 ("bpf: remove CONFIG_BPF_JIT dependency on CONFIG_MODULES of")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>

TY!

Acked-by: Björn Töpel <bjorn@xxxxxxxxxx>