В ядре Linux была устранена следующая уязвимость: bpf: Утечка Fix mmap_lock в irq_work пути stack_map_get_build_id_offset() представила per-CPU irq_work для отсрочки mmap_read_unlock() из контекста NMI, а bpf_find_vma() позже повторно использовал тот же mmap_unlock_work. Оба абонента только проверяют, занята ли работа, прежде чем принять mmap_lock, поэтому вложенный абонент может повторно использовать слот до того, как первый абонент поставит его в очередь. Два замка чтения могут быть приобретены, в то время как только одна отложенная разблокировка запускается, протекая блокировку чтения и блокируя exit_mmap ().
Зарезервируйте слот для CPU перед mmap_read_trylock(). Используйте одну и ту же обертку в stackmap и bpf_find_vma (), чтобы оба вызывающего абонента выпустили резервирование при отказе trylock. Продолжайте отклонять слот, пока irq_work остается занятым.
Отпустите его после того, как вызов irq_work разблокирует мм.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix mmap_lock leak in irq_work path stack_map_get_build_id_offset() introduced a per-CPU irq_work to defer mmap_read_unlock() from NMI context, and bpf_find_vma() later reused the same mmap_unlock_work. Both callers only check whether the work is busy before taking mmap_lock, so a nested caller can reuse the slot before the first caller queues it. Two read locks may then be acquired while only one deferred unlock runs, leaking a read lock and blocking exit_mmap(). Reserve the per-CPU slot before mmap_read_trylock(). Use the same wrapper in stackmap and bpf_find_vma() so both callers release the reservation on trylock failure. Keep rejecting the slot while the irq_work remains busy. Release it after the irq_work callback unlocks the mm.