В ядре Linux устранена следующая уязвимость:
mm/ptdump: всегда стабилизировать против освобождения таблицы страниц с помощью init_mm
Предыдущие коммиты установили инвариант таблицы страниц ядра.
освобождение выполняется, пока удерживается блокировка чтения mmap на init_mm, что
исправляет гонки между ptdump и освобождением таблицы страниц ядра через init_mm. Однако x86 и Arm64 могут выполнять ptdump для мм, отличных от init_mm.
через ptdump_walk_pgd() и поскольку диапазоны памяти ядра являются общими для всех
неядерные мм, это означает, что для этих случаев гонка все еще существует. Исправьте это, установив вложенную блокировку записи mmap для init_mm в
ptdump_walk_pgd().
Это безопасно, поскольку мы принимаем это после записи mmap, блокирующей мм, и ничего
сначала получает блокировку init_mm, прежде чем блокировать произвольный мм, поэтому нет
возможен тупик. Также обновите walk_page_range_debug(), чтобы утверждать, что init_mm является записью.
заблокировано, добавьте комментарий, объясняющий причину, и удалите лишний код, а также
исключить ненужный и сбивающий с толку вызов
walk_kernel_page_table_range(). Мы можем безопасно удалить проверку, отличную от NULL, для walk.mm, поскольку блокировка mmap
Asserts разыменовал бы NULL-указатель, если бы это было так (и, конечно, ни одна вызывающая сторона этого не делает).
это).
Первый момент, когда ptdump может участвовать в гонке за освобождением таблицы страниц ядра: commit b6bdb7517c3d ("mm/vmalloc: добавить интерфейсы на свободную несопоставленную страницу table"), поэтому мы указываем это в теге "Исправления".
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: mm/ptdump: always stabilise against page table freeing using init_mm Previous commits have established the invariant that kernel page table freeing is performed while an mmap read lock on init_mm is held, which fixes races between ptdump and kernel page table freeing over init_mm. However, x86 and arm64 can perform a ptdump over an mm other than init_mm via ptdump_walk_pgd() and since kernel memory ranges are shared across non-kernel mm's, this means that the race still exists for these cases. Fix this by acquiring a nested mmap write lock for init_mm in ptdump_walk_pgd(). This is safe as we take this after mmap write locking the mm, and nothing acquires the init_mm lock first before locking an arbitrary mm, so no deadlock is possible. Also update walk_page_range_debug() to assert that init_mm is write locked, add a comment explaining why and remove some redundant code, and eliminate the unnecessary and confusing invocation of walk_kernel_page_table_range(). We can safely remove the non-NULL check for walk.mm, as the mmap lock asserts would NULL pointer deref if it was (and of course no callers do this). The first point at which ptdump can race kernel page table freeing is commit b6bdb7517c3d ("mm/vmalloc: add interfaces to free unmapped page table"), so we target this in the Fixes tag.
Уязвимые продукты 11
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
5.10.266
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
5.15.217
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
6.6.153
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
6.12.105
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
6.18.45
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
7.1.9
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.16
|
7.2
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.4.125
|
— |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.9.91
|
— |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14.31
|
— |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.15.14
|
— |