В ядре Linux устранена следующая уязвимость:
net/sched: sch_teql: ввести подчиненные_блокировки, чтобы избежать состояния гонки и UAF. Односвязный список teql master->slave не защищен от
несколько записей. Его можно модифицировать одновременно с помощью teql_master_xmit(),
teql_dequeue(), teql_init() и teql_destroy() без сохранения какого-либо списка
блокировка или защита RCU.
zdi-disclosures@trendmicro.com продемонстрировал, что qdisc освобожден.
после льготного периода RCU, но teql_master_xmit() выполняется на другом
ЦП все еще может удерживать устаревший указатель на список, что приводит к
использование плиты после бесплатного:
ОШИБКА: KASAN: slab-use-after-free в teql_master_xmit+0xf0f/0x16b0
Чтение размера 8 по адресу ffff888013fb0440 с помощью задачи poc/332.
Освобождена 512-байтовая область [ffff888013fb0400, ffff888013fb0600) (kmalloc-512). Исправление?
Добавьте спин-блокировку «slaves_lock» для каждого мастера, которая сериализует все изменения
master->slave и ссылки NEXT_SLAVE() в teql_destroy() и
teql_qdisc_init(). teql_master_xmit() также принимает тот же адрес_slave_lock
вокруг этих обновлений. Аннотируйте master->slave и указатель на подчиненное устройство ->next с помощью __rcu и
используйте соответствующие средства доступа RCU везде, где к ним прикасаются:
rcu_assign_pointer() на стороне записи (под подчиненным_lock),
rcu_dereference_protected() для загрузки на стороне записи (также в разделе
подчиненные_lock), rcu_dereference_bh() для загрузки в teql_master_xmit() и
rtnl_dereference() для загрузки в teql_master_open()/teql_master_mtu(),
которые работают под управлением RTNL.
Соедините это с rcu_read_lock_bh()/rcu_read_unlock_bh() вокруг списка.
обход в teql_master_xmit(), чтобы читатели либо наблюдали полностью
связанный список или откладываются до завершения текущей мутации. два
пути раннего возврата в teql_master_xmit() обновлены для освобождения RCU-bh
критическая секция на стороне чтения перед возвратом, так как если оставить ее удерживаемой, это приведет к
навсегда отключите BH на этом процессоре.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/sched: sch_teql: Introduce slaves_lock to avoid race condition and UAF The teql master->slaves singly linked list is not protected against multiple writes. It can be mod'ed concurently from teql_master_xmit(), teql_dequeue(), teql_init() and teql_destroy() without holding any list lock or RCU protection. zdi-disclosures@trendmicro.com has demonstrated that the qdisc is freed after an RCU grace period, but teql_master_xmit() running on another CPU can still hold a stale pointer into the list, resulting in a slab-use-after-free: BUG: KASAN: slab-use-after-free in teql_master_xmit+0xf0f/0x16b0 Read of size 8 at addr ffff888013fb0440 by task poc/332 Freed 512-byte region [ffff888013fb0400, ffff888013fb0600) (kmalloc-512) The fix? Add a per-master slaves_lock spinlock that serializes all mutations of master->slaves and the NEXT_SLAVE() links in teql_destroy() and teql_qdisc_init(). teql_master_xmit() also takes the same slaves_lock around those updates. Annotate master->slaves and the per-slave ->next pointer with __rcu and use the appropriate RCU accessors everywhere they are touched: rcu_assign_pointer() on the writer side (under slaves_lock), rcu_dereference_protected() for the writer-side loads (also under slaves_lock), rcu_dereference_bh() for the loads in teql_master_xmit() and rtnl_dereference() for the loads in teql_master_open()/teql_master_mtu(), which run under RTNL. Pair this with rcu_read_lock_bh()/rcu_read_unlock_bh() around the list traversal in teql_master_xmit(), so that readers either observe a fully linked list or are deferred until the in-flight mutation completes. The two early-return paths in teql_master_xmit() are updated to release the RCU-bh read-side critical section before returning, since leaving it held would disable BH on that CPU for good.
Характеристики атаки
Последствия
Строка CVSS v3.1