From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 72031384385C; Thu, 30 Jun 2022 11:56:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72031384385C From: "fweimer at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug network/29305] New: Inefficient buffer space usage in nss_dns for gethostbyname and other functions Date: Thu, 30 Jun 2022 11:56:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: network X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: fweimer at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 11:56:51 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29305 Bug ID: 29305 Summary: Inefficient buffer space usage in nss_dns for gethostbyname and other functions Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: network Assignee: unassigned at sourceware dot org Reporter: fweimer at redhat dot com Target Milestone: --- A typical response buffer looks like this: 00000000: e71b 0b01 0000 0000 141c 0b01 0000 0000 ................ 00000010: 671c 0b01 0000 0000 0000 0000 0000 0000 g............... 00000020: 3a3a 3100 2020 2020 2020 2020 6c6f 6361 ::1. loca 00000030: 6c68 6f73 7400 6c6f 6361 6c68 6f73 742e lhost.localhost. 00000040: 6c6f 6361 6c64 6f6d 6169 6e00 6c6f 6361 localdomain.loca 00000050: 6c68 6f73 7436 006c 6f63 616c 686f 7374 lhost6.localhost 00000060: 362e 6c6f 6361 6c64 6f6d 6169 6e36 0000 6.localdomain6.. 00000070: 561a 0b01 0000 0000 6c1a 0b01 0000 0000 V.......l....... 00000080: 771a 0b01 0000 0000 0000 0000 0000 0000 w............... 00000090: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000000a0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000000b0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000000c0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000000d0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000000e0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000000f0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000100: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000110: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000120: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000130: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000140: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000150: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000160: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000170: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000180: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 00000190: d01c 0b01 0000 0000 0000 0000 0000 0000 ................ 000001a0: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX 000001b0: 5858 5858 5858 5858 7777 772e 7265 6468 XXXXXXXXwww.redh 000001c0: 6174 2e63 6f6d 0077 7777 2e72 6564 6861 at.com.www.redha 000001d0: 742e 636f 6d00 6473 2d77 7777 2e72 6564 t.com.ds-www.red 000001e0: 6861 742e 636f 6d2e 6564 6765 6b65 792e hat.com.edgekey. 000001f0: 6e65 7400 6473 2d77 7777 2e72 6564 6861 net.ds-www.redha 00000200: 742e 636f 6d2e 6564 6765 6b65 792e 6e65 t.com.edgekey.ne 00000210: 7400 6473 2d77 7777 2e72 6564 6861 742e t.ds-www.redhat. 00000220: 636f 6d2e 6564 6765 6b65 792e 6e65 742e com.edgekey.net. 00000230: 676c 6f62 616c 7265 6469 722e 616b 6164 globalredir.akad 00000240: 6e73 2e6e 6574 0064 732d 7777 772e 7265 ns.net.ds-www.re 00000250: 6468 6174 2e63 6f6d 2e65 6467 656b 6579 dhat.com.edgekey 00000260: 2e6e 6574 2e67 6c6f 6261 6c72 6564 6972 .net.globalredir 00000270: 2e61 6b61 646e 732e 6e65 7400 6533 3339 .akadns.net.e339 00000280: 362e 6473 6378 2e61 6b61 6d61 6965 6467 6.dscx.akamaiedg 00000290: 652e 6e65 7400 6533 3339 362e 6473 6378 e.net.e3396.dscx 000002a0: 2e61 6b61 6d61 6965 6467 652e 6e65 7400 .akamaiedge.net. 000002b0: 1700 57ba ..W. This roughly corresponds to the following DNS packet: ; <<>> DiG 9.16.29-RH <<>> www.redhat.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35698 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1220 ; COOKIE: 278a93776c2c45bbf190f68462bd8e694ae55e8c652b2a09 (good) ;; QUESTION SECTION: ;www.redhat.com. IN A ;; ANSWER SECTION: www.redhat.com. 300 IN CNAME ds-www.redhat.com.edgekey.n= et. ds-www.redhat.com.edgekey.net. 15029 IN CNAME=20=20 ds-www.redhat.com.edgekey.net.globalredir.akadns.net. ds-www.redhat.com.edgekey.net.globalredir.akadns.net. 628 IN CNAME e3396.dscx.akamaiedge.net. e3396.dscx.akamaiedge.net. 14 IN A 23.0.87.186 ;; Query time: 26 msec ;; MSG SIZE rcvd: 229 There are a bunch of gaps that are never written (the /etc/hosts contents before the XXX and the XXX themselves). And the names of CNAME aliases are stored twice. If gethostbyname_r starts out with a small buffer, this results in pointless extra DNS queries. --=20 You are receiving this mail because: You are on the CC list for the bug.=