ldd 在 x86 Linux 上显示不同的地址
我在 Fedora/x86 上使用 ldd 来显示动态库,每次使用时都会显示不同的结果。
这是预期的吗?或者有什么解释吗?
我记得它在 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)`
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)`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Fedora 使用地址空间随机化作为其各种安全措施的一部分。 ldd 的工作原理是实际加载共享对象并显示它们最终的位置。将两者放在一起就得到了给定的观察结果。
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.