linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	"H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH v2] x86/boot: Correct relocation destination on old linkers
Date: Fri, 13 Mar 2020 14:33:50 -0400	[thread overview]
Message-ID: <20200313183349.GA1544820@rani.riverdale.lan> (raw)
In-Reply-To: <20200207214926.3564079-1-nivedita@alum.mit.edu>

On Fri, Feb 07, 2020 at 04:49:26PM -0500, Arvind Sankar wrote:
> For the 32-bit kernel, as described in commit 6d92bc9d483a ("x86/build:
> Build compressed x86 kernels as PIE"), pre-2.26 binutils generates
> R_386_32 relocations in PIE mode.  Since the startup code does not
> perform relocation, any reloc entry with R_386_32 will remain as 0 in
> the executing code.
> 
> Commit 974f221c84b0 ("x86/boot: Move compressed kernel to the end of the
> decompression buffer") added a new symbol _end but did not mark it
> hidden, which doesn't give the correct offset on older linkers. This
> causes the compressed kernel to be copied beyond the end of the
> decompression buffer, rather than flush against it. This region of
> memory may be reserved or already allocated for other purposes by the
> bootloader.
> 
> Mark _end as hidden to fix. This changes the relocation from R_386_32 to
> R_386_RELATIVE even on the pre-2.26 binutils.
> 
> For 64-bit, this is not strictly necessary, as the 64-bit kernel is only
> built as PIE if the linker supports -z noreloc-overflow, which implies
> binutils-2.27+, but for consistency, mark _end as hidden here too.
> 

Gentle reminder.

https://lore.kernel.org/lkml/20200207214926.3564079-1-nivedita@alum.mit.edu/

  reply	other threads:[~2020-03-13 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-11 19:00 [PATCH] x86/boot/compressed: " Arvind Sankar
2020-02-07 21:49 ` [PATCH v2] x86/boot: " Arvind Sankar
2020-03-13 18:33   ` Arvind Sankar [this message]
2020-05-16 23:12     ` Arvind Sankar
2020-05-19 12:35   ` [tip: x86/boot] " tip-bot2 for Arvind Sankar

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=20200313183349.GA1544820@rani.riverdale.lan \
    --to=nivedita@alum.mit.edu \
    --cc=bp@alien8.de \
    --cc=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH v2] x86/boot: Correct relocation destination on old linkers' \
    /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

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).