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]
Message-ID: <CA+fCnZd7znwWCc11NS9g+6m7G3KT=1jq1cJi7crF6QXMCky7ag@mail.gmail.com>
Date:   Mon, 13 Dec 2021 22:57:05 +0100
From:   Andrey Konovalov <andreyknvl@...il.com>
To:     Catalin Marinas <catalin.marinas@....com>
Cc:     andrey.konovalov@...ux.dev, Marco Elver <elver@...gle.com>,
        Alexander Potapenko <glider@...gle.com>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        Peter Collingbourne <pcc@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        kasan-dev <kasan-dev@...glegroups.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Will Deacon <will@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Evgenii Stepanov <eugenis@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Andrey Konovalov <andreyknvl@...gle.com>
Subject: Re: [PATCH v2 08/34] kasan: only apply __GFP_ZEROTAGS when memory is zeroed

On Fri, Dec 10, 2021 at 6:48 PM Catalin Marinas <catalin.marinas@....com> wrote:
>
> On Mon, Dec 06, 2021 at 10:43:45PM +0100, andrey.konovalov@...ux.dev wrote:
> > From: Andrey Konovalov <andreyknvl@...gle.com>
> >
> > __GFP_ZEROTAGS should only be effective if memory is being zeroed.
> > Currently, hardware tag-based KASAN violates this requirement.
> >
> > Fix by including an initialization check along with checking for
> > __GFP_ZEROTAGS.
> >
> > Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> > Reviewed-by: Alexander Potapenko <glider@...gle.com>
> > ---
> >  mm/kasan/hw_tags.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
> > index 0b8225add2e4..c643740b8599 100644
> > --- a/mm/kasan/hw_tags.c
> > +++ b/mm/kasan/hw_tags.c
> > @@ -199,11 +199,12 @@ void kasan_alloc_pages(struct page *page, unsigned int order, gfp_t flags)
> >        * page_alloc.c.
> >        */
> >       bool init = !want_init_on_free() && want_init_on_alloc(flags);
> > +     bool init_tags = init && (flags & __GFP_ZEROTAGS);
> >
> >       if (flags & __GFP_SKIP_KASAN_POISON)
> >               SetPageSkipKASanPoison(page);
> >
> > -     if (flags & __GFP_ZEROTAGS) {
> > +     if (init_tags) {
>
> You can probably leave this unchanged but add a WARN_ON_ONCE() if !init.
> AFAICT there's only a single place where __GFP_ZEROTAGS is passed.

Yes, there's only one such place.

In a later patch, I implement handling __GFP_ZEROTAGS in regardless of
having __GFP_ZERO present or not, so adding WARN_ON() here and then
removing it probably doesn't make much sense.

As per what you said in the other message, I've left this unchanged.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ