Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp472873yba; Wed, 15 May 2019 04:45:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4QoftWwrOAZiuT4IkW5cEFXaeCuH8JJzecRNNeZjhxGLBkoSvlKcKWSLMBr143ueDmePf X-Received: by 2002:a17:902:9a83:: with SMTP id w3mr43661669plp.241.1557920731916; Wed, 15 May 2019 04:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557920731; cv=none; d=google.com; s=arc-20160816; b=MceqZ3YsbKvVjb+4YFuKx4P86Iejtbt9N9zhkpD+jQ8PXki4m0dgNHQPUIW83AuoEh c6pKh+xXYRL/8c3FqKr9Zev3xpk9HGe9OiaFEDPL1VdlQiyyeNLvIhRd+8LoNgSEHAyO H3PcGf+FzpmBAMF7TbJ41SjPPQoe9hptDwOpCpVKbqz2V2UWlvOvPqhiDk5dH9RiRdtD Xi5dnERSjb3OXbFkbszioi+yEHUz7zZuPlhejT7GAqnALz6LYRtdKgDS8eHr59MBZ+LZ oiqfoEVFMFfA11hTixy5QjfRAvZnAfCR8VLXUMZLAcdXJBoR0xP73DS3kgEoNSRv/47g H48g== 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=GX1LNFbuUbawrRLnHUPk6ar6Mbynl4D7Nk7maWUXj2E=; b=Me8HqJQ/Kl8Qp3qYBa08aFiBa0hm1qA1Cj/BNLeXazF40XQR1ZogMOnCIuIBL9blVY vKyjHEG9JAGGG7RWvS70eORpg5/W2NCvyB+FvBG852xQCEjxSXfRyeH4+5HQYu+Mg2MZ 4kgl8dwm5zQn/r7kxwE/uB7otU7z46kNdvp6/g0j40DSX/qAbuC3sSbdnDk8KbsF9d0U brj+b1rU3EzBLeZdtWr1QwXvj2BbYfKWU/kvnNaXWQkdOFbEpbba7WyCnrQzm9LbjJQn tN+GZGbthkC0WngCifnAYLTip6kSn+yTgPHKaReJP7xPpgebC/RYxzTzfp5dNYn5Iric 1tFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vzrNBzSY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y83si1911798pfb.161.2019.05.15.04.45.16; Wed, 15 May 2019 04:45:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vzrNBzSY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732290AbfEOL1v (ORCPT + 99 others); Wed, 15 May 2019 07:27:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732275AbfEOL1p (ORCPT ); Wed, 15 May 2019 07:27:45 -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 7B7C920818; Wed, 15 May 2019 11:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919665; bh=/DZk7Tjs2OD9MFeDI6pcdJwNuMYfGUliVRI3kPiKr1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzrNBzSYuCh2lIpSdp8TXSNQGwIdEeksr/Wc4glMzU6EQGBw8PYJ+olBwG5AjexcI BtkGA1Nndx4QWLGJWHXAgWg0uAfTYrQ8reKHevV7q82WEAYSKlX03xYXrNFcijkrvp Q6ECx4/IfprA9SmAdnHExNXUKbi/Qk0NNI0fS0cI= 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 5.0 047/137] x86/build/lto: Fix truncated .bss with -fdata-sections Date: Wed, 15 May 2019 12:55:28 +0200 Message-Id: <20190515090656.873641624@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@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 [ 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 ee3b5c7d662e1..c45214c44e612 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -362,7 +362,7 @@ SECTIONS .bss : AT(ADDR(.bss) - LOAD_OFFSET) { __bss_start = .; *(.bss..page_aligned) - *(.bss) + *(BSS_MAIN) BSS_DECRYPTED . = ALIGN(PAGE_SIZE); __bss_stop = .; -- 2.20.1