Re: [PATCH] objtool: Fix SYSCALL instruction handling and INSN_CONTEXT_SWITCH
From: Josh Poimboeuf
Date: Thu Apr 03 2025 - 15:28:47 EST
On Thu, Apr 03, 2025 at 07:57:42PM +0100, Andrew Cooper wrote:
> On 03/04/2025 7:48 pm, Josh Poimboeuf wrote:
> > With SYSCALL and SYSENTER, INSN_CONTEXT_SWITCH now has a sane
> > well-defined return semantic.
>
> Do you mean "without" here?
I was just testing to see if anybody actually read all the way to the
bottom. Congratulations, you passed the test!
> > diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
> > index 33d861c04ebd..628c2c8a0f6a 100644
> > --- a/tools/objtool/arch/x86/decode.c
> > +++ b/tools/objtool/arch/x86/decode.c
> > @@ -535,10 +535,9 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
> >
> > insn->type = INSN_JUMP_CONDITIONAL;
> >
> > - } else if (op2 == 0x05 || op2 == 0x07 || op2 == 0x34 ||
> > - op2 == 0x35) {
> > + } else if (op2 == 0x07) {
> >
> > - /* sysenter, sysret */
> > + /* sysret */
> > insn->type = INSN_CONTEXT_SWITCH;
>
> Linux doesn't use SYSEXIT, but it's conceptually like SYSRET/ERETx so
> perhaps worth keeping the 0x35 here?
In theory yes, but objtool will never support x86-32. Note I also
removed retf and jmpf, I'm thinking it's simpler to just stick to the
instructions we actually use.
--
Josh