Re: [PATCH bpf-next v1 1/3] x86/mm: Resolve BPF exception fixups for user address faults under SMAP

From: Kumar Kartikeya Dwivedi

Date: Sun Nov 22 2026 - 20:00:43 EST


On Mon, 23 Nov 2026 at 01:31, Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Sun, Nov 22, 2026 at 10:59:33PM +0100, Kumar Kartikeya Dwivedi wrote:
> > So I am not sure I see how this risks making things worse for anyone
> > else. It's not about saving some bytes, if you look at the cover
> > letter, we reduce significant amount of code and associated overhead
> > from programs running in hot paths.
>
> Lemme summarize our "discussion":
>
> Boris: you're subverting SMAP security.
>
> Kumar: but but, performance. And we're special.
>
> Nope, not good enough.
>
> You need to go back to the drawing board and massage your bpf program until it
> doesn't need any hackery like that.
>
> I dunno, tag the pointer, massage it so that it causes a "normal" page fault
> like it would happen for any other userspace program, whatever. Just not this.

We already handle it properly. The only practical difference without
this patch is that we pay extra overhead to handle such addresses. It
would be useful to shift the cost into the fault handler, since common
programs instrumented with the relevant sanitization do not exercise
it, but still pay the cost.

I also don't understand your security concern. Since the destination
register will be written to zero, I don't see how the program gains
any new capabilities or reads anything. It cannot use this to bypass
SMAP protection.

Thus far, I've tried to provide reasonable explanations for this
change and clarified how it impacts nothing other than BPF's own
behavior. At that point in the fault handler, without this exception
handling fixup, the kernel will panic.

Instead of paying instrumentation overhead to get to that point, we'd
like to shift that cost to that path, that is already otherwise going
to lead to a panic, to instead continue the BPF program.

I don't think being dismissive, telling us to "go back to the drawing
board" without understanding how BPF works, or arguing "BPF people
will do bad things to the kernel if we accept this" leads to a
productive discussion.

>
> HTH.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette