В ядре Linux устранена следующая уязвимость:
l2tp: используйте refcount_inc_not_zero в l2tp_session_get_by_ifname
Читатель в l2tp_session_get_by_ifname() может вернуть указатель на
сеанс, счетчик ссылок которого достиг нуля. Добытчик берет свое
ссылка с помощью простого refcount_inc(), но любой другой метод получения сеанса
в том же файле (l2tp_v2_session_get, l2tp_v3_session_get и
соответствующие варианты _get_next) использует refcount_inc_not_zero()
потому что поиск IDR/RCU может состязаться с помощью refcount_dec_and_test() ->
l2tp_session_free() -> kfree_rcu(). Метод получения ifname является единственным
выброс; несоответствие было поднято в списке после 979c017803c4
(«l2tp: используйте list_del_rcu в l2tp_session_unhash»).
Читатель внутри rcu_read_lock_bh(), соответствующий session->ifname, может
быть вытеснено между strcmp() и refcount_inc(). Если
последняя ссылка попадает на другой процессор в этом окне, читатель
refcount_inc() выполняется на счетчике, который достиг нуля. refcount_t
улавливает сложение по нулю, печатает «refcount_t: сложение по 0;
use-after-free", насыщает счетчик и возвращает насыщенное значение.
указатель на вызывающего абонента. Память сеанса сохраняется в режиме реального времени в полете
раздел чтения RCU, но обратный вызов kfree_rcu() поставлен в очередь из
l2tp_session_free() освободит его после окончания льготного периода; а
вызывающий абонент, который разыменовывает возвращенный сеанс после этой точки, достигает
плита-использование после бесплатного использования.
В PREEMPT_RT local_bh_disable() является функцией для каждого процессора.
спальный замок и окно упреждения реальны; на складе
ядра local_bh_disable() — это приращение preempt_count, которое закрывает
межпроцессорная гонка на практике (см. ниже). Используйте refcount_inc_not_zero() и продолжайте обход списка в случае неудачи,
соответствие другим геттерам сеанса в файле. Метод получения ifname
является единственным методом получения сеанса в net/l2tp/, который все еще использует голый
шаблон refcount_inc(); это изменение восстанавливает внутренние файлы
консистенция.
Путь успеха неизменен.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname A reader in l2tp_session_get_by_ifname() can return a pointer to a session whose refcount has reached zero. The getter takes its reference with plain refcount_inc(), but every other session getter in the same file (l2tp_v2_session_get, l2tp_v3_session_get, and the corresponding _get_next variants) uses refcount_inc_not_zero() because the IDR/RCU lookup can race with refcount_dec_and_test() -> l2tp_session_free() -> kfree_rcu(). The ifname getter is the only outlier; the inconsistency was raised on-list after 979c017803c4 ("l2tp: use list_del_rcu in l2tp_session_unhash"). A reader inside rcu_read_lock_bh() that matches session->ifname can be preempted between the strcmp() and the refcount_inc(). If the last reference drops on another CPU in that window, the reader's refcount_inc() runs on a counter that has reached zero. refcount_t catches the addition-on-zero, prints "refcount_t: addition on 0; use-after-free", saturates the counter, and returns the saturated pointer to the caller. Session memory is held live by the in-flight RCU read section, but the kfree_rcu() callback queued from l2tp_session_free() will free it once the grace period closes; a caller that dereferences the returned session past that point hits a slab-use-after-free. On PREEMPT_RT local_bh_disable() is a per-CPU sleeping lock and the preemption window is real; on stock PREEMPT kernels local_bh_disable() is a preempt_count increment that closes the cross-CPU race in practice (see below). Use refcount_inc_not_zero() and continue the list walk on failure, matching the other session getters in the file. The ifname getter is the only session getter in net/l2tp/ that still uses the bare refcount_inc() pattern; this change restores file-internal consistency. The success path is unchanged.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.12
|
6.12.93
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.35
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.0.12
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.1:rc5:*:*:*:*:*:*
|
— | — |