From patchwork Wed Jun 1 15:55:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 54683 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 58B6038327D5 for ; Wed, 1 Jun 2022 15:56:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58B6038327D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1654098961; bh=Vh7gq8inP9VaR0+xnkr+uNR+FzMVYAaK0LQTPQOTc+Q=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Wt9CkeF3KxiCgjk2OT+ztiC8pGhq0rI+6d6Of8duyov5TDNCmMpk26vmWdGjGwWE4 NOZEPFdUeMTeIKFDnT6Ze8W6XiM57lahm3q0jF0CBm2Ubs35N8h/TPdXRUp4KST3fr 0p/fFuoofnFJcffe6azSOVbOPm0k0Rlhkjh4JQFw= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 467DA3834E7A for ; Wed, 1 Jun 2022 15:55:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 467DA3834E7A Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 251FMa0J000392 for ; Wed, 1 Jun 2022 15:55:46 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gbcahr800-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 01 Jun 2022 15:55:44 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 251FZdhN009468 for ; Wed, 1 Jun 2022 15:55:41 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gc8kh7ea5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 01 Jun 2022 15:55:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IOOtF9yf0OP0F25/K0eNxgPYbNBQ7B2esEGfm60nELYnYfK3/OGfJmn2o0IAId1p/gdKG9BjgSP2yTgdDJlgR46Av6P0MMY0CCzH5na/0W4q5Wi/EWKE+Nr9kOHgTTazIWkAtumL9uRBSXCUpKD2gpOlRZT2DeKsPgFpLmnd9tCAdZpqayFi6q+7ak3I9aIz0udx/Jr7tMHX0W/ns6NcMqKQmYDS6rTSz5shrVz4dZ6TkXnT0AWQdLClSlYwFP0MBq2exunTh7A7vQZNMbG+g/tfbt6oJzwcecGqDC496T6VuVZL9/gZgQm/dCMuf9v9D2RjYb1wkGYoBMo9cLErzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vh7gq8inP9VaR0+xnkr+uNR+FzMVYAaK0LQTPQOTc+Q=; b=KhdBZ3ouTSDGQhkQXDN+lOpzBKR0HyK0i3HZdY9unQaSXYvETYSnoREG5OLkOxlhRSag5Npydm5W2+X8/Wc9UrFVp3pnsoacdd68RhZKx9cDeMsRuav07noEyemtIctSpRm9Gk8AbMalEakdJaEAyVqLllNP5isA3Zr2Q/gbZwkNe2CX271DzKjNkAJksoXB518fazJiKg2STkfGB7lr1Q827uI/vmMtMThBIBTegrdPOaJCsKbYQCqOyCH9/vuPM4dPwERNU6cWPtzLArz4D2T5TZvOEIu5m+FOe16+DrPK9bR9YxbfdpUstUR+PBLvowxlGhv5//45DKbmFwt3oA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by SA2PR10MB4698.namprd10.prod.outlook.com (2603:10b6:806:113::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Wed, 1 Jun 2022 15:55:38 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::5d6c:93b5:dfd8:c058]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::5d6c:93b5:dfd8:c058%4]) with mapi id 15.20.5314.013; Wed, 1 Jun 2022 15:55:38 +0000 To: elfutils-devel@sourceware.org Subject: [PATCHv2] strip: keep .ctf section in stripped file Date: Wed, 1 Jun 2022 10:55:27 -0500 Message-Id: <20220601155527.2192182-1-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: X-ClientProxiedBy: SJ0PR13CA0219.namprd13.prod.outlook.com (2603:10b6:a03:2c1::14) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2615b3a2-5a12-4e36-14f9-08da43e72bca X-MS-TrafficTypeDiagnostic: SA2PR10MB4698:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R0e+Eq4nBEdnTyPdvbAGIaFpI1MdlUJBd9YaWDcqERLsDMXU45/pm5e7SXxa+nhnJ0TCGUS5v6MOpyie046p5ejfBujdsSXX5t6cMXKdbL0IyfO8I721F6CDuj14i2eznnolcS+VOL1OAzImKHSKcXFwCGQFJQJkuDnusLR6nTOiDQojfxpj6kvp6EwK4b7GJ8gkjyD2He+LslE0Vq5VoPmSjQNUrFByj6nQAzq2XtmUnYQ5cZbkqVsiyQ9TFH4GZgY93B7M3rVTo18gGsTmxpZZXbF/p3eA2kZ096dixgkpe47a8jSqW+WZja+DsSb0AU/4NgupDAK3t0P9MbRz9TJ/GWzvjtEUmN0SSZSrZYKcJVvDpmc7oaUliCSUNBU3pCUgc+lJHkDCGxO2KDGlmY6ZZMwPHLHgv+FiQZd1JRJ8r4+caNqoFs0vxjNGwOofp0KIK4zxGfZzPA/yF5YEAYH7X/R+KSkApz3Fc/Ss0p+PELdZGqTWLBrVT+gWQfui5PiMQ9fSrHn5CAZSW7P2IXVXoQwSzgY2ZwCXHEubLdwu81ZMUdW5TLMSYaJs/QhHrr9QsMcj2yFs5E9e185AxPpe6BOPyOYP0Pp0RDldH04J8+qfSYfxTOQLbWg6KTRKc5JjMlLyYQMObJeu4QB6d4aJRvj/5IRnqyXVo0MAUaOOF4Ub6qXrKS+NOFY14EB+6mKrXNeZItWmNitCx1IUFDZVuGW6JK+5/WN7o9CLV6O5GogDLGTPR92/CdKYzpRFL1sUSjhht3So9WYwTMZ5rNNUDWO330zudNyBR0GyJEY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(316002)(6916009)(83380400001)(6666004)(2616005)(6506007)(508600001)(52116002)(107886003)(6512007)(1076003)(186003)(30864003)(103116003)(5660300002)(8936002)(86362001)(2906002)(8676002)(4326008)(38100700002)(36756003)(66476007)(66946007)(66556008)(6486002)(142923001)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: ekrrD2ymdFLSWSmGr6IU08xhd3q8y7iQ6qSF00zEPUyR0nxWcLIYMgW6rUzFPhtYOov+OnLSIUwCtm8GCdv0aYdObAOMmhms0GEO/gZAeiTbx5vx+RPymPXAOh77oKSBadkt661DvOrnVl8BcGEFAoGqg0U6zfcRObOCAMr+SWVQEKMJREYZVPCvF2J8b98cI2didEXt0sbiTKnZl0jq2KqL9fXPLA68s29yJvf8te4Kc3HbiYnxPDdoccbzl4fnWVkGJx6Xkzmz7BhGczSqcXSu4GfK1pq8rFvSVVW0CyaYCO2TwvkVB6ifOWN4QB90cgwVYmxDn22L4gZEWeIXQpqnVxfaYASfvNgleHLCT8Niky8+XWDxGRrmJdspNVM1y6QTdbhXrEmCVtLQ3rkmPUd7TDZPDP9J5TrP6ySD8xSTwCf5t6ijsKzytUCsE7ZYMggaPrd7z9ftfjIKfG63VCiUdVKqiPewRnPya0gZalk/Cpw4bdrZZm6JVPSgF/eZWiDI3mwchRGA1f+4AT9r5/Fjfn9O0G6ER1u8ED2Pl1wOoPHfSBRuPLk5+n+O5nOiA+W29eiGJle1GIu0du+b3I7JXNjj0E+nf1V0xgSPJER4BkI5QZSBzP1SegD2NgPkIv0r0G6T1XefYuKnbDP2Ji4YI0F5YFe4SKGmLw5kd5FSyLYQDPdUJSfv5MbihKAjLRU+rRxarJvqwxYKm2ysoO6u8JLViA5EOrpy0DTd0ZtONV4nEwZCcc58pCRHHnvh0XiEfUiCcsHrupQNYcGU5giEqMSKzKzARWd+K7BGfM0TJpm6rzYNkys+Za1+s4fS/9S3o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72bca X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 15:55:38.1266 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /mrBSZM9CIJoRvjMhSNSrs/ArF7YIDmWxb+cFuErPodH8ks69iSEEzlhz98/UW7Mk3uD432d9gynW5hWshxamSaVuzBnDJJptZzF6uJ2NXA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4698 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-01_05:2022-06-01, 2022-06-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206010072 X-Proofpoint-ORIG-GUID: EdQWOUkjXRX3iLcUxe8CIOZRU5OquHRP X-Proofpoint-GUID: EdQWOUkjXRX3iLcUxe8CIOZRU5OquHRP X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Elfutils-devel" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Cc: "Guillermo E. Martinez" Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" Hello, This is the second version patch to avoid remove the CTF section in stripped files. Changes from v1: - Add description in tests/run-strip-remove-keep-ctf.sh mentioning how to regenerate test input file (testfile-ctf) Please let me know your thoughts. Kind regard, guillermo CTF debug format was designed to be present in stripped files, so this section should not be removed, so a new --remove-ctf option is added to indicate explicitly that .ctf section will be stripped out from binary file. Signed-off-by: Guillermo E. Martinez --- ChangeLog | 23 ++++ libebl/eblsectionstripp.c | 4 +- libebl/libebl.h | 2 +- libelf/elf-knowledge.h | 7 +- libelf/elf32_checksum.c | 2 +- src/elfcmp.c | 4 +- src/strip.c | 71 ++++++++-- tests/Makefile.am | 6 +- tests/run-strip-remove-keep-ctf.sh | 212 +++++++++++++++++++++++++++++ tests/testfile-ctf.bz2 | Bin 0 -> 2620 bytes 10 files changed, 309 insertions(+), 22 deletions(-) create mode 100755 tests/run-strip-remove-keep-ctf.sh create mode 100755 tests/testfile-ctf.bz2 GIT binary patch literal 2620 zcmV-C3d8k6T4*^jL0KkKSvsAgApi-}fB*mg|Ns8~|NH;%|Np=L|N8&`;Z;EeM^^pq z_0HDc|9{{JtX!7+2XAK`U&iEGE>xgo=NORrc=hL znN6sAhp5oWnwbMb5uh|_h-rjrlhgs}sQo1MJx^0Xrh`YQ+J=oiPbkwtrbm=$G=vGJ zC!rXoDDsAY0i#W+kN^Mx0000D05kvq000000000015F4ZMD;NvDD)7?lT9?p27}TA zLlK}F01r?Gni)Mn0B8UJ00E!?007Wv0Fe?yRXVN=#qGAR>(?9?X zJx^01kkdv+Km$RL000dSP|yGX01W^#AOVoj$O9m0qd*M06NGd&)x^;TUA44rNDV3Q z8XD{(SEz0JYYRxvTbFBNLR~OuM)rMC@rI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S>W^k_`8xR!i0g;?HLHGprbti literal 0 HcmV?d00001 base-commit: b8713b3fd0617415c76df8c9da70f8e2f26d3134 diff --git a/ChangeLog b/ChangeLog index f1a14b5c..2b608866 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2022-05-21 Guillermo E. Martinez + + * libebl/eblsectionstripp.c (ebl_section_strip_p): Use + remove_ctf argument. + (SECTION_STRIP_P): Likewise. + * libebl/libebl.h (ebl_section_strip_p): Likewise. + * libelf/elf-knowledge.h (SECTION_STRIP_P): Update macro + definition to use remove_ctf to determine whether .ctf + section is stripped out. + * libelf/elf32_checksum.c (elfw2): Use false value for + remove_ctf parameter. + * src/elfcmp.c (main): Likewise. + * src/strip.c (options): Add --remove-ctf option set by + remove_ctf variable. + (set_remove_special_section_opt): Add new function. + (erratic_special_section_opt): Likewise. + (parse_opt): Parse new --remove-ctf option. + (handle_elf): Adjust .comment and use remove_ctf argument. + * tests/Makefile.am (TEST): Add run-strip-remove-keep-ctf.sh + and testfile-ctf.bz2. + * tests/run-strip-remove-keep-ctf.sh: Add new testcase. + * tests/testfile-ctf.bz2: Add new test harness. + 2022-05-02 Mark Wielaard * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Remove diff --git a/libebl/eblsectionstripp.c b/libebl/eblsectionstripp.c index a5624ffe..f26cc170 100644 --- a/libebl/eblsectionstripp.c +++ b/libebl/eblsectionstripp.c @@ -37,7 +37,7 @@ bool ebl_section_strip_p (Ebl *ebl, const GElf_Shdr *shdr, const char *name, bool remove_comment, - bool only_remove_debug) + bool only_remove_debug, bool remove_ctf) { /* If only debug information should be removed check the name. There is unfortunately no other way. */ @@ -66,5 +66,5 @@ ebl_section_strip_p (Ebl *ebl, const GElf_Shdr *shdr, return false; } - return SECTION_STRIP_P (shdr, name, remove_comment); + return SECTION_STRIP_P (shdr, name, remove_comment, remove_ctf); } diff --git a/libebl/libebl.h b/libebl/libebl.h index 731001d3..067b769e 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -205,7 +205,7 @@ extern bool ebl_relative_reloc_p (Ebl *ebl, int reloc); /* Check whether section should be stripped. */ extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Shdr *shdr, const char *name, - bool remove_comment, bool only_remove_debug); + bool remove_comment, bool only_remove_debug, bool remove_ctf); /* Check if backend uses a bss PLT in this file. */ extern bool ebl_bss_plt_p (Ebl *ebl); diff --git a/libelf/elf-knowledge.h b/libelf/elf-knowledge.h index 6e005fa5..903a0f4f 100644 --- a/libelf/elf-knowledge.h +++ b/libelf/elf-knowledge.h @@ -34,7 +34,7 @@ /* Test whether a section can be stripped or not. */ -#define SECTION_STRIP_P(shdr, name, remove_comment) \ +#define SECTION_STRIP_P(shdr, name, remove_comment, remove_ctf) \ /* Sections which are allocated are not removed. */ \ (((shdr)->sh_flags & SHF_ALLOC) == 0 \ /* We never remove .note sections. */ \ @@ -45,7 +45,10 @@ && strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) != 0\ /* We remove .comment sections only if explicitly told to do so. */\ && (remove_comment \ - || strcmp (name, ".comment") != 0)))) + || strcmp (name, ".comment") != 0) \ + /* We remove .ctf sections only if explicitly told to do so. */\ + && (remove_ctf \ + || strcmp (name, ".ctf") != 0)))) /* Test whether `sh_info' field in section header contains a section diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c index c5f27bbe..190bad7d 100644 --- a/libelf/elf32_checksum.c +++ b/libelf/elf32_checksum.c @@ -105,7 +105,7 @@ elfw2(LIBELFBITS,checksum) (Elf *elf) if (SECTION_STRIP_P (shdr, INTUSE(elf_strptr) (elf, shstrndx, shdr->sh_name), - true)) + true, false)) /* The section can be stripped. Don't use it. */ continue; diff --git a/src/elfcmp.c b/src/elfcmp.c index 21d8d9dc..76f15735 100644 --- a/src/elfcmp.c +++ b/src/elfcmp.c @@ -270,7 +270,7 @@ main (int argc, char *argv[]) sname1 = elf_strptr (elf1, shstrndx1, shdr1->sh_name); } while (scn1 != NULL && shdr1 != NULL - && ebl_section_strip_p (ebl1, shdr1, sname1, true, false)); + && ebl_section_strip_p (ebl1, shdr1, sname1, true, false, false)); GElf_Shdr shdr2_mem; GElf_Shdr *shdr2; @@ -283,7 +283,7 @@ main (int argc, char *argv[]) sname2 = elf_strptr (elf2, shstrndx2, shdr2->sh_name); } while (scn2 != NULL && shdr2 != NULL - && ebl_section_strip_p (ebl2, shdr2, sname2, true, false)); + && ebl_section_strip_p (ebl2, shdr2, sname2, true, false, false)); if (scn1 == NULL || scn2 == NULL || shdr1 == NULL || shdr2 == NULL) break; diff --git a/src/strip.c b/src/strip.c index 452b1279..6f79a1d0 100644 --- a/src/strip.c +++ b/src/strip.c @@ -62,6 +62,7 @@ ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; #define OPT_RELOC_DEBUG 0x103 #define OPT_KEEP_SECTION 0x104 #define OPT_RELOC_DEBUG_ONLY 0x105 +#define OPT_REMOVE_CTF 0x106 /* Definitions of arguments for argp functions. */ @@ -87,6 +88,8 @@ static const struct argp_option options[] = N_("Similar to --reloc-debug-sections, but resolve all trivial relocations between debug sections in place. No other stripping is performed (operation is not reversible, incompatible with -f, -g, --remove-comment and --remove-section)"), 0 }, { "remove-comment", OPT_REMOVE_COMMENT, NULL, 0, N_("Remove .comment section"), 0 }, + { "remove-ctf", OPT_REMOVE_CTF, NULL, 0, + N_("Remove .ctf section"), 0 }, { "remove-section", 'R', "SECTION", 0, N_("Remove the named section. SECTION is an extended wildcard pattern. May be given more than once. Only non-allocated sections can be removed."), 0 }, { "keep-section", OPT_KEEP_SECTION, "SECTION", 0, N_("Keep the named section. SECTION is an extended wildcard pattern. May be given more than once."), 0 }, { "permissive", OPT_PERMISSIVE, NULL, 0, @@ -150,6 +153,9 @@ static bool preserve_dates; /* If true .comment sections will be removed. */ static bool remove_comment; +/* If true .ctf sections will be removed. */ +static bool remove_ctf; + /* If true remove all debug sections. */ static bool remove_debug; @@ -217,6 +223,48 @@ section_name_matches (struct section_pattern *patterns, const char *name) return false; } +static void +set_remove_special_section_opt (const char *arg) +{ + if (fnmatch (arg, ".comment", FNM_EXTMATCH) == 0) + remove_comment = true; + else if (fnmatch (arg, ".ctf", FNM_EXTMATCH) == 0) + remove_ctf = true; +} + +static error_t +erratic_special_section_opt (struct argp_state *state) +{ + int s; + struct { + const char *name; + bool remove; + } special_secs[] = { + { + .name = ".comment", + .remove = remove_comment + }, + { + .name = ".ctf", + .remove = remove_ctf + }, + { + .name = NULL, + } + }; + + for (s = 0; special_secs[s].name; ++s) + if (special_secs[s].remove == true + && section_name_matches (keep_secs, special_secs[s].name)) + { + argp_error (state, + _("cannot both keep and remove %s section"), + special_secs[s].name); + return EINVAL; + } + + return 0; +} int main (int argc, char *argv[]) @@ -325,9 +373,12 @@ parse_opt (int key, char *arg, struct argp_state *state) remove_comment = true; break; + case OPT_REMOVE_CTF: + remove_ctf = true; + break; + case 'R': - if (fnmatch (arg, ".comment", FNM_EXTMATCH) == 0) - remove_comment = true; + set_remove_special_section_opt (arg); add_pattern (&remove_secs, arg); break; @@ -353,13 +404,8 @@ parse_opt (int key, char *arg, struct argp_state *state) break; case ARGP_KEY_SUCCESS: - if (remove_comment == true - && section_name_matches (keep_secs, ".comment")) - { - argp_error (state, - _("cannot both keep and remove .comment section")); - return EINVAL; - } + if (erratic_special_section_opt (state)) + return EINVAL; break; default: @@ -1358,7 +1404,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, all sections which are not used at runtime are stripped out. But there are a few exceptions: - - special sections named ".comment" and ".note" are kept + - special sections named ".comment", ".note" and ".ctf" are kept - OS or architecture specific sections are kept since we might not know how to handle them - if a section is referred to from a section which is not removed @@ -1371,7 +1417,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, if (remove_shdrs ? !(shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) : (ebl_section_strip_p (ebl, &shdr_info[cnt].shdr, shdr_info[cnt].name, remove_comment, - remove_debug) + remove_debug, remove_ctf) || cnt == shstrndx || section_name_matches (remove_secs, shdr_info[cnt].name))) { @@ -1534,7 +1580,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, &shdr_info[scnidx].shdr, shdr_info[scnidx].name, remove_comment, - remove_debug) + remove_debug, + remove_ctf) && ebl_data_marker_symbol (ebl, sym, elf_strptr (elf, shdr_info[cnt].shdr.sh_link, diff --git a/tests/Makefile.am b/tests/Makefile.am index 84c3950a..f30d958e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -197,7 +197,8 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \ msg_tst system-elf-libelf-test \ $(asm_TESTS) run-disasm-bpf.sh run-low_high_pc-dw-form-indirect.sh \ run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \ - run-readelf-dw-form-indirect.sh run-strip-largealign.sh + run-readelf-dw-form-indirect.sh run-strip-largealign.sh \ + run-strip-remove-keep-ctf.sh if !BIARCH export ELFUTILS_DISABLE_BIARCH = 1 @@ -580,7 +581,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-readelf-dw-form-indirect.sh testfile-dw-form-indirect.bz2 \ run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \ testfile_nvidia_linemap.bz2 \ - testfile-largealign.o.bz2 run-strip-largealign.sh + testfile-largealign.o.bz2 run-strip-largealign.sh \ + testfile-ctf.bz2 run-strip-remove-keep-ctf.sh if USE_VALGRIND diff --git a/tests/run-strip-remove-keep-ctf.sh b/tests/run-strip-remove-keep-ctf.sh new file mode 100755 index 00000000..9a4fde72 --- /dev/null +++ b/tests/run-strip-remove-keep-ctf.sh @@ -0,0 +1,212 @@ +#! /bin/sh +# Copyright (C) 2022 Oracle, Inc. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. $srcdir/test-subr.sh + +# - testfile-ctf.c +# int +# main () +# { +# return 0; +# } +# +# gcc -gctf -g -o testfile-ctf testfile-ctf.c +# eu-strip testfile-ctf + +# strip -o output and -f debug files +tempfiles testfile.elf testfile.debug + +# A random 32bit testfile +testfiles testfile-ctf + +# strip should keep .ctf section +echo strip testfile-ctf +testrun ${abs_top_builddir}/src/strip -o testfile.elf -f testfile.debug testfile-ctf +echo elflint testfile.elf +testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf +echo elflint testfile.debug +testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug +echo readelf testfile.elf +testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF +There are 28 section headers, starting at offset 0x31d8: + +Section Headers: +[Nr] Name Type Addr Off Size ES Flags Lk Inf Al +[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 +[ 1] .interp PROGBITS 0000000000400318 00000318 0000001c 0 A 0 0 1 +[ 2] .note.gnu.property NOTE 0000000000400338 00000338 00000020 0 A 0 0 8 +[ 3] .note.ABI-tag NOTE 0000000000400358 00000358 00000020 0 A 0 0 4 +[ 4] .hash HASH 0000000000400378 00000378 00000018 4 A 6 0 8 +[ 5] .gnu.hash GNU_HASH 0000000000400390 00000390 0000001c 0 A 6 0 8 +[ 6] .dynsym DYNSYM 00000000004003b0 000003b0 00000048 24 A 7 1 8 +[ 7] .dynstr STRTAB 00000000004003f8 000003f8 00000038 0 A 0 0 1 +[ 8] .gnu.version GNU_versym 0000000000400430 00000430 00000006 2 A 6 0 2 +[ 9] .gnu.version_r GNU_verneed 0000000000400438 00000438 00000020 0 A 7 1 8 +[10] .rela.dyn RELA 0000000000400458 00000458 00000030 24 A 6 0 8 +[11] .init PROGBITS 0000000000401000 00001000 00000017 0 AX 0 0 4 +[12] .text PROGBITS 0000000000401020 00001020 00000191 0 AX 0 0 16 +[13] .fini PROGBITS 00000000004011b4 000011b4 00000009 0 AX 0 0 4 +[14] .rodata PROGBITS 0000000000402000 00002000 00000004 4 AM 0 0 4 +[15] .eh_frame_hdr PROGBITS 0000000000402004 00002004 00000034 0 A 0 0 4 +[16] .eh_frame PROGBITS 0000000000402038 00002038 000000d8 0 A 0 0 8 +[17] .init_array INIT_ARRAY 0000000000403e40 00002e40 00000008 8 WA 0 0 8 +[18] .fini_array FINI_ARRAY 0000000000403e48 00002e48 00000008 8 WA 0 0 8 +[19] .dynamic DYNAMIC 0000000000403e50 00002e50 000001a0 16 WA 7 0 8 +[20] .got PROGBITS 0000000000403ff0 00002ff0 00000010 8 WA 0 0 8 +[21] .got.plt PROGBITS 0000000000404000 00003000 00000018 8 WA 0 0 8 +[22] .data PROGBITS 0000000000404018 00003018 00000010 0 WA 0 0 8 +[23] .bss NOBITS 0000000000404028 00003028 00000008 0 WA 0 0 1 +[24] .comment PROGBITS 0000000000000000 00003028 0000002a 1 MS 0 0 1 +[25] .ctf PROGBITS 0000000000000000 00003052 00000071 0 0 0 1 +[26] .gnu_debuglink PROGBITS 0000000000000000 000030c4 00000014 0 0 0 4 +[27] .shstrtab STRTAB 0000000000000000 000030d8 000000fd 0 0 0 1 + +EOF +echo readelf testfile.debug +testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF +There are 35 section headers, starting at offset 0xb80: + +Section Headers: +[Nr] Name Type Addr Off Size ES Flags Lk Inf Al +[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 +[ 1] .interp NOBITS 0000000000400318 00000318 0000001c 0 A 0 0 1 +[ 2] .note.gnu.property NOTE 0000000000400338 00000318 00000020 0 A 0 0 8 +[ 3] .note.ABI-tag NOTE 0000000000400358 00000338 00000020 0 A 0 0 4 +[ 4] .hash NOBITS 0000000000400378 00000358 00000018 4 A 6 0 8 +[ 5] .gnu.hash NOBITS 0000000000400390 00000358 0000001c 0 A 6 0 8 +[ 6] .dynsym NOBITS 00000000004003b0 00000358 00000048 24 A 7 1 8 +[ 7] .dynstr NOBITS 00000000004003f8 00000358 00000038 0 A 0 0 1 +[ 8] .gnu.version NOBITS 0000000000400430 00000358 00000006 2 A 6 0 2 +[ 9] .gnu.version_r NOBITS 0000000000400438 00000358 00000020 0 A 7 1 8 +[10] .rela.dyn NOBITS 0000000000400458 00000358 00000030 24 A 6 0 8 +[11] .init NOBITS 0000000000401000 00000358 00000017 0 AX 0 0 4 +[12] .text NOBITS 0000000000401020 00000360 00000191 0 AX 0 0 16 +[13] .fini NOBITS 00000000004011b4 00000360 00000009 0 AX 0 0 4 +[14] .rodata NOBITS 0000000000402000 00000360 00000004 4 AM 0 0 4 +[15] .eh_frame_hdr NOBITS 0000000000402004 00000360 00000034 0 A 0 0 4 +[16] .eh_frame NOBITS 0000000000402038 00000360 000000d8 0 A 0 0 8 +[17] .init_array NOBITS 0000000000403e40 00000360 00000008 8 WA 0 0 8 +[18] .fini_array NOBITS 0000000000403e48 00000360 00000008 8 WA 0 0 8 +[19] .dynamic NOBITS 0000000000403e50 00000360 000001a0 16 WA 7 0 8 +[20] .got NOBITS 0000000000403ff0 00000360 00000010 8 WA 0 0 8 +[21] .got.plt NOBITS 0000000000404000 00000360 00000018 8 WA 0 0 8 +[22] .data NOBITS 0000000000404018 00000360 00000010 0 WA 0 0 8 +[23] .bss NOBITS 0000000000404028 00000360 00000008 0 WA 0 0 1 +[24] .comment NOBITS 0000000000000000 00000360 0000002a 1 MS 0 0 1 +[25] .ctf NOBITS 0000000000000000 00000360 00000071 0 0 0 1 +[26] .debug_aranges PROGBITS 0000000000000000 00000360 00000030 0 0 0 1 +[27] .debug_info PROGBITS 0000000000000000 00000390 00000054 0 0 0 1 +[28] .debug_abbrev PROGBITS 0000000000000000 000003e4 00000038 0 0 0 1 +[29] .debug_line PROGBITS 0000000000000000 0000041c 0000004f 0 0 0 1 +[30] .debug_str PROGBITS 0000000000000000 0000046b 0000005f 1 MS 0 0 1 +[31] .debug_line_str PROGBITS 0000000000000000 000004ca 0000001c 1 MS 0 0 1 +[32] .symtab SYMTAB 0000000000000000 000004e8 00000378 24 33 20 8 +[33] .strtab STRTAB 0000000000000000 00000860 000001cb 0 0 0 1 +[34] .shstrtab STRTAB 0000000000000000 00000a2b 0000014e 0 0 0 1 + +EOF + +# gcc -gctf -g -o testfile-ctf testfile-ctf.c +# eu-strip --remove-ctf testfile-ctf + +# Explicitly removes .ctf section +echo strip --remove-ctf testfile-ctf +testrun ${abs_top_builddir}/src/strip --remove-ctf -o testfile.elf -f testfile.debug testfile-ctf +echo elflint testfile.elf +testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf +echo elflint testfile.debug +testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug +echo readelf testfile.elf +testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF +There are 27 section headers, starting at offset 0x3160: + +Section Headers: +[Nr] Name Type Addr Off Size ES Flags Lk Inf Al +[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 +[ 1] .interp PROGBITS 0000000000400318 00000318 0000001c 0 A 0 0 1 +[ 2] .note.gnu.property NOTE 0000000000400338 00000338 00000020 0 A 0 0 8 +[ 3] .note.ABI-tag NOTE 0000000000400358 00000358 00000020 0 A 0 0 4 +[ 4] .hash HASH 0000000000400378 00000378 00000018 4 A 6 0 8 +[ 5] .gnu.hash GNU_HASH 0000000000400390 00000390 0000001c 0 A 6 0 8 +[ 6] .dynsym DYNSYM 00000000004003b0 000003b0 00000048 24 A 7 1 8 +[ 7] .dynstr STRTAB 00000000004003f8 000003f8 00000038 0 A 0 0 1 +[ 8] .gnu.version GNU_versym 0000000000400430 00000430 00000006 2 A 6 0 2 +[ 9] .gnu.version_r GNU_verneed 0000000000400438 00000438 00000020 0 A 7 1 8 +[10] .rela.dyn RELA 0000000000400458 00000458 00000030 24 A 6 0 8 +[11] .init PROGBITS 0000000000401000 00001000 00000017 0 AX 0 0 4 +[12] .text PROGBITS 0000000000401020 00001020 00000191 0 AX 0 0 16 +[13] .fini PROGBITS 00000000004011b4 000011b4 00000009 0 AX 0 0 4 +[14] .rodata PROGBITS 0000000000402000 00002000 00000004 4 AM 0 0 4 +[15] .eh_frame_hdr PROGBITS 0000000000402004 00002004 00000034 0 A 0 0 4 +[16] .eh_frame PROGBITS 0000000000402038 00002038 000000d8 0 A 0 0 8 +[17] .init_array INIT_ARRAY 0000000000403e40 00002e40 00000008 8 WA 0 0 8 +[18] .fini_array FINI_ARRAY 0000000000403e48 00002e48 00000008 8 WA 0 0 8 +[19] .dynamic DYNAMIC 0000000000403e50 00002e50 000001a0 16 WA 7 0 8 +[20] .got PROGBITS 0000000000403ff0 00002ff0 00000010 8 WA 0 0 8 +[21] .got.plt PROGBITS 0000000000404000 00003000 00000018 8 WA 0 0 8 +[22] .data PROGBITS 0000000000404018 00003018 00000010 0 WA 0 0 8 +[23] .bss NOBITS 0000000000404028 00003028 00000008 0 WA 0 0 1 +[24] .comment PROGBITS 0000000000000000 00003028 0000002a 1 MS 0 0 1 +[25] .gnu_debuglink PROGBITS 0000000000000000 00003054 00000014 0 0 0 4 +[26] .shstrtab STRTAB 0000000000000000 00003068 000000f8 0 0 0 1 + +EOF +echo readelf testfile.debug +testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF +There are 35 section headers, starting at offset 0xbf0: + +Section Headers: +[Nr] Name Type Addr Off Size ES Flags Lk Inf Al +[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 +[ 1] .interp NOBITS 0000000000400318 00000318 0000001c 0 A 0 0 1 +[ 2] .note.gnu.property NOTE 0000000000400338 00000318 00000020 0 A 0 0 8 +[ 3] .note.ABI-tag NOTE 0000000000400358 00000338 00000020 0 A 0 0 4 +[ 4] .hash NOBITS 0000000000400378 00000358 00000018 4 A 6 0 8 +[ 5] .gnu.hash NOBITS 0000000000400390 00000358 0000001c 0 A 6 0 8 +[ 6] .dynsym NOBITS 00000000004003b0 00000358 00000048 24 A 7 1 8 +[ 7] .dynstr NOBITS 00000000004003f8 00000358 00000038 0 A 0 0 1 +[ 8] .gnu.version NOBITS 0000000000400430 00000358 00000006 2 A 6 0 2 +[ 9] .gnu.version_r NOBITS 0000000000400438 00000358 00000020 0 A 7 1 8 +[10] .rela.dyn NOBITS 0000000000400458 00000358 00000030 24 A 6 0 8 +[11] .init NOBITS 0000000000401000 00000358 00000017 0 AX 0 0 4 +[12] .text NOBITS 0000000000401020 00000360 00000191 0 AX 0 0 16 +[13] .fini NOBITS 00000000004011b4 00000360 00000009 0 AX 0 0 4 +[14] .rodata NOBITS 0000000000402000 00000360 00000004 4 AM 0 0 4 +[15] .eh_frame_hdr NOBITS 0000000000402004 00000360 00000034 0 A 0 0 4 +[16] .eh_frame NOBITS 0000000000402038 00000360 000000d8 0 A 0 0 8 +[17] .init_array NOBITS 0000000000403e40 00000360 00000008 8 WA 0 0 8 +[18] .fini_array NOBITS 0000000000403e48 00000360 00000008 8 WA 0 0 8 +[19] .dynamic NOBITS 0000000000403e50 00000360 000001a0 16 WA 7 0 8 +[20] .got NOBITS 0000000000403ff0 00000360 00000010 8 WA 0 0 8 +[21] .got.plt NOBITS 0000000000404000 00000360 00000018 8 WA 0 0 8 +[22] .data NOBITS 0000000000404018 00000360 00000010 0 WA 0 0 8 +[23] .bss NOBITS 0000000000404028 00000360 00000008 0 WA 0 0 1 +[24] .comment NOBITS 0000000000000000 00000360 0000002a 1 MS 0 0 1 +[25] .ctf PROGBITS 0000000000000000 00000360 00000071 0 0 0 1 +[26] .debug_aranges PROGBITS 0000000000000000 000003d1 00000030 0 0 0 1 +[27] .debug_info PROGBITS 0000000000000000 00000401 00000054 0 0 0 1 +[28] .debug_abbrev PROGBITS 0000000000000000 00000455 00000038 0 0 0 1 +[29] .debug_line PROGBITS 0000000000000000 0000048d 0000004f 0 0 0 1 +[30] .debug_str PROGBITS 0000000000000000 000004dc 0000005f 1 MS 0 0 1 +[31] .debug_line_str PROGBITS 0000000000000000 0000053b 0000001c 1 MS 0 0 1 +[32] .symtab SYMTAB 0000000000000000 00000558 00000378 24 33 20 8 +[33] .strtab STRTAB 0000000000000000 000008d0 000001cb 0 0 0 1 +[34] .shstrtab STRTAB 0000000000000000 00000a9b 0000014e 0 0 0 1 + +EOF + +exit 0 diff --git a/tests/testfile-ctf.bz2 b/tests/testfile-ctf.bz2 new file mode 100755 index 0000000000000000000000000000000000000000..f48bb9304f1e2194500f5091dbb3aa1a7b8806cc