Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 432020 - <sys-libs/glibc-2.21: /var/db/services.db causes infinite loop in getaddrinfo()
Summary: <sys-libs/glibc-2.21: /var/db/services.db causes infinite loop in getaddrinfo()
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
Depends on:
Reported: 2012-08-20 03:11 UTC by Maxim Kammerer
Modified: 2016-03-30 19:54 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---

/var/db/services.db (services.db,111.78 KB, application/octet-stream)
2012-08-20 03:13 UTC, Maxim Kammerer
getaddrinfo.c example (getaddrinfo.c,1.06 KB, text/plain)
2012-08-20 03:16 UTC, Maxim Kammerer
emerge --info (emerge-info,5.36 KB, text/plain)
2012-08-20 03:21 UTC, Maxim Kammerer

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Kammerer 2012-08-20 03:11:39 UTC
glibc 2.15 provides /var/db/Makefile, which creates various databases for plaintext files using makedb:

  make -C /var/db

If /var/db/services.db is created, service name lookup using getaddrinfo() (but not getservbyname()) results in an infinite loop (full CPU load and no system calls).

This happens, e.g., if iptables is supplied named --sport / --dport parameters. An example program (to be attached) uses relevant code from iptables-1.4.13.
Comment 1 Maxim Kammerer 2012-08-20 03:13:51 UTC
Created attachment 321734 [details]
Comment 2 Maxim Kammerer 2012-08-20 03:16:10 UTC
Created attachment 321736 [details]
getaddrinfo.c example

# ./getaddrinfo
getservbyname: 67
Comment 3 Maxim Kammerer 2012-08-20 03:21:28 UTC
Created attachment 321738 [details]
emerge --info

This is a hardened system, but the problem appears both under hardened and regular kernel (in a chroot).
Comment 4 SpanKY gentoo-dev 2012-08-20 03:28:03 UTC
nice test case -- doesn't really need iptables setup.  i've moved this upstream.
Comment 5 SpanKY gentoo-dev 2016-03-30 19:54:58 UTC
glibc-2.21+ should be fixed, and that's stable now, so closing out