Commit 81e9f061 authored by Nikhil V's avatar Nikhil V Committed by Suren Baghdasaryan
Browse files

UPSTREAM: arm64: mm: Make hibernation aware of KFENCE



In the restore path, swsusp_arch_suspend_exit uses copy_page() to
over-write memory. However, with features like KFENCE enabled, there could
be situations where it may have marked some pages as not valid, due to
which it could be reported as invalid accesses.

Consider a situation where page 'P' was part of the hibernation image.
Now, when the resume kernel tries to restore the pages, the same page 'P'
is already in use in the resume kernel and is kfence protected, due to
which its mapping is removed from linear map. Since restoring pages happens
with the resume kernel page tables, we would end up accessing 'P' during
copy and results in kernel pagefault.

The proposed fix tries to solve this issue by marking PTE as valid for such
kfence protected pages.

Bug: 350428411
Co-developed-by: default avatarPavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: default avatarPavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: default avatarNikhil V <quic_nprakash@quicinc.com>
Link: https://lore.kernel.org/r/20230713070757.4093-1-quic_nprakash@quicinc.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
(cherry picked from commit a8bd38db)
Change-Id: Ib1458808f6fc4b0cb4bcee62231425197cd6b448
Signed-off-by: default avatarNikhil V <quic_nprakash@quicinc.com>
parent aa8621e0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment