mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: Re: [PATCH master v2 0/3] Fix GCC 11 THUMB2 relocate_to_current_adr miscompile
Date: Fri, 21 Oct 2022 07:34:45 +0200	[thread overview]
Message-ID: <ea6c81b2-45d7-e7d5-c9f7-c17c00f5b6af@pengutronix.de> (raw)
In-Reply-To: <20221020131510.3734338-1-a.fatoum@pengutronix.de>

On 20.10.22 15:15, Ahmad Fatoum wrote:
> Since a8b788ba61eb ("relocate_to_current_adr: hang directly on error instead
> of panic()"),  GCC can prove that variables aren't supposed to overlap and as
> such it generated code than readded get_runtime_offset() on top of an
> already relocated linker-defined variable's address.
> See PATCH 2/3 for a disassembly of the affected code. Board code can
> be similarly micompiled, but that's a fix for another day.

v1 -> v2:
  - rename get_unrelocated() to runtime_address()
  - add Fixes: line after identifying why this issue only popped up now:
    removing panic() in relocate_to_current_adr() shifted code around
    enough for compiler to consider optimization worthwhile
  - fixed left-over + offset in RISC-V patch

> 
> Ahmad Fatoum (3):
>   include: asm-generic: reloc: implement runtime_address()
>   ARM: cpu: add compiler barrier around unrelocated access
>   RISC-V: add compiler barriers around unrelocated accesses
> 
>  arch/arm/cpu/common.c             | 15 ++++---
>  arch/arm/cpu/uncompress.c         |  4 +-
>  arch/riscv/boot/uncompress.c      |  4 +-
>  arch/riscv/include/asm/sections.h |  3 +-
>  arch/riscv/lib/reloc.c            | 10 +++--
>  include/asm-generic/reloc.h       | 69 +++++++++++++++++++++++++++++++
>  6 files changed, 91 insertions(+), 14 deletions(-)
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  parent reply	other threads:[~2022-10-21  5:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 13:15 Ahmad Fatoum
2022-10-20 13:15 ` [PATCH master v2 1/3] include: asm-generic: reloc: implement runtime_address() Ahmad Fatoum
2022-10-20 13:15 ` [PATCH master v2 2/3] ARM: cpu: add compiler barrier around unrelocated access Ahmad Fatoum
2022-10-20 13:15 ` [PATCH v2 3/3] RISC-V: add compiler barriers around unrelocated accesses Ahmad Fatoum
2022-10-21  5:34 ` Ahmad Fatoum [this message]
2022-10-24  9:03 ` [PATCH master v2 0/3] Fix GCC 11 THUMB2 relocate_to_current_adr miscompile Sascha Hauer

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=ea6c81b2-45d7-e7d5-c9f7-c17c00f5b6af@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@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