public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Hans J. Koch" <hjk@hansjkoch.de>
Cc: Jean-Francois Dagenais <jeff.dagenais@gmail.com>,
	Greg KH <gregkh@suse.de>,
	tglx@linutronix.de, linux-pci@vger.kernel.org,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: extra large DMA buffer for PCI-E device under UIO
Date: Wed, 23 Nov 2011 10:20:21 +0200	[thread overview]
Message-ID: <20111123082020.GA22734@redhat.com> (raw)
In-Reply-To: <20111122185244.GD15508@local>

On Tue, Nov 22, 2011 at 07:52:45PM +0100, Hans J. Koch wrote:
> On Tue, Nov 22, 2011 at 08:40:40PM +0200, Michael S. Tsirkin wrote:
> > On Tue, Nov 22, 2011 at 06:54:02PM +0100, Hans J. Koch wrote:
> > > On Tue, Nov 22, 2011 at 07:37:23PM +0200, Michael S. Tsirkin wrote:
> > > [...]
> > > > > Or am I better off with a UIO solution?
> > > > 
> > > > You should probably write a proper kernel driver, not a UIO one.
> > > > your kernel driver would have to prevent the device fom DMA into memory
> > > > outside the allocated range, even if userspace is malicious.
> > > > That's why UIO is generally not recommended for PCI devices that do DMA.
> > > 
> > > When UIO was designed, the main goal was the ability to handle interrupts
> > > from userspace. There was no requirement for DMA. In fact, in five years I
> > > didn't get one real world device on my desk that needed it. That doesn't
> > > mean there are no such devices. Adding DMA support to the UIO core was
> > > discussed several times but noone ever did it. Ideas are still welcome...
> > > 
> > > If parts of the driver should be in userspace, you should really try
> > > to extend the UIO core instead of re-implementing UIO functionality in
> > > a "proper kernel driver".
> > > 
> > > Thanks,
> > > Hans
> > 
> > Right, I really meant put all of the driver in the kernel.
> > If parts are in userspace, and device can do DMA,
> > you are faced with the problem as userspace suddenly
> > can access arbitrary memory through the device.
> 
> That's nothing UIO specific. You have the same problem with /dev/mem
> or graphic cards. If you're root, you can do lots of things that can
> compromise security or crash your system.
> 
> Thanks,
> Hans

With an appropriate security policy, you might not be able to,
or your attempt to do so might be logged. Even without, people
can use permissions to give non-root access to devices.
One doesn't normally expect chown mst /dev/foobar
to give mst full root on a box.

-- 
MST

  parent reply	other threads:[~2011-11-23  8:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 21:16 extra large DMA buffer for PCI-E device under UIO Jean-Francois Dagenais
2011-11-18 22:08 ` Greg KH
2011-11-21 15:31   ` Jean-Francois Dagenais
2011-11-21 17:36     ` Greg KH
2011-11-21 18:17       ` Hans J. Koch
     [not found]         ` <4A52B447-8E21-43F6-A38E-711E36F89A34@gmail.com>
2011-11-21 19:29           ` Hans J. Koch
2011-11-22 15:24         ` Jean-Francois Dagenais
2011-11-22 15:35           ` Michael S. Tsirkin
2011-11-22 16:54             ` Jean-Francois Dagenais
2011-11-22 17:27               ` Matthew Wilcox
2011-11-22 17:40                 ` Michael S. Tsirkin
2011-11-22 17:37               ` Michael S. Tsirkin
2011-11-22 17:54                 ` Hans J. Koch
2011-11-22 18:40                   ` Michael S. Tsirkin
2011-11-22 18:52                     ` Hans J. Koch
2011-11-22 19:50                       ` Jean-Francois Dagenais
2011-11-23  8:20                       ` Michael S. Tsirkin [this message]
2011-11-22 16:05           ` Hans J. Koch
2011-11-22 19:57   ` Jean-Francois Dagenais
2013-01-23  2:00     ` Jean-François Dagenais
2011-11-18 22:27 ` Hans J. Koch
2011-11-21 15:10   ` Jean-Francois Dagenais
2011-11-21 15:47     ` Rolf Eike Beer
2011-11-21 16:01       ` Jean-Francois Dagenais

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=20111123082020.GA22734@redhat.com \
    --to=mst@redhat.com \
    --cc=gregkh@suse.de \
    --cc=hjk@hansjkoch.de \
    --cc=jeff.dagenais@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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