Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Aug 2018 18:35:20 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337269 - in head: sys/dev/pci usr.sbin/pciconf
Message-ID:  <201808031835.w73IZKRO006950@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808031835.w73IZKRO006950>