Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp219599yba; Tue, 23 Apr 2019 23:20:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkqcAl9M+wRArgIQzH9/ceUwti4Wc/j58EBc5fRs0J9HJiAHzbHvTzi0gEoAebZq6ODvLO X-Received: by 2002:aa7:8b8b:: with SMTP id r11mr1174061pfd.130.1556086801580; Tue, 23 Apr 2019 23:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556086801; cv=none; d=google.com; s=arc-20160816; b=OD0uOFcQwJBwKeB6eqxa7VyRjEQtIqPIBqTfizcb4Walbkwgl1t9VLv9qcnCck91w9 lBCr38bZXBVT3V9KOM4bP/7C4/S5+mKKRT8/W0ijdRamYFpwEol6j71f/CY3gtuUCvQV 5d1aHMZ3gC/7LN/u8y6zmH9R3sFyA88Vyy+oK4EnTrGIN1czAIhFANUWjAw7oJIw/CZF L2gfLC+S9RLUjvS+vRYL7wh+RUU1X3p81r2L6EoabBfB5/904y9UFGOh1dIKBjvxMkH+ WwdZ0j+6nrUx38Xl4dgsTmy8BZQjVqVW4YRaMKOLxwDIW7tRgs0jpCuJPEoROP/HJFqS iBUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LVr3zB6lx/n+mPeP+jKKdD4K+KNfXqasU+M1Ke+WNY0=; b=Ar0siIGJlaC1AG41S9gDPPshcyYM1WPCTEbEQyYRGHcYRbdSyLj/JWb1TK2S/3a/Gb nfia36aSO6Ef38MIH67DsteqMKj3zsTl3i1TRqhsJldDpq5mC/o1w+51OVi9vUcKnRcv jhwp4EILVMjeV4DNuaZ15M4qewnOyEM1j3UTt8VD0/NWb5cLDCG0SnX8AR1cWOcbcvTL Zi4eoQ2ytZCk7S3JVD2iF8xFEfyRARNFb1lpaZJzrn30GGoUJgd7EiTlBe2PYA4bJ3zR AllTZTXz6uVBCzd/eyk8kmY/AatykUOpcVx/X5JL+/O9EFWtfScMGfxzrRilGlBUXC8e oEQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si7460431pla.405.2019.04.23.23.19.46; Tue, 23 Apr 2019 23:20:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729688AbfDXF54 (ORCPT + 99 others); Wed, 24 Apr 2019 01:57:56 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37948 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729244AbfDXF54 (ORCPT ); Wed, 24 Apr 2019 01:57:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 44111A78; Tue, 23 Apr 2019 22:57:55 -0700 (PDT) Received: from [10.162.0.144] (a075553-lin.blr.arm.com [10.162.0.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B27573F5AF; Tue, 23 Apr 2019 22:57:52 -0700 (PDT) Subject: Re: [PATCH v10 1/5] KVM: arm64: Add a vcpu flag to control ptrauth for guest To: Dave Martin Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Catalin Marinas , Will Deacon , Kristina Martsenko , kvmarm@lists.cs.columbia.edu, Ramana Radhakrishnan , linux-kernel@vger.kernel.org References: <1555994558-26349-1-git-send-email-amit.kachhap@arm.com> <1555994558-26349-2-git-send-email-amit.kachhap@arm.com> <20190423154419.GL3567@e103592.cambridge.arm.com> From: Amit Daniel Kachhap Message-ID: Date: Wed, 24 Apr 2019 11:27:50 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190423154419.GL3567@e103592.cambridge.arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 4/23/19 9:14 PM, Dave Martin wrote: > On Tue, Apr 23, 2019 at 10:12:34AM +0530, Amit Daniel Kachhap wrote: >> A per vcpu flag is added to check if pointer authentication is >> enabled for the vcpu or not. This flag may be enabled according to >> the necessary user policies and host capabilities. >> >> This patch also adds a helper to check the flag. >> >> Reviewed-by: Dave Martin >> Signed-off-by: Amit Daniel Kachhap >> Cc: Mark Rutland >> Cc: Marc Zyngier >> Cc: Christoffer Dall >> Cc: kvmarm@lists.cs.columbia.edu >> --- >> Changes since v9: >> >> * Added ptrauth cpufeature static check in vcpu_has_ptrauth [Marc Zyngier]. >> >> arch/arm64/include/asm/kvm_host.h | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h >> index 7a096fd..7ccac42 100644 >> --- a/arch/arm64/include/asm/kvm_host.h >> +++ b/arch/arm64/include/asm/kvm_host.h >> @@ -355,10 +355,15 @@ struct kvm_vcpu_arch { >> #define KVM_ARM64_HOST_SVE_ENABLED (1 << 4) /* SVE enabled for EL0 */ >> #define KVM_ARM64_GUEST_HAS_SVE (1 << 5) /* SVE exposed to guest */ >> #define KVM_ARM64_VCPU_SVE_FINALIZED (1 << 6) /* SVE config completed */ >> +#define KVM_ARM64_GUEST_HAS_PTRAUTH (1 << 7) /* PTRAUTH exposed to guest */ >> >> #define vcpu_has_sve(vcpu) (system_supports_sve() && \ >> ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE)) >> >> +#define vcpu_has_ptrauth(vcpu) ((system_supports_address_auth() || \ >> + system_supports_generic_auth()) && \ > > Come to think of it, should this be > system_supports_address_auth() _&&_ system_supports_generic_auth()? I thought about it and kept it this way so that the implementation limitation is not introduced in this patch but only in a single place in the 3rd patch where all the documentation and reasoning is present on doing this way. > > It won't make a functional difference today though, since today > kvm_vcpu_enable_ptrauth() won't set KVM_ARM64_GUEST_HAS_PTRAUTH without > system_supports_address_auth() and system_supports_generic_auth() both > true. > > With || here, we won't have to change this if supporting the two auth > types independently in the future though. Yes right. > > Either way, my Reviewed-by stands. Thanks, Amit D > > Cheers > ---Dave >