Re: [PATCH v2 0/4] PM: hibernate: Add relaxed_memmap option for x86 E820 integrity check
From: Milan Oravec
Date: Mon Jun 29 2026 - 09:19:13 EST
Hello, I wanted to try this new set of patches, but I was unable to apply them. Tested with 7.1.2 and master too.
migo@migo-HP:~/build/linux-test/linux$ patch -p1 < ../hibernate2.patch
patching file include/linux/suspend.h
patching file kernel/power/hibernate.c
Hunk #2 FAILED at 1431.
1 out of 2 hunks FAILED -- saving rejects to file kernel/power/hibernate.c.rej
patching file arch/x86/power/hibernate.c
Hunk #1 FAILED at 61.
Hunk #2 succeeded at 78 with fuzz 1.
Hunk #3 FAILED at 144.
Hunk #4 FAILED at 166.
3 out of 4 hunks FAILED -- saving rejects to file arch/x86/power/hibernate.c.rej
patching file Documentation/admin-guide/kernel-parameters.txt
Hunk #1 FAILED at 1967.
1 out of 1 hunk FAILED -- saving rejects to file Documentation/admin-guide/kernel-parameters.txt.rej
Thank you,
Milan
s pozdravom
Milan Oravec
CIKT UKF Nitra
Mobil/Signal: +421907670270
email: moravec@xxxxxx
--------------------------------------------------------------------
Tuto spravu nepreveril ziadny antivirus - nebolo treba...
On 6/23/26 18:47, Marco Scardovi wrote:
Hi Rafael, Milan,
...You are totally agree. While mine is still a solution for these like @Milan
Hibernation in Linux simply cannot cope with a changing memory map in
general, sorry about that.
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(-)
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature