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: <CAAeHK+xMxX3Baou=W914tbbPhuPGCBd4wJdgS3O459JEwxw5OQ@mail.gmail.com>
Date:   Wed, 13 Mar 2019 20:18:24 +0100
From:   Andrey Konovalov <andreyknvl@...gle.com>
To:     Sasha Levin <sashal@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        stable <stable@...r.kernel.org>,
        Alexander Potapenko <glider@...gle.com>,
        Andrey Ryabinin <aryabinin@...tuozzo.com>,
        Catalin Marinas <catalin.marinas@....com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Evgeniy Stepanov <eugenis@...gle.com>,
        Kostya Serebryany <kcc@...gle.com>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [PATCH AUTOSEL 4.14 22/33] kasan, slab: make freelist stored
 without tags

On Wed, Mar 13, 2019 at 8:16 PM Sasha Levin <sashal@...nel.org> wrote:
>
> From: Andrey Konovalov <andreyknvl@...gle.com>
>
> [ Upstream commit 51dedad06b5f6c3eea7ec1069631b1ef7796912a ]

Hi Sasha,

None of the 4.9, 4.14, 4.19 or 4.20 have tag-based KASAN, so
backporting these 3 KASAN related patches doesn't make much sense.

Thanks!


>
> Similarly to "kasan, slub: move kasan_poison_slab hook before
> page_address", move kasan_poison_slab() before alloc_slabmgmt(), which
> calls page_address(), to make page_address() return value to be
> non-tagged.  This, combined with calling kasan_reset_tag() for off-slab
> slab management object, leads to freelist being stored non-tagged.
>
> Link: http://lkml.kernel.org/r/dfb53b44a4d00de3879a05a9f04c1f55e584f7a1.1550602886.git.andreyknvl@google.com
> Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> Tested-by: Qian Cai <cai@....pw>
> Cc: Alexander Potapenko <glider@...gle.com>
> Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Dmitry Vyukov <dvyukov@...gle.com>
> Cc: Evgeniy Stepanov <eugenis@...gle.com>
> Cc: Kostya Serebryany <kcc@...gle.com>
> Cc: Vincenzo Frascino <vincenzo.frascino@....com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  mm/slab.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 409631e49295..766043dd3f8e 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2378,6 +2378,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
>                 /* Slab management obj is off-slab. */
>                 freelist = kmem_cache_alloc_node(cachep->freelist_cache,
>                                               local_flags, nodeid);
> +               freelist = kasan_reset_tag(freelist);
>                 if (!freelist)
>                         return NULL;
>         } else {
> @@ -2690,6 +2691,13 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
>
>         offset *= cachep->colour_off;
>
> +       /*
> +        * Call kasan_poison_slab() before calling alloc_slabmgmt(), so
> +        * page_address() in the latter returns a non-tagged pointer,
> +        * as it should be for slab pages.
> +        */
> +       kasan_poison_slab(page);
> +
>         /* Get slab management. */
>         freelist = alloc_slabmgmt(cachep, page, offset,
>                         local_flags & ~GFP_CONSTRAINT_MASK, page_node);
> @@ -2698,7 +2706,6 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
>
>         slab_map_pages(cachep, page, freelist);
>
> -       kasan_poison_slab(page);
>         cache_init_objs(cachep, page);
>
>         if (gfpflags_allow_blocking(local_flags))
> --
> 2.19.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ