From owner-freebsd-hackers Mon May 18 00:54:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA29569 for freebsd-hackers-outgoing; Mon, 18 May 1998 00:54:08 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bird.te.rl.ac.uk (bird.te.rl.ac.uk [130.246.19.162]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA29549 for ; Mon, 18 May 1998 00:54:01 -0700 (PDT) (envelope-from tmb@rcru.rl.ac.uk) Received: from rcru.rl.ac.uk (localhost [127.0.0.1]) by bird.te.rl.ac.uk (8.8.8/8.8.8) with ESMTP id IAA22480; Mon, 18 May 1998 08:53:54 +0100 (BST) (envelope-from tmb@rcru.rl.ac.uk) Message-Id: <199805180753.IAA22480@bird.te.rl.ac.uk> To: hackers@FreeBSD.ORG cc: tmb@rcru.rl.ac.uk Subject: /dev/io access. Date: Mon, 18 May 1998 08:53:53 +0100 From: Mark Blackman Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello all, I've noticed that there is a small discrepancy between what the io(4) man page says and what the source for 2.2.6 does. In the course of doing some preliminary userland communication with a custom bit of hardware (10MHz A/D PCI card), I find that my code cannot write to an I/O port address unless it's run with uid=0. The man page io(4) says ... " The entire access control is handled by the file access permissions of /dev/io, so care should be taken in granting rights for this device. Note that even read/only access will grant the full I/O privileges. " The source code (/usr/src/sys/i386/i386/mem.c) says.. in "mmopen", case 14 being the "io" device I believe. case 14: error = suser(p->p_ucred, &p->p_acflag); if (error != 0) return (error); if (securelevel > 0) return (EPERM); fp = (struct trapframe *)curproc->p_md.md_regs; fp->tf_eflags |= PSL_IOPL; break; The "suser" call appears to enforce a root-only access policy to the I/O port addresses. I assume there was a change of philosophy between the man page being written and 2.2.6? There are two trivial work-arounds, i.e. run uid=0 or change my version of the system. However, I would like to be briefly acquainted with the reasoning for this change though if anyone is feeling generous with their time. Note that pciconf.c is similarly restricted. Regards, ************************************************************************* * Mark Blackman * * Radar Group * * Radio Communications Research Unit * * Rutherford Appleton Laboratory E-mail: tmb@rcru.rl.ac.uk * * Chilton, Didcot Tel: +44-1235-446126 * * Oxon OX11 0QX, United Kingdom Fax: +44-1235-446140 * ************************************************************************* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message