Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ldd shows varied addresses on x86 Linux

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)`
like image 498
tristan Avatar asked Feb 07 '10 14:02

tristan


1 Answers

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.

like image 150
Ignacio Vazquez-Abrams Avatar answered Oct 23 '22 05:10

Ignacio Vazquez-Abrams