Re: [PATCH] objtool: Fix SYSCALL instruction handling and INSN_CONTEXT_SWITCH

From: Josh Poimboeuf
Date: Fri Apr 04 2025 - 11:02:10 EST


On Fri, Apr 04, 2025 at 04:54:12PM +0200, Peter Zijlstra wrote:
> On Fri, Apr 04, 2025 at 07:46:52AM -0700, Josh Poimboeuf wrote:
> > On Fri, Apr 04, 2025 at 12:49:38PM +0200, Peter Zijlstra wrote:
> > > On Thu, Apr 03, 2025 at 11:48:13AM -0700, Josh Poimboeuf wrote:
> > >
> > > > The real problem here is that INSN_CONTEXT_SWITCH is ambiguous. It can
> > > > represent both call semantics (SYSCALL, SYSENTER) and return semantics
> > > > (SYSRET, IRET, RETS, RETU). Those differ significantly: calls preserve
> > > > control flow whereas returns terminate it.
> > >
> > > Does that not rather suggest we should perhaps have INSN_SYSCALL /
> > > INSN_SYSRET to replace the single ambiguous thing?
> >
> > Is there any reason to have INSN_SYSCALL in the first place?
>
> This xen hyperclal thing?

SYSCALL does a hypercall. It usually returns. Which means we don't
need to care about it, except for the one case where it "calls" IRET.

That's the one with a UD2. Similar to replacing unreachable() with
BUG().

--
Josh