Skip to content

Commit 24f69c0

Browse files
David BrazdilMarc Zyngier
authored andcommitted
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 <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3a949f4 commit 24f69c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kvm/va_layout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ __init void kvm_compute_layout(void)
4848
va_mask = GENMASK_ULL(tag_lsb - 1, 0);
4949
tag_val = hyp_va_msb;
5050

51-
if (tag_lsb != (vabits_actual - 1)) {
51+
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && tag_lsb != (vabits_actual - 1)) {
5252
/* We have some free bits to insert a random tag. */
5353
tag_val |= get_random_long() & GENMASK_ULL(vabits_actual - 2, tag_lsb);
5454
}

0 commit comments

Comments
 (0)