All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf 0/2] Add return value check for BPF_LSM_CGROUP
@ 2026-05-23  8:58 Xu Kuohai
  2026-05-23  8:58 ` [PATCH bpf 1/2] bpf: " Xu Kuohai
  2026-05-23  8:58 ` [PATCH bpf 2/2] selftests/bpf: Add return value tests for lsm cgroup Xu Kuohai
  0 siblings, 2 replies; 9+ messages in thread
From: Xu Kuohai @ 2026-05-23  8:58 UTC (permalink / raw)
  To: bpf, linux-kernel
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Yonghong Song, Stanislav Fomichev, Matt Bobrowski, Quan Sun

Quan Sun reported a NULL pointer dereference caused by invalid return value of
BPF_LSM_CGROUP program [1].

The cause is that the BPF_LSM_CGROUP programs use bpf_set_retval() helper to
set return value for the target LSM hook, and the value is not validated,
making any arbitrary value legally accepted.

To fix it, add return value check for BPF_LSM_CGROUP programs. 

[1] https://lore.kernel.org/all/567d3206-74a5-44e5-99c6-779c425f399e@std.uestc.edu.cn

Xu Kuohai (2):
  bpf: Add return value check for BPF_LSM_CGROUP
  selftests/bpf: Add return value tests for lsm cgroup

 kernel/bpf/verifier.c                         | 10 +++++
 .../selftests/bpf/progs/verifier_lsm.c        | 45 +++++++++++++++++++
 2 files changed, 55 insertions(+)

-- 
2.43.0


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

end of thread, other threads:[~2026-05-26  7:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-23  8:58 [PATCH bpf 0/2] Add return value check for BPF_LSM_CGROUP Xu Kuohai
2026-05-23  8:58 ` [PATCH bpf 1/2] bpf: " Xu Kuohai
2026-05-23  9:48   ` sashiko-bot
2026-05-25  8:57     ` Xu Kuohai
2026-05-23  8:58 ` [PATCH bpf 2/2] selftests/bpf: Add return value tests for lsm cgroup Xu Kuohai
2026-05-23 10:08   ` sashiko-bot
2026-05-25  1:56     ` Xu Kuohai
2026-05-25 18:43   ` Emil Tsalapatis
2026-05-26  7:56     ` Xu Kuohai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.