Author: kib Date: Fri Aug 3 18:35:20 2018 New Revision: 337269 URL: https://svnweb.freebsd.org/changeset/base/337269
Log: Require write access when mmapping BAR. This actually makes the rights requirements for accessing PCI config space and BARs using /dev/pci same. Since unchanged /dev/pci mode only allows write open for root, default configuration de-facto limits the BAR read to root only. In particular, state-changing reads of the registers are limited to root. Discussed with: se Suggested and reviewed by: jhb (kernel part) Sponsored by: The FreeBSD Foundation MFC after: 12 days Differential revision: https://reviews.freebsd.org/D16580 Modified: head/sys/dev/pci/pci_user.c head/usr.sbin/pciconf/pciconf.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Fri Aug 3 18:30:02 2018 (r337268) +++ head/sys/dev/pci/pci_user.c Fri Aug 3 18:35:20 2018 (r337269) @@ -809,7 +809,6 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, #endif case PCIOCGETBAR: case PCIOCLISTVPD: - case PCIOCBARMMAP: break; default: return (EPERM); Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Fri Aug 3 18:30:02 2018 (r337268) +++ head/usr.sbin/pciconf/pciconf.c Fri Aug 3 18:35:20 2018 (r337269) @@ -1085,7 +1085,7 @@ dump_bar(const char *name, const char *reg, const char pbm.pbm_flags = 0; pbm.pbm_memattr = VM_MEMATTR_UNCACHEABLE; /* XXX */ - fd = open(_PATH_DEVPCI, O_RDONLY, 0); + fd = open(_PATH_DEVPCI, O_RDWR, 0); if (fd < 0) err(1, "%s", _PATH_DEVPCI); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"