Bug 25481 - getaddrinfo() doesn't resolve IPv4 localhost, when an unrelated IPv4 long line is present in the /etc/hosts
Summary: getaddrinfo() doesn't resolve IPv4 localhost, when an unrelated IPv4 long lin...
Status: RESOLVED DUPLICATE of bug 18991
Alias: None
Product: glibc
Classification: Unclassified
Component: network (show other bugs)
Version: 2.22
: P2 minor
Target Milestone: ---
Assignee: Florian Weimer
Depends on:
Reported: 2020-01-29 15:47 UTC by pavel.devecka
Modified: 2020-02-25 12:07 UTC (History)
1 user (show)

See Also:
Last reconfirmed: 2020-01-29 00:00:00
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description pavel.devecka 2020-01-29 15:47:10 UTC
•	getaddrinfo() is unable to resolve the IPv4 localhost hostname in situation, when an unrelated IPv4 line in /etc/hosts has 29 entries for an unrelated IP. (Example of such line is at the bottom of this bug report.)
•	When any 1 of the aliases is removed, this behavior disappears.
•	When "x" is put instead of the alias removed in the previous point, this behavior returns.
•	Above behavior has been observed with glibc-2.22-62.6.2.x86_64, glibc-2.22-62.13.2.x86_64 and glibc-2.22-100.15.4.x86_64.
•	Vendor (SUSE) refuses to continue to troubleshoot this, because according to them limits hit here "are well beyond the scope of a proper use case for /etc/hosts", which seems to be a reasonable argument.
---      xxxxxxxxxx12    xxxxxxxxxx12.3456.7890.xxx.xx.xxx       xxxxxxxxxx12.xx.xxxxxxxx.xxxxx  xxxxxxxxxx12.xxxx.xxxxxxxx.xxxxx xxx-xxxx-x12.xxxx.xxxxxxxx.xxxxx xxx-xxxx-x12.xxxxxxx.xxx xxx-xxx1-x23.xxxx.xxxxxxxx.xxxxx xxx-xxx1-x23.xxxxxxx.xxx xxx.xxxxxxx.xxx xxx-xxxx-x12.xxxx.xxxxxxxx.xxxxx xxxxx.xxxxxxx.xxx xxx-xxxx-x12.xxxx.xxxxxxxx.xxxxx xxx-xxxxxx-x12.xxxx.xxxxxxxx.xxxxx xxx-xx-x12.xxxx.xxxxxxxx.xxxxx xxx-xx-x12.xx.xxxxxxxx.xxxxx xxx-xxxxx-xx.xxxxxxx.xxx xxx-xxxxx-xx xxx-xxxxx-xx.xx.xxxxxxxx.xxxxx xxxxxx12.xxxxxxx.xxx xxxxxx_xxx xxxxxx_xxx.xxxxxxx.xxx xxxxxxxxx.xxxxxxx.xxx xxxxxxx.xxxxxxx.xxx  xxx-xxxxx-x12.xxxxxxxxxx.xxxxxxxx xxx-xxxxxx-x12.xx.xxxxxxxx.xxxxx xxx-xxxxxx-x12.xxxx.xxxxxxxx.xxxxx xxx-xxxxx-x12.xxxx.xxxxxxxx.xxxxx xxx-xxxxx-x12.xx.xxxxxxxx.xxxxx xxxxxxx.xxxxxxx.xxx
Comment 1 Florian Weimer 2020-01-29 16:30:25 UTC
I believe this is bug 18991. This was fixed in glibc 2.28. Can you test that glibc version (or the current master version) to see if this fixes the bug as well?
Comment 2 pavel.devecka 2020-02-25 12:05:32 UTC
Due to inability to test later glibc version in a prod environment I did below testing only. (getent ahostsv4 localhost)

OS version              glibc version       Issue observed      Note
openSUSE Leap 15.1      2.26-lp151.18.7     No                  live CD
Ubuntu 18.04.4 LTS      2.27-3ubuntu1       No                  installed desktop
Ubuntu 19.10            2.30-0ubuntu2       No                  live CD
Comment 3 Florian Weimer 2020-02-25 12:07:16 UTC
Thanks for the feedback, closing as a duplicate.

*** This bug has been marked as a duplicate of bug 18991 ***