From: Andrew Morton <akpm@linux-foundation.org>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Cc: Alexander Potapenko <glider@google.com>,
David Hildenbrand <david@kernel.org>,
Marco Elver <elver@google.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>, Len Brown <lenb@kernel.org>,
Pavel Machek <pavel@kernel.org>,
kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 0/5] hibernation: make safe_copy_page more robust and remove debug_pagealloc support
Date: Sun, 27 Sep 2026 15:02:57 -0700 [thread overview]
Message-ID: <20260927150257.c9558f807114f2ce9c6675e0@linux-foundation.org> (raw)
In-Reply-To: <20260926-hibernation-v2-0-235f69f3ab2a@kernel.org>
On Sat, 26 Sep 2026 12:26:29 +0300 "Mike Rapoport (Microsoft)" <rppt@kernel.org> wrote:
> When hibernation creates a memory image, it uses set_direct_map() APIs to
> temporarily map pages that are marked as not present in the kernel page
> tables.
>
> Initially, this was intended to support debug_pagealloc along with
> hibernation on x86.
>
> With the increasing desire to use set_direct_map APIs for hardening
> features and with their inconsistent implementations across architectures,
> using kernel_page_present() + set_direct_map_valid_noflush() to save
> non-present pages in the hibernation image is not very safe, to say the
> least.
>
> Worse, some combinations of debug features, such as debug_pagealloc and
> PAGE_POISON cause a crash during restore.
>
> Keeping debug_pagealloc compatible with hibernation requires a complex
> infrastructure for tracking free unmapped pages with a page flag/page type,
> verifying that it is actually a free page that hibernate_map_page() tries
> to remap and making sure there are no stale or failed page table updates.
> With init_on_{alloc,free} and/or PAGE_POISON on top, this also requires the
> ability to map and initialize these free pages on restore.
>
> This complexity does not seem justified for a somewhat niche debugging
> scenario.
>
> Instead of a complex fix to support hibernation with debug_pagealloc, make
> sure that copy_data_pages() and its helpers properly handle errors that may
> happen during page table updates, explicitly enable saving of KFENCE pages
> and disallow hibernation when debug_pagealloc is enabled.
Thanks.
> Mike Rapoport (Microsoft) (5):
> hibernation: make swsusp_page helpers static
> hibernation: ensure secretmem pages don't reach a snapshot
> hibernate: handle potential errors in hibernate_{map,unmap}_page()
> hibernation, KFENCE: explicitly map/unmap KFENCE pages
> hibernation: make hibernation unavailable when debug_pagealloc is on
>
> include/linux/kfence.h | 29 ++++++++++
> include/linux/suspend.h | 6 ---
> kernel/power/hibernate.c | 6 +++
> kernel/power/snapshot.c | 137 +++++++++++++++++++++++++----------------------
> mm/kfence/core.c | 52 +++++++++++++++++-
> 5 files changed, 159 insertions(+), 71 deletions(-)
I'm not sure how to route this. Rafael, wdyt?
prev parent reply other threads:[~2026-09-27 22:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 9:26 Mike Rapoport (Microsoft)
2026-09-26 9:26 ` [PATCH v2 1/5] hibernation: make swsusp_page helpers static Mike Rapoport (Microsoft)
2026-09-26 9:26 ` [PATCH v2 2/5] hibernation: ensure secretmem pages don't reach a snapshot Mike Rapoport (Microsoft)
2026-09-28 8:56 ` David Hildenbrand (Arm)
2026-09-26 9:26 ` [PATCH v2 3/5] hibernate: handle potential errors in hibernate_{map,unmap}_page() Mike Rapoport (Microsoft)
2026-09-28 8:58 ` David Hildenbrand (Arm)
2026-09-26 9:26 ` [PATCH v2 4/5] hibernation, KFENCE: explicitly map/unmap KFENCE pages Mike Rapoport (Microsoft)
2026-09-28 9:00 ` David Hildenbrand (Arm)
2026-09-26 9:26 ` [PATCH v2 5/5] hibernation: make hibernation unavailable when debug_pagealloc is on Mike Rapoport (Microsoft)
2026-09-27 22:02 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260927150257.c9558f807114f2ce9c6675e0@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®