[Bug network/25425] New: Missing call to __resolv_context_put in getaddrinfo.c:gethosts
filip at sumologic dot com
sourceware-bugzilla@sourceware.org
Mon Jan 20 16:33:00 GMT 2020
https://sourceware.org/bugzilla/show_bug.cgi?id=25425
Bug ID: 25425
Summary: Missing call to __resolv_context_put in
getaddrinfo.c:gethosts
Product: glibc
Version: 2.27
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: network
Assignee: unassigned at sourceware dot org
Reporter: filip at sumologic dot com
Target Milestone: ---
In reference to mailing list discussion
https://sourceware.org/ml/libc-help/2020-01/msg00031.html
There is a missing call to __resolv_context_put here
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=f813d85aa39d80a9f23f95368854213ebd60b46b;hb=HEAD#l291
before the jump to free_and_return.
Details:
Looking at the function getaddrinfo.c:gaih_inet there is a call to
__resolv_context_get in
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=f813d85aa39d80a9f23f95368854213ebd60b46b;hb=HEAD#l746
It is then possible to arrive at the call site of gethosts macro without
calling __resolv_context_put
here:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=f813d85aa39d80a9f23f95368854213ebd60b46b;hb=HEAD#l849
or here:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=f813d85aa39d80a9f23f95368854213ebd60b46b;hb=HEAD#l861
Next, in gethosts, we have a lot of branches, but it's possible to arrive here
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=f813d85aa39d80a9f23f95368854213ebd60b46b;hb=HEAD#l291
where the code jumps to free_and_return, without calling __resolv_context_put
as in other branches.
Finally, free_and_return does not call __resolv_context_put either:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=f813d85aa39d80a9f23f95368854213ebd60b46b;hb=HEAD#l1116
In certain scenarios (I don't know what they are as I don't understand the code
well enough) we can call __resolv_context_get without matching
__resolv_context_put and never free the underlying context.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list