В ядре Linux устранена следующая уязвимость: net/rds: использование wq_has_sleeper() в release_in_xmit() release_in_xmit() очищает RDS_IN_XMIT с помощью clear_bit_unlock(), а затем проверяет waitqueue_active(), чтобы решить, нужно ли кому-то бодрствовать. clear_bit_unlock() — это только операция релиза: он заказывает критическую секцию раньше бита, но не заказывает после нее. Сторона официанта делает зеркальное отражение - она добавляет себя в очередь ожидания, а затем проверяет бит. Это классический шаблон буферизации хранилища: выпускающий CPU может считывать очередь ожидания как пустую, в то время как ожидающий CPU все еще читает бит как набор, поэтому спящий никогда не просыпается.
Официантами являются rds_conn_shutdown() и rds_tcp_reset_callbacks(), оба в непрерывном wait_event() без тайм-аута. Потерянное пробуждение приводит к выключению рабочего на его однопоточном рабочем месте, пока какой-то другой отправитель не выпустит бит снова - и на соединении, которое разрывается именно потому, что оно не удалось, может никогда не быть другого отправителя. Раньше барьер был там: release_in_xmit() сделал clear_bit(), а затем smp_mb__after_atomic(), пока не совершит 1422f28826d2 («rds: ввести порядок приобретения / выпуска в acquire/release_in_xmit()»), сложенный в clear_bit_unlock(), который укрепил передачу блокировки, но молча сбросил полный барьер, от которого зависит проверка пробуждения.
Заправочный аналог, release_refill() в net/rds/ib_recv.c, по-прежнему имеет свой smp_mb__after_atomic() именно по этой причине. Используйте wq_has_sleeper(), который является waitqueue_active(), которому предшествует требуемый полный барьер.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/rds: use wq_has_sleeper() in release_in_xmit() release_in_xmit() clears RDS_IN_XMIT with clear_bit_unlock() and then checks waitqueue_active() to decide whether anyone needs waking. clear_bit_unlock() is only a release operation: it orders the critical section before the bit clear, but does not order the subsequent plain load of the wait queue head after it. The waiter side does the mirror image - it adds itself to the wait queue and then tests the bit. That is the classic store-buffering pattern: the releasing CPU can read the wait queue as empty while the waiting CPU still reads the bit as set, so the sleeper is never woken. The waiters are rds_conn_shutdown() and rds_tcp_reset_callbacks(), both in uninterruptible wait_event() with no timeout. A lost wake-up strands the shutdown worker on its single-threaded workqueue until some other sender releases the bit again - and on a connection that is being torn down precisely because it failed, there may never be another sender. The barrier used to be there: release_in_xmit() did clear_bit() followed by smp_mb__after_atomic() until commit 1422f28826d2 ("rds: introduce acquire/release ordering in acquire/release_in_xmit()") folded both into clear_bit_unlock(), which strengthened the lock hand-off but silently dropped the full barrier the wake-up check depends on. The refill counterpart, release_refill() in net/rds/ib_recv.c, still carries its smp_mb__after_atomic() for exactly this reason. Use wq_has_sleeper(), which is waitqueue_active() preceded by the required full barrier.
Характеристики атаки
Последствия
Строка CVSS v3.1
Уязвимые продукты 11
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.19.311
|
4.20
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.4.273
|
5.5
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.10.214
|
5.10.271
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.15.153
|
5.15.222
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.1.83
|
6.1.189
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.6.23
|
6.6.158
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7.11
|
6.8
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.8.2
|
6.12.111
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.53
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.2.7
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.3:rc1:*:*:*:*:*:*
|
— | — |