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@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 07/11] kasan: docs: update SW_TAGS implementation details section
Date: Fri, 12 Mar 2021 16:09:15 +0100 [thread overview]
Message-ID: <YEuEG+K4/V4zn9l4@elver.google.com> (raw)
In-Reply-To: <69b9b2e49d8cf789358fa24558be3fc0ce4ee32c.1615559068.git.andreyknvl@google.com>
On Fri, Mar 12, 2021 at 03:24PM +0100, Andrey Konovalov wrote:
> Update the "Implementation details" section for SW_TAGS KASAN:
>
> - Clarify the introduction sentence.
> - Punctuation, readability, and other minor clean-ups.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
> ---
> Documentation/dev-tools/kasan.rst | 39 +++++++++++++++----------------
> 1 file changed, 19 insertions(+), 20 deletions(-)
>
> diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
> index 986410bf269f..5873d80cc1fd 100644
> --- a/Documentation/dev-tools/kasan.rst
> +++ b/Documentation/dev-tools/kasan.rst
> @@ -235,38 +235,37 @@ quarantine (see mm/kasan/quarantine.c for implementation).
> Software tag-based KASAN
> ~~~~~~~~~~~~~~~~~~~~~~~~
>
> -Software tag-based KASAN requires software memory tagging support in the form
> -of HWASan-like compiler instrumentation (see HWASan documentation for details).
> -
> -Software tag-based KASAN is currently only implemented for arm64 architecture.
> +Software tag-based KASAN uses a software memory tagging approach to checking
> +access validity. It is currently only implemented for the arm64 architecture.
>
> Software tag-based KASAN uses the Top Byte Ignore (TBI) feature of arm64 CPUs
> -to store a pointer tag in the top byte of kernel pointers. Like generic KASAN
> -it uses shadow memory to store memory tags associated with each 16-byte memory
> -cell (therefore it dedicates 1/16th of the kernel memory for shadow memory).
> +to store a pointer tag in the top byte of kernel pointers. It uses shadow memory
> +to store memory tags associated with each 16-byte memory cell (therefore, it
> +dedicates 1/16th of the kernel memory for shadow memory).
>
> -On each memory allocation software tag-based KASAN generates a random tag, tags
> -the allocated memory with this tag, and embeds this tag into the returned
> +On each memory allocation, software tag-based KASAN generates a random tag, tags
> +the allocated memory with this tag, and embeds the same tag into the returned
> pointer.
>
> Software tag-based KASAN uses compile-time instrumentation to insert checks
> -before each memory access. These checks make sure that tag of the memory that
> -is being accessed is equal to tag of the pointer that is used to access this
> -memory. In case of a tag mismatch software tag-based KASAN prints a bug report.
> +before each memory access. These checks make sure that the tag of the memory
> +that is being accessed is equal to the tag of the pointer that is used to access
> +this memory. In case of a tag mismatch, software tag-based KASAN prints a bug
> +report.
>
> -Software tag-based KASAN also has two instrumentation modes (outline, that
> -emits callbacks to check memory accesses; and inline, that performs the shadow
> +Software tag-based KASAN also has two instrumentation modes (outline, which
> +emits callbacks to check memory accesses; and inline, which performs the shadow
> memory checks inline). With outline instrumentation mode, a bug report is
> -simply printed from the function that performs the access check. With inline
> -instrumentation a brk instruction is emitted by the compiler, and a dedicated
> -brk handler is used to print bug reports.
> +printed from the function that performs the access check. With inline
> +instrumentation, a ``brk`` instruction is emitted by the compiler, and a
> +dedicated ``brk`` handler is used to print bug reports.
>
> Software tag-based KASAN uses 0xFF as a match-all pointer tag (accesses through
> -pointers with 0xFF pointer tag aren't checked). The value 0xFE is currently
> +pointers with the 0xFF pointer tag are not checked). The value 0xFE is currently
> reserved to tag freed memory regions.
>
> -Software tag-based KASAN currently only supports tagging of
> -kmem_cache_alloc/kmalloc and page_alloc memory.
> +Software tag-based KASAN currently only supports tagging of slab and page_alloc
> +memory.
>
> Hardware tag-based KASAN
> ~~~~~~~~~~~~~~~~~~~~~~~~
> --
> 2.31.0.rc2.261.g7f71774620-goog
>
next prev parent reply other threads:[~2021-03-12 15:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 14:24 [PATCH v2 01/11] kasan: docs: clean up sections Andrey Konovalov
2021-03-12 14:24 ` [PATCH v2 02/11] kasan: docs: update overview section Andrey Konovalov
2021-03-12 15:07 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 03/11] kasan: docs: update usage section Andrey Konovalov
2021-03-12 15:07 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 04/11] kasan: docs: update error reports section Andrey Konovalov
2021-03-12 15:08 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 05/11] kasan: docs: update boot parameters section Andrey Konovalov
2021-03-12 15:08 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 06/11] kasan: docs: update GENERIC implementation details section Andrey Konovalov
2021-03-12 15:08 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 07/11] kasan: docs: update SW_TAGS " Andrey Konovalov
2021-03-12 15:09 ` Marco Elver [this message]
2021-03-12 14:24 ` [PATCH v2 08/11] kasan: docs: update HW_TAGS " Andrey Konovalov
2021-03-12 15:09 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 09/11] kasan: docs: update shadow memory section Andrey Konovalov
2021-03-12 15:09 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 10/11] kasan: docs: update ignoring accesses section Andrey Konovalov
2021-03-12 15:10 ` Marco Elver
2021-03-12 14:24 ` [PATCH v2 11/11] kasan: docs: update tests section Andrey Konovalov
2021-03-12 15:11 ` Marco Elver
2021-03-12 15:06 ` [PATCH v2 01/11] kasan: docs: clean up sections Marco Elver
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=YEuEG+K4/V4zn9l4@elver.google.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 \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox