From: Milan Oravec <moravec@ukf.sk>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Marco Scardovi <scardracs@disroot.org>
Cc: pavel@kernel.org, tglx@kernel.org, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
hpa@zytor.com, crecklin@redhat.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, regressions@leemhuis.info,
regressions@lists.linux.dev
Subject: Re: [PATCH 1/1] x86/power: only verify usable RAM regions during hibernation E820 check
Date: Tue, 23 Jun 2026 17:11:19 +0200 [thread overview]
Message-ID: <cd45c7c8-4df9-4963-b847-02cf72bcc039@ukf.sk> (raw)
In-Reply-To: <CAJZ5v0jmOj0WBtMTvbnaD+2b0bTFowA=JWrqRzaaCYpHpai1Nw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3293 bytes --]
Hello Rafael. OK, what is proper solution for the Hibernate inconsistent
memory map detected! problem?
Thank you,
best regards,
Milan Oravec
CIKT UKF Nitra
Mobil/Signal: +421907670270
email: moravec@ukf.sk
--------------------------------------------------------------------
Tuto spravu nepreveril ziadny antivirus - nebolo treba...
On 6/23/26 14:59, Rafael J. Wysocki wrote:
> On Sat, Jun 20, 2026 at 10:16 AM Marco Scardovi <scardracs@disroot.org> 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.
> That may not be sufficient for the image kernel to work after resuming though.
>
>> This happens because the UEFI firmware or bootloader (like GRUB) makes
>> non-deterministic allocations or shifts reserved/ACPI memory regions
>> dynamically across boots,
> The boot loader has nothing to do with this, the memory map comes from
> the UEFI firmware.
>
>> 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.
> Which is risky because the image kernel may access stuff located in
> those non-RAM memory regions (for instance, ACPI tables, AML operation
> regions, UEFI runtime variables, etc.).
>
> Hibernation in Linux simply cannot cope with a changing memory map in
> general, sorry about that.
>
>> 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@disroot.org>
>> ---
>> 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
>> --
>> 2.54.0
>>
>>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4983 bytes --]
next prev parent reply other threads:[~2026-06-23 15:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-20 8:15 [PATCH 0/1] " 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 [this message]
2026-06-23 16:47 ` [PATCH v2 0/4] PM: hibernate: Add relaxed_memmap option for x86 E820 integrity check Marco Scardovi
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=cd45c7c8-4df9-4963-b847-02cf72bcc039@ukf.sk \
--to=moravec@ukf.sk \
--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=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=regressions@leemhuis.info \
--cc=regressions@lists.linux.dev \
--cc=scardracs@disroot.org \
--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®