From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 003E3C433E1 for ; Mon, 15 Jun 2020 10:16:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8012206B7 for ; Mon, 15 Jun 2020 10:16:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sUYMgOVA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8012206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d1fjDIQBTFxLQWAvyvilk+BrQjQj5hZB5kdh83WiKSs=; b=sUYMgOVAT0gqBA 8LXErKKI38C9g8Lv8CcyImgSizesOLULX6GMd6Rd7EHABmGQKpFayPHlvwuutxX4qSPShteEK/4d4 PUnniwvdzBQKKMdaMh2Bv/Dar9JtiYeBwwSp6dnqIcSo5+1/YUjztgbgr4s+ygjl+f0b2IyUuZicd LrLLpV9rv41G4eX2DYlOoNTNc0jX4Ss59aFMKolwDjmaV0sj5EY8o7FFEu43FEGgyEiQ1mJ0/EnTB VUS5pfwScGuvG88mE2xVDzYIT8SnE9lUmQXWMn0A8GcaCo9q5Vazoata4KpQ4Lvr6z4nSkbCkK9LV GnLyABX09j1TBqtBH7bw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkmA0-0005lS-96; Mon, 15 Jun 2020 10:16:12 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jkm9x-0005l4-BY for linux-arm-kernel@lists.infradead.org; Mon, 15 Jun 2020 10:16:10 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 860D71F1; Mon, 15 Jun 2020 03:16:08 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.7.221]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9A7FA3F71F; Mon, 15 Jun 2020 03:16:07 -0700 (PDT) Date: Mon, 15 Jun 2020 11:16:05 +0100 From: Mark Rutland To: Marc Zyngier Subject: Re: [PATCH 3/4] KVM: arm64: Allow PtrAuth to be enabled from userspace on non-VHE systems Message-ID: <20200615101605.GC773@C02TD0UTHF1T.local> References: <20200615081954.6233-1-maz@kernel.org> <20200615081954.6233-4-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200615081954.6233-4-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200615_031609_442794_B9B04E34 X-CRM114-Status: GOOD ( 18.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 15, 2020 at 09:19:53AM +0100, Marc Zyngier wrote: > Now that the scene is set for enabling PtrAuth on non-VHE, drop > the restrictions preventing userspace from enabling it. > > Signed-off-by: Marc Zyngier Other than dropping the `has_vhe()` check this appears to be functionally equivalent and easier to follow, so: Acked-by: Mark Rutland Mark. > --- > arch/arm64/kvm/reset.c | 21 ++++++++++----------- > 1 file changed, 10 insertions(+), 11 deletions(-) > > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c > index d3b209023727..2a929789fe2e 100644 > --- a/arch/arm64/kvm/reset.c > +++ b/arch/arm64/kvm/reset.c > @@ -42,6 +42,11 @@ static u32 kvm_ipa_limit; > #define VCPU_RESET_PSTATE_SVC (PSR_AA32_MODE_SVC | PSR_AA32_A_BIT | \ > PSR_AA32_I_BIT | PSR_AA32_F_BIT) > > +static bool system_has_full_ptr_auth(void) > +{ > + return system_supports_address_auth() && system_supports_generic_auth(); > +} > + > /** > * kvm_arch_vm_ioctl_check_extension > * > @@ -80,8 +85,7 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext) > break; > case KVM_CAP_ARM_PTRAUTH_ADDRESS: > case KVM_CAP_ARM_PTRAUTH_GENERIC: > - r = has_vhe() && system_supports_address_auth() && > - system_supports_generic_auth(); > + r = system_has_full_ptr_auth(); > break; > default: > r = 0; > @@ -205,19 +209,14 @@ static void kvm_vcpu_reset_sve(struct kvm_vcpu *vcpu) > > static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu) > { > - /* Support ptrauth only if the system supports these capabilities. */ > - if (!has_vhe()) > - return -EINVAL; > - > - if (!system_supports_address_auth() || > - !system_supports_generic_auth()) > - return -EINVAL; > /* > * For now make sure that both address/generic pointer authentication > - * features are requested by the userspace together. > + * features are requested by the userspace together and the system > + * supports these capabilities. > */ > if (!test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || > - !test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) > + !test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features) || > + !system_has_full_ptr_auth()) > return -EINVAL; > > vcpu->arch.flags |= KVM_ARM64_GUEST_HAS_PTRAUTH; > -- > 2.27.0 > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel