All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: x86@kernel.org
Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Song Liu" <song@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	"Petr Mladek" <pmladek@suse.com>,
	"Joe Lawrence" <joe.lawrence@redhat.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Miroslav Benes" <mbenes@suse.cz>,
	"Catalin Marinas" <catalin.marinas@arm.com>
Subject: Re: [PATCH v3 19/21] objtool/klp: Introduce objtool for arm64
Date: Fri, 15 May 2026 02:08:45 +0000	[thread overview]
Message-ID: <20260515020845.CE5B2C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <5b66146373b1ff1aba1318fd51867dea2eb882f6.1778642121.git.jpoimboe@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The arm64 instruction decoder misclassifies trap instructions (e.g., `brk #0x800` used for `BUG()`) as `INSN_OTHER` instead of `INSN_BUG`.
--

commit dd63f0c03bab6a47f34cfcb310454460653638ed
Author: Josh Poimboeuf <jpoimboe@kernel.org>

objtool/klp: Introduce objtool for arm64

This commit adds basic support for arm64 in objtool, initially enabling 
only the "objtool klp" subcommands.

> diff --git a/tools/objtool/arch/arm64/decode.c b/tools/objtool/arch/arm64/decode.c
> new file mode 100644
> index 0000000000000..47658c76e1af0
> --- /dev/null
> +++ b/tools/objtool/arch/arm64/decode.c

[ ... ]

> +int arch_decode_instruction(struct objtool_file *file, const struct section *sec,
> +			    unsigned long offset, unsigned int maxlen,
> +			    struct instruction *insn)
> +{

[ ... ]

> +	if (ins == 0xd503201f) {
> +		/* NOP: static branch */
> +		insn->type = INSN_NOP;
> +	} else if ((ins & 0xfc000000) == 0x14000000) {

[ ... ]

> +	} else if ((ins & 0x7e000000) == 0x36000000) {
> +		/* TBZ/TBNZ: intra-TU sibling call */
> +		insn->type = INSN_JUMP_CONDITIONAL;
> +		insn->immediate = sign_extend64((ins >> 5) & 0x3fff, 13);
> +	} else {
> +		insn->type = INSN_OTHER;
> +	}

Does this code misclassify trap instructions?

On arm64, BUG() is implemented using the brk instruction (such as brk #0x800).
Since the decoder doesn't appear to check for brk, it will fall through to the
else block and classify it as INSN_OTHER.

If INSN_BUG is misclassified as a normal instruction, won't this lose dead-end
propagation and corrupt objtool's control-flow analysis?

> +
> +	insn->len = 4;
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1778642120.git.jpoimboe@kernel.org?part=19

  reply	other threads:[~2026-05-15  2:08 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  3:33 [PATCH v3 00/21] objtool/arm64: Port klp-build to arm64 Josh Poimboeuf
2026-05-13  3:33 ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 01/21] klp-build: Reject patches to init/*.c Josh Poimboeuf
2026-05-13  3:33   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 02/21] arm64: Annotate intra-function calls Josh Poimboeuf
2026-05-13  3:33   ` Josh Poimboeuf
2026-05-13  3:33     ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 03/21] arm64: Fix EFI linking with -fdata-sections Josh Poimboeuf
2026-05-13  3:33   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 04/21] arm64: Rename TRAMP_VALIAS -> TRAMP_VALIAS_ASM in asm-offsets Josh Poimboeuf
2026-05-13  3:33   ` Josh Poimboeuf
2026-05-13  3:34     ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 05/21] arm64: vdso: Discard .discard.* sections Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 06/21] arm64: Annotate special section entries Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 07/21] crypto: arm64: Move data to .rodata Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 08/21] objtool: Allow setting --mnop without --mcount Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 09/21] kbuild: Only run objtool if there is at least one command Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-14 22:25   ` sashiko-bot
2026-05-13  3:33 ` [PATCH v3 10/21] objtool: Ignore jumps to the end of the function for checksum runs Josh Poimboeuf
2026-05-13  3:33   ` Josh Poimboeuf
2026-05-13  3:34     ` Josh Poimboeuf
2026-05-13  7:36     ` Peter Zijlstra
2026-05-14 22:30     ` sashiko-bot
2026-05-13  3:33 ` [PATCH v3 11/21] objtool: Allow empty alternatives Josh Poimboeuf
2026-05-13  3:33   ` Josh Poimboeuf
2026-05-13  3:34     ` Josh Poimboeuf
2026-05-13  7:37     ` Peter Zijlstra
2026-05-13  3:33 ` [PATCH v3 12/21] objtool: Refactor elf_add_data() to use a growable data buffer Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-14 23:13   ` sashiko-bot
2026-05-13  3:33 ` [PATCH v3 13/21] objtool: Reuse string references Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 14/21] objtool: Prevent kCFI hashes from being decoded as instructions Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-15  0:16   ` sashiko-bot
2026-05-13  3:33 ` [PATCH v3 15/21] objtool/klp: Add arm64 support for prefix/PFE detection Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 16/21] objtool/klp: Filter arm64 mapping symbols in find_symbol_by_offset() Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 17/21] objtool/klp: Don't correlate arm64 mapping symbols Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-15  1:19   ` sashiko-bot
2026-05-13  3:33 ` [PATCH v3 18/21] objtool/klp: Clone inline alternative replacements Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 19/21] objtool/klp: Introduce objtool for arm64 Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-15  2:08   ` sashiko-bot [this message]
2026-05-13  3:33 ` [PATCH v3 20/21] klp-build: Support cross-compilation Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-13  3:33 ` [PATCH v3 21/21] klp-build: Add arm64 syscall patching macro Josh Poimboeuf
2026-05-13  3:34   ` Josh Poimboeuf
2026-05-15  2:44   ` sashiko-bot

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=20260515020845.CE5B2C2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joe.lawrence@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=song@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@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.