Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1324495pxf; Fri, 12 Mar 2021 07:10:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWIk6oad18o6QAFtd/Hy/tUIgEPP94iEPV4Eq09Hq7TRPDMrB1oW1YinqJdimWTM26nP3/ X-Received: by 2002:a17:906:7e12:: with SMTP id e18mr9385554ejr.316.1615561854770; Fri, 12 Mar 2021 07:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615561854; cv=none; d=google.com; s=arc-20160816; b=x+PnAOBBHy0BqGtpNNC0ODyl3HAbDzGcOphxolK7a9ufBEVZN+2B+RhnDsto/bN4UM duDA88Y42XLzoz+IlMqAlzc2DUVha+TmKniDdPZPgP/++mIcyLoPE2GqoR/j1qETGJju AgLs0bGrLn6DXO/Z3613XQcyKQ70Kr7b8mH8b9JjEy/Tr+sEMVzDkVYmvZDrz6Im16lj F4MjXM0Ay+db8OFcAMvb8kej1wpsduVXiy0ZrYgxqNQcicewebnCZt4Xv7m/Sf9lNnWS WjG6/4NR9dV8AljeEgcf9sCUKisPFfPz0NvHX3gHDR2nbqEsy21J7Nhqe23N3858zuOX /xSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qBFp/gtR/nkmpiy/tuP54xC4mkMnllk9WWHQ5y9bp+8=; b=B0iGziKY+V2qDtIzKHrof7hJOZ+EqylLKxxgzHXA/EuqbMrr8nEIZA3rssXcWW8XLS S1iVDex02paBmtxI1sHAd3fZ105X6u/uvC6RhnyfF+5y7yyZunc+PGrPslEb54/PBBXz XM3r1iH+wT3+F4FlQxNsC8Zcu3J4ZnGFyqjUO0nlBnVReFxudP8N+Di6ox0VVfXDP2Qp TC4PZWnQ15e+tgmOaSkSCBhvbSKZs1+wadcZqbvnoEZrypVV5jSTKhWc7j72UffSk7jt 6D6khvguxFGjcwuiS2pwPH6n5NwODQanrYdIEgVsIy90aSLGIGd7OTtiw9juINkPVpdw Q6LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=l0terJNx; 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 w11si4164251ejc.1.2021.03.12.07.10.23; Fri, 12 Mar 2021 07:10:54 -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=l0terJNx; 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 S229959AbhCLPHQ (ORCPT + 99 others); Fri, 12 Mar 2021 10:07:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbhCLPGp (ORCPT ); Fri, 12 Mar 2021 10:06:45 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E7A3C061574 for ; Fri, 12 Mar 2021 07:06:44 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id e10so4982252wro.12 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=ulsFv7jJsxjWItCy3I/r664oy8GK8+XuxcmjaJm7RrV5ChGKlgVxMXBYvDkwAWQRdw zWUHKIHNy9YD1JPYoS7GzPLTmi90gJUjm5aLrKoJi+aeF2Gpw6hMKhUwZYXijJIz+wzw UovQ8M4axwntSSu3bT1Wp6FwrzeGZpftlmLGgmxuNEgCBJ+0+pGtUzMHi4OT3T2xzdJm C2WI3jvY+x/FvxZTyU7zBcoH+osqFRz6XRLPhr+TnRyVhSbmYfnPKr6BEFaNObTej06d RY9j3vi8unikqEbjc4f3cbYVCPYHyO9akCvpOyjlP9nmOUSYPpHm8W6lOla/y615yu0F eV/w== X-Gm-Message-State: AOAM533/yzBFMcEXojA6zSr8TpPfJuF2kzwl2Gi+Oea+fZOnWBXwdJBb jCC0tckNyvMPn9TiVVVWii1e9CF4+me+xQ== 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >