BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/1] selftests/bpf: more precise cpu_mitigations state detection
@ 2025-06-14  5:06 Eduard Zingerman
  2025-06-14  5:06 ` [PATCH bpf-next v2 1/1] " Eduard Zingerman
  0 siblings, 1 reply; 6+ messages in thread
From: Eduard Zingerman @ 2025-06-14  5:06 UTC (permalink / raw)
  To: bpf, ast, andrii
  Cc: daniel, martin.lau, kernel-team, yonghong.song, eddyz87,
	laoar.shao, mykyta.yatsenko5

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-16 23:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-14  5:06 [PATCH bpf-next v2 0/1] selftests/bpf: more precise cpu_mitigations state detection Eduard Zingerman
2025-06-14  5:06 ` [PATCH bpf-next v2 1/1] " 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox