В ядре Linux устранена следующая уязвимость:
bpf: исправлен эффективный индекс массива программ с помощью BPF_F_PREORDER.
replace_efficient_prog() и purge_efficient_progs() нашли слот в
эффективный массив путем обхода списка программ и подсчета записей
линейно. Это количество не соответствует макету массива: Compute_efficient_
progs() помещает программы BPF_F_PREORDER вперед (предковая cgroup
сначала установите порядок внутри контрольной группы), а остальные после них (потомок
сначала cgroup). Таким образом, при наличии программы предварительного заказа линейный список
позиция больше не равна индексу программы в эффективном массиве.
Для replace_efficient_prog() (bpf_link_update()) это перезаписало
неправильный слот, нарушая эффективный порядок. Для purge_efficient_progs(),
он может подделать слот, принадлежащий другой программе, и оставить
отдельная программа в массиве, в то время как bpf_prog_put() удаляет ее ссылку,
то есть использование после освобождения. Исправьте и то, и другое, воспроизведя размещение Compute_efficient_progs() (включая
отмену предварительного заказа для каждой контрольной группы) в общей функции effect_prog_pos().
помощник.
Вместо этого идентифицируйте запись по ее указателю struct bpf_prog_list.
чем по значению (prog, link), поэтому поиск приводит именно к
прикрепить выбранный системный вызов, даже если подключен тот же самый bpf_prog
нескольким контрольным группам в иерархии.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix effective prog array index with BPF_F_PREORDER replace_effective_prog() and purge_effective_progs() located the slot in the effective array by walking the program hlist and counting entries linearly. That count does not match the array layout: compute_effective_ progs() places BPF_F_PREORDER programs at the front (ancestor cgroup first, attach order within a cgroup) and the rest after them (descendant cgroup first). So when a preorder program is present, the linear hlist position no longer equals the program's index in the effective array. For replace_effective_prog() (bpf_link_update()) this overwrote the wrong slot, corrupting the effective order. For purge_effective_progs(), it could dummy out a slot belonging to a different program and leave the detached program in the array while bpf_prog_put() drops its reference, i.e. a use-after-free. Fix both by replaying compute_effective_progs()'s placement (including the per-cgroup preorder reversal) in a shared effective_prog_pos() helper. Identify the entry by its struct bpf_prog_list pointer rather than by (prog, link) value, so the lookup resolves to exactly the attachment the syscall selected even when the same bpf_prog is attached to several cgroups in the hierarchy.
Характеристики атаки
Последствия
Строка CVSS v3.1