Bug#1024149: linux-image-amd64: 32-bit mmap() puts large files at non-random address
Adding forgotten attachment...
--
Jakub Wilk
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
int main(int argc, char **argv)
{
struct stat st;
if (fstat(0, &st) < 0)
abort();
void *p = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 0, 0);
printf("mmap(NULL, %zd, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 0, 0) = %p\n", (size_t) st.st_size, p);
}
Reply to: