]> exis.tech > repos - linux.git/commit
KVM: arm64: Only update XN attr when requested during S2 relaxation
authorOliver Upton <oupton@kernel.org>
Wed, 1 Jul 2026 23:16:20 +0000 (16:16 -0700)
committerMarc Zyngier <maz@kernel.org>
Mon, 6 Jul 2026 16:17:38 +0000 (17:17 +0100)
commitf35c08c092505f3a83ce097d94fe51eb8bc9c1b5
treeaa46e67bd00de4f8168a4c6511f1aee88dc33886
parent100baf0184896f859290a684f864b8200d8ac872
KVM: arm64: Only update XN attr when requested during S2 relaxation

On systems without DIC, KVM lazily grants execute permission to stage-2
translations after taking an instruction abort due to a permission
fault, allowing it to defer I-cache invalidations to the point they're
absolutely required.

If a data abort happens later down the line to such a translation, KVM
will not request execute permissions as part of the S2 relaxation on the
assumption that kvm_pgtable_stage2_relax_perms() does exactly what the
name implies and adds the requested permissions to the pre-existing
ones.

Avoid taking unintended execute permission faults by only preparing the
XN attribute if KVM_PGTABLE_PROT_X is set.

Fixes: 2608563b466b ("KVM: arm64: Add support for FEAT_XNX stage-2 permissions")
Signed-off-by: Oliver Upton <oupton@kernel.org>
Reviewed-by: Wei-Lin Chang <weilin.chang@arm.com>
Link: https://patch.msgid.link/20260701231620.3300204-3-oupton@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/pgtable.c