Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp526796img; Thu, 28 Feb 2019 03:44:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IaceIKSevieBze6NEz/xZt2vzBVmaNCCJrlaaaPbp84gzsYC1hJriXbW3ugvmIfBuUOP2TV X-Received: by 2002:a17:902:7614:: with SMTP id k20mr7462929pll.298.1551354272426; Thu, 28 Feb 2019 03:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551354272; cv=none; d=google.com; s=arc-20160816; b=Gh/4dVdznoyRkzZiz61FnevopMAVul0+x7XhSaMgrNTUF2Kbweja3KJXcehFgWZ71C /LY/YhBU3rhJZnxCOpiNk1FsWbBY3blshWJ89kIMPh3x23SsElQlG1N4WNjDQMGNZMA9 hk7ivR7dNzmd3deu0ZlUwjy7B+zl8+6s9YlhJOMvnlnTt/DGwaTD0BRE6WVZsbrouzRZ 2JxWw4Jmdjq9Smy3WtXi36hmDY3XQ/KSJtpVHLLNp1cPApKofWU7cJ3tLQHUQx0XPH4U zTcXQ3jSqEy0Cm8cUI3C2YWboC9gBacj8PMKyILAdkDJ0qDapFv/HWmHhbNPh20xFWgd AK7w== 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=lH8GFygzl0oIBmTgWlvB7pzHUMy3Xc840yhu7ktfdzk=; b=K3AH43cuo1RWBmhX8rIyJi11NgHQOODExzeVieJyfd67Mw6eZzGycqcsIgFOhv+Ruc YBLjMmXGLbw3mMuUUtvRhxEMKP4cp6D8pWPUQT6aU4Q7T5rycO8aKvkOwSAU3lVpJHsh ifska5NZs9Es9lVXybU22ODIkcQVlMRI8GKJ3OynorFBWwsxK/QDDcceIuI2ZOiwjsav fyHizjNCDpsNVVw4rgvOVsfmJDR1VWuh2IXrdvbpe/LqhF9TXKCMb5Li6ELMi+Fi3hS7 SVGsVOp4DAtrFAF/aYC6uyUrJVJ6LTlADyCE9ZuT/YKiUbly6hoFjzu2hO70RTzpACWD ZVzg== 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 cm2si19229365plb.327.2019.02.28.03.44.17; Thu, 28 Feb 2019 03:44:32 -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 S1727889AbfB1JZJ (ORCPT + 99 others); Thu, 28 Feb 2019 04:25:09 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44774 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbfB1JZI (ORCPT ); Thu, 28 Feb 2019 04:25:08 -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 25AFDEBD; Thu, 28 Feb 2019 01:25:08 -0800 (PST) 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 4F2663F738; Thu, 28 Feb 2019 01:25:04 -0800 (PST) Subject: Re: [PATCH v6 4/6] arm64/kvm: add a userspace option to enable pointer authentication To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, 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, James Morse , Julien Thierry References: <1550568271-5319-1-git-send-email-amit.kachhap@arm.com> <1550568271-5319-5-git-send-email-amit.kachhap@arm.com> <20190221123416.GD33673@lakrids.cambridge.arm.com> From: Amit Daniel Kachhap Message-ID: Date: Thu, 28 Feb 2019 14:55:02 +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: <20190221123416.GD33673@lakrids.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 2/21/19 6:04 PM, Mark Rutland wrote: > On Tue, Feb 19, 2019 at 02:54:29PM +0530, 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. >> >> Signed-off-by: Amit Daniel Kachhap >> Cc: Mark Rutland >> Cc: Marc Zyngier >> Cc: Christoffer Dall >> Cc: kvmarm@lists.cs.columbia.edu >> --- >> Documentation/arm64/pointer-authentication.txt | 9 +++++---- >> Documentation/virtual/kvm/api.txt | 4 ++++ >> arch/arm64/include/asm/kvm_host.h | 3 ++- >> arch/arm64/include/uapi/asm/kvm.h | 1 + >> arch/arm64/kvm/handle_exit.c | 2 +- >> arch/arm64/kvm/hyp/ptrauth-sr.c | 16 +++++++++++++++- >> arch/arm64/kvm/reset.c | 3 +++ >> arch/arm64/kvm/sys_regs.c | 26 +++++++++++++------------- >> include/uapi/linux/kvm.h | 1 + >> 9 files changed, 45 insertions(+), 20 deletions(-) >> >> diff --git a/Documentation/arm64/pointer-authentication.txt b/Documentation/arm64/pointer-authentication.txt >> index a25cd21..0529a7d 100644 >> --- a/Documentation/arm64/pointer-authentication.txt >> +++ b/Documentation/arm64/pointer-authentication.txt >> @@ -82,7 +82,8 @@ pointers). >> 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 virtual machine is >> +created by passing a flag (KVM_ARM_VCPU_PTRAUTH) requesting this feature >> +to be enabled. Without this flag, pointer authentication is not enabled >> +in KVM guests and attempted use of the feature will result in an UNDEFINED >> +exception being injected into the guest. >> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt >> index 356156f..1e646fb 100644 >> --- a/Documentation/virtual/kvm/api.txt >> +++ b/Documentation/virtual/kvm/api.txt >> @@ -2642,6 +2642,10 @@ 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: Emulate 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. > > I think that we should have separate flags for address auth and generic > auth, to match the ID register split. > > For now, we can have KVM only support the case where both are set, but > it gives us freedom to support either in isolation if we have to in > future, without an ABI break. yes agree with you about having two address and generic ptrauth flags. Will add in next iteration. Thanks, Amit D > > Thanks, > Mark. >