lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200804011017.35352.vda.linux@googlemail.com>
Date:	Tue, 1 Apr 2008 10:17:35 +0200
From:	Denys Vlasenko <vda.linux@...glemail.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Kevin Shanahan <kmshanah@...b.org.au>, linux-kernel@...r.kernel.org
Subject: Re: OOM (HighMem) on linux 2.6.24.2

On Tuesday 01 April 2008 06:57, Peter Zijlstra wrote:
> On Tue, 2008-04-01 at 04:31 +0200, Denys Vlasenko wrote:
> > On Thursday 20 March 2008 11:04, Kevin Shanahan wrote:
> > > Feb 28 06:32:20 hermes kernel: 5313 pages slab
> > > Feb 28 06:32:20 hermes kernel: 2632 pages pagetables
> > > Feb 28 06:32:20 hermes kernel: Out of memory: kill process 24013 (apache2) score 22070 or a child
> > > Feb 28 06:32:20 hermes kernel: Killed process 24013 (apache2)
> > > 
> > > Looks like the HighMem low watermark was hit again (though I've no idea
> > > if that's actually significant).
> > 
> > I kno that people routinely forget to do that, but
> > at least for purely paranoid reasons you are better
> > to run all daemons with setrlimit'ed memory size.
> > At least all daemons which you cannot reasonably
> > trust to be 100% leak-free and to have bounded
> > peak memory usage.
> 
> Afaik we don't actually implement RLIMIT_RSS.

I don't know, but the following definitely works for me:

#include <stdlib.h>
int main() {
    void *p;
    unsigned size = 1 << 20;
    unsigned long total = 0;
    while (size) {
        p = malloc(size);
        if (!p) size >>= 1;
        else {
            memset(p, 0x77, size);
            total += size;
            printf("Allocated %9u bytes, %12lu total\n", size, total);
        }
    }
    printf("Cannot malloc more. Exiting\n");
    return 0;
}

# softlimit -a 12000000 ./oom
Allocated   1048576 bytes,      1048576 total
Allocated   1048576 bytes,      2097152 total
Allocated   1048576 bytes,      3145728 total
Allocated   1048576 bytes,      4194304 total
Allocated   1048576 bytes,      5242880 total
Allocated   1048576 bytes,      6291456 total
Allocated   1048576 bytes,      7340032 total
Allocated   1048576 bytes,      8388608 total
Allocated   1048576 bytes,      9437184 total
Allocated   1048576 bytes,     10485760 total
Allocated    262144 bytes,     10747904 total
Cannot malloc more. Exiting

--
vda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ