linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/2] arm64: restrict initrd placement to guarantee linear region coverage
Date: Wed, 30 Mar 2016 15:18:41 +0200	[thread overview]
Message-ID: <1459343923-16283-1-git-send-email-ard.biesheuvel@linaro.org> (raw)

Since commit a7f8de168ace ("arm64: allow kernel Image to be loaded anywhere
in physical memory"), we need to take some extra care to ensure that the linear
region covers the kernel image if the [disjoint] placement of system RAM in
the physical address space spans a larger distance than we can cover with the
linear mapping.

A related issue, which is not currently covered, may occur if the kernel Image
is loaded high up in physical memory while the initrd is placed close to the
beginning of memory, in a way that does not allow the linear mapping to cover
both entirely. This will currently go undetected by relocate_initrd(), and will
crash the kernel as soon as it tries to access the initrd contents.

Rather than updating relocate_initrd() to deal with this case as well, this
series replaces it with
a) a new arm64 boot protocol requirement to place the kernel Image and the
   initrd within a reasonable distance of each other, so that the linear region
   issue described above can no longer occur,
b) code to add back the memory covered by the initrd if it was removed from the
   linear region due to a mem= kernel command line parameter, which is the use
   case relocate_initrd() was designed to address in the first place.

This way, we can remove relocate_initrd() entirely, and simply rely on the
placement of initrd by the bootloader. The only side effect is that the mem=
limit could be relaxed somewhat (i.e., by the size of the initrd) if the initrd
is placed outside of the memory that is covered by the mem= parameter. This is
entirely under the control of the bootloader, and if this is a concern, the
bootloader should pass mem= and initrd= arguments which are mutually consistent.

Ard Biesheuvel (2):
  arm64: add the initrd region to the linear mapping explicitly
  arm64: remove the now unneeded relocate_initrd()

 Documentation/arm64/booting.txt |  4 ++
 arch/arm64/kernel/setup.c       | 64 --------------------
 arch/arm64/mm/init.c            | 29 +++++++++
 3 files changed, 33 insertions(+), 64 deletions(-)

-- 
2.5.0

             reply	other threads:[~2016-03-30 13:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 13:18 Ard Biesheuvel [this message]
2016-03-30 13:18 ` [PATCH 1/2] arm64: add the initrd region to the linear mapping explicitly Ard Biesheuvel
2016-03-30 13:18 ` [PATCH 2/2] arm64: remove the now unneeded relocate_initrd() 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=1459343923-16283-1-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).