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=-24.8 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_SANE_1,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 11EADC433E0 for ; Fri, 12 Mar 2021 15:06:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D21964FDC for ; Fri, 12 Mar 2021 15:06:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D21964FDC 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 EF3C96B006C; Fri, 12 Mar 2021 10:06:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ECB7F6B006E; Fri, 12 Mar 2021 10:06:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D936F6B0070; Fri, 12 Mar 2021 10:06:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id C15BB6B006C for ; Fri, 12 Mar 2021 10:06:48 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8854A1820C7A4 for ; Fri, 12 Mar 2021 15:06:48 +0000 (UTC) X-FDA: 77911549296.03.5CB1737 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by imf13.hostedemail.com (Postfix) with ESMTP id C328CE007A4F for ; Fri, 12 Mar 2021 15:06:42 +0000 (UTC) Received: by mail-wr1-f53.google.com with SMTP id j7so1961275wrd.1 for ; Fri, 12 Mar 2021 07:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qBFp/gtR/nkmpiy/tuP54xC4mkMnllk9WWHQ5y9bp+8=; b=l0terJNxYkV/+zFklKdMKaNVqV1bPtw1g8NvMZndsJUemdD1envhpUZzRx+8u4hcvI wraNb8fJXljCTpMUM2joNzzuE9IaX5ektzNIW2f4g9APQ6tH/jAqaFZWmnbnObagcXiu sX+7iM2C+whX4MBjWL8WFCSFS1/f5QVTGpfqCYWp5R5t7XJu21qFxLcLk4Xyh0bfkyku MeXlEY3AfvEJk29LpAqDzYAUElEusRESRD39orwpq9EiWziFxlBqOv8mfadvAzMkf7T5 +ilCSMcT4ynrc1kiza9Wr76Ab5rW86EljbDy/3dtNdkxmkbIl0BjAHRZD3ssDRRt3Z/H 4XyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qBFp/gtR/nkmpiy/tuP54xC4mkMnllk9WWHQ5y9bp+8=; b=L6Em9vEI1w8n1TCq8YnuidgIcXK5bRxrPYT/F3PnR95tEIQSUg5HkqPU/N0e8i/1Z4 UXjJVqhdayyM0XLq+b+P28HTThjHp3LFTR6uxE9xwTkcc51t8TH56eBq4PUe5eMsr2Kt RnOyL1Ezp1KpWWZytGgt1zR0IAU5DA8Du2qjVhQXfoQcvxdxv19pVbsP9EbvS0zB8Ph7 WrJgQ/ijR/fF3yuNXNZwzj8zCjM4FMQ4iA9qWMB0deL6Jw0O9eafbPxWNwPNgnpqCTXN yJsScI8iCmRv+QyNmMO3rPIvQzSsX/1l8LSaTxD84Jk/Y0blxwovA7CdfwL7Ab0x9aDq 0GJA== X-Gm-Message-State: AOAM532AGM4dgaaw0bsyoacA685Vo/2Cl5wiQm8nV255p1lYn1LszgIz ctDCcUBua2qJFXPKtdu3jut7GA== X-Google-Smtp-Source: ABdhPJzn4ygg7SPkaFeqCJM4x23NqTmcfN68SGDVwhFt0n2atB7O+FT3qRyI1pW2DRw34DHBEuU7Nw== X-Received: by 2002:a5d:65cd:: with SMTP id e13mr14714985wrw.334.1615561601007; Fri, 12 Mar 2021 07:06:41 -0800 (PST) Received: from elver.google.com ([2a00:79e0:15:13:d5de:d45f:f79c:cb62]) by smtp.gmail.com with ESMTPSA id d7sm7830010wrs.42.2021.03.12.07.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 07:06:40 -0800 (PST) Date: Fri, 12 Mar 2021 16:06:34 +0100 From: Marco Elver To: Andrey Konovalov Cc: Andrew Morton , Alexander Potapenko , Andrey Ryabinin , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 01/11] kasan: docs: clean up sections Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C328CE007A4F X-Stat-Signature: nzoybg1bo4zs5bwqqisx9nnqhy3hqtqh Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mail-wr1-f53.google.com; client-ip=209.85.221.53 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615561602-337419 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: On Fri, Mar 12, 2021 at 03:24PM +0100, Andrey Konovalov wrote: > Update KASAN documentation: > > - Give some sections clearer names. > - Remove unneeded subsections in the "Tests" section. > - Move the "For developers" section and split into subsections. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > > Changes v1->v2: > - Rename "By default" section to "Default behaviour". > --- > Documentation/dev-tools/kasan.rst | 54 +++++++++++++++---------------- > 1 file changed, 27 insertions(+), 27 deletions(-) > > diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst > index ddf4239a5890..b3b2c517db55 100644 > --- a/Documentation/dev-tools/kasan.rst > +++ b/Documentation/dev-tools/kasan.rst > @@ -168,24 +168,6 @@ particular KASAN features. > report or also panic the kernel (default: ``report``). Note, that tag > checking gets disabled after the first reported bug. > > -For developers > -~~~~~~~~~~~~~~ > - > -Software KASAN modes use compiler instrumentation to insert validity checks. > -Such instrumentation might be incompatible with some part of the kernel, and > -therefore needs to be disabled. To disable instrumentation for specific files > -or directories, add a line similar to the following to the respective kernel > -Makefile: > - > -- For a single file (e.g. main.o):: > - > - KASAN_SANITIZE_main.o := n > - > -- For all files in one directory:: > - > - KASAN_SANITIZE := n > - > - > Implementation details > ---------------------- > > @@ -299,8 +281,8 @@ support MTE (but supports TBI). > Hardware tag-based KASAN only reports the first found bug. After that MTE tag > checking gets disabled. > > -What memory accesses are sanitised by KASAN? > --------------------------------------------- > +Shadow memory > +------------- > > The kernel maps memory in a number of different parts of the address > space. This poses something of a problem for KASAN, which requires > @@ -311,8 +293,8 @@ The range of kernel virtual addresses is large: there is not enough > real memory to support a real shadow region for every address that > could be accessed by the kernel. > > -By default > -~~~~~~~~~~ > +Default behaviour > +~~~~~~~~~~~~~~~~~ > > By default, architectures only map real memory over the shadow region > for the linear mapping (and potentially other small areas). For all > @@ -362,8 +344,29 @@ unmapped. This will require changes in arch-specific code. > This allows ``VMAP_STACK`` support on x86, and can simplify support of > architectures that do not have a fixed module region. > > -CONFIG_KASAN_KUNIT_TEST and CONFIG_KASAN_MODULE_TEST > ----------------------------------------------------- > +For developers > +-------------- > + > +Ignoring accesses > +~~~~~~~~~~~~~~~~~ > + > +Software KASAN modes use compiler instrumentation to insert validity checks. > +Such instrumentation might be incompatible with some part of the kernel, and > +therefore needs to be disabled. To disable instrumentation for specific files > +or directories, add a line similar to the following to the respective kernel > +Makefile: > + > +- For a single file (e.g. main.o):: > + > + KASAN_SANITIZE_main.o := n > + > +- For all files in one directory:: > + > + KASAN_SANITIZE := n > + > + > +Tests > +~~~~~ > > KASAN tests consist of two parts: > > @@ -409,21 +412,18 @@ Or, if one of the tests failed:: > 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``. > > 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. > > 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 > -- > 2.31.0.rc2.261.g7f71774620-goog >