Ad

CVE-2026-97533

NONE EPSS 0.22%
Обновлено 19 октября 2026
Linux
Параметр Значение
Поставщик Linux
Публичный эксплойт Нет

В ядре Linux была устранена следующая уязвимость: x86/mm/pat: Acquire init_mm read lock on attribute changes to avoid UAF A предыдущая фиксация защищена от гонок между ptdump и CPA collapse, однако между изменениями атрибутов и collapse как сообщает Denis V всё ещё существует одна фиксация. Lunev (связанный). When an attribute change arises, a lockless page table walker obtains a PTE entry, which is later written to via set_pte_atomic(): ... -> change_page_attr_set_clr() -> __change_page_attr_set_clr() -> __change_page_attr() -> _lookup_address_cpa() -> lookup_address_in_pgd_attr() -> [ lockless page table walker ] -> set_pte_atomic() There is nothing preventing a concurrent CPA collapse which can free the PTE that was retrieved here, resulting in a use-after-free.

С помощью mmap блокировки записи, взятой на init_mm над крахом CPA, решить эту гонку, приобретя mmap блокировки чтения на init_mm над __change_page_attr_set_clr(). Это блокирует всю операцию, над которой происходит прогулка и запись входа PTE, решая гонку. Это безопасно сделать здесь, так как при входе в __change_page_attr_set_clr() не удерживаются спин-локи.

Тем не менее, блокировка не должна удерживаться над распределением, так как выделение может вызвать возврат, и усадщики могут рекурсивно вызывать CPA, делая возможными тупики (init_mm -> ... -> fs_reclaim -> init_mm). Таблица страниц выделяется, когда огромная страница должна быть разделена: -> change_page_attr_set_clr() -> __change_page_attr_set_clr() -> __change_page_attr() -> split_large_page() [ pagetable_alloc() ] -> __split_large_page() Avoid тупиков, сбрасывая блокировку mmap через pagetable_alloc() в split_large_page() и отслеживать, нужно ли это, добавив новый флаг 'init_mm_read_locked' для struct cpa_data. Это безопасно, так как __split_large_page() (называемый с восстановленными блокировками) повторно подтверждает, что запись таблицы страниц такая же, как и до удаления блокировок, и __change_page_attr() повторяет прохождение всей таблицы страниц всякий раз, когда происходит разделение, поэтому учитываются одновременное разделение и коллапс.

Параллельный ptdump также безопасен, так как блокировка только опускается над распределением таблицы страниц, в течение которого таблица страниц еще не была изменена. Флаг CPA_COLLAPSE устанавливается только set_memory_rox(), который работает исключительно на диапазонах vmalloc, а на x86 только в пространстве отображения модулей. Это важно, потому что некоторые абоненты напрямую вызывают __change_page_attr_set_clr(), минуя эту блокировку.

However, none of these operate within the module mapping space. * cpa_process_alias() - a recursive helper called by __change_page_attr_set_clr(). * __set_memory_enc_pgtable() - operates on the direct mapping and (via __vmbus_establish_gpadl()) the vmalloc mapping space. * __set_pages_[n]p() - called by set_direct_map_[invalid, default, valid]_noflush(), __kernel_map_pages() - operates on the direct map. * kernel_[un]map_pages_in_pgd() - operates on EFI ranges. Эта работа основана на Denis V. Lunev's отличный анализ ошибки с благодарностью. [ dhansen: перейти к императивному голосу в журнале изменений ]

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

In the Linux kernel, the following vulnerability has been resolved: x86/mm/pat: Acquire init_mm read lock on attribute changes to avoid UAF A previous commit protected against races between ptdump and CPA collapse, however one still exists between attribute changes and collapse as reported by Denis V. Lunev (linked). When an attribute change arises, a lockless page table walker obtains a PTE entry, which is later written to via set_pte_atomic(): ... -> change_page_attr_set_clr() -> __change_page_attr_set_clr() -> __change_page_attr() -> _lookup_address_cpa() -> lookup_address_in_pgd_attr() -> [ lockless page table walker ] -> set_pte_atomic() There is nothing preventing a concurrent CPA collapse which can free the PTE that was retrieved here, resulting in a use-after-free. With the mmap write lock taken on init_mm over CPA collapse, resolve this race by acquiring an mmap read lock on init_mm over __change_page_attr_set_clr(). This locks across the whole operation over which the walk and the PTE entry write occurs, solving the race. It is safe to do this here, as no spinlocks are held upon entry to __change_page_attr_set_clr(). However, the lock must not be held over an allocation, as allocation can trigger reclaim and shrinkers may call into CPA recursively, making deadlocks possible (init_mm -> ... -> fs_reclaim -> init_mm). A page table is allocated when a huge page needs to be split: -> change_page_attr_set_clr() -> __change_page_attr_set_clr() -> __change_page_attr() -> split_large_page() [ pagetable_alloc() ] -> __split_large_page() Avoid deadlocks by dropping the mmap lock across pagetable_alloc() in split_large_page() and track whether this is needed by adding a new 'init_mm_read_locked' flag to struct cpa_data. This is safe as __split_large_page() (called with locks re-established) revalidates that the page table entry is the same as it was prior to the locks being dropped and __change_page_attr() repeats the entire page table walk whenever a split occurs, so concurrent split and collapse are accounted for. Concurrent ptdump is also safe as the lock is only dropped over page table allocation during which time the page table has not yet been modified. The CPA_COLLAPSE flag is only set by set_memory_rox(), which exclusively operates upon vmalloc ranges, and on x86 only within the module mapping space. This is important, because some callers directly invoke __change_page_attr_set_clr(), bypassing this lock. However, none of these operate within the module mapping space. * cpa_process_alias() - a recursive helper called by __change_page_attr_set_clr(). * __set_memory_enc_pgtable() - operates on the direct mapping and (via __vmbus_establish_gpadl()) the vmalloc mapping space. * __set_pages_[n]p() - called by set_direct_map_[invalid, default, valid]_noflush(), __kernel_map_pages() - operates on the direct map. * kernel_[un]map_pages_in_pgd() - operates on EFI ranges. This work is based upon Denis V. Lunev's excellent analysis of the bug with gratitude. [ dhansen: move to imperative voice in changelog ]