From: Greg KH <email@example.com> To: Allen <firstname.lastname@example.org> Cc: email@example.com, Bjorn Helgaas <firstname.lastname@example.org>, email@example.com, Linux Kernel Mailing List <firstname.lastname@example.org>, Allen Pais <email@example.com>, Allen Pais <firstname.lastname@example.org> Subject: Re: [RFC] PCI: allow sysfs file owner to read the config space with CAP_SYS_RAWIO Date: Mon, 19 Oct 2020 15:47:29 +0200 [thread overview] Message-ID: <20201019134729.GA3259788@kroah.com> (raw) In-Reply-To: <CAOMdWS+F=cCK=Rgy-0xk4_mqUFMn1PQBWR8u3JwqTP2AVifxsA@mail.gmail.com> On Mon, Oct 19, 2020 at 06:51:39PM +0530, Allen wrote: > > > > > > > > > > Access to pci config space is explictly checked with CAP_SYS_ADMIN > > > > > in order to read configuration space past the frist 64B. > > > > > > > > > > Since the path is only for reading, could we use CAP_SYS_RAWIO? > > > > > > > > Why? What needs this reduced capability? > > > > > > Thanks for the review. > > > > > > We need read access to /sys/bus/pci/devices/, We need write access to config, > > > remove, rescan & enable files under the device directory for each PCIe > > > functions & the downstream PCIe port. > > > > > > We need r/w access to sysfs to unbind and rebind the root complex. > > > > That didn't answer my question at all. > > Sorry about that, breaking it down: > > When the machine first boots, the VFIO device bindings under /dev/vfio > are not present. > > root@localhost:/tmp# ls -l /dev/vfio/ > total 0 > crw-rw-rw-. 1 root root 10, 196 Jan 5 01:47 vfio > > We have an agent which needs to run the following commands (We get > access denied here and need permissions to do this). > echo -n xxxx yyyy > /sys/module/vfio_pci/drivers/pci:vfio-pci/new_id > echo -n xxxx yyyy > /sys/module/vfio_pci/drivers/pci:vfio-pci/new_id > > And we want to avoid handing CAP_SYS_ADMIN here. Which is why the > thought about CAP_SYS_RAWIO. But that is not what you were asking this patch to do at all. So why bring it up? new_id is NOT for "raw io" control, that should be only for admin priviliges. And just because the vfio driver "abuses" this traditionally-debug-functionality doesn't mean you get to abuse the permission levels either. > > Why can't you have the process that wants to do all of the above, have > > admin rights as well? Doing all of that is _very_ low-level and can > > cause all sorts of horrible things to happen to your machine, and is not > > really "raw io" in the traditional sense at all, right? > > > If the above approach is going to cause the system to do horrible things, > then I'll drop the idea. Of course it can cause the system to do horrible things, try it yourself and see! greg k-h
next prev parent reply other threads:[~2020-10-19 13:46 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-16 5:52 Allen Pais 2020-10-16 6:20 ` Greg KH 2020-10-19 13:00 ` Allen 2020-10-19 13:16 ` Greg KH 2020-10-19 13:21 ` Allen 2020-10-19 13:47 ` Greg KH [this message] 2020-10-19 14:32 ` Allen
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=20201019134729.GA3259788@kroah.com \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [RFC] PCI: allow sysfs file owner to read the config space with CAP_SYS_RAWIO' \ /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
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).