lkml.org 
[lkml]   [2003]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC] prevent "dd if=/dev/mem" crash
>>>>> On Mon, 20 Oct 2003 09:17:10 -0600, Bjorn Helgaas <bjorn.helgaas@hp.com> said:

Bjorn> On Friday 17 October 2003 6:21 pm, David Mosberger wrote:
>> What about memory-mapped device registers? Isn't all memory
>> physically contiguous on x86 and that's why the "p >=
>> __pa(high_memory)" test saves you from that?

Bjorn> As others have mentioned, using read/write on /dev/mem to get
Bjorn> at memory-mapped registers is unlikely to work on ia64
Bjorn> anyway, because read/write use cacheable mappings. Using
Bjorn> mmap does work (using uncacheable mappings), and my patch
Bjorn> doesn't change that path.

True, I just find this whole thing rather disgusting: different
behavior for read/write vs. mmap; but you're right, it's nothing
new and probably the most pragmatic "solution".

Bjorn> I bet that ia32 does have page tables for this case, and that
Bjorn> an attempt to read non-existent physical memory will cause a
Bjorn> TLB miss from which copy_*_user() can easily recover.

True, but even this doesn't help for MMIO space, where a device may
decode less than a full page. So you'd still end up accessing address
holes. Just that x86 returns garbage in that case (I think).

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

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:2.238 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site