linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Brian Gerst <brgerst@gmail.com>,
	linux-efi <linux-efi@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@suse.de>,
	Colin Ian King <colin.king@canonical.com>,
	Gary Lin <glin@suse.com>, Jiri Slaby <jslaby@suse.cz>,
	Sergey Shatunov <me@prok.pw>, Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH 3/9] efi/x86: Move efi stub globals from .bss to .data
Date: Fri, 10 Apr 2020 20:03:15 +0200	[thread overview]
Message-ID: <CAMj1kXGW6V8Zif7-95MbivNgtDoufVt=uMDtYuFvEJCzOub+sA@mail.gmail.com> (raw)
In-Reply-To: <20200410180123.GA1155098@rani.riverdale.lan>

On Fri, 10 Apr 2020 at 20:01, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Fri, Apr 10, 2020 at 06:03:38PM +0200, Ard Biesheuvel wrote:
> > On Fri, 10 Apr 2020 at 17:16, Arvind Sankar <nivedita@alum.mit.edu> wrote:
> > >
> > > On Fri, Apr 10, 2020 at 10:20:42AM +0200, Ard Biesheuvel wrote:
> > > > On Thu, 9 Apr 2020 at 23:08, Arvind Sankar <nivedita@alum.mit.edu> wrote:
> > > > >
> > > > > On Thu, Apr 09, 2020 at 04:53:07PM -0400, Brian Gerst wrote:
> > > > > > > Can we use the -fno-zero-initialized-in-bss compiler flag instead of
> > > > > > > explicitly marking global variables?
> > > > > >
> > > > > > Scratch that.  Apparently it only works when a variable is explicitly
> > > > > > initialized to zero.
> > > > > >
> > > > > > --
> > > > > > Brian Gerst
> > > > >
> > > > > Right, there doesn't seem to be a compiler option to turn off the use of
> > > > > .bss altogether.
> > > >
> > > > Yeah. I'll try to come up with a way to consolidate this a bit across
> > > > architectures (which is a bit easier now that all of the EFI stub C
> > > > code lives in the same place). It is probably easiest to use a section
> > > > renaming trick similar to the one I added for ARM (as Arvind suggested
> > > > as well, IIRC), and get rid of the per-symbol annotations altogether.
> > >
> > > Does that work for 32-bit ARM, or does it need to be .data to tell the
> > > compiler to avoid generating GOT references? If that's fine, we don't
> > > actually need to rename sections -- linker script magic is enough. For
> > > eg, the below pulls the EFI stub bss into .data for x86 without the need
> > > for the annotations.
> > >
> > > diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S
> > > index 508cfa6828c5..e324819c95bc 100644
> > > --- a/arch/x86/boot/compressed/vmlinux.lds.S
> > > +++ b/arch/x86/boot/compressed/vmlinux.lds.S
> > > @@ -52,6 +52,7 @@ SECTIONS
> > >                 _data = . ;
> > >                 *(.data)
> > >                 *(.data.*)
> > > +               drivers/firmware/efi/libstub/lib.a:(.bss .bss.*)
> > >                 _edata = . ;
> > >         }
> > >         . = ALIGN(L1_CACHE_BYTES);
> >
> > No, we can add this to ARM as well, and get rid of the
> > __efistub_global annotations entirely.
>
> Cool.
>
> >
> > We'll still need .data.efistub for the .data pieces, but that is a
> > separate issue.
>
> You can avoid that by using an archive specification like above. i.e.
> adding
>         drivers/firmware/efi/libstub/lib.a:(.data .data.*)
> to the .init.data output section will pull in just the .data input
> sections from the EFI stub into the .init.data section.

Sure. But the ARM decompressor linker script currently discards .data
before this point in the linker script, and relies on this as a safety
net to ensure that no new .data items get added to the decompressor
binary (which runs after the stub)

  reply	other threads:[~2020-04-10 18:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 13:04 [GIT PULL 0/9] EFI fixes for v5.7-rc Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 1/9] efi/cper: Use scnprintf() for avoiding potential buffer overflow Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 2/9] efi/libstub/x86: remove redundant assignment to pointer hdr Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 3/9] efi/x86: Move efi stub globals from .bss to .data Ard Biesheuvel
2020-04-09 20:05   ` Brian Gerst
2020-04-09 20:53     ` Brian Gerst
2020-04-09 21:08       ` Arvind Sankar
2020-04-10  8:20         ` Ard Biesheuvel
2020-04-10 15:16           ` Arvind Sankar
2020-04-10 16:03             ` Ard Biesheuvel
2020-04-10 18:01               ` Arvind Sankar
2020-04-10 18:03                 ` Ard Biesheuvel [this message]
2020-04-10 19:03                   ` Arvind Sankar
2020-04-11  1:03                   ` Arvind Sankar
2020-04-09 13:04 ` [PATCH 4/9] efi/x86: Always relocate the kernel for EFI handover entry Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 5/9] efi/arm: Deal with ADR going out of range in efi_enter_kernel() Ard Biesheuvel
2020-04-14  8:20   ` [tip: efi/urgent] " tip-bot2 for Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 6/9] Documentation: efi/x86: clarify EFI handover protocol and its requirements Ard Biesheuvel
2020-04-14  8:20   ` [tip: efi/urgent] Documentation/x86, efi/x86: Clarify " tip-bot2 for Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 7/9] efi/libstub/file: merge filename buffers to reduce stack usage Ard Biesheuvel
2020-04-14  8:20   ` [tip: efi/urgent] efi/libstub/file: Merge file name " tip-bot2 for Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 8/9] efi/x86: Fix the deletion of variables in mixed mode Ard Biesheuvel
2020-04-09 13:04 ` [PATCH 9/9] efi/x86: Don't remap text<->rodata gap read-only for " Ard Biesheuvel
2020-04-14  8:20   ` [tip: efi/urgent] " tip-bot2 for Ard Biesheuvel
2020-04-09 19:01 ` [GIT PULL 0/9] EFI fixes for v5.7-rc Theodore Y. Ts'o
2020-04-09 19:04   ` Ard Biesheuvel
2020-04-09 20:16     ` Theodore Y. Ts'o
2020-04-09 21:29       ` Ard Biesheuvel
2020-04-09 23:57         ` Theodore Y. Ts'o
2020-04-10  7:08           ` Ard Biesheuvel
2020-04-10 13:54             ` Dave Young
2020-04-11 19:43               ` Theodore Y. Ts'o
2020-04-12  3:51                 ` Dave Young
2020-04-13 14:07 ` David Howells

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='CAMj1kXGW6V8Zif7-95MbivNgtDoufVt=uMDtYuFvEJCzOub+sA@mail.gmail.com' \
    --to=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bp@suse.de \
    --cc=brgerst@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=glin@suse.com \
    --cc=jslaby@suse.cz \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@prok.pw \
    --cc=mingo@kernel.org \
    --cc=nivedita@alum.mit.edu \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.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).