Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1667686pxk; Tue, 1 Sep 2020 04:57:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB0KqEN3dr5GiRVRh0O11TShiJoXjRKhpUlUwcvU3kKCeORq86jeuGsHxfmD1qxWCi5mwx X-Received: by 2002:a50:8d87:: with SMTP id r7mr1403819edh.26.1598961451348; Tue, 01 Sep 2020 04:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598961451; cv=none; d=google.com; s=arc-20160816; b=sHgwJL8fqaBr1D0WPUsBaZLsbaYc848GfjVJMXIeEpfFSCY96kCyymRFPJbkiE9G0X BvoVTeBLnetAZ3okPSjpcVhgU6YaGtsaG5+7OaIMiNo8qUZ0FT+6sLrpnQQG1vjgjraO k7p6GsfZlgvhsyN3qtP4vaXEHpHhtXHsJ5MoeP/hg8ZLY97BINg7wmrLXnHqgnxIBtvF OidGAt537fZPsb43nmGg4Ec3WRcfPDRCiokRMIGZuyTWIzfAETV0w7cZTaVNfyVVPvqz N479fNHSLaYZLMcKk4eoRilU8FKp1+Zfb+iyidGexJIH92AuLXovk7GE5cg7LP3uVhgW AKkw== 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=YMGlOoCzb2k0yduh1mhM3CVSZIx7WXdMJ+kIVjs8rac=; b=neHXJC7LdOEsM7g/tHCirW/XNmzrKsomJmMrZxOkoG9Q7gdAVLAG2FgKbWPH539UML GRPS6pyf5kELxq9lH4pPmVmRPiaTNcu+6wNN/C5HyZtvGCeVZVcvs+Ozw4TrvstL9ay9 xcOQbE02gq5oPW4xwqflvsvDBmf4W6/O5vPcmfmv9CmDRIOItsyxm0uMwTegnigoTjyI XDirXhNQXvNzsgGtvP7lLMC+hcnPhKNq2OE17dsZQ/JOVA3vqyrtv0P81nOlf5l0/K42 VYT0Z7S26Ah/5bC59G0ux4kqeQ8uVRb6zqPR/dudB/0lg8jfNHUVNKM1N/X8soyFWwI2 fG/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=Ofqebp0V; dkim=neutral (no key) header.i=@vger.kernel.org; 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 cz6si477082edb.188.2020.09.01.04.57.08; Tue, 01 Sep 2020 04:57:31 -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=Ofqebp0V; dkim=neutral (no key) header.i=@vger.kernel.org; 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 S1727954AbgIALxe (ORCPT + 99 others); Tue, 1 Sep 2020 07:53:34 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39412 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727794AbgIALs1 (ORCPT ); Tue, 1 Sep 2020 07:48:27 -0400 Date: Tue, 01 Sep 2020 11:47:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598960874; 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=YMGlOoCzb2k0yduh1mhM3CVSZIx7WXdMJ+kIVjs8rac=; b=Ofqebp0VvLbKpi0maPMUag3Wk5dhHgc1xamrmuM+DxpIvt2P8ammczbCW7ubZnyZ7j1jtW tg/+c2RxOoLwKW7pfSSp6M06nVfb4DLog6Nwa614T3wsu+7rWZw77wymLTKjb4D85EE2+L 0QzU9EjEXey0LYDamIfRVCbSOjtUDkxDW0P73AFgXDEN1f2+4cSgOFZ7LBi88UQwiv0GW3 2P2Frnf2d08LB9QZ9lAafjJJp39Z3T7hNpjTtTkgumcrz+nNKOm0gDwL0PIsCdb98eE1xH HOpUu3smDfOKcIcrulB0Zd0uNrCdHHx79zK+plJkAjKGQ8h47mMXXNeQwkj8KA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598960874; 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=YMGlOoCzb2k0yduh1mhM3CVSZIx7WXdMJ+kIVjs8rac=; b=i0vqHD0pn01KlDnM4zO+WsJ7KmoZvQJ5bhFdp21KOKxvGd2AL+FYlgq0z2NL5PQvfKDCaT MCBTwB7R21hNdFBQ== From: "tip-bot2 for Kees Cook" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/build] x86/build: Add asserts for unwanted sections Cc: Kees Cook , Ingo Molnar , x86 , LKML In-Reply-To: <20200821194310.3089815-25-keescook@chromium.org> References: <20200821194310.3089815-25-keescook@chromium.org> MIME-Version: 1.0 Message-ID: <159896087347.20229.10560541261825230647.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: 5354e84598f264793265cc99b4be2a2295826c86 Gitweb: https://git.kernel.org/tip/5354e84598f264793265cc99b4be2a2295826c86 Author: Kees Cook AuthorDate: Fri, 21 Aug 2020 12:43:05 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 01 Sep 2020 10:03:18 +02:00 x86/build: Add asserts for unwanted sections In preparation for warning on orphan sections, enforce other 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 Link: https://lore.kernel.org/r/20200821194310.3089815-25-keescook@chromium.org --- arch/x86/kernel/vmlinux.lds.S | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 4b1b936..45d7244 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -427,6 +427,30 @@ SECTIONS SIZEOF(.got.plt) == 0xc, #endif "Unexpected GOT/PLT entries detected!") + + /* + * Sections that should stay zero sized, which is safer to + * explicitly check instead of blindly discarding. + */ + .got : { + *(.got) *(.igot.*) + } + ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + + .plt : { + *(.plt) *(.plt.*) *(.iplt) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + + .rel.dyn : { + *(.rel.*) *(.rel_*) + } + ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") + + .rela.dyn : { + *(.rela.*) *(.rela_*) + } + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") } #ifdef CONFIG_X86_32