On 30/01/05 16:50, Muli Ben-Yehuda wrote:
remap_page_range has some peculiarities. In particular, are you
setting the pages you are mapping to PageReserved first?

<rant>
"Some peculiarities" indeed! If you use remap_page_range (e.g., via /dev/mem) to mmap a physical address that's valid and unreserved (i.e., all of "normal" memory), it fails silently: the PTE is allocated but left marked as not present (see mm/memory.c/remap_pte_range). When you later access the corresponding virtual address, the page fault allocates a new page at an arbitrary physical address, and you end up accessing *that* pageframe.


To recap: you say "I want to access physical address X"; the kernel says "no problem, here it is" and maps you to a different physical address.

I wasted several days because of this bug (first on getting bad data, then on tracking it down). It didn't help much that mmap() on /dev/map is broken, but lseek()+read() on /dev/mem work fine, so if you look at /dev/mem using dd or hexdump it looks like the data is there.

This bug has apparently been known for years, but never addressed. Now, mmapping valid unreserved memory apparently entails problems with ref counts and swapping, but if it's not implemented then the calls should at least indicate a failure!
</rant>


  Eran

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to