ldd shows varied addresses on x86 Linux

一曲冷凌霜 提交于 2019-12-21 09:13:09

问题


I am using ldd to show the dynamic library on Fedora/x86, and it shows different results each time it is used.

Is that expected? Or is there an explanation?

I remember it shows a fixed result on PPC/Linux.

`ldd /bin/ls
 linux-gate.so.1 =>  (0x00e5b000)
 librt.so.1 => /lib/librt.so.1 (0x00c0c000)
 libselinux.so.1 => /lib/libselinux.so.1 (0x0095d000)
 libcap.so.2 => /lib/libcap.so.2 (0x00110000)
 libacl.so.1 => /lib/libacl.so.1 (0x00331000)
 libc.so.6 => /lib/libc.so.6 (0x00115000)
 libpthread.so.0 => /lib/libpthread.so.0 (0x00bc9000)
 /lib/ld-linux.so.2 (0x009d2000)
 libdl.so.2 => /lib/libdl.so.2 (0x00680000)
 libattr.so.1 => /lib/libattr.so.1 (0x00447000)
ldd /bin/ls
 linux-gate.so.1 =>  (0x00f76000)
 librt.so.1 => /lib/librt.so.1 (0x00494000)
 libselinux.so.1 => /lib/libselinux.so.1 (0x0095d000)
 libcap.so.2 => /lib/libcap.so.2 (0x009e9000)
 libacl.so.1 => /lib/libacl.so.1 (0x00365000)
 libc.so.6 => /lib/libc.so.6 (0x00732000)
 libpthread.so.0 => /lib/libpthread.so.0 (0x00b61000)
 /lib/ld-linux.so.2 (0x002a7000)
 libdl.so.2 => /lib/libdl.so.2 (0x002f0000)
 libattr.so.1 => /lib/libattr.so.1 (0x00447000)`

回答1:


Fedora uses address space randomization as part of its various security measures. ldd works by actually loading the shared objects and showing where they end up. Putting the two together results in the given observations.



来源:https://stackoverflow.com/questions/2217023/ldd-shows-varied-addresses-on-x86-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!