diff options
| author | Pu Lehui <pulehui@huawei.com> | 2026-07-28 02:54:57 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2026-07-30 15:29:51 -0700 |
| commit | 863f3ddd0b8ac65abfb50d3be0869268ac0e277b (patch) | |
| tree | b98e298350570b0fc987ab84b60812840c776da3 /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 5c5997836381010fc5907b36bc17d3b19407e933 (diff) | |
bpf: Fix potential UAF when reading bpf link info
In bpf_link_show_fdinfo and bpf_link_get_info_by_fd, link->prog is
accessed without holding any locks. If the prog is concurrently replaced
via bpf_link_update, the old prog can be freed, leading to a potential
UAF issue.
Fix this by accessing link->prog under RCU protection to safely fetch
the pointer and guarantee its lifetime while reading its fields.
Fixes: 0c991ebc8c69 ("bpf: Implement bpf_prog replacement for an active bpf_cgroup_link")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Reviewed-by: Amery Hung <ameryhung@gmail.com>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/bpf/f87b53c0-8f00-45a6-82db-8242fa9b143f@huaweicloud.com [0]
Link: https://lore.kernel.org/bpf/20260728025457.2814876-1-pulehui@huaweicloud.com
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions
