RE: [PATCH] arm64: allow post-init vmalloc PXNTable

From: Maxwell Bland
Date: Tue Feb 13 2024 - 14:37:36 EST


> -----Original Message-----
> From: Maxwell Bland On Tuesday, February 13, 2024 1:15 PM
> > From: Mark Rutland <mark.rutland@xxxxxxx>
> > How does this work with other allocations of executable memory? e.g. modules,
> > BPF?
>
> It should work.
> - kernel/bpf/core.c uses bpf_jit_alloc_exec to create executable code regions,
> which is a wrapper for module_alloc. In the interpreted BPF case, we do not
> need to worry since the pages storing interpreted code are NX and can be
> marked PXNTable regardless.

Correction: I was wrong here. The _weak reference to bpf_jit_alloc_exec is overwritten in
arch/arm64/net/bpf_jit_comp.c to use a vmalloc call. This would need to be set back to
the generic BPF's use of "module_alloc". I will look into and correct this.