]> Git Repo - linux.git/commitdiff
KVM: arm64: Make nVHE ASLR conditional on RANDOMIZE_BASE
authorDavid Brazdil <[email protected]>
Tue, 21 Jul 2020 09:44:44 +0000 (10:44 +0100)
committerMarc Zyngier <[email protected]>
Tue, 28 Jul 2020 09:41:11 +0000 (10:41 +0100)
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 <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
arch/arm64/kvm/va_layout.c

index a4f48c1ac28c09d4d91d188a90fa86dec4675457..e0404bcab019a22d70699c53f0ebbce781b34fc2 100644 (file)
@@ -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);
        }
This page took 0.056822 seconds and 4 git commands to generate.