Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp408859rwi; Wed, 19 Oct 2022 23:45:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TDFAQ9x/HB+t1c6nQWf+XoRIFbEyDekZCniqXTWjITc+MvnuDzECILteFfeguM0ZSIYve X-Received: by 2002:a17:903:50e:b0:182:631b:df6f with SMTP id jn14-20020a170903050e00b00182631bdf6fmr12672680plb.66.1666248316724; Wed, 19 Oct 2022 23:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666248316; cv=none; d=google.com; s=arc-20160816; b=K2gr7nUx3/kk1x4xeQ6Y78b5lPvOC258uxsJTD5bxf0PPZa9GMhZXD/r4yePy3aT2z WqTNeMoebc08pm0eIvITzSOZWvsNPkqUnQZRlaVcUXjUyqtgxaaMm3bDnfFK8HTE97hb 3yesXSCJdfb4/AR43ZadH/txFdgfWGlJNltzYQ/1sHnzKT/eor9nmzPP8jqdBcuNLK+z Y7oV9i/3sTOywNLPydgQxYEidgAqq9Z9bGjJz7KEfMpiwR0vbKsjsxh98K+jH+X69Fc9 7nLwIzprFJq732+hN6KXrXH2i/QRpEjPAxC+xd4qj2/vQjzK7c/WGUXGLpSvOlbCHROe MHuw== 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=11yslyoqZ22XHDYINXeXMeKoDoK+0zcgLn8t6nqfX5I=; b=RREBl4TisHJ1qrSDSvkbcMyvsii6VSQWWXXsqe8+9uxk0nz9evAUZR2c2pCgLMdmvh URygnehs/Jsmj49hWIwnZuA3hENjF7174ZHDIK+kLDORz1QKiWGJau6yH9gjsb0JIhbV s0xEzxKs5JwJ6bzf6csvSUVvKu/iNrYbnjfcpQkCGPnCao0hbTkBKjAuftFCRzps/lPn mKmeusS38gufHyMnxoGfp0hyqxk7+WsupKKmCZgiFChxbmutCGWdimo1KjRHh936UALY soG35HkGqLnPv5tYtU2ZqHkbliQvNYDt1jBOBb+oldhOecdxEBkqxGlmiLvc9VB8yJsY PA+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ZmB1GSfy; 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 i7-20020a17090a650700b0020ab4faf62dsi2161482pjj.159.2022.10.19.23.45.03; Wed, 19 Oct 2022 23:45:16 -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=ZmB1GSfy; 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 S229964AbiJTGiS (ORCPT + 99 others); Thu, 20 Oct 2022 02:38:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiJTGiR (ORCPT ); Thu, 20 Oct 2022 02:38:17 -0400 Received: from mail-vs1-xe2d.google.com (mail-vs1-xe2d.google.com [IPv6:2607:f8b0:4864:20::e2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB8218C407 for ; Wed, 19 Oct 2022 23:38:15 -0700 (PDT) Received: by mail-vs1-xe2d.google.com with SMTP id n63so271778vsc.8 for ; Wed, 19 Oct 2022 23:38:15 -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=11yslyoqZ22XHDYINXeXMeKoDoK+0zcgLn8t6nqfX5I=; b=ZmB1GSfyCz8f4EVitmjVVdxTuugsj4nvXjP2gNyiPRzX1oHWbhqtZRxCKOlHym0t7K 9VLWyvd9Ld/Ts7q1xBpQf03Yd9y0JhvuOMpcN1Cmxb1Y8hD+JkjxIQJM7lW2Zn4sU+Im JHtJL48Xe6bDGNoIMV8cyp/0w72ks3m3Yx0AV75c6rHTY30ZP9DWCy551nA5Y6pdeYBJ soVJi2sdRXGQcB2R0mSNoixNowB9bue3KZ/+wcPFJw2JpxgQdaZ0f1nuj3Lof4KAsadj DVofDxfQc8PNITPm2/Sb2x1Fq6nxDn179lsqaPU/FUYaxKYueJP+JqC5jPNqUtJOpIs4 jOMg== 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=11yslyoqZ22XHDYINXeXMeKoDoK+0zcgLn8t6nqfX5I=; b=Bire9XT6zFdKtnW1qZAKCZjTqPa3PX+ijc5fLahXvf9RwapWCvWNCht7CExQeZnAsA 32d6S81WDFhijnV9nOYvp/0Q6FEzTogeakTF3U7QRxtwxG42oBMn1VAcvwonOcf8DjXe 2LFZXDicsdrPgTqnCUl5jZu7wu9JfCs/D5vP/1CeNbG1SaMFxhAXyvRG2rjdzqVJV+HO bqzE6viyRPO9W2nZTPDJOqm+HfTMrGrYMaT0NDkUfBgzupELsv564OXt36i044HF8NGm RIjtrpzJ0ShqwNOcnvOSbhLnJeg4kmrIGe36RSdEmjLw1CyYhnawBcgh/2fUXGm4v5GZ mKFw== X-Gm-Message-State: ACrzQf0fK53++1+00dSgVe5AkEtOOVtTaKHwGnzIv+2ROrFWGVW6mYq0 C++HzDo3V8uxn1l/tXF2Y0G4wHLYzPJYZ6TizAv1JA== X-Received: by 2002:a05:6102:284a:b0:3a7:ce5:ca83 with SMTP id az10-20020a056102284a00b003a70ce5ca83mr5880849vsb.38.1666247894600; Wed, 19 Oct 2022 23:38:14 -0700 (PDT) MIME-Version: 1.0 References: <20221019085747.3810920-1-davidgow@google.com> In-Reply-To: From: David Gow Date: Thu, 20 Oct 2022 14:38:02 +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="000000000000e214d405eb719132" 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 --000000000000e214d405eb719132 Content-Type: text/plain; charset="UTF-8" On Thu, Oct 20, 2022 at 3:48 AM Andrey Konovalov wrote: > > On Wed, Oct 19, 2022 at 5:06 PM David Gow wrote: > > > > > 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 > > Ah, right. Thanks for the explanation! > > > > 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. > > I wonder what's the best solution to support this, assuming KASAN > tests are switched to using tracepoints... I guess we could still keep > the per-task KUnit flag, and only use it for non-KASAN tests. However, > they will still suffer from the same issue tracepoints solve for KASAN > tests: if a bug is triggered in a context other than the current task, > the test will succeed. Yeah: I'm not sure what the perfect solution here is. Ideally, we'd have some good way to get the current test, which would work even in workqueues, rcu, etc. This affects more than just KASAN: there are quite a few different places where getting "the current test" is important. One option is just to use a global: we don't support running multiple simultaneous KUnit tests at all, at the moment. But, equally, it increases the possibility of false-positives if something non-test related needs to access the test structure. This is probably not too much of a problem for KASAN, but the function redirection features we're working on benefit quite a bit from those redirections not being enabled outside of the test. Thus far, we've just sort-of accepted that these don't work with tests which push work to other tasks, but it is sub-optimal. And even if KASAN moves to tracepoints, this problem doesn't totally go away, as you still need some way to know you're in the KASAN test to disable the "fail-test-on-KASAN-report" behaviour. I guess that could be some global flag triggered from the suite_init / suite_exit for the KASAN test, though. Cheers, -- David --000000000000e214d405eb719132 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ggz5MIIEtjCCA56gAwIBAgIQeAMYYHb81ngUVR0WyMTzqzANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG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