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 EC7C0C433DB for ; Fri, 12 Mar 2021 15:07:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7787564FDD for ; Fri, 12 Mar 2021 15:07:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7787564FDD 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 F1AC86B006E; Fri, 12 Mar 2021 10:07:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ECA656B0070; Fri, 12 Mar 2021 10:07:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D442B6B0071; Fri, 12 Mar 2021 10:07:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id BA6916B006E for ; Fri, 12 Mar 2021 10:07:35 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7B5352C98 for ; Fri, 12 Mar 2021 15:07:35 +0000 (UTC) X-FDA: 77911551270.06.D00237A Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf07.hostedemail.com (Postfix) with ESMTP id 08E79A0009E9 for ; Fri, 12 Mar 2021 15:07:32 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id t5-20020a1c77050000b029010e62cea9deso15366786wmi.0 for ; Fri, 12 Mar 2021 07:07:32 -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=NxCzouo00jLfy5JFbVee5vzdNlkY0nXEKiHSuDiLt14=; b=OK9FMmpHJViO21TkMjEO0tHh1gvZmPxHyxNM6n5EZKAskK55zEy+TGVcPm2Ki4TupI /zVvm0g5OM4ZAzzr283CcoTOEGE5XSc4FEERoD2/YNHFquaUujiJcyXWfuZyd3AiE7is X91u2jLsKj0pIuNCX9PbK4fiIL701w+tzEKFCTa4EKZWuHxAnwPPsw7g3zOkRgCCEF/D 2U48LxKDfIaf7STy+hfy/fe1IBchljs3Fk8vK320YjInqidBU622pW4UZzdMv9gt2pgJ Th0eyvCku/uP+hxx3ecKpAbR3kLDQw7yoKOlsQR8EsZNCtnZ8l0r34NYVYKgv9wcA37p vu7g== 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=NxCzouo00jLfy5JFbVee5vzdNlkY0nXEKiHSuDiLt14=; b=ffFhWE7k3ZLiZGAkD7JsBjj3ZaJkLiJjfJ8jEyOqw6g+K0bJFlQPeoqp3hbcWmJHIM sGyD9zxSRCO1Bq/LUSHBJ+HKaZrWupbASMiAv7YTczv9zCipEa2JNZcuR2ETxx4ImlMt 1Zpt9Q27vMrdNajNkqGpYAm3y2I0E5D3Xjf5bo2TOnLP+i96YFmWO5iOE5f3OjI5iY5p lYusD8Z0qJ0Q1DbkHTqeaUfsSGBWiVCHvxVyPYBqdkxfZQhzjlqrkKVnRZWSo2SUJzOX LsfRfvvjBNa8YPGBQvmV8uNbry3rHdJuuFUGZqFXQLjS94eVPgdAkjcVvulbn9Salr1A 3TKw== X-Gm-Message-State: AOAM5334dhxypFWoj6s2MfXO5K/0JRpiAmo93nEM1Tek3iXGPal3leAa JHly4vbXGtYcuIvrkPNDI+IiJA== X-Google-Smtp-Source: ABdhPJwnv1fjgqt6bQERsyk0doi/6CJMOjcR7KExV1Ht4QxZNUfCHWk5FcFIMJQ8s5t8eJ5SzM7Uew== X-Received: by 2002:a1c:6605:: with SMTP id a5mr13891700wmc.85.1615561651710; Fri, 12 Mar 2021 07:07:31 -0800 (PST) Received: from elver.google.com ([2a00:79e0:15:13:d5de:d45f:f79c:cb62]) by smtp.gmail.com with ESMTPSA id b131sm2441214wmb.34.2021.03.12.07.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 07:07:31 -0800 (PST) Date: Fri, 12 Mar 2021 16:07:25 +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 02/11] kasan: docs: update overview section Message-ID: References: <1486fba8514de3d7db2f47df2192db59228b0a7b.1615559068.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1486fba8514de3d7db2f47df2192db59228b0a7b.1615559068.git.andreyknvl@google.com> User-Agent: Mutt/2.0.5 (2021-01-21) X-Stat-Signature: abo7iep664uzzah4te1ahyo61hchd5yh X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 08E79A0009E9 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mail-wm1-f44.google.com; client-ip=209.85.128.44 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615561652-616004 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 the "Overview" section in KASAN documentation: > > - Outline main use cases for each mode. > - Mention that HW_TAGS mode need compiler support too. > - Move the part about SLUB/SLAB support from "Usage" to "Overview". > - Punctuation, readability, and other minor clean-ups. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver > --- > > Changes v1->v2: > - Mention GCC support for HW_TAGS. > --- > Documentation/dev-tools/kasan.rst | 27 +++++++++++++++++++-------- > 1 file changed, 19 insertions(+), 8 deletions(-) > > diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst > index b3b2c517db55..2f2697b290d5 100644 > --- a/Documentation/dev-tools/kasan.rst > +++ b/Documentation/dev-tools/kasan.rst > @@ -11,17 +11,31 @@ designed to find out-of-bound and use-after-free bugs. KASAN has three modes: > 2. software tag-based KASAN (similar to userspace HWASan), > 3. hardware tag-based KASAN (based on hardware memory tagging). > > -Software KASAN modes (1 and 2) use compile-time instrumentation to insert > -validity checks before every memory access, and therefore require a compiler > +Generic KASAN is mainly used for debugging due to a large memory overhead. > +Software tag-based KASAN can be used for dogfood testing as it has a lower > +memory overhead that allows using it with real workloads. Hardware tag-based > +KASAN comes with low memory and performance overheads and, therefore, can be > +used in production. Either as an in-field memory bug detector or as a security > +mitigation. > + > +Software KASAN modes (#1 and #2) use compile-time instrumentation to insert > +validity checks before every memory access and, therefore, require a compiler > version that supports that. > > -Generic KASAN is supported in both GCC and Clang. With GCC it requires version > +Generic KASAN is supported in GCC and Clang. With GCC, it requires version > 8.3.0 or later. Any supported Clang version is compatible, but detection of > out-of-bounds accesses for global variables is only supported since Clang 11. > > -Tag-based KASAN is only supported in Clang. > +Software tag-based KASAN mode is only supported in Clang. > > -Currently generic KASAN is supported for the x86_64, arm, arm64, xtensa, s390 > +The hardware KASAN mode (#3) relies on hardware to perform the checks but > +still requires a compiler version that supports memory tagging instructions. > +This mode is supported in GCC 10+ and Clang 11+. > + > +Both software KASAN modes work with SLUB and SLAB memory allocators, > +while the hardware tag-based KASAN currently only supports SLUB. > + > +Currently, generic KASAN is supported for the x86_64, arm, arm64, xtensa, s390, > and riscv architectures, and tag-based KASAN modes are supported only for arm64. > > Usage > @@ -39,9 +53,6 @@ For software modes, you also need to choose between CONFIG_KASAN_OUTLINE and > CONFIG_KASAN_INLINE. Outline and inline are compiler instrumentation types. > The former produces smaller binary while the latter is 1.1 - 2 times faster. > > -Both software KASAN modes work with both SLUB and SLAB memory allocators, > -while the hardware tag-based KASAN currently only support SLUB. > - > For better error reports that include stack traces, enable CONFIG_STACKTRACE. > > To augment reports with last allocation and freeing stack of the physical page, > -- > 2.31.0.rc2.261.g7f71774620-goog >