]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: Fix kernel_page_present() for KPRANGE/XKPRANGE
authorHuacai Chen <chenhuacai@loongson.cn>
Thu, 13 Feb 2025 04:02:35 +0000 (12:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Mar 2025 19:54:17 +0000 (12:54 -0700)
commitf30b7b949ed80ae3d6675713d122bd9c93a79eba
tree493b7f9cf56a9a2c25e022a1c8c903d467ddbc39
parenta91922e9eab5a9f88e00617065414e817a3818f5
LoongArch: Fix kernel_page_present() for KPRANGE/XKPRANGE

[ Upstream commit 619b52777a4972bdb6ddf86ac54c6f68a47b51c4 ]

Now kernel_page_present() always return true for KPRANGE/XKPRANGE
addresses, this isn't correct because hibernation (ACPI S4) use it
to distinguish whether a page is saveable. If all KPRANGE/XKPRANGE
addresses are considered as saveable, then reserved memory such as
EFI_RUNTIME_SERVICES_CODE / EFI_RUNTIME_SERVICES_DATA will also be
saved and restored.

Fix this by returning true only if the KPRANGE/XKPRANGE address is in
memblock.memory.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/loongarch/mm/pageattr.c