Subject: Re: /dev/mem ???
To: Hauke Fath <saw@sun0.urz.uni-heidelberg.de>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-mac68k
Date: 06/12/1996 11:25:37
On Wed, 12 Jun 1996 18:00:51 +0100 
 saw@sun0.urz.uni-heidelberg.de (Hauke Fath) wrote:

 > o  though running setuid root/setgid kmem, a little program cannot open
 > /dev/mem; open( "/dev/mem", O_RDWR) gives 1 (EACCES?)

This is because kernel security level prevents opening /dev/mem, 
/dev/kmem, etc. for writing of securelevel > 0.  You would be able to do 
this in single-user mode, for example, since securelevel is 0 at that 
point.  The rationale is that being able to scribble random bits of 
memory from userspace is a _serious_ security hole :-)

 > o  "hexdump /dev/mem" run as root dumps core:

Can't help you with this one ... looks like a bug :-)

 > Has anyone out there had more success with /dev/mem??

The best inteface for groveling around in memory is kvm(3)...This is the 
interface ps(1), etc. uses.

----save the ancient forests - http://www.bayarea.net/~thorpej/forest/----
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939