From patchwork Mon Jun 29 06:18:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11630491 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5386E913 for ; Mon, 29 Jun 2020 06:22:21 +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 DB2C023131 for ; Mon, 29 Jun 2020 06:22:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R7jCVAqH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XBLhEqs6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WAur6F+G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB2C023131 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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=OQXzY7Wolz2HpDBNuILkXbvNrnyz6EZy5NZ6qyA7BgQ=; b=R7jCVAqHQJUGfCO+iTZ1/CCCu dtVzf57ZWLDzAXCoOEfxmZDBt7WKnQm1wHZG8ebavgX6nwKPx86waCB413HkgUgCJQ7Z3J7VhDOG4 cHRPRPQJu8ZQRjZ4yd98/tqp4fwvRuLClpALiZZ5P96OnNhsWyhrrZxkzPMQT/Zin6MTgg72kuDJq vw+TR93yLzul3LSmgh3FxwXmE0RYZh22CaOaYB66gEnqY/XNRGdPRxEAZwePzuK5lWX5IyYavuRXS DCt2xco4XtiDjejwp3EuZpceL+Yj3khFdmHbeb61ZASJ8EvDc7kU+rPbHqVLTu39UwvQQZ9IJst9a /FubSNzhA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8z-0006Co-Qb; Mon, 29 Jun 2020 06:19:53 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn8B-0005tU-1s for linux-arm-kernel@merlin.infradead.org; Mon, 29 Jun 2020 06:19:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zbmvLfTE9L6uB1QeuLicstyHsAYPZqeThcBTspx8dsE=; b=XBLhEqs6QgdzuIplrJzdpGQ4pV UgHDDFmEv+TfTtEH9N9DH5ivX1k6KyIZoaSF7XybpaOZgoXmlqlRBi7vzl/FGjmt0+OrU+Z1jFpj/ E1zFl0LYPbzi0IpFpcTnFc2O0DgXYEN1JDMTN6EksN69ZGMbj919lCfC3nn+iOepcCo+hiJlOwBrA JX+7ivgVfFBd+xSBSZCH6nWf07Ghkd7qIUILN4XT/584MhYObXFNUZ4Hmp8NgldEwfW3UywWFEBe9 ABMKPHX7BOZGpOJ1P78vptVHLscPTczn++bhCH8U9d4yCVgXvyIC3b4QSPfg4k46cN7QoRO9btWHU KJ2XMjWA==; Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpn86-0002kX-BR for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 06:19:01 +0000 Received: by mail-pf1-x443.google.com with SMTP id t11so2591921pfq.11 for ; Sun, 28 Jun 2020 23:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zbmvLfTE9L6uB1QeuLicstyHsAYPZqeThcBTspx8dsE=; b=WAur6F+GWFNqabvWetrOIjwqeCKciP5tB4yziNtRgHbUBWnFYsk+PWnQg0rPnI1y+g L9/2L8LDp87Z/M1SaT4HH8r+8tUNDRfoRgnG+GLIbasGQzjvCK70sg2txXh3pnKq7xZH dgJ/3navMjpE0lZYo7ggt1P0ejy+Ucz+w7giI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zbmvLfTE9L6uB1QeuLicstyHsAYPZqeThcBTspx8dsE=; b=uCJsMEEVeZ/YkL8UkqX/7aFFuhbQK6pVeSujacPTuPKWGhiZkmHdImxU3c1ZmLqC8r +izBwrNmnihj3fvYS63gJEWKvQZKFCxz1b+8Bo0rMmiYrSJrSnHOmqmdIkOcQyVvrhSA kEI4LnfeYns9lUnNgFbz0FJb0sbd1/Icu1MNJM/tTy7Imul6n4D28027PjQybkfQJJbN ebiQoAdhg4CnW2g5WhTtiLba0/mapJSUqoOhTlDJvsn+ARd7ErTv/Dm3UGE3Yl6wDwF0 4sPdK5oMid4ECRzmwmtRh+jcaZdf4o94gyd+s5rmYpJjlEXQcDAE1FBMq6dt4zTJxZgk Rh0A== X-Gm-Message-State: AOAM533Qchb1tqHYFqqMt6gqPVwWAPUyvw/14voQXSBYUJbe6lmu7P1y cw5l9fkPl0kDffAQIjiEMcs09g== X-Google-Smtp-Source: ABdhPJzPkKoWIedag90LUswlw/9FOCURl1w95dlknpWPuvDM08OSsAriAcGrqOlQQRubrP3Iw59Dwg== X-Received: by 2002:a63:d208:: with SMTP id a8mr8881051pgg.351.1593411533472; Sun, 28 Jun 2020 23:18:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id hg13sm5486603pjb.21.2020.06.28.23.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 23:18:48 -0700 (PDT) From: Kees Cook To: Will Deacon Subject: [PATCH v4 12/17] arm/build: Refactor linker script headers Date: Sun, 28 Jun 2020 23:18:35 -0700 Message-Id: <20200629061840.4065483-13-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629061840.4065483-1-keescook@chromium.org> References: <20200629061840.4065483-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200629_071859_177416_609B2276 X-CRM114-Status: GOOD ( 14.36 ) X-Spam-Score: -2.1 (--) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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 , linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, Kees Cook , Arnd Bergmann , Catalin Marinas , Masahiro Yamada , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, Nathan Chancellor , clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , James Morse , Thomas Gleixner , Borislav Petkov , Peter Collingbourne , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In preparation for adding --orphan-handling=warn, refactor the linker script header includes, and extract common macros. (The ARM_COMMON_DISCARD macro will be shared with the boot linker script in a future patch.) Signed-off-by: Kees Cook --- arch/arm/{kernel => include/asm}/vmlinux.lds.h | 17 ++++++++++++----- arch/arm/kernel/vmlinux-xip.lds.S | 4 +--- arch/arm/kernel/vmlinux.lds.S | 4 +--- 3 files changed, 14 insertions(+), 11 deletions(-) rename arch/arm/{kernel => include/asm}/vmlinux.lds.h (95%) diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h similarity index 95% rename from arch/arm/kernel/vmlinux.lds.h rename to arch/arm/include/asm/vmlinux.lds.h index 381a8e105fa5..142c038b2e97 100644 --- a/arch/arm/kernel/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -1,4 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#include #ifdef CONFIG_HOTPLUG_CPU #define ARM_CPU_DISCARD(x) @@ -37,6 +38,10 @@ *(.idmap.text) \ __idmap_text_end = .; \ +#define ARM_COMMON_DISCARD \ + *(.discard) \ + *(.discard.*) + #define ARM_DISCARD \ *(.ARM.exidx.exit.text) \ *(.ARM.extab.exit.text) \ @@ -49,8 +54,12 @@ EXIT_CALL \ ARM_MMU_DISCARD(*(.text.fixup)) \ ARM_MMU_DISCARD(*(__ex_table)) \ - *(.discard) \ - *(.discard.*) + ARM_COMMON_DISCARD + +#define ARM_STUBS_TEXT \ + *(.gnu.warning) \ + *(.glue_7) \ + *(.glue_7t) #define ARM_TEXT \ IDMAP_TEXT \ @@ -64,9 +73,7 @@ CPUIDLE_TEXT \ LOCK_TEXT \ KPROBES_TEXT \ - *(.gnu.warning) \ - *(.glue_7) \ - *(.glue_7t) \ + ARM_STUBS_TEXT \ . = ALIGN(4); \ *(.got) /* Global offset table */ \ ARM_CPU_KEEP(PROC_INFO) diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 3d4e88f08196..904c31fa20ed 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -9,15 +9,13 @@ #include -#include +#include #include #include #include #include #include -#include "vmlinux.lds.h" - OUTPUT_ARCH(arm) ENTRY(stext) diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 5592f14b7e35..bb950c896a67 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -9,15 +9,13 @@ #else #include -#include +#include #include #include #include #include #include -#include "vmlinux.lds.h" - OUTPUT_ARCH(arm) ENTRY(stext)