Calling getaddrinfo(3) in 32-bit binary on 64-bit host
Li-Wen Hsu
lwhsu at freebsd.org
Sun Jan 21 21:15:02 UTC 2018
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 at FreeBSD.org>
https://lwhsu.org
More information about the freebsd-hackers
mailing list