Re: [PATCH] /dev/mem validate mmap requests

From: Bjorn Helgaas <>
Date: 2005-12-07 07:49:11
On Tuesday 06 December 2005 11:39 am, Hugh Dickins wrote:
> On Mon, 5 Dec 2005, Bjorn Helgaas wrote:
> > Add a hook so architectures can validate /dev/mem mmap requests.
> Not a comment on your patch at all, just an FYI in case you've missed
> it, and in case it makes any difference to your ia64 needs.
> A side-effect of 2.6.15-rc's PageReserved changes is that a user with
> access to /dev/mem can now mmap any page of it, and see what's there
> rather than zeroes, whether or not it has been marked PageReserved.

Thanks for the pointer.

I think my patch is orthogonal to your PageReserved changes.

Here's a little more detail on the problem scenario.  An HP
sx1000 machine with VGA has a memory map like this:

	0-640K 		memory (supports only WB mappings)
	640K-768K	VGA frame buffer (MMIO, supports only UC mappings)
	768K-16M	memory (supports only WB mappings)

We use a 16MB "granule".  All mappings within a granule have to
be the same type to avoid attribute aliasing.  Since we're using
VGA, we have to use UC mappings for the MMIO frame buffer.  We
can't use UC mappings for the memory, because the sx1000 chipset
doesn't support that.  We can't use WB mappings, because that would
cause attribute aliasing.

Since we can't use WB mappings, the kernel ignores all that memory
between 0-16MB.  There aren't even any page structures for it.  But
without my patch, /dev/mem allows users to mmap it.  And there's no
safe way to allow access of any kind to that memory.

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Wed Dec 07 07:49:53 2005

This archive was generated by hypermail 2.1.8 : 2005-12-07 07:50:03 EST