Subject: mmap of /dev/mem
To: None <tech-kern@NetBSD.org>
From: Wolfgang Solfrank <ws@tools.de>
List: tech-kern
Date: 04/07/2004 14:30:50
Hi,
most of our ports have something like (this one is from i386)
if ((u_int)off > ctob(physmem) && suser(...) != 0)
return (-1);
in their mmmmap function (probably derived from this i386 version).
While the intent seems to be to only allow the superuser access
to device memory, even when /dev/mem would allow it to others,
this doesn't work on machines with non-contigous physical memory
or with memory not starting at address 0 (and therefor it probably
didn't work on the original i386 pmap version (which was quite
different from what we have now) either).
Since all ports seem to allow normal read(2)/write(2) access to
/dev/mem independent of address or user id, should the above check
be eliminated? Or should we implement the intended semantics?
Ciao,
Wolfgang
--
ws@TooLs.DE Wolfgang Solfrank, TooLs GmbH