[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260127115912.3026761-1-luis.gerhorst@fau.de>
Date: Tue, 27 Jan 2026 12:59:10 +0100
From: Luis Gerhorst <luis.gerhorst@....de>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>,
Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Luis Gerhorst <luis.gerhorst@....de>,
Ihor Solodrai <isolodrai@...a.com>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: [PATCH bpf-next 0/2] bpf: Fix verifier_bug_if to account for BPF_CALL
This fixes the verifier_bug_if() that runs on nospec_result to not trigger
for BPF_CALL (bug reported by Hu, Mei, and Mu). See patch 1 for a full
description and patch 2 for a test (based on the PoC from the report).
While working on this I noticed two other problems:
- nospec_result is currently ignored for BPF_CALL during patching, but it
may be required if we assume the CPU may speculate into/out of functions.
- Both the instruction patching for nospec and nospec_result erases the
instruction aux information even thought it might be better to keep that.
For nospec_result it may be fine as it is only applied to store
instructions currently (except for when we decide to change the thing
from above), but nospec may be set for arbitrary instructions and if
these require rewrites they break.
I assume these issues are better fixed separately, thus I decided to
exclude them from this series.
Luis Gerhorst (2):
bpf: Fix verifier_bug_if to account for BPF_CALL
bpf: Test nospec after dead stack write in helper
kernel/bpf/verifier.c | 14 +++++++-----
.../selftests/bpf/progs/verifier_unpriv.c | 22 +++++++++++++++++++
2 files changed, 30 insertions(+), 6 deletions(-)
base-commit: 8016abd6314ed1ed01ff09404e3c82ceb13c185b
--
2.52.0
Powered by blists - more mailing lists