• Vlastimil Babka's avatar
    kernel/power: allow hibernation with page_poison sanity checking · 03b6c9a3
    Vlastimil Babka authored
    Page poisoning used to be incompatible with hibernation, as the state of
    poisoned pages was lost after resume, thus enabling CONFIG_HIBERNATION
    forces CONFIG_PAGE_POISONING_NO_SANITY.  For the same reason, the
    poisoning with zeroes variant CONFIG_PAGE_POISONING_ZERO used to disable
    hibernation.  The latter restriction was removed by commit 1ad1410f
    ("PM / Hibernate: allow hibernation with PAGE_POISONING_ZERO") and
    similarly for init_on_free by commit 18451f9f ("PM: hibernate: fix
    crashes with init_on_free=1") by making sure free pages are cleared after
    resume.
    
    We can use the same mechanism to instead poison free pages with
    PAGE_POISON after resume.  This covers both zero and 0xAA patterns.  Thus
    we can remove the Kconfig restriction that disables page poison sanity
    checking when hibernation is enabled.
    
    Link: https://lkml.kernel.org/r/20201113104033.22907-4-vbabka@suse.czSigned-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>	[hibernation]
    Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Mike Rapoport <rppt@linux.ibm.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Laura Abbott <labbott@kernel.org>
    Cc: Mateusz Nosek <mateusznosek0@gmail.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    03b6c9a3
snapshot.c 72.6 KB