From: Marco Scardovi <scardracs@disroot.org>
To: moravec@ukf.sk
Cc: bp@alien8.de, crecklin@redhat.com, dave.hansen@linux.intel.com,
hpa@zytor.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, mingo@redhat.com, pavel@kernel.org,
rafael@kernel.org, regressions@leemhuis.info,
regressions@lists.linux.dev, scardracs@disroot.org,
tglx@kernel.org, x86@kernel.org
Subject: [PATCH v2 0/4] PM: hibernate: Add relaxed_memmap option for x86 E820 integrity check
Date: Tue, 23 Jun 2026 18:47:26 +0200 [thread overview]
Message-ID: <20260623165724.10753-1-scardracs@disroot.org> (raw)
In-Reply-To: <cd45c7c8-4df9-4963-b847-02cf72bcc039@ukf.sk>
Hi Rafael, Milan,
> ...
>
> Hibernation in Linux simply cannot cope with a changing memory map in
> general, sorry about that.
You are totally agree. While mine is still a solution for these like @Milan
with a buggy firmware, it's not a solution to make it unconditional for every
device so I came with a solution to introduce the boot flag
hybernate=relaxed_memmap. This is still a bit hacky and I don't like it at
all at the end of the day but works better than nothing, at least until HP
releases a proper firmware with it fixed.
This v2 of the patch address hibernation E820 map integrity check failures
on UEFI platforms where firmware dynamically shifts reserved or ACPI memory
ranges across boots (such as the HP OmniBook X Flip).
In v1, I attempted to restrict the integrity check to only E820_TYPE_RAM
ranges by default. As pointed out by Rafael, this is risky because the
resumed kernel could attempt to access shifted ACPI tables or UEFI runtime
services at stale addresses, leading to post-resume crashes or corruption.
To address this feedback while still allowing hibernation to function on
affected platforms, v2 introduces the 'hibernate=relaxed_memmap' command-line
parameter.
- Patch 1: Declare the 'hibernate_relaxed_memmap' flag in the PM core header.
- Patch 2: Define the flag and add parsing logic to kernel/power/hibernate.c.
- Patch 3: Implement the relaxed E820 memory map check on x86, which compares
a secondary RAM-only checksum if the main checksum mismatches,
warning the user but proceeding with resume.
- Patch 4: Document the option in Documentation/admin-guide/kernel-parameters.txt.
1. By default, the E820 checksum verification remains strict to ensure
safety for all systems.
2. If 'hibernate=relaxed_memmap' is specified, the kernel will perform
a secondary check on only the usable RAM regions (E820_TYPE_RAM) if the
main E820 checksum mismatches.
- If the RAM regions differ, the resume is aborted (to prevent direct map
mismatches and kernel paging faults during page restoration).
- If the RAM regions match, the resume is allowed to proceed and a warning
is logged about the non-RAM changes.
To support this, a secondary 'e820_ram_checksum' field is added to the
x86-specific 'restore_data_record', and 'RESTORE_MAGIC' is incremented to
signal the header layout change.
Marco Scardovi (4):
PM: hibernate: Declare hibernate_relaxed_memmap
PM: hibernate: Define and parse hibernate=relaxed_memmap parameter
x86/power: Implement relaxed E820 memory map integrity check
Documentation: Document hibernate=relaxed_memmap parameter option
.../admin-guide/kernel-parameters.txt | 5 +++
arch/x86/power/hibernate.c | 40 +++++++++++++++++--
include/linux/suspend.h | 1 +
kernel/power/hibernate.c | 3 ++
4 files changed, 45 insertions(+), 4 deletions(-)
--
2.54.0
next prev parent reply other threads:[~2026-06-23 16:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-20 8:15 [PATCH 0/1] x86/power: only verify usable RAM regions during hibernation E820 check Marco Scardovi
2026-06-20 8:15 ` [PATCH 1/1] " Marco Scardovi
2026-06-20 9:20 ` Milan Oravec
2026-06-23 12:59 ` Rafael J. Wysocki
2026-06-23 15:11 ` Milan Oravec
2026-06-23 16:47 ` Marco Scardovi [this message]
2026-06-23 16:47 ` [PATCH v2 1/4] PM: hibernate: Declare hibernate_relaxed_memmap Marco Scardovi
2026-06-23 16:47 ` [PATCH v2 2/4] PM: hibernate: Define and parse hibernate=relaxed_memmap parameter Marco Scardovi
2026-06-23 16:47 ` [PATCH v2 3/4] x86/power: Implement relaxed E820 memory map integrity check Marco Scardovi
2026-06-23 16:47 ` [PATCH v2 4/4] Documentation: Document hibernate=relaxed_memmap parameter option Marco Scardovi
2026-06-29 13:04 ` [PATCH v2 0/4] PM: hibernate: Add relaxed_memmap option for x86 E820 integrity check Milan Oravec
2026-06-29 19:53 ` Marco Scardovi
2026-06-30 6:52 ` Milan Oravec
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=20260623165724.10753-1-scardracs@disroot.org \
--to=scardracs@disroot.org \
--cc=bp@alien8.de \
--cc=crecklin@redhat.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=moravec@ukf.sk \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=regressions@leemhuis.info \
--cc=regressions@lists.linux.dev \
--cc=tglx@kernel.org \
--cc=x86@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®