linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3 4/4] arm64: Enable TEXT_OFFSET fuzzing
Date: Fri, 20 Jun 2014 09:50:08 +0100	[thread overview]
Message-ID: <20140620085008.GG25104@arm.com> (raw)
In-Reply-To: <1403174963-10730-5-git-send-email-mark.rutland@arm.com>

On Thu, Jun 19, 2014 at 11:49:23AM +0100, Mark Rutland wrote:
> The arm64 Image header contains a text_offset field which bootloaders
> are supposed to read to determine the offset (from a 2MB aligned "start
> of memory" per booting.txt) at which to load the kernel. The offset is
> not well respected by bootloaders at present, and due to the lack of
> variation there is little incentive to support it. This is unfortunate
> for the sake of future kernels where we may wish to vary the text offset
> (even zeroing it).
> 
> This patch adds options to arm64 to enable fuzz-testing of text_offset.
> CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET forces the text offset to a random
> 16-byte aligned value value in the range [0..2MB) upon a build of the
> kernel. It is recommended that distribution kernels enable randomization
> to test bootloaders such that any compliance issues can be fixed early.

[...]

> diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
> index 1c1b756..566bf80 100644
> --- a/arch/arm64/Kconfig.debug
> +++ b/arch/arm64/Kconfig.debug
> @@ -28,4 +28,20 @@ config PID_IN_CONTEXTIDR
>  	  instructions during context switch. Say Y here only if you are
>  	  planning to use hardware trace tools with this kernel.
>  
> +config ARM64_RANDOMIZE_TEXT_OFFSET
> +	bool "Randomize TEXT_OFFSET at build time (EXPERIMENTAL)"

Lose the (EXPERIMENTAL) suffix -- this already lives under Kconfig.debug.

> +	default N

I think this is redundant.

> +	help
> +	  Say Y here if you want the image load offset (AKA TEXT_OFFSET)
> +	  of the kernel to be randomized at build-time. When selected,
> +	  this option will cause TEXT_OFFSET to be randomized upon any
> +	  build of the kernel, and the offset will be reflected in the
> +	  text_offset field of the resulting Image. This can be used to
> +	  fuzz-test bootloaders which respect text_offset.
> +
> +	  This option is intended for bootloader and/or kernel testing
> +	  only. Bootloaders must make no assumptions regarding the value
> +	  of TEXT_OFFSET and platforms must not require a specific
> +	  value.

Will

  reply	other threads:[~2014-06-20  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 10:49 [PATCHv3 0/4] arm64: simplify restrictions on bootloaders Mark Rutland
2014-06-19 10:49 ` [PATCHv3 1/4] arm64: head.S: remove unnecessary function alignment Mark Rutland
2014-06-19 10:49 ` [PATCHv3 2/4] arm64: place initial page tables above the kernel Mark Rutland
2014-06-19 10:49 ` [PATCHv3 3/4] arm64: Update the Image header Mark Rutland
2014-06-20  8:55   ` Will Deacon
2014-06-20 10:32     ` Mark Rutland
2014-06-20 17:03   ` Geoff Levand
2014-06-24 13:49     ` Mark Rutland
2014-06-19 10:49 ` [PATCHv3 4/4] arm64: Enable TEXT_OFFSET fuzzing Mark Rutland
2014-06-20  8:50   ` Will Deacon [this message]
2014-06-20 10:35     ` Mark Rutland
2014-06-20  8:56 ` [PATCHv3 0/4] arm64: simplify restrictions on bootloaders Will Deacon

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=20140620085008.GG25104@arm.com \
    --to=will.deacon@arm.com \
    --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).