libresolv with getaddrinfo (With valid bug report?)
Joshua Rogers
glibc@internot.info
Sat Mar 14 13:26:00 GMT 2015
On 14/03/15 22:32, Joshua Rogers wrote:
> I can see why this is the case:
>
> http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/resolv/res_data.c?rev=1.14&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
Aaand that repository is outdated.
I'm going to look at the latest Ubuntu libc which does indeed use
__res_maybe_init.
I found *A* problem, I think.
if ((ret == 0) && (last_mtime != statbuf.st_mtime)) {
(gdb) p statbuf
$3 = {st_dev = 16, st_ino = 16508, st_nlink = 1, st_mode = 33188, st_uid
= 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 172, st_blksize =
4096, st_blocks = 8, st_atim = {tv_sec = 1426334408, tv_nsec = 449405094},
st_mtim = {tv_sec = 1426334407, tv_nsec = 73405066}, st_ctim = {tv_sec
= 1426334407, tv_nsec = 73405066}, __glibc_reserved = {0, 0, 0}}
There is no statbuf.st_mtime. It's st.mtim.
(gdb) p statbuf.st_mtim.tv_sec
$7 = 1426334407
(gdb) p last_mtime
$8 = 1426334407
(gdb) p statbuf.st_mtime
No symbol "statbuf" in current context.
I also found *the *problem, as to why why res_init() doesn't work correctly:
in __res_maybe_init:
> static time_t last_mtime;
> struct stat statbuf;
> int ret;
>
> if (resp->options & RES_INIT) {
> ret = stat (_PATH_RESCONF, &statbuf);
> __libc_lock_lock (lock);
> if ((ret == 0) && (last_mtime !=
> statbuf.st_mtim.tv_sec)) {
> last_mtime = statbuf.st_mtime;
> atomicinc (__res_initstamp);
'last_mtime' is never set outside of the __res_maybe_init() function!
And when we manually run res_init();, it does not call
__res_maybe_init(), and therefor does not st last_mtime!
Should I send in a bug report for these two?
Thanks!
--
-- Joshua Rogers <https://internot.info/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-help/attachments/20150314/7acc1e79/attachment.sig>
More information about the Libc-help
mailing list