Am Dienstag, 31. August 2021, 14:12:00 CEST schrieb Manvendra Bhangui:
I'm facing a strange problem with dlmopen() on Tumbleweed, FC34 and Ubuntu 21.04. The dlopen() functions work fine though. The problem doesn't happen on Leap 42.3 and all debian versions. The workaround is to set the LD_DEBUG environment variable. The other work around is to modify /etc/nsswitch.conf to not use only files. This issue was first reported on 24 Mar 2021 by someone. I too have reported multiple conditions under which the bug occurs and it still continues. This is an upstream issue but causing issues for multiple distributions downstream.
Interesting.
Any application that uses dlmopen() and calls any of the getpwent, getgrent, getaliasent, etc either segfault or give error on missing libnss symbols. It is trivial to simulate the issue. The below code snippets foo.c and test.c exploits the issue.
cat <<EOF>foo.c #include
#include void bar1() { struct passwd *pw; pw = getpwent(); if (pw) printf("%s\n", pw->pw_name); } EOF cat <<EOF>test.c #define _GNU_SOURCE #include #include int main(int argc, char **argv) { void *handle; int (*func) (); if (!(handle = dlmopen(LM_ID_NEWLM, "./libfoo.so", RTLD_NOW))) { perror("dlmopen"); return 1; } func = dlsym(handle, "bar1"); (*func)(); return 0; } EOF
# On Tumbleweed gcc -fPIC -shared foo.c -o libfoo.so gcc test.c -o test -ldl ./test ./test: symbol lookup error: /lib64/libnss_compat.so.2: undefined symbol: _nss_compat_endaliasent # setting LD_DEBUG=unused fixes the issue env LD_DEBUG=unused ./test root
Well, not here ~> LD_DEBUG=unused ./test ./test: error while loading shared libraries: libnss_nis.so.2: cannot open shared object file: No such file or directory neither as a user nor root, but I'm using sss on this system. Have you opened an issue on https://bugzilla.opensuse.org already? Cheers, Pete