* /proc/<pid>/maps
@ 2000-03-17 23:48 cpg
2000-03-18 1:08 ` /proc/<pid>/maps Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: cpg @ 2000-03-17 23:48 UTC (permalink / raw)
To: axp-list
I've got a question:
If I look at /proc/<pid>/maps I've got 3 entries for every shared lib
the process uses. On i386 there are only 2 entries for each shlib
(I assume code + data).
The additional entry on alpha has flags "---p" (no read, no write no
execute,
I don't know what p means).
What is the purpose of this mapping and where does it come from?
regards,
chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: /proc/<pid>/maps
2000-03-17 23:48 /proc/<pid>/maps cpg
@ 2000-03-18 1:08 ` Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2000-03-18 1:08 UTC (permalink / raw)
To: axp-list
On Sat, Mar 18, 2000 at 12:48:21AM +0100, cpg@aladdin.de wrote:
> If I look at /proc/<pid>/maps I've got 3 entries for every shared lib
> the process uses. On i386 there are only 2 entries for each shlib
[...]
> What is the purpose of this mapping and where does it come from?
This is an artifact of the glibc ld.so. It will appear on any
architecture that has a maximum architectural page size larger
than the current os page size.
What happens is that glibc reserves the entire memory region
that it needs with PROT_NONE. We do this because all segments
must have a fixed relationship with one another, so we have
mmap bring us the first unused contiguous region that's large
enough.
We then goes back and remap the actual Phdr entries with proper
permissions and MAP_FIXED. If, for the reason mentioned above,
the linker has "overaligned" the data segment, then there may be
unused space between the text and data segment.
We could of course unmap that region, but there's not really
any point. On no system that I am aware of will it be larger
than 16 pages, which means that the PMD is already in use,
which means that we're not really consuming any extra page
table resources.
The lack of foresight in not defining a large maximum architectural
page size for x86 is actually hurting ia64 folks who want to do
emulation. Ideally they'd like to have a 16K system page size,
but all the x86 binaries are linked expecting a 4K page size.
Which can be worked around with effort, but it shouldn't have
been necessary.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: /proc/<pid>/maps
@ 2000-03-18 1:50 cpg
2000-03-18 2:05 ` /proc/<pid>/maps Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: cpg @ 2000-03-18 1:50 UTC (permalink / raw)
To: axp-list
Richard, thanks for the explanation.
On 03/18/2000 01:08:51 AM GMT Richard Henderson wrote:
>
>We could of course unmap that region, but there's not really
>any point. On no system that I am aware of will it be larger
So an access to this region is an apllication error?
I have such an error, but "x/b" of the address in gdb gave
me a 0 instead of a "cannot access memory" error,
I was confused ... :-)
>than 16 pages, which means that the PMD is already in use,
>which means that we're not really consuming any extra page
>table resources.
This is an example from over here (linux 2.2.14, glibc-2.0.7):
0000020000110000-00000200001f8000 r-xp 0000000000000000 08:07 10332
/usr/X11R6/lib/libX11.so.6.1
00000200001f8000-00000200002f0000 ---p 00000000000e8000 08:07 10332
/usr/X11R6/lib/libX11.so.6.1
00000200002f0000-0000020000302000 rwxp 00000000000e0000 08:07 10332
/usr/X11R6/lib/libX11.so.6.1
The size of the "---p" section is almost 1MB. Am I
calculating s/th wrong?
regards,
chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: /proc/<pid>/maps
2000-03-18 1:50 /proc/<pid>/maps cpg
@ 2000-03-18 2:05 ` Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2000-03-18 2:05 UTC (permalink / raw)
To: axp-list
On Sat, Mar 18, 2000 at 02:50:44AM +0100, cpg@aladdin.de wrote:
> So an access to this region is an apllication error?
Very much so.
> This is an example from over here (linux 2.2.14, glibc-2.0.7):
[...]
> The size of the "---p" section is almost 1MB. Am I
> calculating s/th wrong?
No, there was a typo in ld once upon a time. Instead of
a 64k max page size (0x10000), I had 1MB (0x100000).
No harm done, really, but it has been fixed since.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-03-18 2:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-17 23:48 /proc/<pid>/maps cpg
2000-03-18 1:08 ` /proc/<pid>/maps Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
2000-03-18 1:50 /proc/<pid>/maps cpg
2000-03-18 2:05 ` /proc/<pid>/maps Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox