mmap(2) segaults with certain len values and MAP_ANON|MAP_FIXED

Alexander Best alexbestms at math.uni-muenster.de
Wed Oct 21 01:41:23 UTC 2009


hi there,

just a little mmap(2) related question. running the following code causes a
segfault:

mmap( (void*)0x1000, 0x80047000, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0 );

while the following doesn't:

mmap( (void*)0x1000, 0xffffffff, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0 );

is this a known problem? seems reproducible on all branches.

cheers
alex
-------------- next part --------------
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
	printf("mmap: %p\n", mmap( (void*)0x1000, 0xffffffff, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0 ));
	printf("mmap: %p\n", mmap( (void*)0x1000, 0x80047000, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0 ));

	return 0;
}


More information about the freebsd-hackers mailing list