Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3244
b: refs/heads/master
c: fc5fb2c
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Machek authored and Linus Torvalds committed Jun 25, 2005
1 parent 5648c99 commit 582e101
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a72e04df5470df0ec646029d31e5528167ab1a7
refs/heads/master: fc5fb2c609c6acef15a8b062063e9135fb08b4d2
84 changes: 81 additions & 3 deletions trunk/Documentation/power/swsusp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ place where the thread is safe to be frozen (no kernel semaphores
should be held at that point and it must be safe to sleep there), and
add:

if (current->flags & PF_FREEZE)
refrigerator(PF_FREEZE);
try_to_freeze(PF_FREEZE);

If the thread is needed for writing the image to storage, you should
instead set the PF_NOFREEZE process flag when creating the thread.
instead set the PF_NOFREEZE process flag when creating the thread (and
be very carefull).


Q: What is the difference between between "platform", "shutdown" and
Expand Down Expand Up @@ -233,3 +233,81 @@ A: Try running
cat `cat /proc/[0-9]*/maps | grep / | sed 's:.* /:/:' | sort -u` > /dev/null

after resume. swapoff -a; swapon -a may also be usefull.

Q: What happens to devices during swsusp? They seem to be resumed
during system suspend?

A: That's correct. We need to resume them if we want to write image to
disk. Whole sequence goes like

Suspend part
~~~~~~~~~~~~
running system, user asks for suspend-to-disk

user processes are stopped

suspend(PMSG_FREEZE): devices are frozen so that they don't interfere
with state snapshot

state snapshot: copy of whole used memory is taken with interrupts disabled

resume(): devices are woken up so that we can write image to swap

write image to swap

suspend(PMSG_SUSPEND): suspend devices so that we can power off

turn the power off

Resume part
~~~~~~~~~~~
(is actually pretty similar)

running system, user asks for suspend-to-disk

user processes are stopped (in common case there are none, but with resume-from-initrd, noone knows)

read image from disk

suspend(PMSG_FREEZE): devices are frozen so that they don't interfere
with image restoration

image restoration: rewrite memory with image

resume(): devices are woken up so that system can continue

thaw all user processes

Q: What is this 'Encrypt suspend image' for?

A: First of all: it is not a replacement for dm-crypt encrypted swap.
It cannot protect your computer while it is suspended. Instead it does
protect from leaking sensitive data after resume from suspend.

Think of the following: you suspend while an application is running
that keeps sensitive data in memory. The application itself prevents
the data from being swapped out. Suspend, however, must write these
data to swap to be able to resume later on. Without suspend encryption
your sensitive data are then stored in plaintext on disk. This means
that after resume your sensitive data are accessible to all
applications having direct access to the swap device which was used
for suspend. If you don't need swap after resume these data can remain
on disk virtually forever. Thus it can happen that your system gets
broken in weeks later and sensitive data which you thought were
encrypted and protected are retrieved and stolen from the swap device.
To prevent this situation you should use 'Encrypt suspend image'.

During suspend a temporary key is created and this key is used to
encrypt the data written to disk. When, during resume, the data was
read back into memory the temporary key is destroyed which simply
means that all data written to disk during suspend are then
inaccessible so they can't be stolen later on. The only thing that
you must then take care of is that you call 'mkswap' for the swap
partition used for suspend as early as possible during regular
boot. This asserts that any temporary key from an oopsed suspend or
from a failed or aborted resume is erased from the swap device.

As a rule of thumb use encrypted swap to protect your data while your
system is shut down or suspended. Additionally use the encrypted
suspend image to prevent sensitive data from being stolen after
resume.
4 changes: 1 addition & 3 deletions trunk/MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2115,9 +2115,7 @@ S: Maintained
SOFTWARE SUSPEND:
P: Pavel Machek
M: pavel@suse.cz
M: pavel@ucw.cz
L: http://lister.fornax.hu/mailman/listinfo/swsusp
W: http://swsusp.sf.net/
L: linux-pm@osdl.org
S: Maintained

SONIC NETWORK DRIVER
Expand Down

0 comments on commit 582e101

Please sign in to comment.