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: <CANpmjNOhrPie9aWGdBeTke6yz-o+MV+G5moKB=eb9EN8Ky+f1Q@mail.gmail.com>
Date:   Tue, 8 Feb 2022 19:42:31 +0100
From:   Marco Elver <elver@...gle.com>
To:     andrey.konovalov@...ux.dev
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Andrey Konovalov <andreyknvl@...il.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andrey Ryabinin <ryabinin.a.a@...il.com>,
        kasan-dev@...glegroups.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        Andrey Konovalov <andreyknvl@...gle.com>
Subject: Re: [PATCH] kasan: test: prevent cache merging in kmem_cache_double_destroy

On Tue, 8 Feb 2022 at 19:37, <andrey.konovalov@...ux.dev> wrote:
>
> From: Andrey Konovalov <andreyknvl@...gle.com>
>
> With HW_TAGS KASAN and kasan.stacktrace=off, the cache created in the
> kmem_cache_double_destroy() test might get merged with an existing one.
> Thus, the first kmem_cache_destroy() call won't actually destroy it
> but will only descrease the refcount. This causes the test to fail.

s/descrease/decrease/

> Provide an empty contructor for the created cache to prevent the cache

s/contructor/constructor/

> from getting merged.
>
> Fixes: f98f966cd750 ("kasan: test: add test case for double-kmem_cache_destroy()")
> Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>

Reviewed-by: Marco Elver <elver@...gle.com>


> ---
>  lib/test_kasan.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index 26a5c9007653..3b413f8c8a71 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -869,11 +869,14 @@ static void kmem_cache_invalid_free(struct kunit *test)
>         kmem_cache_destroy(cache);
>  }
>
> +static void empty_cache_ctor(void *object) { }
> +
>  static void kmem_cache_double_destroy(struct kunit *test)
>  {
>         struct kmem_cache *cache;
>
> -       cache = kmem_cache_create("test_cache", 200, 0, 0, NULL);
> +       /* Provide a constructor to prevent cache merging. */
> +       cache = kmem_cache_create("test_cache", 200, 0, 0, empty_cache_ctor);
>         KUNIT_ASSERT_NOT_ERR_OR_NULL(test, cache);
>         kmem_cache_destroy(cache);
>         KUNIT_EXPECT_KASAN_FAIL(test, kmem_cache_destroy(cache));
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ