В ядре Linux устранена следующая уязвимость:
dm array: исправлено двойное освобождение ошибочного блока массива в dm_array_cursor_end. Когда dm_bm_read_lock() завершается сбоем из-за ошибок блокировки или контрольной суммы, он
неявно освобождает неисправный блок, оставляя неверный вывод
указатель сзади. Вызывающий dm_bm_read_lock() не должен работать
этот неверный указатель dm_block, иначе это приведет к неопределенному результату.
Например, dm_array_cursor неправильно кэширует неверный указатель.
при чтении ошибочного блока массива, что приводит к двойному освобождению
dm_array_cursor_end(), затем нажимаем BUG_ON в dm-bufio cache_put(). Воспроизведите шаги:
1. инициализировать кэш-устройство
dmsetup создать cmeta --table "0 8192 линейный /dev/sdc 0"
dmsetup создать cdata --table "0 65536 линейный /dev/sdc 8192"
dmsetup create corig --table "0 524288 линейный /dev/sdc $262144"
dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1
dmsetup создать кэш --table "0 524288 кэш /dev/mapper/cmeta \
/dev/mapper/cdata /dev/mapper/corig 128 2 сквозная запись метаданных 2 smq 0"
2. стереть второй блок массива в автономном режиме
dmsteup удалить кеш cmeta cdata corig
Mapping_root=$(dd if=/dev/sdc bs=1c count=8 Skip=192 \
2>/dev/ноль | hexdump -e '1/8 "%u\n"')
ablock=$(dd if=/dev/sdc bs=1c count=8 Skip=$((4096*mapping_root+2056)) \
2>/dev/ноль | hexdump -e '1/8 "%u\n"')
dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock
3. попробуйте снова открыть кэш-устройство
dmsetup создать cmeta --table "0 8192 линейный /dev/sdc 0"
dmsetup создать cdata --table "0 65536 линейный /dev/sdc 8192"
dmsetup create corig --table "0 524288 линейный /dev/sdc $262144"
dmsetup создать кэш --table "0 524288 кэш /dev/mapper/cmeta \
/dev/mapper/cdata /dev/mapper/corig 128 2 сквозная запись метаданных 2 smq 0"
Журналы ядра:
(отрывок)
устройство-сопоставитель: массив: array_block_check не удалось: номер блока 0 != требуется 10
устройство-сопоставитель: диспетчер блоков: проверка валидатора массива не удалась для блока 10
устройство-сопоставитель: массив: ошибка get_ablock
устройство-сопоставитель: метаданные кэша: dm_array_cursor_next для сопоставления не удалось
------------[вырезать здесь]------------
ОШИБКА ядра в драйверах/md/dm-bufio.c:638!
Исправьте это, установив для указателя кэшированного блока значение NULL в случае ошибок. Помимо описанного выше репродуктора, этот фикс можно
проверено с помощью теста «array_cursor/damaged» в dm-unit:
dm-unit run /pdata/array_cursor/damaged --kernel-dir <KERNEL_DIR>
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: dm array: fix releasing a faulty array block twice in dm_array_cursor_end When dm_bm_read_lock() fails due to locking or checksum errors, it releases the faulty block implicitly while leaving an invalid output pointer behind. The caller of dm_bm_read_lock() should not operate on this invalid dm_block pointer, or it will lead to undefined result. For example, the dm_array_cursor incorrectly caches the invalid pointer on reading a faulty array block, causing a double release in dm_array_cursor_end(), then hitting the BUG_ON in dm-bufio cache_put(). Reproduce steps: 1. initialize a cache device dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc $262144" dd if=/dev/zero of=/dev/mapper/cmeta bs=4k count=1 dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \ /dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" 2. wipe the second array block offline dmsteup remove cache cmeta cdata corig mapping_root=$(dd if=/dev/sdc bs=1c count=8 skip=192 \ 2>/dev/null | hexdump -e '1/8 "%u\n"') ablock=$(dd if=/dev/sdc bs=1c count=8 skip=$((4096*mapping_root+2056)) \ 2>/dev/null | hexdump -e '1/8 "%u\n"') dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock 3. try reopen the cache device dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc $262144" dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \ /dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" Kernel logs: (snip) device-mapper: array: array_block_check failed: blocknr 0 != wanted 10 device-mapper: block manager: array validator check failed for block 10 device-mapper: array: get_ablock failed device-mapper: cache metadata: dm_array_cursor_next for mapping failed ------------[ cut here ]------------ kernel BUG at drivers/md/dm-bufio.c:638! Fix by setting the cached block pointer to NULL on errors. In addition to the reproducer described above, this fix can be verified using the "array_cursor/damaged" test in dm-unit: dm-unit run /pdata/array_cursor/damaged --kernel-dir <KERNEL_DIR>
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 12
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.9
|
5.4.290
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.5
|
5.10.234
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.177
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.125
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.72
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.10
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc2:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc3:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc6:*:*:*:*:*:*
|
— | — |