All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: Romain Naour <romain.naour@smile.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/elf2flt: fix relocations for readonly .eh_frame section
Date: Thu, 30 Dec 2021 15:56:54 +0100	[thread overview]
Message-ID: <20211230155654.1929e59d@windsurf> (raw)
In-Reply-To: <20200221235728.592613-1-romain.naour@smile.fr>

On Sat, 22 Feb 2020 00:57:28 +0100
Romain Naour <romain.naour@smile.fr> wrote:

> The patch added to fix a efl2flt segfault on ARM Cortex-m4
> introduced some regressions on m68k and ARM [2].
> 
> While debuging, we can notice the flags value (0x12f) for .eh_frame
> just before the crash.
> 
> RELOCS: .eh_frame [0x2185c20]: flags=0x12f vma=0x84384
> 
>     /* bug case: flags = 0x12f (m68k)
>      * SEC_HAS_CONTENTS 0x100
>      * SEC_DATA         0x020
>      * SEC_READONLY     0x008
>      * SEC_RELOC        0x004
>      * SEC_LOAD         0x002
>      * SEC_ALLOC        0x001
>      */
> 
> On ARM cortex-m4, we have the same flags:
> RELOCS: .ARM.exidx [0x9ac5b0]: flags=0x12f vma=0x4b4ec
> 
> So due to the new condition introduced by [1] the .eh_frame
> section located in a readonly data section will be moved to
> the "text" section.
> 
> Looking at the gcc code for m68k [3]:
> 
> "Because .eh_frame refers to both code and data, it follows that
> .eh_frame must be in the data segment itself.
> [...]
> In theory, we could create a read-only .eh_frame [...]. However,
> gcc currently handles indirect references using a per-TU constant
> pool. This means that if a function and its eh_frame are removed
> by the linker, the eh_frame's indirect references to the removed
> function will not be removed, leading to an unresolved symbol
> error."
> 
> Fix this crash by checking the section name and move
> .eh_frame section even if it is located in readonly data.
> 
> Upstream status: under review [4]
> 
> Build tested on m68k and ARM w/ host-binutils 2.33.1.
> 
> [1] 2b064f86b6a0fd683f307b51f12d9d919fcaa386
> [2] http://lists.busybox.net/pipermail/buildroot/2020-February/274593.html
> [3] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/m68k/m68k.h;h=fc65e524b139a6d43e528956a788b9110aebaf2e;hb=a0c06cc27d2146b7d86758ffa236516c6143d62c#l785
> [4] https://github.com/uclinux-dev/elf2flt/issues/12
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  ...cations-for-read-only-.eh_frame-sect.patch | 81 +++++++++++++++++++
>  1 file changed, 81 insertions(+)
>  create mode 100644 package/elf2flt/0003-elf2flt-fix-relocations-for-read-only-.eh_frame-sect.patch

If I'm not wrong, this has been replaced by
https://git.buildroot.org/buildroot/commit/package/elf2flt?id=2b064f86b6a0fd683f307b51f12d9d919fcaa386.

I'll mark this patch as Superseded, but please let me know if there's
still something to fix.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2021-12-30 14:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 23:57 [Buildroot] [PATCH] package/elf2flt: fix relocations for readonly .eh_frame section Romain Naour
2021-12-30 14:56 ` Thomas Petazzoni [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=20211230155654.1929e59d@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@buildroot.org \
    --cc=romain.naour@smile.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.