From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 530 invoked by alias); 2 Jul 2012 02:22:04 -0000 Received: (qmail 517 invoked by uid 22791); 2 Jul 2012 02:22:03 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Jul 2012 02:21:48 +0000 From: "siddhesh at redhat dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug network/14307] getaddrinfo() sends superfluous DNS requests in x86_64 programs for certain hostnames Date: Mon, 02 Jul 2012 02:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: network X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: siddhesh at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00007.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14307 --- Comment #7 from Siddhesh Poyarekar 2012-07-02 02:21:46 UTC --- Here's a review of the patch. Please post the patch with modifications to the libc-alpha mailing list for further review and approval and use the following wiki link as a guideline for the submission: http://sourceware.org/glibc/wiki/Contribution%20checklist - size_t tmpbuflen = 512; + // MAX_NR_ALIASES=48 in resolv/nss_dns/dns-host.c + size_t host_data_size = 48 * sizeof(char*) + 16; Put MAX_NR_ALIASES one of the headers and use it here. + size_t tmpbuflen = 512; assert (tmpbuf == NULL); - tmpbuf = alloca_account (tmpbuflen, alloca_used); + tmpbuf = alloca_account (tmpbuflen+host_data_size, alloca_used); Adjust the tmpbuflen size instead of adding it separately here. int rc; struct hostent th; struct hostent *h; @@ -579,19 +581,19 @@ gaih_inet (const char *name, const struct gaih_service *service, while (1) { rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf, - tmpbuflen, &h, &herrno); + tmpbuflen+host_data_size, &h, &herrno); Likewise. if (rc != ERANGE || herrno != NETDB_INTERNAL) break; if (!malloc_tmpbuf - && __libc_use_alloca (alloca_used + 2 * tmpbuflen)) + && __libc_use_alloca (alloca_used + 2 * tmpbuflen + host_data_size)) Here too. tmpbuf = extend_alloca_account (tmpbuf, tmpbuflen, - 2 * tmpbuflen, + 2 * tmpbuflen+host_data_size, And here. alloca_used); else { char *newp = realloc (malloc_tmpbuf ? tmpbuf : NULL, - 2 * tmpbuflen); + 2 * tmpbuflen+host_data_size); Here as well. if (newp == NULL) { result = -EAI_MEMORY; > Also, I noticed that there is no limit imposed on the size of the temp buffer. > Not sure what the effect would be of receiving a UDP jumbogram over IPv6 in > response to a DNS query? The current implementation is broken for it, since it will keep blowing the buffer up exponentially till it can fit the entire jumbogram into the buffer and hope that the underlying memory supports it. This needs to be fixed in future. -- 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.