User Access to I/O ports

Simo Huotari (sjhuotar@rock.helsinki.fi)
Tue, 3 Jun 1997 16:58:33 +0300 (EET DST)


Dear kernel maintainers,

The following is actually nearly from word to word the e-mail from
Gerry Swislow to Linus Torvalds in 1994, only the idea wasn't accomplished
into a patch then. The needed change is actually quite important, so probably
someone is willing to implement it in future kernel versions.

I would like to suggest a change that would make the Linux
version of the KDADDIO/KDDELIO and KDENABIO/KDDISABIO ioctl() calls
work the same as the AT&T/USL System V/386 Releases 3 and SVR4.x
implementations.

The current Linux implementation requires super user privilege
for non-video I/O port access. Although the System V implementation
requires super user privilege for the KDADDIO/KDDELIO calls (perhaps not
so for video ports?), once a port is added by root, the port is available
to any user process that calls KDENABIO.

The reason this change is important, is that our applications use
I/O port access to program motor controllers, counter/timers, etc. We do
not want these programs to run with super-user privilege, however,
because of all the other things that they do.

I imagine the modification to the Linux kernel would involve adding a
global io_bitmap[] that is modified with KDADDIO and KDDELIO and is
copied (or or'ed in) to a task's io_bitmap[] with the KDENABIO call.

The ioperm() system call could still be used to modify a single process's
bitmap for compatibility with existing Linux code, such as the VGA
library.

Dr. Swislow has used the above-mentioned ioctl() calls extensively, and
he is quite sure the System V implementation is as described. It is also
clear that the System V documentation doesn't give a clue that is
the way the calls function.

In the meantime, we just comment out the "if (suser())" check in
the ioperm() code in the kernel in order to run our software.

---
Simo j. Huotari		e-mail: simo.huotari@helsinki.fi
X-Ray Laboratory	www: http://www.physics.helsinki.fi/~sjhuotar
Dept. of Physics
University of Helsinki