Re: [PATCH] Fix mmap_kmem (was: [question] What's the difference between /dev/kmem and /dev/mem)

Alan Cox
2005-08-16T23:07:04Z

On Maw, 2005-08-16 at 17:12 -0500, Greg Edwards wrote:
> mmap_mem suffers from a lack of proper checks as well. For example, on
> Altix page 0 of each node is reserved for prom and a read or write to it
> will cause an MCA. mmaping /dev/mem with offset 0 will nicely explode.
> Would adding a pfn_valid test in mmap_mem be the best bet, or could we
> consolidate the checks currently in mmap_kmem into mmap_mem?

If you use /dev/mem you should know what you are doing. Even with
"checks" dd if=/dev/zero of=/dev/mem will do bad things. Trapping
obviously bad cases is fine, but complete sanity checking may actually
be counter productive.