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: <Yvt91VYNEJFnWV1r@kroah.com>
Date:   Tue, 16 Aug 2022 13:21:57 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Marco Elver <elver@...gle.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.19 0767/1157] kasan: fix zeroing vmalloc memory with
 HW_TAGS

On Tue, Aug 16, 2022 at 01:14:13PM +0200, Jiri Slaby wrote:
> On 16. 08. 22, 13:04, Jiri Slaby wrote:
> > On 15. 08. 22, 20:02, Greg Kroah-Hartman wrote:
> > > From: Andrey Konovalov <andreyknvl@...gle.com>
> > > 
> > > [ Upstream commit 6c2f761dad7851d8088b91063ccaea3c970efe78 ]
> > > 
> > > HW_TAGS KASAN skips zeroing page_alloc allocations backing vmalloc
> > > mappings via __GFP_SKIP_ZERO.  Instead, these pages are zeroed via
> > > kasan_unpoison_vmalloc() by passing the KASAN_VMALLOC_INIT flag.
> > > 
> > > The problem is that __kasan_unpoison_vmalloc() does not zero pages when
> > > either kasan_vmalloc_enabled() or is_vmalloc_or_module_addr() fail.
> > > 
> > > Thus:
> > > 
> > > 1. Change __vmalloc_node_range() to only set KASAN_VMALLOC_INIT when
> > >     __GFP_SKIP_ZERO is set.
> > > 
> > > 2. Change __kasan_unpoison_vmalloc() to always zero pages when the
> > >     KASAN_VMALLOC_INIT flag is set.
> > > 
> > > 3. Add WARN_ON() asserts to check that KASAN_VMALLOC_INIT cannot be set
> > >     in other early return paths of __kasan_unpoison_vmalloc().
> > > 
> > > Also clean up the comment in __kasan_unpoison_vmalloc.
> > > 
> > > Link: https://lkml.kernel.org/r/4bc503537efdc539ffc3f461c1b70162eea31cf6.1654798516.git.andreyknvl@google.com
> > > Fixes: 23689e91fb22 ("kasan, vmalloc: add vmalloc tagging for HW_TAGS")
> > > Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> > > Cc: Marco Elver <elver@...gle.com>
> > > Cc: Alexander Potapenko <glider@...gle.com>
> > > Cc: Dmitry Vyukov <dvyukov@...gle.com>
> > > Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>
> > > Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> > > Signed-off-by: Sasha Levin <sashal@...nel.org>
> > > ---
> > >   mm/kasan/hw_tags.c | 32 +++++++++++++++++++++++---------
> > >   mm/vmalloc.c       | 10 +++++-----
> > >   2 files changed, 28 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
> > > index 9e1b6544bfa8..9ad8eff71b28 100644
> > > --- a/mm/kasan/hw_tags.c
> > > +++ b/mm/kasan/hw_tags.c
> > > @@ -257,27 +257,37 @@ static void unpoison_vmalloc_pages(const void
> > > *addr, u8 tag)
> > >       }
> > >   }
> > > +static void init_vmalloc_pages(const void *start, unsigned long size)
> > > +{
> > > +    const void *addr;
> > > +
> > > +    for (addr = start; addr < start + size; addr += PAGE_SIZE) {
> > > +        struct page *page = virt_to_page(addr);
> > > +
> > > +        clear_highpage_kasan_tagged(page);
> > 
> > This breaks build on aarch64:
> > > mm/kasan/hw_tags.c: In function 'init_vmalloc_pages':
> > > mm/kasan/hw_tags.c:267:17: error: implicit declaration of function
> > > 'clear_highpage_kasan_tagged'
> > > [-Werror=implicit-function-declaration]
> 
> Which translates into: this is missing:
> commit d9da8f6cf55eeca642c021912af1890002464c64
> Author: Andrey Konovalov <andreyknvl@...il.com>
> Date:   Thu Jun 9 20:18:46 2022 +0200
> 
>     mm: introduce clear_highpage_kasan_tagged

Thanks, now added to both 5.18.y and 5.19.y.  I'll push out some -rc2
releases with this in it so it can get some testing.

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ