showstopper, mmap()+read(), pre2.0.12

Ingo Molnar (mingo@kaliban.csoma.elte.hu)
Wed, 5 Jun 1996 22:53:36 -0400 (EDT)


i guess it's well known, but anyways, i've simplified down the "grep .."
problem to the following code. It locks up my machine very reliably, old
kernels like 1.3.64 too:

[ sometimes it locks up with interrupts turned off, sometimes the kernel
loops in __get_free_page() (?) i think ]:

[ can provide more info but i guess this is enough ]:

[ N has to be bigger than mem+swap ]

---------- cut here ---------------->
#include <unistd.h>
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>

#define N 83894272

int main( void )
{
int fd;
void * map;
fd=open("/dev/zero",O_RDONLY);

map = mmap( 0, N, PROT_READ|PROT_WRITE, MAP_PRIVATE|0x20, fd, 0);

read( fd, map, N);

return(0);
}