Re: [PATCH 1/1] x86/power: only verify usable RAM regions during hibernation E820 check
From: Milan Oravec
Date: Sat Jun 20 2026 - 05:28:11 EST
Hallo, thank you very much! This patch resolves this issue on my HP OmniBook X Flip - hibernation is working again.
Best regards,
Milan Oravec
CIKT UKF Nitra
Mobil/Signal: +421907670270
email: moravec@xxxxxx
--------------------------------------------------------------------
Tuto spravu nepreveril ziadny antivirus - nebolo treba...
On 6/20/26 10:15, Marco Scardovi wrote:
On some UEFI platforms (such as the HP OmniBook X Flip), resuming from
hibernation fails with 'Hibernate inconsistent memory map detected!'
even though the usable system RAM configuration is identical.
This happens because the UEFI firmware or bootloader (like GRUB) makes
non-deterministic allocations or shifts reserved/ACPI memory regions
dynamically across boots, which changes the CRC32 checksum computed
over the entire E820 table (which includes non-RAM types like reserved,
ACPI, NVS, and unusable memory).
Fix this by modifying compute_e820_crc32() to only calculate the
checksum over memory map entries of type E820_TYPE_RAM. Usable system
RAM layout is still verified to ensure data safety, but dynamic shifts
in ACPI and other reserved ranges are ignored.
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221569
Fixes: f5d1499ae209 ("PM: hibernate: x86: Use crc32 instead of md5 for hibernation e820 integrity check")
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Marco Scardovi <scardracs@xxxxxxxxxxx>
---
arch/x86/power/hibernate.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/arch/x86/power/hibernate.c b/arch/x86/power/hibernate.c
index a2294c1649f6..752a490bc3d2 100644
--- a/arch/x86/power/hibernate.c
+++ b/arch/x86/power/hibernate.c
@@ -70,12 +70,19 @@ struct restore_data_record {
*
* Return: the resulting checksum
*/
-static inline u32 compute_e820_crc32(struct e820_table *table)
+static u32 compute_e820_crc32(struct e820_table *table)
{
- int size = offsetof(struct e820_table, entries) +
- sizeof(struct e820_entry) * table->nr_entries;
+ u32 crc = ~0;
+ int i;
+
+ for (i = 0; i < table->nr_entries; i++) {
+ if (table->entries[i].type == E820_TYPE_RAM) {
+ crc = crc32_le(crc, (unsigned char const *)&table->entries[i],
+ sizeof(struct e820_entry));
+ }
+ }
- return ~crc32_le(~0, (unsigned char const *)table, size);
+ return ~crc;
}
#ifdef CONFIG_X86_64
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature