!LemuOOvbWqRXodtSsw:nixos.org

NixOS Reproducible Builds

539 Members
Report: https://reproducible.nixos.org Project progress: https://github.com/orgs/NixOS/projects/30125 Servers

Load older messages


SenderMessageTime
5 Sep 2021
@baloo_:matrix.orgbaloorunning the same strace here, and it looks like you're correct, it does not execve curl19:59:10
@baloo_:matrix.orgbaloobut ... I still see:19:59:16
@baloo_:matrix.orgbaloo
[pid 137791] openat(AT_FDCWD, "/nix/store/9bh3986bpragfjmr32gay8p95k91q4gy-glibc-2.33-47/lib/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 10
19:59:23
@baloo_:matrix.orgbaloothat works fine ...19:59:28
@baloo_:matrix.orgbaloohuuum19:59:41
@baloo_:matrix.orgbaloo could you share the output of mount? 19:59:52
@baloo_:matrix.orgbaloo is /nix/store in the same filesystem than /? 20:00:11
@zhaofeng:zhaofeng.liZhaofeng LiNo, different filesystem20:00:35
@baloo_:matrix.orgbalooha!20:00:47
@tomberek:matrix.orgtomberekwould using nixUstable to run the build help?20:00:55
@zhaofeng:zhaofeng.liZhaofeng Li@tomberek I'm using nixUnstable20:01:11
@baloo_:matrix.orgbaloo tomberek: https://github.com/NixOS/nix/issues/5089#issuecomment-905193921 tried both in a nix tests here 20:01:27
@baloo_:matrix.orgbalooboth were working fine20:01:35
@baloo_:matrix.orgbaloobut the filesystem of /nix/store being different than /, that could be a mount namespace issue20:02:13
@zhaofeng:zhaofeng.liZhaofeng Li Ok, I looked at the logs a bit closer, and it looks like the NSS loading hack didn't really work. getaddrinfo doesn't seem to load libnss_dns 20:04:58
@zhaofeng:zhaofeng.liZhaofeng LiIt opens a socket to nscd and doesn't load libnss_dns at all.20:05:32
@rick:matrix.ciphernetics.nlRick (Mindavi)I'm also using different filesystems for / and for /nix/store20:05:48
@zhaofeng:zhaofeng.liZhaofeng LiSo when the builder runs it's already sandboxed and won't be able to load in the library20:05:55
@zhaofeng:zhaofeng.liZhaofeng Li * So when the builder calls libcurl it's already sandboxed and won't be able to load in the library20:06:23
@baloo_:matrix.orgbalooyup, that would make sense.20:06:27
@baloo_:matrix.orgbaloo
[pid 137783] socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 12
[pid 137783] connect(12, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0
[pid 137783] sendto(12, "\2\0\0\0\16\0\0\0000\0\0\0this.pre-initializes.the.dns.resolvers.invalid.\0", 60, MSG_NOSIGNAL, NULL, 0) = 60
[pid 137783] poll([{fd=12, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=12, revents=POLLIN}])
[pid 137783] read(12, "\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
[pid 137783] close(12)                  = 0

here (where it works), and similar on your log

20:08:35
@zhaofeng:zhaofeng.liZhaofeng LiI think it's actually a bug that it worked with / and /nix/store in the same filesystem. It shouldn't have worked with the sandbox.20:09:57
@baloo_:matrix.orgbaloo
In reply to @zhaofeng:zhaofeng.li
I think it's actually a bug that it worked with / and /nix/store in the same filesystem. It shouldn't have worked with the sandbox.
I think so too.
20:10:13
@zhaofeng:zhaofeng.liZhaofeng LiSo it seems we need a better hack to pull in libnss20:10:16
@baloo_:matrix.orgbalooI have to run, but I'll have a look at it a bit later20:10:42
@baloo_:matrix.orgbaloothank you so much for the log!20:10:51
6 Sep 2021
@baloo_:matrix.orgbalooI think I found an ... ugly fix22:59:46
@baloo_:matrix.orgbaloo
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stddef.h>

void preloadNSS() {
        struct addrinfo *res = NULL;

        char * previous_env = getenv("LOCALDOMAIN");
        setenv("LOCALDOMAIN", "invalid", 1);
        if (getaddrinfo("this.pre-initializes.the.dns.resolvers.invalid.", "http", NULL, &res) != 0) {
            if (res) freeaddrinfo(res);
        }
        if (previous_env)
             setenv("LOCALDOMAIN", previous_env, 1);
        else
             unsetenv("LOCALDOMAIN");
}

int main() {
    preloadNSS();
}

This forces nss to make a dns lookup, and to load the nss_dns.so

23:03:27
@baloo_:matrix.orgbaloo(ugly because, I need to change the environment, so there is a slight delay during which it gets modified)23:04:36
@baloo_:matrix.orgbalooanyone willing to try a proper patch? :D23:06:13

Show newer messages


Back to Room ListRoom Version: 6