Re: objtool clac/stac handling change..

From: Al Viro
Date: Fri Jul 03 2020 - 18:04:37 EST


On Fri, Jul 03, 2020 at 10:59:22PM +0100, Al Viro wrote:
> On Fri, Jul 03, 2020 at 02:10:08PM -0700, Linus Torvalds wrote:
> > On Fri, Jul 3, 2020 at 2:02 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > Actually, for more serious problem consider arch/x86/lib/copy_user_64.S
> >
> > What? No.
> >
> > > In case of an unhandled fault on attempt to read an (unaligned) word,
> > > the damn thing falls back to this:
> > > SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail)
> > > movl %edx,%ecx
> > > 1: rep movsb
> > > 2: mov %ecx,%eax
> > > ASM_CLAC
> > > ret
> > >
> > > _ASM_EXTABLE_UA(1b, 2b)
> > > SYM_CODE_END(.Lcopy_user_handle_tail)
> >
> > In the case of "we did an unaligned word at the end of a page, we took
> > a fault, and now we have to start all over", the _least_ of our
> > problems is that part of "starting over" would now imply doing a
> > "stac" again.
>
> What do you mean, start over? It's picking a few remaining bytes out
> of that word, *not* redoing the entire thing.

I'm _not_ saying that it's a performance-critical place, in case that's not
obvious - just trying to head off potential confusion re what that code is
doing.