Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 699527 Details for
Bug 908888
qemu now requires CAP_COMPROMISE_KERNEL for working PCI passthrough
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
sysfs cap check on open
sysfs-open-caps.diff (text/plain), 3.65 KB, created by
Kyle McMartin
on 2013-02-19 16:47:30 UTC
(
hide
)
Description:
sysfs cap check on open
Filename:
MIME Type:
Creator:
Kyle McMartin
Created:
2013-02-19 16:47:30 UTC
Size:
3.65 KB
patch
obsolete
>diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c >index 1db1e74..09a88be 100644 >--- a/drivers/pci/pci-sysfs.c >+++ b/drivers/pci/pci-sysfs.c >@@ -546,9 +546,6 @@ pci_write_config(struct file* filp, struct kobject *kobj, > loff_t init_off = off; > u8 *data = (u8*) buf; > >- if (!capable(CAP_COMPROMISE_KERNEL)) >- return -EPERM; >- > if (off > dev->cfg_size) > return 0; > if (off + count > dev->cfg_size) { >@@ -772,6 +769,7 @@ void pci_create_legacy_files(struct pci_bus *b) > b->legacy_io->attr.name = "legacy_io"; > b->legacy_io->size = 0xffff; > b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; >+ b->legacy_io->attr.cap = CAP_COMPROMISE_KERNEL; > b->legacy_io->read = pci_read_legacy_io; > b->legacy_io->write = pci_write_legacy_io; > b->legacy_io->mmap = pci_mmap_legacy_io; >@@ -786,6 +784,7 @@ void pci_create_legacy_files(struct pci_bus *b) > b->legacy_mem->attr.name = "legacy_mem"; > b->legacy_mem->size = 1024*1024; > b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; >+ b->legacy_io->attr.cap = CAP_COMPROMISE_KERNEL; > b->legacy_mem->mmap = pci_mmap_legacy_mem; > pci_adjust_legacy_attr(b, pci_mmap_mem); > error = device_create_bin_file(&b->dev, b->legacy_mem); >@@ -855,9 +854,6 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, > resource_size_t start, end; > int i; > >- if (!capable(CAP_COMPROMISE_KERNEL)) >- return -EPERM; >- > for (i = 0; i < PCI_ROM_RESOURCE; i++) > if (res == &pdev->resource[i]) > break; >@@ -965,9 +961,6 @@ pci_write_resource_io(struct file *filp, struct kobject *kobj, > struct bin_attribute *attr, char *buf, > loff_t off, size_t count) > { >- if (!capable(CAP_COMPROMISE_KERNEL)) >- return -EPERM; >- > return pci_resource_io(filp, kobj, attr, buf, off, count, true); > } > >@@ -1027,6 +1020,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine) > } > res_attr->attr.name = res_attr_name; > res_attr->attr.mode = S_IRUSR | S_IWUSR; >+ res_attr->attr.cap = CAP_COMPROMISE_KERNEL; > res_attr->size = pci_resource_len(pdev, num); > res_attr->private = &pdev->resource[num]; > retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr); >@@ -1142,6 +1136,7 @@ static struct bin_attribute pci_config_attr = { > .attr = { > .name = "config", > .mode = S_IRUGO | S_IWUSR, >+ .cap = CAP_COMPROMISE_KERNEL, > }, > .size = PCI_CFG_SPACE_SIZE, > .read = pci_read_config, >@@ -1152,6 +1147,7 @@ static struct bin_attribute pcie_config_attr = { > .attr = { > .name = "config", > .mode = S_IRUGO | S_IWUSR, >+ .cap = CAP_COMPROMISE_KERNEL, > }, > .size = PCI_CFG_SPACE_EXP_SIZE, > .read = pci_read_config, >@@ -1201,6 +1197,7 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev) > attr->size = dev->vpd->len; > attr->attr.name = "vpd"; > attr->attr.mode = S_IRUSR | S_IWUSR; >+ attr->attr.cap = CAP_COMPROMISE_KERNEL; > attr->read = read_vpd_attr; > attr->write = write_vpd_attr; > retval = sysfs_create_bin_file(&dev->dev.kobj, attr); >diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c >index 614b2b5..e40a725 100644 >--- a/fs/sysfs/bin.c >+++ b/fs/sysfs/bin.c >@@ -402,6 +402,10 @@ static int open(struct inode * inode, struct file * file) > if (!sysfs_get_active(attr_sd)) > return -ENODEV; > >+ error = -EPERM; >+ if (attr->attr.cap && !capable(attr->attr.cap)) >+ goto err_out; >+ > error = -EACCES; > if ((file->f_mode & FMODE_WRITE) && !(attr->write || attr->mmap)) > goto err_out; >diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h >index 381f06d..0cf0034 100644 >--- a/include/linux/sysfs.h >+++ b/include/linux/sysfs.h >@@ -26,6 +26,7 @@ enum kobj_ns_type; > struct attribute { > const char *name; > umode_t mode; >+ int cap; > #ifdef CONFIG_DEBUG_LOCK_ALLOC > bool ignore_lockdep:1; > struct lock_class_key *key;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 908888
: 699527