lkml.org 
[lkml]   [1996]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: the mmap() problem, a'la "grep x /dev/zero"
Date
Linus Torvalds writes:
> I suspect it's just the fact that Linux doesn't check for memory availability
> when doing memory mappings. It _does_ check when increasing the bss, so it
> was just a matter of doing that check in both places (the check should
> probably be improved too).
>
> I'm including totally untested patches - I haven't even rebooted (or
> compiled) this kernel yet, but the more testers, the merrier. The worst
> that can happen is that nothing works, it eats your harddisk, and the
> machine goes up in smoke.,.
>
> (most of this patch is actually just moving "sys_brk()" to where it
> belongs)
>
> Please do tell if this makes a difference for you..

For me there's no different bahaviour at all. I killed the grep when it was
clearly over the limit I set.

But for the following program there was a change:

#include <stdio.h>
#define K 1024
#define M (1020*K)
#define N 128
char a[N*M];

main()
{
long i;

for(i=0;i<(N*M);i++)
a[i]=i%100;
}

Instead of killing my machine it dumps core. Not exactly what it should do
but better than killing the system :-)

BTW this program is the one my collegue uses to kill my machine from time to
time.

Michael

--
Michael Meskes | _____ ________ __ ____
meskes@informatik.rwth-aachen.de | / ___// ____/ // / / __ \___ __________
meskes@sanet.de | \__ \/ /_ / // /_/ /_/ / _ \/ ___/ ___/
meskes@debian.org | ___/ / __/ /__ __/\__, / __/ / (__ )
Use Debian Linux! | /____/_/ /_/ /____/\___/_/ /____/


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.055 / U:3.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site