7.8high
bpf: Defer the free of inner map when necessary
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.25% (higher than 17% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Defer the free of inner map when necessary When updating or deleting an inner map in map array or map htab, the map may still be accessed by non-sleepable program or sleepable program. However bpf_map_fd_put_ptr() decreases the ref-counter of the inner map directly through bpf_map_put(), if the ref-counter is the last one (which is true for most cases), the inner map will be freed by ops->map_free() in a kworker. But for now, most .map_free() callbacks don't use synchronize_rcu() or its variants to wait for the elapse of a RCU grace period, so after the invocation of ops->map_free completes, the bpf program which is accessing the inner map may incur use-after-free problem. Fix the free of inner map by invoking bpf_map_free_deferred() after both one RCU grace period and one tasks trace RCU grace period if the inner map has been removed from the outer map before. The deferment is accomplished by using call_rcu() or call_rcu_tasks_trace() when releasing the last ref-counter of bpf map. The newly-added rcu_head field in bpf_map shares the same storage space with work field to reduce the size of bpf_map.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from bba1dc0b55ac462d24ed1228ad49800c238cd6d7 before 90c445799fd1dc214d7c6279c144e33a35e29ef2, from bba1dc0b55ac462d24ed1228ad49800c238cd6d7 before 37d98fb9c3144c0fddf7f6e99aece9927ac8dce6, from bba1dc0b55ac462d24ed1228ad49800c238cd6d7 before 62fca83303d608ad4fec3f7428c8685680bb01b0, from bba1dc0b55ac462d24ed1228ad49800c238cd6d7 before f91cd728b10c51f6d4a39957ccd56d1e802fc8ee, from bba1dc0b55ac462d24ed1228ad49800c238cd6d7 before bfd9b20c4862f41d4590fde11d70a5eeae53dcc5, from bba1dc0b55ac462d24ed1228ad49800c238cd6d7 before 876673364161da50eed6b472d746ef88242b2368, 5.9 Not affected: before 5.9, from 5.10.214 up to 5.10.*, from 5.15.153 up to 5.15.*, from 6.1.75 up to 6.1.*, from 6.6.14 up to 6.6.*, from 6.7.2 up to 6.7.* | CVE List |
| linux linux_kernel | from bba1dc0b55ac before 90c445799fd1, from bba1dc0b55ac before 37d98fb9c314, from bba1dc0b55ac before 62fca83303d6, from bba1dc0b55ac before f91cd728b10c, from bba1dc0b55ac before bfd9b20c4862, from bba1dc0b55ac before 876673364161, 5.9, from 5.9.0 before 5.10.214 and 4 more Not affected: before 5.9, from 5.10.214 up to 5.10.*, from 5.15.153 up to 5.15.*, from 6.1.75 up to 6.1.*, from 6.6.14 up to 6.6.*, from 6.7.2 up to 6.7.* | CVE List, NVD |
All scores
| Linux | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| CISA-ADP | 6.7medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H |
| NVD | 6.7medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: bpf: Defer the free of inner map when necessary When updating or deleting an inner map in map array or map htab, the map may still be accessed by non-sleepable program or sleepable program. However bpf_map_fd_put_ptr() decreases the ref-counter of the inner map directly through bpf_map_put(), if the ref-counter is the last one (which is true for most cases), the inner map will be freed by ops->map_free() in a kworker. But for now, most .map_free() callbacks don't use synchronize_rcu() or its variants to wait for the elapse of a RCU grace period, so after the invocation of ops->map_free completes, the bpf program which is accessing the inner map may incur use-after-free problem. Fix the free of inner map by invoking bpf_map_free_deferred() after both one RCU grace period and one tasks trace RCU grace period if the inner map has been removed from the outer map before. The deferment is accomplished by using call_rcu() or call_rcu_tasks_trace() when releasing the last ref-counter of bpf map. The newly-added rcu_head field in bpf_map shares the same storage space with work field to reduce the size of bpf_map.
NVD (es)
En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: bpf: posponer la liberación del mapa interno cuando sea necesario Al actualizar o eliminar un mapa interno en la matriz de mapas o en el htab de mapas, aún se puede acceder al mapa mediante un programa que no se puede dormir o un programa que se puede dormir. . Sin embargo, bpf_map_fd_put_ptr() disminuye el contador de referencias del mapa interno directamente a través de bpf_map_put(), si el contador de referencias es el último (lo cual es cierto en la mayoría de los casos), el mapa interno será liberado por ops->map_free() en un kworker. Pero por ahora, la mayoría de las devoluciones de llamada .map_free() no usan sincronizar_rcu() o sus variantes para esperar a que transcurra el período de gracia de RCU, por lo que después de que se completa la invocación de ops->map_free, el programa bpf que accede al interior El mapa puede sufrir un problema de uso después de su liberación. Corrija la liberación del mapa interno invocando bpf_map_free_deferred() después de un período de gracia de RCU y un período de gracia de seguimiento de tareas de RCU si el mapa interno se eliminó del mapa externo antes. El aplazamiento se logra utilizando call_rcu() o call_rcu_tasks_trace() al liberar el último contador de referencia del mapa bpf. El campo rcu_head recién agregado en bpf_map comparte el mismo espacio de almacenamiento con el campo de trabajo para reducir el tamaño de bpf_map.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-52447 changed 2026-10-15 | CVE Terms of Use |
| NVD | CVE-2023-52447 changed 2026-10-15 | Public domain |