Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp738791pxf; Thu, 11 Mar 2021 13:44:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxi4DxBY3OLSQjiG0ao2Bj5Y+HOhWB0ntEjABsF5/2mFEY2M4ZsfgEOjLjeWIgzMkdFtwqb X-Received: by 2002:a17:907:628a:: with SMTP id nd10mr2134183ejc.326.1615499060661; Thu, 11 Mar 2021 13:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615499060; cv=none; d=google.com; s=arc-20160816; b=IOP72y01G5LVuaSdMYHgY3oxcd06d+JQ3DBMebEvxaN/TfoqjfXuDJ189pE/z4RahO TBmXyo+j9ZIZEhVbL+3ngcbreYABO8iiydpaF1ZaD4uivuNkeg/K0CgnwBlXds4NIBnb VN5hJQQnala0rcWGn1DIqaBWv+P8NIz0uiFvGeCBsTKrD4vjJvX+hZ5kpgFjnEhtJZmk GcI3MqRT++8dl8JwcsrqbdqsynoJIu8s5XNGp9C8XhTqiIvpcqv8d/AnjzifiEPXO1G1 2ldpGPpJErtbgT7fFgd5i2jDooxAbPR+gpMyv7acDdmtzPqzar9k/WDM56G8J1VIKd2U la5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=KqyiEXFZVlJ5WAkVIpzRsNvJDBTABYowTYxavN0wmPI=; b=ktM0N3nLb5913XfLv9nSymqLjU+J//zUWRMN7YkaARznIFxfCT2d3FdDfG54FlGTLY EgWitguxlmab/zujxGDXmiuFQ22SNnNgqWm+jqbqcjJjHPrQnYAFGqBoVUznLW+IcAKP QRGJm2PiyyaqG/sZWN3NVrtEkxZ/1Mk/xb4hZLD6Sq05h8CTW5exsUSSvnBDoERVOrKB ttCBFDaJEHU4TJZPHsy9Ou+B6P6h4qHEK14vI68ZiJca5duRP0iQFUDmF0D+nZUjyBcZ I+BjlgNeyJphn9rLefh0uD73m1qoA6SiJ88YX2/kfwcTWshUn14Fwaevn+xPB/CsRoCI 0/bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vUKUWADT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id h19si2462736edb.134.2021.03.11.13.43.57; Thu, 11 Mar 2021 13:44:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vUKUWADT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231366AbhCKViV (ORCPT + 99 others); Thu, 11 Mar 2021 16:38:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231196AbhCKVhw (ORCPT ); Thu, 11 Mar 2021 16:37:52 -0500 Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3A1C061574 for ; Thu, 11 Mar 2021 13:37:52 -0800 (PST) Received: by mail-wm1-x34a.google.com with SMTP id f9so4580319wml.0 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=O1kw4n+M7AfwvspyJyzdXNPmNTj8a7EHzJq89AZX7bi1rP6fysd69UIPzOK1tLymsn w/SXNPTnjrO3Y8GJu6AC4Hu6BPw2Tn9dTUkysw6ew35BzXcDRKPtUShh4gjI54wbdRBD GQFm1UoYBNcT3DawM/PF1ustRgaMGOQNGJ+Ec8YALFBZpCv8y6x00UN/bHIdfTAiiS9L J44hEia6m7Ymn/OYDuAerPb8JMCzBxHwidTwdz7CiXCfszdCiulEoAOH6L0c1jSolJs9 xBkzDF9i7R4SMBMljb3vdpJfgxJjEbe2Dzy2Y3NOUvK1usJPXigQ3Wrg7glTfQKcTVrg ZECw== X-Gm-Message-State: AOAM530aQmZ7URGwkblW7qaSjORMV8wIOgFt2j8Y/AIcRGOBmReI6JVd offi66WgMhrcPne6MnqEMBhab7qNOZNZImyz 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.31.0.rc2.261.g7f71774620-goog