Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1195939pxa; Thu, 20 Aug 2020 05:20:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9OY/6vM2BviaCELLk9zbBeeJvN/ODB9RkCxt9T1bvmlBTj1vgBMBmrCrL+Ln8EzYW855A X-Received: by 2002:aa7:d3c2:: with SMTP id o2mr2656321edr.11.1597926059226; Thu, 20 Aug 2020 05:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597926059; cv=none; d=google.com; s=arc-20160816; b=SvVzkmwML41wvgTONSTTok+k0DyzJS0HO/s0xr9gpDHlAgxy5/58lFUfeUTSxczVdt 9CzsBj9X+XPWYhRCFesraoZOUVWkLj7JTrEJVXc+EtgeZFp2bXz79+/hhPl/ejGNHTJ5 QX27lC3njoJm/zHbnm0+SkQXG4/uEu7aTdxiOjSEHl22wK/Zmj3VAvHOPiR2xOysh0yx VEUVUbHVeP8zg8HWt23cRoQvZTGa4+BTNZo7vJXPJlvGuCaS6Pc5/QjCEd3Jb7oAqvwS OIKanVSMBkG+Mqr6Nma5QEDYUuS0buj3F7H/vkCPgWkc0rrgRUk/PRPay1+T2hE/5RYc l9Xg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oDl6rXgaOudx40H6+lFFCAd0YvuUcVsmM9xEGIxArNM=; b=Y+5zFlkIW/y6IVvsQO/UoFOOgG3uXdnTigwt6u9h96850EEdKF6sUHOJuA0H6TbKBG wAklZsQU5oFAjb1fZM9W9o1IT7LjnCEyINUIxSjk/gEoiLWEkVUYsIAB3IigRzVDGJV/ Y8WkF6NdhDYAzKcPtHM7ZZHk4QuUObDx84+k7DCY0hv0itY8kqRfHVDOU424Op7momHN rkmn2wbERFUMCV312bxbg+JqvTPMfjA6dGvA0lnluyw6D1YPShv52/iN9NBC4UrOgp0z ruIea9GUFF09u6rEs2+QBziTtEf2fRjT3y+2zfUxKquB55mcOmBbizBxuuKtFr8YwNai 6Sqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l1kJ5z9v; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq8si1239736ejb.282.2020.08.20.05.20.35; Thu, 20 Aug 2020 05:20:59 -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=pass header.i=@kernel.org header.s=default header.b=l1kJ5z9v; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730002AbgHTMRy (ORCPT + 99 others); Thu, 20 Aug 2020 08:17:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:40042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730230AbgHTJ4g (ORCPT ); Thu, 20 Aug 2020 05:56:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BBC820885; Thu, 20 Aug 2020 09:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917395; bh=G+G+Ym26cq/41gK660ylSESL4nMsWXnY8y2UDQq+AgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l1kJ5z9vR51mVmXkSPPyhI8cAk0QMZTjov4SF4dp/eYl6rVVr9hqT4P36PYP3TYfu eRiFJvmneoU5sGpOoNU28nQmtbNOlMSwFvhcjZRGHphTQ9UqL3US5Ifm8OfZc1ru5n Ibm+LgdQro8Xiu49B0nJg7vRXOP1vLbvFIIM82DA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , Nick Desaulniers , Kees Cook , Borislav Petkov , Linus Torvalds , Nicholas Piggin , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 4.9 017/212] x86/build/lto: Fix truncated .bss with -fdata-sections Date: Thu, 20 Aug 2020 11:19:50 +0200 Message-Id: <20200820091603.210193271@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091602.251285210@linuxfoundation.org> References: <20200820091602.251285210@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sami Tolvanen [ Upstream commit 6a03469a1edc94da52b65478f1e00837add869a3 ] With CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y, we compile the kernel with -fdata-sections, which also splits the .bss section. The new section, with a new .bss.* name, which pattern gets missed by the main x86 linker script which only expects the '.bss' name. This results in the discarding of the second part and a too small, truncated .bss section and an unhappy, non-working kernel. Use the common BSS_MAIN macro in the linker script to properly capture and merge all the generated BSS sections. Signed-off-by: Sami Tolvanen Reviewed-by: Nick Desaulniers Reviewed-by: Kees Cook Cc: Borislav Petkov Cc: Kees Cook Cc: Linus Torvalds Cc: Nicholas Piggin Cc: Nick Desaulniers Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20190415164956.124067-1-samitolvanen@google.com [ Extended the changelog. ] Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- arch/x86/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 097268f85e4ee..0df44e4fe7cb1 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -329,7 +329,7 @@ SECTIONS .bss : AT(ADDR(.bss) - LOAD_OFFSET) { __bss_start = .; *(.bss..page_aligned) - *(.bss) + *(BSS_MAIN) . = ALIGN(PAGE_SIZE); __bss_stop = .; } -- 2.25.1