On Mon, Sep 28, 2020 at 11:10:56PM -0500, Josh Poimboeuf wrote:
> > Josh, any ideas?  We could, of course, make it "r"(size), but that would
> > be unpleasant in all existing callers...
> 
> Sorry, I've been traveling.  I'd just vote for making it "r".
> 
> array_index_nospec() is always called after a usercopy.  I don't think
> anyone will notice the extra mov, for the cases where it would be
> propagated as an immediate.  And the argument *is* an unsigned long
> after all.
> 
> Stephen, can you confirm this fixes it?

Still traveling, I didn't see an update on this.  Any objections to the
below?  I assume it fixes Stephen's build issue.

> 
> diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
> index d158ea1fa250..69045ac62f58 100644
> --- a/arch/x86/include/asm/barrier.h
> +++ b/arch/x86/include/asm/barrier.h
> @@ -40,7 +40,7 @@ static inline unsigned long 
> array_index_mask_nospec(unsigned long index,
>  
>       asm volatile ("cmp %1,%2; sbb %0,%0;"
>                       :"=r" (mask)
> -                     :"g"(size),"r" (index)
> +                     :"r"(size), "r"(index)
>                       :"cc");
>       return mask;
>  }
> 

-- 
Josh

Reply via email to