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
This commit is contained in:
parent
1d1077d63c
commit
af9bfba938
@ -809,7 +809,6 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t
|
||||
#endif
|
||||
case PCIOCGETBAR:
|
||||
case PCIOCLISTVPD:
|
||||
case PCIOCBARMMAP:
|
||||
break;
|
||||
default:
|
||||
return (EPERM);
|
||||
|
@ -1085,7 +1085,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user