From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 A2EC1C28E83 for ; Tue, 1 Sep 2020 14:50:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A38621D6C for ; Tue, 1 Sep 2020 14:50:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Q4fEniEK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zh+34IjN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728655AbgIAOuA (ORCPT ); Tue, 1 Sep 2020 10:50:00 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39504 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727820AbgIALs2 (ORCPT ); Tue, 1 Sep 2020 07:48:28 -0400 Date: Tue, 01 Sep 2020 11:47:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598960877; 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=Pd3TPOZpCtc39cOCyBoPEyvLy1chLF0/6fTI+Ptfuco=; b=Q4fEniEKcbOMu89CXmIP0A3NKEh/+XiuKrqJgINE1TqK0fkHwzxJloGpM58/4zmc6g8pkb G6FzTnDr/FTNll28D9lEptWu2j9A6FoqNLQ9KVtcVzZdcqa9I+yHH+Uwl1PaIV2kzxp1WF CAH4xkDWL/b9QwFyZyvh1wIsMkmeFtl/X3FosSDjTJ0thKJdA1UB3Yd3nDafzFAtP8pKtL Tl+FO3jDloK0CE6DaK63sSSngwCqIrZiGUSxPqHL4ViNSDo7syfzOWOLKtzu9Epp/YXUN/ Ttn39lONRY8g8xEOVnAzIRsFiMuTsMExiD/iL9E5+HpyibwP+gAp2Nzd9ACBCw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598960877; 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=Pd3TPOZpCtc39cOCyBoPEyvLy1chLF0/6fTI+Ptfuco=; b=zh+34IjNnJBcaydYCkZX3Uyh5uvCRQBCsPYe9o0xRokuMxz3LQMOZAJEMdwrRf+6o3eftF Y99aFDtWmL5ASXBQ== From: "tip-bot2 for Kees Cook" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/build] arm64/build: Assert for unwanted sections Cc: Ard Biesheuvel , Kees Cook , Ingo Molnar , Catalin Marinas , Will Deacon , x86 , LKML In-Reply-To: <20200821194310.3089815-14-keescook@chromium.org> References: <20200821194310.3089815-14-keescook@chromium.org> MIME-Version: 1.0 Message-ID: <159896087672.20229.3309776280520089538.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: be2881824ae9eb92a35b094f734f9ca7339ddf6d Gitweb: https://git.kernel.org/tip/be2881824ae9eb92a35b094f734f9ca7339ddf6d Author: Kees Cook AuthorDate: Fri, 21 Aug 2020 12:42:54 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 01 Sep 2020 09:50:37 +02:00 arm64/build: Assert for unwanted sections In preparation for warning on orphan sections, discard unwanted non-zero-sized generated sections, and enforce other expected-to-be-zero-sized sections (since discarding them might hide problems with them suddenly gaining unexpected entries). Suggested-by: Ard Biesheuvel Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Cc: Catalin Marinas Cc: Will Deacon Link: https://lore.kernel.org/r/20200821194310.3089815-14-keescook@chromium.org --- arch/arm64/kernel/vmlinux.lds.S | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 16eb2ef..e8847ca 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -121,6 +121,14 @@ SECTIONS *(.got) /* Global offset table */ } + /* + * Make sure that the .got.plt is either completely empty or it + * contains only the lazy dispatch entries. + */ + .got.plt : { *(.got.plt) } + ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, + "Unexpected GOT/PLT entries detected!") + . = ALIGN(SEGMENT_ALIGN); _etext = .; /* End of text section */ @@ -243,6 +251,18 @@ SECTIONS ELF_DETAILS HEAD_SYMBOLS + + /* + * Sections that should stay zero sized, which is safer to + * explicitly check instead of blindly discarding. + */ + .plt : { + *(.plt) *(.plt.*) *(.iplt) *(.igot) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + + .data.rel.ro : { *(.data.rel.ro) } + ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!") } #include "image-vars.h"