Add return value check for BPF_LSM_CGROUP#12168
Open
kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
Open
Add return value check for BPF_LSM_CGROUP#12168kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
Conversation
Author
|
Upstream branch: 49b1831 |
bdffe6c to
0bc2057
Compare
Author
|
Upstream branch: 7dd6256 |
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>
9f7b2fb to
aa2f9a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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