From: Chris Wright <chrisw@sous-sol.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Chris Wright <chrisw@sous-sol.org>,
greg@kroah.com, jbarnes@virtuousgeek.org, matthew@wil.cx,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, ddutile@redhat.com,
alex.williamson@redhat.com
Subject: Re: [PATCH 2/2] pci: allow sysfs file owner to read device dependent config space
Date: Thu, 13 May 2010 08:05:54 -0700 [thread overview]
Message-ID: <20100513150554.GC28034@sequoia.sous-sol.org> (raw)
In-Reply-To: <20100513105911.6469c434@lxorguk.ukuu.org.uk>
* Alan Cox (alan@lxorguk.ukuu.org.uk) wrote:
> On Wed, 12 May 2010 18:29:57 -0700
> Chris Wright <chrisw@sous-sol.org> wrote:
>
> > The PCI config space bin_attr read handler has a hardcoded CAP_SYS_ADMIN
> > check to verify privileges before allowing a user to read device
> > dependent config space. This is meant to protect from an unprivileged
> > user potentially locking up the box.
>
> Or hacking it.
With read access? You mean from read side-effect on a device register?
> You could argue the correct requirement is to change it to
> require CAP_SYS_RAWIO in fact !
It's also pervasive through sysfs. I found 22 CAP_SYS_ADMIN checks via
sysfs bin_attrs, most are firmware, config space, and similar; most of
which have could be abused to hack box in one way or another.
> > With this patch the sysfs file owner is also considered privileged enough
> > to read all of the config space.
>
> Which breaks the main reason the check was there in the first place. To
> stop accidents of the form
>
> find / -exec grep {} "wibble"
>
> blowing up in people's faces.
Right, this won't change w/out sysadmin intervention.
Currently, any random user doing that won't trigger an ill-behaving
device dependent config space read. It requires an admin to chown the
file to the user, at which point you've given the device to the user.
This is typically only done in the privileged context of libvirt launching
a KVM guest that has a host PCI device directly assigned to it, and the
chown is typically to a non-shell user.
> I agree with the problem - but IMHO the fix is to require opening the file
> checks CAP_SYS_something instead:
We can't require CAP_SYS_something on open as that will break basic tools
like lspci. We could note the privileges when opened and check them
later.
> not to hack the read method and make it
> even weirder and more un-Linux than it is now.
next prev parent reply other threads:[~2010-05-13 15:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 1:28 [PATCH 1/2] sysfs: add struct file* to bin_attr callbacks Chris Wright
2010-05-13 1:29 ` [PATCH 2/2] pci: allow sysfs file owner to read device dependent config space Chris Wright
2010-05-13 9:59 ` Alan Cox
2010-05-13 15:05 ` Chris Wright [this message]
2010-05-13 17:43 ` [PATCH 2/2 v2] pci: check caps from sysfs file open " Chris Wright
2010-05-13 19:06 ` Greg KH
2010-05-13 19:16 ` Chris Wright
2010-05-13 10:56 ` [PATCH 2/2] pci: allow sysfs file owner " Avi Kivity
2010-05-13 11:02 ` Daniel P. Berrange
2010-05-14 19:09 ` Greg KH
2010-05-14 19:26 ` Jesse Barnes
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=20100513150554.GC28034@sequoia.sous-sol.org \
--to=chrisw@sous-sol.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=alex.williamson@redhat.com \
--cc=ddutile@redhat.com \
--cc=greg@kroah.com \
--cc=jbarnes@virtuousgeek.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=matthew@wil.cx \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.