All of lore.kernel.org
 help / color / mirror / Atom feed
From: Waldemar Brodkorb <wbx@openadk.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Waldemar Brodkorb <wbx@openadk.org>,
	linux-sh@vger.kernel.org, Max Filippov <jcmvbkbc@gmail.com>,
	Greg Ungerer <gerg@linux-m68k.org>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: Re: [PATCH] sh: select BINFMT_FLAT_NO_DATA_START_OFFSET for noMMU
Date: Tue, 20 Oct 2026 09:21:00 +0200	[thread overview]
Message-ID: <atcWXCw-LNI1D-Ew@waldemar-brodkorb.de> (raw)
In-Reply-To: <CAMuHMdUCTOxqwHnh0nnQOntSLq+WEXdZ0KubV89sfz33wufgbg@mail.gmail.com>

Hi Geert,
Geert Uytterhoeven wrote,

> Hi Waldemar,
> 
> On Tue, 20 Oct 2026 at 06:00, Waldemar Brodkorb <wbx@openadk.org> wrote:
> > binfmt_flat offsets the in-memory start of the data segment by
> > MAX_SHARED_LIBS words and then aligns it to FLAT_DATA_ALIGN, so FLAT_FLAG_RAM
> > binaries end up with a gap between text and data (commit 2217b9826246
> > ("binfmt_flat: revert "binfmt_flat: don't offset the data start"")).
> >
> > SH position-independent code finds the GOT with a PC-relative mova of
> > _GLOBAL_OFFSET_TABLE_, which assumes data follows text directly, as elf2flt
> > lays out the image. With the gap, the GOT register points below the real GOT,
> > so every GOT load reads the neighbouring slot and gets a wrong pointer. On a
> > J2 (sh2eb, noMMU) this made userland crash or hang right after start-up.
> > In my case the data was moved up by 0x20 bytes.
> >
> > Commit 04d82a6d0881 ("binfmt_flat: allow not offsetting data start") added
> > CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET for architectures that cannot
> > tolerate such a gap; currently only riscv noMMU selects it. Select it on SH
> > as well when building without an MMU.
> 
> Thanks for your patch!
> 
> > Tested on a J2 board (Numato Mimas V2, sh2eb, noMMU) with Linux 6.18 and
> > FLAT binaries built with elf2flt: with this change the data segment starts
> > exactly at the end of text and init runs.
> 
> V6.18 is getting a bit old. Can you please verify on v7.3?

The problem with Linus 7.3 tree is, that Florian's patch which fixes the
compile error with nstree.c is not in. Or do you mean linux-sh tree
for-next branch with Florian's commit eb549e808390eeecf07618b8c3a82a6f2a887e70?
 
best regards
 Waldemar

  reply	other threads:[~2026-10-20  7:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  4:00 [PATCH] sh: select BINFMT_FLAT_NO_DATA_START_OFFSET for noMMU Waldemar Brodkorb
2026-10-20  6:57 ` Geert Uytterhoeven
2026-10-20  7:21   ` Waldemar Brodkorb [this message]
2026-10-20  7:37     ` Geert Uytterhoeven

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=atcWXCw-LNI1D-Ew@waldemar-brodkorb.de \
    --to=wbx@openadk.org \
    --cc=damien.lemoal@wdc.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-sh@vger.kernel.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 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.