linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* hibernate bug: "Image size after compression: -1210935 kbytes"
@ 2025-11-05 18:05 Askar Safin
  0 siblings, 0 replies; only message in thread
From: Askar Safin @ 2025-11-05 18:05 UTC (permalink / raw)
  To: linux-pm; +Cc: Rafael J. Wysocki, superm1

I found hibernation bug: kernel sometimes reports negative size of
hibernation image.

Steps to reproduce:
- Your memory size should be 10000 MiB
- Your swap size should be 3000 MiB
- Mount ramfs
- Create 4000 MiB file with random (uncompressable) data in that ramfs
- Try to hibernate
- Of course, hibernation will fail, because you cannot fit 4000 MiB random file to
3000 MiB swap
- But you will see very strange message in kernel logs
"Image size after compression: -1210935 kbytes" (or similar)

Here is script for reproduction this bug in Qemu:
https://zerobin.net/?7d87d78855b41e07#yvP+T2c/v9A1AJr2d1tjWCbA6KUZZscDeESvbHqfqOo=

Here is resulting output (dmesg):
https://zerobin.net/?76c5a5e312ff7e6d#fH6jAkatrtRvtOWvFdo5EldWWP86wVxJrzzOCzvCQZc=

Reproducibility in Qemu: always (assuming you use script above).

The bug reproduces (in Qemu) on current master (284922f4c563).

I see two bugs in this output. First, negative size of hibernation image.
Second, "dmesg" doesn't contain any hibernation error. I. e. "dmesg" looks like
hibernation succeed, but it did not.

The bug is reproducible both in Qemu and on real hardware.
(Note: I reproduced it on real hardware with v6.12.48 kernel.)

This looks like integer overflow. I suggest double-checking that all
size calculations are 64-bit (on 64-bit systems) in hibernation code.

-- 
Askar Safin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-05 18:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05 18:05 hibernate bug: "Image size after compression: -1210935 kbytes" Askar Safin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).