В ядре Linux устранена следующая уязвимость:
net/smc: исправлено использование сокета после освобождения во время завершения группы каналов.
__smc_lgr_terminate() удаляет conns_lock после обнаружения соединения в
lgr->conns_all, но перед получением ссылки на его сокет. Связь
встроен в сокет, и его регистрационная ссылка защищает только его.
при этом соединение остается в дереве. Одновременное закрытие может отменить регистрацию соединения и удалить эту ссылку.
освобождение сокета до того, как работник завершения достигнет sock_hold().
Гонка становится достижимой, когда близкое перекрытие группы каналов завершается. Локальное стресс-тестирование воспроизвело использование после освобождения, и KASAN сообщил:
ОШИБКА: KASAN: slab-use-after-free в __smc_lgr_terminate.part.0 [smc]
Запись размера 4 по задаче kworker/3:3
Рабочая очередь: события smc_lgr_terminate_work [smc]
__smc_lgr_terminate.part.0 [smc]
Сокет был выделен smc_create(), освобожден через
slab_free_after_rcu_debug(), за которым последовало:
refcount_t: добавление по 0; использовать после бесплатно.
__smc_lgr_terminate.part.0 [smc]
Возьмите ссылку на сокет, пока conns_lock все еще защищает запись в дереве. Путь отмены регистрации не может удалить последнюю ссылку до завершения.
закончил использовать сокет.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/smc: fix socket use-after-free during link group termination __smc_lgr_terminate() drops conns_lock after finding a connection in lgr->conns_all, but before taking a reference on its socket. The connection is embedded in the socket, and its registration reference protects it only while the connection remains in the tree. A concurrent close can unregister the connection and drop that reference, freeing the socket before the termination worker reaches sock_hold(). The race is reachable when close overlaps link group termination. Local stress testing reproduced the use-after-free and KASAN reported: BUG: KASAN: slab-use-after-free in __smc_lgr_terminate.part.0 [smc] Write of size 4 by task kworker/3:3 Workqueue: events smc_lgr_terminate_work [smc] __smc_lgr_terminate.part.0 [smc] The socket was allocated by smc_create(), freed through slab_free_after_rcu_debug(), and was followed by: refcount_t: addition on 0; use-after-free. __smc_lgr_terminate.part.0 [smc] Take the socket reference while conns_lock still protects the tree entry. The unregister path then cannot drop the last reference until termination has finished using the socket.
Характеристики атаки
Последствия
Строка CVSS v3.1