Re: [PATCH v4 bpf 0/4] vmalloc: bpf: introduce VM_ALLOW_HUGE_VMAP
From: Linus Torvalds
Date: Sat Apr 16 2022 - 16:31:29 EST
On Sat, Apr 16, 2022 at 12:55 PM Song Liu <songliubraving@xxxxxx> wrote:
>
> Based on this analysis, I think we should either
> 1) ship the whole set with 5.18; or
> 2) ship 1/4, 3/4, and 4/4 with 5.18, and 2/4 with 5.19.
Honestly, I think the proper thing to do is
- apply #1, because yes, that "use huge pages" should be an opt-in.
- but just disable hugepages for now.
I think those games with set_memory_nx() and friends just show how
rough this all is right now.
In fact, I personally think that the whole bpf 'prog_pack' stuff
should probably be disabled. It looks incredible broken to me right
now.
Unless I mis-read it, it does a "module_alloc()" to allocate the vmap
area, and then just marks it executable without having even
initialized the pages. Am I missing something? So now we have random
kernel memory that is marked executable.
Sure, it's also marked RO, but who cares? It's random data that is now
executable.
Maybe I am missing something, but I really don't think this is ready
for prime-time. We should effectively disable it all, and have people
think through it a lot more.
Linus