From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1786C3F2D1 for ; Mon, 2 Mar 2020 17:52:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A25BF2173E for ; Mon, 2 Mar 2020 17:52:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ob7ugNbo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbgCBRwm (ORCPT ); Mon, 2 Mar 2020 12:52:42 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:35397 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbgCBRwm (ORCPT ); Mon, 2 Mar 2020 12:52:42 -0500 Received: by mail-yw1-f66.google.com with SMTP id a132so645432ywb.2 for ; Mon, 02 Mar 2020 09:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1IOLrEITmD2P6VvJiuWxnVZVe415X+z+1kv5oi6Hs5w=; b=Ob7ugNbolYcPYQ1RvjJtJ0j6ieNXbuDYZuyXXFLie3EM4zIZNEuw/jW+FdJJFwdv52 84g3Wvq7rGW3EoP8iKyZqhcJROlzHsUXVtSD1R1ltJqSdjF+8A/z6QeYocl9NrBNpx3R Flc957tzuSZgDdYcTO8nL15zW1KM/5W+deBWI= 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=1IOLrEITmD2P6VvJiuWxnVZVe415X+z+1kv5oi6Hs5w=; b=D7+2TiQetq/CPb3DAFUVIv/8JjsbXVtxsWT9m6ix4O0spA+/x7AtFC4V3sS5PDnnFz zWVnVQK4TtKYywxgckXWalkqQYy/Wdeurei914fKPk5E2GzqzQZEye/WhYS7gaPpGDQ/ z6vBhfFMO3jniCGW/o2keAp7xXJLy4MCvk53DlkHx4dbrqeC32Y72Id8TVdQgisMe3O5 w2eL75wn+XugB48isspzMNtdEH9CD0Sw7jT1aRkwIgRqqaq+I/Zq5cCHWoV4zNP3LMdI gA66oHKfWcC+VVtyJk5/vqw2SBgo17benrvrAU8rew4YTU++FW7O8yqb+GVfC8C5pgsm VuJg== X-Gm-Message-State: ANhLgQ1lbnRAnsCvhoAz6JLHNgqLWfYi3EE2D1Adz/PrNTVCrMEzejtT 1Tu4aNDhMQfJVadJwPQW/4FNIxsRmy8= X-Google-Smtp-Source: ADFU+vuNfnK7htyJl7tX+JzVLxk2ROoEUm47TqFnAtS9v2ulbTMi0Hs8+EQY9xANeWA32ZQx6kcMDA== X-Received: by 2002:a25:a281:: with SMTP id c1mr142590ybi.327.1583171559070; Mon, 02 Mar 2020 09:52:39 -0800 (PST) Received: from mail-yw1-f51.google.com (mail-yw1-f51.google.com. [209.85.161.51]) by smtp.gmail.com with ESMTPSA id h124sm3106458ywc.83.2020.03.02.09.52.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Mar 2020 09:52:37 -0800 (PST) Received: by mail-yw1-f51.google.com with SMTP id h6so594535ywc.8 for ; Mon, 02 Mar 2020 09:52:37 -0800 (PST) X-Received: by 2002:a81:3888:: with SMTP id f130mr517632ywa.138.1583171556864; Mon, 02 Mar 2020 09:52:36 -0800 (PST) MIME-Version: 1.0 References: <20200227024301.217042-1-trishalfonso@google.com> In-Reply-To: From: Kees Cook Date: Mon, 2 Mar 2020 09:52:25 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/2] Port KASAN Tests to KUnit To: Dmitry Vyukov Cc: Patricia Alfonso , 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 Sat, Feb 29, 2020 at 10:39 PM Dmitry Vyukov wrote: > > On Sat, Feb 29, 2020 at 2:56 AM Patricia Alfonso > wrote: > > On Thu, Feb 27, 2020 at 6:19 AM Dmitry Vyukov wrote: > > > > > > .On Thu, Feb 27, 2020 at 3:44 AM Patricia Alfonso > > > > - pr_info("out-of-bounds in copy_from_user()\n"); > > > > - unused = copy_from_user(kmem, usermem, size + 1); > > > > > > Why is all of this removed? > > > Most of these tests are hard earned and test some special corner cases. > > > > > I just moved it inside IS_MODULE(CONFIG_TEST_KASAN) instead because I > > don't think there is a way to rewrite this without it being a module. > > You mean these are unconditionally crashing the machine? If yes, > please add a comment about this. > > Theoretically we could have a notion of "death tests" similar to gunit: > https://stackoverflow.com/questions/3698718/what-are-google-test-death-tests > KUnit test runner wrapper would need to spawn a separete process per > each such test. Under non-KUnit test runner these should probably be > disabled by default and only run if specifically requested (a-la > --gunit_filter/--gunit_also_run_disabled_tests). > Could also be used to test other things that unconditionally panic, > e.g. +Kees may be happy for unit tests for some of the > hardening/fortification features. > I am not asking to bundle this with this change of course. A bunch of LKDTM tests can kill the system too. I collected the list when building the selftest script for LKDTM: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/lkdtm/tests.txt I'm all for unittests (I have earlier kind-of-unit-tests in lib/test_user_copy.c lib/test_overflow.c etc), but most of LKDTM is designed to be full system-behavior testing ("does the system correct BUG the current thread, when some deeper system state is violated?") -- Kees Cook