lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A120A8EC-AB1E-44FB-AEAB-09DFE282CCF8@zytor.com>
Date: Mon, 08 Apr 2024 06:41:12 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Peter Zijlstra <peterz@...radead.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>
CC: Ingo Molnar <mingo@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
        the arch/x86 maintainers <x86@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: More annoying code generation by clang

On April 8, 2024 1:49:34 AM PDT, Peter Zijlstra <peterz@...radead.org> wrote:
>On Thu, Apr 04, 2024 at 03:53:49PM -0700, Linus Torvalds wrote:
>
>> diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
>> index 66e57c010392..6159d2cbbfde 100644
>> --- a/arch/x86/include/asm/barrier.h
>> +++ b/arch/x86/include/asm/barrier.h
>> @@ -33,20 +33,15 @@
>>   * Returns:
>>   *     0 - (index < size)
>>   */
>> +#define array_index_mask_nospec(idx,sz) ({	\
>> +	typeof((idx)+(sz)) __idx = (idx);	\
>> +	typeof(__idx) __sz = (sz);		\
>> +	typeof(__idx) __mask;			\
>> +	asm volatile ("cmp %1,%2; sbb %0,%0"	\
>> +			:"=r" (__mask)		\
>> +			:"ir"(__sz),"r" (__idx)	\
>> +			:"cc");			\
>> +	__mask; })
>
>Should this not carry a comment about the "ir" constraint wanting to be
>"g" except for clang being daft?
>
>(I really wish clang would go fix this, it keeps coming up time and
>again).
>
>>  
>>  /* Prevent speculative execution past this barrier. */
>>  #define barrier_nospec() asm volatile("lfence":::"memory")
>

If the only reason for "ir" as opposed to "g" (= "irm") is clang then it really needs to be called out. Or better yet, don't do anything and let the clang people actually fix their code generation.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ