В ядре Linux устранена следующая уязвимость:
regmap-irq: исправить доступ за пределами границ при выделении буферов конфигурации. При выделении 2D-массива для обработки регистров типа IRQ в
regmap_add_irq_chip_fwnode(), цель состоит в том, чтобы выделить матрицу
со строками num_config_bases и столбцами num_config_regs. В настоящее время это решается путем выделения буфера для хранения указателя на
каждую строку (т. е. num_config_bases).
После этого логика пытается
выделить память, необходимую для хранения конфигурации регистра для
каждый ряд. Однако вместо этого распределения для каждой строки
(т. е. выделение num_config_bases), логика ошибочно делает это
выделение num_config_regs количество раз. Этот сценарий может привести к выходу за пределы доступа, когда num_config_regs
больше, чем num_config_bases.
Исправьте это, обновив завершающую
состояние цикла, выделяющего память для хранения регистра
конфигурация для выделения памяти только для каждой строки в матрице. Амит Пундир сообщил о сбое, произошедшем на его устройстве db845c.
из-за повреждения памяти (см. тег «Закрытие» в отчете Амита). КАСАН
Отчет ниже помог сузить круг вопросов до этой проблемы:
[ 14.033877][ T1] ===============================================================
[14.042507][ T1] ОШИБКА: KASAN: неверный доступ в regmap_add_irq_chip_fwnode+0x594/0x1364
[ 14.050796][ T1] Запись размера 8 по адресу 06ffff8081021850 с помощью задачи init/1
[ 14.242004][ T1] Адрес ошибки принадлежит объекту по адресу ffffff8081021850.
[ 14.242004][ T1] принадлежит кэшу kmalloc-8 размером 8.
[ 14.255669][ T1] Адрес ошибки находится в 0 байтах внутри
[ 14.255669][ T1] 8-байтовая область [ffffff8081021850, ffffff8081021858)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: regmap-irq: Fix out-of-bounds access when allocating config buffers When allocating the 2D array for handling IRQ type registers in regmap_add_irq_chip_fwnode(), the intent is to allocate a matrix with num_config_bases rows and num_config_regs columns. This is currently handled by allocating a buffer to hold a pointer for each row (i.e. num_config_bases). After that, the logic attempts to allocate the memory required to hold the register configuration for each row. However, instead of doing this allocation for each row (i.e. num_config_bases allocations), the logic erroneously does this allocation num_config_regs number of times. This scenario can lead to out-of-bounds accesses when num_config_regs is greater than num_config_bases. Fix this by updating the terminating condition of the loop that allocates the memory for holding the register configuration to allocate memory only for each row in the matrix. Amit Pundir reported a crash that was occurring on his db845c device due to memory corruption (see "Closes" tag for Amit's report). The KASAN report below helped narrow it down to this issue: [ 14.033877][ T1] ================================================================== [ 14.042507][ T1] BUG: KASAN: invalid-access in regmap_add_irq_chip_fwnode+0x594/0x1364 [ 14.050796][ T1] Write of size 8 at addr 06ffff8081021850 by task init/1 [ 14.242004][ T1] The buggy address belongs to the object at ffffff8081021850 [ 14.242004][ T1] which belongs to the cache kmalloc-8 of size 8 [ 14.255669][ T1] The buggy address is located 0 bytes inside of [ 14.255669][ T1] 8-byte region [ffffff8081021850, ffffff8081021858)
Характеристики атаки
Последствия
Строка CVSS v3.1