Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp572798img; Wed, 20 Mar 2019 06:39:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx31UUWbhZghaQDEOEGpiS9HUKpwQjbL/U3OChoKkaf/o0YY9HRCDGMkWPVTaNDrDI3cHg5 X-Received: by 2002:a17:902:8506:: with SMTP id bj6mr7974885plb.60.1553089193174; Wed, 20 Mar 2019 06:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553089193; cv=none; d=google.com; s=arc-20160816; b=hcmTvQIkn8idIUttS2iRQLpkNBSMqGQ1pEAC3IXLYH8TiC/V8pp5u0yatzDvz1J99R aJdkiD/9+UvfZ1GNisbIuNVjtycPwsxc4dN40Q6BwDM4OaqPgu/flTdEVTTaaziPsy+R vGGr/K8+ZIw8sx3V/TG7aCqjPZcFDBsq8wybqUpgWMhds707xBAic9vb2RqptBlQEeQa yO5dSN/0MANZKi82Yc/16c1U0whb+NFGB4yCYYEA724HRoHg4RIuXNyrbLJRHiS0gkHX OuN1NuoWRajvPIiJJCkbbcVjPKn5+npSjQSmwajfqqu7E4X1GRlI0rQ3NYLJJQv7N4S9 /weg== 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=fZ4kZMohyROB0cqPxWOkSkSxvCH1Pc4ecv3azaES+z4=; b=Z7JqAKg130d3Ypcwa1JR2BnFjmcVLvwmcr0KhdZl74svhIaZ3m97JrARAkeopWgN8y OkUHkvMT7hOLKGMacdvWkn1bF0avkPLiE+N4IQygS+TfzK8CT/QI0Wd7WP3JZ0Bds5NT /W+umwWsikukoB3hSZk0fT+Uh3NyOa3ldjjt14fAtWv49GYb5qv+0Q0pVpQVKibiDX+N 7wHAi370mLIHnlDNU5wce2mNZunExd03Ejwb97ive+xqRn+JGDCq+HtI+SLaTvekQd1F O1n7Q8hN21AjHdQnsTv+1pB279+oXjw/5w+dFA8OiPMw6TqCreq3ff9ClG3J4m65uvsn Smfw== 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 j3si1611361pfi.279.2019.03.20.06.39.36; Wed, 20 Mar 2019 06:39:53 -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 S1727939AbfCTNiN (ORCPT + 99 others); Wed, 20 Mar 2019 09:38:13 -0400 Received: from foss.arm.com ([217.140.101.70]:40234 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbfCTNiM (ORCPT ); Wed, 20 Mar 2019 09:38:12 -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 D7A871650; Wed, 20 Mar 2019 06:38:11 -0700 (PDT) Received: from [10.1.197.45] (e112298-lin.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7D6AF3F59C; Wed, 20 Mar 2019 06:38:08 -0700 (PDT) Subject: Re: [PATCH v7 9/10] KVM: arm64: docs: document KVM support of 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, Kristina Martsenko , linux-kernel@vger.kernel.org, Mark Rutland , James Morse References: <1552984243-7689-1-git-send-email-amit.kachhap@arm.com> <1552984243-7689-10-git-send-email-amit.kachhap@arm.com> From: Julien Thierry Message-ID: <7bf19035-02ba-ae47-b08c-7d7622a45dbf@arm.com> Date: Wed, 20 Mar 2019 13:37:58 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1552984243-7689-10-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 Hi Amit, On 19/03/2019 08:30, Amit Daniel Kachhap wrote: > This adds sections for KVM API extension for pointer authentication. > A brief description about usage of pointer authentication for KVM guests > is added in the arm64 documentations. > > Signed-off-by: Amit Daniel Kachhap > Cc: Mark Rutland > Cc: Christoffer Dall > Cc: Marc Zyngier > Cc: kvmarm@lists.cs.columbia.edu > --- > Documentation/arm64/pointer-authentication.txt | 15 +++++++++++---- > Documentation/virtual/kvm/api.txt | 6 ++++++ > 2 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/Documentation/arm64/pointer-authentication.txt b/Documentation/arm64/pointer-authentication.txt > index 5baca42..4b769e6 100644 > --- a/Documentation/arm64/pointer-authentication.txt > +++ b/Documentation/arm64/pointer-authentication.txt > @@ -87,7 +87,14 @@ used to get and set the keys for a thread. > Virtualization > -------------- > > -Pointer authentication is not currently supported in KVM guests. KVM > -will mask the feature bits from ID_AA64ISAR1_EL1, and attempted use of > -the feature will result in an UNDEFINED exception being injected into > -the guest. > +Pointer authentication is enabled in KVM guest when each virtual cpu is > +initialised by passing flags KVM_ARM_VCPU_PTRAUTH_[ADDRESS/GENERIC] and > +requesting this feature to be enabled. Without this flag, pointer "Without these flags"* > +authentication is not enabled in KVM guests and attempted use of the > +feature will result in an UNDEFINED exception being injected into the > +guest. > + > +Additionally, when these vcpu feature flags are not set then KVM will > +filter out the Pointer Authentication system key registers from > +KVM_GET/SET_REG_* ioctls and mask those features from cpufeature ID > +register. > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt > index 7de9eee..b5c66bc 100644 > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -2659,6 +2659,12 @@ Possible features: > Depends on KVM_CAP_ARM_PSCI_0_2. > - KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU. > Depends on KVM_CAP_ARM_PMU_V3. > + - KVM_ARM_VCPU_PTRAUTH_ADDRESS: > + - KVM_ARM_VCPU_PTRAUTH_GENERIC: > + Enables Pointer authentication for the CPU. > + Depends on KVM_CAP_ARM_PTRAUTH and only on arm64 architecture. If > + set, then the KVM guest allows the execution of pointer authentication > + instructions. Otherwise, KVM treats these instructions as undefined. > Overall I feel one could easily get confused to whether PTRAUTH_ADDRESS/GENERIC are two individual features, whether one is a superset of the other, if the names are just an alias of one another, etc... I think the doc should at least stress out that *both* flags are required to enable ptrauth in a guest. However it raises the question, if we don't plan to support the features individually (because we can't), should we really expose two feature flags? I seems odd to introduce two flags that only do something if used together... Cheers, -- Julien Thierry