From patchwork Fri Mar 12 14:24:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12134805 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 CC962C433E0 for ; Fri, 12 Mar 2021 14:25:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74C0464FD6 for ; Fri, 12 Mar 2021 14:25:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74C0464FD6 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 CF9448D0365; Fri, 12 Mar 2021 09:25:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CABEF8D0361; Fri, 12 Mar 2021 09:25:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B244D8D0365; Fri, 12 Mar 2021 09:25:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 562C28D0361 for ; Fri, 12 Mar 2021 09:25:04 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 148C85010 for ; Fri, 12 Mar 2021 14:25:04 +0000 (UTC) X-FDA: 77911444128.25.05444C8 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf15.hostedemail.com (Postfix) with ESMTP id CE86BA0000FD for ; Fri, 12 Mar 2021 14:25:02 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id m23so6212066wrh.7 for ; Fri, 12 Mar 2021 06:25:03 -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=Bw5uCei/catF+EzOEmfCcRCFyREJER0Q0h8plWDwOtQ=; b=Xnhtd3gvW2K8u2WiuCaZNvtsoyWO9DSXU+9u6yVJZ4RbQh7xRFDPPX1TkZXDu2ZUGc vBkGtX3S8Jq5LetjXUH0b+2csT0PMYHsU2T0hLUWe5RLQ67/II10RAKEsIGTO9Rg5nj5 uyQPdUribEsObu00cvEGjydTSBi2d2qvyX1zkl+7Us81ZrgAbZUQVj17EMzIMQuiGmEa Wai+muui+UNGInCH5JrDeQWuus39Oez87A9DPVxkdClfs2Z6MS0mhRNl8dMnlLXappbW yXYhJ1d21mG1S90SgjQx9wBSLQ/VsQhFTo0iyj1XWheORUnb1eGCiEa7GIUA//kZ2DO3 RkXg== 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=Bw5uCei/catF+EzOEmfCcRCFyREJER0Q0h8plWDwOtQ=; b=hlmEaF0MFsKhwziJzqjZw8YtJdbBgAfr3i4quQZf4QA656Ldpd6r9MAndG4CfUoYMS lX7x4oywgKCY9PTYbB4iT0glZdXKFFaYQjDGq4vo5i7T3Ev/8g8LjN5oXX0s/chHYcbS fEE2JHYer2aOCKaAYQ2Tby1CFfnPkws7VcAbjKSnw1XFHIk/3F1o0S3Fb3u+l5NvCBjz N7DizILY5HHNSzQZMplA/z9zsOAy0/tYCvY1lbP638LRfNPBhw8YOtJEwKi8CBvW1Yqb +uByaI9qsBaZ4j8IbHIqgzS/ZsTQeSaRvxJaJ3RJPNU1p7XvMhhfmBtogjMTa1RKRaro ZvoQ== X-Gm-Message-State: AOAM532skpwytUTTif42CxzhzVix1xCnt6gmCxsuYEHA56G5btto2Udj aAnXwTZ7pF2zFrU2CMeueI0s1HvlATu3SSol X-Google-Smtp-Source: ABdhPJzx/wOW6+gWN/8am6G2R3KojRCf27zV3DUYoC42P07d36RS26M31dlU0mkAElkJQD/Bs1CkPM2pjAu6wwFv X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:95a:d8a8:4925:42be]) (user=andreyknvl job=sendgmr) by 2002:a7b:c18e:: with SMTP id y14mr2248712wmi.1.1615559101927; Fri, 12 Mar 2021 06:25:01 -0800 (PST) Date: Fri, 12 Mar 2021 15:24:34 +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 v2 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: 4tsz7mn1aeec879tadoxmu8wfa7i5h19 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: CE86BA0000FD Received-SPF: none (flex--andreyknvl.bounces.google.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from="<3vXlLYAoKCOYIVLZMgSVdTOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--andreyknvl.bounces.google.com>"; helo=mail-wr1-f74.google.com; client-ip=209.85.221.74 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615559102-594406 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 Reviewed-by: Marco Elver --- Changes v1->v2: - Fix missing snippet delimeter around "test_kasan.ko". - Drop "the" before "test_kasan.ko". --- Documentation/dev-tools/kasan.rst | 32 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 5749c14b38d0..a8c3e0cff88d 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -411,19 +411,20 @@ saving and restoring the per-page KASAN tag via 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:: @@ -451,27 +452,24 @@ 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 ``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