Re: mmotm 2019-04-19-14-53 uploaded (objtool)

From: Peter Zijlstra
Date: Tue Apr 23 2019 - 13:39:24 EST


On Tue, Apr 23, 2019 at 09:07:01AM -0700, Andy Lutomirski wrote:
> > diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> > index 22ba683afdc2..c82abd6e4ca3 100644
> > --- a/arch/x86/include/asm/uaccess.h
> > +++ b/arch/x86/include/asm/uaccess.h
> > @@ -427,10 +427,11 @@ do { \
> > ({ \
> > __label__ __pu_label; \
> > int __pu_err = -EFAULT; \
> > - __typeof__(*(ptr)) __pu_val; \
> > - __pu_val = x; \
> > + __typeof__(*(ptr)) __pu_val = (x); \
> > + __typeof__(ptr) __pu_ptr = (ptr); \
>
> Hmm. I wonder if this forces the address calculation to be done
> before STAC, which means that gcc canât use mov ..., %gs:(fancy
> stuff). It probably depends on how clever the optimizer is. Have you
> looked at the generated code?

I have not; will do before posting the real patch.