Skip to content

Commit 8673e5b

Browse files
rhythm16Marc Zyngier
authored andcommitted
KVM: arm64: ptdump: Don't test PTE_VALID alongside other attributes
The attribute masks and test values in the ptdump code are meant for individual attributes, however for stage-2 ptdump we included PTE_VALID while testing for R, W, X, and AF. This led to some confusion and the flipped output for the executable attribute. Remove PTE_VALID from all attribute masks and values so that each test matches only the relevant bits. Additionally, the executable attribute printing is updated to align with stage-1 ptdump, printing "NX" for non-executable regions and "x " for executable ones. Suggested-by: Anshuman Khandual <anshuman.khandual@arm.com> Suggested-by: Mark Rutland <mark.rutland@arm.com> Suggested-by: Sebastian Ene <sebastianene@google.com> Signed-off-by: Wei-Lin Chang <r09922117@csie.ntu.edu.tw> Acked-by: Will Deacon <will@kernel.org> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 1b237f1 commit 8673e5b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

arch/arm64/kvm/ptdump.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ static const struct ptdump_prot_bits stage2_pte_bits[] = {
3232
.set = " ",
3333
.clear = "F",
3434
}, {
35-
.mask = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R | PTE_VALID,
36-
.val = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R | PTE_VALID,
35+
.mask = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R,
36+
.val = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R,
3737
.set = "R",
3838
.clear = " ",
3939
}, {
40-
.mask = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W | PTE_VALID,
41-
.val = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W | PTE_VALID,
40+
.mask = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W,
41+
.val = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W,
4242
.set = "W",
4343
.clear = " ",
4444
}, {
45-
.mask = KVM_PTE_LEAF_ATTR_HI_S2_XN | PTE_VALID,
46-
.val = PTE_VALID,
47-
.set = " ",
48-
.clear = "X",
45+
.mask = KVM_PTE_LEAF_ATTR_HI_S2_XN,
46+
.val = KVM_PTE_LEAF_ATTR_HI_S2_XN,
47+
.set = "NX",
48+
.clear = "x ",
4949
}, {
50-
.mask = KVM_PTE_LEAF_ATTR_LO_S2_AF | PTE_VALID,
51-
.val = KVM_PTE_LEAF_ATTR_LO_S2_AF | PTE_VALID,
50+
.mask = KVM_PTE_LEAF_ATTR_LO_S2_AF,
51+
.val = KVM_PTE_LEAF_ATTR_LO_S2_AF,
5252
.set = "AF",
5353
.clear = " ",
5454
}, {

0 commit comments

Comments
 (0)