[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANpmjNNhvxEnjkq_s9DRyFd-r0hDnxGST6ommX3anTY+fBcLaA@mail.gmail.com>
Date: Tue, 22 Feb 2022 19:48:40 +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>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH mm v2] another fix for "kasan: improve vmalloc tests"
On Tue, 22 Feb 2022 at 19:26, <andrey.konovalov@...ux.dev> wrote:
>
> From: Andrey Konovalov <andreyknvl@...gle.com>
>
> set_memory_rw/ro() are not exported to be used in modules and thus
> cannot be used in KUnit-compatible KASAN tests.
>
> Do the checks that rely on these functions only when the tests are
> built-in.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
Looks reasonable, thanks.
Reviewed-by: Marco Elver <elver@...gle.com>
> ---
>
> Changes v1->v2:
> - Hide checks under #if instead of dropping.
> ---
> lib/test_kasan.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index ef99d81fe8b3..c4b7eb2bad77 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -1083,11 +1083,13 @@ static void vmalloc_helpers_tags(struct kunit *test)
> KUNIT_ASSERT_TRUE(test, is_vmalloc_addr(ptr));
> KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vmalloc_to_page(ptr));
>
> +#if !IS_MODULE(CONFIG_KASAN_KUNIT_TEST)
> /* Make sure vmalloc'ed memory permissions can be changed. */
> rv = set_memory_ro((unsigned long)ptr, 1);
> KUNIT_ASSERT_GE(test, rv, 0);
> rv = set_memory_rw((unsigned long)ptr, 1);
> KUNIT_ASSERT_GE(test, rv, 0);
> +#endif
>
> vfree(ptr);
> }
> --
> 2.25.1
>
Powered by blists - more mailing lists