Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1307035rwi; Wed, 19 Oct 2022 09:03:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mX64uC8wtpYgwPmIeJ+08EkLTxQSZdODlwlC7dk3tKtrS3NATrhKfxaagiuVg4/U5UmLI X-Received: by 2002:a17:903:2cd:b0:182:f36b:31ef with SMTP id s13-20020a17090302cd00b00182f36b31efmr9018510plk.171.1666195405007; Wed, 19 Oct 2022 09:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666195404; cv=none; d=google.com; s=arc-20160816; b=ylLTfPXnMO46r64RqBTFknpx8xbqoYF83r0sbi3a9JEL1x5oVatxX7rXkqkwvJDkE+ WXo72NNdTbACFbm8udQhVM+B8cOgSI0NqrKxSoQ/vEF5iU3Rlm+czkPK6c9vVRuFAECm u78+RCLDBunqpI1gVCQkSfwtXIDoycthBgSNajKOWORaxgU6xGCagzESH2PvkimN7d6o TZSDACi/ES70TdxoM4dXSBxTlGtGX3w+WueCnFpzLSTcgsbC64kMbYnEGkZ+WbtVAlVz APPjFWOzIW1MfjsC240APIpKmLTZIhOE+OCp2/TEIDVfSNgg9GNz2P+jXTM5gAG78keh IMOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EA/X3XCsPZogje4ZqteiRzB/2MJTap3610f/+jO3p0Y=; b=ww1qmmzgHuV5UChefB5uCOMd8onFcCYJUEgctuGjLySZsrsj037eYfIRnKFAgsup0D U/Ga3QW4l5DNfHDtgSx9ep94h3SpapPt8SJCHjODjDZZcvhtapJ69OFSkZ/wCCr6F5Ks RSs6w9q/ZukwRNt0oVK0BZNH7h+hmoSMoofDxZ0Vgjc0MhBFtONJnA7GxqOwV1FmyR2z MHEoxNjlbN6IbwOYPb+nbDlo7Zjbm3kESLZWg96P/M6T6Psw+fcL33hN27ySv23BFRNo eanRSL4kuozmyIJ7uEk+u2NNGAXNw7pI0LPoy4JepaEbq//ylAw4UMgd7p5Xgy+Ux7sD Gasg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="la/8UQgx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a170903234d00b00178b562e79asi21632093plh.263.2022.10.19.09.03.00; Wed, 19 Oct 2022 09:03:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="la/8UQgx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232182AbiJSPPg (ORCPT + 99 others); Wed, 19 Oct 2022 11:15:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbiJSPO5 (ORCPT ); Wed, 19 Oct 2022 11:14:57 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C711C812C for ; Wed, 19 Oct 2022 08:07:54 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id y20so7371630uao.8 for ; Wed, 19 Oct 2022 08:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EA/X3XCsPZogje4ZqteiRzB/2MJTap3610f/+jO3p0Y=; b=la/8UQgxE0wKVVZ7S3BDbi4Y5FkVWJW5LyRO2wstPIuLC42hwDf/wOK9EgRPpEpbWn OwNrwB/zaSpHfi2NAWY9Ru5yrpbSKGyGwgLXvN4IXvSlriw8YRF5mZsWbXDFg1UnaNod jbM97olMcuGgayYiZDhIxf2J47em63cbNQJPdHzVhdPKbrz/QcLbUYgr9WTwuCrFpru3 Y43f2+9qkL4pdQlNZ10g1vIWSIop9usmknc2/CtBYMgGeZSqzkzkD65sYhP8noYm/g+h kdLIxLzEYQeUx7Ma1ZGO2heoEfOZ1MJYvBh+0Bi2+3yaoasEQ6ihNXq9KUUx1xzG5dPU /SSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EA/X3XCsPZogje4ZqteiRzB/2MJTap3610f/+jO3p0Y=; b=eHTH2ZonhN1LgS7sP5wv/Nb8mkRapH0Nul1ignrCPxu4nlnRGuTFTqe19UaOynBDaE B2up/a67TRrEVziEvBry/LyVLmiOGNaH8WHJxwf++Y5YyksHUXiwBKjv9tWex3bMknfq Fif3NJSQaVt/qKyCvqF9lc9P9w63AOxhx/khGl6fAcHaBvw+wnGO2B04WQa7dx2NC94e fm7/5O/xS4lL2GNl00UEZYuEDP5zwX7xTJHYO5WKDx/lYXbYEtDe2JgNhSUJTLi4hGz/ q7nix3pG8IQbis6ZUeeRN3uWn/Gm2G9SioH4Ai8A+5tma/waTQarmndmxis0Gi4SZ8YH LMHw== X-Gm-Message-State: ACrzQf085hooGw54zwBSD0ZtGs6l45Wnq7O4MvLlxBd8/GvjZqUHSguA v7v+CIETEdH4bjJagW3fDxLoA/k4ymLQ4i9719h4xg== X-Received: by 2002:ab0:7412:0:b0:3d1:c2f7:3250 with SMTP id r18-20020ab07412000000b003d1c2f73250mr4374614uap.21.1666191975065; Wed, 19 Oct 2022 08:06:15 -0700 (PDT) MIME-Version: 1.0 References: <20221019085747.3810920-1-davidgow@google.com> In-Reply-To: From: David Gow Date: Wed, 19 Oct 2022 23:06:03 +0800 Message-ID: Subject: Re: [PATCH] kasan: Enable KUnit integration whenever CONFIG_KUNIT is enabled To: Andrey Konovalov Cc: Andrey Konovalov , Alexander Potapenko , Andrey Ryabinin , Dmitry Vyukov , Andrew Morton , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Daniel Latypov , Brendan Higgins , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000d2078a05eb648cd3" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000d2078a05eb648cd3 Content-Type: text/plain; charset="UTF-8" On Wed, Oct 19, 2022 at 10:18 PM Andrey Konovalov wrote: > > On Wed, Oct 19, 2022 at 10:58 AM 'David Gow' via kasan-dev > wrote: > > > > Enable the KASAN/KUnit integration even when the KASAN tests are > > disabled, as it's useful for testing other things under KASAN. > > Essentially, this reverts commit 49d9977ac909 ("kasan: check CONFIG_KASAN_KUNIT_TEST instead of CONFIG_KUNIT"). > > > > To mitigate the performance impact slightly, add a likely() to the check > > for a currently running test. > > > > There's more we can do for performance if/when it becomes more of a > > problem, such as only enabling the "expect a KASAN failure" support wif > > the KASAN tests are enabled, or putting the whole thing behind a "kunit > > tests are running" static branch (which I do plan to do eventually). > > > > Fixes: 49d9977ac909 ("kasan: check CONFIG_KASAN_KUNIT_TEST instead of CONFIG_KUNIT") > > Signed-off-by: David Gow > > --- > > > > Basically, hiding the KASAN/KUnit integration broke being able to just > > pass --kconfig_add CONFIG_KASAN=y to kunit_tool to enable KASAN > > integration. We didn't notice this, because usually > > CONFIG_KUNIT_ALL_TESTS is enabled, which in turn enables > > CONFIG_KASAN_KUNIT_TEST. However, using a separate .kunitconfig might > > result in failures being missed. > > > > Take, for example: > > ./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_KASAN=y \ > > --kunitconfig drivers/gpu/drm/tests > > > > This should run the drm tests with KASAN enabled, but even if there's a > > KASAN failure (such as the one fixed by [1]), kunit_tool will report > > success. > > Hi David, > > How does KUnit detect a KASAN failure for other tests than the KASAN > ones? I thought this was only implemented for KASAN tests. At least, I > don't see any code querying kunit_kasan_status outside of KASAN tests. Yeah, there aren't any other tests which set up a "kasan_status" resource to expect specific failures, but we still want the fallback call to kunit_set_failure() so that any test which causes a KASAN report will fail: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/kasan/report.c#n130 > I'm currently switching KASAN tests from using KUnit resources to > console tracepoints [1], and those patches will be in conflict with > yours. Ah, sorry -- I'd seen these go past, and totally forgot about them! I think all we really want to keep is the ability to fail tests if a KASAN report occurs. The tricky bit is then disabling that for the KASAN tests, so that they can have "expected" failures. -- David --000000000000d2078a05eb648cd3 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqh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