From: Vincent Donnefort <vdonnefort@google.com>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Steffen Eiden <seiden@linux.ibm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Fuad Tabba <tabba@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 01/20] KVM: arm64: Only allow ptrauth for a pVM on a system with full ptrauth
Date: Thu, 3 Dec 2026 11:47:26 +0000 [thread overview]
Message-ID: <axFWzuGkaLuUajj4@google.com> (raw)
In-Reply-To: <20261125153911.106793-2-fuad.tabba@linux.dev>
On Wed, Nov 25, 2026 at 03:38:52PM +0000, Fuad Tabba wrote:
> EL2 allows a protected VM both ptrauth features whatever the system
> supports. An id_aa64isar1 override can leave a system with generic but
> not address auth. EL2 then doesn't trap the guest's key accesses, but
> it doesn't switch the keys either, since the switch is gated on
> ARM64_HAS_ADDRESS_AUTH. The host can read and write the guest's
> APGAKey.
>
> Only allow the ptrauth features when the system has full ptrauth, as
> the host does.
>
> Fixes: b56680de9c648 ("KVM: arm64: Initialize trap register values in hyp in pKVM")
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> ---
> arch/arm64/include/asm/kvm_pkvm.h | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_pkvm.h b/arch/arm64/include/asm/kvm_pkvm.h
> index fd042d2b54624..155ac35069245 100644
> --- a/arch/arm64/include/asm/kvm_pkvm.h
> +++ b/arch/arm64/include/asm/kvm_pkvm.h
> @@ -76,11 +76,14 @@ static inline void kvm_pkvm_vcpu_allowed_features(struct kvm *kvm,
> if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PMU_V3))
> set_bit(KVM_ARM_VCPU_PMU_V3, allowed);
>
> - if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PTRAUTH_ADDRESS))
> - set_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, allowed);
> + /* Without address auth, EL2 doesn't switch the guest's keys. */
> + if (system_has_full_ptr_auth()) {
> + if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PTRAUTH_ADDRESS))
> + set_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, allowed);
>
> - if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PTRAUTH_GENERIC))
> - set_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, allowed);
> + if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PTRAUTH_GENERIC))
> + set_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, allowed);
> + }
>
> if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_SVE))
> set_bit(KVM_ARM_VCPU_SVE, allowed);
> --
> 2.47.3
>
If we mandate both GENERIC and ADDRESS on the host, do we need to also update
vm_has_ptrauth() to
system_has_full_ptr_auth() && (kvm_vcpu_has_feature(kvm, KVM_ARM_VCPU_PTRAUTH_ADDRESS) ||
kvm_vcpu_has_feature(kvm, KVM_ARM_VCPU_PTRAUTH_GENERIC)
and pvmid_aa64isar1 to
MAX_FEAT_FUNC(GPA, IMP, vm_has_ptrauth),
MAX_FEAT_FUNC(GPI, IMP, vm_has_ptrauth),
--
Vincent
next prev parent reply other threads:[~2026-12-03 11:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 15:38 [PATCH v2 00/20] KVM: arm64: Support debug, SVE, MOPS, PIE/POE, FPMR and more in protected VMs Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 01/20] KVM: arm64: Only allow ptrauth for a pVM on a system with full ptrauth Fuad Tabba
2026-12-03 11:47 ` Vincent Donnefort [this message]
2026-11-25 15:38 ` [PATCH v2 02/20] KVM: arm64: Don't advertise the host's MTE_frac to protected VMs Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 03/20] KVM: arm64: Add support for self-hosted debug in protected guests Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 04/20] KVM: arm64: Remove redundant kern_hyp_va() calls from the pKVM FP sync Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 05/20] KVM: arm64: Allocate a protected vCPU's SVE state at EL2 Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 06/20] KVM: arm64: Advertise ID_AA64ZFR0_EL1 to protected VMs Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 07/20] KVM: arm64: Allow protected VMs to use SVE Fuad Tabba
2026-11-25 15:38 ` [PATCH v2 08/20] KVM: arm64: Move the VM's FGU initialisation into config.c Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 09/20] KVM: arm64: Report an incomplete feature map with WARN_ON() Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 10/20] KVM: arm64: Advertise the GICv3 CPU interface to protected VMs on GICv5 Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 11/20] KVM: arm64: Compute a protected vCPU's fine-grained traps at EL2 Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 12/20] KVM: arm64: Advertise TCR2, SCTLR2, S1PIE and S1POE to protected VMs Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 13/20] KVM: arm64: Advertise MOPS " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 14/20] KVM: arm64: Advertise FPMR " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 15/20] KVM: arm64: Advertise HBC, CLRBHB, RPRFM, CSSC and LUT " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 16/20] KVM: arm64: Advertise FAMINMAX, LSFE, LSUI and FPRCVT " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 17/20] KVM: arm64: Advertise AFP and RPRES " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 18/20] KVM: arm64: Advertise ECBHB, TIDCP1, TTST and LVA " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 19/20] KVM: arm64: Advertise FP8 and F16MM " Fuad Tabba
2026-11-25 15:39 ` [PATCH v2 20/20] KVM: arm64: Advertise ECV, HAFT and ETS3 " Fuad Tabba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=axFWzuGkaLuUajj4@google.com \
--to=vdonnefort@google.com \
--cc=catalin.marinas@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=tabba@google.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox