In the Linux kernel, the following vulnerability has been resolved: net/sched: cls_u32: fix manual hash table handle IDR aliasing A u32 hash table created with an explicit handle ('tc filter add ... handle 801: u32 divisor N') keys its IDR entry on the raw handle, while the destroy paths free it under handle2id(handle). Два ключевых домена не согласуются для ручек в диапазоне htid 0x800..0xFFF: handle2id () складывает их обратно в автоматически выделенное пространство id (1..0x7FF). Поэтому ручная таблица оставляет недоступной запись с сырым ключом IDR при удалении (постоянная утечка), и ее удаление может привести к удалению записи IDR из несвязанного живого автоматического стола.
Более позднее автоматическое распределение может затем выдать ручку, которая называет живую ручную таблицу; u32_lookup_ht () поиск маршрутов первого соответствия и TCA_U32_LINK для этого htid в неправильную таблицу. Клавиша делитель-путь распределяется на handle2id(handle), поэтому распределение и удаление разделяют один ключевой домен. Ручная рукоятка, которая отображается на уже используемый идентификатор, отклоняется с помощью -ENOSPC, а автоматическое распределение пропускает идентификаторы, удерживаемые живыми ручными таблицами.
Conditions to recreate: ip link add test0 type dummy tc qdisc add dev test0 clsact tc filter add dev test0 ingress protocol ip pref 1 \ handle 801: u32 divisor 16 tc filter add dev test0 ingress protocol ip pref 2 u32 divisor 16 tc -d filter show dev test0 ingress | grep 'fh 801:' # unpatched: two live tables with handle 0x80100000 (the pref 2 root # hnode is auto-allocated id 1); patched: the auto hnode takes id 2. Также тестируется с poc с живой таблицей u32 на блоке, добавьте / удалите ручную таблицу «руководство 901: делитель u32 1» дважды; без исправления повторная добавка не работает с -ENOSPC, потому что необработанный ключ просочился при первом удалении.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/sched: cls_u32: fix manual hash table handle IDR aliasing A u32 hash table created with an explicit handle ('tc filter add ... handle 801: u32 divisor N') keys its IDR entry on the raw handle, while the destroy paths free it under handle2id(handle). The two key domains disagree for handles in the 0x800..0xFFF htid range: handle2id() folds them back into the auto-allocated id space (1..0x7FF). A manual table therefore leaves its raw-keyed IDR entry unreachable on delete (a permanent leak), and its delete can drop the idr entry of an unrelated live auto table. A later auto allocation can then hand out a handle that aliases the live manual table; u32_lookup_ht() first-match routes lookups and TCA_U32_LINK for that htid to the wrong table. Key the divisor-path alloc on handle2id(handle) so allocation and removal share one key domain. A manual handle that maps onto an id already in use is rejected with -ENOSPC, and auto allocation skips ids held by live manual tables. Conditions to recreate: ip link add test0 type dummy tc qdisc add dev test0 clsact tc filter add dev test0 ingress protocol ip pref 1 \ handle 801: u32 divisor 16 tc filter add dev test0 ingress protocol ip pref 2 u32 divisor 16 tc -d filter show dev test0 ingress | grep 'fh 801:' # unpatched: two live tables with handle 0x80100000 (the pref 2 root # hnode is auto-allocated id 1); patched: the auto hnode takes id 2. Also tested with a poc with a live u32 table on the block, add/delete a manual table 'handle 901: u32 divisor 1' twice; unpatched, the re-add fails with -ENOSPC because the raw key leaked on the first delete.