This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libresolv with getaddrinfo (With valid bug report?)


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/>

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]