mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miroslav Benes <mbenes@suse.cz>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	 live-patching@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	 Joe Lawrence <joe.lawrence@redhat.com>,
	Song Liu <song@kernel.org>,
	 Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	 linux-arm-kernel@lists.infradead.org,
	Mark Rutland <mark.rutland@arm.com>,
	 Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	 Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 07/14] objtool: Extricate checksum calculation from validate_branch()
Date: Wed, 11 Mar 2026 09:24:22 +0100 (CET)	[thread overview]
Message-ID: <alpine.LSU.2.21.2603110916110.19933@pobox.suse.cz> (raw)
In-Reply-To: <ssvxqrraejznlambdt3yunuteguhu22yef236ngtqnpyhxruc6@bx2dhcbpzrbq>

On Tue, 10 Mar 2026, Josh Poimboeuf wrote:

> On Tue, Mar 10, 2026 at 11:47:41AM +0100, Miroslav Benes wrote:
> > Hi,
> > 
> > > @@ -3691,9 +3691,30 @@ static void checksum_update_insn(struct objtool_file *file, struct symbol *func,
> > >  				 struct instruction *insn)
> > >  {
> > >  	struct reloc *reloc = insn_reloc(file, insn);
> > > +	struct alternative *alt;
> > >  	unsigned long offset;
> > >  	struct symbol *sym;
> > >  
> > > +	for (alt = insn->alts; alt; alt = alt->next) {
> > > +		struct alt_group *alt_group = alt->insn->alt_group;
> > > +
> > > +		checksum_update(func, insn, &alt->type, sizeof(alt->type));
> > > +
> > > +		if (alt_group && alt_group->orig_group) {
> > > +			struct instruction *alt_insn;
> > > +
> > > +			checksum_update(func, insn, &alt_group->feature, sizeof(alt_group->feature));
> > > +
> > > +			for (alt_insn = alt->insn; alt_insn; alt_insn = next_insn_same_sec(file, alt_insn)) {
> > > +				checksum_update_insn(file, func, alt_insn);
> > > +				if (alt_insn == alt_group->last_insn)
> > > +					break;
> > > +			}
> > > +		} else {
> > > +			checksum_update(func, insn, &alt->insn->offset, sizeof(alt->insn->offset));
> > > +		}
> > > +	}
> > > +
> > 
> > does this hunk belong to the patch? Unless I am missing something, it 
> > might be worth a separate one.
> 
> It belongs, but I should have clarified that in the patch description.
> 
> This hunk wasn't needed before because validate_branch() already
> iterates all the alternatives, so it was calling checksum_update_insn()
> for every instruction in the function, including the alternatives.
> 
> Now that it's no longer called by validate_branch(),
> checksum_update_insn() has to manually iterate the alternatives.

After writing the email I had a suspicion it must have been something like 
above but failed to find it. Now I see that next_insn_to_validate() called 
in do_validate_branch() handles exactly that. Thanks for the pointer. The 
patch looks good to me then (and the rest as well as far as I can judge).

I must admit that objtool has gotten so complex that I have a hard time to 
track everything in the code :).

Regards
Miroslav

  reply	other threads:[~2026-03-11  8:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05  3:31 [PATCH 00/14] objtool/arm64: Port klp-build to arm64 Josh Poimboeuf
2026-03-05  3:31 ` [PATCH 01/14] objtool: Fix data alignment in elf_add_data() Josh Poimboeuf
2026-03-09 19:54   ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2026-03-05  3:31 ` [PATCH 02/14] objtool: Fix ERROR_INSN() error message Josh Poimboeuf
2026-03-09 19:54   ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2026-03-05  3:31 ` [PATCH 03/14] arm64: Annotate intra-function calls Josh Poimboeuf
2026-03-11 23:12   ` Song Liu
2026-03-05  3:31 ` [PATCH 04/14] arm64: head: Move boot header to .head.data Josh Poimboeuf
2026-03-11 23:12   ` Song Liu
2026-03-05  3:31 ` [PATCH 05/14] arm64: Fix EFI linking with -fdata-sections Josh Poimboeuf
2026-03-11 23:12   ` Song Liu
2026-03-05  3:31 ` [PATCH 06/14] crypto: arm64: Move data to .rodata Josh Poimboeuf
2026-03-05  3:31 ` [PATCH 07/14] objtool: Extricate checksum calculation from validate_branch() Josh Poimboeuf
2026-03-10 10:47   ` Miroslav Benes
2026-03-10 16:27     ` Josh Poimboeuf
2026-03-11  8:24       ` Miroslav Benes [this message]
2026-03-17 17:21         ` Josh Poimboeuf
2026-03-05  3:31 ` [PATCH 08/14] objtool: Allow setting --mnop without --mcount Josh Poimboeuf
2026-03-11 23:13   ` Song Liu
2026-03-05  3:31 ` [PATCH 09/14] kbuild: Only run objtool if there is at least one command Josh Poimboeuf
2026-03-14  0:45   ` Nathan Chancellor
2026-03-05  3:31 ` [PATCH 10/14] objtool: Ignore jumps to the end of the function for non-CFG arches Josh Poimboeuf
2026-03-11 23:14   ` Song Liu
2026-03-05  3:31 ` [PATCH 11/14] objtool: Allow empty alternatives Josh Poimboeuf
2026-03-11 23:14   ` Song Liu
2026-03-05  3:31 ` [PATCH 12/14] objtool: Reuse consecutive string references Josh Poimboeuf
2026-03-11 23:15   ` Song Liu
2026-03-05  3:31 ` [PATCH 13/14] objtool: Introduce objtool for arm64 Josh Poimboeuf
2026-03-05  3:31 ` [PATCH 14/14] klp-build: Support cross-compilation Josh Poimboeuf
2026-03-11 23:18   ` Song Liu
2026-03-16 19:15     ` Josh Poimboeuf
2026-03-17 17:52       ` Josh Poimboeuf
2026-03-17 18:21         ` Song Liu
2026-03-17 18:53           ` Josh Poimboeuf
2026-03-17 18:58             ` Song Liu
2026-03-11 23:23 ` [PATCH 00/14] objtool/arm64: Port klp-build to arm64 Song Liu

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=alpine.LSU.2.21.2603110916110.19933@pobox.suse.cz \
    --to=mbenes@suse.cz \
    --cc=catalin.marinas@arm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --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=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=peterz@infradead.org \
    --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 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®