From: Andrew Morton <akpm@linux-foundation.org>
To: Maciej Wieczor-Retman <m.wieczorretman@pm.me>
Cc: urezki@gmail.com, elver@google.com, vincenzo.frascino@arm.com,
glider@google.com, dvyukov@google.com, ryabinin.a.a@gmail.com,
andreyknvl@gmail.com, kasan-dev@googlegroups.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
maciej.wieczor-retman@intel.com,
Jiayuan Chen <jiayuan.chen@linux.dev>
Subject: Re: [PATCH v2 0/2] kasan: vmalloc: Fix incorrect tag assignment with multiple vm_structs
Date: Tue, 2 Dec 2025 08:35:22 -0800 [thread overview]
Message-ID: <20251202083522.1b0349117b9159b891808532@linux-foundation.org> (raw)
In-Reply-To: <cover.1764685296.git.m.wieczorretman@pm.me>
On Tue, 02 Dec 2025 14:27:56 +0000 Maciej Wieczor-Retman <m.wieczorretman@pm.me> wrote:
> A KASAN tag mismatch, possibly resulting in a kernel panic, can be
> observed on systems with a tag-based KASAN enabled and with multiple
> NUMA nodes. Initially it was only noticed on x86 [1] but later a similar
> issue was also reported on arm64 [2].
>
> Specifically the problem is related to how vm_structs interact with
> pcpu_chunks - both when they are allocated, assigned and when pcpu_chunk
> addresses are derived.
>
> When vm_structs are allocated they are tagged if vmalloc support is
> enabled along the KASAN mode. Later when first pcpu chunk is allocated
> it gets its 'base_addr' field set to the first allocated vm_struct.
> With that it inherits that vm_struct's tag.
>
> When pcpu_chunk addresses are later derived (by pcpu_chunk_addr(), for
> example in pcpu_alloc_noprof()) the base_addr field is used and offsets
> are added to it. If the initial conditions are satisfied then some of
> the offsets will point into memory allocated with a different vm_struct.
> So while the lower bits will get accurately derived the tag bits in the
> top of the pointer won't match the shadow memory contents.
>
> The solution (proposed at v2 of the x86 KASAN series [3]) is to tag the
> vm_structs the same when allocating them for the per cpu allocator (in
> pcpu_get_vm_areas()).
>
> Originally these patches were part of the x86 KASAN series [4].
>
> The series is based on 6.18.
This series overlaps a lot with
https://lkml.kernel.org/r/20251128111516.244497-1-jiayuan.chen@linux.dev
Please discuss!
> [1] https://lore.kernel.org/all/e7e04692866d02e6d3b32bb43b998e5d17092ba4.1738686764.git.maciej.wieczor-retman@intel.com/
> [2] https://lore.kernel.org/all/aMUrW1Znp1GEj7St@MiWiFi-R3L-srv/
> [3] https://lore.kernel.org/all/CAPAsAGxDRv_uFeMYu9TwhBVWHCCtkSxoWY4xmFB_vowMbi8raw@mail.gmail.com/
> [4] https://lore.kernel.org/all/cover.1761763681.git.m.wieczorretman@pm.me/
>
next prev parent reply other threads:[~2025-12-02 16:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 14:27 Maciej Wieczor-Retman
2025-12-02 14:29 ` [PATCH v2 1/2] kasan: Refactor pcpu kasan vmalloc unpoison Maciej Wieczor-Retman
2025-12-03 15:53 ` Andrey Konovalov
2025-12-03 16:43 ` Maciej Wieczór-Retman
2025-12-02 14:29 ` [PATCH v2 2/2] kasan: Unpoison vms[area] addresses with a common tag Maciej Wieczor-Retman
2025-12-03 15:53 ` Andrey Konovalov
2025-12-03 16:24 ` Maciej Wieczór-Retman
2025-12-04 0:43 ` Andrey Konovalov
2025-12-04 8:00 ` Maciej Wieczór-Retman
2025-12-02 16:35 ` Andrew Morton [this message]
2025-12-02 17:13 ` [PATCH v2 0/2] kasan: vmalloc: Fix incorrect tag assignment with multiple vm_structs Maciej Wieczór-Retman
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=20251202083522.1b0349117b9159b891808532@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=jiayuan.chen@linux.dev \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.wieczorretman@pm.me \
--cc=maciej.wieczor-retman@intel.com \
--cc=ryabinin.a.a@gmail.com \
--cc=urezki@gmail.com \
--cc=vincenzo.frascino@arm.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