All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Arvind Sankar" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Mike Lothian <mike@fireburn.co.uk>,
	Arvind Sankar <nivedita@alum.mit.edu>,
	Ard Biesheuvel <ardb@kernel.org>, x86 <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [tip: efi/urgent] x86/boot: Mark global variables as static
Date: Fri, 22 May 2020 18:30:16 -0000	[thread overview]
Message-ID: <159017221614.17951.9790248963724097639.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200511225849.1311869-1-nivedita@alum.mit.edu>

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     e78d334a5470ead861590ec83158f3b17bd6c807
Gitweb:        https://git.kernel.org/tip/e78d334a5470ead861590ec83158f3b17bd6c807
Author:        Arvind Sankar <nivedita@alum.mit.edu>
AuthorDate:    Mon, 11 May 2020 18:58:49 -04:00
Committer:     Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Thu, 14 May 2020 11:11:20 +02:00

x86/boot: Mark global variables as static

Mike Lothian reports that after commit
  964124a97b97 ("efi/x86: Remove extra headroom for setup block")
gcc 10.1.0 fails with

  HOSTCC  arch/x86/boot/tools/build
  /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld:
  error: linker defined: multiple definition of '_end'
  /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld:
  /tmp/ccEkW0jM.o: previous definition here
  collect2: error: ld returned 1 exit status
  make[1]: *** [scripts/Makefile.host:103: arch/x86/boot/tools/build] Error 1
  make: *** [arch/x86/Makefile:303: bzImage] Error 2

The issue is with the _end variable that was added, to hold the end of
the compressed kernel from zoffsets.h (ZO__end). The name clashes with
the linker-defined _end symbol that indicates the end of the build
program itself.

Even when there is no compile-time error, this causes build to use
memory past the end of its .bss section.

To solve this, mark _end as static, and for symmetry, mark the rest of
the variables that keep track of symbols from the compressed kernel as
static as well.

Fixes: 964124a97b97 ("efi/x86: Remove extra headroom for setup block")
Reported-by: Mike Lothian <mike@fireburn.co.uk>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://lore.kernel.org/r/20200511225849.1311869-1-nivedita@alum.mit.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/boot/tools/build.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index 8f8c8e3..c8b8c1a 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -59,14 +59,14 @@ u8 buf[SETUP_SECT_MAX*512];
 #define PECOFF_COMPAT_RESERVE 0x0
 #endif
 
-unsigned long efi32_stub_entry;
-unsigned long efi64_stub_entry;
-unsigned long efi_pe_entry;
-unsigned long efi32_pe_entry;
-unsigned long kernel_info;
-unsigned long startup_64;
-unsigned long _ehead;
-unsigned long _end;
+static unsigned long efi32_stub_entry;
+static unsigned long efi64_stub_entry;
+static unsigned long efi_pe_entry;
+static unsigned long efi32_pe_entry;
+static unsigned long kernel_info;
+static unsigned long startup_64;
+static unsigned long _ehead;
+static unsigned long _end;
 
 /*----------------------------------------------------------------------*/
 

  parent reply	other threads:[~2020-05-22 18:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-01 23:05 [PATCH 0/5] Minimize the need to move the kernel in the EFI stub Arvind Sankar
2020-03-01 23:05 ` [PATCH 1/5] x86/boot/compressed/32: Save the output address instead of recalculating it Arvind Sankar
2020-03-03 19:10   ` Ard Biesheuvel
2020-03-01 23:05 ` [PATCH 2/5] efi/x86: Decompress at start of PE image load address Arvind Sankar
2020-03-03  6:28   ` Mika Penttilä
2020-03-03 13:45     ` Arvind Sankar
2020-03-03 19:08   ` Ard Biesheuvel
2020-03-01 23:05 ` [PATCH 3/5] efi/x86: Add kernel preferred address to PE header Arvind Sankar
2020-03-03 19:11   ` Ard Biesheuvel
2020-03-01 23:05 ` [PATCH 4/5] efi/x86: Remove extra headroom for setup block Arvind Sankar
2020-03-02  4:21   ` Mika Penttilä
2020-03-03  4:14     ` Arvind Sankar
2020-03-01 23:05 ` [PATCH 5/5] efi/x86: Don't relocate the kernel unless necessary Arvind Sankar
2020-03-03 19:15   ` Ard Biesheuvel
2020-03-03 22:12 ` [PATCH v2 0/5] Minimize the need to move the kernel in the EFI stub Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 1/5] x86/boot/compressed/32: Save the output address instead of recalculating it Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 2/5] efi/x86: Decompress at start of PE image load address Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 3/5] efi/x86: Add kernel preferred address to PE header Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 4/5] efi/x86: Remove extra headroom for setup block Arvind Sankar
2020-05-11 17:01     ` Mike Lothian
2020-05-11 18:36       ` Arvind Sankar
2020-05-11 21:13         ` Ard Biesheuvel
2020-05-11 22:53           ` Arvind Sankar
2020-05-11 22:58             ` [PATCH] x86/boot: Mark global variables as static Arvind Sankar
2020-05-11 23:12               ` Mike Lothian
2020-05-12 11:05                 ` Ard Biesheuvel
2020-05-22 18:30               ` tip-bot2 for Arvind Sankar [this message]
2020-03-03 22:12   ` [PATCH v2 5/5] efi/x86: Don't relocate the kernel unless necessary Arvind Sankar
2020-03-03 23:08     ` Ard Biesheuvel
2020-03-03 23:34       ` Arvind Sankar
2020-03-04  7:30         ` Ard Biesheuvel
2020-03-03 22:26   ` [PATCH v2 0/5] Minimize the need to move the kernel in the EFI stub Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159017221614.17951.9790248963724097639.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=ardb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mike@fireburn.co.uk \
    --cc=nivedita@alum.mit.edu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.