Bug 1125975 - getaddrinfo is confused if NSS modules don't reset h_errno, even if they reset *h_errnop
Summary: getaddrinfo is confused if NSS modules don't reset h_errno, even if they rese...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Florian Weimer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-01 13:48 UTC by Lennart Poettering
Modified: 2017-09-05 10:44 UTC (History)
7 users (show)

Fixed In Version: glibc-2.26.90-14.fc28 glibc-2.26-7.fc27
Clone Of:
Environment:
Last Closed: 2017-09-05 10:44:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Lennart Poettering 2014-08-01 13:48:56 UTC
If h_errno is already set != 0 when the getaddrinfo3_r() entry point of an NSS module is called, and it does not explicitly reset it, then getaddrinfo() will always fail.

getaddrinfo3_r() has a a parameter "h_errnop" which is supposedly useful for propagating h_errno from an NSS module. However, as it appears it is also necessary for NSS modules to reset the real h_errno too, otherwise getaddrinfo() will get confused...

This becomes visible when an NSS module is invoked from "ping6"'s getaddrinfo(): in this case h_errno appears to be set 1 always before (no idea why though, probably something to debug, too). glibc's nss-dns now resets h_errno *and* *h_errnop to 0, and all is good. Any other NSS module, that doesn't reset h_errno to 0 however will not work (even if it does reset *h_errnop), as getaddrinfo checks that and then fails.

$ rpm -qa glibc
glibc-2.18-12.fc20.x86_64

Comment 1 Lennart Poettering 2014-08-01 13:50:59 UTC
Oh, sorry for the confusion, I meant the gethostbyname3_r() NSS module entry point. Of course, there's no getaddrinfo3_r() entry point.

Comment 2 Fedora End Of Life 2015-05-29 12:32:18 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Carlos O'Donell 2015-06-03 04:40:17 UTC
Still a problem we want to fix.

Comment 4 Jan Kurik 2015-07-15 14:38:50 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 5 Fedora End Of Life 2016-11-24 11:11:59 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2017-02-28 09:37:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 7 Florian Weimer 2017-09-05 10:44:48 UTC
This has been fixed upstream with this commit:

commit 53250a21b81474ef4e78090a4a9a63d8471e1091
Author: Florian Weimer <fweimer>
Date:   Fri Sep 1 08:57:07 2017 +0200

    getaddrinfo: Use &h_errno has the h_errno pointer
    
    This simplifies the code because it is not necessary to propagate the
    temporary h_errno value to the thread-local variable.  It also increases
    compatibility with NSS modules which update only one of the two places.

The other getaddrinfo changes, notably

commit a2881ef01450295782b065f2f850f340d5c12c14
Author: Florian Weimer <fweimer>
Date:   Fri Sep 1 08:57:52 2017 +0200

    getaddrinfo: In gaih_inet, use h_errno for certain status values only
    
    h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
    accurate at this point.

are relevant in this context, too.


Note You need to log in before you can comment on or make changes to this bug.