LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Marco Elver <elver@google.com>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Potapenko <glider@google.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 02/11] kasan: docs: update overview section
Date: Fri, 12 Mar 2021 11:17:54 +0100	[thread overview]
Message-ID: <CANpmjNP3bHe2h1=-W7r-64Vg9vr9vREzY0M97uh_QRDr3tVEYQ@mail.gmail.com> (raw)
In-Reply-To: <da296c4fe645f724922b691019e9e578e1834557.1615498565.git.andreyknvl@google.com>

On Thu, 11 Mar 2021 at 22:37, Andrey Konovalov <andreyknvl@google.com> 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 <andreyknvl@google.com>
> ---
>  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
>

  reply	other threads:[~2021-03-12 10:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 21:37 [PATCH 01/11] kasan: docs: clean up sections Andrey Konovalov
2021-03-11 21:37 ` [PATCH 02/11] kasan: docs: update overview section Andrey Konovalov
2021-03-12 10:17   ` Marco Elver [this message]
2021-03-12 13:51     ` Andrey Konovalov
2021-03-11 21:37 ` [PATCH 03/11] kasan: docs: update usage section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 04/11] kasan: docs: update error reports section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 05/11] kasan: docs: update boot parameters section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 06/11] kasan: docs: update GENERIC implementation details section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 07/11] kasan: docs: update SW_TAGS " Andrey Konovalov
2021-03-11 21:37 ` [PATCH 08/11] kasan: docs: update HW_TAGS " Andrey Konovalov
2021-03-11 21:37 ` [PATCH 09/11] kasan: docs: update shadow memory section Andrey Konovalov
2021-03-12 10:52   ` Marco Elver
2021-03-12 13:52     ` Andrey Konovalov
2021-03-11 21:37 ` [PATCH 10/11] kasan: docs: update ignoring accesses section Andrey Konovalov
2021-03-12 11:02   ` Marco Elver
2021-03-12 14:07     ` Andrey Konovalov
2021-03-11 21:37 ` [PATCH 11/11] kasan: docs: update tests section Andrey Konovalov
2021-03-12 10:47   ` Marco Elver
2021-03-12 13:53     ` Andrey Konovalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANpmjNP3bHe2h1=-W7r-64Vg9vr9vREzY0M97uh_QRDr3tVEYQ@mail.gmail.com' \
    --to=elver@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --subject='Re: [PATCH 02/11] kasan: docs: update overview section' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).