]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.98/arm64-hibernate-clean-the-__hyp_text-to-poc-after-resume.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.98 / arm64-hibernate-clean-the-__hyp_text-to-poc-after-resume.patch
CommitLineData
ed43125d
GKH
1From f7daa9c8fd191724b9ab9580a7be55cd1a67d799 Mon Sep 17 00:00:00 2001
2From: James Morse <james.morse@arm.com>
3Date: Thu, 24 Jan 2019 16:32:57 +0000
4Subject: arm64: hibernate: Clean the __hyp_text to PoC after resume
5
6From: James Morse <james.morse@arm.com>
7
8commit f7daa9c8fd191724b9ab9580a7be55cd1a67d799 upstream.
9
10During resume hibernate restores all physical memory. Any memory
11that is accessed with the MMU disabled needs to be cleaned to the
12PoC.
13
14KVMs __hyp_text was previously ommitted as it runs with the MMU
15enabled, but now that the hyp-stub is located in this section,
16we must clean __hyp_text too.
17
18This ensures secondary CPUs that come online after hibernate
19has finished resuming, and load KVM via the freshly written
20hyp-stub see the correct instructions.
21
22Signed-off-by: James Morse <james.morse@arm.com>
23Cc: stable@vger.kernel.org
24Signed-off-by: Will Deacon <will.deacon@arm.com>
25Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27---
28 arch/arm64/kernel/hibernate.c | 4 +++-
29 1 file changed, 3 insertions(+), 1 deletion(-)
30
31--- a/arch/arm64/kernel/hibernate.c
32+++ b/arch/arm64/kernel/hibernate.c
33@@ -299,8 +299,10 @@ int swsusp_arch_suspend(void)
34 dcache_clean_range(__idmap_text_start, __idmap_text_end);
35
36 /* Clean kvm setup code to PoC? */
37- if (el2_reset_needed())
38+ if (el2_reset_needed()) {
39 dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end);
40+ dcache_clean_range(__hyp_text_start, __hyp_text_end);
41+ }
42
43 /* make the crash dump kernel image protected again */
44 crash_post_resume();