|
Message-ID: <20180126142137.GH4418@port70.net> Date: Fri, 26 Jan 2018 15:21:37 +0100 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: BUG: $ORIGIN does not seem to work * Stefan Fröberg <stefan.froberg@...roprogram.com> [2018-01-26 15:39:23 +0200]: > On glibc the following: > > gcc -o x -Wl,-rpath='$ORIGIN/lib' x.c -L ./lib -lcrypto > > or > > gcc -o x -Wl,-rpath,'$ORIGIN/lib' x.c -L ./lib -lcrypto > > Gives me binary with relative library path > > ldd x > linux-vdso.so.1 (0x00007ffcb6bee000) > * libcrypto.so.1.0.0 => /home/wizard/kal-el/lib/libcrypto.so.1.0.0 > (0x00007f0bc3593000)** > * libc.so.6 => /lib64/libc.so.6 (0x00007f0bc31e2000) > libdl.so.2 => /lib64/libdl.so.2 (0x00007f0bc2fde000) > libz.so.1 => /lib64/libz.so.1 (0x00007f0bc2dc7000) > /lib64/ld-linux-x86-64.so.2 (0x00007f0bc39d2000) > > cp -rap kal-el/* batman/ > ldd x > linux-vdso.so.1 (0x00007ffdbf0b6000) > * libcrypto.so.1.0.0 => /home/wizard/batman/lib/libcrypto.so.1.0.0 > (0x00007fb682149000)** > * libc.so.6 => /lib64/libc.so.6 (0x00007fb681d98000) > libdl.so.2 => /lib64/libdl.so.2 (0x00007fb681b94000) > libz.so.1 => /lib64/libz.so.1 (0x00007fb68197d000) > /lib64/ld-linux-x86-64.so.2 (0x00007fb682588000) > > > But trying the same with musl does not seem to work? > ldd x > /lib/ld-musl-x86_64.so.1 (0x7f07372e2000) > libc.so => /lib/ld-musl-x86_64.so.1 (0x7f07372e2000) > > and if i remove the -L ./lib from the command it uses system library > gcc -o x -Wl,-rpath,'$ORIGIN/lib' x.c -lcrypto > ldd xx > /lib/ld-musl-x86_64.so.1 (0x7fdd8618d000) > libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x7fdd85ed7000) > libc.so => /lib/ld-musl-x86_64.so.1 (0x7fdd8618d000) > > $ORIGIN in rpath works fine in musl you are doing something wrong but it's hard to tell what: your ldd command is looking at the wrong binary, we don't know what ldd you are using (e.g. use ld-*-musl.so.1 --list foo to make this explicit), it's not clear if the binary has $ORIGIN set up correctly since you showed a gcc command line instead of readelf -d of the generated executable, we don't know what paths have the library and what paths the ldso tried (you can check this by strace). (there are some differences between musl and glibc: e.g. glibc expands $ORIGIN in dlopen too while musl does not, however in your case musl should work)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.