]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Teach ptdump about FEAT_XNX permissions
authorOliver Upton <oupton@kernel.org>
Mon, 24 Nov 2025 19:01:46 +0000 (11:01 -0800)
committerOliver Upton <oupton@kernel.org>
Mon, 1 Dec 2025 08:43:47 +0000 (00:43 -0800)
Although KVM doesn't make direct use of the feature, guest hypervisors
can use FEAT_XNX which influences the permissions of the shadow stage-2.
Update ptdump to separately print the privileged and unprivileged
execute permissions.

Reviewed-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Link: https://msgid.link/20251124190158.177318-5-oupton@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
arch/arm64/kvm/ptdump.c

index dc5acfb00af91ac3285bb3e866f402072d8a7a9a..6cbe018fd6fda3cacef61700b494ab8401eac483 100644 (file)
@@ -31,27 +31,46 @@ static const struct ptdump_prot_bits stage2_pte_bits[] = {
                .val    = PTE_VALID,
                .set    = " ",
                .clear  = "F",
-       }, {
+       },
+       {
                .mask   = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R,
                .val    = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R,
                .set    = "R",
                .clear  = " ",
-       }, {
+       },
+       {
                .mask   = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W,
                .val    = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W,
                .set    = "W",
                .clear  = " ",
-       }, {
+       },
+       {
                .mask   = KVM_PTE_LEAF_ATTR_HI_S2_XN,
-               .val    = KVM_PTE_LEAF_ATTR_HI_S2_XN,
-               .set    = "NX",
-               .clear  = "x ",
-       }, {
+               .val    = 0b00UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN),
+               .set    = "px ux ",
+       },
+       {
+               .mask   = KVM_PTE_LEAF_ATTR_HI_S2_XN,
+               .val    = 0b01UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN),
+               .set    = "PXNux ",
+       },
+       {
+               .mask   = KVM_PTE_LEAF_ATTR_HI_S2_XN,
+               .val    = 0b10UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN),
+               .set    = "PXNUXN",
+       },
+       {
+               .mask   = KVM_PTE_LEAF_ATTR_HI_S2_XN,
+               .val    = 0b11UL << __bf_shf(KVM_PTE_LEAF_ATTR_HI_S2_XN),
+               .set    = "px UXN",
+       },
+       {
                .mask   = KVM_PTE_LEAF_ATTR_LO_S2_AF,
                .val    = KVM_PTE_LEAF_ATTR_LO_S2_AF,
                .set    = "AF",
                .clear  = "  ",
-       }, {
+       },
+       {
                .mask   = PMD_TYPE_MASK,
                .val    = PMD_TYPE_SECT,
                .set    = "BLK",