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:   Wed, 13 Feb 2019 14:25:05 +0100
From:   Andrey Konovalov <andreyknvl@...gle.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Andrey Ryabinin <aryabinin@...tuozzo.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Catalin Marinas <catalin.marinas@....com>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        kasan-dev <kasan-dev@...glegroups.com>,
        Linux Memory Management List <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>, Qian Cai <cai@....pw>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        Kostya Serebryany <kcc@...gle.com>,
        Evgeniy Stepanov <eugenis@...gle.com>
Subject: Re: [PATCH 4/5] kasan, slub: move kasan_poison_slab hook before page_address

On Tue, Feb 12, 2019 at 10:12 PM Andrew Morton
<akpm@...ux-foundation.org> wrote:
>
> On Mon, 11 Feb 2019 22:59:53 +0100 Andrey Konovalov <andreyknvl@...gle.com> wrote:
>
> > With tag based KASAN page_address() looks at the page flags to see
> > whether the resulting pointer needs to have a tag set. Since we don't
> > want to set a tag when page_address() is called on SLAB pages, we call
> > page_kasan_tag_reset() in kasan_poison_slab(). However in allocate_slab()
> > page_address() is called before kasan_poison_slab(). Fix it by changing
> > the order.
> >
> > ...
> >
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -1642,12 +1642,15 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
> >       if (page_is_pfmemalloc(page))
> >               SetPageSlabPfmemalloc(page);
> >
> > +     kasan_poison_slab(page);
> > +
> >       start = page_address(page);
> >
> > -     if (unlikely(s->flags & SLAB_POISON))
> > +     if (unlikely(s->flags & SLAB_POISON)) {
> > +             metadata_access_enable();
> >               memset(start, POISON_INUSE, PAGE_SIZE << order);
> > -
> > -     kasan_poison_slab(page);
> > +             metadata_access_disable();
> > +     }
> >
> >       shuffle = shuffle_freelist(s, page);
>
> This doesn't compile when CONFIG_SLUB_DEBUG=n.  Please review carefully:

Sorry, missed this. I think it makes more sense to move this memset
into another function CONFIG_SLUB_DEBUG ifdef, since all other
poisoning code is also there. I'll send a v2.

>
> --- a/mm/slub.c~kasan-slub-move-kasan_poison_slab-hook-before-page_address-fix
> +++ a/mm/slub.c
> @@ -1357,6 +1357,14 @@ slab_flags_t kmem_cache_flags(unsigned i
>
>  #define disable_higher_order_debug 0
>
> +static inline void metadata_access_enable(void)
> +{
> +}
> +
> +static inline void metadata_access_disable(void)
> +{
> +}
> +
>  static inline unsigned long slabs_node(struct kmem_cache *s, int node)
>                                                         { return 0; }
>  static inline unsigned long node_nr_slabs(struct kmem_cache_node *n)
> _
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ