Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1119365pxf; Fri, 12 Mar 2021 02:20:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3tOZNZrOXLdSyFP/er5IaLvIpVISLj1simTVj4bEyVunLHtFAp/Die/SUwIpLiVrbWop5 X-Received: by 2002:a17:906:3444:: with SMTP id d4mr7736401ejb.410.1615544421544; Fri, 12 Mar 2021 02:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615544421; cv=none; d=google.com; s=arc-20160816; b=QQ4xf6ktP3OE1st5kBQHdERxO9UZCCryp1eHxox0nQuBHaw8t0VmYvzuf1Qfw4Ar7T usmZ0OFsi9Rr1gIVDBOnmfKgHZc/jqZHUe3ejHcfq5ax4yaVTxr6TjKt7ytDKnrw4bz4 4TjLzkENm8jEfp2OY3Bg4RSoN6kaZeTgnmkvHe38JBt8+JFiVv0qSVK7+JwknWc6oxcU 0R/pjFjrucmr9XXv0dXWEhiQqusdRq7ozlmpBVEHUUfGmXsCRibgfiuMFr5Pc78ngt2B w8kEYCe2/7tIk3pyIvgDsq58SV+cF1Zp2OOVKTOW8ix+ejQE//FsMNQFC9JMEqommnaa 2y1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=P9nT1kdDzpw5kqt3CYTv0XonbOcWSwDlZvC3/pVxkrE=; b=yWPmMFiCLa5Ez45wzCNWaT9dCQAXGRLyBDprsruBlWILFsJyKzgepA3ivTg+nGdM51 VKEmfApdz6SFKc+46RoH6l0HD1w8W9pXuYQjKHdYbytrns6jYHcNbUiyeDFVv/uGKn02 WUJjO+cFROC+DbAxq6oAPT3FlD0jMemoRwNoTDp/UliYaEjaHJU5TE4NT1hQgOGdp8US TA+JocBVXdqpUPzqvTAo1Xw1eqfYG+lyCqr0Xfpj+oOfp0KG65RaQK8DEFNfhDWykzLY 1VJIUHimIKFdzaDLuAoiMjmkTUOX3DnFXt/X9GWxP46b8XC/GZtGUCNylw1mzmk09TLp JviA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ou5hyZQa; 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 r11si3493625ejy.571.2021.03.12.02.19.59; Fri, 12 Mar 2021 02:20:21 -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=Ou5hyZQa; 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 S233171AbhCLKS0 (ORCPT + 99 others); Fri, 12 Mar 2021 05:18:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233120AbhCLKSI (ORCPT ); Fri, 12 Mar 2021 05:18:08 -0500 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4271CC061574 for ; Fri, 12 Mar 2021 02:18:08 -0800 (PST) Received: by mail-oi1-x22b.google.com with SMTP id x78so26344057oix.1 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=mLt6Eo6uEg8Eq1pkMl9OBXX6LBq0RsQ7Ef8LXGTic++yON0Dab1vhJiTQbiyWy7Ks6 GC8GX/hJ3iFNcyfyl64RLMVDrKBHHZJFYgyn5CEDbEYHNvE6RBATeWqu6szTAubF+2dx gPhXl9zcxP3FACaetH132fMlzS+rHYT9Fool+iZS1yohFqDvc9ZMv72ak9AeZwMETYcm j/sXqT7Q/rXTO6cFpigxydkBN2WlqXqGKWcrwWb7OfwjDrwI40Jx5831zNb1s7RcLddp NNhMkFH8ZjhdWfKPb72a+VWXXEVOD9MzdC2IFdqMO7mB0ycuDUrWfrdI69GU9TwQ3OSE 6TjA== X-Gm-Message-State: AOAM530/u1hZIk5B01eTPj/YqlRtn9ahGSjDxcKfTKDJPPyCaPN8eiI0 8k8g4VlIUXuLj+nQPpocJMU0eTegRcNRFQq/hD0eZQ== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >