All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Paweł Sikora" <pluto@agmk.net>
Cc: libc-help@sourceware.org, linux-kernel@vger.kernel.org
Subject: Re: mprotect() failed: Cannot allocate memory
Date: Wed, 21 Apr 2010 12:16:50 +0200	[thread overview]
Message-ID: <1271845010.1776.72.camel@laptop> (raw)
In-Reply-To: <201004210105.20942.pluto@agmk.net>

On Wed, 2010-04-21 at 01:05 +0200, Paweł Sikora wrote:
> hi,
> 
> i'm trying to debug an ugly application with ElectricFence.
> in fact, on x86-64 box with 8GB ram and 16GB swap i'm getting following error:
> 
> "ElectricFence Exiting: mprotect() failed: Cannot allocate memory"
> 
> the program has been compiled with gcc-4.5, glibc-2.11.1, kernel-2.6.32.
> did you ever come across such (kernel/glibc) limitations?
> 
> here's a simple testcase which triggs -ENOMEM in mprotect().

You probably depleted the max map count, see:
  /proc/sys/vm/max_map_count

We have a limit on the number of maps you can have, those mprotect()
calls split you maps like crazy, see also /proc/$pid/maps.

eg. change your second test program to include something like:

  char buf[128];
  snprintf(buf, sizeof(buf), "cat /proc/%d/maps", (int)getpid());
  system(buf);

at the end after lowering your NN count to fit, and observe the result
of those mprotect() calls.


  parent reply	other threads:[~2010-04-21 10:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 23:05 mprotect() failed: Cannot allocate memory Paweł Sikora
2010-04-20 23:17 ` Mike Frysinger
2010-04-20 23:44   ` Paweł Sikora
2010-04-21  2:23     ` Mike Frysinger
2010-04-21  8:22     ` Yann Droneaud
2010-04-21  7:33       ` Paweł Sikora
2010-04-21  7:42       ` Paweł Sikora
2010-04-21 10:16 ` Peter Zijlstra [this message]
2010-04-21  9:42   ` Paweł Sikora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271845010.1776.72.camel@laptop \
    --to=peterz@infradead.org \
    --cc=libc-help@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pluto@agmk.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.