Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1789409pxk; Tue, 1 Sep 2020 07:52:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybCiVXfaqW4F2c2aSURce4RRmVMlbLoI4TZqcPX+Jv4bTCLxLOkiNpd1cI+oVEaSD/tfOV X-Received: by 2002:a17:906:4bc5:: with SMTP id x5mr1900961ejv.177.1598971974561; Tue, 01 Sep 2020 07:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598971974; cv=none; d=google.com; s=arc-20160816; b=nC/xRZFTJ5SqHU6pv7KCzFmfX4Y0L2muKkxS7BTKaU7EQiOsKw8H55qrv/ox2rgMWm K4jYL3m8qiDJU1/q9pEwMe58chsd71nNo1lg9dlCJF8BgYgk0PgEQrrL/PRwDoFtHXpg dScE3ZX+IPvJ62vLNVAG82b7opLBx6ZFs4S98sKIVeI5fVUcaXsZMxFPcsI7kfdTTxxy rLUmLLLlQUlbaIGW2HfKlad6eNNzgawv6BpsQDVxkQoNTcPKjTFJ1SLrScFRFjoQ/EUm u6RsC9Bdp6NPmLOmFT4AycBIIh3s1yEE7qmysB6MRtTHZUPjydecO1eZFL9GnlVZ5NHv c2rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=6H7pYz/RFeshDuKqJ0FUSS9Irmz7kYYz+37l6Oei5ow=; b=UlN7M4iikJu8E0gK/Wp9bjbCpCLTbJW0ijScLwNh60lpHt9uKkWfnIVdD3GYslN8oW 9uqSzT8R5Aq/f4hHWBlSNrD11yTNG4cGokMW2RUsMNq6H6+qV3kymob59vSfmyRZJ0jb 9RbYsgvWIbNaTg2DA+FZ56eCG5VU1fSirUgnBCIY3g3OGaUPhVZSvCtsBemoD+02Zr/D H2YyiQvpQCziFJnALjgQYSJWkmOvgEkcAp3X4+mH6omPm57zaKvJ/Jq8Gomnpz7V8Icr sEDgBS6Js/1k8KFrS/KyxSF4TantzH4f2gUt0bmjmjOmzNEcfwdBhVNZgCU4smfi6wKw uoBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=R0HVw9Lx; dkim=neutral (no key) header.i=@linutronix.de header.b="YH9xp/eQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si670173edr.361.2020.09.01.07.52.31; Tue, 01 Sep 2020 07:52:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=R0HVw9Lx; dkim=neutral (no key) header.i=@linutronix.de header.b="YH9xp/eQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728621AbgIAOth (ORCPT + 99 others); Tue, 1 Sep 2020 10:49:37 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39444 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727804AbgIALs2 (ORCPT ); Tue, 1 Sep 2020 07:48:28 -0400 Date: Tue, 01 Sep 2020 11:47:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598960875; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6H7pYz/RFeshDuKqJ0FUSS9Irmz7kYYz+37l6Oei5ow=; b=R0HVw9LxkjIRBtXJElIuI12FZ5TI+tLD3drCGmXpty5c85zS/s6xrsD9S04Vof/kTRAvyc hJ1Pv7aRvrJj9K3K7zUlM6V9CzwPMKMmXnFE2oQPBmt8qlk2tRYp3L3popuJxTbNrZci+H Q3YXVaT09fy5/Y8jjIAnN0SIzMf1uOMqBOUOeUwrrQE9tYRuUEkL31XbYxDR6KJj69tYWm WtrjxF5YGqNTumRFYyOVAgbDqAFMjSybb5RKrfa/mtPH0NFlzASFgrQ2yLhfb7Io7Ez/+R ZkJz60yHOGAWFMdntmG2QKmeL9TAuis7M52vDZ3AEwiFeR9OxPUw/hFGRH48aQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598960875; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6H7pYz/RFeshDuKqJ0FUSS9Irmz7kYYz+37l6Oei5ow=; b=YH9xp/eQviAl5DtSeffSdqIQQuS5mdyjK0ko70sJENMUin5vsmSqhZSeIjxfvVlpxIDG69 2/GJyUzOlrGra1AA== From: "tip-bot2 for Kees Cook" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/build] arm/build: Assert for unwanted sections Cc: Kees Cook , Ingo Molnar , Russell King , x86 , LKML In-Reply-To: <20200821194310.3089815-19-keescook@chromium.org> References: <20200821194310.3089815-19-keescook@chromium.org> MIME-Version: 1.0 Message-ID: <159896087511.20229.3683531986832107213.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/build branch of tip: Commit-ID: 0c918e753f8c03b0308a635c0721a8c24d738d4a Gitweb: https://git.kernel.org/tip/0c918e753f8c03b0308a635c0721a8c24d738d4a Author: Kees Cook AuthorDate: Fri, 21 Aug 2020 12:42:59 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 01 Sep 2020 10:03:18 +02:00 arm/build: Assert for unwanted sections In preparation for warning on orphan sections, enforce expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Cc: Russell King Link: https://lore.kernel.org/r/20200821194310.3089815-19-keescook@chromium.org --- arch/arm/include/asm/vmlinux.lds.h | 11 +++++++++++ arch/arm/kernel/vmlinux-xip.lds.S | 2 ++ arch/arm/kernel/vmlinux.lds.S | 2 ++ 3 files changed, 15 insertions(+) diff --git a/arch/arm/include/asm/vmlinux.lds.h b/arch/arm/include/asm/vmlinux.lds.h index 6624dd9..4a91428 100644 --- a/arch/arm/include/asm/vmlinux.lds.h +++ b/arch/arm/include/asm/vmlinux.lds.h @@ -52,6 +52,17 @@ ARM_MMU_DISCARD(*(__ex_table)) \ COMMON_DISCARDS +/* + * Sections that should stay zero sized, which is safer to explicitly + * check instead of blindly discarding. + */ +#define ARM_ASSERTS \ + .plt : { \ + *(.iplt) *(.rel.iplt) *(.iplt) *(.igot.plt) \ + } \ + ASSERT(SIZEOF(.plt) == 0, \ + "Unexpected run-time procedure linkages detected!") + #define ARM_DETAILS \ ELF_DETAILS \ .ARM.attributes 0 : { *(.ARM.attributes) } diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 11ffa79..5013682 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -152,6 +152,8 @@ SECTIONS STABS_DEBUG DWARF_DEBUG ARM_DETAILS + + ARM_ASSERTS } /* diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index dc672fe..5f4922e 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -151,6 +151,8 @@ SECTIONS STABS_DEBUG DWARF_DEBUG ARM_DETAILS + + ARM_ASSERTS } #ifdef CONFIG_STRICT_KERNEL_RWX