Messages in this thread | | | Date | Sun, 10 Mar 2019 14:22:14 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH 03/20] x86/uaccess: Move copy_user_handle_tail into asm |
| |
On Fri, Mar 08, 2019 at 01:53:02PM -0600, Josh Poimboeuf wrote: > 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.
Normally yes, but we don't do that for .fixup I think. And by setting STT_FUNC we enable the 'redundant CLAC' warning, which is ignored for !STT_FUNC.
| |