В ядре Linux была устранена следующая уязвимость: RDMA/rxe: Avoid перерабатывает текущий пакет после того, как QP входит в состояние ошибки When do_complete() находит QP в состоянии ошибки он возвращает RESPST_CHK_RESOURCE. Перед фиксацией 49dc9c1f0c7e («RDMA/rxe: Cleanup reset state handling in rxe_resp.c») это был флеш-петль: check_resource() имел ветку состояния ошибки, которая доставала каждый оставшийся recv WQE и завершала его с IB_WC_WR_FLUSH_ERR, не касаясь текущего пакета. Эта фиксация удалила ветку error-state из check_resource() (теперь дренаж выполняется в записи rxe_receiver(), но сохранила возврат error-state do_complete().
В результате, когда QP переходит в состояние ошибки, в то время как пакет завершается - например, rdma_cm разъединяет гонку с обработкой приема - машина состояния ответчика возвращается в цепочку обработки запроса с уже завершенным пакетом: check_resource() получает свежий recv WQE, execute()/send_data_in() копирует ту же полезную нагрузку пакета снова, do_complete() отправляет еще IB_WC_SUCCESS CQE (qp->resp.status - все еще 0), и возвращает контроль. The loop re-executes the same packet once per posted recv WQE (observed: ~1000 duplicate IB_WC_SUCCESS completions of one SEND, one per ~8us, matching the RQ occupancy) until the RQ is exhausted, after which qp->resp.wqe is NULL and send_data_in() dereferences it: BUG: kernel NULL pointer dereference, address: 0000000000000014 Workqueue: rxe_wq do_work RIP: copy_data+0x29/0x1f0 Call Trace: send_data_in+0x25/0x50 rxe_receiver+0xf36/0x1dd0 The duplicate completions are indistinguishable from real receives to the ULP. Во время стресс-теста rds сообщение принималось как новое и доставляло одну и ту же дейтаграмму в пользовательское пространство сотни раз, повреждая поток; любой ULP, который полагается на RC, подвергается воздействию точно один раз.
Живой пакет, достигающий проверки состояния ошибки в do_complete(), был выполнен и завершен ровно один раз и должен быть использован, а не повторно обработан. Верните RESPST_CLEANUP для него (очерёдно и бесплатно); продолжайте возвращать RESPST_CHK_RESOURCE для случая pkt NULL.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: RDMA/rxe: Avoid reprocessing the current packet after the QP enters the error state When do_complete() finds the QP in the error state it returns RESPST_CHK_RESOURCE. Before commit 49dc9c1f0c7e ("RDMA/rxe: Cleanup reset state handling in rxe_resp.c") this was the flush loop: check_resource() had an error-state branch that fetched each remaining recv WQE and completed it with IB_WC_WR_FLUSH_ERR, without touching the current packet. That commit removed the error-state branch from check_resource() (draining is now done at rxe_receiver() entry) but kept the do_complete() error-state return. As a result, when a QP moves to the error state while a packet is being completed - e.g. an rdma_cm disconnect racing with receive processing - the responder state machine loops back into the request processing chain with the already-completed packet still in hand: check_resource() fetches a fresh recv WQE, execute()/send_data_in() copies the same packet payload again, do_complete() posts another IB_WC_SUCCESS CQE (qp->resp.status is still 0), and control returns to the error-state check. The loop re-executes the same packet once per posted recv WQE (observed: ~1000 duplicate IB_WC_SUCCESS completions of one SEND, one per ~8us, matching the RQ occupancy) until the RQ is exhausted, after which qp->resp.wqe is NULL and send_data_in() dereferences it: BUG: kernel NULL pointer dereference, address: 0000000000000014 Workqueue: rxe_wq do_work RIP: copy_data+0x29/0x1f0 Call Trace: send_data_in+0x25/0x50 rxe_receiver+0xf36/0x1dd0 The duplicate completions are indistinguishable from real receives to the ULP. During an rds stress test, the message was accepted as new and delivered the same datagram to user space hundreds of times, corrupting the stream; any ULP that relies on RC exactly-once delivery is affected. A live packet reaching the error-state check in do_complete() has been executed and completed exactly once and must be consumed, not re-processed. Return RESPST_CLEANUP for it (dequeue and free); keep returning RESPST_CHK_RESOURCE for the pkt == NULL case.
Характеристики атаки
Последствия
Строка CVSS v3.1