From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, PDS_RDNS_DYNAMIC_FP,RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 29F781F8C6 for ; Thu, 15 Jul 2021 05:23:33 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0BBF03AA7C9D for ; Thu, 15 Jul 2021 05:23:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BBF03AA7C9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626326612; bh=EzXUnV7GCjNXdKx45xmo62BXrUetLmpvyvaaeF4Q+/A=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lOoSiOQEHekvTkKURGwOUvSgrA6RxiRJ1Y3/rriiU6eOC1xp2+HOLUy07qb2PAgW7 df/edScOTioEq2xMWq3pK5MDmxw4K4VglQLcyLh00ougqXzHpK6y4eIzsyk6/LuRpo 2pDQNuvhztO3Ywca4JvD6YHQqpXUmRiDJoYLT5RA= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 1AAB939A28D6 for ; Thu, 15 Jul 2021 05:02:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1AAB939A28D6 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-142gGxW8PXydDAV2IkCSZw-1; Thu, 15 Jul 2021 01:02:43 -0400 X-MC-Unique: 142gGxW8PXydDAV2IkCSZw-1 Received: by mail-qk1-f200.google.com with SMTP id f203-20020a379cd40000b02903b861bec838so2895807qke.7 for ; Wed, 14 Jul 2021 22:02:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=EzXUnV7GCjNXdKx45xmo62BXrUetLmpvyvaaeF4Q+/A=; b=hZvsEAvZXB0phBXsHW2R4kBGvFSAe8mcdILSh2cx/GIIJaub2yP9s4pef4AVnqFGRN CTayzouwo0i9uhlPQUjCL/cNIGNiUllDpqNJNt/ip7/MeAfu9PqTBLGJ6swyOP8hJD6t S2LvUlcto+9aKnr7IVP9QalATivH3L9+0MlHQiYHTxWp5hZmTCGD9P07iIMINdf0ktMt TVorwyXYsCmrvAg2AWs0P2o4PcI7G96FPpAU4m+BijdOG85YN++SQrw5Cl7wCcc4SP0e kli5gFI9UkK9eSPsc+jO2QfxhYf4EV1U+APgvO6NDDWJAbCklVbtMGd3iPis6reaw7vp F/Qw== X-Gm-Message-State: AOAM532oPX2MMIB1Zrio1b+/p1s3bueYBw3P1Nws0XO7SM+3edgWNcN0 bQmxLpxK06wys+E5xPDVwfhR56YTnapJRDTm7fy32MRvcXgTNSGs4c6q3y9peWKlL71mJ5LdkAQ ucidjY5cOVHUrJhXSn7vkGNseBZO9masrLY/bAmD7Cl1b4cwecuLHPblMsVMtMLmY5+Z76w== X-Received: by 2002:a05:620a:1a01:: with SMTP id bk1mr1903482qkb.103.1626325363266; Wed, 14 Jul 2021 22:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCI9h4H52Ldi1T8er2Wxjyk1MAREDRXOjumAyZlLQL6tQGwpOjYFf2ggsj2YbVUstwIrkBLw== X-Received: by 2002:a05:620a:1a01:: with SMTP id bk1mr1903455qkb.103.1626325363003; Wed, 14 Jul 2021 22:02:43 -0700 (PDT) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id o186sm2115578qke.44.2021.07.14.22.02.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jul 2021 22:02:42 -0700 (PDT) Subject: Re: [PATCH 29/30] resolv: Move nss_dns into libc To: Florian Weimer , libc-alpha@sourceware.org References: <5701b67dde592d1f24c44d223f1bda50a9f21224.1625755446.git.fweimer@redhat.com> Organization: Red Hat Message-ID: <4a60e4d5-f69b-faac-09d2-03dcc93c0e7f@redhat.com> Date: Thu, 15 Jul 2021 01:02:41 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <5701b67dde592d1f24c44d223f1bda50a9f21224.1625755446.git.fweimer@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 7/8/21 11:07 AM, Florian Weimer via Libc-alpha wrote: > No abilist updates are needed because the symbols were GLIBC_PRIVATE. OK for glibc 2.34. Tested without regression on x86_64 and i686. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell > --- > include/nss_dns.h | 36 ++++++++++++++++++++++++++ > resolv/Makefile | 15 +++-------- > resolv/Versions | 21 ++++++++------- > resolv/nss_dns/dns-canon.c | 4 +-- > resolv/nss_dns/dns-host.c | 50 +++++++++++++++++------------------- > resolv/nss_dns/dns-network.c | 13 +++++----- > 6 files changed, 82 insertions(+), 57 deletions(-) > create mode 100644 include/nss_dns.h > > diff --git a/include/nss_dns.h b/include/nss_dns.h > new file mode 100644 > index 0000000000..63b5853870 > --- /dev/null > +++ b/include/nss_dns.h > @@ -0,0 +1,36 @@ > +/* Internal routines for nss_dns. OK. > + Copyright (C) 2021 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#ifndef _NSS_DNS_H > +#define _NSS_DNS_H > + > +#include > + > +NSS_DECLARE_MODULE_FUNCTIONS (dns) > + > +libc_hidden_proto (_nss_dns_getcanonname_r) > +libc_hidden_proto (_nss_dns_gethostbyname3_r) > +libc_hidden_proto (_nss_dns_gethostbyname2_r) > +libc_hidden_proto (_nss_dns_gethostbyname_r) > +libc_hidden_proto (_nss_dns_gethostbyname4_r) > +libc_hidden_proto (_nss_dns_gethostbyaddr2_r) > +libc_hidden_proto (_nss_dns_gethostbyaddr_r) > +libc_hidden_proto (_nss_dns_getnetbyname_r) > +libc_hidden_proto (_nss_dns_getnetbyaddr_r) OK. > + > +#endif > diff --git a/resolv/Makefile b/resolv/Makefile > index 4ba58dfa96..dd0a98c74f 100644 > --- a/resolv/Makefile > +++ b/resolv/Makefile > @@ -31,6 +31,9 @@ routines := \ > dn_comp \ > dn_expand \ > dn_skipname \ > + dns-canon \ > + dns-host \ > + dns-network \ OK. Pull into libc. > herror \ > inet_addr \ > inet_ntop \ > @@ -175,18 +178,6 @@ libanl-shared-only-routines += libanl-compat > subdir-dirs = nss_dns > vpath %.c nss_dns > > -libnss_dns-routines := \ > - dns-canon \ > - dns-host \ > - dns-network \ > - # libnss_dns-routines > - > -libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes)) > -ifeq ($(build-static-nss),yes) > -routines += $(libnss_dns-routines) $(libresolv-routines) > -static-only-routines += $(libnss_dns-routines) $(libresolv-routines) > -endif > - OK. Remove libnss_dns-routines. > ifeq ($(run-built-tests),yes) > ifneq (no,$(PERL)) > tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \ > diff --git a/resolv/Versions b/resolv/Versions > index f8b7700a1e..0e878d1421 100644 > --- a/resolv/Versions > +++ b/resolv/Versions > @@ -124,6 +124,15 @@ libc { > __resolv_context_get_preinit; > __resolv_context_put; > __resp; > + _nss_dns_getcanonname_r; > + _nss_dns_gethostbyaddr2_r; > + _nss_dns_gethostbyaddr_r; > + _nss_dns_gethostbyname2_r; > + _nss_dns_gethostbyname3_r; > + _nss_dns_gethostbyname4_r; > + _nss_dns_gethostbyname_r; > + _nss_dns_getnetbyaddr_r; > + _nss_dns_getnetbyname_r; OK. New functions. > } > } > > @@ -215,15 +224,9 @@ libresolv { > > libnss_dns { > GLIBC_PRIVATE { > - _nss_dns_getcanonname_r; > - _nss_dns_gethostbyaddr2_r; > - _nss_dns_gethostbyaddr_r; > - _nss_dns_gethostbyname2_r; > - _nss_dns_gethostbyname3_r; > - _nss_dns_gethostbyname4_r; > - _nss_dns_gethostbyname_r; > - _nss_dns_getnetbyaddr_r; > - _nss_dns_getnetbyname_r; OK. > + # Keep a version node (with a synthesized local: * directive) so that > + # __bss_* symbols are hidden on targets that need it. > + __libnss_dns_version_placeholder; OK. > } > } > > diff --git a/resolv/nss_dns/dns-canon.c b/resolv/nss_dns/dns-canon.c > index c5718ce3ab..c892170abd 100644 > --- a/resolv/nss_dns/dns-canon.c > +++ b/resolv/nss_dns/dns-canon.c > @@ -25,8 +25,7 @@ > #include > #include > #include > - > -NSS_DECLARE_MODULE_FUNCTIONS (dns) > +#include OK. Include nss_dns.h. > > #if PACKETSZ > 65536 > # define MAXPACKET PACKETSZ > @@ -185,3 +184,4 @@ _nss_dns_getcanonname_r (const char *name, char *buffer, size_t buflen, > __resolv_context_put (ctx); > return status; > } > +libc_hidden_def (_nss_dns_getcanonname_r) OK. > diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c > index d6a69a602a..7248ade18d 100644 > --- a/resolv/nss_dns/dns-host.c > +++ b/resolv/nss_dns/dns-host.c > @@ -82,6 +82,7 @@ > > #include "nsswitch.h" > #include > +#include OK. Include nss_dns.h. > > #include > #include > @@ -90,8 +91,6 @@ > #include > #include > > -NSS_DECLARE_MODULE_FUNCTIONS (dns) > - > #define RESOLVSORT > > #if PACKETSZ > 65536 > @@ -169,6 +168,7 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result, > __resolv_context_put (ctx); > return status; > } > +libc_hidden_def (_nss_dns_gethostbyname3_r) OK. > > static enum nss_status > gethostbyname3_context (struct resolv_context *ctx, > @@ -283,7 +283,7 @@ gethostbyname3_context (struct resolv_context *ctx, > static enum nss_status > check_name (const char *name, int *h_errnop) > { > - if (res_hnok (name)) > + if (__libc_res_hnok (name)) > return NSS_STATUS_SUCCESS; OK. > *h_errnop = HOST_NOT_FOUND; > return NSS_STATUS_NOTFOUND; > @@ -300,7 +300,7 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result, > return _nss_dns_gethostbyname3_r (name, af, result, buffer, buflen, errnop, > h_errnop, NULL, NULL); > } > - > +libc_hidden_def (_nss_dns_gethostbyname2_r) OK. > > enum nss_status > _nss_dns_gethostbyname_r (const char *name, struct hostent *result, > @@ -327,7 +327,7 @@ _nss_dns_gethostbyname_r (const char *name, struct hostent *result, > __resolv_context_put (ctx); > return status; > } > - > +libc_hidden_def (_nss_dns_gethostbyname_r) OK. > > enum nss_status > _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, > @@ -419,15 +419,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, > __resolv_context_put (ctx); > return status; > } > - > - > -extern enum nss_status _nss_dns_gethostbyaddr2_r (const void *addr, > - socklen_t len, int af, > - struct hostent *result, > - char *buffer, size_t buflen, > - int *errnop, int *h_errnop, > - int32_t *ttlp); > -hidden_proto (_nss_dns_gethostbyaddr2_r) > +libc_hidden_def (_nss_dns_gethostbyname4_r) OK. > > enum nss_status > _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af, > @@ -568,7 +560,7 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af, > __resolv_context_put (ctx); > return NSS_STATUS_SUCCESS; > } > -hidden_def (_nss_dns_gethostbyaddr2_r) > +libc_hidden_def (_nss_dns_gethostbyaddr2_r) OK. > > > enum nss_status > @@ -579,6 +571,7 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af, > return _nss_dns_gethostbyaddr2_r (addr, len, af, result, buffer, buflen, > errnop, h_errnop, NULL); > } > +libc_hidden_def (_nss_dns_gethostbyaddr_r) OK. > > static void > addrsort (struct resolv_context *ctx, char **ap, int num) > @@ -672,10 +665,10 @@ getanswer_r (struct resolv_context *ctx, > { > case T_A: > case T_AAAA: > - name_ok = res_hnok; > + name_ok = __libc_res_hnok; OK. > break; > case T_PTR: > - name_ok = res_dnok; > + name_ok = __libc_res_dnok; OK. > break; > default: > *errnop = ENOENT; > @@ -810,7 +803,8 @@ getanswer_r (struct resolv_context *ctx, > > if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1]) > continue; > - n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); > + n = __libc_dn_expand (answer->buf, end_of_message, cp, > + tbuf, sizeof tbuf); OK. > if (__glibc_unlikely (n < 0 || (*name_ok) (tbuf) == 0)) > { > ++had_error; > @@ -848,8 +842,9 @@ getanswer_r (struct resolv_context *ctx, > if (ttlp != NULL && ttl < *ttlp) > *ttlp = ttl; > > - n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); > - if (__glibc_unlikely (n < 0 || res_dnok (tbuf) == 0)) > + n = __libc_dn_expand (answer->buf, end_of_message, cp, > + tbuf, sizeof tbuf); > + if (__glibc_unlikely (n < 0 || __libc_res_dnok (tbuf) == 0)) OK. > { > ++had_error; > continue; > @@ -881,7 +876,7 @@ getanswer_r (struct resolv_context *ctx, > switch (type) > { > case T_PTR: > - if (__glibc_unlikely (strcasecmp (tname, bp) != 0)) > + if (__glibc_unlikely (__strcasecmp (tname, bp) != 0)) OK. > { > cp += n; > continue; /* XXX - had_error++ ? */ > @@ -897,7 +892,7 @@ getanswer_r (struct resolv_context *ctx, > n = -1; > } > > - if (__glibc_unlikely (n < 0 || res_hnok (bp) == 0)) > + if (__glibc_unlikely (n < 0 || __libc_res_hnok (bp) == 0)) OK. > { > ++had_error; > break; > @@ -911,7 +906,7 @@ getanswer_r (struct resolv_context *ctx, > return NSS_STATUS_SUCCESS; > case T_A: > case T_AAAA: > - if (__glibc_unlikely (strcasecmp (result->h_name, bp) != 0)) > + if (__glibc_unlikely (__strcasecmp (result->h_name, bp) != 0)) OK. > { > cp += n; > continue; /* XXX - had_error++ ? */ > @@ -1060,7 +1055,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname, > *h_errnop = NO_RECOVERY; > return NSS_STATUS_UNAVAIL; > } > - if (__glibc_unlikely (res_hnok (buffer) == 0)) > + if (__glibc_unlikely (__libc_res_hnok (buffer) == 0)) OK. > { > errno = EBADMSG; > *errnop = EBADMSG; > @@ -1093,7 +1088,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname, > > n = -1; > } > - if (__glibc_unlikely (n < 0 || res_hnok (buffer) == 0)) > + if (__glibc_unlikely (n < 0 || __libc_res_hnok (buffer) == 0)) OK. > { > ++had_error; > continue; > @@ -1142,8 +1137,9 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname, > if (ttlp != NULL && ttl < *ttlp) > *ttlp = ttl; > > - n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); > - if (__glibc_unlikely (n < 0 || res_hnok (tbuf) == 0)) > + n = __libc_dn_expand (answer->buf, end_of_message, cp, > + tbuf, sizeof tbuf); > + if (__glibc_unlikely (n < 0 || __libc_res_hnok (tbuf) == 0)) OK. > { > ++had_error; > continue; > diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c > index 801313caec..74b78959c2 100644 > --- a/resolv/nss_dns/dns-network.c > +++ b/resolv/nss_dns/dns-network.c > @@ -67,11 +67,10 @@ > #include "nsswitch.h" > #include > #include > +#include OK. Include nss_dns.h. > #include > #include > > -NSS_DECLARE_MODULE_FUNCTIONS (dns) > - > /* Maximum number of aliases we allow. */ > #define MAX_NR_ALIASES 48 > > @@ -152,7 +151,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result, > __resolv_context_put (ctx); > return status; > } > - > +libc_hidden_def (_nss_dns_getnetbyname_r) OK. > > enum nss_status > _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result, > @@ -246,7 +245,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result, > __resolv_context_put (ctx); > return status; > } > - > +libc_hidden_def (_nss_dns_getnetbyaddr_r) OK. > > static enum nss_status > getanswer_r (const querybuf *answer, int anslen, struct netent *result, > @@ -347,7 +346,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result, > n = -1; > } > > - if (n < 0 || res_dnok (bp) == 0) > + if (n < 0 || __libc_res_dnok (bp) == 0) OK. > break; > cp += n; > > @@ -381,7 +380,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result, > n = -1; > } > > - if (n < 0 || !res_hnok (bp)) > + if (n < 0 || !__libc_res_hnok (bp)) OK. > { > /* XXX What does this mean? The original form from bind > returns NULL. Incrementing cp has no effect in any case. > @@ -469,7 +468,7 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result, > /* If we are out of digits now, there are two cases: > 1. We are done with digits and now see "in-addr.arpa". > 2. This is not the droid we are looking for. */ > - if (!isdigit (*p) && !strcasecmp (p, "in-addr.arpa")) > + if (!isdigit (*p) && !__strcasecmp (p, "in-addr.arpa")) OK. > { > result->n_net = val; > return NSS_STATUS_SUCCESS; > -- Cheers, Carlos.