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, 31 May 2018 19:54:18 -0500
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Kees Cook <keescook@...omium.org>
Cc:     Matthew Wilcox <mawilcox@...rosoft.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Matthew Wilcox <willy@...radead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>,
        Kernel Hardening <kernel-hardening@...ts.openwall.com>
Subject: Re: [PATCH v3 00/16] Provide saturating helpers for allocation

On Thu, May 31, 2018 at 7:43 PM Kees Cook <keescook@...omium.org> wrote:
>
> So, while nothing does:
>     kmalloc_array(a, b, ...) -> kmalloc(array_size(a, b), ...)
> the treewide changes DO perform changes like this:
>     kmalloc(a * b, ...) -> kmalloc(array_size(a, b), ...)

Ugh. I really really still absolutely despise this.

Why can't you just have a separate set of coccinelle scripts that do
the simple and clean cases?

So *before* doing any array_size() conversions, just do

    kzalloc(a*b, ...) -> kcalloc(a, b, ...)
    kmalloc(a*b,..) -> kmalloc_array(a,b, ...)

and the obvious variations on that (devm_xyz() has all the same helpers).

Only after doing the ones that don't have the nice obvious helpers, do
the remaining ones with array_size(), ie

    *alloc(a*b, ..) -> *alloc(array_size(a,b), ...)

because that really makes for much less legible code.

Hmm?

            Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ