Re: [syzbot] upstream test error: KASAN: invalid-access Read in __entry_tramp_text_end

Peter Zijlstra
2021-09-29T10:02:49Z

On Wed, Sep 29, 2021 at 09:50:45AM +0100, Mark Rutland wrote:
> On Wed, Sep 29, 2021 at 09:39:47AM +0200, Peter Zijlstra wrote:
> > On Tue, Sep 28, 2021 at 06:36:37PM -0700, Josh Poimboeuf wrote:

> > > + asm volatile("417: rdmsr\n"
> > > + : EAX_EDX_RET(val, low, high)
> > > + : "c" (msr));
> > > + asm_volatile_goto(_ASM_EXTABLE(417b, %l[Efault]) :::: Efault);
> >
> > That's terrible :-) Could probably do with a comment, but might just
> > work..
>
> The compiler is well within its rights to spill/restore/copy/shuffle
> registers or modify memory between the two asm blocks (which it's liable
> to do that when optimizing this after a few layers of inlining), and
> skipping that would cause all sorts of undefined behaviour.

Ah, but in this case it'll work irrespective of that (which is why we
needs a comment!).

This is because _ASM_EXTABLE only generates data for another section.
There doesn't need to be code continuity between these two asm
statements.

As I said, this is terrible :-)