linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: YinFengwei <fengwei_yin@linux.alibaba.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Kees Cook <kees@kernel.org>
Cc: fengwei_yin@linux.alibaba.com, zhourundong.zrd@linux.alibaba.com
Subject: [Question] About the elf program header size
Date: Fri, 27 Jun 2025 09:04:11 +0800	[thread overview]
Message-ID: <sxokzxpo74u7yhrhfrmgtdvkpshwl464jicrwwkwtvkwl5d5dj@fqto77h2prj2> (raw)

Hi,
We had a script generated assembly code. built it with gcc and the
output elf file had 78 program headers.

On an arm64 platform, if we have 64KB base page size, the elf can
be started correctly. But if we have 4KB base page size, the elf
can NOT be started with:
    cannot execute binary file: Exec format error

Look at the function load_elf_phdrs():
        if (size == 0 || size > 65536 || size > ELF_MIN_ALIGN)
	                goto out;

ELF_MIN_ALIGN is defined as PAGE_SIZE on arm64. Which can explain
above inconsistent behaviors (from user perspetive).

I didn't find the limitation definition in ELF spec(Maybe I missed
some obvious info there). If I remove "size > ELF_MIN_ALIGN", the
same elf can be started correctly even with 4KB page size.

So my question is why we limit the who program headers total size
to PAGE_SIZE? git history couldn't tell anything because the
limitation was introduced when whole linux kernel tree was migrated
to git. Is there a possible constrain on other architecture? Thanks.


Regards
Yin, Fengwei



             reply	other threads:[~2025-06-27  1:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27  1:04 YinFengwei [this message]
2025-06-27 16:35 ` Kees Cook
2025-06-30  0:12   ` YinFengwei
2025-07-02  1:08   ` YinFengwei

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=sxokzxpo74u7yhrhfrmgtdvkpshwl464jicrwwkwtvkwl5d5dj@fqto77h2prj2 \
    --to=fengwei_yin@linux.alibaba.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zhourundong.zrd@linux.alibaba.com \
    /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