Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Sep 2007 13:19:39 +0400
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Peter Wemm <peter@wemm.org>
Cc:        freebsd-amd64@FreeBSD.org
Subject:   Re: amd64 process sizes
Message-ID:  <20070909091939.GA72634@team.vega.ru>
In-Reply-To: <46E38A42.8050400@wemm.org>
References:  <20070905095049.GH1167@turion.vk2pj.dyndns.org> <20070905145006.GA50486@team.vega.ru> <46E38930.2050409@wemm.org> <46E38A42.8050400@wemm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Sep 08, 2007 at 10:53:06PM -0700, Peter Wemm wrote:
> Peter Wemm wrote:
>> 
>> 2) There is a bug in sys/kern/imgact_elf.c.  It assumes that the PT_LOAD 
>> sections are contiguous, which isn't a given.
> 
> I think I may have outsmarted myself here.  This should be coming from 
> rtld, not the kernel.  In any case, it is still our bug.
> 
This has to do with binutils (the section's alignment).  On i386
it's 2^12 (4KB):

: Program Header:
:     LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
:          filesz 0x000ca5d2 memsz 0x000ca5d2 flags r-x
:     LOAD off    0x000ca5e0 vaddr 0x000cb5e0 paddr 0x000cb5e0 align 2**12
:          filesz 0x000053f0 memsz 0x0001b404 flags rw-

But on amd64 it's 2^20 (1MB):

: Program Header:
:     LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**20
:          filesz 0x00000000000d7051 memsz 0x00000000000d7051 flags r-x
:     LOAD off    0x00000000000d7060 vaddr 0x00000000001d7060 paddr 0x00000000001d7060 align 2**20
:          filesz 0x000000000001a010 memsz 0x0000000000032df8 flags rw-

1MB gives either 255 or 256 pages when aligned.  What I don't
understand is why rtld mmaps the total sum of virtual sizes
(memsz) from the library, which often is greater than the
size of the file, but I didn't yet look close enough in the
sources.


Cheers,
-- 
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070909091939.GA72634>