Re: [PATCH v1] arm64: Mitigate Spectre v1 in the BPF interpreter

From: Ryan Roberts

Date: Sun Nov 22 2026 - 03:58:49 EST


On 20/11/2026 17:38, Alexei Starovoitov wrote:
> On Fri Nov 20, 2026 at 10:02 AM UTC, Catalin Marinas wrote:
>> On Thu, Nov 19, 2026 at 01:18:03AM +0000, Alexei Starovoitov wrote:
>>> On Tue, Nov 17, 2026 at 09:23 AM Ryan Roberts <ryan.roberts@xxxxxxx> wrote:
>>>> The arm64 JIT implements BPF_NOSPEC with a speculation barrier, but the
>>>> interpreter calls barrier_nospec(), which falls back to a no-op on
>>>> arm64. Programs executed by the interpreter therefore lack the
>>>> Spectre-v1 barriers assumed by the verifier. Contrary to the code
>>>> comment, kernel-wide SSBD does not provide this protection, since it
>>>> mitigates Spectre v4 rather than Spectre v1.
>>>
>>> Nack.
>>> In bpf-next arm64 has no interpreter when the JIT is built.
>>
>> And what about current mainline/stable or when one disables BPF_JIT
>> explicitly? Should we force BPF_JIT=y as well when ALWAYS_ON=y?
>
> Anyone who didn't have BPF_JIT_ALWAYS_ON=y were exposed to speculation
> attacks forever. The security hole was wide open. We've been saying it
> forever. At the next merge window we will say
> "you cannot make wrong choice anymore".

I view this patch as a fix to arm64, not as a fix to BPF. I haven't changed any
BPF code - I've only removed an out of date comment in BPF code, which assumed
the code path was for Spectre v4 only. But that's not true since Commit
dff883d9e93a ("bpf, arm64, powerpc: Change nospec to include v1 barrier").

arm64 was previously nop'ing barrier_nospec() despite seemingly needing it in
the same situation as x86. I think this is orthogonal to whether or not the BPF
interpreter permits speculation attacks in other places?

Looking at bpf-next, it is still possible to deselect BPF_JIT when building. If
this is such a security issue, shouldn't we disallow that on arm64, or at the
every least make it an EXPERT option?

Thanks,
Ryan