Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Fix EL2 S1 XN handling for hVHE setups

The current XN implementation is tied to the EL2 translation regime,
and fall flat on its face with the EL2&0 one that is used for hVHE,
as the permission bit for privileged execution is a different one.

Fixes: 6537565fd9b7f ("KVM: arm64: Adjust EL2 stage-1 leaf AP bits when ARM64_KVM_HVHE is set")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Fuad Tabba <tabba@google.com>
Link: https://msgid.link/20251210173024.561160-2-maz@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>

authored by

Marc Zyngier and committed by
Oliver Upton
8d8e882c 5e8b511c

+9 -1
+9 -1
arch/arm64/include/asm/kvm_pgtable.h
··· 87 87 88 88 #define KVM_PTE_LEAF_ATTR_HI_SW GENMASK(58, 55) 89 89 90 - #define KVM_PTE_LEAF_ATTR_HI_S1_XN BIT(54) 90 + #define __KVM_PTE_LEAF_ATTR_HI_S1_XN BIT(54) 91 + #define __KVM_PTE_LEAF_ATTR_HI_S1_UXN BIT(54) 92 + #define __KVM_PTE_LEAF_ATTR_HI_S1_PXN BIT(53) 93 + 94 + #define KVM_PTE_LEAF_ATTR_HI_S1_XN \ 95 + ({ cpus_have_final_cap(ARM64_KVM_HVHE) ? \ 96 + (__KVM_PTE_LEAF_ATTR_HI_S1_UXN | \ 97 + __KVM_PTE_LEAF_ATTR_HI_S1_PXN) : \ 98 + __KVM_PTE_LEAF_ATTR_HI_S1_XN; }) 91 99 92 100 #define KVM_PTE_LEAF_ATTR_HI_S2_XN GENMASK(54, 53) 93 101