From: Andrey Konovalov <andreyknvl@gmail.com>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>
Cc: corbet@lwn.net, morbo@google.com, rppt@kernel.org,
lorenzo.stoakes@oracle.com, ubizjak@gmail.com, mingo@redhat.com,
vincenzo.frascino@arm.com, maciej.wieczor-retman@intel.com,
maz@kernel.org, catalin.marinas@arm.com, yeoreum.yun@arm.com,
will@kernel.org, jackmanb@google.com, samuel.holland@sifive.com,
glider@google.com, osandov@fb.com, nsc@kernel.org,
luto@kernel.org, jpoimboe@kernel.org, akpm@linux-foundation.org,
Liam.Howlett@oracle.com, kees@kernel.org,
jan.kiszka@siemens.com, thomas.lendacky@amd.com,
jeremy.linton@arm.com, dvyukov@google.com,
axelrasmussen@google.com, leitao@debian.org,
ryabinin.a.a@gmail.com, bigeasy@linutronix.de,
peterz@infradead.org, mark.rutland@arm.com, urezki@gmail.com,
brgerst@gmail.com, hpa@zytor.com, mhocko@suse.com,
weixugc@google.com, kbingham@kernel.org, vbabka@suse.cz,
nathan@kernel.org, trintaeoitogc@gmail.com,
samitolvanen@google.com, tglx@kernel.org, thuth@redhat.com,
surenb@google.com, anshuman.khandual@arm.com,
smostafa@google.com, yuanchu@google.com,
ada.coupriediaz@arm.com, dave.hansen@linux.intel.com,
kas@kernel.org, nick.desaulniers+lkml@gmail.com,
david@kernel.org, bp@alien8.de, ardb@kernel.org,
justinstitt@google.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, kasan-dev@googlegroups.com,
llvm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org,
x86@kernel.org
Subject: Re: [PATCH v8 00/14] kasan: x86: arm64: KASAN tag-based mode for x86
Date: Tue, 13 Jan 2026 02:44:35 +0100 [thread overview]
Message-ID: <CA+fCnZf5NMa=_Aic_gVQ05rvAvYx0xUpbZ=hOg2=7A9=ZbPdFw@mail.gmail.com> (raw)
In-Reply-To: <cover.1768233085.git.m.wieczorretman@pm.me>
On Mon, Jan 12, 2026 at 6:26 PM Maciej Wieczor-Retman
<m.wieczorretman@pm.me> wrote:
>
> ======= Introduction
> The patchset aims to add a KASAN tag-based mode for the x86 architecture
> with the help of the new CPU feature called Linear Address Masking
> (LAM). Main improvement introduced by the series is 2x lower memory
> usage compared to KASAN's generic mode, the only currently available
> mode on x86. The tag based mode may also find errors that the generic
> mode couldn't because of differences in how these modes operate.
>
> ======= How does KASAN' tag-based mode work?
> When enabled, memory accesses and allocations are augmented by the
> compiler during kernel compilation. Instrumentation functions are added
> to each memory allocation and each pointer dereference.
>
> The allocation related functions generate a random tag and save it in
> two places: in shadow memory that maps to the allocated memory, and in
> the top bits of the pointer that points to the allocated memory. Storing
> the tag in the top of the pointer is possible because of Top-Byte Ignore
> (TBI) on arm64 architecture and LAM on x86.
>
> The access related functions are performing a comparison between the tag
> stored in the pointer and the one stored in shadow memory. If the tags
> don't match an out of bounds error must have occurred and so an error
> report is generated.
>
> The general idea for the tag-based mode is very well explained in the
> series with the original implementation [1].
>
> [1] https://lore.kernel.org/all/cover.1544099024.git.andreyknvl@google.com/
>
> ======= Differences summary compared to the arm64 tag-based mode
> - Tag width:
> - Tag width influences the chance of a tag mismatch due to two
> tags from different allocations having the same value. The
> bigger the possible range of tag values the lower the chance
> of that happening.
> - Shortening the tag width from 8 bits to 4, while it can help
> with memory usage, it also increases the chance of not
> reporting an error. 4 bit tags have a ~7% chance of a tag
> mismatch.
>
> - Address masking mechanism
> - TBI in arm64 allows for storing metadata in the top 8 bits of
> the virtual address.
> - LAM in x86 allows storing tags in bits [62:57] of the pointer.
> To maximize memory savings the tag width is reduced to bits
> [60:57].
>
> - Inline mode mismatch reporting
> - Arm64 inserts a BRK instruction to pass metadata about a tag
> mismatch to the KASAN report.
> - Right now on x86 the INT3 instruction is used for the same
> purpose. The attempt to move it over to use UD1 is already
> implemented and tested but relies on another series that needs
> merging first. Therefore this patch will be posted separately
> once the dependency is satisfied by being merged upstream.
>
Please also update the Software Tag-Based KASAN section in
Documentation/dev-tools/kasan.rst accordingly.
prev parent reply other threads:[~2026-01-13 1:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 17:26 Maciej Wieczor-Retman
2026-01-12 17:27 ` [PATCH v8 01/14] kasan: sw_tags: Use arithmetic shift for shadow computation Maciej Wieczor-Retman
2026-01-12 17:27 ` [PATCH v8 02/14] kasan: arm64: x86: Make special tags arch specific Maciej Wieczor-Retman
2026-01-13 1:21 ` Andrey Konovalov
2026-01-12 17:27 ` [PATCH v8 04/14] x86/kasan: Add arch specific kasan functions Maciej Wieczor-Retman
2026-01-13 1:21 ` Andrey Konovalov
2026-01-12 17:27 ` [PATCH v8 06/14] mm/execmem: Untag addresses in EXECMEM_ROX related pointer arithmetic Maciej Wieczor-Retman
2026-01-12 17:28 ` [PATCH v8 13/14] x86/kasan: Logical bit shift for kasan_mem_to_shadow Maciej Wieczor-Retman
2026-01-13 1:21 ` Andrey Konovalov
2026-01-12 18:29 ` [PATCH v8 00/14] kasan: x86: arm64: KASAN tag-based mode for x86 Andrew Morton
2026-01-12 20:08 ` Maciej Wieczór-Retman
2026-01-12 20:53 ` Andrew Morton
2026-01-13 1:47 ` Andrey Konovalov
2026-01-12 20:27 ` Dave Hansen
2026-01-13 1:44 ` Andrey Konovalov [this message]
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='CA+fCnZf5NMa=_Aic_gVQ05rvAvYx0xUpbZ=hOg2=7A9=ZbPdFw@mail.gmail.com' \
--to=andreyknvl@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=ada.coupriediaz@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=axelrasmussen@google.com \
--cc=bigeasy@linutronix.de \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hpa@zytor.com \
--cc=jackmanb@google.com \
--cc=jan.kiszka@siemens.com \
--cc=jeremy.linton@arm.com \
--cc=jpoimboe@kernel.org \
--cc=justinstitt@google.com \
--cc=kas@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=kbingham@kernel.org \
--cc=kees@kernel.org \
--cc=leitao@debian.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=lorenzo.stoakes@oracle.com \
--cc=luto@kernel.org \
--cc=m.wieczorretman@pm.me \
--cc=maciej.wieczor-retman@intel.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nsc@kernel.org \
--cc=osandov@fb.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=samitolvanen@google.com \
--cc=samuel.holland@sifive.com \
--cc=smostafa@google.com \
--cc=surenb@google.com \
--cc=tglx@kernel.org \
--cc=thomas.lendacky@amd.com \
--cc=thuth@redhat.com \
--cc=trintaeoitogc@gmail.com \
--cc=ubizjak@gmail.com \
--cc=urezki@gmail.com \
--cc=vbabka@suse.cz \
--cc=vincenzo.frascino@arm.com \
--cc=weixugc@google.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=yeoreum.yun@arm.com \
--cc=yuanchu@google.com \
/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