В ядре Linux устранена следующая уязвимость:
sunrpc: закрепите svc_xprt в обратном вызове асинхронного подтверждения TLS.
svc_tcp_handshake() сохраняет необработанный указатель svc_xprt в
tls_handshake_args.ta_data и отправляет запрос через
tls_server_hello_x509(). Ядро рукопожатия занимает всего
sock_hold (req-> hr_sk); ничто не ссылается на структуру внедрения
svc_sock, который svc_tcp_handshake_done() достигает черезContainer_of(). Две близкие гонки оставляют запись обратного вызова в полете через освобожденную
svc_sock. svc_sock_free() вызывает tls_handshake_cancel() и отбрасывает
его возвращаемое значение: ложный возврат означает, что Handshake_complete() имеет
уже установлен HANDSHAKE_F_REQ_COMPLETED, но hp_done() может не иметь
завершено, но svc_sock_free() переходит к kfree(svsk).
Провал отмены-проигравшего внутри самой svc_tcp_handshake() производит
то же окно: когда wait_for_completion_interruptible_timeout()
возвращает <= 0 (тайм-аут или сигнал), а tls_handshake_cancel() возвращает
false, функция не сливает воду, возвращает и svc_handle_xprt()
вызывает svc_xprt_received(), который очищает XPT_BUSY и может удалить
последняя ссылка. Одновременное закрытие затем запускает svc_sock_free(), пока
svc_tcp_handshake_done() все еще обновляет xpt_flags и ходит
svsk->sk_handshake_done. Повреждение проявляется в виде set_bit/clear_bit RMW в освобожденном
xpt_flags slab и, как Complete_all(), идя и записывая
освобожден список wait_queue_head_t, встроенный в sk_handshake_done --
примитивное повреждение плиты, а не безобидное чтение.
Путь доступен
на любом сервере NFS с поддержкой TLS всякий раз, когда закрытие соединения перекрывается
окно доставки вызова tlshd; прерываемое ожидание означает
достаточно доставки сигнала, а не только истечения срока действия SVC_HANDSHAKE_TO. Возьмите svc_xprt_get(xprt) непосредственно перед tls_server_hello_x509().
поэтому обратный вызов в процессе выполнения имеет собственную ссылку. Выпустите его на
два ребра, где обратный вызов гарантированно не сработает - представление
сбой от tls_server_hello_x509() и успешный
tls_handshake_cancel() -- и в конце
svc_tcp_handshake_done() после Complete_all().
[cel: переписано сообщение фиксации, чтобы описать фактическое изменение]
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: sunrpc: pin svc_xprt across the asynchronous TLS handshake callback svc_tcp_handshake() stores the raw svc_xprt pointer in tls_handshake_args.ta_data and submits the request through tls_server_hello_x509(). The handshake core takes only sock_hold(req->hr_sk); nothing references the embedding struct svc_sock that svc_tcp_handshake_done() reaches via container_of(). Two close races leave the in-flight callback writing through a freed svc_sock. svc_sock_free() calls tls_handshake_cancel() and discards its return value: a false return means handshake_complete() has already set HANDSHAKE_F_REQ_COMPLETED but hp_done() may not have finished, yet svc_sock_free() proceeds to kfree(svsk). The cancel-loser fall-through inside svc_tcp_handshake() itself produces the same window: when wait_for_completion_interruptible_timeout() returns <= 0 (timeout or signal) and tls_handshake_cancel() returns false, the function does not drain, returns, and svc_handle_xprt() calls svc_xprt_received(), which clears XPT_BUSY and can drop the last reference. A concurrent close then runs svc_sock_free() while svc_tcp_handshake_done() is still updating xpt_flags and walking svsk->sk_handshake_done. The corruption surfaces as set_bit/clear_bit RMW into the freed xpt_flags slab slot and as complete_all() walking and writing the freed wait_queue_head_t list embedded in sk_handshake_done -- a slab-corruption primitive, not a benign read. The path is reachable on any TLS-enabled NFS server whenever a connection close overlaps the tlshd downcall delivery window; the interruptible wait means signal delivery suffices, not just SVC_HANDSHAKE_TO expiry. Take svc_xprt_get(xprt) immediately before tls_server_hello_x509() so the in-flight callback owns its own reference. Release it on the two edges where the callback is guaranteed not to fire -- submission failure from tls_server_hello_x509() and a successful tls_handshake_cancel() -- and at the tail of svc_tcp_handshake_done() after complete_all(). [cel: rewrote commit message to describe the actual change]
Характеристики атаки
Последствия
Строка CVSS v3.1