linux/drivers/pci
Chris Wright de139a3393 pci: check caps from sysfs file open to read device dependent config space
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.

When assigning a PCI device directly to a guest with libvirt and KVM,
the sysfs config space file is chown'd to the unprivileged user that
the KVM guest will run as.  The guest needs to have full access to the
device's config space since it's responsible for driving the device.
However, despite being the owner of the sysfs file, the CAP_SYS_ADMIN
check will not allow read access beyond the config header.

With this patch we check privileges against the capabilities used when
openining the sysfs file.  The allows a privileged process to open the
file and hand it to an unprivileged process, and the unprivileged process
can still read all of the config space.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-21 09:37:32 -07:00
..
hotplug sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
pcie PCI aerdrv: use correct bit defines and add 2ms delay to aer_root_reset 2010-04-08 09:24:11 -07:00
.gitignore
access.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
bus.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
dmar.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hotplug-pci.c
hotplug.c
htirq.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
intel-iommu.c VT-d: Change {un}map_range functions to implement {un}map interface 2010-03-07 18:01:11 +01:00
intr_remapping.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
intr_remapping.h
ioapic.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
iov.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
iova.c
irq.c
Kconfig
Makefile microblaze: Enable PCI, missing files 2010-03-11 14:04:27 +01:00
msi.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
msi.h
pci-acpi.c
pci-driver.c
pci-stub.c
pci-sysfs.c pci: check caps from sysfs file open to read device dependent config space 2010-05-21 09:37:32 -07:00
pci.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-05-20 09:20:59 -07:00
pci.h PCI: make bitfield unsigned 2010-05-11 10:07:20 +02:00
probe.c PCI: revert broken device warning 2010-04-22 16:13:16 -07:00
proc.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
quirks.c PCI quirk: RS780/RS880: disable MSI behind the PCI bridge 2010-04-02 19:47:05 -07:00
remove.c
rom.c
search.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
setup-bus.c Revert "PCI: update bridge resources to get more big ranges in PCI assign unssigned" 2010-05-12 18:39:45 -07:00
setup-irq.c
setup-res.c PCI: for address space collisions, show conflicting resource 2010-03-24 13:21:34 -07:00
slot.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
syscall.c
vpd.c