Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp656531imj; Wed, 13 Feb 2019 15:06:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IZzzYuYvp5u9dPlyFkibUrusFf826DNurmlC2LINVAR0sZEpZuwThmSOEgltMTyYUCqlfs3 X-Received: by 2002:a63:4b60:: with SMTP id k32mr631525pgl.186.1550099216131; Wed, 13 Feb 2019 15:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550099216; cv=none; d=google.com; s=arc-20160816; b=LcttPFyB17HTc7kxmOW4dDE/kkhzkWK7ZDU3xuf/BzVVRhTIkXBB1NS2N3Dgdoxa1F 1XDCdTSqyeg+WghyCEKo3ccyqXKXcRZpqNPL2pP456YLC0ywBY+UC09V8ETs6QzsDqnI 1ln9B3IbioASuMegfZ4v09Wgewbf/eI4g8TlKn6pF++x23ItikqQM44or1H7CyRCanha JzOpXXnQg8YY5SqoAzCbXjZUB9c7IoIdRU2oCFcU/Y6bE4yGgW63Wuou7WEGwBSQyf61 QJ7gpzr/WkuZui3yKccAEx0KgGGaBKN7KPeSjrYRMtLoZNncCP+iUseA1eTfpO4FSxMp DsiQ== 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:references:cc:to:subject:from; bh=Vy+cQcy3a3orp2Q/3JnqznuR4UEoXp+94dzNpxEz6xM=; b=Pz2nAcWx4VJzqRGDhd/ivh4RZsInj2K1t1P2g/z3BaET61j37GZJiqeOfYO6Um+7HZ t9QMO+ptFgt1uggZmzpHfWawn1U+VryE8c13VbQpRLXBAZcZKE0+nQjKMvDWk62EZMLI MYcwlE7kzbAXp84VU/4uoak8Hf9svuuRuynZfcXelhqeoYvyjVGYAxn/HtRBt/Vv/HY1 ROnHGaYtZj2dIFRE7WAT3+eBO/mpSPIVOuULJm2mqLHldOyzkRCXD50XfZyy/3GW+lMt lpwN+3rAkmB/vv5SJRiiXPqzn3NpKtMHCgqDP/gKRw2yIMqeJ77aslHREj+UQ52UQ7sV dnzw== 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 y71si628499pfd.96.2019.02.13.15.06.39; Wed, 13 Feb 2019 15:06:56 -0800 (PST) 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 S2393100AbfBMRf1 (ORCPT + 99 others); Wed, 13 Feb 2019 12:35:27 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57940 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732687AbfBMRf1 (ORCPT ); Wed, 13 Feb 2019 12:35:27 -0500 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 41790A78; Wed, 13 Feb 2019 09:35:27 -0800 (PST) Received: from [10.1.197.21] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B3333F675; Wed, 13 Feb 2019 09:35:23 -0800 (PST) From: Kristina Martsenko Subject: Re: [PATCH v5 4/5] arm64/kvm: add a userspace option to enable pointer authentication To: Amit Daniel Kachhap , linux-arm-kernel@lists.infradead.org Cc: Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , Andrew Jones , Dave Martin , Ramana Radhakrishnan , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Mark Rutland References: <1548658727-14271-1-git-send-email-amit.kachhap@arm.com> <1548658727-14271-5-git-send-email-amit.kachhap@arm.com> Message-ID: Date: Wed, 13 Feb 2019 17:35:22 +0000 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: <1548658727-14271-5-git-send-email-amit.kachhap@arm.com> Content-Type: text/plain; charset=utf-8 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 On 28/01/2019 06:58, Amit Daniel Kachhap wrote: > This feature will allow the KVM guest to allow the handling of > pointer authentication instructions or to treat them as undefined > if not set. It uses the existing vcpu API KVM_ARM_VCPU_INIT to > supply this parameter instead of creating a new API. > > A new register is not created to pass this parameter via > SET/GET_ONE_REG interface as just a flag (KVM_ARM_VCPU_PTRAUTH) > supplied is enough to enable this feature. [...] > diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h > index b200c14..b6950df 100644 > --- a/arch/arm/include/asm/kvm_host.h > +++ b/arch/arm/include/asm/kvm_host.h > @@ -346,6 +346,10 @@ static inline int kvm_arm_have_ssbd(void) > static inline void kvm_vcpu_load_sysregs(struct kvm_vcpu *vcpu) {} > static inline void kvm_vcpu_put_sysregs(struct kvm_vcpu *vcpu) {} > static inline void kvm_arm_vcpu_ptrauth_reset(struct kvm_vcpu *vcpu) {} > +static inline bool kvm_arm_vcpu_ptrauth_allowed(struct kvm_vcpu *vcpu) > +{ > + return false; > +} It seems like this is only ever called from arm64 code, so do we need an arch/arm/ definition? > +/** > + * kvm_arm_vcpu_ptrauth_allowed - checks if ptrauth feature is present in vcpu > + * > + * @vcpu: The VCPU pointer > + * > + * This function will be used to enable/disable ptrauth in guest as configured > + * by the KVM userspace API. > + */ > +bool kvm_arm_vcpu_ptrauth_allowed(struct kvm_vcpu *vcpu) > +{ > + return test_bit(KVM_ARM_VCPU_PTRAUTH, vcpu->arch.features); > +} I'm not sure, but should there also be something like if (test_bit(KVM_ARM_VCPU_PTRAUTH, vcpu->arch.features) && !kvm_supports_ptrauth()) return -EINVAL; in kvm_reset_vcpu? Thanks, Kristina