v1
2026-09-17
休眠页拷贝加固与清理 · v1
休眠不再兼容 debug_pagealloc:处理 copy_data_pages 错误、显式保存 KFENCE 页,并在 debug_pagealloc 时禁止休眠。
原始补丁链接
子 Patch(5)
1/5
hibernation: make swsusp_page helpers static
Since commit 31a1b9d7fe768 (“mm: page_alloc: move mark_free_page() into snapshot.c”) several helpers that set, clear and query free and forbidden page status are only used inside kernel/power/snapshot
2/5
hibernation: ensure secretmem pages don't reach a snapshot
hibernation_available() checks for active secretmem users, but a secretmem file can be created after this check and its pages may get into the hibernation snapshot although they should not. Recheck s
3/5
hibernate: handle potential errors in hibernate_{map,unmap}_page()
When safe_copy_page() had to map/unmap pages only because of debug_pagealloc() there could be no errors in the kernel page table updates. However, with the increasing desire to remove pages from the
4/5
hibernation, KFENCE: explicitly map/unmap KFENCE pages
The pages protected by KFENCE are removed from the direct map. safe_copy_page() temporarily maps and unmaps them using set_direct_map APIs, or, when the stars align, even using debug_pagealloc_map_pa
5/5
hibernation: make hibernation unavailable when debug_pagealloc is on
Back in 2008 when commit 8a235efad548a (“Hibernation: Handle DEBUG_PAGEALLOC on x86”) enabled coexistence of hibernation and DEBUG_PAGEALLOC, the world was simpler, the combination was only supported