From: Steffen Persvold <sp@scali.com>
To: Lingli Zhang <lingli_z@umail.ucsb.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: mmap() failed on Linux 2.4.18-10smp with 4GB RAM
Date: Wed, 25 Sep 2002 08:18:40 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.44.0209250814230.1579-100000@dpc-27.office.scali.no> (raw)
In-Reply-To: <1032929970.3d9142b22bc55@webaccess.umail.ucsb.edu>
On Tue, 24 Sep 2002, Lingli Zhang wrote:
> Hi there,
>
> My machine is a 2-Processor Pentium 4 (Xeon) 2.4GHz e7500 Chipset with 4GB RAM.
> I installed Redhat (kernel: Linux 2.4.18-10bigmem) on it.
>
> But when I run following piece of code:
> ========================================
> #include <unistd.h>
> #include <sys/mman.h>
> int main(){
> mmap ((void *) 1090519040, 17000000,
> PROT_READ | PROT_WRITE | PROT_EXEC,
> MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
> }
> ===========================================
> It gives out "segmentation fault". It works well if I change 17000000
> to 16000000.
>
> I have tried Linux 2.4.18-10smp kernel, same problem.
>
> Is there anyone have any idea what's going on here? Or do you have any
> recommendation that which version of Linux I should use for my machine to work
> around this problem?
>
Well, the problem is that you are forcing the mmap to create a virtual map
starting at 0x41000000 and with 17000000 bytes that map is ending at
0x42036640, which is right in the middle of where glibc gets mapped :
# cat /proc/2441/maps
08048000-08049000 r-xp 00000000 00:0c 163922 /home/sp/a.out
08049000-0804a000 rw-p 00000000 00:0c 163922 /home/sp/a.out
40000000-40013000 r-xp 00000000 08:02 416894 /lib/ld-2.2.5.so
40013000-40014000 rw-p 00013000 08:02 416894 /lib/ld-2.2.5.so
40014000-40015000 rw-p 00000000 00:00 0
40022000-40023000 rw-p 00000000 00:00 0
42000000-4212c000 r-xp 00000000 08:02 448959 /lib/i686/libc-2.2.5.so
4212c000-42131000 rw-p 0012c000 08:02 448959 /lib/i686/libc-2.2.5.so
42131000-42135000 rw-p 00000000 00:00 0
bfffe000-c0000000 rwxp fffff000 00:00 0
If you absolutely want to use this fixed address for your mmap, link your
application statically, or maybe there's a way to tell the dynamic linker
to put the libraries elsewhere ?
Regards,
--
Steffen Persvold | Scali AS
mailto:sp@scali.com | http://www.scali.com
Tel: (+47) 2262 8950 | Olaf Helsets vei 6
Fax: (+47) 2262 8951 | N0621 Oslo, NORWAY
next prev parent reply other threads:[~2002-09-25 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-25 4:59 mmap() failed on Linux 2.4.18-10smp with 4GB RAM Lingli Zhang
2002-09-25 6:18 ` Steffen Persvold [this message]
2002-09-25 17:50 Lingli Zhang
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=Pine.LNX.4.44.0209250814230.1579-100000@dpc-27.office.scali.no \
--to=sp@scali.com \
--cc=lingli_z@umail.ucsb.edu \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).