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: <f8df7ae5-e1e8-72b3-2f01-49d016b75719@redhat.com>
Date:   Tue, 26 Jun 2018 11:08:26 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Matthias Kaehlcke <mka@...omium.org>
Cc:     Radim Krčmář <rkrcmar@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v2] kvm: x86: mmu: Add cast to negated bitmasks in
 update_permission_bitmask()

On 25/06/2018 19:35, Matthias Kaehlcke wrote:
> commit e2a5dca753d1cdc3212519023ed8a13e13f5495b
> Author: Borislav Petkov <bp@...e.de>
> Date:   Thu Nov 23 10:19:51 2017 +0100
> 
>     x86/umip: Fix insn_get_code_seg_params()'s return value

So this is the closest thing to a bug (it could have been a real bug
if the caller checked ret < 0 instead of ret == -EINVAL).  *However*
the warning there is a bit misleading too.

The compiler does absolutely nothing to tell you that the return value
is in the [-EINVAL,132] range and therefore it should have been int.
_That_ would have been a useful warning.  Instead, it says:

      arch/x86/lib/insn-eval.c:780:10: warning: implicit conversion from 'int' to 'char'
              changes value from 132 to -124 [-Wconstant-conversion]
                      return INSN_CODE_SEG_PARAMS(4, 8);
                      ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
      ./arch/x86/include/asm/insn-eval.h:16:57: note: expanded from macro 'INSN_CODE_SEG_PARAMS'
      #define INSN_CODE_SEG_PARAMS(oper_sz, addr_sz) (oper_sz | (addr_sz << 4))
    
If you changed the return value from char to u8, you'd break the "return
-EINVAL;" case.  The compiler would probably complain in turn that this
is not the right fix, by signaling a warning on "return -EINVAL;", but the
warning could really be done better.

Thanks,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ