All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	kvmarm@lists.cs.columbia.edu
Subject: [PATCH v2 4/4] arm64: hibernate: Clean the __hyp_text to PoC after resume
Date: Thu, 24 Jan 2019 16:32:57 +0000	[thread overview]
Message-ID: <20190124163257.233929-5-james.morse@arm.com> (raw)
In-Reply-To: <20190124163257.233929-1-james.morse@arm.com>

During resume hibernate restores all physical memory. Any memory
that is accessed with the MMU disabled needs to be cleaned to the
PoC.

KVMs __hyp_text was previously ommitted as it runs with the MMU
enabled, but now that the hyp-stub is located in this section,
we must clean __hyp_text too.

This ensures secondary CPUs that come online after hibernate
has finished resuming, and load KVM via the freshly written
hyp-stub see the correct instructions.

Signed-off-by: James Morse <james.morse@arm.com>
Cc: stable@vger.kernel.org
---
 arch/arm64/kernel/hibernate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 29cdc99688f3..9859e1178e6b 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -299,8 +299,10 @@ int swsusp_arch_suspend(void)
 		dcache_clean_range(__idmap_text_start, __idmap_text_end);
 
 		/* Clean kvm setup code to PoC? */
-		if (el2_reset_needed())
+		if (el2_reset_needed()) {
 			dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end);
+			dcache_clean_range(__hyp_text_start, __hyp_text_end);
+		}
 
 		/* make the crash dump kernel image protected again */
 		crash_post_resume();
-- 
2.20.1

WARNING: multiple messages have this Message-ID (diff)
From: James Morse <james.morse@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Christoffer Dall <christoffer.dall@arm.com>,
	james.morse@arm.com, Masami Hiramatsu <mhiramat@kernel.org>,
	kvmarm@lists.cs.columbia.edu
Subject: [PATCH v2 4/4] arm64: hibernate: Clean the __hyp_text to PoC after resume
Date: Thu, 24 Jan 2019 16:32:57 +0000	[thread overview]
Message-ID: <20190124163257.233929-5-james.morse@arm.com> (raw)
In-Reply-To: <20190124163257.233929-1-james.morse@arm.com>

During resume hibernate restores all physical memory. Any memory
that is accessed with the MMU disabled needs to be cleaned to the
PoC.

KVMs __hyp_text was previously ommitted as it runs with the MMU
enabled, but now that the hyp-stub is located in this section,
we must clean __hyp_text too.

This ensures secondary CPUs that come online after hibernate
has finished resuming, and load KVM via the freshly written
hyp-stub see the correct instructions.

Signed-off-by: James Morse <james.morse@arm.com>
Cc: stable@vger.kernel.org
---
 arch/arm64/kernel/hibernate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 29cdc99688f3..9859e1178e6b 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -299,8 +299,10 @@ int swsusp_arch_suspend(void)
 		dcache_clean_range(__idmap_text_start, __idmap_text_end);
 
 		/* Clean kvm setup code to PoC? */
-		if (el2_reset_needed())
+		if (el2_reset_needed()) {
 			dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end);
+			dcache_clean_range(__hyp_text_start, __hyp_text_end);
+		}
 
 		/* make the crash dump kernel image protected again */
 		crash_post_resume();
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-01-24 16:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 16:32 [PATCH v2 0/4] Fix some KVM/HYP interactions with kprobes James Morse
2019-01-24 16:32 ` James Morse
2019-01-24 16:32 ` [PATCH v2 1/4] KVM: arm64: Forbid kprobing of the VHE world-switch code James Morse
2019-01-24 16:32   ` James Morse
2019-01-25  1:28   ` Masami Hiramatsu
2019-01-25  1:28     ` Masami Hiramatsu
2019-01-31  8:08   ` Christoffer Dall
2019-01-31  8:08     ` Christoffer Dall
2019-01-31 18:53     ` James Morse
2019-01-31 18:53       ` James Morse
2019-02-01  8:04       ` Christoffer Dall
2019-02-01  8:04         ` Christoffer Dall
2019-02-01 13:34   ` Marc Zyngier
2019-02-01 13:34     ` Marc Zyngier
2019-01-24 16:32 ` [PATCH v2 2/4] arm64: kprobe: Always blacklist the KVM " James Morse
2019-01-24 16:32   ` James Morse
2019-01-31  8:08   ` Christoffer Dall
2019-01-31  8:08     ` Christoffer Dall
2019-01-24 16:32 ` [PATCH v2 3/4] arm64: hyp-stub: Forbid kprobing of the hyp-stub James Morse
2019-01-24 16:32   ` James Morse
2019-01-31  8:04   ` Christoffer Dall
2019-01-31  8:04     ` Christoffer Dall
2019-02-01 12:02     ` James Morse
2019-02-01 12:02       ` James Morse
2019-01-24 16:32 ` James Morse [this message]
2019-01-24 16:32   ` [PATCH v2 4/4] arm64: hibernate: Clean the __hyp_text to PoC after resume James Morse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190124163257.233929-5-james.morse@arm.com \
    --to=james.morse@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.