From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org,
Alex Williamson <alex.williamson@redhat.com>,
kvm-ppc@vger.kernel.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH kernel v2 0/2] KVM: PPC: Check if IOMMU page is contained in the pinned physical page
Date: Fri, 29 Jun 2018 13:00:07 +1000 [thread overview]
Message-ID: <20180629130007.1b78e168@aik.ozlabs.ibm.com> (raw)
In-Reply-To: <877emiwe3n.fsf@concordia.ellerman.id.au>
On Fri, 29 Jun 2018 11:55:40 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
> > This is to improve page boundaries checking and should probably
> > be cc:stable. I came accross this while debugging nvlink2 passthrough
> > but the lack of checking might be exploited by the existing userspace.
>
> Do you really mean "exploited" ? As in there's a security issue?
>
> Your change log for patch 2 sort of suggests that but then says that
> without the fix you just hit an error in vfio code.
The bug is that I can easily make unmodified guest use 16MB IOMMU pages
while guest RAM is backed with system 64K pages so unless the guest RAM
is allocated contigously (which is unlikely), a 16MB TCE will provide
the hardware access to the host physical memory it is not supposed to
have access to, which is 16MB minus first 64K.
There is a fast path for H_PUT_TCE - via KVM - there is no contained
test.
There is a slow path for H_PUT_TCE - via VFIO ioctl() - there is a
contained test.
Because of a different feature of VFIO on sPAPR (it stores an array of
userspace addresses which we received from QEMU and translated to host
physical addresses and programmed those to the TCE table) we do not take
the fast path on the very first H_PUT_TCE (because I allocate the
array when the slow path is taken the very first time), fail there,
pass the failure to the guest the guest decides that is over.
But a modified guest could ignore that initial H_PUT_TCE failure and
simply repeat H_PUT_TCE again - this time it will take the fast path
and allow the bad mapping.
> So I'm not clear on what the exposure is.
>
> cheers
--
Alexey
next prev parent reply other threads:[~2018-06-29 3:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 5:59 [PATCH kernel v2 0/2] KVM: PPC: Check if IOMMU page is contained in the pinned physical page Alexey Kardashevskiy
2018-06-26 5:59 ` [PATCH kernel v2 1/2] vfio/spapr: Use IOMMU pageshift rather than pagesize Alexey Kardashevskiy
2018-06-30 19:56 ` Alex Williamson
2018-06-26 5:59 ` [PATCH kernel v2 2/2] KVM: PPC: Check if IOMMU page is contained in the pinned physical page Alexey Kardashevskiy
2018-06-29 4:12 ` David Gibson
2018-06-29 4:51 ` Alexey Kardashevskiy
2018-06-29 4:57 ` David Gibson
2018-06-29 5:18 ` Alexey Kardashevskiy
2018-06-29 7:07 ` Alexey Kardashevskiy
2018-07-02 4:08 ` David Gibson
2018-07-02 4:33 ` Alexey Kardashevskiy
2018-07-02 4:52 ` David Gibson
2018-07-02 6:32 ` Alexey Kardashevskiy
2018-07-03 1:36 ` David Gibson
2018-06-29 1:55 ` [PATCH kernel v2 0/2] " Michael Ellerman
2018-06-29 3:00 ` Alexey Kardashevskiy [this message]
2018-06-29 4:14 ` David Gibson
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=20180629130007.1b78e168@aik.ozlabs.ibm.com \
--to=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).