]> git.baikalelectronics.ru Git - kernel.git/commit
PM / Hibernate: Fix memory corruption related to swap
authorRafael J. Wysocki <rjw@sisk.pl>
Fri, 3 Dec 2010 21:57:45 +0000 (22:57 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Mon, 6 Dec 2010 22:52:08 +0000 (23:52 +0100)
commit1a3589c3f6938510ddbe51f66a1ed5b285193064
tree6038002f46173ca785936ac2fe54177197f98a08
parent4978f84fd2120b0356ee062360e0c4dc7a0f2f9c
PM / Hibernate: Fix memory corruption related to swap

There is a problem that swap pages allocated before the creation of
a hibernation image can be released and used for storing the contents
of different memory pages while the image is being saved.  Since the
kernel stored in the image doesn't know of that, it causes memory
corruption to occur after resume from hibernation, especially on
systems with relatively small RAM that need to swap often.

This issue can be addressed by keeping the GFP_IOFS bits clear
in gfp_allowed_mask during the entire hibernation, including the
saving of the image, until the system is finally turned off or
the hibernation is aborted.  Unfortunately, for this purpose
it's necessary to rework the way in which the hibernate and
suspend code manipulates gfp_allowed_mask.

This change is based on an earlier patch from Hugh Dickins.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Hugh Dickins <hughd@google.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: stable@kernel.org
include/linux/gfp.h
kernel/power/hibernate.c
kernel/power/suspend.c
kernel/power/user.c
mm/page_alloc.c