From: Eduard Zingerman <eddyz87@gmail.com>
To: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
yonghong.song@linux.dev, eddyz87@gmail.com, laoar.shao@gmail.com,
mykyta.yatsenko5@gmail.com
Subject: [PATCH bpf-next v2 0/1] selftests/bpf: more precise cpu_mitigations state detection
Date: Fri, 13 Jun 2025 22:06:16 -0700 [thread overview]
Message-ID: <20250614050617.4161083-1-eddyz87@gmail.com> (raw)
If kernel executing selftests is configured with spectre mitigations
disabled, verification of unprivileged BPF won't emulate speculative
branches.
A number of selftests relies on speculative branches being visited.
In discussion [1] it was decided not to add additional tests
classification, but to execute unprivileged tests only when
mitigations are enabled.
Current mitigations status detection inspects /proc/cmdline,
which is not sufficient for some configurations.
This patch adds logic to also inspect /proc/config.gz and
/boot/config-$(uname -r).
Changelog:
v1: https://lore.kernel.org/bpf/20250610215221.846484-1-eddyz87@gmail.com/
v1 -> v2:
- added code to visit /boot/config-$(uname -r) (Yafang, Andrii)
- in case if config can't be read, print a warning and disable
unprivileged tests execution.
[1] https://lore.kernel.org/bpf/20231025031144.5508-1-laoar.shao@gmail.com/
Eduard Zingerman (1):
selftests/bpf: more precise cpu_mitigations state detection
tools/testing/selftests/bpf/unpriv_helpers.c | 94 +++++++++++++++++++-
1 file changed, 91 insertions(+), 3 deletions(-)
--
2.47.1
next reply other threads:[~2025-06-14 5:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-14 5:06 Eduard Zingerman [this message]
2025-06-14 5:06 ` [PATCH bpf-next v2 1/1] selftests/bpf: more precise cpu_mitigations state detection Eduard Zingerman
2025-06-15 2:18 ` Yafang Shao
2025-06-16 21:13 ` Andrii Nakryiko
2025-06-16 21:27 ` Eduard Zingerman
2025-06-16 23:36 ` Andrii Nakryiko
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=20250614050617.4161083-1-eddyz87@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=laoar.shao@gmail.com \
--cc=martin.lau@linux.dev \
--cc=mykyta.yatsenko5@gmail.com \
--cc=yonghong.song@linux.dev \
/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