Re: [PATCH -final] x86/clear_user: Make it faster

Borislav Petkov
2022-07-11T10:33:44Z

On Wed, Jul 06, 2022 at 12:24:12PM +0300, Alexey Dobriyan wrote:
> On Tue, Jul 05, 2022 at 07:01:06PM +0200, Borislav Petkov wrote:
>
> > + asm volatile(
> > + "1:\n\t"
> > + ALTERNATIVE_3("rep stosb",
> > + "call clear_user_erms", ALT_NOT(X86_FEATURE_FSRM),
> > + "call clear_user_rep_good", ALT_NOT(X86_FEATURE_ERMS),
> > + "call clear_user_original", ALT_NOT(X86_FEATURE_REP_GOOD))
> > + "2:\n"
> > + _ASM_EXTABLE_UA(1b, 2b)
> > + : "+&c" (size), "+&D" (addr), ASM_CALL_CONSTRAINT
> > + : "a" (0)
> > + /* rep_good clobbers %rdx */
> > + : "rdx");
>
> "+c" and "+D" should be enough for 1 instruction assembly?

I'm looking at

e0a96129db57 ("x86: use early clobbers in usercopy*.c")

which introduced the early clobbers and I'm thinking we want them
because "this operand is an earlyclobber operand, which is written
before the instruction is finished using the input operands" and we have
exception handling.

But maybe you need to be more verbose as to what you mean exactly...

--
Regards/Gruss,
Boris.