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:   Mon, 26 Sep 2022 11:30:14 -0700
From:   Kees Cook <keescook@...omium.org>
To:     "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3 2/2] minmax: clamp more efficiently by avoiding extra
 comparison

On Mon, Sep 26, 2022 at 03:34:35PM +0200, Jason A. Donenfeld wrote:
> [...]
> In this case, we actually gain a branch, unfortunately, because the
> compiler's replacement axioms no longer as cleanly apply.
> 
> So all and all, this change is a bit of a mixed bag.

I'm on the fence -- I think the new macro is a more correct way to
describe the operation, though on the other hand, the old way provides a
simple way to compose the bounds checks.

I suspect we should probably optimize for _performance_, not code size,
so if the new branch is actually visible via cycle counts in "perf"
output, probably we shouldn't use this patch, and instead add a comment
about why it is defined the way it is.

-Kees

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ