bpf: Mark bpf_btf_find_by_name_kind() as sleepable
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3d78417b60fba249cc555468cb72d96f5cde2964 · < 620614bf7672130c43b3cff375525a2202f61979| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Mark bpf_btf_find_by_name_kind() as sleepable
When bpf_btf_find_by_name_kind() finds a type in module BTF, it returns a new BTF object fd through __btf_new_fd(). This reaches anon_inode_getfd(), which can sleep while allocating or expanding the current task fd table.
The helper prototype does not set might_sleep, so the verifier allows the helper in non-sleepable contexts such as BPF timer callbacks. The fd allocation can then sleep in softirq context and install the fd into the interrupted task.
Mark the helper as sleepable. This preserves calls from the main body of a sleepable syscall program while rejecting calls from its non-sleepable regions.
From the CVE record · Linux
The Linux kernel’s bpf_btf_find_by_name_kind() helper can allocate a file descriptor when it finds a type in module BTF. If called from a non-sleepable context such as a BPF timer callback, that allocation can sleep in softirq context and install the descriptor into the interrupted task. The input does not specify authentication requirements or user interaction.
Engineers running Linux kernels that provide this BPF helper should check their exposure; affected versions are not specified.