From patchwork Thu Mar 11 21:37:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12132963 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=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 33151C433DB for ; Thu, 11 Mar 2021 21:37:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB6B364F86 for ; Thu, 11 Mar 2021 21:37:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB6B364F86 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 479FC8D0303; Thu, 11 Mar 2021 16:37:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 450368D02B2; Thu, 11 Mar 2021 16:37:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F2FD8D0303; Thu, 11 Mar 2021 16:37:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 0C08E8D02B2 for ; Thu, 11 Mar 2021 16:37:53 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B3CE3181200EF for ; Thu, 11 Mar 2021 21:37:52 +0000 (UTC) X-FDA: 77908905984.26.95CC68B Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf26.hostedemail.com (Postfix) with ESMTP id 89254407F8F8 for ; Thu, 11 Mar 2021 21:37:49 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id i14so4547375wmq.7 for ; Thu, 11 Mar 2021 13:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=KqyiEXFZVlJ5WAkVIpzRsNvJDBTABYowTYxavN0wmPI=; b=vUKUWADTysn9YczPlnO53jYKYuLAG9pNDM0DXT3f6YdB5w4mlKOmJqqd/tGTFSDvdz FmsShTL8D6d0ayHAepOJQVXj6AG/O2j0fCohJgEu2atXg3/J7rnfGbzdfZsoaBK3bZxi z5M3Ow0kLuVo2gzEXn+ojysuZqAr8xxsoV2+0IBsNpSKpkaX2/LXzYoZmELq3zE/kcDI 5O0eoEngZSfqEs8uWMaNzHom/AdhnIyjGWxB05yQPbAUUauSNqVHffFtOZ82AOwuXlPj uCOuEZkmUGrmqVaQDNPBWHyTL/ZYjJzMyeWMp3VVc0ywHL5DEVEM8Z1FYSOtQBykGMlU HZAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=KqyiEXFZVlJ5WAkVIpzRsNvJDBTABYowTYxavN0wmPI=; b=P3cEoT18cUuSceOsGtkp67pgbnrCS0pfgfSQoeBSXYncjqzHdqmy62V4ynXzFxJ2Il eEGi8m/0PY7wv/S0WhnQ3MNVS718H8laZCerH4gbqMdgS9JQ+2aFGb9/grCYrhz8yXeV 9zRcXSWgDO8Kj0jneWER28Ma0AYqFhfZEMwPQ91uFyQkL0tJ4/EuWOE71yTE+8UwYcyT mYocFw8DF8y6TNNRuYRhxiW46v/raYVcJGKJGLSwUus6lGPBkUV6TO3EsQmHwgWrP2kA 7KxmKo7ClNknraETO1HV82/mklyPUZMnqNuNsz/cA+zNqLg8cOf9yX+Jm0nkfHyhfYBR 1OlA== X-Gm-Message-State: AOAM530Kh1G4uTOsr+QG3iZ7wxikdUCkj/Epa8vmSdPdQctgIwnF5DYv b04aFp9WkVTmeN2eyQFSdrhUonEe/gzGGPEY X-Google-Smtp-Source: ABdhPJwPI7MXwIggsu0PIhpFTdjlAk8f4pD+e/W64RlEyitc321VCJDbT5aPSUC15RhN1r5iSJ07BSbs/d8EUiHp X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:95a:d8a8:4925:42be]) (user=andreyknvl job=sendgmr) by 2002:a7b:cc84:: with SMTP id p4mr10172254wma.10.1615498671258; Thu, 11 Mar 2021 13:37:51 -0800 (PST) Date: Thu, 11 Mar 2021 22:37:23 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH 11/11] kasan: docs: update tests section From: Andrey Konovalov To: Andrew Morton , Alexander Potapenko , Marco Elver Cc: Andrey Ryabinin , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Stat-Signature: t93razzbffs8h9x6i1dsqxzsf836cp9r X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 89254407F8F8 Received-SPF: none (flex--andreyknvl.bounces.google.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from="<3r41KYAoKCPwerhvi2orzpksskpi.gsqpmry1-qqozego.svk@flex--andreyknvl.bounces.google.com>"; helo=mail-wm1-f74.google.com; client-ip=209.85.128.74 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615498669-55129 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update the "Tests" section in KASAN documentation: - Add an introductory sentence. - Add proper indentation for the list of ways to run KUnit tests. - Punctuation, readability, and other minor clean-ups. Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 33 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 6628b133c9ad..c4a3c8a9fe71 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -398,19 +398,20 @@ To disable KASAN reports in a certain part of the kernel code: Tests ~~~~~ -KASAN tests consist of two parts: +There are KASAN tests that allow verifying that KASAN works and can detect +certain types of memory corruptions. The tests consist of two parts: 1. Tests that are integrated with the KUnit Test Framework. Enabled with ``CONFIG_KASAN_KUNIT_TEST``. These tests can be run and partially verified -automatically in a few different ways, see the instructions below. +automatically in a few different ways; see the instructions below. 2. Tests that are currently incompatible with KUnit. Enabled with ``CONFIG_KASAN_MODULE_TEST`` and can only be run as a module. These tests can -only be verified manually, by loading the kernel module and inspecting the +only be verified manually by loading the kernel module and inspecting the kernel log for KASAN reports. -Each KUnit-compatible KASAN test prints a KASAN report if an error is detected. -Then the test prints its number and status. +Each KUnit-compatible KASAN test prints one of multiple KASAN reports if an +error is detected. Then the test prints its number and status. When a test passes:: @@ -438,27 +439,25 @@ Or, if one of the tests failed:: not ok 1 - kasan - There are a few ways to run KUnit-compatible KASAN tests. 1. Loadable module -With ``CONFIG_KUNIT`` enabled, ``CONFIG_KASAN_KUNIT_TEST`` can be built as -a loadable module and run on any architecture that supports KASAN by loading -the module with insmod or modprobe. The module is called ``test_kasan``. + With ``CONFIG_KUNIT`` enabled, KASAN-KUnit tests can be built as a loadable + module and run by loading the `test_kasan.ko`` with ``insmod`` or + ``modprobe``. 2. Built-In -With ``CONFIG_KUNIT`` built-in, ``CONFIG_KASAN_KUNIT_TEST`` can be built-in -on any architecure that supports KASAN. These and any other KUnit tests enabled -will run and print the results at boot as a late-init call. + With ``CONFIG_KUNIT`` built-in, KASAN-KUnit tests can be built-in as well. + In this case, the tests will run at boot as a late-init call. 3. Using kunit_tool -With ``CONFIG_KUNIT`` and ``CONFIG_KASAN_KUNIT_TEST`` built-in, it's also -possible use ``kunit_tool`` to see the results of these and other KUnit tests -in a more readable way. This will not print the KASAN reports of the tests that -passed. Use `KUnit documentation `_ -for more up-to-date information on ``kunit_tool``. + With ``CONFIG_KUNIT`` and ``CONFIG_KASAN_KUNIT_TEST`` built-in, it is also + possible to use ``kunit_tool`` to see the results of KUnit tests in a more + readable way. This will not print the KASAN reports of the tests that passed. + See `KUnit documentation `_ + for more up-to-date information on ``kunit_tool``. .. _KUnit: https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html