Re: [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm

From: Josh Poimboeuf
Date: Fri Mar 08 2019 - 14:53:14 EST


On Fri, Mar 08, 2019 at 08:48:35PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 08, 2019 at 12:53:21PM -0600, Josh Poimboeuf wrote:
> > On Thu, Mar 07, 2019 at 12:45:14PM +0100, Peter Zijlstra wrote:
> > > /*
> > > + * Try to copy last bytes and clear the rest if needed.
> > > + * Since protection fault in copy_from/to_user is not a normal situation,
> > > + * it is not necessary to optimize tail handling.
> > > + *
> > > + * Input:
> > > + * rdi destination
> > > + * rsi source
> > > + * rdx count
> > > + *
> > > + * Output:
> > > + * eax uncopied bytes or 0 if successful.
> > > + */
> > > +ALIGN;
> > > +copy_user_handle_tail:
> > > + movl %edx,%ecx
> > > +1: rep movsb
> > > +2: mov %ecx,%eax
> > > + ASM_CLAC
> > > + ret
> > > +
> > > + _ASM_EXTABLE_UA(1b, 2b)
> > > +ENDPROC(copy_user_handle_tail)
> >
> > This is an unstructured piece of code rather than a callable function,
> > END would probably be more appropriate. Or maybe it should just be a
> > local label (.Lcopy_user_handle_tail) because I don't think the
> > alignment and ELF symbol size are even needed.
>
> ENDPROC makes it STT_FUNC and gets us stricter AC tests.

How so? I would have thought the opposite. Doesn't objtool only follow
a jump if its destination is to a non-function? Otherwise it's
considered a sibling call.

--
Josh