aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/platform.c
diff options
context:
space:
mode:
authorMyrrh Periwinkle <[email protected]>2025-04-06 04:45:22 +0000
committerIngo Molnar <[email protected]>2025-04-07 17:20:08 +0000
commitf2f29da9f0d4367f6ff35e0d9d021257bb53e273 (patch)
tree2f28bafe704346673e86ca23b988eb8eb0c58e1c /rust/helpers/platform.c
parentx86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI (diff)
downloadkernel-f2f29da9f0d4367f6ff35e0d9d021257bb53e273.tar.gz
kernel-f2f29da9f0d4367f6ff35e0d9d021257bb53e273.zip
x86/e820: Fix handling of subpage regions when calculating nosave ranges in e820__register_nosave_regions()
While debugging kexec/hibernation hangs and crashes, it turned out that the current implementation of e820__register_nosave_regions() suffers from multiple serious issues: - The end of last region is tracked by PFN, causing it to find holes that aren't there if two consecutive subpage regions are present - The nosave PFN ranges derived from holes are rounded out (instead of rounded in) which makes it inconsistent with how explicitly reserved regions are handled Fix this by: - Treating reserved regions as if they were holes, to ensure consistent handling (rounding out nosave PFN ranges is more correct as the kernel does not use partial pages) - Tracking the end of the last RAM region by address instead of pages to detect holes more precisely These bugs appear to have been introduced about ~18 years ago with the very first version of e820_mark_nosave_regions(), and its flawed assumptions were carried forward uninterrupted through various waves of rewrites and renames. [ mingo: Added Git archeology details, for kicks and giggles. ] Fixes: e8eff5ac294e ("[PATCH] Make swsusp avoid memory holes and reserved memory regions on x86_64") Reported-by: Roberto Ricci <[email protected]> Tested-by: Roberto Ricci <[email protected]> Signed-off-by: Myrrh Periwinkle <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Len Brown <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Closes: https://lore.kernel.org/all/Z4WFjBVHpndct7br@desktop0a/
Diffstat (limited to 'rust/helpers/platform.c')
0 files changed, 0 insertions, 0 deletions