В ядре Linux устранена следующая уязвимость:
watch_queue: исправлена проверка ограничения фильтра. В watch_queue_set_filter() есть несколько мест, где мы проверяем
что значение типа фильтра не превышает битовое изображение type_filter
может держать. В одном месте количество бит рассчитывается по формуле:
if (tf[i].type >= sizeof(wfilter->type_filter) * 8)
это нормально, но второй делает:
if (tf[i].type >= sizeof(wfilter->type_filter) * BITS_PER_LONG)
что нет.
Это может привести к нескольким записям за пределами области из-за
слишком большой тип:
(1) __set_bit() для wfilter->type_filter
(2) Запись большего количества элементов в wfilter->filters[], чем мы выделили. Исправьте это, просто используя вместо этого правильный WATCH_TYPE__NR, который является
количество типов, о которых мы действительно знаем. Ошибка может привести к тому, что сообщение oops будет выглядеть примерно так:
ОШИБКА: KASAN: плита выходит за пределы в watch_queue_set_filter+0x659/0x740.
Запись размера 4 по адресу ffff88800d2c66bc с помощью задачи watch_queue_oob/611.
... Отслеживание вызова:
<ЗАДАЧА>
dump_stack_lvl+0x45/0x59
print_address_description.constprop.0+0x1f/0x150
...
kasan_report.cold+0x7f/0x11b
...
watch_queue_set_filter+0x659/0x740
...
__x64_sys_ioctl+0x127/0x190
do_syscall_64+0x43/0x90
запись_SYSCALL_64_after_hwframe+0x44/0xae
Выделено задачей 611:
kasan_save_stack+0x1e/0x40
__kasan_kmalloc+0x81/0xa0
watch_queue_set_filter+0x23a/0x740
__x64_sys_ioctl+0x127/0x190
do_syscall_64+0x43/0x90
запись_SYSCALL_64_after_hwframe+0x44/0xae
Глючный адрес принадлежит объекту по адресу ffff88800d2c66a0.
который принадлежит кешу kmalloc-32 размером 32
Адрес ошибки находится в 28 байтах внутри
32-байтовая область [ffff88800d2c66a0, ffff88800d2c66c0)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: watch_queue: Fix filter limit check In watch_queue_set_filter(), there are a couple of places where we check that the filter type value does not exceed what the type_filter bitmap can hold. One place calculates the number of bits by: if (tf[i].type >= sizeof(wfilter->type_filter) * 8) which is fine, but the second does: if (tf[i].type >= sizeof(wfilter->type_filter) * BITS_PER_LONG) which is not. This can lead to a couple of out-of-bounds writes due to a too-large type: (1) __set_bit() on wfilter->type_filter (2) Writing more elements in wfilter->filters[] than we allocated. Fix this by just using the proper WATCH_TYPE__NR instead, which is the number of types we actually know about. The bug may cause an oops looking something like: BUG: KASAN: slab-out-of-bounds in watch_queue_set_filter+0x659/0x740 Write of size 4 at addr ffff88800d2c66bc by task watch_queue_oob/611 ... Call Trace: <TASK> dump_stack_lvl+0x45/0x59 print_address_description.constprop.0+0x1f/0x150 ... kasan_report.cold+0x7f/0x11b ... watch_queue_set_filter+0x659/0x740 ... __x64_sys_ioctl+0x127/0x190 do_syscall_64+0x43/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae Allocated by task 611: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x81/0xa0 watch_queue_set_filter+0x23a/0x740 __x64_sys_ioctl+0x127/0x190 do_syscall_64+0x43/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88800d2c66a0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 28 bytes inside of 32-byte region [ffff88800d2c66a0, ffff88800d2c66c0)
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 3
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.8
|
5.10.106
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.29
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
5.16.15
|