process page map

Mark Einon mark.einon at gmail.com
Wed Apr 9 04:27:34 EDT 2014


On Sat Apr 5 17:33:23 EDT 2014, gary kong wrote:
> I am looking at the /proc/self/maps file. i find that for every shared
> library there are 4 sections with different permission. what are the
> reasons for this ? does that mean the same library is loaded 4 times ?
> e.g.
>
>
> 7fb543e5d000-7fb54401a000 r-xp 00000000 08:01 6033115
>   /lib/x86_64-linux-gnu/libc-2.17.so
> 7fb54401a000-7fb54421a000 ---p 001bd000 08:01 6033115
>   /lib/x86_64-linux-gnu/libc-2.17.so
> 7fb54421a000-7fb54421e000 r--p 001bd000 08:01 6033115
>   /lib/x86_64-linux-gnu/libc-2.17.so
> 7fb54421e000-7fb544220000 rw-p 001c1000 08:01 6033115
>   /lib/x86_64-linux-gnu/libc-2.17.so
> 7fb544220000-7fb544225000 rw-p 00000000 00:00 0
> 7fb544225000-7fb54423a000 r-xp 00000000 08:01 6029447
>   /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7fb54423a000-7fb544439000 ---p 00015000 08:01 6029447
>   /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7fb544439000-7fb54443a000 r--p 00014000 08:01 6029447
>   /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7fb54443a000-7fb54443b000 rw-p 00015000 08:01 6029447
>   /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7fb54443b000-7fb54453e000 r-xp 00000000 08:01 6032973
>   /lib/x86_64-linux-gnu/libm-2.17.so
> 7fb54453e000-7fb54473d000 ---p 00103000 08:01 6032973
>   /lib/x86_64-linux-gnu/libm-2.17.so
> 7fb54473d000-7fb54473e000 r--p 00102000 08:01 6032973
>   /lib/x86_64-linux-gnu/libm-2.17.so
> 7fb54473e000-7fb54473f000 rw-p 00103000 08:01 6032973
>   /lib/x86_64-linux-gnu/libm-2.17.so
>
> Gary

Hi Gary,

My details below may be a bit sketchy but it means that each library is made up
of four parts -

* The read ony executable part (r-xp) is the text section, containing the
executable code.
* The no permissions (---p) part is (probably...?) kernel specific (something to
do with faster syscalls?).
* The read only non-executable part (r--p) is the data segment for static, read
only data and the bss.
* The read write part (rw-p) is for dynamic data that the library uses.

The 'pmap' command gives this info in a slightly easier to read way.

Hope that helps,

Mark



More information about the Kernelnewbies mailing list