From patchwork Wed Jul 14 13:58:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 44343 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C9B4398544F for ; Wed, 14 Jul 2021 13:54:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C9B4398544F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626270844; bh=JgYfA0fjh2ImGBVeNpeRFGp9SuqEnbDJKwcFdYxnEdw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=LwBvAwqc1B6c4DlqvtBpEfJ99OnGE9xZHVr9mm/rS5suNcwj8eEPcgXSU9EGYkVqr tUOnlFOVxrohSjSENI6sywvrTR8isaS/qKOR08K9wtGMbTWQzEjeXd9kWkCEAzwSo+ eVjOhM1n4JbRzTiz3mJoQNC0/RCfpcOYtfk+uKsU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id D76EF386483D for ; Wed, 14 Jul 2021 13:52:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D76EF386483D Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16EDXt1L049004 for ; Wed, 14 Jul 2021 09:52:59 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39sufyanr9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 14 Jul 2021 09:52:58 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16EDaU48061697 for ; Wed, 14 Jul 2021 09:52:58 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 39sufyanqf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Jul 2021 09:52:58 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16EDXbEC023219; Wed, 14 Jul 2021 13:52:56 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 39q3689t5y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Jul 2021 13:52:55 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16EDqqiC27984356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jul 2021 13:52:52 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A692D11C052; Wed, 14 Jul 2021 13:52:52 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FEBD11C04A; Wed, 14 Jul 2021 13:52:52 +0000 (GMT) Received: from t35lp56.lnxne.boe (unknown [9.152.108.100]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 14 Jul 2021 13:52:52 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH] Fix linknamespace errors and local-plt-usages in nss_files. Date: Wed, 14 Jul 2021 15:58:08 +0200 Message-Id: <20210714135808.3555370-1-stli@linux.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 79IqWwT7_3enIEkPQq5mE2NKu37STaKq X-Proofpoint-ORIG-GUID: JDcs4s90MQYyLEi033wmvGvbfgIaNo_J X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-14_07:2021-07-14, 2021-07-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 adultscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107140084 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Stefan Liebler via Libc-alpha From: Stefan Liebler Reply-To: Stefan Liebler Cc: fweimer@redhat.com, Stefan Liebler Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" After commit f9c8b11ed7726b858cd7b7cea0d3d7c5233d78cf "nss: Access nss_files through direct references", when building with -Os, multiple conform/.../linknamespace tests and elf/check-localplt are failing: Extra PLT reference: libc.so: fgetc_unlocked Extra PLT reference: libc.so: getline Or e.g.: [initial] glob -> [libc.a(glob.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_module_get_function -> [libc.a(nss_module.o)] __nss_files_functions -> [libc.a(nss_files_functions.o)] _nss_files_endaliasent -> [libc.a(files-alias.o)] feof_unlocked [initial] glob -> [libc.a(glob.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_module_get_function -> [libc.a(nss_module.o)] __nss_files_functions -> [libc.a(nss_files_functions.o)] _nss_files_endaliasent -> [libc.a(files-alias.o)] fgetc_unlocked [initial] glob -> [libc.a(glob.o)] __getpwnam_r -> [libc.a(getpwnam_r.o)] __nss_database_custom -> [libc.a(nsswitch.o)] __nss_module_get_function -> [libc.a(nss_module.o)] __nss_files_functions -> [libc.a(nss_files_functions.o)] _nss_files_endnetgrent -> [libc.a(files-netgrp.o)] getline This patch is using the hidden symbols where possible. Instead of fputc_unlocked, __putc_unlocked is used. (Compare to commit eeaa19f75e52d2d48074ae0c423f2311d67c42c6 "mntent: Use __putc_unlocked instead of fputc_unlocked") --- nss/nss_files/files-alias.c | 4 ++-- nss/nss_files/files-initgroups.c | 4 ++-- nss/nss_files/files-netgrp.c | 6 +++--- nss/nss_readline.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c index 8c6e176ff6..2a4023b9a9 100644 --- a/nss/nss_files/files-alias.c +++ b/nss/nss_files/files-alias.c @@ -189,7 +189,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, if (listfile != NULL && (old_line = __strdup (line)) != NULL) { - while (! feof_unlocked (listfile)) + while (! __feof_unlocked (listfile)) { if (room_left < 2) { @@ -269,7 +269,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, just read character. */ int ch; - ch = fgetc_unlocked (stream); + ch = __getc_unlocked (stream); if (ch == EOF || ch == '\n' || !isspace (ch)) { size_t cnt; diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c index b44211e50b..d221335902 100644 --- a/nss/nss_files/files-initgroups.c +++ b/nss/nss_files/files-initgroups.c @@ -55,10 +55,10 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, { fpos_t pos; fgetpos (stream, &pos); - ssize_t n = getline (&line, &linelen, stream); + ssize_t n = __getline (&line, &linelen, stream); if (n < 0) { - if (! feof_unlocked (stream)) + if (! __feof_unlocked (stream)) status = ((*errnop = errno) == ENOMEM ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL); break; diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c index 75bfbd9e44..82cc201b85 100644 --- a/nss/nss_files/files-netgrp.c +++ b/nss/nss_files/files-netgrp.c @@ -77,9 +77,9 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result) status = NSS_STATUS_NOTFOUND; result->cursor = result->data; - while (!feof_unlocked (fp)) + while (!__feof_unlocked (fp)) { - ssize_t curlen = getline (&line, &line_len, fp); + ssize_t curlen = __getline (&line, &line_len, fp); int found; if (curlen < 0) @@ -111,7 +111,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result) result->cursor -= 2; /* Get next line. */ - curlen = getline (&line, &line_len, fp); + curlen = __getline (&line, &line_len, fp); if (curlen <= 0) break; diff --git a/nss/nss_readline.c b/nss/nss_readline.c index a2f397a11f..ddf2b8962f 100644 --- a/nss/nss_readline.c +++ b/nss/nss_readline.c @@ -42,7 +42,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset) buf[len - 1] = '\xff'; /* Marker to recognize truncation. */ if (__fgets_unlocked (buf, len, fp) == NULL) { - if (feof_unlocked (fp)) + if (__feof_unlocked (fp)) { __set_errno (ENOENT); return ENOENT;