Ad

CVE-2022-49789

HIGH CVSS 3.1: 7,8 EPSS 0.20%
Обновлено 4 августа 2026
Linux
Параметр Значение
CVSS 7,8 (HIGH)
Уязвимые версии 2.6.34 — 6.0.10
Устранено в версии 5.4.225
Тип уязвимости CWE-415 (Двойное освобождение памяти)
Поставщик Linux
Публичный эксплойт Нет

В ядре Linux устранена следующая уязвимость: scsi: zfcp: исправлено двойное освобождение запроса FSF при сбое отправки qdio. Раньше мы использовали неправильный тип целого числа в zfcp_fsf_req_send() для кэширования. идентификатор запроса FSF при отправке нового запроса FSF. Это используется в том случае, если отправка не удалась и нам нужно удалить запрос из нашего внутреннего хеша таблицу еще раз (чтобы мы не сохраняли недействительную ссылку и не использовали ее, когда освобождаем запрос еще раз).

В «zfcp_fsf_req_send()» мы кэшировали идентификатор как «int» (со знаком и 32). немного шире), но остальная часть кода zfcp (и спецификация прошивки) обрабатывает идентификатор как 'unsigned long'/'u64' (беззнаковый и 64-битный [s390x ЭЛЬФ АБИ]). Во-первых, это очевидная проблема: когда идентификатор растет после 32 бит (это может произойти достаточно быстро) он усекается до 32 бит при сохранении его в переменной кеша и поэтому не соответствует исходному идентификатору больше. Вторая менее очевидная проблема заключается в том, что даже если исходный идентификатор еще не перерос 32-битный, как только 32-й бит установлен в исходный идентификатор (0x80000000 = 2'147'483'648), у нас будет несоответствие, когда мы верните его обратно в «unsigned long».

Поскольку кэшированная переменная имеет знак типа, компилятор выберет инструкцию расширения знака для загрузки 32 битовую переменную в 64-битный регистр (например: «lgf %r11,188(%r15)»). Итак, однажды мы передаем кешированную переменную в zfcp_reqlist_find_rm(), чтобы удалить повторите запрос, все ведущие нули будут заменены на единицы, чтобы расширить подписать и больше не будет соответствовать исходному идентификатору (это наблюдалось в практика). Если мы не сможем снова успешно удалить запрос из хеш-таблицы после «zfcp_qdio_send()» завершается сбоем (это происходит регулярно, когда zfcp не может уведомить адаптер о новой работе, потому что адаптер уже пропал во время например переключатель ChpID), в итоге мы получим двойное бесплатное значение.

Мы безоговорочно освободить запрос в вызывающей функции в случае сбоя zfcp_fsf_req_send(), но поскольку запрос все еще находится в хеш-таблице, мы получаем устаревший результат. ссылка на память, и после сброса адаптера zfcp во время восстановления или выключение, мы в конечном итоге освобождаем одну и ту же память дважды. Полученные трассировки стека различаются в зависимости от ядра и не имеют прямого значения. корреляция с местом возникновения ошибки. Вот три примера, которые были замечены на практике: list_del повреждение. next->prev должно быть 00000001b9d13800, но было 00000000dead4ead. (следующий=00000001bd131a00) ------------[вырезать здесь]------------ ОШИБКА ядра в lib/list_debug.c:62! событие мониторинга: 0040 ilc:2 [#1] PREEMPT SMP Модули, связанные в: ...

ЦП: 9 PID: 1617 Связь: zfcperp0.0.1740 Kdump: загружено Имя оборудования: ... Krnl PSW: 0704d00180000000 00000003cbeea1f8 (__list_del_entry_valid+0x98/0x140) R:0 T:1 IO:1 EX:1 Ключ:0 M:1 W:0 P:0 AS:3 CC:1 PM:0 RI:0 EA:3 Крнл GPRS: 00000000916d12f1 0000000080000000 000000000000006d 00000003cb665cd6 0000000000000001 0000000000000000 0000000000000000 00000000d28d21e8 00000000d3844000 00000380099efd28 00000001bd131a00 00000001b9d13800 00000000d3290100 0000000000000000 00000003cbeea1f4 00000380099efc70 Код Krnl: 00000003cbeea1e8: c020004f68a7 larl %r2,00000003cc8d7336 00000003cbeea1ee: c0e50027fd65 brasl %r14,00000003cc3e9cb8 #00000003cbeea1f4: af000000 мс 0,0 >00000003cbeea1f8: c02000920440 ларл %r2,00000003cd12aa78 00000003cbeea1fe: c0e500289c25 brasl %r14,00000003cc3fda48 00000003cbeea204: b9040043 lgr %r4, %r3 00000003cbeea208: b9040051 lgr %r5, %r1 00000003cbeea20c: b9040032 lgr %r3, %r2 Отслеживание вызова: [<00000003cbeea1f8>] __list_del_entry_valid+0x98/0x140 ([<00000003cbeea1f4>] __list_del_entry_valid+0x94/0x140) [<000003ff7ff502fe>] zfcp_fsf_req_dismiss_all+0xde/0x150 [zfcp] [<000003ff7ff49cd0>] zfcp_erp_strategy_do_action+0x160/0x280 [zfcp] ---усечено---

Показать оригинальное описание (EN)

In the Linux kernel, the following vulnerability has been resolved: scsi: zfcp: Fix double free of FSF request when qdio send fails We used to use the wrong type of integer in 'zfcp_fsf_req_send()' to cache the FSF request ID when sending a new FSF request. This is used in case the sending fails and we need to remove the request from our internal hash table again (so we don't keep an invalid reference and use it when we free the request again). In 'zfcp_fsf_req_send()' we used to cache the ID as 'int' (signed and 32 bit wide), but the rest of the zfcp code (and the firmware specification) handles the ID as 'unsigned long'/'u64' (unsigned and 64 bit wide [s390x ELF ABI]). For one this has the obvious problem that when the ID grows past 32 bit (this can happen reasonably fast) it is truncated to 32 bit when storing it in the cache variable and so doesn't match the original ID anymore. The second less obvious problem is that even when the original ID has not yet grown past 32 bit, as soon as the 32nd bit is set in the original ID (0x80000000 = 2'147'483'648) we will have a mismatch when we cast it back to 'unsigned long'. As the cached variable is of a signed type, the compiler will choose a sign-extending instruction to load the 32 bit variable into a 64 bit register (e.g.: 'lgf %r11,188(%r15)'). So once we pass the cached variable into 'zfcp_reqlist_find_rm()' to remove the request again all the leading zeros will be flipped to ones to extend the sign and won't match the original ID anymore (this has been observed in practice). If we can't successfully remove the request from the hash table again after 'zfcp_qdio_send()' fails (this happens regularly when zfcp cannot notify the adapter about new work because the adapter is already gone during e.g. a ChpID toggle) we will end up with a double free. We unconditionally free the request in the calling function when 'zfcp_fsf_req_send()' fails, but because the request is still in the hash table we end up with a stale memory reference, and once the zfcp adapter is either reset during recovery or shutdown we end up freeing the same memory twice. The resulting stack traces vary depending on the kernel and have no direct correlation to the place where the bug occurs. Here are three examples that have been seen in practice: list_del corruption. next->prev should be 00000001b9d13800, but was 00000000dead4ead. (next=00000001bd131a00) ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:62! monitor event: 0040 ilc:2 [#1] PREEMPT SMP Modules linked in: ... CPU: 9 PID: 1617 Comm: zfcperp0.0.1740 Kdump: loaded Hardware name: ... Krnl PSW : 0704d00180000000 00000003cbeea1f8 (__list_del_entry_valid+0x98/0x140) R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:1 PM:0 RI:0 EA:3 Krnl GPRS: 00000000916d12f1 0000000080000000 000000000000006d 00000003cb665cd6 0000000000000001 0000000000000000 0000000000000000 00000000d28d21e8 00000000d3844000 00000380099efd28 00000001bd131a00 00000001b9d13800 00000000d3290100 0000000000000000 00000003cbeea1f4 00000380099efc70 Krnl Code: 00000003cbeea1e8: c020004f68a7 larl %r2,00000003cc8d7336 00000003cbeea1ee: c0e50027fd65 brasl %r14,00000003cc3e9cb8 #00000003cbeea1f4: af000000 mc 0,0 >00000003cbeea1f8: c02000920440 larl %r2,00000003cd12aa78 00000003cbeea1fe: c0e500289c25 brasl %r14,00000003cc3fda48 00000003cbeea204: b9040043 lgr %r4,%r3 00000003cbeea208: b9040051 lgr %r5,%r1 00000003cbeea20c: b9040032 lgr %r3,%r2 Call Trace: [<00000003cbeea1f8>] __list_del_entry_valid+0x98/0x140 ([<00000003cbeea1f4>] __list_del_entry_valid+0x94/0x140) [<000003ff7ff502fe>] zfcp_fsf_req_dismiss_all+0xde/0x150 [zfcp] [<000003ff7ff49cd0>] zfcp_erp_strategy_do_action+0x160/0x280 [zfcp] ---truncated---

Характеристики атаки

Способ атаки
Локальный
Нужен локальный доступ
Сложность
Низкая
Легко эксплуатировать
Нужны права
Низкие
Нужны базовые права
Участие пользователя
Не требуется
Не нужно действие пользователя

Последствия

Конфиденциальность
Высокое
Полная утечка данных
Целостность
Высокое
Полная модификация данных
Доступность
Высокое
Полный отказ в обслуживании

Строка CVSS v3.1

Уязвимые продукты 9

Конфигурация От (включительно) До (исключительно)
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
2.6.34 5.4.225
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
5.5 5.10.156
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
5.11 5.15.80
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
5.16 6.0.10
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc1:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc2:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc3:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc4:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.1:rc5:*:*:*:*:*:*
— —