Date: Mon, 22 Jan 2018 05:14:59 +0800 From: Li-Wen Hsu <lwhsu@freebsd.org> To: freebsd-hackers@freebsd.org Subject: Calling getaddrinfo(3) in 32-bit binary on 64-bit host Message-ID: <CAKBkRUx14r%2B%2BZ-n64SNDd4uu=hoJv-KaXxeyUGM7f%2BDS2Ha%2BmQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi all, Recently I found a strange case: calling getaddrinfo(3) cannot resolve IPv6 address in 32-bit binary on 64-bit host. It happens on vanilla installed 11.1-R and also on r327788 snapshot build. For a program like this: https://gist.github.com/lwhsu/1288aa5be90b9e7da934a3e2bfc55aa3 It works fine when compiled as a 32-bit binary and run on a 32-bit host. As expected, It is also works fine when compiled as a 64-bit binary and run on a 64-bit host However, when taking the 32-bit binary and run on a 64 bit system (with /usr/lib32 installed), getaddrinfo(3) just returns: "Non-recoverable failure in name resolution" The ktrace/kdump outputs are as following: 64 on 64: https://gist.github.com/lwhsu/a89eb72b34a5ce59af075566c65db8ab 32 on 32: https://gist.github.com/lwhsu/c0b763695a44e5f3798276096d9379c0 32 on 64: https://gist.github.com/lwhsu/b2048789726f674681e7646603d2bd75 It seems that it even did not call socket(2). Any suggested way to debug this? I've tried to use gdb, set breaking point at err = getaddrinfo(host, service, &hints, &res); and did "step", but it went to next line in the file: if (err != 0) Instead of stepping into getaddrinfo.c as debugging on 32-bit or 64-bit systems. Best, Li-Wen -- Li-Wen Hsu <lwhsu@FreeBSD.org> https://lwhsu.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKBkRUx14r%2B%2BZ-n64SNDd4uu=hoJv-KaXxeyUGM7f%2BDS2Ha%2BmQ>