From: Ryan Roberts <ryan.roberts@arm.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v1] arm64: Mitigate Spectre v1 in the BPF interpreter
Date: Mon, 23 Nov 2026 10:49:58 +0000 [thread overview]
Message-ID: <85385aae-af06-4742-a39b-5a95e3e73a7e@arm.com> (raw)
In-Reply-To: <DN2ALO12MI1Z.3HI553HDMO2FL@gmail.com>
On 23/11/2026 04:07, Alexei Starovoitov wrote:
> On Sun, Nov 22, 2026 at 12:58 AM Ryan Roberts <ryan.roberts@arm.com> wrote:
>> 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").
>
> Fair enough, but the arm64 part of that comment is stale.
> The verifier relies on nospec for v1 since
> commit d6f1c85f2253 ("bpf: Fall back to nospec for Spectre v1").
>
>> 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?
>
> Not quite. In the interpreter the barrier sits behind an indirect branch:
>
> goto *jumptable[insn->code];
>
> arm64 has no retpoline, and the prog can train this branch.
> With a wrong target the CPU skips ST_NOSPEC and runs the next insn.
> So the interpreter is still not safe.
> Yet you're arguing that you're making bpf interpreter a viable option
> on arm64. That's just not fair to users.
I'm not saying that at all. I wasn't aware that it previously considered unviable.
I noticed this particular issue while doing manual code inspection while working
on something else. I sent the patch to close what I perceived to be a bug to try
to be a good citizen.
> Say it in the commit log that you're fixing one tiny issue and leaving
> giant security hole in place.
> With that I'm no longer nacking it.
Happy to fix up the commit log as you suggest.
>
>> 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?
>
> Yeah. Good point. Let's disallow it on arm64 and x86-64.
>
> I'm thinking to push something like this
>
> diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig
> index d705d7b..8b8688d 100644
> --- a/kernel/bpf/Kconfig
> +++ b/kernel/bpf/Kconfig
> @@ -26,8 +26,8 @@ config HAVE_EBPF_JIT_KASAN
> config ARCH_WANT_DEFAULT_BPF_JIT
> bool
>
> -# Used by archs to tell that kernels that were compiled with BPF JIT support
> -# have no BPF interpreter.
> +# Used by archs to tell that kernels with the bpf() system call have the
> +# BPF JIT compiler and no BPF interpreter.
> config ARCH_WANT_BPF_JIT_ALWAYS_ON
> bool
>
> @@ -36,6 +36,7 @@ menu "BPF subsystem"
> config BPF_SYSCALL
> bool "Enable bpf() system call"
> select BPF
> + select BPF_JIT if ARCH_WANT_BPF_JIT_ALWAYS_ON
> select IRQ_WORK
> select NEED_TASKS_RCU
> select TASKS_TRACE_RCU
Seems reasonable as long as we're sure that there are no users that rely on the
interpreter on arm64 for some reason?
Would you propose that this is something that should be backported? If so, I'll
drop this patch. Otherwise, I'll send a v2 with a more cautious commit log.
Thanks,
Ryan
next prev parent reply other threads:[~2026-11-23 10:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 17:23 [PATCH v1] arm64: Mitigate Spectre v1 in the BPF interpreter Ryan Roberts
2026-11-18 14:27 ` Luis Gerhorst
2026-11-19 1:18 ` Alexei Starovoitov
2026-11-20 10:02 ` Catalin Marinas
2026-11-20 17:38 ` Alexei Starovoitov
2026-11-22 8:58 ` Ryan Roberts
2026-11-23 4:07 ` Alexei Starovoitov
2026-11-23 10:49 ` Ryan Roberts [this message]
2026-11-23 15:37 ` Catalin Marinas
2026-11-23 16:48 ` Ryan Roberts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85385aae-af06-4742-a39b-5a95e3e73a7e@arm.com \
--to=ryan.roberts@arm.com \
--cc=akpm@linux-foundation.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox