Comment 9 for bug 1869364

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Yes, and it doesn't matter whether you use the interpreter from the build directory or the default one (the binary has PF_INTERP set to /lib/ld-linux-aarch64.so.1 but the testsuite invokes it with the one from the build tree).

Some gdb time later, it transpires that this is systemd's fault :) (at least partially)

I'm a bit hazy on NSS in general, but valid uids present in /etc/passwd are (I assume) found by the "compat" nss module. Ones that are not found there are sent off to the libnss-systemd.so.

In there, _nss_systemd_getpwuid_r calls userdb_getpwuid which calls userdb_nss_compat_is_enabled which calls userdb_thread_sockaddr which calls getauxval(AT_RANDOM) which for some reason in this situation _fails_. userdb_thread_sockaddr then returns -EIO which leads to userdb_getpwuid setting errnop to EIO and returning NSS_STATUS_UNAVAIL which leads to _nss_systemd_getpwuid_r setting its errnop to EIO and that's what the test program sees as errno.

This leads me to this experiment:

ubuntu@juju-b11c42-ubuntu-24:~$ cat getauxval.c
#include <sys/auxv.h>
#include <stdio.h>

int main(int argc, char** argv) {
        printf("%lu\n", getauxval(AT_RANDOM));
}
ubuntu@juju-b11c42-ubuntu-24:~$ gcc -o getauxval getauxval.c
ubuntu@juju-b11c42-ubuntu-24:~$ ./getauxval
281474825715272
ubuntu@juju-b11c42-ubuntu-24:~$ /lib/ld-linux-aarch64.so.1 ./getauxval
0

which seems like a bug (it doesn't happen on amd64 or s390x).