Message ID | 87a74v9df8.fsf@oldenburg2.str.redhat.com |
---|---|
State | Committed |
Headers |
Received: (qmail 86512 invoked by alias); 5 Mar 2020 12:47:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 86493 invoked by uid 89); 5 Mar 2020 12:47:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C8vLSM5l925rYt5ZS6Df93uafA3B4YKbhAIApY9ruwk=; b=glCCzGPt9pPiD8bqVdbR9hkq4Yw5KCXqtU6N91s5MGGT2gDEu/2MrO1UzFRSsVOmsrbcvL 6t4+rgLuVmRx/48BN+k39IVV58TGXpPBXwWvuqjbGgNOSVIsoEMT4d1cvNsMiW5gCR1YLP MlvOs1wS67nShe2VamtghIta9TvcQbc= From: Florian Weimer <fweimer@redhat.com> To: Stefan Liebler <stli@linux.ibm.com> Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Linux: Work around kernel bugs in chmod on /proc/self/fd paths References: <87sgjfd04p.fsf@oldenburg2.str.redhat.com> <d3d43ae5-560d-894f-341b-69b9b7241cc6@linux.ibm.com> <87lfp0eyq1.fsf@oldenburg2.str.redhat.com> <0e138e0f-6062-9ac1-4aac-896377304130@linux.ibm.com> <07cadb1f-82ce-9f70-9040-291388f37ef6@linux.ibm.com> Date: Thu, 05 Mar 2020 13:47:07 +0100 In-Reply-To: <07cadb1f-82ce-9f70-9040-291388f37ef6@linux.ibm.com> (Stefan Liebler's message of "Thu, 5 Mar 2020 12:55:09 +0100") Message-ID: <87a74v9df8.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable |
Commit Message
Florian Weimer
March 5, 2020, 12:47 p.m. UTC
* Stefan Liebler: > On 2/18/20 5:50 PM, Matheus Castanho wrote: > ... >> On 2/18/20 11:50 AM, Florian Weimer wrote: >>> Agreed, I've dropped it. >>> >>> New patch below. >>> >>> Florian > ... > ... >> LGTM. >> >> Reviewed-by: Matheus Castanho <msc@linux.ibm.com> >> >> -- >> Matheus Castanho >> > > Hi Florian, > > I've just recognized that building with -Os fails with > /usr/bin/ld: /path/to/glibc-build/libc_pic.os.clean: in function `fchmodat': > (.text+0xb1c36): undefined reference to `fstatat64' > collect2: error: ld returned 1 exit status > > This happens at least on x86_64 and s390x. > I've bisected and this was the first bad commit. Thanks. This patch should fix building with -Os. Florian 8<------------------------------------------------------------------8< Subject: Linux: Use __fstatat64 in fchmodat implementation fstatat64 depends on inlining to produce the desired __fxstatat64 call, which does not happen with -Os, leading to a link failure with an undefined reference to fstatat64. __fxstatat64 has a macro definition in include/sys/stat.h and thus avoids the problem. ----- sysdeps/unix/sysv/linux/fchmodat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 3/5/20 1:47 PM, Florian Weimer wrote: > * Stefan Liebler: > >> On 2/18/20 5:50 PM, Matheus Castanho wrote: >> ... >>> On 2/18/20 11:50 AM, Florian Weimer wrote: >>>> Agreed, I've dropped it. >>>> >>>> New patch below. >>>> >>>> Florian >> ... >> ... >>> LGTM. >>> >>> Reviewed-by: Matheus Castanho <msc@linux.ibm.com> >>> >>> -- >>> Matheus Castanho >>> >> >> Hi Florian, >> >> I've just recognized that building with -Os fails with >> /usr/bin/ld: /path/to/glibc-build/libc_pic.os.clean: in function `fchmodat': >> (.text+0xb1c36): undefined reference to `fstatat64' >> collect2: error: ld returned 1 exit status >> >> This happens at least on x86_64 and s390x. >> I've bisected and this was the first bad commit. > > Thanks. This patch should fix building with -Os. > > Florian > > 8<------------------------------------------------------------------8< > Subject: Linux: Use __fstatat64 in fchmodat implementation > > fstatat64 depends on inlining to produce the desired __fxstatat64 > call, which does not happen with -Os, leading to a link failure > with an undefined reference to fstatat64. __fxstatat64 has a macro > definition in include/sys/stat.h and thus avoids the problem. > > ----- > sysdeps/unix/sysv/linux/fchmodat.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c > index 17eca54051..5531f1aa6f 100644 > --- a/sysdeps/unix/sysv/linux/fchmodat.c > +++ b/sysdeps/unix/sysv/linux/fchmodat.c > @@ -48,7 +48,7 @@ fchmodat (int fd, const char *file, mode_t mode, int flag) > /* Use fstatat because fstat does not work on O_PATH descriptors > before Linux 3.6. */ > struct stat64 st; > - if (fstatat64 (pathfd, "", &st, AT_EMPTY_PATH) != 0) > + if (__fstatat64 (pathfd, "", &st, AT_EMPTY_PATH) != 0) > { > __close_nocancel (pathfd); > return -1; > I've tested this and now glibc buids in my two environments (x86_64 and s390x) fine. LGTM Thanks, Stefan
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c index 17eca54051..5531f1aa6f 100644 --- a/sysdeps/unix/sysv/linux/fchmodat.c +++ b/sysdeps/unix/sysv/linux/fchmodat.c @@ -48,7 +48,7 @@ fchmodat (int fd, const char *file, mode_t mode, int flag) /* Use fstatat because fstat does not work on O_PATH descriptors before Linux 3.6. */ struct stat64 st; - if (fstatat64 (pathfd, "", &st, AT_EMPTY_PATH) != 0) + if (__fstatat64 (pathfd, "", &st, AT_EMPTY_PATH) != 0) { __close_nocancel (pathfd); return -1;