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] [day] [month] [year] [list]
Message-ID: <CA+fCnZdKLrniF4ru8G5=hkm4M6YYm3RJz6wFcNqD2hPC8Trj-g@mail.gmail.com>
Date:   Fri, 19 Nov 2021 15:36:06 +0100
From:   Andrey Konovalov <andreyknvl@...il.com>
To:     Marco Elver <elver@...gle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Vlastimil Babka <vbabka@...e.cz>,
        kasan-dev <kasan-dev@...glegroups.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [PATCH 2/2] kasan: test: add test case for double-kmem_cache_destroy()

On Fri, Nov 19, 2021 at 3:22 PM Marco Elver <elver@...gle.com> wrote:
>
> Add a test case for double-kmem_cache_destroy() detection.
>
> Signed-off-by: Marco Elver <elver@...gle.com>
> ---
>  lib/test_kasan.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index 40f7274297c1..4da4b214ed06 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -866,6 +866,16 @@ static void kmem_cache_invalid_free(struct kunit *test)
>         kmem_cache_destroy(cache);
>  }
>
> +static void kmem_cache_double_destroy(struct kunit *test)
> +{
> +       struct kmem_cache *cache;
> +
> +       cache = kmem_cache_create("test_cache", 200, 0, 0, NULL);
> +       KUNIT_ASSERT_NOT_ERR_OR_NULL(test, cache);
> +       kmem_cache_destroy(cache);
> +       KUNIT_EXPECT_KASAN_FAIL(test, kmem_cache_destroy(cache));
> +}
> +
>  static void kasan_memchr(struct kunit *test)
>  {
>         char *ptr;
> @@ -1183,6 +1193,7 @@ static struct kunit_case kasan_kunit_test_cases[] = {
>         KUNIT_CASE(ksize_uaf),
>         KUNIT_CASE(kmem_cache_double_free),
>         KUNIT_CASE(kmem_cache_invalid_free),
> +       KUNIT_CASE(kmem_cache_double_destroy),
>         KUNIT_CASE(kasan_memchr),
>         KUNIT_CASE(kasan_memcmp),
>         KUNIT_CASE(kasan_strings),
> --
> 2.34.0.rc2.393.gf8c9666880-goog
>

Reviewed-by: Andrey Konovalov <andreyknvl@...il.com>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ