Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5341970ybf; Wed, 4 Mar 2020 22:45:04 -0800 (PST) X-Google-Smtp-Source: ADFU+vvjzbBNrNl/39FyFNn0/dfQhu3vtTQX90KiU5plYMidVMrAJ7VUSsa9yzazrhkqpHPE5Ktl X-Received: by 2002:a9d:4f0c:: with SMTP id d12mr5061854otl.150.1583390704598; Wed, 04 Mar 2020 22:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583390704; cv=none; d=google.com; s=arc-20160816; b=vL/q0St3DcbhLX8GFkyfAhenSavJM7UfNKvL1KqhJZ1v+HhYv0C7vJp/7SoYmkAV3g M4MH3HqSfTKTR5msOtbLRwnlyqcQWAtFlYWq7+xFL7q5JNopcGK0mOmYEV+UzhCd65wd areK0DbkElOjq2VyDw/hvPsCfyAc7RPwN0NPh/YOdX4ZRmei6akzsbJb9yOK0zkiMWhE kaPEXrDclvKVKk0fnOyBdOOyXxTsKg4aig0J0jYr0ITtpDch5SjtVAx+zuhEqsogteK6 zcY9C+e/YZoGcmIBRFkYWlWjAP76+AaiRUGt8oTmD6VpU8eRfrwE3BUOABvCPDCfEBV+ 5igw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jUsXfxq47fTB69Eo8JioRupR5VCGfY6ptuLWDAnbRk8=; b=at2UGtbPIMvo4QML7ZmIlBZB+rK8znxduID+3r8WVoWuaPoX6u9rugHXE212g1ZNGX YVJ056LOOw7y9GIgFZhrZBXfbtD/+B+6SgA8Uhs7jOnBd+rY3MKvUSVRbcGnhiPzrK4Z +JFoi8YZG7Zq4tgPVlRjtMK/PTBAJPlVotB0jIPH+Wis8sxijr7R+/lo0n9BL+Ipf3LB aa1uZhozxehrLRsUFKEK1K0885Pu+QdAwiqDCzxuQyO7H3LYkh4XqGIod+rPnDCHqVQe dnBZvYy5/d10Q2A0LbzsP2KdSQEGfPqgfjedUa1yZRvlnTsYZdyC1FVydC8KWLWknuVL upIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ctYxfjLo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si3015856oig.110.2020.03.04.22.44.53; Wed, 04 Mar 2020 22:45:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ctYxfjLo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726211AbgCEGoV (ORCPT + 99 others); Thu, 5 Mar 2020 01:44:21 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:40664 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbgCEGoV (ORCPT ); Thu, 5 Mar 2020 01:44:21 -0500 Received: by mail-qv1-f68.google.com with SMTP id u17so648166qvv.7 for ; Wed, 04 Mar 2020 22:44:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jUsXfxq47fTB69Eo8JioRupR5VCGfY6ptuLWDAnbRk8=; b=ctYxfjLo/A+r4dZRBuJIu/kSqGQpprntxrJvCk9FV5NaH6locQvrgp+PKWXl1i8Udq KmxJqN/EXANRIs2kJvuZEzZVNqQMPmKQbyFQkg1hq03TVX4lFtQKEO/b2/Yj0CFym9qJ L5Lm6cMjTjhw6WM5FApyl47nqWXM5YDHBAqTualP/UqNNqLkj8gWZ8yPK7lTxAGEBa3w jt2Lc1h6BRAXO40Pp08QJYAL0gwuPxWxfZo6ILnwgsNayZwgrVbf1kXpj4zYmzMVNpwS vYhD17FZQEo5XONsGf190dy0fpLVlhwsZ9CoZq/tbUvtGzUGQx/vhL3+5kRr7u29kED4 nsWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jUsXfxq47fTB69Eo8JioRupR5VCGfY6ptuLWDAnbRk8=; b=Y3jwSVbkHFDeDx6Sq5k1NizE3hBypl7glkQNUjqmITc+2Iw5DWgSWF8wRmSMKLnJAc UAjzx6iyuwY9mJw1dAhqb7pTToRaPxjwh8rWYvaugMEMOe1sFzUCrSl/P27yj35EXxXQ RFBvamwmUZIH/bNR+dC/dydGIcptXPRtVpWroWvNu+nc/uF/MnZX5SeWnAOuzT9rS0BZ DarapPbCfLQLqANQrE2ZlCAlSvM7wpdZMOo+R4K7i2yKkSVJu7yWgYmoAB1tdvRYW0N/ pqcLsxsKLQ3y8PjbZYx1e0D14pGjCrhBsF1ULS6fHQWWbLIn7RvY4arUraPj1m9mYZcI /i2Q== X-Gm-Message-State: ANhLgQ1KZG4P68ig2Hy8E/0Euxbpptzb3sSQfPpSdJ2qaAXZi3yvf6pM ytVBwWu2d1eLgusnijf0wRU3Kpv0hixVBJduBYNM7w== X-Received: by 2002:ad4:4bc6:: with SMTP id l6mr5269372qvw.34.1583390658639; Wed, 04 Mar 2020 22:44:18 -0800 (PST) MIME-Version: 1.0 References: <20200227024301.217042-1-trishalfonso@google.com> <20200227024301.217042-2-trishalfonso@google.com> In-Reply-To: From: Dmitry Vyukov Date: Thu, 5 Mar 2020 07:44:07 +0100 Message-ID: Subject: Re: [RFC PATCH 2/2] KUnit: KASAN Integration To: Patricia Alfonso Cc: Andrey Ryabinin , Brendan Higgins , David Gow , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , LKML , kasan-dev , "open list:KERNEL SELFTEST FRAMEWORK" , kunit-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 5, 2020 at 1:08 AM Patricia Alfonso wrote: > > > On Sat, Feb 29, 2020 at 10:29 PM Dmitry Vyukov wrote: > > > > > > > > On Sat, Feb 29, 2020 at 2:23 AM Patricia Alfonso > > > > wrote: > > > > > > > > > > > > On Thu, Feb 27, 2020 at 3:44 AM 'Patricia Alfonso' via kasan-dev > > > > > > 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.