From patchwork Wed Mar 13 09:54:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1055985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100590-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="qNDzhcdc"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44K6dL1YGvz9s47 for ; Wed, 13 Mar 2019 20:54:45 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:cc:date :mime-version:in-reply-to:content-type:message-id; q=dns; s= default; b=hbmRGdsdty19NFAJmxLAZW8sYfQ+1w3Cheys9Ot3A/P3iaPu6tO5i J5SuupmfajLzQeL2Wo6HvDI9yn711Q0+EUrocVc7nprvF8hvRbEe7la3W/QGJ+2a wzg1UaVaV2yQJcoqeRRiAzBbRTMEX+6oMQggOrlUXY9pFeZe+WdICY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:cc:date :mime-version:in-reply-to:content-type:message-id; s=default; bh=f8lgCRh1qWiW4dpUT2e66T+Q6RE=; b=qNDzhcdcOZ65t1JpVS00aT3qIs0x 7X4Jrn1a9X7PLonchwqY3sc0w1lBba+N22psC/DvARiq5hK+GxV1BecI0Y11JMCv x3228ZdqvcGNW2+33Td2W6x5zbwHKXIq0m0SlFoLcvRAjkbYY0TbohNazWG7J/ma AwujP6YurSbjDd4= Received: (qmail 1139 invoked by alias); 13 Mar 2019 09:54:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 1117 invoked by uid 89); 13 Mar 2019 09:54:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=HTo:U*libc-stable X-HELO: mx0a-001b2d01.pphosted.com Subject: [2.29 COMMITTED] Fix output of LD_SHOW_AUXV=1. To: GNU C Library , libc-stable@sourceware.org References: <5b73a948-5209-14b0-61d1-aca82c99e192@redhat.com> From: Stefan Liebler Cc: "Carlos O'Donell" Date: Wed, 13 Mar 2019 10:54:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <5b73a948-5209-14b0-61d1-aca82c99e192@redhat.com> x-cbid: 19031309-0020-0000-0000-0000032204C7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19031309-0021-0000-0000-000021743502 Message-Id: <26473622-44fc-b2ae-6132-e7d475190f95@linux.ibm.com> On 3/12/19 9:11 PM, Carlos O'Donell wrote: > On 3/12/19 11:06 AM, Stefan Liebler wrote: >> commit 988376a08d6d36ea321203b9c039db4b266609ae >> Author: Stefan Liebler >> Date: Fri Mar 8 11:18:53 2019 +0100 >> >> Fix output of LD_SHOW_AUXV=1. >> >> Starting with commit 1616d034b61622836d3a36af53dcfca7624c844e >> the output was corrupted on some platforms as _dl_procinfo >> was called for every auxv entry and on some architectures like s390 >> all entries were represented as "AT_HWCAP". >> >> This patch is removing the condition and let _dl_procinfo decide if >> an entry is printed in a platform specific or generic way. >> This patch also adjusts all _dl_procinfo implementations which assumed >> that they are only called for AT_HWCAP or AT_HWCAP2. They are now just >> returning a non-zero-value for entries which are not handled platform >> specifc. >> >> ChangeLog: >> >> * elf/dl-sysdep.c (_dl_show_auxv): Remove condition and always >> call _dl_procinfo. >> * sysdeps/unix/sysv/linux/s390/dl-procinfo.h (_dl_procinfo): >> Ignore types other than AT_HWCAP. >> * sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Likewise. >> * sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo): >> Likewise. > > Thanks for the cleanup, this makes it really clear how this is intended to work. > > OK for master if you... > - Fix ARM and POWERPC backend _dl_procinfo to remove "/* This should not happen. */" > comment in dl-procinfo.c. It *does* happen now because we pass all options to > the machine version first. > > Reviewed-by: Carlos O'Donell > Okay. I've adjusted those comments and committed the patch to master and backported it to glibc release branch 2.29. Thanks, Stefan >> diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c >> index 5f6c679a3f..5d19b100b2 100644 >> --- a/elf/dl-sysdep.c >> +++ b/elf/dl-sysdep.c >> @@ -328,14 +328,9 @@ _dl_show_auxv (void) >> assert (AT_NULL == 0); >> assert (AT_IGNORE == 1); >> >> - if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2 >> - || AT_L1I_CACHEGEOMETRY || AT_L1D_CACHEGEOMETRY >> - || AT_L2_CACHEGEOMETRY || AT_L3_CACHEGEOMETRY) >> - { >> - /* These are handled in a special way per platform. */ >> - if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0) >> - continue; >> - } >> + /* Some entries are handled in a special way per platform. */ >> + if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0) >> + continue; > > OK. > > OK. ARM backend returns -1 with default handling. > > OK. POWERPC backend return -1 with default handling. > >> >> if (idx < sizeof (auxvars) / sizeof (auxvars[0]) >> && auxvars[idx].form != unknown) >> diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h >> index 282b8c5117..cc2687e99b 100644 >> --- a/sysdeps/sparc/dl-procinfo.h >> +++ b/sysdeps/sparc/dl-procinfo.h >> @@ -32,7 +32,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) >> int i; >> >> /* Fallback to unknown output mechanism. */ >> - if (type == AT_HWCAP2) >> + if (type != AT_HWCAP) > > OK. > >> return -1; >> >> _dl_printf ("AT_HWCAP: "); >> diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h >> index 22b43431bc..3aef14c6c1 100644 >> --- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h >> +++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h >> @@ -31,7 +31,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) >> int i; >> >> /* Fallback to unknown output mechanism. */ >> - if (type == AT_HWCAP2) >> + if (type != AT_HWCAP) > > OK. > >> return -1; >> >> _dl_printf ("AT_HWCAP: "); >> diff --git a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h >> index 19329a335b..16739fd6cd 100644 >> --- a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h >> +++ b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h >> @@ -33,7 +33,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) >> int i; >> >> /* Fallback to unknown output mechanism. */ >> - if (type == AT_HWCAP2) >> + if (type != AT_HWCAP) > > OK. > >> return -1; >> >> _dl_printf ("AT_HWCAP: "); > > commit daede01d78492f2f7b640966a2e60ff409be677a Author: Stefan Liebler Date: Fri Mar 8 11:18:53 2019 +0100 Fix output of LD_SHOW_AUXV=1. Starting with commit 1616d034b61622836d3a36af53dcfca7624c844e the output was corrupted on some platforms as _dl_procinfo was called for every auxv entry and on some architectures like s390 all entries were represented as "AT_HWCAP". This patch is removing the condition and let _dl_procinfo decide if an entry is printed in a platform specific or generic way. This patch also adjusts all _dl_procinfo implementations which assumed that they are only called for AT_HWCAP or AT_HWCAP2. They are now just returning a non-zero-value for entries which are not handled platform specifc. ChangeLog: * elf/dl-sysdep.c (_dl_show_auxv): Remove condition and always call _dl_procinfo. * sysdeps/unix/sysv/linux/s390/dl-procinfo.h (_dl_procinfo): Ignore types other than AT_HWCAP. * sysdeps/sparc/dl-procinfo.h (_dl_procinfo): Likewise. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo): Likewise. * sysdeps/powerpc/dl-procinfo.h (_dl_procinfo): Adjust comment in the case of falling back to generic output mechanism. * sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_dl_procinfo): Likewise. diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c index 5f6c679a3f..5d19b100b2 100644 --- a/elf/dl-sysdep.c +++ b/elf/dl-sysdep.c @@ -328,14 +328,9 @@ _dl_show_auxv (void) assert (AT_NULL == 0); assert (AT_IGNORE == 1); - if (av->a_type == AT_HWCAP || av->a_type == AT_HWCAP2 - || AT_L1I_CACHEGEOMETRY || AT_L1D_CACHEGEOMETRY - || AT_L2_CACHEGEOMETRY || AT_L3_CACHEGEOMETRY) - { - /* These are handled in a special way per platform. */ - if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0) - continue; - } + /* Some entries are handled in a special way per platform. */ + if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0) + continue; if (idx < sizeof (auxvars) / sizeof (auxvars[0]) && auxvars[idx].form != unknown) diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h index f542f7318f..dfc3b33a72 100644 --- a/sysdeps/powerpc/dl-procinfo.h +++ b/sysdeps/powerpc/dl-procinfo.h @@ -225,7 +225,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) break; } default: - /* This should not happen. */ + /* Fallback to generic output mechanism. */ return -1; } _dl_printf ("\n"); diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h index 282b8c5117..64ee267fc7 100644 --- a/sysdeps/sparc/dl-procinfo.h +++ b/sysdeps/sparc/dl-procinfo.h @@ -31,8 +31,8 @@ _dl_procinfo (unsigned int type, unsigned long int word) { int i; - /* Fallback to unknown output mechanism. */ - if (type == AT_HWCAP2) + /* Fallback to generic output mechanism. */ + if (type != AT_HWCAP) return -1; _dl_printf ("AT_HWCAP: "); diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h index 66c00297b7..05c62c8687 100644 --- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h @@ -67,7 +67,7 @@ _dl_procinfo (unsigned int type, unsigned long int word) break; } default: - /* This should not happen. */ + /* Fallback to generic output mechanism. */ return -1; } _dl_printf ("\n"); diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h index 22b43431bc..0585cdaa9c 100644 --- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h @@ -30,8 +30,8 @@ _dl_procinfo (unsigned int type, unsigned long int word) in the kernel sources. */ int i; - /* Fallback to unknown output mechanism. */ - if (type == AT_HWCAP2) + /* Fallback to generic output mechanism. */ + if (type != AT_HWCAP) return -1; _dl_printf ("AT_HWCAP: "); diff --git a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h index 19329a335b..d67fde368f 100644 --- a/sysdeps/unix/sysv/linux/s390/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/s390/dl-procinfo.h @@ -32,8 +32,8 @@ _dl_procinfo (unsigned int type, unsigned long int word) in the kernel sources. */ int i; - /* Fallback to unknown output mechanism. */ - if (type == AT_HWCAP2) + /* Fallback to generic output mechanism. */ + if (type != AT_HWCAP) return -1; _dl_printf ("AT_HWCAP: ");