[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+fCnZfy=c3haZqqmeBo6P1Fmt5s7dqt1jVfk=MEAJpCwuaR3A@mail.gmail.com>
Date: Tue, 22 Feb 2022 19:27:21 +0100
From: Andrey Konovalov <andreyknvl@...il.com>
To: Marco Elver <elver@...gle.com>
Cc: andrey.konovalov@...ux.dev,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrey Konovalov <andreyknvl@...gle.com>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH mm] another fix for "kasan: improve vmalloc tests"
On Tue, Feb 22, 2022 at 7:11 PM Marco Elver <elver@...gle.com> wrote:
>
> On Tue, 22 Feb 2022 at 19:08, Andrey Konovalov <andreyknvl@...il.com> wrote:
> >
> > On Tue, Feb 22, 2022 at 6:50 PM Marco Elver <elver@...gle.com> wrote:
> > >
> > > On Tue, 22 Feb 2022 at 18:10, <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.
> > > >
> > > > Drop the checks that rely on these functions.
> > > >
> > > > Reported-by: kernel test robot <lkp@...el.com>
> > > > Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> > > > ---
> > > > lib/test_kasan.c | 6 ------
> > > > 1 file changed, 6 deletions(-)
> > > >
> > > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> > > > index ef99d81fe8b3..448194bbc41d 100644
> > > > --- a/lib/test_kasan.c
> > > > +++ b/lib/test_kasan.c
> > > > @@ -1083,12 +1083,6 @@ 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));
> > > >
> > > > - /* 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);
> > >
> > > You can still test it by checking 'ifdef MODULE'. You could add a
> > > separate test which is skipped if MODULE is defined. Does that work?
> >
> > Yes, putting it under ifdef will work. I thought that having a
> > discrepancy between built-in and module tests is weird, but I see the
> > kprobes tests doing this, so maybe it's not such a bad idea. Will do
> > in v2.
>
> Additionally you could have the test skip with kunit_skip(), so it's
> at least visible. The code itself has to be #ifdef'd I guess because
> set_memory_*() aren't even declared ifdef MODULE (I think?).
I sent v2 with the simplest approach without an additional test. I
hope that's OK with you.
Powered by blists - more mailing lists