From patchwork Tue Dec 15 18:35:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matheus Castanho X-Patchwork-Id: 41406 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 899BA3861823; Tue, 15 Dec 2020 18:35:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 899BA3861823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608057348; bh=e1oUStA5I48ljy1xrViEm7BXhrTOE28LDriHIRVDNhY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=qe3oVp8+0u8TSmP5H6R/Z3JrhC9D1IFOcriNGa9r1nkMjrhKjO5b18a9rV5o+hyYg vVU4x1txoOSDfuT+UeFQtkPXIgDYQQUGbeEo1aEbx7aj1dwf9Z2ZuvCiqoaOhMwib0 m69RRbCBXmp5/04RpwP11Y83+9mx6h9HoEuH5fCY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 0944C386100B for ; Tue, 15 Dec 2020 18:35:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0944C386100B Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BFIWEdJ168384 for ; Tue, 15 Dec 2020 13:35:44 -0500 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 35ey5a257t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Dec 2020 13:35:44 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BFISEc7027388 for ; Tue, 15 Dec 2020 18:35:43 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma01wdc.us.ibm.com with ESMTP id 35cng8p8ep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 Dec 2020 18:35:43 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BFIZg3H11075918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 Dec 2020 18:35:43 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D7BEFAC05B for ; Tue, 15 Dec 2020 18:35:42 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F48BAC066 for ; Tue, 15 Dec 2020 18:35:42 +0000 (GMT) Received: from localhost (unknown [9.160.17.6]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP for ; Tue, 15 Dec 2020 18:35:42 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH 1/1] elf: Limit tst-prelink-cmp target archs Date: Tue, 15 Dec 2020 15:35:41 -0300 Message-Id: <20201215183541.89487-1-msc@linux.ibm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2020-12-15_12:2020-12-15, 2020-12-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012150120 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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: Matheus Castanho via Libc-alpha From: Matheus Castanho Reply-To: Matheus Castanho Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Follow up from [0]. [0] https://sourceware.org/pipermail/libc-alpha/2020-November/119970.html ---8<--- elf/tst-prelink-cmp was initially added for x86 (commit fe534fe898) to validate the fix for Bug 19178, and later applied to all architectures that use GLOB_DAT relocations (commit 89569c8bb6). However, that bug only affected targets that handle GLOB_DAT relocations as ELF_TYPE_CLASS_EXTERN_PROTECTED_DATA, so the test should only apply to targets defining DL_EXTERN_PROTECTED_DATA, which gates the usage of the elf type class above. For all other targets not meeting that criteria, the test now returns with UNSUPPORTED status. --- elf/Makefile | 9 ++------ elf/tst-prelink-cmp.c | 48 +++++++++++++++++++++++++++++++++++++++++++ elf/tst-prelink.exp | 1 - 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 elf/tst-prelink-cmp.c delete mode 100644 elf/tst-prelink.exp -- 2.26.2 diff --git a/elf/Makefile b/elf/Makefile index 0b4d78c874..9d171416ad 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -453,12 +453,10 @@ update-all-abi: update-all-abi-ld ifeq ($(have-glob-dat-reloc),yes) tests += tst-prelink +tests-internal += tst-prelink-cmp # Don't compile tst-prelink.c with PIE for GLOB_DAT relocation. CFLAGS-tst-prelink.c += -fno-pie tst-prelink-no-pie = yes -ifeq ($(run-built-tests),yes) -tests-special += $(objpfx)tst-prelink-cmp.out -endif endif # The test requires shared _and_ PIE because the executable @@ -1599,10 +1597,7 @@ tst-prelink-ENV = LD_TRACE_PRELINKING=1 $(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@ -$(objpfx)tst-prelink-cmp.out: tst-prelink.exp \ - $(objpfx)tst-prelink-conflict.out - cmp $^ > $@; \ - $(evaluate-test) +$(objpfx)tst-prelink-cmp.out: $(objpfx)tst-prelink-conflict.out $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig $(SHELL) $< '$(common-objpfx)' '$(test-wrapper-env)' \ diff --git a/elf/tst-prelink-cmp.c b/elf/tst-prelink-cmp.c new file mode 100644 index 0000000000..5d21f1ddfd --- /dev/null +++ b/elf/tst-prelink-cmp.c @@ -0,0 +1,48 @@ +/* Test the output from the environment variable, LD_TRACE_PRELINKING, + for prelink. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include + +static int +do_test (void) +{ +#ifndef DL_EXTERN_PROTECTED_DATA + return EXIT_UNSUPPORTED; +#else + char *src = xasprintf ("%s/elf/tst-prelink-conflict.out", support_objdir_root); + FILE *f = xfopen (src,"r"); + size_t buffer_length = 0; + char *buffer = NULL; + + const char *expected = "/0 stdout\n"; + + xgetline (&buffer, &buffer_length, f); + TEST_COMPARE_STRING (expected, buffer); + + free (buffer); + xfclose (f); + return 0; +#endif +} + +#include diff --git a/elf/tst-prelink.exp b/elf/tst-prelink.exp deleted file mode 100644 index b35b4c9705..0000000000 --- a/elf/tst-prelink.exp +++ /dev/null @@ -1 +0,0 @@ -/0 stdout