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+w86uMUrJjwV1Sei=N4udhfTmWab5e3FuT72=BEMcCu3A@mail.gmail.com>
Date:   Thu, 1 Mar 2018 18:28:52 +0100
From:   Andrey Konovalov <andreyknvl@...gle.com>
To:     Andrey Ryabinin <aryabinin@...tuozzo.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Nick Terrell <terrelln@...com>, Chris Mason <clm@...com>,
        Yury Norov <ynorov@...iumnetworks.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        "Luis R . Rodriguez" <mcgrof@...nel.org>,
        Palmer Dabbelt <palmer@...belt.com>,
        "Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
        Jeff Layton <jlayton@...hat.com>,
        "Jason A . Donenfeld" <Jason@...c4.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kasan-dev <kasan-dev@...glegroups.com>,
        Linux Memory Management List <linux-mm@...ck.org>
Cc:     Kostya Serebryany <kcc@...gle.com>,
        Andrey Konovalov <andreyknvl@...gle.com>
Subject: Re: [PATCH 1/2] kasan: fix invalid-free test crashing the kernel

On Thu, Mar 1, 2018 at 6:15 PM, Andrey Konovalov <andreyknvl@...gle.com> wrote:
> When an invalid-free is triggered by one of the KASAN tests, the object
> doesn't actually get freed. This later leads to a BUG failure in
> kmem_cache_destroy that checks that there are no allocated objects in the
> cache that is being destroyed. Fix this by calling kmem_cache_free with
> the proper object address after the call that triggers invalid-free.

Note, that for this patch to fix the issue, it is supposed to go on
top of the "kasan, slub: fix handling of kasan_slab_free hook" patch I
sent recently.

https://patchwork.kernel.org/patch/10238179/

>
> Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> ---
>  lib/test_kasan.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index 98854a64b014..ec657105edbf 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -567,7 +567,15 @@ static noinline void __init kmem_cache_invalid_free(void)
>                 return;
>         }
>
> +       /* Trigger invalid free, the object doesn't get freed */
>         kmem_cache_free(cache, p + 1);
> +
> +       /*
> +        * Properly free the object to prevent the "Objects remaining in
> +        * test_cache on __kmem_cache_shutdown" BUG failure.
> +        */
> +       kmem_cache_free(cache, p);
> +
>         kmem_cache_destroy(cache);
>  }
>
> --
> 2.16.2.395.g2e18187dfd-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ