From owner-svn-src-head@freebsd.org Fri Aug 3 18:35:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59C92104C1EC; Fri, 3 Aug 2018 18:35:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F15C98FD8C; Fri, 3 Aug 2018 18:35:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD188242C7; Fri, 3 Aug 2018 18:35:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w73IZKxG006952; Fri, 3 Aug 2018 18:35:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w73IZKRO006950; Fri, 3 Aug 2018 18:35:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201808031835.w73IZKRO006950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 3 Aug 2018 18:35:20 +0000 (UTC) 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 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: sys/dev/pci usr.sbin/pciconf X-SVN-Commit-Revision: 337269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 18:35:21 -0000 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);