linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Patricia Alfonso <trishalfonso@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	David Gow <davidgow@google.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	kunit-dev@googlegroups.com
Subject: Re: [RFC PATCH 2/2] KUnit: KASAN Integration
Date: Thu, 5 Mar 2020 07:44:07 +0100	[thread overview]
Message-ID: <CACT4Y+a+SLAetVsquiitua9v0pnhQD-C5AWFekvZ8h-m0y1xuQ@mail.gmail.com> (raw)
In-Reply-To: <CAKFsvUK84pD+K5rTbvKXB0MyW9XCknpSfMAO28iQ4S1=WBQK6Q@mail.gmail.com>

On Thu, Mar 5, 2020 at 1:08 AM Patricia Alfonso <trishalfonso@google.com> wrote:
> > > On Sat, Feb 29, 2020 at 10:29 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> > > >
> > > > On Sat, Feb 29, 2020 at 2:23 AM Patricia Alfonso
> > > > <trishalfonso@google.com> wrote:
> > > > > >
> > > > > > On Thu, Feb 27, 2020 at 3:44 AM 'Patricia Alfonso' via kasan-dev
> > > > > > <kasan-dev@googlegroups.com> wrote:
> > > > > > >
> > > > > > > --- a/tools/testing/kunit/kunit_kernel.py
> > > > > > > +++ b/tools/testing/kunit/kunit_kernel.py
> > > > > > > @@ -141,7 +141,7 @@ class LinuxSourceTree(object):
> > > > > > >                 return True
> > > > > > >
> > > > > > >         def run_kernel(self, args=[], timeout=None, build_dir=''):
> > > > > > > -               args.extend(['mem=256M'])
> > > > > > > +               args.extend(['mem=256M', 'kasan_multi_shot'])
> > > > > >
> > > > > > This is better done somewhere else (different default value if
> > > > > > KASAN_TEST is enabled or something). Or overridden in the KASAN tests.
> > > > > > Not everybody uses tools/testing/kunit/kunit_kernel.py and this seems
> > > > > > to be a mandatory part now. This means people will always hit this, be
> > > > > > confused, figure out they need to flip the value, and only then be
> > > > > > able to run kunit+kasan.
> > > > > >
> > > > > I agree. Is the best way to do this with "bool multishot =
> > > > > kasan_save_enable_multi_shot();"  and
> > > > > "kasan_restore_multi_shot(multishot);" inside test_kasan.c like what
> > > > > was done in the tests before?
> > > >
> > > > This will fix KASAN tests, but not non-KASAN tests running under KUNIT
> > > > and triggering KASAN reports.
> > > > You set kasan_multi_shot for all KUNIT tests. I am reading this as
> > > > that we don't want to abort on the first test that triggered a KASAN
> > > > report. Or not?
> > >
> > > I don't think I understand the question, but let me try to explain my
> > > thinking and see if that resonates with you. We know that the KASAN
> > > tests will require more than one report, and we want that. For most
> > > users, since a KASAN error can cause unexpected kernel behavior for
> > > anything after a KASAN error, it is best for just one unexpected KASAN
> > > error to be the only error printed to the user, unless they specify
> > > kasan-multi-shot. The way I understand it, the way to implement this
> > > is to use  "bool multishot = kasan_save_enable_multi_shot();"  and
> > > "kasan_restore_multi_shot(multishot);" around the KASAN tests so that
> > > kasan-multi-shot is temporarily enabled for the tests we expect
> > > multiple reports. I assume "kasan_restore_multi_shot(multishot);"
> > > restores the value to what the user input was so after the KASAN tests
> > > are finished, if the user did not specify kasan-multi-shot and an
> > > unexpected kasan error is reported, it will print the full report and
> > > only that first one. Is this understanding correct? If you have a
> > > better way of implementing this or a better expected behavior, I
> > > appreciate your thoughts.
> >
> > Everything you say is correct.
> > What I tried to point at is that this new behavior is different from
> > the original behavior of your change. Initially you added
> > kasan_multi_shot to command line for _all_ kunit tests (not just
> > KASAN). The question is: do we want kasan_multi_shot for non-KASAN
> > tests or not?
>
> Ah, yes. I thought your first comment was suggesting I change it from
> printing all KASAN tests by default because the intended behavior of
> KASAN is to only print the first report. I think I'll pose the
> question back to you. Do we want kasan_multi_shot for non-KASAN tests?
> For functionality sake, it is only required for the KASAN tests so
> this is more of a judgement call for the user experience.

Good question. I don't see strong arguments either way. So I guess we
can leave the current version (only for kasan tests) and wait when/if
somebody has real arguments. I wanted to point to change in behavior
and understand if it's intentional/accidental.

  reply	other threads:[~2020-03-05  6:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27  2:43 [RFC PATCH 1/2] Port KASAN Tests to KUnit Patricia Alfonso
2020-02-27  2:43 ` [RFC PATCH 2/2] KUnit: KASAN Integration Patricia Alfonso
2020-02-27 14:04   ` Alan Maguire
2020-02-29  0:46     ` Patricia Alfonso
2020-03-03 16:40       ` Alan Maguire
2020-03-05  2:14         ` Patricia Alfonso
2020-03-05  7:46           ` Alan Maguire
2020-03-10 21:42             ` Brendan Higgins
2020-03-10 21:42               ` Brendan Higgins
2020-03-10 21:39     ` Brendan Higgins
2020-03-10 21:39       ` Brendan Higgins
2020-02-27 14:39   ` Dmitry Vyukov
2020-02-29  1:09     ` Patricia Alfonso
2020-03-01  6:26       ` Dmitry Vyukov
2020-02-27 14:43   ` Dmitry Vyukov
2020-02-29  1:23     ` Patricia Alfonso
2020-03-01  6:29       ` Dmitry Vyukov
2020-03-04  1:26         ` Patricia Alfonso
2020-03-04  6:23           ` Dmitry Vyukov
2020-03-05  0:07             ` Patricia Alfonso
2020-03-05  6:44               ` Dmitry Vyukov [this message]
2020-02-27 14:45   ` Dmitry Vyukov
2020-02-29  0:49     ` Patricia Alfonso
2020-03-04  6:35   ` Dmitry Vyukov
2020-02-27 13:56 ` [RFC PATCH 1/2] Port KASAN Tests to KUnit Andrey Konovalov
2020-02-27 15:16   ` Alan Maguire
2020-02-27 14:19 ` Dmitry Vyukov
2020-02-29  1:56   ` Patricia Alfonso
2020-03-01  6:39     ` Dmitry Vyukov
2020-03-02 17:52       ` Kees Cook
2020-03-02 22:36         ` Brendan Higgins
2020-03-02 23:02           ` Kees Cook
2020-03-06 23:58   ` Patricia Alfonso

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=CACT4Y+a+SLAetVsquiitua9v0pnhQD-C5AWFekvZ8h-m0y1xuQ@mail.gmail.com \
    --to=dvyukov@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=trishalfonso@google.com \
    --cc=vincent.guittot@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).