bpf: fix end-of-list detection in cgroup_storage_get_next_key()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ de9cbbaadba5adf88a19e46df61f7054000838f6 · < 32ce55d424395904986f5066f8755f6cb9993377| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: fix end-of-list detection in cgroup_storage_get_next_key()
list_next_entry() never returns NULL -- when the current element is the last entry it wraps to the list head via container_of(). The subsequent NULL check is therefore dead code and get_next_key() never returns -ENOENT for the last element, instead reading storage->key from a bogus pointer that aliases internal map fields and copying the result to userspace.
Replace it with list_entry_is_head() so the function correctly returns -ENOENT when there are no more entries.
From the CVE record · Linux
The Linux kernel's BPF cgroup storage key iterator fails to detect the end of its list. When a caller requests the key after the last entry, it copies data from internal map fields to userspace instead of returning an end-of-list error. The input does not specify access requirements or whether user interaction is needed.
Engineers running Linux kernels with BPF cgroup storage should check their versions; affected versions are not specified.