Re: [PATCH 2/2] make /dev/kmem return error for highmem

From: H. Peter Anvin
Date: Fri Feb 08 2013 - 15:49:00 EST


On 02/08/2013 12:28 PM, Dave Hansen wrote:
I was auding the /dev/mem code for more questionable uses of
__pa(), and ran across this.

My assumption is that if you use /dev/kmem, you expect to be
able to read the kernel virtual mappings. However, those
mappings _stop_ as soon as we hit high memory. The
pfn_valid() check in here is good for memory holes, but since
highmem pages are still valid, it does no good for those.

Also, since we are now checking that __pa() is being done on
valid virtual addresses, this might have tripped the new
check. Even with the new check, this code would have been
broken with the NUMA remapping code had we not ripped it
out:


It would be great if you could take a stab at fixing /dev/mem and /dev/kmem... there are a bunch of problems with both which seem to really translate to "HIGHMEM was never properly implemented"...

-hpa


--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/