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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKv+Gu_zEO75s6o8bv4TXPxibSH-dCe-V46AYjL-dOEAvpQaqw@mail.gmail.com>
Date:   Thu, 1 Aug 2019 09:04:11 +0300
From:   Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:     Valdis Klētnieks <valdis.kletnieks@...edu>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
        <linux-crypto@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] linux-next 20190731 - aegis128-core.c fails to build

On Thu, 1 Aug 2019 at 08:47, Valdis Klētnieks <valdis.kletnieks@...edu> wrote:
>
> On Thu, 01 Aug 2019 08:01:54 +0300, Ard Biesheuvel said:
>
> > > ERROR: "crypto_aegis128_decrypt_chunk_simd" [crypto/aegis128.ko] undefined!
> > > ERROR: "crypto_aegis128_update_simd" [crypto/aegis128.ko] undefined!
> > > ERROR: "crypto_aegis128_encrypt_chunk_simd" [crypto/aegis128.ko] undefined!
> > > make[1]: *** [scripts/Makefile.modpost:105: modules-modpost] Error 1
> > > make: *** [Makefile:1299: modules] Error 2
>
> > Which compiler version are you using? All references to the
> > crypt_aegis128_xx_simd() routines should disappear if
> > CONFIG_CRYPTO_AEGIS128_SIMD is not set (in which case have_simd will
> > always be false and so the compiler should optimize away those calls).
>
> gcc 9.1.1 obviously doesn't think it can be optimized away. Apparently, it's
> not smart enough to realize that nothing sets have_simd in any of the functions
> and therefor it's guaranteed to be zero, and  it can do dead code optimization
> based on that.
>
> Now, if we had something like:
>
> #ifdef CONFIG_CRYPTO_AEGIS_128_SIMD
> static bool have_simd;
> #else
> #define have_simd (0)
> #endif
>
> then that should be enough to tell the compiler it can optimize it away, except
> that then runs into problems here:
>
>         if (IS_ENABLED(CONFIG_CRYPTO_AEGIS128_SIMD))
>                 have_simd = crypto_aegis128_have_simd();
>
> because it will whine about the lack of an lvalue before it optimizes the assignment away...

The fact that crypto_aegis128_have_simd() does get optimized away, but
crypto_aegis128_update_simd() doesn't (which is only called directly
and not via a function pointer like the other two routines) makes me
suspicious that this is some pathology in the compiler. Is this a
distro build of gcc? Also, which architecture are you compiling for?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ