NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/45830: reading :dev/mem panics an i386 domU


(Forwarding my reply to your question on tech-kern to place it
into the PR:)

No, this is not a bug, especially not, if this is run by root.

/dev/mem is by definition the possibility to access the physical
address space of the machine.  That is, apart from allowing access
to the physical memory, it also allows access to memory mapped I/O
etc.  Reading sequentially through this may or may not stumble upon
one of these addresses before getting some error result (depending
on the machine in question and the access rights).

Access to /dev/mem requires specially crafted tools that know what
they are doing.

Regarding the mentioning of root in my first sentence, what I meant
was that in (most of) our ports, there is code in the kernel that
(depending on the secmodel in place) allows non-root users access
only to real memory and returns an error otherwise (which happens to
be wrong anyway, as it returns KAUTH_RESULT_* values as errno values,
as I just found out when looking into this).

From a security POV, access to /dev/mem should be restricted to
root anyway (ok, based on the secmodel in place.  However, the
current restriction of non-root access to memory only doesn't make
too much sense; maybe a relict from some early frame buffer access?)

--                         Wolfgang Solfrank

Home | Main Index | Thread Index | Old Index