В ядре Linux устранена следующая уязвимость:
net/sched: sch_api: исправить путь ошибки xa_insert() в tcf_block_get_ext()
Эта команда:
$ tc qdisc replace dev eth0 ingress_block 1 egress_block 1 clsact
Ошибка: не удалось вставить блок разработчика: -EBUSY.
не удается, поскольку пользовательское пространство запрашивает тот же индекс блока, который должен быть установлен для
как вход, так и выход.
[примечание: я не думаю, что это даже не удалось до фиксации 913b47d3424e
(«net/sched: представить блок tc для отслеживания netdev ниже»), потому что это
это команда из моего старого набора заметок, которая раньше работала, но
увы, я не разделил это пополам с научной точки зрения]
Проблема не в том, что не получается, а в том, что со второго раза
вокруг, он выходит из строя по-другому (и безвозвратно):
$ tc qdisc replace dev eth0 ingress_block 1 egress_block 1 clsact
Ошибка: dsa_core: блок потока cb занят.
[еще одно примечание: дополнение добавлено мной в целях иллюстрации.
контекст проблемы заключается в том, что clsact_init() получает то же самое
указатель &q->ingress_block как &q->egress_block, и поскольку мы вызываем
tcf_block_get_ext() для них обоих, к имени будет добавлено «dev».
блок->ports xarray дважды, что приводит к сбою операции: один раз
указатель входного блока и еще раз через выходной блок
указатель. сама проблема в том, что при сбое xa_insert() у нас есть
отправил команду FLOW_BLOCK_BIND через ndo_setup_tc(), но
offload никогда не видит соответствующий FLOW_BLOCK_UNBIND. ]
Даже исправив неверный пользовательский ввод, мы все равно не сможем восстановить:
$ tc qdisc replace dev swp3 ingress_block 1 egress_block 2 clsact
Ошибка: dsa_core: блок потока cb занят. По сути, единственный способ восстановить систему — перезагрузить систему или отменить привязку и
перепривязать драйвер сетевого устройства. Чтобы исправить ошибку, нам нужно заполнить правильный путь удаления ошибки, который
был пропущен во время перемещения кода и вызовите tcf_block_offload_unbind()
когда xa_insert() завершается с ошибкой.
[последнее замечание: по сути, я виню в этом соглашение об именах меток.
tcf_block_get_ext() для устранения ошибки.
Этикетки должны быть названы в честь чего они это делают, а не после пути ошибки, который к ним переходит. Таким образом, это очевидно неправильно, что две метки, указывающие на один и тот же код, означают что-то не так, и проверяем корректность кода на сайте goto это тоже проще]
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/sched: sch_api: fix xa_insert() error path in tcf_block_get_ext() This command: $ tc qdisc replace dev eth0 ingress_block 1 egress_block 1 clsact Error: block dev insert failed: -EBUSY. fails because user space requests the same block index to be set for both ingress and egress. [ side note, I don't think it even failed prior to commit 913b47d3424e ("net/sched: Introduce tc block netdev tracking infra"), because this is a command from an old set of notes of mine which used to work, but alas, I did not scientifically bisect this ] The problem is not that it fails, but rather, that the second time around, it fails differently (and irrecoverably): $ tc qdisc replace dev eth0 ingress_block 1 egress_block 1 clsact Error: dsa_core: Flow block cb is busy. [ another note: the extack is added by me for illustration purposes. the context of the problem is that clsact_init() obtains the same &q->ingress_block pointer as &q->egress_block, and since we call tcf_block_get_ext() on both of them, "dev" will be added to the block->ports xarray twice, thus failing the operation: once through the ingress block pointer, and once again through the egress block pointer. the problem itself is that when xa_insert() fails, we have emitted a FLOW_BLOCK_BIND command through ndo_setup_tc(), but the offload never sees a corresponding FLOW_BLOCK_UNBIND. ] Even correcting the bad user input, we still cannot recover: $ tc qdisc replace dev swp3 ingress_block 1 egress_block 2 clsact Error: dsa_core: Flow block cb is busy. Basically the only way to recover is to reboot the system, or unbind and rebind the net device driver. To fix the bug, we need to fill the correct error teardown path which was missed during code movement, and call tcf_block_offload_unbind() when xa_insert() fails. [ last note, fundamentally I blame the label naming convention in tcf_block_get_ext() for the bug. The labels should be named after what they do, not after the error path that jumps to them. This way, it is obviously wrong that two labels pointing to the same code mean something is wrong, and checking the code correctness at the goto site is also easier ]
Характеристики атаки
Последствия
Строка CVSS v3.1
Уязвимые продукты 6
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.8
|
6.11.7
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.12:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.12:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.12:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.12:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.12:rc5:*:*:*:*:*:*
|
— | — |