bpf: Fix potential UAF when reading bpf link info
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 0c991ebc8c69d29b7fc44db17075c5aa5253e2ab · < 863f3ddd0b8ac65abfb50d3be0869268ac0e277b| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
The Linux kernel reads a BPF link's program pointer without protection when showing file-descriptor information or retrieving link information. If the program is replaced concurrently, the old program may be freed, causing a potential use-after-free. The input does not specify access requirements or user interaction.
Engineers running Linux kernels with the affected BPF link code should check their kernel version; affected versions are not specified.