[PATCH 07/14] objtool: Extricate checksum calculation from validate_branch()

Josh Poimboeuf jpoimboe at kernel.org
Tue Mar 10 09:27:51 PDT 2026


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.

-- 
Josh



More information about the linux-arm-kernel mailing list