From: Andrew Morton <akpm@linux-foundation.org>
To: Dima Koziuk <dmytrokoziuk68@gmail.com>
Cc: glider@google.com, elver@google.com, dvyukov@google.com,
urezki@gmail.com, kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm: kmsan: fix iounmap metadata teardown
Date: Fri, 2 Oct 2026 14:12:23 -0700 [thread overview]
Message-ID: <20261002141223.1ab39d5cd2d65b02dce8ab85@linux-foundation.org> (raw)
In-Reply-To: <20261002200508.546-1-dmytrokoziuk68@gmail.com>
On Fri, 2 Oct 2026 23:05:07 +0300 Dima Koziuk <dmytrokoziuk68@gmail.com> wrote:
> kmsan_vmalloc_to_page_or_null() rejects addresses outside the regular
> vmalloc and module ranges, including the shadow and origin addresses
> passed by its callers. As a result, iounmap does not free the metadata
> backing pages. Also, the first iteration of the teardown loop
> unmaps the entire metadata range, preventing subsequent iterations from
> finding their pages even if the address lookup is fixed.
>
> Factor the page-table walk out of vmalloc_to_page() into
> __vmalloc_to_page(), keeping the address check in the public wrapper.
> Use the unchecked helper in kmsan_vmalloc_to_page_or_null() and check
> for NULL before converting the returned page to a PFN. Mark
> __vmalloc_to_page() as __always_inline to avoid an additional function
> call in vmalloc_to_page().
>
> Move metadata teardown into kmsan_iounmap_pages(). Free the backing
> blocks while their mappings are still available, then unmap each
> metadata range once and flush its TLB entries.
Thanks, I'll queue these for test and further review.
Could people please offer opinions on whether we should backport
one/both into -stable kernels?
prev parent reply other threads:[~2026-10-02 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 20:05 Dima Koziuk
2026-10-02 20:05 ` [PATCH v2 2/2] mm: kmsan: fix ioremap error cleanup Dima Koziuk
2026-10-02 21:12 ` Andrew Morton [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=20261002141223.1ab39d5cd2d65b02dce8ab85@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dmytrokoziuk68@gmail.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=urezki@gmail.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
all inboxes | Powered by JetHome®