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, 30 Dec 2021 20:11:40 +0100
From:   Andrey Konovalov <andreyknvl@...il.com>
To:     Alexander Potapenko <glider@...gle.com>
Cc:     andrey.konovalov@...ux.dev, Marco Elver <elver@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        kasan-dev <kasan-dev@...glegroups.com>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Peter Collingbourne <pcc@...gle.com>,
        Evgenii Stepanov <eugenis@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Andrey Konovalov <andreyknvl@...gle.com>
Subject: Re: [PATCH mm v4 35/39] kasan: add kasan.vmalloc command line flag

On Tue, Dec 21, 2021 at 3:43 PM Alexander Potapenko <glider@...gle.com> wrote:
>
> >
> > +       switch (kasan_arg_vmalloc) {
> > +       case KASAN_ARG_VMALLOC_DEFAULT:
> > +               /* Default to enabling vmalloc tagging. */
> > +               fallthrough;
> > +       case KASAN_ARG_VMALLOC_ON:
> > +               static_branch_enable(&kasan_flag_vmalloc);
> > +               break;
> > +       case KASAN_ARG_VMALLOC_OFF:
> > +               /* Do nothing, kasan_flag_vmalloc keeps its default value. */
> > +               break;
> > +       }
>
> I think we should be setting the default when defining the static key
> (e.g. in this case it should be DEFINE_STATIC_KEY_TRUE), so that:
>  - the _DEFAULT case is always empty;
>  - the _ON case explicitly enables the static branch
>  - the _OFF case explicitly disables the branch
> This way we'll only need to change DEFINE_STATIC_KEY_TRUE to
> DEFINE_STATIC_KEY_FALSE if we want to change the default, but we don't
> have to mess up with the rest of the code.
> Right now the switch statement is confusing, because the _OFF case
> refers to some "default" value, whereas the _DEFAULT one actively
> changes the state.
>
> I see that this code is copied from kasan_flag_stacktrace
> implementation, and my comment also applies there (but I don't insist
> on fixing that one right now).

Will do in v5. Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ