Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1791191pxk; Tue, 1 Sep 2020 07:55:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4OeEtFk+x01gQ5xkvL4pnqt8MFi9vmGbLWY65bZXNiBfU0n+4FkqfJrhvBJZS82MfiY+a X-Received: by 2002:a50:fb18:: with SMTP id d24mr2019229edq.149.1598972151261; Tue, 01 Sep 2020 07:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972151; cv=none; d=google.com; s=arc-20160816; b=OObN+Ic5vHoFy5DqXdLNvT8UOzDvs2cyA6ywhDbyhcHFmjIyQx0cgb8yWgLJ6gR2WV u9bGaQ2YwwYtgO8cEVHG7R6XgJt8+wJ3S3EBOkpPRxcFMDnU85zzlAkaEwXG4c33FJGi H4EXf1l+tnpS5BD+w4smsdjnkAodLNKHR95YmEuK+rnbrWwmB75MVJL08hM1IUGZKxps tZoeCs8sv6rSAJbl0eu0ZQEigbto7OWfaq3LSCV/m/CBso0uxhs3VeJJOxGU0J9Gjupk cb2eB05reTNVVYTl8I/CT+5B9tDFR+5UWo1MpCYvoZVqPaQ6Rtm8R/LGmL5gK+KAwS9S MBEA== 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=yprgOg6foVyVlOsUjNUfwCAoBKJ5aj9iejk3iX51wyA=; b=cnItwufHbEepu7g+4dh72lKYON6wWX58oBWkodDqm0pLGvJDnfDv+luht6OeKJLlBI NIN2w8EKEfmC2Y298JsOBpgQK4TUhtz1PMd0ewDRFk3x7TqJwLBy8LTsjBSn3HorCcnw +Uxmk/77lSVBmYlk4vnjbM7UrS/J0EWpyKSfGZiTI5qOuxYS8sPsI4Vy9jXmYW6Wp7ix qHiCEZCGmMpw+0EjkqPFQEMcG55wZWCLQxg0brA/0wkx3/U+3WLvMdjMcbl+w+jvi4mN TURQMqFEycjKtOKe2EjUeUM/51DA47pkWlilOMuaY1Mxrd7U9CPmHLLahKeCJibvcfEm UosA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=pCibZrkM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=NctYPYsA; 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 eb8si878784edb.246.2020.09.01.07.55.25; Tue, 01 Sep 2020 07:55:51 -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=pCibZrkM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=NctYPYsA; 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 S1728596AbgIAOty (ORCPT + 99 others); Tue, 1 Sep 2020 10:49:54 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39392 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbgIALs2 (ORCPT ); Tue, 1 Sep 2020 07:48:28 -0400 Date: Tue, 01 Sep 2020 11:47:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598960873; 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=yprgOg6foVyVlOsUjNUfwCAoBKJ5aj9iejk3iX51wyA=; b=pCibZrkMWB2oxaf7YVXBixb4wUIwC4qLiDgsekmfI66lBrF/25YfFIXz3gxaax6cT73Vvg IJXtaDpKgGgf0ZYtkO72Kp1bQWLeDU59CvvQLBsnaBsaWkGJtfxxSMZ3sbONjh25lK8uAw j6caGSZGcvoe0hUjc/0Sb5dtAOjo1riMx2awKi9KWhCfQDY3bF+oWLItCNBF7iaDzafpp+ 5wqItpBm/G7weWb2Rt80m0iFXM3et1MMQvkKS/vL7GNoZ4xn3SY0x/GyzwgcIWk3mM88H9 mV3b+bmu5c+FD0f2F2gqaka9L3e+pGC4PGA/asBKQU43Vz2tBlntGbL7KeBgWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598960873; 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=yprgOg6foVyVlOsUjNUfwCAoBKJ5aj9iejk3iX51wyA=; b=NctYPYsAtWE54wkvRrux0vJEc68qdDzR9WXLRDexSVquQBG4YDoPJLI+cXUNycJfAcj1bT K68mM5AnVP6ikmDA== 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/boot/compressed: Remove, discard, or assert for unwanted sections Cc: Kees Cook , Ingo Molnar , x86 , LKML In-Reply-To: <20200821194310.3089815-28-keescook@chromium.org> References: <20200821194310.3089815-28-keescook@chromium.org> MIME-Version: 1.0 Message-ID: <159896087273.20229.10147741624644072974.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: d1c0272bc1c068f8c2cb3d1b395173602b0df6e7 Gitweb: https://git.kernel.org/tip/d1c0272bc1c068f8c2cb3d1b395173602b0df6e7 Author: Kees Cook AuthorDate: Fri, 21 Aug 2020 12:43:08 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 01 Sep 2020 10:03:18 +02:00 x86/boot/compressed: Remove, discard, or assert for unwanted sections In preparation for warning on orphan sections, stop the linker from generating the .eh_frame* 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). Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200821194310.3089815-28-keescook@chromium.org --- arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot/compressed/vmlinux.lds.S | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 753d572..5b7f6e1 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -50,6 +50,7 @@ GCOV_PROFILE := n UBSAN_SANITIZE :=n KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) +KBUILD_LDFLAGS += $(call ld-option,--no-ld-generated-unwind-info) # Compressed kernel should be built as PIE since it may be loaded at any # address by the bootloader. LDFLAGS_vmlinux := -pie $(call ld-option, --no-dynamic-linker) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index ca544a1..02f6feb 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -72,6 +72,11 @@ SECTIONS ELF_DETAILS DISCARDS + /DISCARD/ : { + *(.dynamic) *(.dynsym) *(.dynstr) *(.dynbss) + *(.hash) *(.gnu.hash) + *(.note.*) + } .got.plt (INFO) : { *(.got.plt) @@ -93,13 +98,18 @@ SECTIONS } ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + .plt : { + *(.plt) *(.plt.*) + } + ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") + .rel.dyn : { - *(.rel.*) + *(.rel.*) *(.rel_*) } ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") .rela.dyn : { - *(.rela.*) + *(.rela.*) *(.rela_*) } ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") }