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]
Date:   Fri, 12 Jul 2019 15:32:19 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Roman Kagan <rkagan@...tuozzo.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "x86@...nel.org" <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Liran Alon <liran.alon@...cle.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH 1/2] x86: kvm: avoid -Wsometimes-uninitized warning

On Fri, Jul 12, 2019 at 3:14 PM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 12/07/19 15:02, Arnd Bergmann wrote:
> > I think what happens here is that clang does not treat the return
> > code of track the return code of is_64_bit_mode() as a constant
> > expression, and therefore assumes that the if() condition
> > may or may not be true, for the purpose of determining whether
> > the variable is used without an inialization. This would hold even
> > if it later eliminates the code leading up to the if() in an optimization
> > stage. IS_ENABLED(CONFIG_X86_64) however is a constant
> > expression, so with the patch, it understands this.
> >
> > In contrast, gcc seems to perform all the inlining first, and
> > then see if some variable is used uninitialized in the final code.
> > This gives additional information to the compiler, but makes the
> > outcome less predictable since it depends on optimization flags
> > and architecture specific behavior.
> >
> > Both approaches have their own sets of false positive and false
> > negative warnings.
>
> True, on the other hand constant returns are not really rocket science. :)
>
> Maybe change is_long_mode to a macro if !CONFIG_X86_64?  That would be
> better if clang likes it.

I had to also get rid of the temporary variable to make it work.
Sending v2 now.

      Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ