From hiten@angelica.unixdaemons.com  Fri Oct  4 17:55:31 2002
Return-Path: <hiten@angelica.unixdaemons.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B8C1637B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  4 Oct 2002 17:55:31 -0700 (PDT)
Received: from angelica.unixdaemons.com (angelica.unixdaemons.com [209.148.64.135])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 005C343E65
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  4 Oct 2002 17:55:31 -0700 (PDT)
	(envelope-from hiten@angelica.unixdaemons.com)
Received: from angelica.unixdaemons.com (hiten@localhost.unixdaemons.com [127.0.0.1])
	by angelica.unixdaemons.com (8.12.5/8.12.1) with ESMTP id g94NhlVI044020
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 4 Oct 2002 19:43:47 -0400 (EDT)
Received: (from hiten@localhost)
	by angelica.unixdaemons.com (8.12.5/8.12.1/Submit) id g94NhlvQ044019;
	Fri, 4 Oct 2002 19:43:47 -0400 (EDT)
	(envelope-from hiten)
Message-Id: <200210042343.g94NhlvQ044019@angelica.unixdaemons.com>
Date: Fri, 4 Oct 2002 19:43:47 -0400 (EDT)
From: Hiten Pandya <hiten@angelica.unixdaemons.com>
Reply-To: Hiten Pandya <hiten@angelica.unixdaemons.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Updates for the pciconf(8) manual page
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         43678
>Category:       docs
>Synopsis:       [PATCH] Updates for the pciconf(8) manual page
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 04 18:00:11 PDT 2002
>Closed-Date:    Mon Dec 16 08:59:48 PST 2002
>Last-Modified:  Mon Dec 16 08:59:48 PST 2002
>Originator:     Hiten Pandya
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:

	Not applicable.
	
>Description:
	
	The pciconf(8) manual page, presents the '-l' option as usable a
	non-root user; which, is not true.  I have tried this on a two
	FreeBSD systems, one with FreeBSD 5.0-CURRENT (20020818-JPSNAP), 
	and a FreeBSD 4.6-STABLE system.

	In the patch provided, it corrects the mistake.  Secondly, the
	man page describes, under the BUGS section about, providing
	non-root access to the '-a' and '-r' options.  I do not think
	this is possible, because of the kldload command, and other
	reason(s) outlined in the paragraph.

	The patch removes the statements described above.  I have made
	two versions of the patch.  The first one:

	http://www.unixdaemons.com/~hiten/work/diffs/pciconf.8.first

	^^^ Removes the (false) information regarding the '-l' command
	line parameter to pciconf(8).  NOTE, it does not contain a fix
	to the _second_ problem I outlined.  If there is interest in
	the second problem, then, please fetch the patch provided from
	the location below, (NOTE: it fixes both the problems):

	http://www.unixdaemons.com/~hiten/work/diffs/pciconf.8.second

	Thanking in Advance.
	
	  -- Hiten Pandya
	  -- hiten@uk.FreeBSD.org, hiten@softweyr.com


>How-To-Repeat:

	Execute the pciconf(8) utility as non-root, and it will
	result in: "pciconf: /dev/pci: Permission denied".  This
	error can be noticed, both, on -current, and -stable.
	
>Fix:

	Apply the patch provided, to fix both of the problems that
	are described above (patch same as second URL). 
	
	NOTE, this patch _SHOULD_ be MFC'ed, because it applies to 
	-current, and -stable.

Index: pciconf.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pciconf/pciconf.8,v
retrieving revision 1.22
diff -u -r1.22 pciconf.8
--- pciconf.8	2002/09/17 18:10:39	1.22
+++ pciconf.8	2002/10/01 22:54:39
@@ -108,11 +108,10 @@
 device, which contains several (similar or independent) functions on
 one chip.
 .Pp
-The
-.Fl l
-option is the only one available to non-root users.
-All other invocations of
+All invocations of
 .Nm
+except for
+.Fl l
 require a
 .Ar selector
 of the form
@@ -200,15 +199,3 @@
 .Nm ,
 but not in the underlying
 .Xr ioctl 2 .
-.Pp
-It might be useful to give non-root users access to the
-.Fl a
-and
-.Fl r
-options.
-But only root will be able to execute a
-.Nm kldload
-to provide the device with a driver KLD, and reading of configuration space
-registers may cause a failure in badly designed
-.Tn PCI
-chips.
>Release-Note:
>Audit-Trail:

From: Tom Rhodes <trhodes@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, hiten@angelica.unixdaemons.com
Cc:  
Subject: Re: docs/43678 [PATCH] Updates for the pciconf(8) manual page
Date: Thu, 14 Nov 2002 23:36:41 -0500

 Hiten,
 
 This isn't bad, but we have a slight problem :(
 
 This really isn't the a problem with pciconf(8) and non-root users,
 its actually the fact that non-root users do not (and should not)
 have write access to /dev/pci.  Something like (without mdoc(7)):
 
 pciconf(8) is limited to users with write access to /dev/pci, usually
 root.
 
 We get that taken care of, I see no reason why NOT to commit this
 patch and close this PR.  What do you think?
 
 --
 Tom Rhodes

From: Hiten Pandya <hiten@angelica.unixdaemons.com>
To: Tom Rhodes <trhodes@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: docs/43678 [PATCH] Updates for the pciconf(8) manual page
Date: Sat, 23 Nov 2002 20:48:55 -0500

 --5mCyUwZo2JvN/JJP
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Thu, Nov 14, 2002 at 11:36:41PM -0500, Tom Rhodes wrote the words in effect of:
 > Hiten,
 > 
 > This isn't bad, but we have a slight problem :(
 > 
 > This really isn't the a problem with pciconf(8) and non-root users,
 > its actually the fact that non-root users do not (and should not)
 > have write access to /dev/pci.  Something like (without mdoc(7)):
 > 
 > pciconf(8) is limited to users with write access to /dev/pci, usually
 > root.
 > 
 > We get that taken care of, I see no reason why NOT to commit this
 > patch and close this PR.  What do you think?
 > 
 
 Tom,
 
 Thanks for your feedback, I apologize for taking such a long time in
 replying.  Anyway, I am attaching a patch, to resolve this issue, and
 while I was at that, I added some more things.
 
 Please review it, and let me know.
 Cheers.
 
 -- 
 Hiten (hiten@unixdaemons.com, hiten@uk.FreeBSD.org)
 http://www.unixdaemons.com/~hiten/
 
 --5mCyUwZo2JvN/JJP
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="pciconf.8.patch"
 
 Index: pciconf.8
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/pciconf/pciconf.8,v
 retrieving revision 1.22
 diff -u -r1.22 pciconf.8
 --- pciconf.8	2002/09/17 18:10:39	1.22
 +++ pciconf.8	2002/11/24 01:30:28
 @@ -108,11 +108,10 @@
  device, which contains several (similar or independent) functions on
  one chip.
  .Pp
 -The
 -.Fl l
 -option is the only one available to non-root users.
 -All other invocations of
 +All invocations of
  .Nm
 +except for
 +.Fl l
  require a
  .Ar selector
  of the form
 @@ -163,6 +162,13 @@
  .Fl h
  indicates a halfword (two-byte) operation.  The default is to read or
  write a longword (four bytes).
 +.Pp
 +.Sh NOTE
 +.Nm
 +is limited to users with right access to
 +.Em /dev/pci ,
 +usually
 +.Em root .
  .Sh ENVIRONMENT
  The PCI vendor/device information database is normally read from
  .Pa /usr/share/misc/pci_vendors .
 @@ -170,7 +176,8 @@
  .Ev PCICONF_VENDOR_DATABASE .
  .Sh SEE ALSO
  .Xr ioctl 2 ,
 -.\" .Xr pci 4 ,
 +.Xr pci 4 ,
 +.Xr devinfo 8 ,
  .Xr kldload 8
  .Sh HISTORY
  The
 @@ -200,15 +207,3 @@
  .Nm ,
  but not in the underlying
  .Xr ioctl 2 .
 -.Pp
 -It might be useful to give non-root users access to the
 -.Fl a
 -and
 -.Fl r
 -options.
 -But only root will be able to execute a
 -.Nm kldload
 -to provide the device with a driver KLD, and reading of configuration space
 -registers may cause a failure in badly designed
 -.Tn PCI
 -chips.
 
 --5mCyUwZo2JvN/JJP--
Responsible-Changed-From-To: freebsd-doc->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Tue Dec 10 12:02:54 PST 2002 
Responsible-Changed-Why:  
This should have been assigned to me, so do it now. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43678 
State-Changed-From-To: open->patched 
State-Changed-By: trhodes 
State-Changed-When: Sat Dec 14 10:30:16 PST 2002 
State-Changed-Why:  
Patched in HEAD.  Will MFC soon. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43678 
State-Changed-From-To: patched->closed 
State-Changed-By: trhodes 
State-Changed-When: Mon Dec 16 08:59:25 PST 2002 
State-Changed-Why:  
MFC Completed this morning.  Thanks! 

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