当我使用时查看进程的内存映射
cat / proc / pid / maps
有这样的条目:
40321000-40336000 r-xp 00000000 b3:15 875 /system/lib/libm.so
40336000-40337000 r--p 00014000 b3:15 875 /system/lib/libm.so
40337000-40338000 rw-p 00015000 b3:15 875 /system/lib/libm.so
40338000-40345000 r-xp 00000000 b3:15 789 /system/lib/libcutils.so
40345000-40346000 r--p 0000c000 b3:15 789 /system/lib/libcutils.so
40346000-40347000 rw-p 0000d000 b3:15 789 /system/lib/libcutils.so
40347000-40355000 rw-p 00000000 00:00 0
40355000-403bc000 r-xp 00000000 b3:15 877 /system/lib/libmedia.so
403bc000-403bd000 ---p 00000000 00:00 0
403bd000-403d0000 r--p 00067000 b3:15 877 /system/lib/libmedia.so
403d0000-403d1000 rw-p 0007a000 b3:15 877 /system/lib/libmedia.so
403d1000-403d5000 rw-p 00000000 00:00 0
403d5000-403d8000 rw-p 00000000 00:00 0
我理解.so表示进程映射的共享库.似乎每个.so有3个条目,他们的权限是
R-XP
[R – P
RW-P
那么我该怎么解释呢?我可以假设r-xp是库的代码部分,因为它具有x(执行)权限吗? r-p和rw-p怎么样,它们是数据部分吗?
空条目怎么样?例如,关于libmedia的最后6个条目有三个空的entires(00:00 0).这些是什么?
403bc000-403bd000 ---p 00000000 00:00 0
403bd000-403d0000 r--p 00067000 b3:15 877 /system/lib/libmedia.so
403d0000-403d1000 rw-p 0007a000 b3:15 877 /system/lib/libmedia.so
403d1000-403d5000 rw-p 00000000 00:00 0
403d5000-403d8000 rw-p 00000000 00:00 0
Can I assume the r-xp is the code section of the library, since it has
the x (execute) permission?
是的,但这被称为文本段(存储指令).您还应该注意它没有写入权限,因为它没有.
How about the r–p and rw-p, are they the data sections?
是的,这些段存储静态/全局变量.然而,恒定的全局变量将被存储到r-p段中,因为它不应该被任何程序修改.
What about the empty entries? For example, the last 6 entries about
libmedia have three empty entires (00:00 0). What are these?
These might be the guard segment(kernel inserts these segments to protect the overflow scenario). The “p” indicates that its private.
编辑
有关完整信息,您可能需要参考以下链接:
http://Linux.die.net/man/5/proc