From patchwork Mon Jun 7 17:38:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1488857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=RLvoJrMZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 ozlabs.org (Postfix) with ESMTPS id 4FzLMs4B40z9sCD for ; Tue, 8 Jun 2021 03:44:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 81D6E38930CE for ; Mon, 7 Jun 2021 17:44:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81D6E38930CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623087847; bh=awKoAJWFxJNiobkwIMZGJ1OFqrXr/kSzsVv+r584U9U=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RLvoJrMZMCTeB3GzwDeC/MbPkGUtcZeA5ZmfJsy4rw1bmup/w7kgrnhdBpuT5HaCH pMb9NhK3t1mzRT8JnX+im+uAhWFntKf6I8FoMY8w5GM06sowWUYd8P5tNILfvz0uSw zgq1+sKtG24x8bN7AkgRtv0eXkFCK7m1wWcZ03a8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 8B1663938C2D for ; Mon, 7 Jun 2021 17:38:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B1663938C2D Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-kcYHSfXOMYSpMp99mQb0-w-1; Mon, 07 Jun 2021 13:38:41 -0400 X-MC-Unique: kcYHSfXOMYSpMp99mQb0-w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 228EF107ACCD for ; Mon, 7 Jun 2021 17:38:40 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C24B60862 for ; Mon, 7 Jun 2021 17:38:39 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 7/8] nss_files: Move into libc In-Reply-To: References: X-From-Line: 492539c60380229368ed8d07209fc1db4f0eb96d Mon Sep 17 00:00:00 2001 Message-Id: <492539c60380229368ed8d07209fc1db4f0eb96d.1623085295.git.fweimer@redhat.com> Date: Mon, 07 Jun 2021 19:38:37 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" This is the first step towards fixing bug 27959. --- include/libc-symbols.h | 23 ----------------------- include/netdb.h | 2 +- include/nss_files.h | 10 +++++----- nss/Makefile | 11 +++-------- nss/Versions | 13 +++++++++---- nss/nss_files/files-alias.c | 10 +++++----- nss/nss_files/files-hosts.c | 7 ++++--- nss/nss_files/files-netgrp.c | 6 +++--- nss/nss_files/files-network.c | 5 ++--- nss/nss_files/files-parse.c | 8 +------- nss/nss_readline.c | 4 ++-- 11 files changed, 35 insertions(+), 64 deletions(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 127ea656c2..d41ecf4384 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -798,29 +798,6 @@ for linking") # define libdl_hidden_data_ver(local, name) #endif -#if IS_IN (libnss_files) -# define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) -# define libnss_files_hidden_tls_proto(name, attrs...) \ - hidden_tls_proto (name, ##attrs) -# define libnss_files_hidden_def(name) hidden_def (name) -# define libnss_files_hidden_weak(name) hidden_weak (name) -# define libnss_files_hidden_ver(local, name) hidden_ver (local, name) -# define libnss_files_hidden_data_def(name) hidden_data_def (name) -# define libnss_files_hidden_tls_def(name) hidden_tls_def (name) -# define libnss_files_hidden_data_weak(name) hidden_data_weak (name) -# define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name) -#else -# define libnss_files_hidden_proto(name, attrs...) -# define libnss_files_hidden_tls_proto(name, attrs...) -# define libnss_files_hidden_def(name) -# define libnss_files_hidden_weak(name) -# define libnss_files_hidden_ver(local, name) -# define libnss_files_hidden_data_def(name) -# define libnss_files_hidden_tls_def(name) -# define libnss_files_hidden_data_weak(name) -# define libnss_files_hidden_data_ver(local, name) -#endif - #if IS_IN (libnsl) # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libnsl_hidden_tls_proto(name, attrs...) \ diff --git a/include/netdb.h b/include/netdb.h index 645b85dc62..76edd65f9a 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -213,7 +213,7 @@ extern enum nss_status _nss_netgroup_parseline (char **cursor, struct __netgrent *result, char *buffer, size_t buflen, int *errnop); -libnss_files_hidden_proto (_nss_netgroup_parseline) +libc_hidden_proto (_nss_netgroup_parseline) #define DECLARE_NSS_PROTOTYPES(service) \ extern enum nss_status _nss_ ## service ## _setprotoent (int); \ diff --git a/include/nss_files.h b/include/nss_files.h index 7bf1951496..dd0081a0f1 100644 --- a/include/nss_files.h +++ b/include/nss_files.h @@ -124,13 +124,13 @@ extern nss_files_parse_line _nss_files_parse_servent; extern nss_files_parse_line _nss_files_parse_sgent; extern nss_files_parse_line _nss_files_parse_spent; -libnss_files_hidden_proto (_nss_files_parse_etherent) +libc_hidden_proto (_nss_files_parse_etherent) libc_hidden_proto (_nss_files_parse_grent) -libnss_files_hidden_proto (_nss_files_parse_netent) -libnss_files_hidden_proto (_nss_files_parse_protoent) +libc_hidden_proto (_nss_files_parse_netent) +libc_hidden_proto (_nss_files_parse_protoent) libc_hidden_proto (_nss_files_parse_pwent) -libnss_files_hidden_proto (_nss_files_parse_rpcent) -libnss_files_hidden_proto (_nss_files_parse_servent) +libc_hidden_proto (_nss_files_parse_rpcent) +libc_hidden_proto (_nss_files_parse_servent) libc_hidden_proto (_nss_files_parse_sgent) libc_hidden_proto (_nss_files_parse_spent) diff --git a/nss/Makefile b/nss/Makefile index 271a0e7716..8905a5fd9b 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -98,9 +98,9 @@ subdir-dirs = $(services:%=nss_%) vpath %.c $(subdir-dirs) ../locale/programs ../intl -libnss_files-routines := $(addprefix files-, \ - $(filter-out key, $(databases))) \ - files-initgroups files-init +routines += \ + $(addprefix files-, $(filter-out key, $(databases))) \ + files-initgroups files-init libnss_db-dbs := $(addprefix db-,\ $(filter-out hosts network key alias,\ @@ -116,12 +116,9 @@ libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups) \ install-others += $(inst_vardbdir)/Makefile # Build static module into libc if requested -libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes)) ifeq ($(build-static-nss),yes) -routines += $(libnss_files-routines) -static-only-routines += $(libnss_files-routines) tests-static += tst-nss-static endif extra-test-objs += nss_test1.os nss_test2.os @@ -138,8 +135,6 @@ libnss-libc = $(common-objpfx)linkobj/libc.so # for new links: $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc) -$(objpfx)libnss_db.so: $(objpfx)libnss_files.so - $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c @rm -f $@.new (echo '#define EXTERN_PARSER';\ diff --git a/nss/Versions b/nss/Versions index 7b040b4786..e551524aa9 100644 --- a/nss/Versions +++ b/nss/Versions @@ -23,11 +23,8 @@ libc { __nss_files_data_open; __nss_files_data_put; __nss_files_data_setent; - } -} -libnss_files { - GLIBC_PRIVATE { + # Routines formerly in libnss_files.so.2. _nss_files_setaliasent; _nss_files_endaliasent; _nss_files_getaliasbyname_r; @@ -113,6 +110,14 @@ libnss_files { } } +libnss_files { + GLIBC_PRIVATE { + # Keep a version node (with a synthesized local: * directive) so that + # __bss_* symbols are hidden on targets that need it. + __libnss_files_version_placeholder; + } +} + libnss_db { GLIBC_PRIVATE { _nss_db_setetherent; diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c index 9624b6224c..75d91e0b0a 100644 --- a/nss/nss_files/files-alias.c +++ b/nss/nss_files/files-alias.c @@ -98,7 +98,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, /* Read the first line. It must contain the alias name and possibly some alias names. */ first_unused[room_left - 1] = '\xff'; - line = fgets_unlocked (first_unused, room_left, stream); + line = __fgets_unlocked (first_unused, room_left, stream); if (line == NULL) /* Nothing to read. */ break; @@ -187,7 +187,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, /* If the file does not exist we simply ignore the statement. */ if (listfile != NULL - && (old_line = strdup (line)) != NULL) + && (old_line = __strdup (line)) != NULL) { while (! feof_unlocked (listfile)) { @@ -199,8 +199,8 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, } first_unused[room_left - 1] = '\xff'; - line = fgets_unlocked (first_unused, room_left, - listfile); + line = __fgets_unlocked (first_unused, room_left, + listfile); if (line == NULL) break; if (first_unused[room_left - 1] != '\xff') @@ -302,7 +302,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, /* The just read character is a white space and so can be ignored. */ first_unused[room_left - 1] = '\xff'; - line = fgets_unlocked (first_unused, room_left, stream); + line = __fgets_unlocked (first_unused, room_left, stream); if (line == NULL) { /* Continuation line without any data and diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index 1dd51d1db9..894b85d501 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -57,12 +57,13 @@ LINE_PARSER STRING_FIELD (addr, isspace, 1); /* Parse address. */ - if (inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr) + if (__inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr) > 0) af = af == AF_UNSPEC ? AF_INET : af; else { - if (af == AF_INET && inet_pton (AF_INET6, addr, entdata->host_addr) > 0) + if (af == AF_INET + && __inet_pton (AF_INET6, addr, entdata->host_addr) > 0) { if (IN6_IS_ADDR_V4MAPPED (entdata->host_addr)) memcpy (entdata->host_addr, entdata->host_addr + 12, INADDRSZ); @@ -76,7 +77,7 @@ LINE_PARSER return 0; } else if (af == AF_UNSPEC - && inet_pton (AF_INET6, addr, entdata->host_addr) > 0) + && __inet_pton (AF_INET6, addr, entdata->host_addr) > 0) af = AF_INET6; else /* Illegal address: ignore line. */ diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c index f8c821c2f0..be9c72accf 100644 --- a/nss/nss_files/files-netgrp.c +++ b/nss/nss_files/files-netgrp.c @@ -32,7 +32,7 @@ NSS_DECLARE_MODULE_FUNCTIONS (files) #define DATAFILE "/etc/netgroup" -libnss_files_hidden_proto (_nss_files_endnetgrent) +libc_hidden_proto (_nss_files_endnetgrent) #define EXPAND(needed) \ do \ @@ -164,7 +164,7 @@ _nss_files_endnetgrent (struct __netgrent *result) result->cursor = NULL; return NSS_STATUS_SUCCESS; } -libnss_files_hidden_def (_nss_files_endnetgrent) +libc_hidden_def (_nss_files_endnetgrent) static char * strip_whitespace (char *str) @@ -279,7 +279,7 @@ _nss_netgroup_parseline (char **cursor, struct __netgrent *result, return status; } -libnss_files_hidden_def (_nss_netgroup_parseline) +libc_hidden_def (_nss_netgroup_parseline) enum nss_status diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c index 9cd7d7dc79..75c9f8a57e 100644 --- a/nss/nss_files/files-network.c +++ b/nss/nss_files/files-network.c @@ -21,8 +21,7 @@ #include #include #include - -NSS_DECLARE_MODULE_FUNCTIONS (files) +#include #define ENTNAME netent #define DATABASE "networks" @@ -71,7 +70,7 @@ LINE_PARSER *cp = '\0'; addr = newp; } - result->n_net = inet_network (addr); + result->n_net = __inet_network (addr); result->n_addrtype = AF_INET; }) diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c index 68c51c7cbf..997eac573a 100644 --- a/nss/nss_files/files-parse.c +++ b/nss/nss_files/files-parse.c @@ -74,13 +74,7 @@ struct parser_data /* Export the line parser function so it can be used in nss_db. */ # define parser_stclass /* Global */ # define parse_line CONCAT(_nss_files_parse_,ENTNAME) -# if IS_IN (libc) -/* We are defining one of the functions that actually lives in libc - because it is used to implement fget*ent and suchlike. */ -# define nss_files_parse_hidden_def(name) libc_hidden_def (name) -# else -# define nss_files_parse_hidden_def(name) libnss_files_hidden_def (name) -# endif +# define nss_files_parse_hidden_def(name) libc_hidden_def (name) #endif diff --git a/nss/nss_readline.c b/nss/nss_readline.c index 4b3ecbccc8..a2f397a11f 100644 --- a/nss/nss_readline.c +++ b/nss/nss_readline.c @@ -40,7 +40,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset) *poffset = __ftello64 (fp); buf[len - 1] = '\xff'; /* Marker to recognize truncation. */ - if (fgets_unlocked (buf, len, fp) == NULL) + if (__fgets_unlocked (buf, len, fp) == NULL) { if (feof_unlocked (fp)) { @@ -61,7 +61,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset) line on the next call. */ return __nss_readline_seek (fp, *poffset); - /* fgets_unlocked succeeded. */ + /* __fgets_unlocked succeeded. */ /* Remove leading whitespace. */ char *p = buf;