Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp618593imp; Thu, 21 Feb 2019 07:55:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IbYtb3820i9OMkrq9xvOkuCAF/J8VGipF8MFFI92tuPKyyTydEc+jE9A5Jb8i11Akw3BcTm X-Received: by 2002:a17:902:b598:: with SMTP id a24mr26144865pls.27.1550764550277; Thu, 21 Feb 2019 07:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550764550; cv=none; d=google.com; s=arc-20160816; b=TXjbsupm1oXG0uoYQYiBzyFdae4T2d9RtXQyD7QRpOAcl0yr4rlYFSNHCLE7m8f4iR 4X3t3AZOsjkfiwwDLzRZoWcvT9V7u6Ik1V3QtoWEO+MQkN8k+9p9KGhvZv7TdFY6qomq FLOqfxgppirKTqLs1nF6OkxsR/ahcVz6xzMfbsaL7zKT+0cbQk9RrQM6uJc3Xy1SRiCP f9QwF512BBqFAu/JJ6NY1G+JUQ1uqg2bV43vHzvkyoiJcSJN1TXLwWWxrYSv1KenE7fF Q/JSkI51rQ/gOi/Ltj57NmdOpm5SetatD63mGvS+fewN9pTUN/LGQnPXFWoBpJukDu7y QOdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BsTR31B8MutKSg/fJqvPFo4vZwevxaIrNQ119WXon04=; b=CI0asGMBKMMqvOiDDG5CKA/rqcS+R2aAtFmNmq28tFVKSEg8TadvEy4C30MrqQ7Wq5 vtlCeQlk7VCRhTsUWhuYXe+K+OFowxUwXgjXVwEoT9YcYMsSH8r9nhVC0is4yScVYVgQ isD6GVIzUW39C5SlmIV0/kRqoqIqElyT+9J19bTB2AzM5JHsmfwFYbnKzjR/d9ku8CJh Uly/ON6w6urvVV8ToTH0YOH2X+BDiwizp0n4k7MJ6nGiz9khv9KLd2KpANPXEom6F3Xz 405VdjPb6KeHMmULZlciIEmmjvYmUSv38hep2UGoCxK38ObJooEtMdyw5cHGT3I5sSFJ SQpA== 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 d21si891074pll.437.2019.02.21.07.55.35; Thu, 21 Feb 2019 07:55:50 -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 S1728607AbfBUPyE (ORCPT + 99 others); Thu, 21 Feb 2019 10:54:04 -0500 Received: from foss.arm.com ([217.140.101.70]:46872 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728224AbfBUPyE (ORCPT ); Thu, 21 Feb 2019 10:54:04 -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 C4CE2A78; Thu, 21 Feb 2019 07:54:03 -0800 (PST) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D67EC3F5C1; Thu, 21 Feb 2019 07:54:01 -0800 (PST) Date: Thu, 21 Feb 2019 15:53:59 +0000 From: Dave Martin To: Amit Daniel Kachhap 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 Subject: Re: [PATCH v6 5/6] arm64/kvm: control accessibility of ptrauth key registers Message-ID: <20190221155359.GZ3567@e103592.cambridge.arm.com> References: <1550568271-5319-1-git-send-email-amit.kachhap@arm.com> <1550568271-5319-6-git-send-email-amit.kachhap@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550568271-5319-6-git-send-email-amit.kachhap@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 19, 2019 at 02:54:30PM +0530, Amit Daniel Kachhap wrote: > According to userspace settings, ptrauth key registers are conditionally > present in guest system register list based on user specified flag > KVM_ARM_VCPU_PTRAUTH. > > Reset routines still sets these registers to default values but they are > left like that as they are conditionally accessible (set/get). > > Signed-off-by: Amit Daniel Kachhap > Cc: Mark Rutland > Cc: Marc Zyngier > Cc: Christoffer Dall > Cc: kvmarm@lists.cs.columbia.edu > --- > This patch needs patch [1] by Dave Martin and adds feature to manage accessibility in a scalable way. > > [1]: https://lore.kernel.org/linux-arm-kernel/1547757219-19439-13-git-send-email-Dave.Martin@arm.com/ FYI, check_present() has changed a bit in the SVE v5 series [2]. The precise interface is still under discussion, so please take a look and feel free to comment. You'll probably need to tweak some things so that the KVM_GET_REG_LIST output is consistent with the set of regs that do/don't yield -ENOENT in KVM_GET_ONE_REG/KVM_SET_ONE_REG. See other patches in the series for examples of how I use the modified interface. [...] > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > index f7bcc60..c2f4974 100644 > --- a/arch/arm64/kvm/sys_regs.c > +++ b/arch/arm64/kvm/sys_regs.c > @@ -1005,8 +1005,13 @@ static bool trap_ptrauth(struct kvm_vcpu *vcpu, > return false; > } > > +static bool check_ptrauth(const struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd) > +{ > + return kvm_arm_vcpu_ptrauth_allowed(vcpu); > +} > + > #define __PTRAUTH_KEY(k) \ > - { SYS_DESC(SYS_## k), trap_ptrauth, reset_unknown, k } > + { SYS_DESC(SYS_## k), trap_ptrauth, reset_unknown, k , .check_present = check_ptrauth} Cheers ---Dave [2] [PATCH v5 12/26] KVM: arm64: Support runtime sysreg visibility filtering https://lists.cs.columbia.edu/pipermail/kvmarm/2019-February/034671.html