In the Linux kernel, the following vulnerability has been resolved: net/rds: acquire the fastpath locks in rds_conn_shutdown() rds_conn_shutdown() quiesces the transmit and receive-refill paths by waiting for RDS_IN_XMIT and RDS_RECV_REFILL to be sampled clear, and then runs the transport shutdown and rds_conn_path_reset(). Выборка битов не то же самое, что владение ими: в момент после возвращения wait_event() rds_send_xmit() может повторно приобрести RDS_IN_XMIT (или rds_ib_recv_refill() может повторно приобрести RDS_RECV_REFILL) и работать одновременно с распадом. Отправитель перепроверяет состояние соединения после взятия блокировки, но эта перепроверка является классическим шаблоном буферизации хранилища: разборка записывает состояние и читает бит, в то время как отправитель записывает бит и читает состояние. acquire_in_xmit() - это только операция получения, поэтому на слабо упорядоченных архитектурах обе стороны могут пропустить запись друг друга, и путь передачи затем выполняется, в то время как транспорт передает свои кольца (например, rds_ib_ring_init() и rds_send_path_reset).
Oracle UEK исправил тот же класс сбоев - 14-летний хвост BUG_ON()s в rds_ib_sub_signaled(), неожиданные операционные коды и разборки NULL в rds_ib_send_cqe_handler() во время отказоустойчивого тестирования - сделав путь разрыва *acquire * битовые блокировки быстрого пути вместо их тестирования ("rds: Make уверен, что путь передачи и разрыв соединения не происходят одновременно"). Владение одним словом определяется атомарностью RMW, поэтому кросс-переменное упорядочение не требуется. Сделайте то же самое здесь: возьмите оба замка, прежде чем вызвать остановку транспорта, удерживайте их через rds_conn_path_reset (), и отпустите их явно с последующим пробуждением.
Оба выпускаются с clear_bit_unlock(), так что повторная инициализация кольца, выполняемая остановкой транспорта, и состояние передачи, переписанное rds_send_path_reset(), упорядочены до того, как любой бит будет виден следующим acquire_in_xmit() или acquire_refill(). Пользователи Fastpath этих битов - rds_send_xmit() и rds_ib_recv_refill() - это стиль trylock и обратно, в то время как terrawdown владеет блокировками, поэтому для них не вводится новая зависимость от блокировки. rds_tcp_reset_callbacks() отличается: с предыдущего патча он также приобретает RDS_IN_XMIT, и он блокирует это, поэтому его ожидание теперь охватывает terrawdown вместо одной партии отправки. Этот официант работает от rds_tcp_accept_one() на однопоточном рабочем месте krdsd и удерживает rds_tcp_accept_lock и t_conn_path_lock, пока он ждет, поэтому дуэль SYN принимается, пока его путь сносится, парки принимают обработку на время разборки - для TCP, ограниченного (до 5 с) сливной петлей в rds_tcp_conn_path_shutdown().
Утечка IB в rds_ib_conn_path_shutdown() не имеет круглой крышки, но и не блокирует официанта: rds_tcp_reset_callbacks() является единственным блокирующим приобретателем этих битов и ждет только на своем собственном пути TCP, а фастпаты - trylock-and-back-off на обоих транспортах, поэтому длинный слив IB удлиняет только собственный путь. Окно узкое: проверка состояния на стороне принятия должна пройти до того, как разрыв сдвинет путь к RDS_CONN_DISCONNECTING. Поскольку krdsd является единым глобальным рабочим местом, все остальное стоит в очереди - принимать обработку для других соединений и пространств имен сети, а flush_workqueue(rds_wq) в rds_tcp_listen_stop () во время разбора пространства имен - ждет за припаркованным рабочим приемом в течение этого времени.
Он не может зайти в тупик, хотя ожидания указывают друг на друга: разбор блоков до тех пор, пока держатель бита не выпустит его, и держатель может быть тем, что krdsd принимает рабочий. Владелец заканчивает без необходимости чего-либо, что имеет разрыв: синхронизация отменяет проблемы rds_tcp_reset_callbacks (), нацеленные на cp_send_w и cp_recv_w на cp_wq, чей единственный слот исполнения занят заблокированным cp_down_w, поэтому они ожидают максимум и отменяются без смыва - зависимость от заказа cp_wq, которая теперь отмечается рядом с этими отменами (на - усечена -
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/rds: acquire the fastpath locks in rds_conn_shutdown() rds_conn_shutdown() quiesces the transmit and receive-refill paths by waiting for RDS_IN_XMIT and RDS_RECV_REFILL to be sampled clear, and then runs the transport shutdown and rds_conn_path_reset(). Sampling the bits clear is not the same as owning them: the moment after the wait_event() returns, rds_send_xmit() can re-acquire RDS_IN_XMIT (or rds_ib_recv_refill() can re-acquire RDS_RECV_REFILL) and run concurrently with the teardown. The sender does recheck the connection state after taking the lock, but that recheck is a classic store-buffering pattern: teardown writes the state and reads the bit while the sender writes the bit and reads the state. acquire_in_xmit() is only an acquire operation, so on weakly ordered architectures both sides can miss each other's write, and the transmit path then runs while the transport zeroes its rings (e.g. rds_ib_ring_init()) and rds_send_path_reset() rewrites the transmit state under it. Oracle UEK fixed the same class of crashes - a 14-year tail of BUG_ON()s in rds_ib_sub_signaled(), unexpected op-codes and NULL dereferences in rds_ib_send_cqe_handler() during failover testing - by making the teardown path *acquire* the fastpath bit locks instead of testing them ("rds: Make sure transmit path and connection tear-down does not run concurrently"). Ownership of a single word is decided by RMW atomicity, so no cross-variable ordering is needed. Do the same here: take both locks before calling the transport shutdown, hold them across rds_conn_path_reset(), and release them explicitly with a wake-up afterwards. Both are released with clear_bit_unlock(), so that the ring re-initialization done by the transport shutdown and the transmit state rewritten by rds_send_path_reset() are ordered before either bit is seen clear by the next acquire_in_xmit() or acquire_refill(). The fastpath users of these bits - rds_send_xmit() and rds_ib_recv_refill() - are trylock style and back off while teardown owns the locks, so no new lock dependency is introduced for them. rds_tcp_reset_callbacks() is different: since the previous patch it acquires RDS_IN_XMIT as well, and it blocks doing so, so its wait now spans the teardown instead of at most one send batch. That waiter runs from rds_tcp_accept_one() on the single-threaded krdsd workqueue and holds rds_tcp_accept_lock and t_conn_path_lock while it waits, so a duelling SYN accepted while its path is being torn down parks accept processing for the duration of the teardown - for TCP bounded by the (up to 5 s) drain loop in rds_tcp_conn_path_shutdown(). An IB path's drain in rds_ib_conn_path_shutdown() has no round cap, but no blocking waiter either: rds_tcp_reset_callbacks() is the only blocking acquirer of these bits and waits only on its own TCP path, and the fastpaths are trylock-and-back-off on both transports, so a long IB drain lengthens only that path's own quiesce. The window is narrow: the accept-side state check has to pass before the teardown moves the path to RDS_CONN_DISCONNECTING. Because krdsd is a single global workqueue, everything else queued there - accept processing for other connections and network namespaces, and the flush_workqueue(rds_wq) in rds_tcp_listen_stop() during namespace teardown - waits behind the parked accept worker for that time. It cannot deadlock, although the waits do point at each other: the teardown blocks until the bit's holder releases it, and the holder may be that krdsd accept worker. The holder finishes without needing anything the teardown owns: the sync cancels rds_tcp_reset_callbacks() issues target cp_send_w and cp_recv_w on the path's ordered cp_wq, whose only execution slot is occupied by the blocked cp_down_w itself, so they are pending at most and cancel without flushing - a reliance on cp_wq being ordered that is now noted next to those cancels (on ---truncated---
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
2.6.37
|
5.10.271
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.222
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.189
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.158
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
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:*:*:*:*:*:*
|
— | — |