public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 4/4] arm64: Trap non-PIE builds early if starting from wrong address
Date: Thu, 10 Sep 2020 09:50:52 -0400	[thread overview]
Message-ID: <20200910135052.GY7259@bill-the-cat> (raw)
In-Reply-To: <6221239e-e459-859a-5770-ea987e164640@xilinx.com>

On Thu, Sep 10, 2020 at 03:38:25PM +0200, Michal Simek wrote:
> 
> 
> On 10. 09. 20 15:06, Andr? Przywara wrote:
> > On 10/09/2020 13:38, Michal Simek wrote:
> >>
> >>
> >> On 09. 09. 20 19:07, Edgar E. Iglesias wrote:
> >>> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >>>
> >>> Trap non-PIE builds early if the start address doesn't match
> >>> between run-time and link-time. This will trap the startup
> >>> sequence rather than letting it run into obscure errors.
> >>>
> >>> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> >>> ---
> >>>  arch/arm/cpu/armv8/start.S | 13 +++++++++++++
> >>>  1 file changed, 13 insertions(+)
> >>>
> >>> diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
> >>> index e5c2856cf5..39e1b842c4 100644
> >>> --- a/arch/arm/cpu/armv8/start.S
> >>> +++ b/arch/arm/cpu/armv8/start.S
> >>> @@ -101,6 +101,19 @@ pie_skip_reloc:
> >>>  	cmp	x2, x3
> >>>  	b.lo	pie_fix_loop
> >>>  pie_fixup_done:
> >>> +#else
> >>> +	adr	x0, _start
> >>> +	ldr	x1, _TEXT_BASE
> >>> +	cmp	x0, x1
> >>> +	beq	1f
> >>> +0:
> >>> +	/*
> >>> +	 * FATAL, can't continue.
> >>> +	 * U-Boot needs to start executing at CONFIG_SYS_TEXT_BASE.
> >>> +	 */
> >>> +	wfi
> >>> +	b	0b
> >>> +1:
> >>>  #endif
> >>>  
> >>>  #ifdef CONFIG_SYS_RESET_SCTRL
> >>>
> >>
> >> NACK for this.
> >>
> >> 1. It breaks SPL flow because CONFIG_SYS_TEXT_BASE is text base for
> >> U-Boot proper
> >> 2. It likely also breaks TPL flow for the same reason
> >>
> >> 3. And last thing is that this code is used only for U-Boot proper.
> >> .globl	_TEXT_BASE
> >> _TEXT_BASE:
> >> 	.quad	CONFIG_SYS_TEXT_BASE
> >>
> >> The fixes are below. Point 3 should be likely be in separate patch
> >> because it is unrelated.
> > 
> > So if this patch causes issues, can't we just drop it? I mean right now
> > you will probably just crash anyway if you load it at the wrong address,
> > but maybe late enough that you get more hints or even some output.
> > 
> > Now this patch makes sure that you don't get anything, so I don't see
> > how this is really improving the situation. It seems like a case of
> > "don't fix things that ain't broken".
> 
> I am fine with dropping it.
> Tom: What do you think?

OK, yes, we can set this aside for now at least.  I assume this is all
for v2021.01 anyhow?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/f310e4ad/attachment.sig>

  reply	other threads:[~2020-09-10 13:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 17:07 [PATCH v3 0/4] arm64: Large PIE fixes Edgar E. Iglesias
2020-09-09 17:07 ` [PATCH v3 1/4] arm64: Mention 4K aligned load addresses in the PIE Kconfig help Edgar E. Iglesias
2020-09-09 17:07 ` [PATCH v3 2/4] arm64: Trap PIE builds early if load address is not 4K aligned Edgar E. Iglesias
2020-09-09 17:07 ` [PATCH v3 3/4] arm64: Add support for larger PIE U-Boot Edgar E. Iglesias
2020-09-10 11:37   ` Michal Simek
2020-09-09 17:07 ` [PATCH v3 4/4] arm64: Trap non-PIE builds early if starting from wrong address Edgar E. Iglesias
2020-09-10 12:38   ` Michal Simek
2020-09-10 13:06     ` André Przywara
2020-09-10 13:38       ` Michal Simek
2020-09-10 13:50         ` Tom Rini [this message]
2020-09-10 15:02           ` Michal Simek
2020-09-11  8:21             ` Edgar E. Iglesias
2020-09-09 19:16 ` [PATCH v3 0/4] arm64: Large PIE fixes Stephen Warren
2020-09-14  9:55 ` Michal Simek

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=20200910135052.GY7259@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.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