From: Greg KH <gregkh@linuxfoundation.org>
To: Dennis McLeod <umodjm@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: PCI BAR sysfs node permissions
Date: Sat, 13 Dec 2014 19:39:58 -0800 [thread overview]
Message-ID: <20141214033958.GA7039@kroah.com> (raw)
In-Reply-To: <CAAzF57Sj4ZL4mw5PAwcrGtE8wQsgc9hBWRNNn0DHg5VsctY6mA@mail.gmail.com>
On Tue, Dec 09, 2014 at 04:22:35PM -0500, Dennis McLeod wrote:
> need help figuring out how to make this happen. If my pci driver is
> instructed to open a pci device, I want to change the mode of bar0's
> sysfs node to o+rw so a user app can mmap it.
>
> In other words, from the driver, perform this:
> chmod 766 /sys/bus/pci/[slot path]/resource0
> preferably without a lecture on why I shouldn't .. ;-)
Sorry, you will get a lecture if you try to do something as foolish as
this from within the kernel.
If you "really" need this, do it from userspace, with a script you grant
root permissions to change the mode on the files.
> If I chmod that sysfs node for bar0 as root, i can run a user process
> (as regular user) that does an mmap of that and can do reads/writes to
> the bar resource. I would like for my pci driver to do this
> automatically when it is told to open a device.
Nope, that's a bad idea, and you know that as well.
sorry.
greg k-h
prev parent reply other threads:[~2014-12-14 5:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 21:22 PCI BAR sysfs node permissions Dennis McLeod
2014-12-09 21:48 ` Alex Williamson
2014-12-14 3:39 ` Greg KH [this message]
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=20141214033958.GA7039@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-pci@vger.kernel.org \
--cc=umodjm@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: 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.