linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	linux-kernel@vger.kernel.org,
	Arvind Sankar <nivedita@alum.mit.edu>,
	Benjamin Thiel <b.thiel@posteo.de>,
	Borislav Petkov <bp@alien8.de>, Dave Young <dyoung@redhat.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Jerry Snitselaar <jsnitsel@redhat.com>,
	Lenny Szubowicz <lszubowi@redhat.com>,
	linux-acpi@vger.kernel.org, Loic Yhuel <loic.yhuel@gmail.com>,
	Matthew Garrett <mjg59@google.com>,
	Mike Lothian <mike@fireburn.co.uk>,
	Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Subject: [PATCH 5/7] x86/boot: Mark global variables as static
Date: Sun, 17 May 2020 14:57:52 +0200	[thread overview]
Message-ID: <20200517125754.8934-6-ardb@kernel.org> (raw)
In-Reply-To: <20200517125754.8934-1-ardb@kernel.org>

From: Arvind Sankar <nivedita@alum.mit.edu>

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 8f8c8e386cea..c8b8c1a8d1fc 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;
 
 /*----------------------------------------------------------------------*/
 
-- 
2.17.1


  parent reply	other threads:[~2020-05-17 12:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 12:57 [GIT PULL 0/7] EFI fixes for v5.7 Ard Biesheuvel
2020-05-17 12:57 ` [PATCH 1/7] efi/libstub: Avoid returning uninitialized data from setup_graphics() Ard Biesheuvel
2020-05-17 12:57 ` [PATCH 2/7] efi/earlycon: Fix early printk for wider fonts Ard Biesheuvel
2020-05-17 12:57 ` [PATCH 3/7] efi/libstub/x86: Avoid EFI map buffer alloc in allocate_e820() Ard Biesheuvel
2020-05-17 12:57 ` [PATCH 4/7] efi: cper: Add support for printing Firmware Error Record Reference Ard Biesheuvel
2020-05-17 12:57 ` Ard Biesheuvel [this message]
2020-05-17 12:57 ` [PATCH 6/7] efi: Pull up arch-specific prototype efi_systab_show_arch() Ard Biesheuvel
2020-05-17 12:57 ` [PATCH 7/7] tpm: check event log version before reading final events Ard Biesheuvel
2020-05-18  9:07 ` [GIT PULL 0/7] EFI fixes for v5.7 Borislav Petkov
2020-05-18  9:15   ` Ard Biesheuvel
2020-05-22 13:06 ` Ard Biesheuvel
2020-05-22 13:40   ` Borislav Petkov
2020-05-22 13:44     ` Ard Biesheuvel
2020-05-22 14:04       ` Thomas Gleixner
2020-05-22 14:45         ` 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=20200517125754.8934-6-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=b.thiel@posteo.de \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=javierm@redhat.com \
    --cc=jsnitsel@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.yhuel@gmail.com \
    --cc=lszubowi@redhat.com \
    --cc=mike@fireburn.co.uk \
    --cc=mingo@kernel.org \
    --cc=mjg59@google.com \
    --cc=nivedita@alum.mit.edu \
    --cc=punit1.agrawal@toshiba.co.jp \
    --cc=tglx@linutronix.de \
    --cc=xypron.glpk@gmx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).