mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Leizhen Zhang <lzsx618@gmail.com>
Cc: peterz@infradead.org, yangtiezhu@loongson.cn,
	chenhuacai@kernel.org,  alexandre.chartre@oracle.com,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] objtool: Fix undefined behaviour reported by UBSan on a defconfig build
Date: Tue, 10 Nov 2026 17:40:18 -0800	[thread overview]
Message-ID: <avPHcvpkqSqyMPRP@jpoimboe> (raw)
In-Reply-To: <20261110000255.1720945-1-lzsx618@gmail.com>

On Mon, Nov 09, 2026 at 06:02:52PM -0600, Leizhen Zhang wrote:
> An x86_64 defconfig build of v7.4-rc2 with objtool built with
> -fsanitize=address,undefined (GCC 12) gives two UBSan reports from
> objtool, both on the normal vmlinux.o pass, no unusual input involved:
> 
>   arch/x86/orc.c:11:18: runtime error: member access within null pointer of type 'struct cfi_state'
>   special.c:84:18: runtime error: load of misaligned address ... for type 'unsigned int', which requires 4 byte alignment
> 
> 1/3 fixes the first one: init_orc_entry() takes &cfi->regs[CFI_BP]
> before its own "if (!cfi)" check.  2/3 is the same pattern in the
> LoongArch copy of the function; I compile-tested objtool for LoongArch
> but have no LoongArch object to run it on.  3/3 fixes the second one:
> the feature word of a 14-byte packed struct alt_instr is read through
> an 'unsigned int *', so every odd-numbered entry is misaligned.
> 
> Testing: I relinked vmlinux.o without objtool and ran the old and the
> new objtool binary on two copies of it, with the arguments Kbuild uses.
> The old one prints both reports, the new one prints none, and the two
> resulting vmlinux.o files are byte-identical.  A full rebuild with the
> patched objtool is also clean for objtool.
> 
> None of this is a security issue: objtool only processes objects from
> the build itself.
> 
> The two reports were found with UBSan, and the analysis and fixes were
> prepared with the help of an AI coding assistant; I reviewed and tested
> the result.
> 
> Leizhen Zhang (3):
>   objtool/x86: Move the cfi->regs access after the NULL check
>   objtool/LoongArch: Move the cfi->regs access after the NULL check
>   objtool: Fix misaligned load of the alternative feature word
> 
>  tools/objtool/arch/loongarch/orc.c | 6 ++++--
>  tools/objtool/arch/x86/orc.c       | 4 +++-
>  tools/objtool/special.c            | 4 ++--
>  3 files changed, 9 insertions(+), 5 deletions(-)

Thanks!  I will queue these up.

-- 
Josh

      parent reply	other threads:[~2026-11-11  1:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  0:02 Leizhen Zhang
2026-11-10  0:02 ` [PATCH 1/3] objtool/x86: Move the cfi->regs access after the NULL check Leizhen Zhang
2026-11-10  0:02 ` [PATCH 2/3] objtool/LoongArch: " Leizhen Zhang
2026-11-10  0:02 ` [PATCH 3/3] objtool: Fix misaligned load of the alternative feature word Leizhen Zhang
2026-11-11  1:40 ` Josh Poimboeuf [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=avPHcvpkqSqyMPRP@jpoimboe \
    --to=jpoimboe@kernel.org \
    --cc=alexandre.chartre@oracle.com \
    --cc=chenhuacai@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lzsx618@gmail.com \
    --cc=peterz@infradead.org \
    --cc=yangtiezhu@loongson.cn \
    /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®