Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5ece655

Browse files
author
Keir Fraser
committed
ANDROID: KVM: arm64: Fix host_stage2_pte_is_counted()
All valid host mappings are erroneously considered "counted" because KVM_HOST_S2_DEFAULT_MASK mistakenly drops bit KVM_INVALID_PTE_LOCKED (bit 10). Not only is this unnecessary, because the lock flag is only used in invalid ptes, it means that comparisons with KVM_HOST_S2_DEFAULT_MEM_PTE and KVM_HOST_S2_DEFAULT_MMIO_PTE can never succeed. Fix this by incorporating bit 10 back into KVM_HOST_S2_DEFAULT_MASK. Bug: 278749606 Change-Id: Ic8126e763e319e3ac9ae066d975b3ac48b15f60f Signed-off-by: Keir Fraser <keirf@google.com>
1 parent 2236625 commit 5ece655

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/arm64/include/asm/kvm_pgtable.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,8 @@ enum kvm_pgtable_prot {
258258
#define PKVM_HOST_MEM_PROT KVM_PGTABLE_PROT_RWX
259259
#define PKVM_HOST_MMIO_PROT KVM_PGTABLE_PROT_RW
260260

261-
#define KVM_HOST_S2_DEFAULT_MASK ((KVM_PTE_LEAF_ATTR_HI | \
262-
KVM_PTE_LEAF_ATTR_LO) & \
263-
~(KVM_INVALID_PTE_LOCKED))
261+
#define KVM_HOST_S2_DEFAULT_MASK (KVM_PTE_LEAF_ATTR_HI | \
262+
KVM_PTE_LEAF_ATTR_LO)
264263

265264
#define KVM_HOST_S2_DEFAULT_MEM_PTE \
266265
(PTE_S2_MEMATTR(MT_S2_NORMAL) | \

0 commit comments

Comments
 (0)