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=-23.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_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 63B56C433DB for ; Fri, 12 Mar 2021 10:18:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECD6364FEE for ; Fri, 12 Mar 2021 10:18:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECD6364FEE 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 552158D0344; Fri, 12 Mar 2021 05:18:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 528588D0317; Fri, 12 Mar 2021 05:18:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A1FB8D0344; Fri, 12 Mar 2021 05:18:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 1A62D8D0317 for ; Fri, 12 Mar 2021 05:18:09 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CD54352A0 for ; Fri, 12 Mar 2021 10:18:08 +0000 (UTC) X-FDA: 77910821856.12.26853C9 Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by imf30.hostedemail.com (Postfix) with ESMTP id 1D967E0011C4 for ; Fri, 12 Mar 2021 10:18:00 +0000 (UTC) Received: by mail-oi1-f170.google.com with SMTP id x135so21819084oia.9 for ; Fri, 12 Mar 2021 02:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P9nT1kdDzpw5kqt3CYTv0XonbOcWSwDlZvC3/pVxkrE=; b=Ou5hyZQabcpnNaGK3I/5gnreXdlUyiPyrYxc3dGlWeE4d6myY2/7AW654JABnTlaPK ylcLkbGCsys8JiOUZvxnU+puXAbnyjbNsxwwetVXWfgtj7vpG3J20T2xmLEXXwfUloDF hjWMPMyp91FEcLT9FV+mp+SRXXS2tYLchFgccHJ+ylJiieLQqkMIeVFe8XHu8sAQ1qBj Fb/H2s1zZuRwO/850qetDjCna9p0h+I+FYk1pcqUgKtWj0coLIUibu6X9l/Xs+zfU4dE Gz7hIRBbgxLRJgJmRMquKGlYfGW6gJ5nsDn+nhom/uvHk7U9ZhDNoo/9nDNtyWVzN2wO ithA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P9nT1kdDzpw5kqt3CYTv0XonbOcWSwDlZvC3/pVxkrE=; b=Zp5Qmf1IbPssAvMGXYqXg9XXwfymfspbpwO7d93dvobKhVKz/J11pNp2Z4sS8gOs8H S4RbA13cc02/G8vw8SJfL/LV1DmoGTnrsHHRx3CxlGvBP6gQL2RCVVENleNjcQqk6BtD STSsE4oXwry6N3jKUpjN2HcsZnwulHz1+FnWLndK8v9nG3JlZOCU4LxqUzL4RoVXcH+z ikzGYMizaoux66ONqcf9RKdWHdT3ChCHeLodJxPMqpV1WF++fYVmuAIeei0mQbsiIUy0 Dk/aBXJ3nphk/k55umsqDoucMmla5EbrEgqMVB3MyhsRts9Dvc66iabFBHGMg1zwKQbI sygg== X-Gm-Message-State: AOAM5333pvFiGKHIFmNis0Oc3GFTmP2w4wxKFqcFFFrM8yiZPNWCwpDq asA2XjHeOfH2692zhr6ucAtpGaVl0xPBG5cUxHjIDg== X-Google-Smtp-Source: ABdhPJzUmoUUMNbtNKdSb3Vv2aOKvF3v1305PFWx09SdvYCFak+6E0UnjjdlWbYnB2o9kyQ1lrZSaCi4QP6eEhKpouw= X-Received: by 2002:aca:530c:: with SMTP id h12mr9374370oib.172.1615544286829; Fri, 12 Mar 2021 02:18:06 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Marco Elver Date: Fri, 12 Mar 2021 11:17:54 +0100 Message-ID: Subject: Re: [PATCH 02/11] kasan: docs: update overview section To: Andrey Konovalov Cc: Andrew Morton , Alexander Potapenko , Andrey Ryabinin , Dmitry Vyukov , kasan-dev , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1D967E0011C4 X-Stat-Signature: s1eapt3hbj7z3f4kx747wog194e1jife Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mail-oi1-f170.google.com; client-ip=209.85.167.170 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615544280-242532 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 Thu, 11 Mar 2021 at 22:37, 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 > --- > 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 c9484f34da2a..343a683d0520 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 Clang 11+. Doesn't HW_TAGS mode work with GCC as well? While the sentence doesn't say "exclusively", the mention of Clang 11+ makes me think it's only Clang. > +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 >