#include <sys/types.h>
#include <sys/mman.h>
#include <stdio.h>
#include <string.h>
int main( )
{
char * buf = mmap( 0, 4096, PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0 );
strcpy( buf, "hello world" );
mprotect( buf, 4096, PROT_NONE );
/* buf has _PAGE_PROTNONE here */
mprotect( buf, 4096, PROT_READ );
printf( "%s\n", buf );
return 0;
}
This program works on 2.1.122, but once again, I'm suspicious of the
code in mm/memory.c. What happens if my program sleeps here and this
page gets swapped out? Now I have a _PAGE_PROTNONE page that can change
between the "present" and "not present" states.
The rule "a _PAGE_PROTNONE pte is always pte_present" looks inadequate
here.
Michael Elizabeth Chastain
<mailto:mec@shout.net>
"love without fear"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/