From: Alex Williamson <alex.williamson@redhat.com> To: Kay Sievers <kay@vrfy.org> Cc: Greg KH <gregkh@linuxfoundation.org>, Myron Stowe <mstowe@redhat.com>, Myron Stowe <myron.stowe@redhat.com>, linux-hotplug@vger.kernel.org, linux-pci@vger.kernel.org, yuxiangl@marvell.com, yxlraid@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] udevadm-info: Don't access sysfs 'resource<N>' files Date: Mon, 18 Mar 2013 10:24:40 -0600 [thread overview] Message-ID: <1363623880.24132.351.camel@bling.home> (raw) In-Reply-To: <CAPXgP12vmx9j_jJW3HXb2deRapFKAofTVzEbdyS=Z1VUBswE_Q@mail.gmail.com> On Sun, 2013-03-17 at 15:00 +0100, Kay Sievers wrote: > On Sun, Mar 17, 2013 at 2:38 PM, Alex Williamson > <alex.williamson@redhat.com> wrote: > > I'm assuming that the device only breaks because udevadm is dumping the > > full I/O port register space of the device and that if an actual driver > > was interacting with it through this interface that it would work. Who > > knows how many devices will have read side-effects by udevadm blindly > > dumping these files. Thanks, > > Sysfs is a too public interface to export things there which make > devices/driver choke on a simple read() of an attribute. That's why the default permissions for the file do not allow users to read it. I wish we could do something as clever as the MMIO resource files, but I/O port spaces don't allow mmap for the predominant architecture. Eventually VFIO is meant to replace this access and does move device register access behind ioctls, but for now legacy KVM device assignment relies on these files and so might some UIO drivers. > This is nothing specific to udevadm, any tool can do that. Udevadm > will never read any of the files during normal operation. The admin > explicitly asked udevadm with a specific command to dump all the stuff > the device offers. Isn't it possible udevadm could drop privileges or filter out non-world readable files? > The kernel driver needs to be fixed to allow that, in the worst case, > the attributes not exported at all. People should take more care what > they export in /sys, it's not a hidden and private ioctl what's > exported there, stuff is very visible and will be looked at. File permissions... > Telling userspace not to use specific stuff in /sys I would not expect > to work as a strategy; there is too much weird stuff out there that > will always try to do that ... I agree, the kernel needs to protect itself from malicious apps, but if you run a malicious app with admin access, how much can/should we do? If we're going to ignore file permissions, why limit ourselves to read(), should we make everything safe against write() as well? Thanks, Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alex Williamson <alex.williamson@redhat.com> To: Kay Sievers <kay@vrfy.org> Cc: Greg KH <gregkh@linuxfoundation.org>, Myron Stowe <mstowe@redhat.com>, Myron Stowe <myron.stowe@redhat.com>, linux-hotplug@vger.kernel.org, linux-pci@vger.kernel.org, yuxiangl@marvell.com, yxlraid@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] udevadm-info: Don't access sysfs 'resource<N>' files Date: Mon, 18 Mar 2013 16:24:40 +0000 [thread overview] Message-ID: <1363623880.24132.351.camel@bling.home> (raw) In-Reply-To: <CAPXgP12vmx9j_jJW3HXb2deRapFKAofTVzEbdyS=Z1VUBswE_Q@mail.gmail.com> On Sun, 2013-03-17 at 15:00 +0100, Kay Sievers wrote: > On Sun, Mar 17, 2013 at 2:38 PM, Alex Williamson > <alex.williamson@redhat.com> wrote: > > I'm assuming that the device only breaks because udevadm is dumping the > > full I/O port register space of the device and that if an actual driver > > was interacting with it through this interface that it would work. Who > > knows how many devices will have read side-effects by udevadm blindly > > dumping these files. Thanks, > > Sysfs is a too public interface to export things there which make > devices/driver choke on a simple read() of an attribute. That's why the default permissions for the file do not allow users to read it. I wish we could do something as clever as the MMIO resource files, but I/O port spaces don't allow mmap for the predominant architecture. Eventually VFIO is meant to replace this access and does move device register access behind ioctls, but for now legacy KVM device assignment relies on these files and so might some UIO drivers. > This is nothing specific to udevadm, any tool can do that. Udevadm > will never read any of the files during normal operation. The admin > explicitly asked udevadm with a specific command to dump all the stuff > the device offers. Isn't it possible udevadm could drop privileges or filter out non-world readable files? > The kernel driver needs to be fixed to allow that, in the worst case, > the attributes not exported at all. People should take more care what > they export in /sys, it's not a hidden and private ioctl what's > exported there, stuff is very visible and will be looked at. File permissions... > Telling userspace not to use specific stuff in /sys I would not expect > to work as a strategy; there is too much weird stuff out there that > will always try to do that ... I agree, the kernel needs to protect itself from malicious apps, but if you run a malicious app with admin access, how much can/should we do? If we're going to ignore file permissions, why limit ourselves to read(), should we make everything safe against write() as well? Thanks, Alex
next prev parent reply other threads:[~2013-03-18 16:24 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-03-16 21:35 [PATCH] udevadm-info: Don't access sysfs entries backing device I/O port space Myron Stowe 2013-03-16 21:35 ` Myron Stowe 2013-03-16 21:35 ` [PATCH] udevadm-info: Don't access sysfs 'resource<N>' files Myron Stowe 2013-03-16 21:35 ` Myron Stowe 2013-03-16 22:11 ` Greg KH 2013-03-16 22:11 ` Greg KH 2013-03-16 22:55 ` Bjorn Helgaas 2013-03-16 22:55 ` Bjorn Helgaas 2013-03-16 23:50 ` Myron Stowe 2013-03-16 23:50 ` Myron Stowe 2013-03-17 1:03 ` Greg KH 2013-03-17 1:03 ` Greg KH 2013-03-17 4:11 ` Alex Williamson 2013-03-17 4:11 ` Alex Williamson 2013-03-17 5:36 ` Greg KH 2013-03-17 5:36 ` Greg KH 2013-03-17 13:38 ` Alex Williamson 2013-03-17 13:38 ` Alex Williamson 2013-03-17 14:00 ` Kay Sievers 2013-03-17 14:00 ` Kay Sievers 2013-03-17 14:20 ` Myron Stowe 2013-03-17 14:20 ` Myron Stowe 2013-03-17 14:29 ` Kay Sievers 2013-03-17 14:29 ` Kay Sievers 2013-03-17 14:36 ` Myron Stowe 2013-03-17 14:36 ` Myron Stowe 2013-03-17 14:43 ` Kay Sievers 2013-03-17 14:43 ` Kay Sievers 2013-03-18 16:24 ` Alex Williamson [this message] 2013-03-18 16:24 ` Alex Williamson 2013-03-18 16:41 ` Greg KH 2013-03-18 16:41 ` Greg KH 2013-03-18 16:51 ` Alex Williamson 2013-03-18 16:51 ` Alex Williamson 2013-03-18 17:20 ` Bjørn Mork 2013-03-18 17:20 ` Bjørn Mork 2013-03-18 17:54 ` Alex Williamson 2013-03-18 17:54 ` Alex Williamson 2013-03-18 18:02 ` Robert Brown 2013-03-18 18:02 ` Robert Brown 2013-03-18 18:25 ` Bjørn Mork 2013-03-18 18:25 ` Bjørn Mork 2013-03-18 18:59 ` Alex Williamson 2013-03-18 18:59 ` Alex Williamson 2013-03-19 16:57 ` Myron Stowe 2013-03-19 16:57 ` Myron Stowe 2013-03-19 17:06 ` Myron Stowe 2013-03-19 17:06 ` Myron Stowe 2013-03-17 14:33 ` Myron Stowe 2013-03-17 14:33 ` Myron Stowe 2013-03-17 22:28 ` Alex Williamson 2013-03-17 22:28 ` Alex Williamson 2013-03-18 14:50 ` Don Dutile 2013-03-18 14:50 ` Don Dutile 2013-03-18 16:34 ` Alex Williamson 2013-03-18 16:34 ` Alex Williamson 2013-03-17 14:12 ` Myron Stowe 2013-03-17 14:12 ` Myron Stowe 2013-03-19 1:54 ` Robert Hancock 2013-03-19 1:54 ` Robert Hancock 2013-03-19 2:03 ` Greg KH 2013-03-19 2:03 ` Greg KH 2013-03-19 2:09 ` Robert Hancock 2013-03-19 2:09 ` Robert Hancock 2013-03-19 2:35 ` Greg KH 2013-03-19 2:35 ` Greg KH 2013-03-19 3:08 ` Robert Hancock 2013-03-19 3:08 ` Robert Hancock
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=1363623880.24132.351.camel@bling.home \ --to=alex.williamson@redhat.com \ --cc=gregkh@linuxfoundation.org \ --cc=kay@vrfy.org \ --cc=linux-hotplug@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=mstowe@redhat.com \ --cc=myron.stowe@redhat.com \ --cc=yuxiangl@marvell.com \ --cc=yxlraid@gmail.com \ /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: linkBe 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.