Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
	james.morse@arm.com, linux-arm-kernel@lists.infradead.org,
	suzuki.poulose@arm.com
Subject: Re: [PATCH] arm64: set TEXT_OFFSET to 0x0 in preparation for removing it entirely
Date: Wed, 15 Apr 2020 09:39:00 +0100	[thread overview]
Message-ID: <20200415083900.GA12621@willie-the-truck> (raw)
In-Reply-To: <20200415082922.32709-1-ardb@kernel.org>

On Wed, Apr 15, 2020 at 10:29:22AM +0200, Ard Biesheuvel wrote:
> TEXT_OFFSET on arm64 is a historical artifact from the early days of
> the arm64 port where the boot protocol was basically 'copy this image
> to the base of memory + 512k', giving us 512 KB of guaranteed BSS space
> to put the swapper page tables. When the arm64 port was merged for
> v3.10, the Image header already carried the actual value of TEXT_OFFSET,
> to allow the bootloader to discover it dynamically rather than hardcode
> it to 512 KB.

Hey, we're older than that! (3.7)

> Today, this memory window is not used for any particular purpose, and
> it is simply handed to the page allocator at boot. The only reason it
> still exists is because of the 512k misalignment it causes with respect
> to the 2 MB aligned virtual base address of the kernel, which affects
> the virtual addresses of all statically allocated objects in the kernel
> image.
> 
> However, with the introduction of KASLR in v4.6, we added the concept of
> relocatable kernels, which rewrite all absolute symbol references at
> boot anyway, and so the placement of such kernels in the physical address
> space is irrelevant, provided that the minimum segment alignment is
> honoured (64 KB in most cases, 128 KB for 64k pages kernels with vmap'ed
> stacks enabled). This makes 0x0 and 512 KB equally suitable values for
> TEXT_OFFSET on the off chance that we are dealing with boot loaders that
> ignore the value passed via the header entirely.
> 
> Considering that the distros as well as Android ship KASLR-capable
> kernels today, and the fact that TEXT_OFFSET was discoverable from the
> Image header from the very beginning, let's change this value to 0x0, in
> preparation for removing it entirely at a later date.

Can we kill CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET at the same time please?
It seems less useful now than ever and it would move us closer to removing
the TEXT_OFFSET definition entirely (but maybe we should wait a couple of
cycles before doing that... what do you reckon?).

Cheers,

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-04-15  8:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15  8:29 [PATCH] arm64: set TEXT_OFFSET to 0x0 in preparation for removing it entirely Ard Biesheuvel
2020-04-15  8:39 ` Will Deacon [this message]
2020-04-15  8:48   ` Ard Biesheuvel
2020-04-15  9:15     ` Will Deacon
2020-04-28 13:41     ` Will Deacon
2020-04-28 14:49 ` Will Deacon
2020-06-04 14:41   ` Marc Zyngier
2020-06-04 15:01     ` Will Deacon
2020-06-04 15:25       ` Marc Zyngier
2020-06-04 15:41         ` Ard Biesheuvel
2020-06-04 15:48           ` Ard Biesheuvel
2020-06-04 16:07             ` Marc Zyngier
2020-06-09 12:35           ` Jonathan Marek
2020-06-09 12:37             ` Ard Biesheuvel
2020-06-09 12:52               ` Jonathan Marek
2020-06-10  8:57                 ` Mark Rutland
2020-06-10  9:25                   ` 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=20200415083900.GA12621@willie-the-truck \
    --to=will@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=suzuki.poulose@arm.com \
    /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