为什么程序的虚拟地址范围不可读,可写或可执行?

时间:2016-03-29 02:20:20

标签: c linux memory-management process vmmap

当我通过查看/proc/bash_pid/maps来探索bash程序使用的虚拟内存地址范围时,我发现某些虚拟地址范围不可读,可写或可执行。例如,

7f1337130000-7f133732f000 ---p 00017000 08:05 9179011                    /lib/x86_64-linux-gnu/libnsl-2.15.so

我的问题是:

如果此类虚拟地址不可读,可写或可执行,为什么程序需要它?

虽然它显示该地址区域链接到某个共享库,但在我看来,这些地址区域根本不适用于该程序。

以下是/ proc / pid / maps

的完整输出
/proc/4139# cat maps 
00400000-004e0000 r-xp 00000000 08:05 9437188                            /bin/bash
006e0000-006e1000 r--p 000e0000 08:05 9437188                            /bin/bash
006e1000-006ea000 rw-p 000e1000 08:05 9437188                            /bin/bash
006ea000-006f0000 rw-p 00000000 00:00 0 
02239000-02640000 rw-p 00000000 00:00 0                                  [heap]
7f1336d00000-7f1336d0c000 r-xp 00000000 08:05 9175165                    /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f1336d0c000-7f1336f0b000 ---p 0000c000 08:05 9175165                    /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f1336f0b000-7f1336f0c000 r--p 0000b000 08:05 9175165                    /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f1336f0c000-7f1336f0d000 rw-p 0000c000 08:05 9175165                    /lib/x86_64-linux-gnu/libnss_files-2.15.so
7f1336f0d000-7f1336f17000 r-xp 00000000 08:05 9178732                    /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f1336f17000-7f1337117000 ---p 0000a000 08:05 9178732                    /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f1337117000-7f1337118000 r--p 0000a000 08:05 9178732                    /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f1337118000-7f1337119000 rw-p 0000b000 08:05 9178732                    /lib/x86_64-linux-gnu/libnss_nis-2.15.so
7f1337119000-7f1337130000 r-xp 00000000 08:05 9179011                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7f1337130000-7f133732f000 ---p 00017000 08:05 9179011                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7f133732f000-7f1337330000 r--p 00016000 08:05 9179011                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7f1337330000-7f1337331000 rw-p 00017000 08:05 9179011                    /lib/x86_64-linux-gnu/libnsl-2.15.so
7f1337331000-7f1337333000 rw-p 00000000 00:00 0 
7f1337333000-7f133733b000 r-xp 00000000 08:05 9175163                    /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f133733b000-7f133753a000 ---p 00008000 08:05 9175163                    /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f133753a000-7f133753b000 r--p 00007000 08:05 9175163                    /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f133753b000-7f133753c000 rw-p 00008000 08:05 9175163                    /lib/x86_64-linux-gnu/libnss_compat-2.15.so
7f133753c000-7f1337c1f000 r--p 00000000 08:05 2365762                    /usr/lib/locale/locale-archive
7f1337c1f000-7f1337dd4000 r-xp 00000000 08:05 9175161                    /lib/x86_64-linux-gnu/libc-2.15.so
7f1337dd4000-7f1337fd4000 ---p 001b5000 08:05 9175161                    /lib/x86_64-linux-gnu/libc-2.15.so
7f1337fd4000-7f1337fd8000 r--p 001b5000 08:05 9175161                    /lib/x86_64-linux-gnu/libc-2.15.so
7f1337fd8000-7f1337fda000 rw-p 001b9000 08:05 9175161                    /lib/x86_64-linux-gnu/libc-2.15.so
7f1337fda000-7f1337fdf000 rw-p 00000000 00:00 0 
7f1337fdf000-7f1337fe1000 r-xp 00000000 08:05 9179006                    /lib/x86_64-linux-gnu/libdl-2.15.so
7f1337fe1000-7f13381e1000 ---p 00002000 08:05 9179006                    /lib/x86_64-linux-gnu/libdl-2.15.so
7f13381e1000-7f13381e2000 r--p 00002000 08:05 9179006                    /lib/x86_64-linux-gnu/libdl-2.15.so
7f13381e2000-7f13381e3000 rw-p 00003000 08:05 9179006                    /lib/x86_64-linux-gnu/libdl-2.15.so
7f13381e3000-7f1338205000 r-xp 00000000 08:05 9178891                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1338205000-7f1338405000 ---p 00022000 08:05 9178891                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1338405000-7f1338409000 r--p 00022000 08:05 9178891                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1338409000-7f133840a000 rw-p 00026000 08:05 9178891                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f133840a000-7f133842c000 r-xp 00000000 08:05 9179003                    /lib/x86_64-linux-gnu/ld-2.15.so
7f133860f000-7f1338612000 rw-p 00000000 00:00 0 
7f1338623000-7f133862a000 r--s 00000000 08:05 2628031                    /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f133862a000-7f133862c000 rw-p 00000000 00:00 0 
7f133862c000-7f133862d000 r--p 00022000 08:05 9179003                    /lib/x86_64-linux-gnu/ld-2.15.so
7f133862d000-7f133862f000 rw-p 00023000 08:05 9179003                    /lib/x86_64-linux-gnu/ld-2.15.so
7fffdc8a0000-7fffdc8c1000 rw-p 00000000 00:00 0                          [stack]
7fffdc9c8000-7fffdc9ca000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

0 个答案:

没有答案