2021-01-05 18:31:07

by Andrey Konovalov

[permalink] [raw]
Subject: [PATCH 02/11] kasan: clarify HW_TAGS impact on TBI

Mention in the documentation that enabling CONFIG_KASAN_HW_TAGS
always results in in-kernel TBI (Top Byte Ignore) being enabled.

Also do a few minor documentation cleanups.

Signed-off-by: Andrey Konovalov <[email protected]>
Link: https://linux-review.googlesource.com/id/Iba2a6697e3c6304cb53f89ec61dedc77fa29e3ae
---
Documentation/dev-tools/kasan.rst | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
index 0fc3fb1860c4..26c99852a852 100644
--- a/Documentation/dev-tools/kasan.rst
+++ b/Documentation/dev-tools/kasan.rst
@@ -147,15 +147,14 @@ negative values to distinguish between different kinds of inaccessible memory
like redzones or freed memory (see mm/kasan/kasan.h).

In the report above the arrows point to the shadow byte 03, which means that
-the accessed address is partially accessible.
-
-For tag-based KASAN this last report section shows the memory tags around the
-accessed address (see `Implementation details`_ section).
+the accessed address is partially accessible. For tag-based KASAN modes this
+last report section shows the memory tags around the accessed address
+(see the `Implementation details`_ section).

Boot parameters
~~~~~~~~~~~~~~~

-Hardware tag-based KASAN mode (see the section about different mode below) is
+Hardware tag-based KASAN mode (see the section about various modes below) is
intended for use in production as a security mitigation. Therefore it supports
boot parameters that allow to disable KASAN competely or otherwise control
particular KASAN features.
@@ -305,6 +304,13 @@ reserved to tag freed memory regions.
Hardware tag-based KASAN currently only supports tagging of
kmem_cache_alloc/kmalloc and page_alloc memory.

+If the hardware doesn't support MTE (pre ARMv8.5), hardware tag-based KASAN
+won't be enabled. In this case all boot parameters are ignored.
+
+Note, that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI being
+enabled. Even when kasan.mode=off is provided, or when the hardware doesn't
+support MTE (but supports TBI).
+
What memory accesses are sanitised by KASAN?
--------------------------------------------

--
2.29.2.729.g45daf8777d-goog


2021-01-12 11:39:49

by Alexander Potapenko

[permalink] [raw]
Subject: Re: [PATCH 02/11] kasan: clarify HW_TAGS impact on TBI

On Tue, Jan 5, 2021 at 7:28 PM Andrey Konovalov <[email protected]> wrote:
>
> Mention in the documentation that enabling CONFIG_KASAN_HW_TAGS
> always results in in-kernel TBI (Top Byte Ignore) being enabled.
>
> Also do a few minor documentation cleanups.
>
> Signed-off-by: Andrey Konovalov <[email protected]>
> Link: https://linux-review.googlesource.com/id/Iba2a6697e3c6304cb53f89ec61dedc77fa29e3ae
Reviewed-by: Alexander Potapenko <[email protected]>

> ---
> Documentation/dev-tools/kasan.rst | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
> index 0fc3fb1860c4..26c99852a852 100644
> --- a/Documentation/dev-tools/kasan.rst
> +++ b/Documentation/dev-tools/kasan.rst
> @@ -147,15 +147,14 @@ negative values to distinguish between different kinds of inaccessible memory
> like redzones or freed memory (see mm/kasan/kasan.h).
>
> In the report above the arrows point to the shadow byte 03, which means that
> -the accessed address is partially accessible.
> -
> -For tag-based KASAN this last report section shows the memory tags around the
> -accessed address (see `Implementation details`_ section).
> +the accessed address is partially accessible. For tag-based KASAN modes this
> +last report section shows the memory tags around the accessed address
> +(see the `Implementation details`_ section).
>
> Boot parameters
> ~~~~~~~~~~~~~~~
>
> -Hardware tag-based KASAN mode (see the section about different mode below) is
> +Hardware tag-based KASAN mode (see the section about various modes below) is
> intended for use in production as a security mitigation. Therefore it supports
> boot parameters that allow to disable KASAN competely or otherwise control
> particular KASAN features.
> @@ -305,6 +304,13 @@ reserved to tag freed memory regions.
> Hardware tag-based KASAN currently only supports tagging of
> kmem_cache_alloc/kmalloc and page_alloc memory.
>
> +If the hardware doesn't support MTE (pre ARMv8.5), hardware tag-based KASAN
> +won't be enabled. In this case all boot parameters are ignored.
> +
> +Note, that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI being
> +enabled. Even when kasan.mode=off is provided, or when the hardware doesn't
> +support MTE (but supports TBI).
> +
> What memory accesses are sanitised by KASAN?
> --------------------------------------------
>
> --
> 2.29.2.729.g45daf8777d-goog
>


--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

2021-01-12 13:04:19

by Marco Elver

[permalink] [raw]
Subject: Re: [PATCH 02/11] kasan: clarify HW_TAGS impact on TBI

On Tue, Jan 05, 2021 at 07:27PM +0100, Andrey Konovalov wrote:
> Mention in the documentation that enabling CONFIG_KASAN_HW_TAGS
> always results in in-kernel TBI (Top Byte Ignore) being enabled.
>
> Also do a few minor documentation cleanups.
>
> Signed-off-by: Andrey Konovalov <[email protected]>
> Link: https://linux-review.googlesource.com/id/Iba2a6697e3c6304cb53f89ec61dedc77fa29e3ae

Reviewed-by: Marco Elver <[email protected]>

> ---
> Documentation/dev-tools/kasan.rst | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
> index 0fc3fb1860c4..26c99852a852 100644
> --- a/Documentation/dev-tools/kasan.rst
> +++ b/Documentation/dev-tools/kasan.rst
> @@ -147,15 +147,14 @@ negative values to distinguish between different kinds of inaccessible memory
> like redzones or freed memory (see mm/kasan/kasan.h).
>
> In the report above the arrows point to the shadow byte 03, which means that
> -the accessed address is partially accessible.
> -
> -For tag-based KASAN this last report section shows the memory tags around the
> -accessed address (see `Implementation details`_ section).
> +the accessed address is partially accessible. For tag-based KASAN modes this
> +last report section shows the memory tags around the accessed address
> +(see the `Implementation details`_ section).
>
> Boot parameters
> ~~~~~~~~~~~~~~~
>
> -Hardware tag-based KASAN mode (see the section about different mode below) is
> +Hardware tag-based KASAN mode (see the section about various modes below) is
> intended for use in production as a security mitigation. Therefore it supports
> boot parameters that allow to disable KASAN competely or otherwise control
> particular KASAN features.
> @@ -305,6 +304,13 @@ reserved to tag freed memory regions.
> Hardware tag-based KASAN currently only supports tagging of
> kmem_cache_alloc/kmalloc and page_alloc memory.
>
> +If the hardware doesn't support MTE (pre ARMv8.5), hardware tag-based KASAN
> +won't be enabled. In this case all boot parameters are ignored.
> +
> +Note, that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI being
> +enabled. Even when kasan.mode=off is provided, or when the hardware doesn't
> +support MTE (but supports TBI).
> +
> What memory accesses are sanitised by KASAN?
> --------------------------------------------
>
> --
> 2.29.2.729.g45daf8777d-goog
>