Skip to content

Add return value check for BPF_LSM_CGROUP#12168

Open
kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
bpf_basefrom
series/1099759=>bpf
Open

Add return value check for BPF_LSM_CGROUP#12168
kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
bpf_basefrom
series/1099759=>bpf

Conversation

@kernel-patches-daemon-bpf
Copy link
Copy Markdown

Pull request for series with
subject: Add return value check for BPF_LSM_CGROUP
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1099759

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 49b1831
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1099759
version: 1

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 7dd6256
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1099759
version: 1

Xu Kuohai added 2 commits May 23, 2026 07:59
BPF_LSM_CGROUP programs use bpf_set_retval() helper to set the return
value, but the value is not validated. This could cause kernel panic
similar to the bug fixed by commit 5d99e19 ("bpf, lsm: Add check
for BPF LSM return value").

Fix it by verifying the argument for bpf_set_retval() falls within the
valid return value range for the target hook.

Fixes: 69fd337 ("bpf: per-cgroup lsm flavor")
Reported-by: Quan Sun <2022090917019@std.uestc.edu.cn>
Closes: https://lore.kernel.org/all/567d3206-74a5-44e5-99c6-779c425f399e@std.uestc.edu.cn
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Add tests to check return values set by bpf_set_retval() helper for lsm
cgroup programs.

Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants