summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2020-07-21 10:44:44 +0100
committerMarc Zyngier <maz@kernel.org>2020-07-28 10:41:11 +0100
commit24f69c0fa4e252f706884114b7d6353aa07678b5 (patch)
tree721caeec3de6d526e61cdb89773048c00f939e9c /arch/arm64/kvm
parent3a949f4c93548751a377691b2a208063da05e369 (diff)
downloadlwn-24f69c0fa4e252f706884114b7d6353aa07678b5.tar.gz
lwn-24f69c0fa4e252f706884114b7d6353aa07678b5.zip
KVM: arm64: Make nVHE ASLR conditional on RANDOMIZE_BASE
If there are spare bits in non-VHE hyp VA, KVM unconditionally replaces them with a random tag chosen at init. Disable this if the kernel is built without RANDOMIZE_BASE to align with kernel behavior. Signed-off-by: David Brazdil <dbrazdil@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20200721094445.82184-2-dbrazdil@google.com
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/va_layout.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kvm/va_layout.c b/arch/arm64/kvm/va_layout.c
index a4f48c1ac28c..e0404bcab019 100644
--- a/arch/arm64/kvm/va_layout.c
+++ b/arch/arm64/kvm/va_layout.c
@@ -48,7 +48,7 @@ __init void kvm_compute_layout(void)
va_mask = GENMASK_ULL(tag_lsb - 1, 0);
tag_val = hyp_va_msb;
- if (tag_lsb != (vabits_actual - 1)) {
+ if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && tag_lsb != (vabits_actual - 1)) {
/* We have some free bits to insert a random tag. */
tag_val |= get_random_long() & GENMASK_ULL(vabits_actual - 2, tag_lsb);
}