Re: [PATCH v3 bpf-next 5/8] bpf: use module_alloc_huge for bpf_prog_pack

From: hch@xxxxxx
Date: Wed May 25 2022 - 02:02:06 EST


On Tue, May 24, 2022 at 03:08:12PM -0700, Luis Chamberlain wrote:
> > A rename seems good to me. Module space is really just dynamically
> > allocated text space now. There used to be a vmalloc_exec() that
> > allocated text in vmalloc space,
>
> Yes I saw that but it was generic and it did not do the arch-specific
> override, and so that is why Christoph ripped it out and open coded
> it on the only user, on module_alloc().

It it also because random code does not have any business allocating
executable memory. Executable memory in kernel is basically for
modules and module-like code like eBPF, and no one else has any business
allocating pages with the execute bit set (or the NX bit not set).