mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Patrick Boettcher <patrick.boettcher@posteo.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org, Patrick Boettcher <p@yai.se>,
	lst@pengutronix.de
Subject: Re: [PATCH] bootm: abort if kernel is outside the first 128MB
Date: Mon, 29 Oct 2018 14:24:14 +0100	[thread overview]
Message-ID: <20181029142414.30b99d88@yaise-pc1> (raw)
In-Reply-To: <20181029115553.uyz3u7cpaxgczguz@pengutronix.de>

On Mon, 29 Oct 2018 12:55:53 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c
> > index 4cf570e57..42febdc71 100644
> > --- a/arch/arm/lib32/bootm.c
> > +++ b/arch/arm/lib32/bootm.c
> > @@ -121,6 +121,12 @@ static int get_kernel_addresses(size_t
> > image_size, spacing += image_decomp_size;
> >  	}
> >  
> > +	if ((*load_address - mem_start) > SZ_128M) {
> > +		printf("boot aborted: kernel address outside
> > 128MiB "
> > +		       "(0x%08lx)\n", *load_address);
> > +		return -ENOMEM;
> > +	}  
> 
> This is a bit harsh. The 128MiB problem only exists with
> CONFIG_AUTO_ZRELADDR enabled in the kernel, otherwise it's fine to
> put the kernel above that limit.

My patch was also a test-balloon for me to learn. Instead of returning
maybe a warning could be emitted - maybe in verbose mode only?

Hmm, no not in only-verbose-mode, because it my case it silently didn't
work, whereas with an error/warning I would have immediately understood
what's wrong.

> We only put the kernel above the 128MiB limit because we want to find
> a place where the kernel doesn't have to move itself around in order
> to not overwrite itself during decompression.
> 
> Could we instead just use 128MiB as an upper limit to put the kernel
> to?

Would that mean the maximum address is (always):

  load_address = mem_end > SZ_128M ? mem_start + SZ_128M : end_of_ram;
  load_address -= image_size + 1MiB_margin_for_dtb;

or is it only the start_address which has to be inside the first 128MB?

regards,
--
Patrick.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2018-10-29 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-28 14:24 Patrick Boettcher
2018-10-29 11:55 ` Sascha Hauer
2018-10-29 13:24   ` Patrick Boettcher [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=20181029142414.30b99d88@yaise-pc1 \
    --to=patrick.boettcher@posteo.de \
    --cc=barebox@lists.infradead.org \
    --cc=lst@pengutronix.de \
    --cc=p@yai.se \
    --cc=s.hauer@pengutronix.de \
    /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