From owner-freebsd-bugs Mon Dec 10 10:10:14 2001 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 26D9D37B41B for ; Mon, 10 Dec 2001 10:10:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBAIA1q02794; Mon, 10 Dec 2001 10:10:01 -0800 (PST) (envelope-from gnats) Received: from psychotic.aberrant.org (psychotic.aberrant.org [66.92.161.103]) by hub.freebsd.org (Postfix) with ESMTP id 6584D37B416 for ; Mon, 10 Dec 2001 10:06:31 -0800 (PST) Received: by psychotic.aberrant.org (Postfix, from userid 1000) id 6711472501; Mon, 10 Dec 2001 13:06:15 -0500 (EST) Message-Id: <20011210180615.6711472501@psychotic.aberrant.org> Date: Mon, 10 Dec 2001 13:06:15 -0500 (EST) From: seth@psychotic.aberrant.org Reply-To: seth@psychotic.aberrant.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/32677: pciconf -l opens /dev/pci for O_RDWR Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 32677 >Category: kern >Synopsis: pciconf -l opens /dev/pci for read/write when should be readonly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Dec 10 10:10:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Seth >Release: FreeBSD 4.3-STABLE i386 >Organization: >Environment: System: FreeBSD psychotic.aberrant.org 4.3-STABLE FreeBSD 4.3-STABLE #0: Tue Nov 13 13:13:03 EST 2001 seth@psychotic.aberrant.org:/usr/src/sys/compile/KERNEL-F i386 >Description: pciconf -l tries to open /dev/pci O_RDWR even though it shouldn't be writing anything. This causes it to fail under either of the following circum- stances: 1. user is not root 2. securelevel > 0 According to the manpage for pciconf, The -l option is the only one available to non-root users. According to the init manpage, 1 Secure mode - the system immutable and system append-only flags may not be turned off; disks for mounted filesystems, /dev/mem, and /dev/kmem may not be opened for writing; kernel modules (see kld(4)) may not be loaded or unloaded. >How-To-Repeat: pciconf -l as a normal (non-root) user, or truss pciconf -l as root in securelevel 1: open("/dev/pci",2,00) ERR#1 'Operation not permitted' pciconf: write(2,0xbfbfcad8,9) = 9 (0x9) >Fix: Check arguments to pciconf. If -l, open O_RDONLY. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message