From patchwork Fri Mar 8 12:52:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1053474 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-100506-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="GDs/FHtF"; 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 44G6px1NfYz9sMp for ; Fri, 8 Mar 2019 23:52:40 +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:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=wesL/Pk65jBNVwuAgSJE/e7KYFifKMW xPEjksoZXfENu0/CpWDd7ea87uHA/+rK7ccQDh0Uv6B/czm7CpXunBUOWwnjp56g G0xAr99VFjmstA6BpHmaQoM2PlkYLP0MmeNgib093lMp3Z+HGwYrdHPhxsNqsU2F Or00beLHva54= 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:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=T4CLiOz4gQmj4L3UeZTrG9meyz0=; b=GDs/F HtF/KR6LcUdD/ESQ9CaiKZEhPANf36F5l/nZ+AqLYxDXWwOFM/rNpYTkb3PK4hPb UTPAhQLkC45MGONnMWNKh8BkOE8EUK05T6YjxbZLutYcNGk/OC1Q8vGEQYvr/bGD Olk0gc0KjREETX1fWatU9Tpbv5Q9xjtK5EdAKI= Received: (qmail 13298 invoked by alias); 8 Mar 2019 12:52:35 -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 13290 invoked by uid 89); 8 Mar 2019 12:52:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=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=adjusts X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: [PATCH] Fix output of LD_SHOW_AUXV=1. Date: Fri, 8 Mar 2019 13:52:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 x-cbid: 19030812-0012-0000-0000-000003003BC2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19030812-0013-0000-0000-000021374E90 Message-Id: Hi, 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 fixes the condition which determines if _dl_procinfo is called and adjusts _dl_procinfo implementations which assumed that they are only called for AT_HWCAP or AT_HWCAP2. A further question is if we should always call _dl_procinfo without a condition and let it decide if it is able to print an entry or if it should be printed with help of the auxvars list? Okay to commit? Once it is committed I would also backport it to glibc 2.29 release branch. Bye, Stefan ChangeLog: * elf/dl-sysdep.c (_dl_show_auxv): Fix condition if _dl_procinfo is called. * 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. Reviewed-by: Carlos O'Donell Reviewed-by: Carlos O'Donell commit 5bbde0719d7c5fa58b0140d6fb1c6fa31a372772 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 fixes the condition which determines if _dl_procinfo is called and adjusts _dl_procinfo implementations which assumed that they are only called for AT_HWCAP or AT_HWCAP2. ChangeLog: * elf/dl-sysdep.c (_dl_show_auxv): Fix condition if _dl_procinfo is called. * 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. diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c index 5f6c679a3f..1588555651 100644 --- a/elf/dl-sysdep.c +++ b/elf/dl-sysdep.c @@ -329,8 +329,10 @@ _dl_show_auxv (void) 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) + || av->a_type == AT_L1I_CACHEGEOMETRY + || av->a_type == AT_L1D_CACHEGEOMETRY + || av->a_type == AT_L2_CACHEGEOMETRY + || av->a_type == AT_L3_CACHEGEOMETRY) { /* These are handled in a special way per platform. */ if (_dl_procinfo (av->a_type, av->a_un.a_val) == 0) 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) 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) 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) return -1; _dl_printf ("AT_HWCAP: ");