DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, hjk@hansjkoch.de, gregkh@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [dpdk-dev] [PATCH 2/2] uio: new driver to support PCI MSI-X
Date: Tue, 6 Oct 2015 16:42:22 +0300	[thread overview]
Message-ID: <20151006154611-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <20151006083356.3da3defa@uryu.home.lan>

On Tue, Oct 06, 2015 at 08:33:56AM +0100, Stephen Hemminger wrote:
> Other than implementation objections, so far the two main arguments
> against this reduce to:
>   1. If you allow UIO ioctl then it opens an API hook for all the crap out
>      of tree UIO drivers to do what they want.
>   2. If you allow UIO MSI-X then you are expanding the usage of userspace
>      device access in an insecure manner.

That's not all. Without MSI one can detect insecure usage by detecting
userspace enabling bus mastering.  This can be detected simply using
lspci.  Or one can also imagine a configuration where this ability is
disabled, is logged, or taints kernel.  This seems like something that
might be worth having for some locked-down systems.

OTOH enabling MSI requires enabling bus mastering so suddenly we have no
idea whether device can be/is used in a safe way.

> 
> Another alternative which I explored was making a version of VFIO that
> works without IOMMU. It solves #1 but actually increases the likely negative
> response to arguent #2.

No - because VFIO has limited protection against device misuse by
userspace, by limiting access to sub-ranges of device BARs and config
space.  For a device that doesn't do DMA, that will be enough to make it
secure to use.

That's a pretty weak excuse to support userspace drivers for PCI devices
without an IOMMU, but it's the best I heard so far.

Is that worth the security trade-off? I'm still not sure.

> This would keep same API, and avoid having to
> modify UIO. But we would still have the same (if not more resistance)
> from IOMMU developers who believe all systems have to be secure against
> root.

"Secure against root" is a confusing way to put it IMHO. We are talking
about memory protection.

So that's not IOMMU developers IIUC. I believe most kernel developers will
agree it's not a good idea to let userspace corrupt kernel memory.
Otherwise, the driver can't be supported, and maintaining upstream
drivers that can't be supported serves no useful purpose.  Anyone can
load out of tree ones just as well.

VFIO already supports MSI so VFIO developers already have a lot of
experience with these issues. Getting their input would be valuable.

-- 
MST

  parent reply	other threads:[~2015-10-06 13:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 22:28 [dpdk-dev] [PATCH 0/2] uio_msi: device driver Stephen Hemminger
2015-09-30 22:28 ` [dpdk-dev] [PATCH 1/2] uio: add support for ioctls Stephen Hemminger
2015-09-30 22:28 ` [dpdk-dev] [PATCH 2/2] uio: new driver to support PCI MSI-X Stephen Hemminger
2015-10-01  8:33   ` Michael S. Tsirkin
2015-10-01 10:37     ` Michael S. Tsirkin
2015-10-01 16:06       ` Michael S. Tsirkin
2015-10-01 14:50     ` Stephen Hemminger
2015-10-01 15:22       ` Michael S. Tsirkin
2015-10-01 16:31     ` Michael S. Tsirkin
2015-10-01 17:26       ` Stephen Hemminger
2015-10-01 18:25         ` Michael S. Tsirkin
2015-10-05 21:54     ` Michael S. Tsirkin
2015-10-05 22:09       ` Vladislav Zolotarov
2015-10-05 22:49         ` Michael S. Tsirkin
2015-10-06  7:33           ` Stephen Hemminger
2015-10-06 12:15             ` Avi Kivity
2015-10-06 14:07               ` Michael S. Tsirkin
2015-10-06 15:41                 ` Avi Kivity
2015-10-16 17:11               ` Thomas Monjalon
2015-10-16 17:20                 ` Stephen Hemminger
2015-10-06 13:42             ` Michael S. Tsirkin [this message]
2015-10-06  8:23           ` Vlad Zolotarov
2015-10-06 13:58             ` Michael S. Tsirkin
2015-10-06 14:49               ` Vlad Zolotarov
2015-10-06 15:00                 ` Michael S. Tsirkin
2015-10-06 16:40                   ` Vlad Zolotarov
2015-10-01 23:40   ` Alexander Duyck
2015-10-02  0:01     ` Stephen Hemminger
2015-10-02  1:21       ` Alexander Duyck
2015-10-02  0:04     ` Stephen Hemminger
2015-10-02  2:33       ` Alexander Duyck
2015-10-01  8:36 ` [dpdk-dev] [PATCH 0/2] uio_msi: device driver Michael S. Tsirkin
2015-10-01 10:59 ` Avi Kivity
2015-10-01 14:57   ` Stephen Hemminger
2015-10-01 19:48     ` Alexander Duyck
2015-10-01 22:00       ` Stephen Hemminger
2015-10-01 23:03         ` Alexander Duyck
2015-10-01 23:39           ` Stephen Hemminger
2015-10-01 23:43             ` Alexander Duyck
2015-10-02  0:04               ` Stephen Hemminger
2015-10-02  1:39                 ` Alexander Duyck
2015-10-04 16:49                   ` Vlad Zolotarov
2015-10-04 19:03                     ` Greg KH
2015-10-04 20:49                       ` Vlad Zolotarov

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=20151006154611-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=dev@dpdk.org \
    --cc=gregkh@linux-foundation.org \
    --cc=hjk@hansjkoch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stephen@networkplumber.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).