public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present.
@ 2013-01-22 14:42 jiji.vinitha at gmail dot com
2013-01-22 14:43 ` [Bug network/15048] " jiji.vinitha at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jiji.vinitha at gmail dot com @ 2013-01-22 14:42 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15048
Bug #: 15048
Summary: getaddrinfo() leaks memory when /etc/nssswitch.conf is
not present.
Product: glibc
Version: 2.11
Status: NEW
Severity: normal
Priority: P2
Component: network
AssignedTo: unassigned@sourceware.org
ReportedBy: jiji.vinitha@gmail.com
Classification: Unclassified
Created attachment 6829
--> http://sourceware.org/bugzilla/attachment.cgi?id=6829
patch which fixes the leak
Hi,
Found in glibc-2.11.2 on arm-*-linux-gnueabi target.
The scenario:
When
* /etc/nsswitch.conf is not existing
* gethostbyname() has not been called
* dns server is reachable
* "localhost.localdomain" is not resisted to dns
In the above scenario, getaddrinfo("localhost.localdomain"); is leaking
memory.
The testcase to reproduce this issue
[nsstest.c]
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
struct addrinfo *res;
int cnt = 2500;
#if 0
if (gethostbyname("localhost.localdomain") == 0) {
}
#endif
for( i = 0; i < cnt; i++ ) {
if( getaddrinfo("localhost.localdomain", NULL, NULL, &res ) == 0 ){
freeaddrinfo(res);
}
write(1, ".", 1);
}
write(1, "done\n", 5);
while(1){sleep(62);}
return 0;
}
How to reproduce the leak
# strace -e open ./nsstest
...
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory) <- cause of leak
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
.open("/etc/nsswitch.conf", O_RDONLY) = -1 ENOENT (No such file or
directory)
...
RSS is increasing as shown below while executed the binary
# ./nsstest
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................^Z
[1]+ Stopped ./nsstest
# ps
PID TTY TIME CMD
167 pts/0 00:00:00 bash
284 pts/0 00:00:00 nsstest
285 pts/0 00:00:00 ps
# ps -p 284 u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 284 0.9 0.5 1960 668 pts/0 T 00:29 0:00 ./nsstest
# fg
./nsstest
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^Z
[1]+ Stopped ./nsstest
# ps -p 284 u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 284 1.3 0.6 2088 768 pts/0 T 00:29 0:00 ./nsstest
# fg
./nsstest
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^Z
[1]+ Stopped ./nsstest
# ps -p 284 u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 284 1.1 0.7 2216 912 pts/0 T 00:29 0:00 ./nsstest
#
The attached patch solved this issue in glibc-2.11.2.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug network/15048] getaddrinfo() leaks memory when /etc/nssswitch.conf is not present.
2013-01-22 14:42 [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present jiji.vinitha at gmail dot com
@ 2013-01-22 14:43 ` jiji.vinitha at gmail dot com
2013-04-15 12:25 ` siddhesh at redhat dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jiji.vinitha at gmail dot com @ 2013-01-22 14:43 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15048
Vinitha Vijayan <jiji.vinitha at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |arm-*-linux-gnueabi
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug network/15048] getaddrinfo() leaks memory when /etc/nssswitch.conf is not present.
2013-01-22 14:42 [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present jiji.vinitha at gmail dot com
2013-01-22 14:43 ` [Bug network/15048] " jiji.vinitha at gmail dot com
@ 2013-04-15 12:25 ` siddhesh at redhat dot com
2013-04-15 12:31 ` siddhesh at redhat dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-15 12:25 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15048
Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |siddhesh at redhat dot com
--- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-15 12:25:52 UTC ---
Thanks for the patch. Could you please post the patch (which looks OK to me)
on libc-alpha AT sourceware DOT org? It can then be reviewed and pushed into
git.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug network/15048] getaddrinfo() leaks memory when /etc/nssswitch.conf is not present.
2013-01-22 14:42 [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present jiji.vinitha at gmail dot com
2013-01-22 14:43 ` [Bug network/15048] " jiji.vinitha at gmail dot com
2013-04-15 12:25 ` siddhesh at redhat dot com
@ 2013-04-15 12:31 ` siddhesh at redhat dot com
2013-09-10 5:51 ` allan at archlinux dot org
2013-09-30 8:32 ` schwab@linux-m68k.org
4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-15 12:31 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15048
--- Comment #2 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-15 12:31:21 UTC ---
Please go through the following wiki document for guidelines for posting the
patch:
http://sourceware.org/glibc/wiki/Contribution%20checklist
The change is small enough that it shouldn't require any copyright assignment
papers, but if you intend to contribute code in the future then it might be a
good idea to get that paperwork out of the way.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug network/15048] getaddrinfo() leaks memory when /etc/nssswitch.conf is not present.
2013-01-22 14:42 [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present jiji.vinitha at gmail dot com
` (2 preceding siblings ...)
2013-04-15 12:31 ` siddhesh at redhat dot com
@ 2013-09-10 5:51 ` allan at archlinux dot org
2013-09-30 8:32 ` schwab@linux-m68k.org
4 siblings, 0 replies; 6+ messages in thread
From: allan at archlinux dot org @ 2013-09-10 5:51 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=15048
Allan McRae <allan at archlinux dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |allan at archlinux dot org
Assignee|unassigned at sourceware dot org |allan at archlinux dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug network/15048] getaddrinfo() leaks memory when /etc/nssswitch.conf is not present.
2013-01-22 14:42 [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present jiji.vinitha at gmail dot com
` (3 preceding siblings ...)
2013-09-10 5:51 ` allan at archlinux dot org
@ 2013-09-30 8:32 ` schwab@linux-m68k.org
4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2013-09-30 8:32 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15048
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |2.19
--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
Fixed with b217910.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-09-30 8:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-22 14:42 [Bug network/15048] New: getaddrinfo() leaks memory when /etc/nssswitch.conf is not present jiji.vinitha at gmail dot com
2013-01-22 14:43 ` [Bug network/15048] " jiji.vinitha at gmail dot com
2013-04-15 12:25 ` siddhesh at redhat dot com
2013-04-15 12:31 ` siddhesh at redhat dot com
2013-09-10 5:51 ` allan at archlinux dot org
2013-09-30 8:32 ` schwab@linux-m68k.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).