Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4941740ybb; Tue, 24 Mar 2020 08:06:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuZ/lmpqc5kdtLN4twBZ99F5f+6rTCwQWRXyjHp8RYXO3MM0khxh/4IKpmuC6jNGjZalxfQ X-Received: by 2002:a9d:77d0:: with SMTP id w16mr22389741otl.66.1585062367163; Tue, 24 Mar 2020 08:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585062367; cv=none; d=google.com; s=arc-20160816; b=CHY1DZ2muiH9uYAn474nTg1/ogsFlWyQtBETIyEC/VZOxK2pvDvrGqlJAcCS8o7crs J1OgV7O9+gNfyl/WHvOfq2/EKLfoqAP3IC9tJSGC8hiJVgSc9sTXZ/Avu3voDPZ2Fyt6 jO6bwlJ3T0WUuBgnuuQnatiQ27z15+FVzD7NQb7b4snpqzqBygpYCy/sFzZcdnCMZGSc q0xGgMNzE5m2F4kKhTfhGj0J7uzGVOE/7s/8zL0jwNVsyiZ0xf/gUmDFOKGh0St8NeGE rlESkB/0yfz3bK4O5a8kx+6KYcl+eVuEyrAQYoiCIQSiyPChOo8MdcvMUOkUlr+SEs0l yfhA== 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=Z37whwAEqv2UhQ238liZabu95DixugSK+aNM/HESChs=; b=xKi1jR1UqbV6Ty0pdz6/3qFQqtCTZyJqZZ4JN2rBMktbqvR4VF9oH80Id9yy7OCTl8 yBKG82Yh2NFS1gFJdfkraVtJwB771miaGR+pll1WSAu3iBVW31X/fUWBSESaCqvJbn41 ztjGv3vcleybRqpzp8u/Nx+xiYinm91JLeSoqQvmHYsTW/xEOJGHBvYqCzGoVVqJyHFb WbWofHnfP2FUrITQlK7rFxFmE9QEA9gg/8cgb+7ZtvIblg3ggL5s6q5H3UyNS3/6WR0M Y17ZS1lYrM3CiP+e4AJ9VrvXtPmLbXQaHcXIjYPam8pH0yxq2a2T5kgcKNpH7xOQ5v0Y 64KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=koZzPW8O; 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 v10si8789468oth.136.2020.03.24.08.05.47; Tue, 24 Mar 2020 08:06:07 -0700 (PDT) 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=koZzPW8O; 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 S1727742AbgCXPFR (ORCPT + 99 others); Tue, 24 Mar 2020 11:05:17 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42405 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727561AbgCXPFR (ORCPT ); Tue, 24 Mar 2020 11:05:17 -0400 Received: by mail-wr1-f68.google.com with SMTP id h15so9666321wrx.9 for ; Tue, 24 Mar 2020 08:05:15 -0700 (PDT) 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=Z37whwAEqv2UhQ238liZabu95DixugSK+aNM/HESChs=; b=koZzPW8Onon8s5EyCubFp/bBT+4QR2ekY8m1b/Ql5hFd2LxT5rbMicbghIQlwGiuoL 6rWV6xUHlKEw6RXlfd3ONn61FJ8XrH9auITAHSbhRLOXQmQ3tOHbp7PliOed5widCviT /aU9XENZq1ULLHxVXOuA8YT0nDuPbmyDozB49Vip/gkmXNam5Npqu3+saE1TRSglsNCk IPwKjPoLX2PcRSbFDMP2O33SLKyILoXPIPZ+Q5TkFKEybEC4sft0RnNNvOqOSM9onIxp ko6XL6k39lR+0IAmhVGd6f4BHCcsTtyCvP/t0dmZmr8wOfPu7CGt74vjP+6RIl7QmIKp 0BPw== 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=Z37whwAEqv2UhQ238liZabu95DixugSK+aNM/HESChs=; b=sVD8rGZbUWrqe2GHycEVcztGXPe/V7pIZHRv0TLEG8Ghy9l66paw8DiRTEJiAUB9zS sGyWNzPHXtug1zhorn3u6bkyVp6ZS7DfdzrtfOEGfNsXxClxIMn5PABKRzpt/4v775ux U7R/rnFmErl3UXEl41S9oqZu1QDnpOOclBsZAgc1+wQEjHHGfPp2FV9a4H5OzMRrvDmG vyk/hz+UaTcLd+UqH3Qlfd0hNiQKLbaBim3H+hgW7Ff/QbbmSwC/O2M2PRKZWuPp0Hv7 nSp170pi2etimIPlOT0uLg1ICfKWEjMrS157F46hsipDWzQ9pVgHKodtWdRTXfGHd7Ld HckA== X-Gm-Message-State: ANhLgQ18O1k/x4dsNh+SEpJfJBLruxtyw2lOlOA+1e339opqi6981aXN m0KgY096fIF9iEgpBL/7LqWJ7hYBj+IeOFt2ioGSuw== X-Received: by 2002:adf:efc9:: with SMTP id i9mr16611416wrp.23.1585062314941; Tue, 24 Mar 2020 08:05:14 -0700 (PDT) MIME-Version: 1.0 References: <20200319164227.87419-1-trishalfonso@google.com> <20200319164227.87419-4-trishalfonso@google.com> In-Reply-To: From: Patricia Alfonso Date: Tue, 24 Mar 2020 08:05:03 -0700 Message-ID: Subject: Re: [RFC PATCH v2 3/3] KASAN: Port KASAN Tests to KUnit To: Dmitry Vyukov Cc: David Gow , Brendan Higgins , Andrey Ryabinin , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , LKML , kasan-dev , kunit-dev@googlegroups.com, "open list:KERNEL SELFTEST FRAMEWORK" 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 Tue, Mar 24, 2020 at 4:25 AM Dmitry Vyukov wrote: > > On Thu, Mar 19, 2020 at 5:42 PM 'Patricia Alfonso' via kasan-dev > wrote: > > > > Transfer all previous tests for KASAN to KUnit so they can be run > > more easily. Using kunit_tool, developers can run these tests with their > > other KUnit tests and see "pass" or "fail" with the appropriate KASAN > > report instead of needing to parse each KASAN report to test KASAN > > functionalities. All KASAN reports are still printed to dmesg. > > > > Stack tests do not work in UML so those tests are protected inside an > > "#if IS_ENABLED(CONFIG_KASAN_STACK)" so this only runs if stack > > instrumentation is enabled. > > > > copy_user_test cannot be run in KUnit so there is a separate test file > > for those tests, which can be run as before as a module. > > Hi Patricia, > > FWIW I've got some conflicts applying this patch on latest linux-next > next-20200324. There are some changes to the tests in mm tree I think. > > Which tree will this go through? I would be nice to resolve these > conflicts somehow, but I am not sure how. Maybe the kasan tests > changes are merged upstream next windows, and then rebase this? > > Also, how can I apply this for testing? I assume this is based on some > kunit branch? which one? > Hmm... okay, that sounds like a problem. I will have to look into the conflicts. I'm not sure which tree this will go through upstream; I expect someone will tell me which is best when the time comes. This is based on the kunit branch in the kunit documentation here: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=kunit > Why the copy_from_user tests can't be converted? > It would be very nice to get rid of the modules entirely, rather than > having 2 different test procedures because of 2 tests. > Or, alternatively can there be other tests in future that can't be > converted? Naming it "KASAN_USER" looks somewhat overspecialized. Say > tomorrow we have another test that can't run under Kunit, but is not > related to copt_from_user, should we create yet another module for it? > I think the crux of that is that's a module, so a better name may be > "KASAN_TEST_MODULE". Currently all tests that need to run as module > are related to copy_from_user, but that's just an implementation > detail. > When I converted the copy_user_tests into KUnit, I was getting a kernel panic with a "Segfault with no mm." According to Brendan, since KUnit starts a new kthread and is not invoked via a syscall, things like copy_to_user won't work in the KUnit framework. I agree that the naming is too specific, but is KASAN_TEST_MODULE too generic since the current KASAN_TEST can be built as a module? Maybe TEST_KASAN can be KUNIT_TEST_KASAN and TEST_KASAN_USER can be TEST_KASAN_MODULE... -- Best, Patricia