Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

From: Josh Poimboeuf
Date: Thu Sep 23 2021 - 20:55:50 EST


On Thu, Sep 23, 2021 at 03:26:14PM +0000, Fenghua Yu wrote:
> > > + } else if (op2 == 0x38 && op3 == 0xf8) {
> > > + if (insn.prefixes.nbytes == 1 &&
> > > + insn.prefixes.bytes[0] == 0xf2) {
> > > + /* ENQCMD cannot be used in the kernel. */
> > > + WARN("ENQCMD instruction at %s:%lx", sec->name,
> > > + offset);
> > > +
> > > + return -1;
> > > + }
> >
> > The only concern here is if we want it to be fatal or not. But otherwise
> > this seems to be all that's required.
>
> objtool doesn't fail kernel build on this fatal warning.
>
> Returning -1 here stops checking the rest of the file and won't report any
> further warnings unless this ENQCMD warning is fixed. Not returning -1
> continues checking the rest of the file and may report more warnings.
> Seems that's the only difference b/w them.
>
> Should I keep this "return -1" or not? Please advice.

I'd say remove the "return -1" since it's not a fatal-type analysis
error and there's nothing to prevent objtool from analyzing the rest of
the file.

--
Josh