CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/03/13 09:54:47
Modified files:
sys/arch/amd64/amd64: hibernate_machdep.c
sys/arch/i386/i386: hibernate_machdep.c
sys/arch/loongson/loongson: hibernate_machdep.c
Log message:
Fix a longstanding off-by-one error in hibernate unpack.
Last year, I made a commit to early-allocate the hibernate data structure
needed during actual hibernate instead of triyng to allocate it at the
time of 'ZZZ'. This change exposed an old bug that caused machines to
be unstable after unhibernate (typically manifesting in pool corruption
or other difficult to track down bugs).
The error was due to skipping a page of memory immediately adjacent to
the hibernate piglet during unpack, effectively leaving that page with
whatever content it had before image unpack started. If you got lucky, this
page wasn't in use and you didn't notice anything. But with the fix to do
early allocation, the chance that the page was in use increased, and
thus the bug was exposed.
Big thank you to Walter Alejandro Iglesias for tracking this down and
providing the diff/root cause.
discussed with deraadt@
tested on a few i386 VMs and various amd64 laptops for proper ZZZ/un-ZZZ
operation. loongson is included in the diff for completeness sake even though
loongson hibernate was never finished.