mmap giving Permission Denied error

Ravi Teja ravi2j at
Sat Sep 21 09:25:15 EDT 2013

Hello all,

I tried mmap'ing to address zero after setting */proc/sys/vm/mmap_min_addr*to
* 0*, but mmap is giving Permission Denied error.

My C code is as below -

#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

int main(void)
int *ptr = NULL;
ptr =
if(ptr == MAP_FAILED)
perror("Error in mapping\n");
printf("After mmap\n");
*ptr = 16;
printf("Contents of address 0x%x is :: %d\n",ptr,*ptr);
return 0;

Am I doing anything wrong here?

Thank you in advance.

Ravi Teja
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list