From lyndon@orthanc.ab.ca  Fri Dec  1 14:15:55 2000
Return-Path: <lyndon@orthanc.ab.ca>
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 <FreeBSD-gnats-submit@freebsd.org>; 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 <lyndon@orthanc.ab.ca>
Reply-To: lyndon@orthanc.ab.ca
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] 'pciconf -l' opens /dev/pci with incorrect permissions
X-Send-Pr-Version: 3.2

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 01 14:20:01 PST 2000
>Closed-Date:    Mon Apr 16 11:26:26 PDT 2001
>Last-Modified:  Mon Apr 16 11:26:44 PDT 2001
>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:
State-Changed-From-To: open->closed 
State-Changed-By: bmah 
State-Changed-When: Mon Apr 16 11:26:26 PDT 2001 
State-Changed-Why:  
Closed by submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23217 
>Unformatted:
 
