Re: x86 entry perf unwinding failure (missing IRET_REGS annotation on stack switch?)

From: Josh Poimboeuf
Date: Tue Apr 28 2020 - 10:32:07 EST


On Tue, Apr 28, 2020 at 04:16:14PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 28, 2020 at 02:46:27PM +0200, Peter Zijlstra wrote:
> > On Tue, Apr 28, 2020 at 02:04:50AM -0500, Josh Poimboeuf wrote:
>
> > > I'm thinking something like this should fix it. Peter, does this look
> > > ok?
> >
> > Unfortunate. But also, I fear, insufficient. Specifically consider
> > things like:
> >
> > ALTERNATIVE "jmp 1f",
> > "alt...
> > "..."
> > "...insn", X86_FEAT_foo
> > 1:
> >
> > This results in something like:
> >
> >
> > .text .altinstr_replacement
> > e8 xx ...
> > 90
> > 90
> > ...
> > 90
> >
> > Where all our normal single byte nops (0x90) are unreachable with
> > undefined CFI, but the alternative might have CFI, which is never
> > propagated.
> >
> > We ran into this with the validate_alternative stuff from Alexandre.
>
> > So rather than hacking around this issue, should we not make
> > create_orc() smarter?
> >
> > I'm trying to come up with something, but so far I'm just making a mess.
>
> Like this, it's horrid, but it seems to work.
>
> What do you think of the approach? I'll work on cleaning it up if you
> don't hate it too much ;-)

How'd you know I'd hate it ;-)

That's quite the monstrosity, and I still don't see the point. I
thought we decided to just disallow CFI changes in alternatives anyway?
That can be done much simpler.

--
Josh