[PATCH v2 0/4] PM: hibernate: Add relaxed_memmap option for x86 E820 integrity check
From: Marco Scardovi
Date: Tue Jun 23 2026 - 12:57:56 EST
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