[uClibc] /proc/self/maps

Matthieu it matthieu.it at gmail.com
Tue May 3 15:45:28 UTC 2005


Hello, 

I have gone on my investigations on this point, and it seems every
thing is done in readelflib1.c, where I can find :

   flags = MAP_PRIVATE /*| MAP_DENYWRITE */ ;
    if (!piclib)
        flags |= MAP_FIXED;

    status = (char *) _dl_mmap((char *) (piclib ? 0 : minvma), 
        maxvma - minvma, PROT_NONE, flags | MAP_ANONYMOUS, -1, 0); 
    if (_dl_mmap_check_error(status)) {
        _dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname);
        _dl_internal_error_number = LD_ERROR_MMAP_FAILED;
        _dl_close(infile);
        return NULL;
    };
    libaddr = (unsigned long) status; 
    flags |= MAP_FIXED;


This part of sources is quite uneasy to understand though, and I
wonder what handle the different segments, especially why some ---p
segment are present.
In my PC (running glibc) I see : 

$ cat /proc/self/maps
08048000-0804a000 r-xp 00000000 03:06 191307     /bin/cat
0804a000-0804c000 rwxp 00001000 03:06 191307     /bin/cat
0804c000-0804e000 rwxp 0804c000 00:00 0 
40000000-40013000 r-xp 00000000 03:06 223177     /lib/ld-2.2.5.so
40013000-40014000 rwxp 00013000 03:06 223177     /lib/ld-2.2.5.so
40014000-40015000 r-xp 00000000 03:07 311891    
/usr/lib/locale/fr_FR/LC_IDENTIFICATION
40015000-40016000 r-xp 00000000 03:07 311890    
/usr/lib/locale/fr_FR/LC_MEASUREMENT
40016000-40017000 r-xp 00000000 03:07 311889    
/usr/lib/locale/fr_FR/LC_TELEPHONE
40017000-40018000 r-xp 00000000 03:07 311888    
/usr/lib/locale/fr_FR/LC_ADDRESS
40018000-40019000 r-xp 00000000 03:07 311887     /usr/lib/locale/fr_FR/LC_NAME
40019000-4001a000 r-xp 00000000 03:07 311886     /usr/lib/locale/fr_FR/LC_PAPER
4001a000-4001b000 r-xp 00000000 03:07 228039    
/usr/lib/locale/fr_FR/LC_MESSAGES/SYS_LC_MESSAGES
4001b000-4001c000 r-xp 00000000 03:07 311885    
/usr/lib/locale/fr_FR/LC_MONETARY
4001f000-40132000 r-xp 00000000 03:06 223181     /lib/libc-2.2.5.so
40132000-40138000 rwxp 00113000 03:06 223181     /lib/libc-2.2.5.so
40138000-4013c000 rwxp 40138000 00:00 0 
4013c000-40142000 r-xp 00000000 03:07 310878    
/usr/lib/locale/fr_FR/LC_COLLATE
40142000-40143000 r-xp 00000000 03:07 310827     /usr/lib/locale/fr_FR/LC_TIME
40143000-40144000 r-xp 00000000 03:07 310826    
/usr/lib/locale/fr_FR/LC_NUMERIC
40144000-40176000 r-xp 00000000 03:07 310126     /usr/lib/locale/fr_FR/LC_CTYPE

and I can understand each segment, but in my embedded device, the ---p
segments remains unclear for me.

Can anyone help ? 

Regards,

2005/4/26, Matthieu it <matthieu.it at gmail.com>:
> Hi,
> 
> 2005/4/26, Allan Clark <allanc at chickenandporn.com>:
> > Matthieu it wrote:
> >
> > >I wonder what the "---p" maps are. Do they count in the actual memory
> > >used by the process ?
> > >
> > It's a page-marking: (linux-2.6.8/fs/proc/task_mmu.c at 94)
> 
> > Seems to mean "!sharable" ie private.  Not completely sure, just
> > grepping for you.  Anyone feel to second the guess?
> >
> 
> Thank you for your reply. I see that ---p mean :
> not readable, not writable, not executable, private.
> What is the purpose of such segment ?
> Does it handle memory that is actually used by the process ( like rw-p
> segments ) or does it handle memory shared across processes (like
> shared libraries r-xp segments for example) ?
> 
> Regards,
> 
> --
> M.I.
>



More information about the uClibc mailing list