From patchwork Tue Nov 3 10:25:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 11876651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24E14C388F2 for ; Tue, 3 Nov 2020 10:27:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8968222404 for ; Tue, 3 Nov 2020 10:27:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BPTrbK8i"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="Eq8WzEuB"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="Eq8WzEuB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8968222404 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Gh4iYbAJnzqalqY+FcTZJPm9+cL385tB120BCtDJcms=; b=BPTrbK8iwod07n8E5Q6Xu3Nhx +IWawggV8rkeHIHVTUKB4jEASgFqvVy0DH/sbGJ7Nt4OgoebInhcLcCCgDxqslBoM3VwH3tMvWqUz HVojzRgAM+BeRDnVxXXeZZBVFTOpkBfUcxdUlOznL+MaeT/xAxKCKeyueSnP+WWrrriiY91w34ZRn TSecHxMz96UqtWR2LBxU97PQMalCp0sTWmVXris4tqhBgeQ3I+wIwUqrPA6BxrYJmYUgjNzJQ1xAX sg2M3ZnobZGduSufm8fgvc8LO71+bIWGsTqBGoAuE5WqA92Rt/w/zDoQxZcLOSyj4EKhorWUMLDxk TU0PnsFLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtWQ-0008UI-0g; Tue, 03 Nov 2020 10:26:38 +0000 Received: from mail-eopbgr20045.outbound.protection.outlook.com ([40.107.2.45] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtWL-0008Sk-05 for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 10:26:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DA/uKEqYFIqv4yw/4vuKz0cdGhH9H2bnFuZnjVQ/Wbc=; b=Eq8WzEuB0TdDN9OLkTfgMfcLPE7sk9093wOs04dOGlFUd4eVfBKaQmommKTwuFZUUNS2wAKy6uRVxz32FZSGlegzEax/rIE2WhQfS8sLr25mxqDgTgPNkW0N0kSBGu5rO0vP7zhvvdou9rQjIGDMW1B5nKVGuEGPb5yVTUFnNAI= Received: from AM5PR0301CA0018.eurprd03.prod.outlook.com (2603:10a6:206:14::31) by DB6PR0802MB2199.eurprd08.prod.outlook.com (2603:10a6:4:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19; Tue, 3 Nov 2020 10:26:27 +0000 Received: from VE1EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:14:cafe::fb) by AM5PR0301CA0018.outlook.office365.com (2603:10a6:206:14::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Tue, 3 Nov 2020 10:26:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.infradead.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.infradead.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT014.mail.protection.outlook.com (10.152.19.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Tue, 3 Nov 2020 10:26:25 +0000 Received: ("Tessian outbound c579d876a324:v64"); Tue, 03 Nov 2020 10:26:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1b7fbd5d4e494ead X-CR-MTA-TID: 64aa7808 Received: from 66201f25bafa.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AE9A3D34-34A3-44BD-8767-015AE47FD291.1; Tue, 03 Nov 2020 10:26:14 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 66201f25bafa.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 Nov 2020 10:26:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKyYgGMMKnI/dqhwGwOJ83t3I8qrN2728qtg6W6pgxyVz43txLL5KiRmC8aYXkqX40vaLyJnB9scgmb/1zfVv+1gFsafEaGWJarKMJNyvJpmVHJ22JegV/Wq+vbYLX6ensCQU/XkgN6OZJk1zit2nGbkQybbGCBpMeY6+n2iMPpuo8dd6K+mdB0w6/mTftgPBGp1bxe6HfwkOwVi8no5dicCqDeWJU+qEpmbNZPtcCua45ksq2FCEcoEznLVlb2c4EZy1YbkFJBMxlPkABZoRZ1EMEnHI4q06dX/PWRmNdPYi6PyDJAOISi9AeZtglV6qmMJDomeLKfl+6LOSIrLxw== 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-SenderADCheck; bh=DA/uKEqYFIqv4yw/4vuKz0cdGhH9H2bnFuZnjVQ/Wbc=; b=Ki24zoZFsLrzrB/EJMZn407u9N0uDZdI7wCXYcogz4RwNpVa4kHUWH6nBLNlJJqZEbmxLN75FX7loYhTR30UwqgC/dPOOwSazJUeJM4nse0IAmtFftgJhahMdpQmbzQWarQ+YODYT8iu7vtDjPT5UiZ9w+FU1W4+6IhPeQ2aSWMKg79it2Ckl6gEAMDyH6AwmsC5U26SlMOgqJHWVKvehKKf0WII47+/s7AQL0+dptFfk40RuI1SojpfxQTEnjGfBF7egUDSdIV0fIeT1+YM9M2suCcmewzvwzRydXStJJ2Q6KshIbve5L0C4CFUl2s4VW7b6iuBS63CBYRrAELgvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DA/uKEqYFIqv4yw/4vuKz0cdGhH9H2bnFuZnjVQ/Wbc=; b=Eq8WzEuB0TdDN9OLkTfgMfcLPE7sk9093wOs04dOGlFUd4eVfBKaQmommKTwuFZUUNS2wAKy6uRVxz32FZSGlegzEax/rIE2WhQfS8sLr25mxqDgTgPNkW0N0kSBGu5rO0vP7zhvvdou9rQjIGDMW1B5nKVGuEGPb5yVTUFnNAI= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PA4PR08MB6223.eurprd08.prod.outlook.com (2603:10a6:102:e8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Tue, 3 Nov 2020 10:26:12 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792%3]) with mapi id 15.20.3499.032; Tue, 3 Nov 2020 10:26:12 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 1/4] elf: Pass the fd to note processing [BZ #26831] Date: Tue, 3 Nov 2020 10:25:58 +0000 Message-Id: <31936e4acedb265ad49d04f7789bef09d6578448.1604393169.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: SN6PR05CA0019.namprd05.prod.outlook.com (2603:10b6:805:de::32) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.54) by SN6PR05CA0019.namprd05.prod.outlook.com (2603:10b6:805:de::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.10 via Frontend Transport; Tue, 3 Nov 2020 10:26:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a064e2d4-5d2c-415f-b4c9-08d87fe2eaf7 X-MS-TrafficTypeDiagnostic: PA4PR08MB6223:|DB6PR0802MB2199: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: AaxZiJ7jdnYp8oYD2ZDBf5QY4DECjO04ey3y7RDl0oTDJTGmqCY+xJtoeab1SQ/opSeIsmOdH95B6FXKdajRMViBb6frjEKss63aZKt6svL+EwUnYdDYtQa9c+GZsbJJhRzQzQxLR500HnSBqbA1vqByjX1zi4EWyFnhAwsrHgOoVYuiSW3qC+pHZrMbnyd/YdqiVcv8tIP9ZUtNWc3Qs7W6rVqSo4fr93kioTeb+kgoYW5D2ysQFwTyhqtgBSvbMGNqdna38Kk6x1cZC3ts6J9vxdHxltY8oD2I0wznGuA5cvBr2sP4vBTAk4UGe7B2VkNJwFCYd6nBmyrFT5o99pVug4VYnL5i03uDM78aIdLVY85JdEF+I2l1GkHqHl8v X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(346002)(136003)(366004)(5660300002)(2906002)(66556008)(6506007)(8676002)(66946007)(478600001)(54906003)(66476007)(6666004)(6486002)(4326008)(6916009)(6512007)(69590400008)(186003)(16526019)(2616005)(7416002)(36756003)(956004)(8936002)(86362001)(44832011)(83380400001)(52116002)(316002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sDODfNVK6I1Y/maSwD9fiqG+WsIIHDnTIDBUyAnsUO3P9ydzjO8R2e3ZHV6s3M+/aeO8WwB5dyZpuEa+CnFqYwJf4+df5QhbII+ZXY7FEAQsH120aHjz1GRbFAv3ftwh2udUaQbBtzWZDCPjNCPl6SMgucF2FCyXAIj/PaGF5skh/5+mhok/QsBP1LHtQhdk9y18xLf30TZXUCcZ5mcjrFe6viDgSWbjvB6R2rhHqtS/iTOixIa/KWzSoIdaY5Lo9cfss+5D5FGaycYr4sderddscABk9SD1cOGahFxf8a7lERQpCQMSyVSpv4mWweFo811P3SAFTrQu1GXFk77hQnIVMj7eoydL/vzATdYpc1i44otgFkMGkRJQy2lH4wjaX7BvApHbxoEvsUQ5S9ky+Bvx45tzPIh2dSNn8kv794dojyEOU8nv8MJg5uKyRcEF3DhFJlbtNbeRJfTVxiD/qtOcALiPGhprsvxXMOfuxgIU5xgsdW341fhSywjjnAxIeaIsLrSgy6obGJAfnq61CWIM3NJ5FT41eRnZbEeL3+k9Y2WT62vRWY21dKX4Jfw0niZ7luXX8KNJvBt+lKNXLyqotlGjHZnfeK/ZIGJUKilvH3VSP5DdgjG4UecSp0rC9GAEHFkWIDbmHAv17cVF0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6223 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 8914356f-c88b-4471-257d-08d87fe2e2d7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rfRITbndBEjVhmJlCixOh5FDm8YUxJ/G7eH2e9Fe6n8z1quF/b86Q8jz1nZu257NlfYCZAMynXMylER6/n5K9tVJMO4sz88gUXcc4kmNSLGZph+tmBDgrWMa69Xl6+gQ8ZEwbqm5Hee86urFKJEXTo5oAma/ryLSw13k+BTbhUzPt3B8cvVS+kjQRQDExtDzsNGfOWcSbI83TFehqF4k7gpn9pNy07nuJoKjJ+L+YapfENANeozNyTpfttYItv9hTIXQDIhwLOW2Hh1cBy+ksCRwjI5UJrZYjWPnu4lysX4OZfVWgU+G8/cYrn41sGQDuObBEnutMwiRNEFMfwzSsPyD7pj96qvYuQU555/i8yzAexeKXTyT1ZFJRhqjaonxKoTSwA+0eB+u3MUQC0/7D3l6RUSmMcZs+diXOxI5peuv/kkXREr9Vf4cKaAD4ZVB X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(376002)(396003)(39860400002)(136003)(346002)(46966005)(36906005)(316002)(34206002)(6512007)(336012)(8936002)(956004)(69590400008)(5660300002)(107886003)(83380400001)(54906003)(82310400003)(356005)(2616005)(86362001)(6506007)(44832011)(82740400003)(6666004)(70586007)(47076004)(26005)(36756003)(2906002)(16526019)(6486002)(186003)(81166007)(4326008)(70206006)(478600001)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 10:26:25.2114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a064e2d4-5d2c-415f-b4c9-08d87fe2eaf7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2199 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_052634_171505_3A169BDB X-CRM114-Status: GOOD ( 17.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Florian Weimer , Kees Cook , kernel-hardening@lists.openwall.com, Salvatore Mesoraca , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Jeremy Linton , Mark Brown , Lennart Poettering , linux-hardening@vger.kernel.org, Topi Miettinen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To handle GNU property notes on aarch64 some segments need to be mmaped again, so the fd of the loaded ELF module is needed. When the fd is not available (kernel loaded modules), then -1 is passed. The fd is passed to both _dl_process_pt_gnu_property and _dl_process_pt_note for consistency. Target specific note processing functions are updated accordingly. --- elf/dl-load.c | 12 +++++++----- elf/rtld.c | 4 ++-- sysdeps/aarch64/dl-prop.h | 6 +++--- sysdeps/generic/dl-prop.h | 6 +++--- sysdeps/generic/ldsodefs.h | 5 +++-- sysdeps/x86/dl-prop.h | 6 +++--- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index f3201e7c14..ceaab7f18e 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -861,10 +861,12 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, /* Process PT_GNU_PROPERTY program header PH in module L after PT_LOAD segments are mapped. Only one NT_GNU_PROPERTY_TYPE_0 - note is handled which contains processor specific properties. */ + note is handled which contains processor specific properties. + FD is -1 for the kernel mapped main executable otherwise it is + the fd used for loading module L. */ void -_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) +_dl_process_pt_gnu_property (struct link_map *l, int fd, const ElfW(Phdr) *ph) { const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); const ElfW(Addr) size = ph->p_memsz; @@ -911,7 +913,7 @@ _dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph) last_type = type; /* Target specific property processing. */ - if (_dl_process_gnu_property (l, type, datasz, ptr) == 0) + if (_dl_process_gnu_property (l, fd, type, datasz, ptr) == 0) return; /* Check the next property item. */ @@ -1266,10 +1268,10 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, switch (ph[-1].p_type) { case PT_NOTE: - _dl_process_pt_note (l, &ph[-1]); + _dl_process_pt_note (l, fd, &ph[-1]); break; case PT_GNU_PROPERTY: - _dl_process_pt_gnu_property (l, &ph[-1]); + _dl_process_pt_gnu_property (l, fd, &ph[-1]); break; } } diff --git a/elf/rtld.c b/elf/rtld.c index 5d117d0d2c..6ba918338b 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1531,10 +1531,10 @@ dl_main (const ElfW(Phdr) *phdr, switch (ph[-1].p_type) { case PT_NOTE: - _dl_process_pt_note (main_map, &ph[-1]); + _dl_process_pt_note (main_map, -1, &ph[-1]); break; case PT_GNU_PROPERTY: - _dl_process_pt_gnu_property (main_map, &ph[-1]); + _dl_process_pt_gnu_property (main_map, -1, &ph[-1]); break; } diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h index b0785bda83..2016d1472e 100644 --- a/sysdeps/aarch64/dl-prop.h +++ b/sysdeps/aarch64/dl-prop.h @@ -35,13 +35,13 @@ _dl_open_check (struct link_map *m) } static inline void __attribute__ ((always_inline)) -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph) { } static inline int -_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, - void *data) +_dl_process_gnu_property (struct link_map *l, int fd, uint32_t type, + uint32_t datasz, void *data) { if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h index f1cf576fe3..df27ff8e6a 100644 --- a/sysdeps/generic/dl-prop.h +++ b/sysdeps/generic/dl-prop.h @@ -37,15 +37,15 @@ _dl_open_check (struct link_map *m) } static inline void __attribute__ ((always_inline)) -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph) { } /* Called for each property in the NT_GNU_PROPERTY_TYPE_0 note of L, processing of the properties continues until this returns 0. */ static inline int __attribute__ ((always_inline)) -_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, - void *data) +_dl_process_gnu_property (struct link_map *l, int fd, uint32_t type, + uint32_t datasz, void *data) { return 0; } diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 382eeb9be0..702cb0f488 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -925,8 +925,9 @@ extern void _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting); /* Process PT_GNU_PROPERTY program header PH in module L after - PT_LOAD segments are mapped. */ -void _dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph); + PT_LOAD segments are mapped from file FD. */ +void _dl_process_pt_gnu_property (struct link_map *l, int fd, + const ElfW(Phdr) *ph); /* Search loaded objects' symbol tables for a definition of the symbol diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h index 89911e19e2..4eb3b85a7b 100644 --- a/sysdeps/x86/dl-prop.h +++ b/sysdeps/x86/dl-prop.h @@ -145,15 +145,15 @@ _dl_process_cet_property_note (struct link_map *l, } static inline void __attribute__ ((unused)) -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph) { const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); _dl_process_cet_property_note (l, note, ph->p_memsz, ph->p_align); } static inline int __attribute__ ((always_inline)) -_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz, - void *data) +_dl_process_gnu_property (struct link_map *l, int fd, uint32_t type, + uint32_t datasz, void *data) { return 0; } From patchwork Tue Nov 3 10:26:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 11876655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F09C2D0A3 for ; Tue, 3 Nov 2020 10:28:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19E4A206C0 for ; Tue, 3 Nov 2020 10:28:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="r0m9bHRh"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="QXrFOriD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="QXrFOriD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19E4A206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BFV8ns+e5uVuQ47pqNwYTP4X355r2xvlaYU53Xkknh4=; b=r0m9bHRhhkyP80vlKIML1xLB9 YB5Rgn/0vEUKriRfuA9OZouJ7QkeJidTfAgLQlMUk7tT0qzl8gnATY4FJut79worvu5oKSuw3H0yn gn/IW/lB0kDTBdskGG5BCw8umpLyBv3UDJ4x91Xsdm9CT0tQrRMdtF4Ykt3FMWXjq9a+LWX04x92o RHOE2pm4j5TZyWiDtL2YpfESAndK0hiApp+eKvjvTuYzU1VsqtoYVL1H0Wzdxg40ZK2/LaHVaksJb GGKaO1UuSRqxGEsi9yMOK/Hp2hLAxmBZC2AAjrr2I2sHCl4WzbZNy1jvo/V05Z3A0f6NZpcweNd0v zxyMfH4xg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtXB-0000Px-OK; Tue, 03 Nov 2020 10:27:25 +0000 Received: from mail-eopbgr50073.outbound.protection.outlook.com ([40.107.5.73] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtX2-0000ML-3X for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 10:27:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b2LGHS8npIN3aGe1xT1kK15btQCbisIo7d+nrOmvXU0=; b=QXrFOriDF8wUheK7MPfvfeNpEH5ELxFAciGJK9mtZw877QqT1v4kBtmz/rIsCucC8BaXJLunnRK6eU90XShkRxr7hIeyreKnYWWO+ofdush/D+chVhPDHg7V7gnn5QuXWvxmZkjPctPhULOjq6n3aWMukjTu9CG0nJ0uKSMk3JQ= Received: from DB6PR0501CA0028.eurprd05.prod.outlook.com (2603:10a6:4:67::14) by VI1PR08MB3568.eurprd08.prod.outlook.com (2603:10a6:803:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Tue, 3 Nov 2020 10:27:12 +0000 Received: from DB5EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:67:cafe::13) by DB6PR0501CA0028.outlook.office365.com (2603:10a6:4:67::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 3 Nov 2020 10:27:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.infradead.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.infradead.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT052.mail.protection.outlook.com (10.152.21.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Tue, 3 Nov 2020 10:27:12 +0000 Received: ("Tessian outbound c189680f801b:v64"); Tue, 03 Nov 2020 10:27:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e0d9a8a02e872d3c X-CR-MTA-TID: 64aa7808 Received: from f565e3fc67ad.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 02DAA500-AAB5-4231-B5C5-DC82B94A7B7D.1; Tue, 03 Nov 2020 10:26:36 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f565e3fc67ad.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 Nov 2020 10:26:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FtiHxDxxfzlr3GOl7v7ohQxZsttt8jyMnW2iPZo+swkeyJLYuABDoPECRMJvMxx+b8D3VfhSi0VVAVHcpePw8ts/FARFieIdXAdyxXaK2BGFXaHr40DzyZn0/AT7MtOJ0yOM5c8Jx5sTwyB+ZfNJzORBnyWQCZIeN0tpfbbv/Dj873e8fSD4rwlUn7WvzL2t3DtJ9nmToXLWlZ2xxtXOYdvaXHTjInLXf7Tr+VgFqH61EMR7VAc+P+HAmtFCE2ewlrrH7WMIOi/XTEOely+TuVWxH5/0kE6KqUSAqRERaf+6Hl0DFbbvqi0PvVnPH1JO0DvmV6WggYs3dwv65MvIvw== 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-SenderADCheck; bh=b2LGHS8npIN3aGe1xT1kK15btQCbisIo7d+nrOmvXU0=; b=JXLlGTTIQsLfRgj2xwkObOaTy3ON/PNARxRB1jdYLzxVJbpIsnUT0aRf5WGeZ7BKuqPg3i2I9WvDs+wVg3ZL/zpacIEct7RAJb8UuI/oBCJ8A7U4f6RmPqX8iyWt50Ml8TLNQjm1p/osQ4QcGQMaUrEK2V0UMcM2gwOjkpAXy3N2wQaLLsvxE/u4FJPS/09gyJP1Yy5IeuSR6CwYC1TO53qcSrfeKXNkgpNJNkmE911BtRX78JFDG6rjnUVl7IA8UiWC3X0THxWqVKNwx9akmgTAz9nFr7KBWclV/EY6ut1Ot0ygBTo1GoFzricQdfwVP2W2djNWKDKfjBV9dETc1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b2LGHS8npIN3aGe1xT1kK15btQCbisIo7d+nrOmvXU0=; b=QXrFOriDF8wUheK7MPfvfeNpEH5ELxFAciGJK9mtZw877QqT1v4kBtmz/rIsCucC8BaXJLunnRK6eU90XShkRxr7hIeyreKnYWWO+ofdush/D+chVhPDHg7V7gnn5QuXWvxmZkjPctPhULOjq6n3aWMukjTu9CG0nJ0uKSMk3JQ= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PA4PR08MB6285.eurprd08.prod.outlook.com (2603:10a6:102:e0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Tue, 3 Nov 2020 10:26:24 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792%3]) with mapi id 15.20.3499.032; Tue, 3 Nov 2020 10:26:24 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 2/4] elf: Move note processing after l_phdr is updated [BZ #26831] Date: Tue, 3 Nov 2020 10:26:18 +0000 Message-Id: <7b008fd34f802456db3731a043ff56683b569ff7.1604393169.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P265CA0022.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::34) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.54) by LO2P265CA0022.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 3 Nov 2020 10:26:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 99825235-1f94-4516-9af7-08d87fe306bc X-MS-TrafficTypeDiagnostic: PA4PR08MB6285:|VI1PR08MB3568: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mlsiUh61bx5Crih3vA2Z4JW+a2wt3QsdhbSpnZqOyjqsM63KVmxW5XOr1X2TO3Dg1A9F/A/uNYels5NAdSLyJluaktIENrR8gRfaBbqFCjaXvg3Pr5iC9e1MFZzuDweG77qkYBvFpBgkhUuhUgmBaXdZVVG72PYO/tGE/mH+Ylhfe1YQcx1NTEsXSEGjFF5W65uAE3NjKpyWd2AY/T5lqqC+hdmimbYhOzU+uGgyPPFHS5MpKCl/vzUZ0TL1VGoR2vL2LZ+gu7viXGw9n3Dv1bx4tMYcrBFXB8lM92XEKjgA/g7mC2kQzxq4N7Swh6qgb3PwXYuRYp6ztJKEOlrv52Fke7/qLOZNWoPac2G0n1Gf34OgqdO8G6whwM1MgiDG X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(39860400002)(136003)(396003)(366004)(6506007)(36756003)(186003)(54906003)(478600001)(8936002)(6916009)(52116002)(316002)(4326008)(16526019)(26005)(69590400008)(86362001)(5660300002)(2616005)(44832011)(7416002)(956004)(8676002)(66476007)(66556008)(6512007)(83380400001)(6486002)(2906002)(6666004)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: m4/1TbY0scBRHWKeDmS23Ck/0jdSOWYCIpsJxujIy6Qhy5erw+FUqpuGY6k6Fqu8Z3r7jDCYMIhiJMlAZujBIULCskECo5/w5OxdqeHez9ZOFIrOWgJ1WcLJ4UxkK/8pHeE+HXr5xX4gJuoyOfhMNksHGc7kq2kENAuW+hThVJVx9HtsNa2V5MwT7m8I9JB03lS5o2ch7TM8TeYANislqEWiGxevhdEflqSTa7qqm9XgyjbFFMo29TZO/UG7cqoyXB08Q2nLLNqMIKdTyRQdpBAlyL1n1mCi3gxvXc1/cXmx8j5aBJHvFCuNrxAMqws4FAyHERpLdAXNtPwSGOAezm9WpTnuA0nawC/SWVR/fBLVt9BobCUCEK2wyqKDG5z0xbHWFcpLFOMfweXNoV3vkO1JCQHad2kbnmqTmFX03jyzKBC/2LK7X/EOuHXEk2zFoHWVPAxy99VHwM5i0j45YmA9m82ZdYmbxOLdWvlBtPa/SbuGJAiRhyxImq2X6bmkMHNjKG6O7m3Q/n0hMX5vsA/xIERm9cSk8gWUKQbaMhDEtn2Y9oBCzg0iqOWlyr9K3dDoAgG09PDcMG+uaMtq+wyGDP3FlBoj9DXHYvTRgFBTITKiyRAKR0lR7JoRnTYz7i//qDcF3Vt6153BFqUFcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6285 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a88b4fed-4a14-4294-4b4f-08d87fe2ea23 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zqev3sTbQPzUnC/XjB5lx1wnXKoZnT5RUapxLPbNXqOyWhOLC1/Z5DnSh2mF6fnzmUgYB2mo0ckP8/mfstRnGZbTqF03pSBmdet58vN+PvAx71O2efs9XhYxjLSfWAOu4WeM41YOX87K3Lk1WKZNLRpwj1D0nEk2ZI9Huvnn5xZfuRc3dkDw4ogqfYJlUkF0LHVjgUtVO94AnI6LbZ2ccq9Nq1CO0cJpKGEsPT4zuHZq3gSAPkvBmrjMjDHZrlGukA97Mh50j+42rY5kq68245oyaHuC9KNyyAmy+usNwIO8Ls2jzl//gwyG7ItDlmLGYBGu66FM4mtfWrjAI2AoI7o7ew3SJrX62URyqx1jYN5E9xuh42fL2E249DJWMukQ98iI/5ORY5Am63k8pMN/9UyldAjfjjxAQDVxph5wTLQ= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39860400002)(346002)(376002)(396003)(136003)(46966005)(47076004)(6486002)(186003)(8676002)(478600001)(956004)(70206006)(70586007)(4326008)(54906003)(69590400008)(81166007)(82310400003)(8936002)(26005)(36756003)(82740400003)(83380400001)(16526019)(356005)(316002)(107886003)(2906002)(86362001)(6506007)(6512007)(2616005)(6666004)(34206002)(44832011)(5660300002)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 10:27:12.0172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99825235-1f94-4516-9af7-08d87fe306bc X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3568 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_052717_649721_8D449731 X-CRM114-Status: GOOD ( 15.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Florian Weimer , Kees Cook , kernel-hardening@lists.openwall.com, Salvatore Mesoraca , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Jeremy Linton , Mark Brown , Lennart Poettering , linux-hardening@vger.kernel.org, Topi Miettinen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Program headers are processed in two pass: after the first pass load segments are mmapped so in the second pass target specific note processing logic can access the notes. The second pass is moved later so various link_map fields are set up that may be useful for note processing such as l_phdr. --- elf/dl-load.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index ceaab7f18e..673cf960a0 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1259,21 +1259,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, maplength, has_holes, loader); if (__glibc_unlikely (errstring != NULL)) goto call_lose; - - /* Process program headers again after load segments are mapped in - case processing requires accessing those segments. Scan program - headers backward so that PT_NOTE can be skipped if PT_GNU_PROPERTY - exits. */ - for (ph = &phdr[l->l_phnum]; ph != phdr; --ph) - switch (ph[-1].p_type) - { - case PT_NOTE: - _dl_process_pt_note (l, fd, &ph[-1]); - break; - case PT_GNU_PROPERTY: - _dl_process_pt_gnu_property (l, fd, &ph[-1]); - break; - } } if (l->l_ld == 0) @@ -1481,6 +1466,21 @@ cannot enable executable stack as shared object requires"); /* Assign the next available module ID. */ l->l_tls_modid = _dl_next_tls_modid (); + /* Process program headers again after load segments are mapped in + case processing requires accessing those segments. Scan program + headers backward so that PT_NOTE can be skipped if PT_GNU_PROPERTY + exits. */ + for (ph = &l->l_phdr[l->l_phnum]; ph != l->l_phdr; --ph) + switch (ph[-1].p_type) + { + case PT_NOTE: + _dl_process_pt_note (l, fd, &ph[-1]); + break; + case PT_GNU_PROPERTY: + _dl_process_pt_gnu_property (l, fd, &ph[-1]); + break; + } + #ifdef DL_AFTER_LOAD DL_AFTER_LOAD (l); #endif From patchwork Tue Nov 3 10:26:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 11876653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F177C2D0A3 for ; Tue, 3 Nov 2020 10:28:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0422206C0 for ; Tue, 3 Nov 2020 10:28:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CldoijT8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="U+JRAS9d"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="U+JRAS9d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0422206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lVFV4mKrVkTFEc/2ym0MCLDLd0NVJ6vpIipnu1TBDqE=; b=CldoijT8qrBB0zwUf2nT+iUII FOR/U0KVw9oO/ROUnOepUYOk3bH0jhz2eCeJBQYXiBuNfNwswg0JLIkwrhSn6KVuSP1gYu66iNm1Y JdIT8PXE1fA1okq3XHokvPpF3uHIwtxD0j7jbyU1BN/BR4tSESPESCWVQh2DdxtCJqHLqXLnp51y3 V08Ud2R8iD68V5Cvv/Np42hwMi6HkZXFRmhzaWmddCrl3FR8BJqL2XvV3+9n0Y0NW28CQhGMI1/9D otPM/A+l5nR37qacGs+huGpO5EYeI92UcTsDZIJNXVer5/yHThsKSEaqCHguuv3JlcpkqVCuXb2aP 9IG26GFYQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtXX-0000al-8I; Tue, 03 Nov 2020 10:27:47 +0000 Received: from mail-eopbgr70053.outbound.protection.outlook.com ([40.107.7.53] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtXK-0000Un-Pc for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 10:27:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v+UNM3Lv5/vv+slUK/0uE5dl2sBpP1JzcBI5gH+FV0Y=; b=U+JRAS9dkHmx8i2SXzWRtugfJCWqyf5SOZZz7jSCM4rLJM2jksLVPauVzvlu6c2OeG1TBGTGfpxNHTub1ofTqN6qt2X/beNnHL5js6hmrqIovE6jqe0jEYlx2EvO5h26lxDlTIdskIsT3f+Wk+hoX4BNsGh8ZHcf+FNoIo9Kdms= Received: from DB3PR06CA0017.eurprd06.prod.outlook.com (2603:10a6:8:1::30) by AM0PR08MB4036.eurprd08.prod.outlook.com (2603:10a6:208:12c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19; Tue, 3 Nov 2020 10:27:29 +0000 Received: from DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::fc) by DB3PR06CA0017.outlook.office365.com (2603:10a6:8:1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 3 Nov 2020 10:27:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.infradead.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.infradead.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT039.mail.protection.outlook.com (10.152.21.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Tue, 3 Nov 2020 10:27:29 +0000 Received: ("Tessian outbound e6c55a0b9ba9:v64"); Tue, 03 Nov 2020 10:27:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a0ddbe5a41be8d3e X-CR-MTA-TID: 64aa7808 Received: from b1f5d2e3f37d.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 767AF9CE-5DC1-4C50-A568-C4CBB4D6BE4F.1; Tue, 03 Nov 2020 10:26:49 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b1f5d2e3f37d.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 Nov 2020 10:26:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVZ71hYgIZjZfbwrp4bNq9AK8oPE/6SLJ+z086UwdxCOBKpUc5XUIIKGyTeN/kEg++bx2gH+ZTjnB8AqeqById0zX4cZBAM3wB0YwL0RVNMe6Gfk0PzACcrYmQ2GBvJKuoJ/12iglN4YSYouNYGQP4CpwrVd95L9a4Qk/Axz2ZlSSSxvZ3JeJqjgnhZOiizaFEy1x7yny9IFqzFLDALzhex0dRRHw3hxs53VB6Q4HJxwbV26O+HlIcyLlkBoUzoqv2AY/TTR229h6WzHBa2yEnQZai6gxbX+3FasWeVfv/abOTK3q1cXR2szH297wO/H/T247PfoBpATSn3KpylTZA== 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-SenderADCheck; bh=v+UNM3Lv5/vv+slUK/0uE5dl2sBpP1JzcBI5gH+FV0Y=; b=KNk6/OCe3IQR8jqPiC6DnnRD9RPI+Q+6X57WOWuPTYPIDn0eVTJiJ2mmgVzDqPoE/KJuqKK3nMtnEt0XzZDnBex1kSGh7X0idjy8eNh7bEImbPTausoY5IrHh1/T43EpKPHVjbMaeIZaUNpYwrbHcrhnSZlJHnMPO3Ihw8cfSyID2GsUZ67iJPERNEnW5zFAtK5xP+cP1zHnIXjWCOxOJWRMLfBOIGD84i9FVVroTcojIavluSwVJDtqHtDwFsm+XnEfV6xD5ASTyQ3CHDJIl3x6dJzpp31hStSTTkQCPSnRicIOek2P+Xfn26bpR0abpBeeKVj4Ux6zgc6ZLqvecQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v+UNM3Lv5/vv+slUK/0uE5dl2sBpP1JzcBI5gH+FV0Y=; b=U+JRAS9dkHmx8i2SXzWRtugfJCWqyf5SOZZz7jSCM4rLJM2jksLVPauVzvlu6c2OeG1TBGTGfpxNHTub1ofTqN6qt2X/beNnHL5js6hmrqIovE6jqe0jEYlx2EvO5h26lxDlTIdskIsT3f+Wk+hoX4BNsGh8ZHcf+FNoIo9Kdms= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PA4PR08MB6223.eurprd08.prod.outlook.com (2603:10a6:102:e8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Tue, 3 Nov 2020 10:26:36 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792%3]) with mapi id 15.20.3499.032; Tue, 3 Nov 2020 10:26:36 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 3/4] aarch64: Use mmap to add PROT_BTI instead of mprotect [BZ #26831] Date: Tue, 3 Nov 2020 10:26:29 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P265CA0215.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::35) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.54) by LO2P265CA0215.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Tue, 3 Nov 2020 10:26:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b130ba4c-5672-4c58-c312-08d87fe3113c X-MS-TrafficTypeDiagnostic: PA4PR08MB6223:|AM0PR08MB4036: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3826;OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pFJzWG8Yw5e/GUYk3D/pVFVvWPOjiV6M9uIjJphRlHnGQsHOn+hoZ3lsdtBSnnEOZn6nzma3/gtL/Wuh4ePIs0zTVYWKqRRMHASmjNHe2bw+DgY8UMa67sZ3XcvVwKBgwJ9wG3Y4DeBO+ptvj2aAml4LqAFvNKOgdi9EEkq6/F1nOe87MLSLk124ih2ufbVpqYsyVolpKsaaEbXxxxWI4TZJBXRj3bS+M0nzfXm4O6Enxsc4Pf5HH0LFx8jap5gGHsJ83AIlu55M9hXgpZnfPn1uOsGj133zcyJ7tXhILSlk0KslmUQ/0AGemmVAmWh4p/HINnqrzheu35ks3ltz5fAkECWnn46EwORlqchOfrL+WjFjNKKRso8ta5jhra/2 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(346002)(136003)(366004)(5660300002)(2906002)(66556008)(6506007)(8676002)(66946007)(478600001)(54906003)(66476007)(6666004)(6486002)(4326008)(6916009)(6512007)(69590400008)(186003)(16526019)(2616005)(7416002)(36756003)(956004)(8936002)(86362001)(44832011)(83380400001)(52116002)(316002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hDNYcEUHdOkCPtFy9z0Y2Fh3enuTGFcmEu04hq0ufK3iZbr6P8OO8W+GP0Y8X3C4AFsLoSg36mosfLULF2RAVNZdvrjzyXWjP3m6ib6Id1HwrefhRCbvEeRh/XTfRAVtgv0Jk9cApl56ktRou/zIUDBWkMBLBd/lUc7WaSlfrkXiL7SyOPiGveqVcNfygaGp+7UZP1ONGX5YPwZIOCB5piaTKceGDN4E3gdOmeq5StH6PxZhLVxN1GSr7ANTnLuSubLU109DsXmfgCHiyDd8awvL9xnY4w86/sWaAT1yjLHFB02kkWnZjjWTcPu+X6tVO+vzt88rCc3jh3lFQHaExjsnm8U+j1+RutF260PvPYGVs6f2UJVKW9KeYh+vU6zQOmDxxPkn4JeIHCY22PXLRaGdiuW51fv2KiW/SiJb2nz+4ye/vEeTMGvY4G58Zjo5J0q6qKK+jESJcJba8edbH8oFD2VTT5XMaZ9i7M12TBJ9MsTJ/gDL6LT8V5rEDg15Hr1HbQBkd++OG5E+gdwxIR4s7iS1LcxShHALONAla/NsnpWJt2mJjMYT49Lgctjm2d9iaVjlya3L2ElQ/sWqOh6xKK7Sc7XB0OOTzIOtlvsjeCEphsIzTFjE71Olm44W+yQzxm38E1F5t6Dg1aKqKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6223 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: facf50f2-b8a2-48ba-8cb6-08d87fe2f13c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xTmebdd9sLqS6Lt8aM7YzlelbRpsz1ffF4EtubV/9KLqAIeTDRi7VJoyE+a/gEP4Uxmk+lDAowuWIh0s1hZntjdEAnpwRw6dO11Tx1mDimtWUuRkuXzOJ+iScjc7tC62xEebR7ZrP+cwsMZKTJodMUavUkzgN2afzXDigvUHVRfUafS3Q3VqcPSHQfJRAle9UAED8eFT8dzDdfHr1GxMUfENZMUPtvHb2jtwdQ3dZYI5JNmyfkdxc9kts+/9SS8yzTAIF5c6p3IipYN10Qp5/RO7TiRvpjtQH7HE+0JmsFXEFCQgCw6rFoyDrICJIJTp07+L0NwlS9tbXeNTA60gLgiZHiZ3D0bLZgKYGIJtIxqJoxrGoZmyL9j2/HBwqSpDIh17HorZO/IF88lrBw+ntBKDf0XzkQpaZdbagNbNChZKY+tNga3UMVodTZgRdbUg X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(46966005)(36756003)(6666004)(6506007)(54906003)(356005)(81166007)(8936002)(316002)(69590400008)(82310400003)(6512007)(82740400003)(186003)(6486002)(34206002)(16526019)(70586007)(956004)(83380400001)(44832011)(2906002)(478600001)(5660300002)(4326008)(47076004)(86362001)(107886003)(2616005)(70206006)(8676002)(336012)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 10:27:29.6353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b130ba4c-5672-4c58-c312-08d87fe3113c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT039.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4036 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_052734_940686_CD26417D X-CRM114-Status: GOOD ( 21.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Florian Weimer , Kees Cook , kernel-hardening@lists.openwall.com, Salvatore Mesoraca , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Jeremy Linton , Mark Brown , Lennart Poettering , linux-hardening@vger.kernel.org, Topi Miettinen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Re-mmap executable segments if possible instead of using mprotect to add PROT_BTI. This allows using BTI protection with security policies that prevent mprotect with PROT_EXEC. If the fd of the ELF module is not available because it was kernel mapped then mprotect is used and failures are ignored. It is expected that linux kernel will add PROT_BTI when mapping a module (current linux as of version 5.9 does not do this). Computing the mapping parameters follows the logic of _dl_map_object_from_fd more closely now. Fixes bug 26831. --- sysdeps/aarch64/dl-bti.c | 46 ++++++++++++++++++++------------------- sysdeps/aarch64/dl-prop.h | 14 +++++++----- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c index 196e462520..385f1731ca 100644 --- a/sysdeps/aarch64/dl-bti.c +++ b/sysdeps/aarch64/dl-bti.c @@ -19,43 +19,45 @@ #include #include #include +#include /* For MAP_COPY. */ -static int -enable_bti (struct link_map *map, const char *program) +/* Enable BTI protection for MAP. */ + +void +_dl_bti_protect (struct link_map *map, int fd) { + const size_t pagesz = GLRO(dl_pagesize); const ElfW(Phdr) *phdr; - unsigned prot; for (phdr = map->l_phdr; phdr < &map->l_phdr[map->l_phnum]; ++phdr) if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X)) { - void *start = (void *) (phdr->p_vaddr + map->l_addr); - size_t len = phdr->p_memsz; - - prot = PROT_EXEC | PROT_BTI; + size_t vstart = ALIGN_DOWN (phdr->p_vaddr, pagesz); + size_t vend = ALIGN_UP (phdr->p_vaddr + phdr->p_filesz, pagesz); + off_t off = ALIGN_DOWN (phdr->p_offset, pagesz); + void *start = (void *) (vstart + map->l_addr); + size_t len = vend - vstart; + + /* Add PROT_BTI. */ + unsigned prot = PROT_EXEC | PROT_BTI; if (phdr->p_flags & PF_R) prot |= PROT_READ; if (phdr->p_flags & PF_W) prot |= PROT_WRITE; - if (__mprotect (start, len, prot) < 0) + if (fd == -1) + { + /* Ignore failures: rely on the kernel adding PROT_BTI then. */ + __mprotect (start, len, prot); + } + else { - if (program) - _dl_fatal_printf ("%s: mprotect failed to turn on BTI\n", - map->l_name); - else + void *p = __mmap (start, len, prot, MAP_FIXED|MAP_COPY|MAP_FILE, + fd, off); + if (p == MAP_FAILED) _dl_signal_error (errno, map->l_name, "dlopen", - N_("mprotect failed to turn on BTI")); + N_("failed to turn on BTI protection")); } } return 0; } - -/* Enable BTI for L if required. */ - -void -_dl_bti_check (struct link_map *l, const char *program) -{ - if (GLRO(dl_aarch64_cpu_features).bti && l->l_mach.bti) - enable_bti (l, program); -} diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h index 2016d1472e..762bc93733 100644 --- a/sysdeps/aarch64/dl-prop.h +++ b/sysdeps/aarch64/dl-prop.h @@ -19,19 +19,16 @@ #ifndef _DL_PROP_H #define _DL_PROP_H -extern void _dl_bti_check (struct link_map *, const char *) - attribute_hidden; +extern void _dl_bti_protect (struct link_map *, int) attribute_hidden; static inline void __attribute__ ((always_inline)) _rtld_main_check (struct link_map *m, const char *program) { - _dl_bti_check (m, program); } static inline void __attribute__ ((always_inline)) _dl_open_check (struct link_map *m) { - _dl_bti_check (m, NULL); } static inline void __attribute__ ((always_inline)) @@ -43,6 +40,10 @@ static inline int _dl_process_gnu_property (struct link_map *l, int fd, uint32_t type, uint32_t datasz, void *data) { + if (!GLRO(dl_aarch64_cpu_features).bti) + /* Skip note processing. */ + return 0; + if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { /* Stop if the property note is ill-formed. */ @@ -51,7 +52,10 @@ _dl_process_gnu_property (struct link_map *l, int fd, uint32_t type, unsigned int feature_1 = *(unsigned int *) data; if (feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) - l->l_mach.bti = true; + { + l->l_mach.bti = true; /* No longer needed. */ + _dl_bti_protect (l, fd); + } /* Stop if we processed the property note. */ return 0; From patchwork Tue Nov 3 10:26:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 11876657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D19CBC388F2 for ; Tue, 3 Nov 2020 10:28:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30D28206F1 for ; Tue, 3 Nov 2020 10:28:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nOwLn6XJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="Cr4LTSGY"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="Cr4LTSGY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30D28206F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9m2jFMlfONeYGgQHrm3qahCp513ZgDx7N231cKdQsnI=; b=nOwLn6XJmKUHgzjCI23NQR6kZ kQ5LeW3ipxFujvmnBYWPMXPBmIcsffpHwiDY2S8lrHxlqO57xU6Ofc7rHwJ0xTD8/pZmRlJzFCG87 I9Pe/zspiok20CxSaFT7sy7re3mud6CkWIBwKd/p6YnQgNKPiZpDGHN+9kY6D7wcCwilG6bybTDMX XuIW48Yg1U0f2hZlYACfF5QkyNvorLwr09RSVFem+6OD2gMN/TNOSQTMRU6sjl0ftWVkxb8CVHXEm ijC+05W9zhL2uZDahSqiNn2/K2lcpbabjZoo1RWUnAP7bRU3DmK/+s5qhN91QBbMmBYFFeXfVDqfT zdDMCIDUg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtXI-0000UA-Uy; Tue, 03 Nov 2020 10:27:33 +0000 Received: from mail-eopbgr50044.outbound.protection.outlook.com ([40.107.5.44] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZtX3-0000MS-Mi for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 10:27:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wlxmz1lsQy9ANT5hBuxauGpsVdR7Lp8VNGTXKRA7KP8=; b=Cr4LTSGYEETkHIILW5Sr0QH0FPLv/LPR1ukjESdzD5t7gHd815xjEsPcBP1rl1lPzcunwfqWkDWKHBpN9JGdA+xGKvhvGmpIz6BiLQGlbYZT6+I0jzzb4f0Kcx4dJ/0HXhRWboOU3qI4QcrwKnzcKWLl92RmPOO5TIW9GnB060A= Received: from AM5PR1001CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::28) by DB7PR08MB3418.eurprd08.prod.outlook.com (2603:10a6:10:27::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.29; Tue, 3 Nov 2020 10:27:12 +0000 Received: from AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:2:cafe::43) by AM5PR1001CA0015.outlook.office365.com (2603:10a6:206:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Tue, 3 Nov 2020 10:27:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.infradead.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.infradead.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT033.mail.protection.outlook.com (10.152.16.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Tue, 3 Nov 2020 10:27:12 +0000 Received: ("Tessian outbound 7c188528bfe0:v64"); Tue, 03 Nov 2020 10:27:11 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3d316982cdffdc9e X-CR-MTA-TID: 64aa7808 Received: from b1f5d2e3f37d.6 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4F3CA039-F721-4702-A008-0403DAB25079.1; Tue, 03 Nov 2020 10:27:02 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b1f5d2e3f37d.6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 Nov 2020 10:27:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T+UluvmSqw4nvycpam5RjdCFYFsWnhttU1aWyDR7YtfUC7HvgSDVDc7KsVhPveRHmZGuFOunqfBaalbjFaVTN9y91W9ADcl15l7Ez5UgNNrlQBGmEK16yEEkSBBW1wEvluOlk3lE7o/Baht6jG83UJDiiA3Od/bHxiHInIvpzRTd5O14EiP+qiweYl/ZMtg5KULe/J3W+7JNG1+w57kiy8YElIyOc3kC65thAdRLEZbS+IVQU+gVEJBKLeWBVm/SSNV39wQVDDPZrADO9/Gcjk/NL7ajxVPo1E1VhCWYGbDs15oVubLd9guZSOyfsG0dRoIEllNFm3NakMXKUylcoA== 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-SenderADCheck; bh=Wlxmz1lsQy9ANT5hBuxauGpsVdR7Lp8VNGTXKRA7KP8=; b=D6HbCd256X55B4SAy/+AeuY/bnjKLxmHM9Mpk5Kg/QA3VrlyyrStzVzjGHwZncP8/LFDH6AzC7nd4O1hRTRh0aqrHpk4I9OmmdYG9zm54EAIecZvcClJ2XRNrt72YjC/KdvNq9ZFhFl2G/3aICnkdfe8KOReJxgukY5wuzVVLHPhA8TNXPk1YXKzoQMf4MRxaBsweqCIlbd3ZdYSzaThb+oSqz6cgwCWYcu3NsNt3GdHQ2Dq4RS99266j57e1wdZ03tuletzOrA8Vsjug+EOvrpiDqjE89tAVvix2T9kUCL+rOEcBlazWup01oj0CC8+5IVvgb1ZzoxEv5E9/EFJqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wlxmz1lsQy9ANT5hBuxauGpsVdR7Lp8VNGTXKRA7KP8=; b=Cr4LTSGYEETkHIILW5Sr0QH0FPLv/LPR1ukjESdzD5t7gHd815xjEsPcBP1rl1lPzcunwfqWkDWKHBpN9JGdA+xGKvhvGmpIz6BiLQGlbYZT6+I0jzzb4f0Kcx4dJ/0HXhRWboOU3qI4QcrwKnzcKWLl92RmPOO5TIW9GnB060A= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) by PA4PR08MB6223.eurprd08.prod.outlook.com (2603:10a6:102:e8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Tue, 3 Nov 2020 10:26:48 +0000 Received: from PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792]) by PR3PR08MB5564.eurprd08.prod.outlook.com ([fe80::2904:edcf:b299:f792%3]) with mapi id 15.20.3499.032; Tue, 3 Nov 2020 10:26:48 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 4/4] aarch64: Remove the bti link_map field [BZ #26831] Date: Tue, 3 Nov 2020 10:26:42 +0000 Message-Id: <4dadd9c101e32b17e927d56966c54e734ced21ab.1604393169.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.54] X-ClientProxiedBy: LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) To PR3PR08MB5564.eurprd08.prod.outlook.com (2603:10a6:102:87::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.54) by LO2P123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:a6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 3 Nov 2020 10:26:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 39a32b29-8b75-4eb0-a6f1-08d87fe306df X-MS-TrafficTypeDiagnostic: PA4PR08MB6223:|DB7PR08MB3418: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GpX+9AZXL1rA7ftikTwlnVdsxsZ8r8ULLNyUhbJEF3b+g59pp2w1vUpuOQtaix5PB+Oe8OfQUlE+5t9cNv30edS+6vcbzyEkT3/s1n53GjV9n8I6pDyhJapu4YbJR0jyAhwIIJrEKa2FtZVczls7DlzvGEBJSswUiBulAwkw6akKhuy23qG2cPSZ1U1kWVML45l0aTvvyVPy3f2W+S7R5806A+X8nIdGtI3VSRjSip9N+EY1Z80NuKyhJSbzysn7BtONSOROKqSsdJd327BVL6YSBbllWAwVwTU8pqW6lB4hwRbYcegOfpElwQBmSTk1SkbafKYiZh71YPXwe/GTCBAvvnZPPRtXDnTMcG+9aJDFHGwYf2VIqtYpsnOk0Zti X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR08MB5564.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(346002)(136003)(366004)(5660300002)(2906002)(66556008)(6506007)(8676002)(66946007)(478600001)(54906003)(66476007)(6666004)(6486002)(4326008)(6916009)(6512007)(69590400008)(186003)(16526019)(2616005)(7416002)(36756003)(956004)(8936002)(86362001)(44832011)(83380400001)(52116002)(316002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: n+W63gGQDmjlTcHyctXjrchkrxCzFfRzkiydbGMpSLw2hRtMFazdpMP+Iy1+FQCGS21ZilzkcazqPBPKGXKR49RXI5GINqtDQYt1a7KHj5l7KAbJXHJMg6oBmidHtY8iTzEMrtBcxl95NPXJXgxhSbE2ON750mZ5mAPUiSsx8Bt/bzx2YnTnJAlNA0jtEZ6bXxcbNqXR8xdUJZGq/KxhKmzgSGORBApYDfzo22MjKU9ALwJC/UbKyYmR4Nw9cvXX06J2hDN3pKkqhjRaK8RDo/xemX0WVQJdQYU7VTJnUgfy/9mMpNk9gqEOrnbtgLlgSTzEU2IYgz6ZJbt3+cnK7H6F1TeLOcjvHZxgDbKtMwspq802M9fpu2R9hFCCamPuI/Vu+2uiqhokO1U7s9lj1Pk7pan8jS7v2FdonkNTrdsfDV644owsD00mDbG8db/rGHPjY+0DVUFHJsd52bvrRIgYhN2VO3EWhQ97sj2aYLYItX5d15gLjHLtSuSNRoZH8e1rU8cNWQIgNligY3hLe7tpRgBgrJixAmkxXNPXUmVkp9khH6FjCvmRg8C1ET+Ekp1T2mcu7JD+JryWeyZB0sVHKbwOW0H/ziOwXiRtXOwrxNzZhgpWsZnT8XrX2EpCx9hNFTTrhWKno/Iuz0F/OQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6223 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b2e1cbd6-8844-4c3d-f2f3-08d87fe2f874 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QmjKhMJuqFYrGpr6MCABNWuigKfdte8T7PKvAsbBzNFaDvgtY18pyOnvdOUY2QdkkjU6Je+y2jH1EbACd/jbLfCi7kbEFgxstUO0Ke2AS+KOPlcPxV8j+7Oze7zhByst9vDgxz+doyJEwlW/Knkh3iOzw5mTskQy5uKtk/XrdFqvs5ksyLabtlo6Nk4FUsFeE0bfwF2ucre5u+toGbch6fslMFnitlClATvsRqoC8bGO8qVXoutOe4B6yAGJCQSN16KQqHXxuhWFTGCJxwnB94lfXgo4R0WysRMb2xoQt3HVZDMAKU74nGnMYi7o5+twZmwyjiDzX/L/KeCuZdeaGISIuqQ2JccrSwIUnh0yRLx4ONWOTfv0A08qCwupqL+8iRC57Azoc2G5FB3a9eRtLgtsg8GCGQcPRhryjngylM+XQLwOn8XAYuytDapFxPWV X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(346002)(396003)(46966005)(2616005)(8676002)(82310400003)(82740400003)(4326008)(8936002)(956004)(5660300002)(47076004)(70586007)(336012)(34206002)(81166007)(356005)(6506007)(44832011)(6666004)(54906003)(6512007)(83380400001)(69590400008)(36756003)(2906002)(16526019)(26005)(107886003)(86362001)(316002)(36906005)(478600001)(186003)(6486002)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 10:27:12.0930 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39a32b29-8b75-4eb0-a6f1-08d87fe306df X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3418 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_052718_042420_C8E6BAEA X-CRM114-Status: GOOD ( 15.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Florian Weimer , Kees Cook , kernel-hardening@lists.openwall.com, Salvatore Mesoraca , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Jeremy Linton , Mark Brown , Lennart Poettering , linux-hardening@vger.kernel.org, Topi Miettinen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The bti link_map field is no longer necessary because PROT_BTI is applied at note processing time immediately instead of in _dl_open_check based on the bti field. This is a separate patch that is not expected to be backported to avoid changing the link_map layout that is libc internal ABI. --- sysdeps/aarch64/dl-prop.h | 5 +---- sysdeps/aarch64/linkmap.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h index 762bc93733..cf14381e4a 100644 --- a/sysdeps/aarch64/dl-prop.h +++ b/sysdeps/aarch64/dl-prop.h @@ -52,10 +52,7 @@ _dl_process_gnu_property (struct link_map *l, int fd, uint32_t type, unsigned int feature_1 = *(unsigned int *) data; if (feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) - { - l->l_mach.bti = true; /* No longer needed. */ - _dl_bti_protect (l, fd); - } + _dl_bti_protect (l, fd); /* Stop if we processed the property note. */ return 0; diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h index 847a03ace2..e921e77495 100644 --- a/sysdeps/aarch64/linkmap.h +++ b/sysdeps/aarch64/linkmap.h @@ -22,5 +22,4 @@ struct link_map_machine { ElfW(Addr) plt; /* Address of .plt */ void *tlsdesc_table; /* Address of TLS descriptor hash table. */ - bool bti; /* Branch Target Identification is enabled. */ };