Re: implementing mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 22, 2009 at 6:49 PM, Andrea Gasparini <gaspa@xxxxxxxxxxx> wrote:
>> You may want to take a look at this page,
>>
>> http://www.scs.ch/~frey/linux/memorymap.html
>>
>> This also contains a sample source code, here,
>> http://www.scs.ch/~frey/linux/mmap.example.tar
>> I tried this code on ARM architecture on a swapless board which works
>> fine.
>>
>> If you could share exact code, that would be easy to debug the problem
>> you are facing.
>
> Oh, solved!! \o/
> Don't know why, but it didn't take correctly PROT_NONE flag on (userspace)
> mmap.
>
> with:
>    mmapped_ptr = mmap(NULL,SIZE,PROT_READ, MAP_SHARED ,fd,0);
> ( or PROT_WRITE, or both) it works.
>
> thanks.
> --
> -gaspa-
> -----------------------------------------------
> -------- https://launchpad.net/~gaspa ---------
> ------ HomePage: iogaspa.altervista.org -------
> -Il lunedi'dell'arrampicatore: www.lunedi.org -
>

huh? the code which you gave to us already had mmap with
"PROT_READ|PROT_WRITE" and it even worked with my setup.
But, if I use PROT_NONE then it crashes with segfault, which is
perfectly correct as such pages are not meant to be accessed

<snip>
       PROT_EXEC  Pages may be executed.

       PROT_READ  Pages may be read.

       PROT_WRITE Pages may be written.

       PROT_NONE  Pages may not be accessed.
<\snip>



-Vinit

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux