All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Arvind Sankar <nivedita@alum.mit.edu>
Subject: Re: [PATCH v2 0/3] x86/boot: get rid of GOT entries and associated fixup code
Date: Sat, 23 May 2020 11:16:42 -0400	[thread overview]
Message-ID: <20200523151642.GA1189358@rani.riverdale.lan> (raw)
In-Reply-To: <20200523120021.34996-1-ardb@kernel.org>

On Sat, May 23, 2020 at 02:00:18PM +0200, Ard Biesheuvel wrote:
> Building position independent code using GCC by default results in references
> to symbols with external linkage to be resolved via GOT entries, which
> carry the absolute addresses of the symbols, and thus need to be corrected
> if the load time address of the executable != the link time address.
> 
> For fully linked binaries, such GOT indirected references are completely
> useless, and actually make the startup code more complicated than necessary,
> since these corrections may need to be applied more than once. In fact, we
> have been very careful to avoid such references in the EFI stub code, since
> it would require yet another [earlier] pass of GOT fixups which we currently
> don't implement.
> 
> Older GCCs were quirky when it came to overriding this behavior using symbol
> visibility, but now that we have increased the minimum GCC version to 4.6,
> we can actually start setting the symbol visibility to 'hidden' globally for
> all symbol references in the decompressor, getting rid of the GOT entirely.
> This means we can get rid of the GOT fixup code right away, and we can start
> using ordinary external symbol references in the EFI stub without running the
> risk of boot regressions. (v2 note: we have already started doing this)
> 
> CC'ing Linus and Maarten, who were involved in diagnosing an issue related
> to GOT entries emitted from the EFI stub ~5 years ago. [0] [1]
> 
> Many thanks to Arvind for the suggestions and the help in testing these
> changes. Tested on GCC 4.6 + binutils 2.24 (Ubuntu 14.04), and GCC 8 +
> binutils 2.31 (Debian Buster)
> 
> Changes since v1 [2]:
> Rebase only - recent EFI changes have moved all the C code into
> drivers/firmware/efi/libstub/, which is also built with hidden
> visibility, and contains an additional objdump pass to detect (and
> reject) absolute symbol references.
> 
> Unless anyone objects, I'd like to incorporate these changes into my
> late EFI PR for v5.8, which will go out in a day or two.
> 
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Arvind Sankar <nivedita@alum.mit.edu>
> 
> [0] https://lore.kernel.org/lkml/5405E186.2080406@canonical.com/
> [1] https://lore.kernel.org/lkml/CA+55aFxW9PmtjOf9nUQwpU8swsFqJOz8whZXcONo+XFmkSwezg@mail.gmail.com/
> [2] https://lore.kernel.org/linux-efi/20200108102304.25800-1-ardb@kernel.org/
> 

Haha, I was actually doing exactly the same thing as part of getting the
compressed kernel linkable with LLD.

Acked-by: Arvind Sankar <nivedita@alum.mit.edu>

      parent reply	other threads:[~2020-05-23 15:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 12:00 [PATCH v2 0/3] x86/boot: get rid of GOT entries and associated fixup code Ard Biesheuvel
2020-05-23 12:00 ` [PATCH v2 1/3] x86/boot/compressed: move .got.plt entries out of the .got section Ard Biesheuvel
2020-05-24 15:08   ` Ingo Molnar
2020-05-24 15:11     ` Ard Biesheuvel
2020-05-24 15:14       ` Ingo Molnar
2020-05-23 12:00 ` [PATCH v2 2/3] x86/boot/compressed: force hidden visibility for all symbol references Ard Biesheuvel
2020-05-24 15:12   ` Ingo Molnar
2020-05-24 15:15     ` Ard Biesheuvel
2020-05-27 14:36   ` Arvind Sankar
2020-05-27 18:29     ` Brian Gerst
2020-05-27 18:30       ` Ard Biesheuvel
2020-05-28  7:46     ` Ard Biesheuvel
2020-05-23 12:00 ` [PATCH v2 3/3] x86/boot/compressed: get rid of GOT fixup code Ard Biesheuvel
2020-05-23 15:17   ` Arvind Sankar
2020-05-24  8:42     ` Ard Biesheuvel
2020-05-23 15:16 ` Arvind Sankar [this message]

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=20200523151642.GA1189358@rani.riverdale.lan \
    --to=nivedita@alum.mit.edu \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --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.