On Wed, Sep 22, 2021 at 11:44:41PM +0000, Fenghua Yu wrote: > > Since you're making it a fatal error, before doing much of anything > > else, you might at well fail decode and keep it all in the x86/decode.c > > file, no need to spread this 'knowledge' any further.
> Is the following updated patch a right one? Yes, that's what I was thinking of. > diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c > index bc821056aba9..3e0f928e28a5 100644 > --- a/tools/objtool/arch/x86/decode.c > +++ b/tools/objtool/arch/x86/decode.c > @@ -110,7 +110,7 @@ int arch_decode_instruction(const struct elf *elf, const > struct section *sec, > { > struct insn insn; > int x86_64, ret; > - unsigned char op1, op2, > + unsigned char op1, op2, op3, > rex = 0, rex_b = 0, rex_r = 0, rex_w = 0, rex_x = 0, > modrm = 0, modrm_mod = 0, modrm_rm = 0, modrm_reg = 0, > sib = 0, /* sib_scale = 0, */ sib_index = 0, sib_base = 0; > @@ -137,6 +137,7 @@ int arch_decode_instruction(const struct elf *elf, const > struct section *sec, > > op1 = insn.opcode.bytes[0]; > op2 = insn.opcode.bytes[1]; > + op3 = insn.opcode.bytes[2]; > > if (insn.rex_prefix.nbytes) { > rex = insn.rex_prefix.bytes[0]; > @@ -489,6 +490,16 @@ int arch_decode_instruction(const struct elf *elf, const > struct section *sec, > /* nopl/nopw */ > *type = INSN_NOP; > > + } 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. > + > } else if (op2 == 0xa0 || op2 == 0xa8) { > > /* push fs/gs */ _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu