Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1792680pxk; Tue, 1 Sep 2020 07:58:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPX0q34wDYRn+V4fzSg5Pb6QgIfsW2zM1BlIgZw9EOC3U/dyLODqtPd6EeG3SYN73bMeZf X-Received: by 2002:a17:906:b09a:: with SMTP id x26mr1739259ejy.162.1598972300112; Tue, 01 Sep 2020 07:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598972300; cv=none; d=google.com; s=arc-20160816; b=sjgXI/bZV2brzPUpQ2UtLZ/aHDEx0fp2XWwNS0z5s1dhfowhGuP9P5zf/PINujaqwv e7BBWeDMmVVWSkiiHsxJVo38CscTdg4g5+t04+LkIALWjU3G9pMFgpGK+vIIpOz1o3X+ VENQDoiv0CjYL7IuqilXtej9Ehs58sENiQEaWw3TnuTgST7+lW5rYlE81zuYePK108qX aay+jL2mBEeYaYjCNDuJ5Qxfr1yMA+7WUmNDE2aLvlF+n17Va7gqVcxPY8rWWyHeu4N4 XkG6RfAG5eJNaxGujy8epEtt1+mjS/xGe30WFlHjc3THgmmZyYiQHWtw1xzF3MuPoHX2 SmDw== 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=fnzrFDElcMIXBmmpWISTaHQffUOMdRcuKTQGE2TGxh4=; b=urN3rqUyS64OamjM+HDStydhTipmpqLHsuJXWRoqUvvXEsDqcsUV4hW5u2TV0s/5GP eC6Y5t3EMNTI1fCSR9VvOiDNsi+Q6evI1uuCRvBi3AJmOMSUFKZrOb6jydL737kd4UhW HZ3KYyUz9k9erAV2cHZpAan5X/lQw3JOFTX6FlFmkujXl4w1DLXfeL0SXaoW3KkK+oXj qCZ2aSEkfmGggLsqHkIqZfLR9P5g29RKYG/wKdlqfpUryU02MWpLBaXZvdcZH9AUPWsY S7sY/uftqUK9Mu7vdwDWN+rDt8lVDG5h7NWGnCz8g0ifrnOF3x9nh9XjjEPOcIzGTv56 Upaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=XWfkwZDq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 x2si733813eju.153.2020.09.01.07.57.56; Tue, 01 Sep 2020 07:58: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=XWfkwZDq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S1728762AbgIAOy6 (ORCPT + 99 others); Tue, 1 Sep 2020 10:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbgIALs0 (ORCPT ); Tue, 1 Sep 2020 07:48:26 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BBADC061244; Tue, 1 Sep 2020 04:47:56 -0700 (PDT) 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=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=fnzrFDElcMIXBmmpWISTaHQffUOMdRcuKTQGE2TGxh4=; b=XWfkwZDq+m2Jt+Vn7Leuxr8ybTKozfJkOJt3VdfN4cF9mR+U3miFsBkdW5eyfCiPv9WK83 Ig4M7P6jBYgO5ZKFfGidAEHLvtdeow5lA/PtKIe5Lfj1mlLSLDnGitGaLen76JrLr0pECn aY0p8z+SP8oSK/kOFPC8hEhBhGC5wlzu7RRhfveZJxKhpq91dDbcfpkQPyWOcc5GMolNc1 OkCrpW8Yb+uP5IL2JI+DiOZgkjqL4elaEICNxWLIUWQqNxQ4IT9VK3w5E8wUCxrLDVdSNl U5Fihzo7+76ZKkjEw2QIRRK/ClO4wdrKkXzFK3yr3zlbsaJU1ojYpZgnYEimsQ== 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=fnzrFDElcMIXBmmpWISTaHQffUOMdRcuKTQGE2TGxh4=; b=IbiWpHiuW7sCLWhmHGv7GJ+uaKnGKdcCjZnkTbIJwVzPVz1f6CQDZZO/A+GyLcyF4nel70 59NVgKBfDmg79gDQ== 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: Reorganize zero-size section asserts Cc: Kees Cook , Ingo Molnar , x86 , LKML In-Reply-To: <20200821194310.3089815-27-keescook@chromium.org> References: <20200821194310.3089815-27-keescook@chromium.org> MIME-Version: 1.0 Message-ID: <159896087310.20229.16110579156173953333.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: 7cf891a40057f851af74e68bacb01b90bd775b5d Gitweb: https://git.kernel.org/tip/7cf891a40057f851af74e68bacb01b90bd775b5d Author: Kees Cook AuthorDate: Fri, 21 Aug 2020 12:43:07 -07:00 Committer: Ingo Molnar CommitterDate: Tue, 01 Sep 2020 10:03:18 +02:00 x86/boot/compressed: Reorganize zero-size section asserts For readability, move the zero-sized sections to the end after DISCARDS. Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200821194310.3089815-27-keescook@chromium.org --- arch/x86/boot/compressed/vmlinux.lds.S | 44 ++++++++++++++----------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index 3c2ee9a..ca544a1 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -42,19 +42,6 @@ SECTIONS *(.rodata.*) _erodata = . ; } - .rel.dyn : { - *(.rel.*) - } - .rela.dyn : { - *(.rela.*) - } - .got : { - *(.got) - } - .got.plt : { - *(.got.plt) - } - .data : { _data = . ; *(.data) @@ -85,13 +72,34 @@ SECTIONS ELF_DETAILS DISCARDS -} -ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + .got.plt (INFO) : { + *(.got.plt) + } + ASSERT(SIZEOF(.got.plt) == 0 || #ifdef CONFIG_X86_64 -ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, "Unexpected GOT/PLT entries detected!") + SIZEOF(.got.plt) == 0x18, #else -ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0xc, "Unexpected GOT/PLT entries detected!") + 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) + } + ASSERT(SIZEOF(.got) == 0, "Unexpected GOT entries detected!") + + .rel.dyn : { + *(.rel.*) + } + ASSERT(SIZEOF(.rel.dyn) == 0, "Unexpected run-time relocations (.rel) detected!") -ASSERT(SIZEOF(.rel.dyn) == 0 && SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations detected!") + .rela.dyn : { + *(.rela.*) + } + ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations (.rela) detected!") +}