mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leizhen Zhang <lzsx618@gmail.com>
To: rostedt@goodmis.org
Cc: Leizhen Zhang <lzsx618@gmail.com>,
	nathan@kernel.org, nsc@kernel.org, ljs@kernel.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/5] elf-parse: validate what the host ELF tools read from the file
Date: Sat, 24 Oct 2026 19:47:23 -0500	[thread overview]
Message-ID: <20261025004723.432708-1-lzsx618@gmail.com> (raw)
In-Reply-To: <20261019085754.1fcadee6@gandalf.local.home>

On Sun, 19 Oct 2026 08:57:54 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:
> Definitely not a security threat here. If the object files are corrupted,
> then this is not where you should be detecting it. Unless we change the
> purpose of this tool as a corruption detector, this code *expects* the
> input to not be corrupt. The reasons for checking various ELF header info
> is if someone is porting this code to a new architecture where it doesn't
> support it yet, we want to warn.
>
> I'm fine with adding robustness, but not complexity for an issue that
> should never exist.

Understood, and thank you for being direct about it. You are right and I am
dropping most of this series.

To be clear about what I did and did not establish: every reproducer in the
series is a file I corrupted by hand, one field at a time. I never had a
legitimate object that triggers any of 2/5 through 5/5, and I should have
treated "I can only reach this by editing the file" as the answer rather
than as something for you to rule on. The cover letter asked you to review
the threat-model classification; your answer is that the classification is
not the interesting question, the premise is, and that is a fair correction.

So:

 - 2/5, 3/5, 4/5, 5/5: withdrawn. They buy nothing for a toolchain-produced
   object and, as you say, if the object is corrupt the build has already
   lost. I am not going to re-send them in another shape.

 - 1/5: I would like to keep this one, and I am sending a v2 that just
   deletes the comment you called useless. Not because of the fuzzer -- that
   one does not rest on a corrupt file at all. include/uapi/linux/elf.h
   declares

	#define ET_LOPROC 0xff00
	#define ET_HIPROC 0xffff

   so a well-formed processor-specific object, and anything in the
   0xfe00..0xfeff OS-specific range the spec reserves next to it, shifts by
   more than the width of int in

	if (!((1 << type) & types))

   The tools should and still do reject such a file; they just currently get
   there through undefined behaviour, and on a UBSan build that is a hard
   error rather than a clean "Invalid ELF type". That is a one-line fix with
   no added state and no new failure mode.

   If you would rather see even that as churn, say so and I will drop it too.

 - The separate sorttable and tracepoint-update patches are the same class of
   change as 2/5-5/5. I am withdrawing both; see the other mail for the
   tracepoint one.

On the "porting to a new architecture" purpose: that is useful to know and it
is not what I assumed the checks were for. It also explains why 1/5 is worth
keeping and the rest are not -- the type check is exactly the warn-on-port
path, and it should not be the thing that trips UBSan.

Sorry for the noise on the other four.

      reply	other threads:[~2026-10-25  0:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  0:02 Leizhen Zhang
2026-10-19  0:02 ` [PATCH 1/5] elf-parse: avoid an undefined shift when checking the ELF type Leizhen Zhang
2026-10-19 12:47   ` Steven Rostedt
2026-10-25  0:44     ` [PATCH v2] " Leizhen Zhang
2026-10-19  0:02 ` [PATCH 2/5] elf-parse: check that the section header table is inside the file Leizhen Zhang
2026-10-19 12:55   ` Steven Rostedt
2026-10-19  0:02 ` [PATCH 3/5] elf-parse: check the section indices that elf_open_ro() takes from " Leizhen Zhang
2026-10-19  0:02 ` [PATCH 4/5] elf-parse: check the symbol table before walking it Leizhen Zhang
2026-10-19  0:02 ` [PATCH 5/5] elf-parse: bound symbol names by the string table Leizhen Zhang
2026-10-19 12:57 ` [PATCH 0/5] elf-parse: validate what the host ELF tools read from the file Steven Rostedt
2026-10-25  0:47   ` Leizhen Zhang [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=20261025004723.432708-1-lzsx618@gmail.com \
    --to=lzsx618@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®