From owner-freebsd-bugs Fri Dec 1 14:20:11 2000 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 56E3D37B402 for ; Fri, 1 Dec 2000 14:20:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id eB1MK2s64231; Fri, 1 Dec 2000 14:20:02 -0800 (PST) (envelope-from gnats) Received: from orthanc.ab.ca (207-167-15-66.dsl.worldgate.ca [207.167.15.66]) by hub.freebsd.org (Postfix) with ESMTP id D499037B401 for ; Fri, 1 Dec 2000 14:15:54 -0800 (PST) Received: (from lyndon@localhost) by orthanc.ab.ca (8.11.1/8.11.0.Beta3) id eB1MFsn32985; Fri, 1 Dec 2000 15:15:54 -0700 (MST) Message-Id: <200012012215.eB1MFsn32985@orthanc.ab.ca> Date: Fri, 1 Dec 2000 15:15:54 -0700 (MST) From: Lyndon Nerenberg Reply-To: lyndon@orthanc.ab.ca To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/23217: [PATCH] 'pciconf -l' opens /dev/pci with incorrect permissions Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 23217 >Category: bin >Synopsis: [PATCH] 'pciconf -l' opens /dev/pci with incorrect permissions >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 01 14:20:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Lyndon Nerenberg >Release: FreeBSD 4.2-STABLE i386 >Organization: The Frobozz Magic Homing Pigeon Company >Environment: >Description: pciconf always opens /dev/pci with O_RDWR. For the -l case it should open the device O_RDONLY. When combined with my /sys/pci/pci.c patch for pci_ioctl this restores the documented behaviour of 'pciconf -l' being available to mortal users. >How-To-Repeat: Run pciconf -l as a non-root user. >Fix: Index: pciconf.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pciconf/pciconf.c,v retrieving revision 1.11 diff -u -r1.11 pciconf.c --- pciconf.c 1999/12/08 17:43:20 1.11 +++ pciconf.c 2000/12/01 22:11:57 @@ -134,7 +134,7 @@ struct pci_conf conf[255], *p; int none_count = 0; - fd = open(_PATH_DEVPCI, O_RDWR, 0); + fd = open(_PATH_DEVPCI, O_RDONLY, 0); if (fd < 0) err(1, "%s", _PATH_DEVPCI); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message