linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Cc: James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	kernel-team@android.com, Quentin Perret <qperret@google.com>,
	Will Deacon <will@kernel.org>,
	Christoffer Dall <christoffer.dall@arm.com>
Subject: Re: [PATCH] KVM: arm64: Inject exception on out-of-IPA-range translation fault
Date: Wed, 27 Apr 2022 22:33:30 +0100	[thread overview]
Message-ID: <f317899241aaf6858e3419f23800b987@kernel.org> (raw)
In-Reply-To: <20220421153949.2931552-1-maz@kernel.org>

On 2022-04-21 16:39, Marc Zyngier wrote:
> When taking an translation fault for an IPA that is outside of
> the range defined by the hypervisor (between the HW PARange and
> that exposed to the guest), we stupidly treat it as an IO and
> forward the access to userspace. Of course, userspace can't do
> much with it, and things end badly.
> 
> Arguably, the guest is braindead, but we should at least catch the
> case and inject an exception.
> 
> Check the faulting IPA against the IPA size the VM has, and
> inject an Address Size Fault at level 0 if the access fails the
> check.

I'm having second thoughts about this last point.
t
As it turns out, we do no override the PARange exposed to the guest,
and it sees the sanitised HW version. Which makes sense, as the
IPA range is much more fine grained than the PARange (1 bit for
IPA range, 4 bits for PARange).

So a fault can fall into a number of "don't do that" categories:
- outside of the *physical* PARange: the HW injects an AS fault
- outside of the *sanitised* PARange: KVM must inject an AS fault
- between IPA range and PARange: KVM must inject a external abort

This patch merges the last two cases, which is a bit wrong.

I'll repost an updated version and queue it for 5.18.

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2022-04-27 21:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 15:39 [PATCH] KVM: arm64: Inject exception on out-of-IPA-range translation fault Marc Zyngier
2022-04-27 21:33 ` Marc Zyngier [this message]

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=f317899241aaf6858e3419f23800b987@kernel.org \
    --to=maz@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=christoffer.dall@arm.com \
    --cc=james.morse@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=qperret@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /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).