linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amit Daniel Kachhap <amit.kachhap@arm.com>
To: christoffer.dall@arm.com
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	drjones@redhat.com, marc.zyngier@arm.com,
	Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org, kristina.martsenko@arm.com,
	kvmarm@lists.cs.columbia.edu, ramana.radhakrishnan@arm.com,
	Dave Martin <Dave.Martin@arm.com>,
	LAK <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 2/7] arm64/kvm: context-switch ptrauth registers
Date: Thu, 15 Nov 2018 20:03:49 +0530	[thread overview]
Message-ID: <CADGdYn7Jha7b3qx-Thow-dvHZKHdn93eJE-CzC395OBZkPvAjw@mail.gmail.com> (raw)
In-Reply-To: <20181113134438.GH3835@e113682-lin.lund.arm.com>

On Tue, Nov 13, 2018 at 7:16 PM Christoffer Dall
<christoffer.dall@arm.com> wrote:
>
> On Mon, Nov 12, 2018 at 10:32:12PM +0000, Catalin Marinas wrote:
> > On Fri, Nov 02, 2018 at 09:37:25AM +0100, Christoffer Dall wrote:
> > > On Wed, Oct 17, 2018 at 04:17:55PM +0530, Amit Daniel Kachhap wrote:
> > > > From: Mark Rutland <mark.rutland@arm.com>
> > > >
> > > > When pointer authentication is supported, a guest may wish to use it.
> > > > This patch adds the necessary KVM infrastructure for this to work.
> > > >
> > > > When we schedule a vcpu, we enable guest usage of pointer
> > > > authentication instructions and accesses to the keys. After these are
> > > > enabled, we allow context-switching the keys.
> > > >
> > > > Pointer authentication consists of address authentication and generic
> > > > authentication, and CPUs in a system might have varied support for
> > > > either. Where support for either feature is not uniform, it is hidden
> > > > from guests via ID register emulation, as a result of the cpufeature
> > > > framework in the host.
> > > >
> > > > Unfortunately, address authentication and generic authentication cannot
> > > > be trapped separately, as the architecture provides a single EL2 trap
> > > > covering both. If we wish to expose one without the other, we cannot
> > > > prevent a (badly-written) guest from intermittently using a feature
> > > > which is not uniformly supported (when scheduled on a physical CPU which
> > > > supports the relevant feature). When the guest is scheduled on a
> > > > physical CPU lacking the feature, these attempts will result in an UNDEF
> > > > being taken by the guest.
> > > >
> > > > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > > > Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
> > > > Cc: Marc Zyngier <marc.zyngier@arm.com>
> > > > Cc: Christoffer Dall <christoffer.dall@arm.com>
> > > > Cc: kvmarm@lists.cs.columbia.edu
> > [...]
> > > Two questions:
> > >
> > >  - Can we limit all ptrauth functionality to VHE systems so that we
> > >    don't need to touch the non-VHE path and so that we don't need any of
> > >    the __hyp_text stuff?
> >
> > I would say yes. ARMv8.3 implies v8.1, so can enable ptrauth only when
> > VHE is built into the kernel and present in the CPU implementation.
> >
>
> Sounds good.
>
> > >  - Can we move all the save/restore logic to vcpu load/put as long as
> > >    the host kernel itself isn't using ptrauth, and if the host kernel at
> > >    some point begins to use ptrauth, can we have a hook to save/restore
> > >    at that time (similar to what we do for FPSIMD) to avoid this
> > >    overhead on every switch?
> >
> > We will probably enable ptrauth for the kernel as well fairly soon, so I
> > don't think we should base the KVM assumption on the no ptrauth in
> > kernel use-case.
> >
>
> I assume in this case ptrauth will be used for all of the kernel,
> including most of the KVM code?
>
> In that case, I wonder if we always need to context-switch ptrauth
> configruation state or if we can be lazy until the guest actually uses
> the feature?

Sorry for the delayed reply. Lazy switching is possible and was
present in earlier Mark's Rutland v2 version.
However  removed it from v3 version as a mandatory user option to
enable ptrauth is added and to make it look
simpler. But yes both can exist together but with 1 trap cost if guest
always uses ptrauth.

Thanks,
Amit
>
>
> Thanks,
>
>     Christoffer

  reply	other threads:[~2018-11-15 14:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 10:47 [PATCH v3 0/7] Add ARMv8.3 pointer authentication for kvm guest Amit Daniel Kachhap
2018-10-17 10:47 ` [PATCH v3 1/7] arm64/kvm: preserve host HCR_EL2 value Amit Daniel Kachhap
2018-10-17 10:47 ` [PATCH v3 2/7] arm64/kvm: context-switch ptrauth registers Amit Daniel Kachhap
2018-11-02  8:37   ` Christoffer Dall
2018-11-12 22:32     ` Catalin Marinas
2018-11-13 13:44       ` Christoffer Dall
2018-11-15 14:33         ` Amit Daniel Kachhap [this message]
2018-10-17 10:47 ` [PATCH v3 3/7] arm64/kvm: add a userspace option to enable pointer authentication Amit Daniel Kachhap
2018-10-17 10:47 ` [PATCH v3 4/7] arm64/kvm: enable pointer authentication cpufeature conditionally Amit Daniel Kachhap
2018-10-17 10:47 ` [PATCH v3 5/7] arm64/kvm: control accessibility of ptrauth key registers Amit Daniel Kachhap
2018-10-17 10:47 ` [PATCH v3 6/7] arm64: docs: document KVM support of pointer authentication Amit Daniel Kachhap
2018-11-02  8:39   ` Christoffer Dall
2018-10-17 10:48 ` [PATCH v3 7/7] arm/kvm: arm64: Add a vcpu feature for " Amit Daniel Kachhap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADGdYn7Jha7b3qx-Thow-dvHZKHdn93eJE-CzC395OBZkPvAjw@mail.gmail.com \
    --to=amit.kachhap@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@arm.com \
    --cc=drjones@redhat.com \
    --cc=kristina.martsenko@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=ramana.radhakrishnan@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).