Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 347901 - sys-apps/openrc: changed kernels hibernate/suspend partition format may cause system damage
Summary: sys-apps/openrc: changed kernels hibernate/suspend partition format may cause...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High critical
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-06 12:33 UTC by Denis Kaganovich
Modified: 2010-12-12 04:04 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
swap_suspend.patch (swap_suspend.patch,1.71 KB, patch)
2010-12-06 12:36 UTC, Denis Kaganovich
Details | Diff
swap_suspend2.patch (swap_suspend2.patch,1.74 KB, patch)
2010-12-07 12:34 UTC, Denis Kaganovich
Details | Diff
baselayout1-suspend.patch (baselayout1-suspend.patch,1.84 KB, patch)
2010-12-10 11:41 UTC, Denis Kaganovich
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Kaganovich 2010-12-06 12:33:40 UTC
Changed kernels hibernate/suspend partition format may cause system damage. Nearest change - 2.6.37.

Reproducible: Always

Steps to Reproduce:
1. Boot 2.6.37;
2. "echo disk >/sys/power/state" (hibernate);
3. boot 2.6.36 ("swapon -s" - swap is not mounted);
4. do some work on root & other partitions
5. reboot 2.6.37 again... (outdated resume, crushed partitions).
Actual Results:  
System damage (outdated suspend/resume).


I report it in "baselayout" component, becouse it may be fixed via /etc/init.d/swap. To prevent damaging - must verify swap/suspend partition before swapon and re-format on demand. Example patch available (will be attached).
Comment 1 Denis Kaganovich 2010-12-06 12:36:33 UTC
Created attachment 256492 [details, diff]
swap_suspend.patch

See comments inside. depend() changes may be ommited to not break standard boot behaviour, but I trying to be most safe.
Comment 2 Denis Kaganovich 2010-12-07 12:34:07 UTC
Created attachment 256577 [details, diff]
swap_suspend2.patch

depend() changes
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2010-12-09 19:58:34 UTC
Please add the category/pkg you want patched to the Summary.
Comment 4 Denis Kaganovich 2010-12-10 11:19:26 UTC
(In reply to comment #3)
> Please add the category/pkg you want patched to the Summary.

This patch for openrc.

But problem also for baselayout-1. I may provide patch for baselayout-1 too, but just say where to post it ;). Also if anybody interesting about it (I use only openrc) - may be fix it self. Same (but less safe) for baselayout-1: in init.d/localmount, copy "fixswap()" code from this patch and change "/sbin/swapon -a" to "/sbin/swapon -a || fixswap".

But FYI: moving swapon before localmount may cause simple problem: swap over files (vs. partitions) will don't work. This is about this openrc patch with changed "depend()" only. Say if somebody in doubts about this depend() changes and I may change & post patch (or make self by maintainers) in price of small unsafe point in boot-time between fsck+localmount & swap.
Comment 5 Denis Kaganovich 2010-12-10 11:41:50 UTC
Created attachment 256826 [details, diff]
baselayout1-suspend.patch

To close questions: same for baselayout-1 - swapon now will be twice here, before fsck & after localmount (old). Fixme if you want, but there are just most safe. Mounting twice still also compatible with swap over files.
Comment 6 William Hubbs gentoo-dev 2010-12-11 19:28:00 UTC
Can you please open a separate bug for baselayout-1?

Thanks,

William

Comment 7 William Hubbs gentoo-dev 2010-12-11 19:30:23 UTC
Comment on attachment 256826 [details, diff]
baselayout1-suspend.patch

This bug will be used for openrc.
Comment 8 SpanKY gentoo-dev 2010-12-12 04:04:21 UTC
i'm not sure this is something we want to be hacking up.  there is way too much magic going on in your patch to work around what is clearly documented in all linux suspend docs as "a bad idea".

the kernel itself already has checks to make sure people dont go trying to resume things inappropriately.  but there's only so far you can go to keep people from shooting themselves in the foot.

the util-linux man page also indicates that swapon already attempts to detect & rewrite software suspend signatures for this precise reason.  so if you feel that swapon isnt going far enough, feel free to start an e-mail thread on the util-linux list and/or post a patch to improve it.