Broken link and leaking ld.so shared library in core16


#1

Hi all,

I’m new to snapcraft so please point me to the right resources if I’m missing something obvious.

As I was investigating a segfault in the project I’m currently working on, I noticed something weird about the environment created by snap:

$ ldd /snap/parsec/current/usr/bin/python3.6
	linux-vdso.so.1 (0x00007ffd7b90a000)
	libpthread.so.0 => /snap/parsec/current/usr/bin/../../lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb5b8b96000)
	libdl.so.2 => /snap/parsec/current/usr/bin/../../lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb5b8991000)
	libutil.so.1 => /snap/parsec/current/usr/bin/../../lib/x86_64-linux-gnu/libutil.so.1 (0x00007fb5b878d000)
	libexpat.so.1 => /snap/parsec/current/usr/bin/../../lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fb5b8563000)
	libz.so.1 => /snap/core/current/lib/x86_64-linux-gnu/libz.so.1 (0x00007fb5b8349000)
	libm.so.6 => /snap/parsec/current/usr/bin/../../lib/x86_64-linux-gnu/libm.so.6 (0x00007fb5b803e000)
	libc.so.6 => /snap/parsec/current/usr/bin/../../lib/x86_64-linux-gnu/libc.so.6 (0x00007fb5b7c73000)
	/snap/parsec/current/lib/x86_64-linux-gnu/ld-2.23.so => /lib64/ld-linux-x86-64.so.2 (0x00007fb5b8db5000)

and

% ldd /snap/parsec/current/lib/x86_64-linux-gnu/libc.so.6
        linux-vdso.so.1 (0x00007ffd5c3fd000)
	/snap/parsec/current/lib/x86_64-linux-gnu/ld-2.23.so => /lib64/ld-linux-x86-64.so.2 (0x00007fdd048df000)

The last line seems problematic, since /lib64/ld-linux-x86-64.so.2 points to /lib/x86_64-linux-gnu/ld-2.27.so on my system, which doesn’t correspond to the expected libc version (2.23).

I also noticed a broken link:

$ find /snap/parsec/ -name "*ld-*.so*" -exec ls -l {} + 
lrwxrwxrwx 1 root root     32 Jan 15  2018 /snap/parsec/38/lib64/ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.23.so
-rwxr-xr-x 1 root root 162632 Jan 15  2018 /snap/parsec/38/lib/x86_64-linux-gnu/ld-2.23.so
lrwxrwxrwx 1 root root     10 Jan 15  2018 /snap/parsec/38/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -> ld-2.23.so

See how /snap/parsec/38/lib64/ld-linux-x86-64.so.2 points to a file on my system that doesn’t exist (/lib/x86_64-linux-gnu/ld-2.23.so).

There’s already a similar issue on the forum (Can classic, “base: core18” snaps work across series?), but it’s about core18 and I seem to be using core16.

I can provide more information if necessary, thank you for your help.


#2

First, shell in to the environment your snap sees: snap run --shell parsec. Then, try that ldd again :slight_smile:


#3

This is a classic snap, so rpaths and links should be rewritten to point into the snap and shelling into the snap environment is irrelevant. In this case, for example, /snap/parsec/38/lib64/ld-linux-x86-64.so.2 is an absolute link out of the snap, not a relative one within the snap.

It is the same problem I encountered on core18 and the fix is essentially the same. (As is the hacky workaround I used until core18 was fixed.)


#4

First, shell in to the environment your snap sees: snap run --shell parsec. Then, try that ldd again

I get the same results :sweat_smile:


#5

Could you tell me more about this workaround? I’d like to see if this linkage issue is the cause of the segfault I’m investigating. Thanks :slight_smile: