Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Created attachment 1942561[details]
Sample getaddrinfo() program
Created attachment 1942561[details]
Sample getaddrinfo() program
Description of problem:
getaddrinfo() crashes in case the system has no IPv6 (disabled via sysctl calls), and the hints have ai_family=AF_INET6;
Version-Release number of selected component (if applicable):
glibc-2.34-58.el9.x86_64
systemd-252-3.el9.x86_64
How reproducible:
Every time
Steps to Reproduce:
1. build the attached getaddressinfo-test.c
2. disable IPv6 on the system:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
2. run it specifying the hostname of the system, e.g. ./getaddressinfo-test `hostname`
Actual results:
The sample getaddressinfo-test exits with segmentation fault.
Expected results:
getaddressinfo-test runs fine, and either
- exits with a "getaddrinfo: " error line (expected, since IPv6 is not available)
- return something (?)
Additional info:
Attached also the /etc/nsswitch.conf of the system.
I can reproduce it in Beaker, on a machine where nss_dns does not succeed for its host name, but _nss_myhostname_gethostbyname2_r does:
Run till exit from #0 _nss_myhostname_gethostbyname2_r (
name=name@entry=0x7fffffffe201 "<redacted>",
af=af@entry=10, host=host@entry=0x7fffffffd630, buffer=0x7fffffffd920 "",
buflen=1024, errnop=errnop@entry=0x7ffff7fb56c0, h_errnop=0x7ffff7fb5724)
at ../src/nss-myhostname/nss-myhostname.c:520
0x00007ffff7d36d8d in gaih_inet (name=<optimized out>,
name@entry=0x7fffffffe201 "<redacted>",
service=service@entry=0x0, req=req@entry=0x7fffffffdd90,
pai=pai@entry=0x7fffffffd818, naddrs=naddrs@entry=0x7fffffffd814,
tmpbuf=tmpbuf@entry=0x7fffffffd910) at ../sysdeps/posix/getaddrinfo.c:832
832 gethosts (AF_INET6, struct in6_addr);
Value returned is $5 = NSS_STATUS_SUCCESS
Looking at the result in convert_hostent_to_gaih_addrtuple (the macro goo makes that a bit difficult to debug), I get:
convert_hostent_to_gaih_addrtuple (req=req@entry=0x7fffffffdd90,
family=family@entry=10, h=h@entry=0x7fffffffd630,
result=result@entry=0x7fffffffd618) at ../sysdeps/posix/getaddrinfo.c:201
(gdb) print *h
$13 = {h_name = 0x7fffffffd920 "<redacted>",
h_aliases = 0x7fffffffd958, h_addrtype = 10, h_length = 16,
h_addr_list = 0x7fffffffd968}
(gdb) print h->h_addr_list
$14 = (char **) 0x7fffffffd968
(gdb) print h->h_addr_list[0]
$15 = 0x0
So nss_myhostname returns NSS_STATUS_SUCCESS, but no data. The more usual return value for this is NSS_STATUS_TRYAGAIN, telling glibc NSS to continue processing with the next service module. I am not sure if the current protocol actually offers an authoritative NODATA response.
Assuming this analysis is correct, this is more of a systemd bug than a glibc bug.
If you get a machine out of Beaker that has an IPv6 address, you can trigger this bug via:
hostnamectl hostname mycomputer
And then use “mycomputer” with the reproducer.
I cannot reproduce the issue with:
systemd-250-12.el9_1.2.x86_64
systemd-libs-250-12.el9_1.2.x86_64
systemd-pam-250-12.el9_1.2.x86_64
systemd-rpm-macros-250-12.el9_1.2.noarch
systemd-udev-250-12.el9_1.2.x86_64
I can reproduce the issue with:
systemd-252-4.el9.x86_64
systemd-libs-252-4.el9.x86_64
systemd-pam-252-4.el9.x86_64
systemd-rpm-macros-252-4.el9.noarch
systemd-udev-252-4.el9.x86_64
I suspect it is a side effect of:
commit db50d326a46beca3cc24b6354b6e1b3591902d45
Author: Yu Watanabe <watanabe.yu+github>
Date: Fri Apr 22 10:31:22 2022 +0900
nss-myhostname: do not return IPv6 local address if IPv6 is disabled
This came with the systemd-252 rebase.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2023:2531