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

From: Dave Hansen

Date: Tue Nov 24 2026 - 10:25:37 EST


On 11/23/26 09:23, Kumar Kartikeya Dwivedi wrote:
> It would be equivalent of doing copy_from_kernel_nofault() in the
> normal kernel.

... and running afoul a userspace address. So, no, it's not equivalent.
These accesses are more wild than anything else we have in the kernel.

So I kinda reject this bit of the reasoning that's been presented quite
frequently.

>> Also, can you talk a bit about the code generation on the BPF side here?
>> Are the instructions covered by the exception table handler all pure MOV's?
>
> That is correct. Each extable entry covers a single load into a
> register. mov for 4 and 8 byte loads, movzx for 1 and 2 byte loads, and
> movsx/movsxd for the sign-extending ones. On a fault, ex_handler_bpf()
> zeroes the destination register and skips the instruction.

I think that's also important to call out in the changelogs. Because the
"zero the register" behavior doesn't necessarily work for the whole ISA.

This all makes me really nervous.

Do we at least require that these super specialized programs have the
bpf_prog_info->gpl_compatible bit set?