From: Marco Elver <elver@google.com>
To: Andrey Konovalov <andreyknvl@gmail.com>
Cc: andrey.konovalov@linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
kasan-dev <kasan-dev@googlegroups.com>,
Linux Memory Management List <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrey Konovalov <andreyknvl@google.com>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH mm] another fix for "kasan: improve vmalloc tests"
Date: Tue, 22 Feb 2022 19:10:55 +0100 [thread overview]
Message-ID: <CANpmjNN3-qX_brk9PTW0MkF0H=-DeM+n_ccge_QQ07oKBPx74w@mail.gmail.com> (raw)
In-Reply-To: <CA+fCnZf2jE1N8j9iQRtOnQsTP=2CQOGYqREbzypPQa-=UXjhDA@mail.gmail.com>
On Tue, 22 Feb 2022 at 19:08, Andrey Konovalov <andreyknvl@gmail.com> wrote:
>
> On Tue, Feb 22, 2022 at 6:50 PM Marco Elver <elver@google.com> wrote:
> >
> > On Tue, 22 Feb 2022 at 18:10, <andrey.konovalov@linux.dev> wrote:
> > >
> > > From: Andrey Konovalov <andreyknvl@google.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@intel.com>
> > > Signed-off-by: Andrey Konovalov <andreyknvl@google.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?).
next prev parent reply other threads:[~2022-02-22 18:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 17:10 andrey.konovalov
2022-02-22 17:50 ` Marco Elver
2022-02-22 18:08 ` Andrey Konovalov
2022-02-22 18:10 ` Marco Elver [this message]
2022-02-22 18:27 ` Andrey Konovalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANpmjNN3-qX_brk9PTW0MkF0H=-DeM+n_ccge_QQ07oKBPx74w@mail.gmail.com' \
--to=elver@google.com \
--cc=akpm@linux-foundation.org \
--cc=andrey.konovalov@linux.dev \
--cc=andreyknvl@gmail.com \
--cc=andreyknvl@google.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=ryabinin.a.a@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox