Skip to content

Commit

Permalink
arm64: hibernate: Clean the __hyp_text to PoC after resume
Browse files Browse the repository at this point in the history
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
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
James Morse authored and Will Deacon committed Feb 1, 2019
1 parent 8fac5cb commit f7daa9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/arm64/kernel/hibernate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f7daa9c

Please sign in to comment.