lkml.org 
[lkml]   [1998]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mmap oddness


On Thu, 2 Apr 1998 yodaiken@chelm.cs.nmt.edu wrote:
>
> mmap does not map /dev/mem or /dev/kmem correctly or I don't understand
> what it is supposed to do.
>
> 1. insmod a module that kmallocs a page and writes an identifier
> on the page and then printks the virt_to_phys and address.
> 2. a user task opens /dev/mem or /dev/kmem and reads every page
> looking for the identifier -- the identifier is found at exactly
> the expected position.
> 3. a user task opens /dev/mem or /dev/kmem and mmaps the page with the
> identifier -- no identifier found.
> 4. the task in (3) is modified to try every page in mem or kmem -- no
> identifier found.
> 5. If the kernel buffer is allocated statically, everything works as
> expected.
>
> This is on 2.1.89, but is the same on a couple of other versions.

This is because the kernel will refuse any mmap access to any memory pages
that the kernel may be using. That includes all normal memory.

The _only_ way to get a mmap of memory is to mmap something that is
- outside the normal kernel range. This includes stuff like PCI frame
buffers etc, because the kernel knows that it is not trying to manage
that as memory.
- marked as reserved. This includes the 640k-1M region, and can be
expanded (as done by the sound driver).

Linus


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

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