Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1789748pxk; Tue, 1 Sep 2020 07:53:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9z4FYoark/0gmha8l8a3eIpz+lWbGBEXNTIrZup1F9Hr9OWM/Bn01DW0CSZ7EQgRjskra X-Received: by 2002:a17:906:c7d9:: with SMTP id dc25mr1739667ejb.452.1598972000828; Tue, 01 Sep 2020 07:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972000; cv=none; d=google.com; s=arc-20160816; b=ZeO1CpU29MbzE2nxIctBodFVvOQxpUii+LFfe1yH8d5D17kchU4F3cztB41+Kbz1hE W6MYbF41y4xwaXc9KqA27bCK2g8nVRJPtsP5KC2WB7BjsnDqc9/80pd0Rp2JhzwkPkmv tq3ZoKykLTUJ5zUmW1xAYLU3pupReJbOT0rMgusjwOLhy98vo60nma8q754RYQYWGuyL 0CNfE9KJRl/rP/71TjZqK+jIpd+IqvYAbgt05Pcni7C0ViHzGD4M+Yc9SmxxeuxyyYdz 5RPjv4XlCLq4pZZ2HhLnD6BPUpj1lbSBCzltD3J6ce+2Uzw2QHwu5cA6W4f4Xtl1Mozr 3j0g== 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=Pd3TPOZpCtc39cOCyBoPEyvLy1chLF0/6fTI+Ptfuco=; b=hO1hUvUCx70piAMJJb19qqgWDbt5B7Ge6xKqfa2Hbl7FncnzFDSO0SYK7qvMKu/foo db9LWb9HO5hc5CR+OFN0H2CZNUrcUx9cCD4IGKhQBalLpLddz6IDWcDVL81HfuOl3PVw 2S/4TKumFHA8oKtmp+kw2VvQhOaHD9D1RChLczxitrkbS9VALej1YZIqg7pCzhBdwfj6 ocWVkxggQtNwdA9sarpakG22BvH0wan6WDVSL0Kjky91SC03gJu8nyHGBEZVJNU5hn9a QPn2lD4Fqwk+55i+syAkqWKR7n4qGmuPAdbrYlz9VTg4hqJPFU/lpKiRtY/3FXzuPWYw 9a7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=Q4fEniEK; dkim=neutral (no key) header.i=@linutronix.de; 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 m6si889642ejl.341.2020.09.01.07.52.56; Tue, 01 Sep 2020 07:53:20 -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=Q4fEniEK; dkim=neutral (no key) header.i=@linutronix.de; 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 S1728648AbgIAOt7 (ORCPT + 99 others); Tue, 1 Sep 2020 10:49:59 -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"