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:   Thu, 2 Mar 2023 02:00:41 +0000
From:   "Wang, Wei W" <wei.w.wang@...el.com>
To:     David Matlack <dmatlack@...gle.com>
CC:     "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "Christopherson,, Sean" <seanjc@...gle.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v1] KVM: allow KVM_BUG/KVM_BUG_ON to handle 64-bit cond

On Thursday, March 2, 2023 3:47 AM, David Matlack wrote:
> On Wed, Mar 1, 2023 at 5:38 AM Wei Wang <wei.w.wang@...el.com> wrote:
> >
> > Current KVM_BUG and KVM_BUG_ON assumes that 'cond' passed from
> callers
> > is 32-bit as it casts 'cond' to the type of int. This will be wrong if 'cond'
> > provided by a caller is 64-bit, e.g. an error code of
> > 0xc0000d0300000000 will be converted to 0, which is not expected.
> > Improves the implementation by using !!(cond) in KVM_BUG and
> > KVM_BUG_ON. Compared to changing 'int' to 'int64_t', this has less LOCs.
> 
> Less LOC is nice to have, but please preserve the behavior that "cond"
> is evaluated only once by KVM_BUG() and KVM_BUG_ON(). i.e.
> KVM_BUG_ON(do_something(), kvm) should only result in a single call to
> do_something().

Good point, thanks! Using 'typeof(cond)' looks like a better choice.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ