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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5f6c1dd7-982b-2214-f229-80a8ae40780d@acm.org>
Date:   Tue, 1 Aug 2023 13:15:32 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Arnd Bergmann <arnd@...db.de>,
        Naresh Kamboju <naresh.kamboju@...aro.org>
Cc:     open list <linux-kernel@...r.kernel.org>,
        linux-scsi@...r.kernel.org,
        linux-next <linux-next@...r.kernel.org>,
        Avri Altman <avri.altman@....com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Anders Roxell <anders.roxell@...aro.org>
Subject: Re: next: arm64: gcc-8-defconfig: ufshcd.c:10629:2:
 /builds/linux/include/linux/compiler_types.h:397:38: error: call to
 '__compiletime_assert_553' declared with attribute error: BUILD_BUG_ON
 failed:

On 8/1/23 12:54, Arnd Bergmann wrote:
> On Tue, Aug 1, 2023, at 19:51, Bart Van Assche wrote:
>> On 8/1/23 07:56, Arnd Bergmann wrote:
>>> On Tue, Aug 1, 2023, at 16:23, Naresh Kamboju wrote:
>>
>> If I change the return type of ufshcd_check_header_layout() from void
>> into unsigned int and insert the following at the start of that function:
>>
>> return ((u8 *)&(struct request_desc_header){ .enable_crypto = 1})[2] != 0x80;
>>
>> then the compiler shows the following in the output window:
>>
>> xorl    %eax, %eax
>>
>> In other words, the expression next to the return statement evaluates to zero
>> but the same expression does not evaluate to zero in the BUILD_BUG_ON()
>> statement. Does this perhaps indicate a compiler bug? And if so, what is the
>> appropriate way to fix the build error? Insert an #ifdef/#endif pair inside
>> ufshcd_check_header_layout() such that the compile-time checks do not happen
>> for gcc version 9 or older?
> 
> I played around it some more, and this apparently comes
> down to constant-folding in sub-byte bitfields, so in the
> older compilers neither the ==0x80 nor the !=0x80 case
> can be ruled out because of a missing optimization.
> Instead the generated code would try to initialize the
> variable at runtime and then do a conditional branch to
> the assert, but that of course fails the build.
> 
> I'd suggest something like
> 
>      if (defined(GCC_VERSION) && GCC_VERSION < 100000)
>              return;
> 
> before the assertion, in that case it doesn't evaluate it.

An untested patch has been posted on the linux-scsi mailing list. It would
be really appreciated if someone could help with testing that patch since
none of the Linux distro's that I use regularly provides binaries for gcc-9
nor for gcc-8.

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ