Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1202766ybf; Thu, 27 Feb 2020 06:45:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyox/AUvxgm5RZarOeWo/6XK9n5wXpEjbXLGTiAKM8F1KOkGpnrZs3Wv/PYFXlKEyH9sazL X-Received: by 2002:aca:4b92:: with SMTP id y140mr3586570oia.35.1582814712099; Thu, 27 Feb 2020 06:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582814712; cv=none; d=google.com; s=arc-20160816; b=nmxDxSivhMUIz5pXh0IozC+bKX2jS2vCMbiPeiDVo46KseVzPn2npxyEx4C1m17Wk/ Uod2pxZC86WmtwVOoBgMORdnvuXNA8/4eSgC0rDOsUEMzxlfdBaEilvEARWBXhV9aJsc LDXFoQRb2ie+hi7XFgAQ5RUcT+E7tQSNKsInz27R6O8JTA3auujLBcOk/lFee3sytP5X BfC+MowqtNqZf7WniaSJUZnnQxg8sLDnbmkLiyHuu1wezaQCxxC8vr+Zjv3UCLMwsTE9 3a1F8uXSieBaHj/L96v3SD8Xn63/frNbMgJM0LdUMjoZ0RYXe4S4EfSV+XTt8S/wyeUM 8MDA== 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=z+isuoKHbYPGILyMICbGR0T5QiMYRy4J1XMZ/c0MyCE=; b=Cfa1iP7gFMlRYC1bRO22QPEFBvVd44Lj8S3Si06S9AUawmOZZJDE7JfKPXDYgL06Fa u2xhsepCG3JL60uaJgL3Ayrb2edJ4N6P1EWPS3PHSGZ0MZp+ZezFZtmy5Lya/h+PKeKX E73f91vvRYJEbVnnXnIgrT+N6uXALCrtTX0I2KkP2z+jDWxFpBH7MEWQby4a4Qxnljvu kPzh9p41BGt/ebF36utadSTUwj/C/iAhVunuOwFClLju+7V6HRyXud+hQ8XTJ18ZnYuX V4opbaAsNR4sG3hC82q6tAar98MuAvvAzuapjNCQWiOK0EGM8MDbLzKWVaMtcujQd3i8 ilNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="dsz/dd+K"; 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 g18si1615694otp.61.2020.02.27.06.44.59; Thu, 27 Feb 2020 06:45:12 -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="dsz/dd+K"; 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 S1731458AbgB0OnY (ORCPT + 99 others); Thu, 27 Feb 2020 09:43:24 -0500 Received: from mail-vs1-f65.google.com ([209.85.217.65]:41399 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731358AbgB0OnW (ORCPT ); Thu, 27 Feb 2020 09:43:22 -0500 Received: by mail-vs1-f65.google.com with SMTP id k188so1967131vsc.8 for ; Thu, 27 Feb 2020 06:43:22 -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=z+isuoKHbYPGILyMICbGR0T5QiMYRy4J1XMZ/c0MyCE=; b=dsz/dd+K0I4XD1YrhrhPrHHrR191LtRyLN7aW8hmkbZPgrrvlzPCU2Smg1NEu36eT6 KHLffuYRjxM41BUOtcI6irVNls7ebDoaPsitXlh9zLNYML4FI9hSwEqIRBSYmpQPdrk6 +5Jc5auj6M+JJe2bJ1uLklew3o9sgGElGwB3XYKUXjOLArCJ0cpQkL84PKxdozFzjvc+ KIlGHGfjb2TATOqqIOqDSze6qeAqyF/kaKk98t/jbfQT0r2qx6PrOxDMGQ4f7S6IIwmt dbHDeywyho5NjaxRwEKTM+v75sCIpKtLn9ske4II8+0vX697sx2/ui4at3opVGGi2eJP BmMA== 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=z+isuoKHbYPGILyMICbGR0T5QiMYRy4J1XMZ/c0MyCE=; b=oWxc/mRnkHrIChnQsbe/eNyxk1tUdx+dtAkgZ3V55551wKs4cLq0koNDkUwcdl3NOZ KamK+W1N+xNiE3znEAWo7ASs/Qdz4Aq3VjvhwnmIICBfca7Zwy4suUE/DWHWyQS2KQvy VjByaJHw9AHukQMH8+D2gov7h4jtaa8vqdoBFcIzFHqzPi2Wbe7uIKFM63jHUh/wgy4s ozmfgBJp40EkZzUUDzO0F+BE6qcgW8olGhKDwf/flLSy1Y3Wvnhfn/u+HNIJ7os2ZFis xUoe+J/NCMRFm7xL70n48jYBNguPng7kpDKNrXhc19kWegusg5Ear/e23XkOdqA9+OdJ j8cQ== X-Gm-Message-State: APjAAAVWja1w3DDxgH959E3GeGkGn6TI6I0WKaCybvoMX67VihY8VSl+ gt3Yg3FPWaBbGCPwgc6L+bQEANdjm6lXBmFNpl6cfw== X-Received: by 2002:a67:f318:: with SMTP id p24mr2787324vsf.240.1582814601592; Thu, 27 Feb 2020 06:43:21 -0800 (PST) MIME-Version: 1.0 References: <20200227024301.217042-1-trishalfonso@google.com> <20200227024301.217042-2-trishalfonso@google.com> In-Reply-To: <20200227024301.217042-2-trishalfonso@google.com> From: Dmitry Vyukov Date: Thu, 27 Feb 2020 15:43:10 +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@linaro.org, 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, Feb 27, 2020 at 3:44 AM 'Patricia Alfonso' via kasan-dev wrote: > > Integrate KASAN into KUnit testing framework. > - Fail tests when KASAN reports an error that is not expected > - Use KUNIT_EXPECT_KASAN_FAIL to expect a KASAN error in KASAN tests > - KUnit struct added to current task to keep track of the current test > from KASAN code > - Booleans representing if a KASAN report is expected and if a KASAN > report is found added to kunit struct > - This prints "line# has passed" or "line# has failed" > > Signed-off-by: Patricia Alfonso > --- > If anyone has any suggestions on how best to print the failure > messages, please share! > > One issue I have found while testing this is the allocation fails in > kmalloc_pagealloc_oob_right() sometimes, but not consistently. This > does cause the test to fail on the KUnit side, as expected, but it > seems to skip all the tests before this one because the output starts > with this failure instead of with the first test, kmalloc_oob_right(). I don't follow this... we don't check output in any way, so how does output affect execution?... > --- 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. > process = self._ops.linux_bin(args, timeout, build_dir) > with open(os.path.join(build_dir, 'test.log'), 'w') as f: > for line in process.stdout: