Re: [PATCH bpf-next v1 1/3] x86/mm: Resolve BPF exception fixups for user address faults under SMAP
From: Borislav Petkov
Date: Sun Nov 22 2026 - 15:09:37 EST
On Fri, Oct 09, 2026 at 05:23:13PM +0200, Kumar Kartikeya Dwivedi wrote:
> The advantage is losing significant amount of code size in JITed programs and
> the associated runtime overhead (you can see the numbers in the cover letter).
>
> Do note that we can make it more generic, we can follow up and optimize
> copy_from_kernel_nofault() with cpu_feature_enabled(X86_FEATURE_SMAP) as well.
> But I didn't want to go there just yet. I am happy to work on a follow up if so
> desired.
So we basically disable SMAP around bpf programs when they are about to
accesss potentially stale memory and the only line of defense is for
is_bpf_text_address() to really DTRT.
And once we open the floodgates here, I'm sure you bpf folks will find another
creative way to flip the kernel on its head.
And all that just to save some bytes.
Sorry, this is simply not worth the risk from where I am standing.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette