bpf,fork: wipe ->bpf_storage before bailouts that access it
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ a10787e6d58c24b51e91c19c6d16c5da89fcaa4b · < 43f0005f81b8ce3be962d653cde8db9022f1e9b0| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf,fork: wipe ->bpf_storage before bailouts that access it
Currently, copy_process() can bail out to free_task() before p->bpf_storage has been initialized, with this call graph (shown here for the !CONFIG_MEMCG case):
copy_process dup_task_struct arch_dup_task_struct [copies the entire task_struct, including ->bpf_storage member] [RLIMIT_NPROC check fails] delayed_free_task free_task bpf_task_storage_free rcu_dereference(task->bpf_storage) bpf_local_storage_destroy
In this case, the nascent task's ->bpf_storage member that bpf_local_storage_destroy() operates on is a plain copy of the parent's ->bpf_storage pointer, not a real initialized pointer. This leads to badness (kernel hangs, UAF).
This is reachable as long as the process calling fork() has been inserted into a task storage map.
From the CVE record · Linux
The Linux kernel can free a newly copied task before its BPF task storage pointer is initialized. A local process calling fork() can trigger a kernel hang or use-after-free if it has been inserted into a task storage map and the fork fails at the process-limit check. No separate user interaction is described.
Anyone running the Linux kernel should check whether their kernel includes the affected BPF task storage and fork code; affected versions were not provided.