Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Elkin Cruz <elkin@google.com>, Andrew Morton <akpm@linux-foundation.org>
Cc: Zi Yan <ziy@nvidia.com>, Matthew Brost <matthew.brost@intel.com>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	Byungchul Park <byungchul@sk.com>,
	Gregory Price <gourry@gourry.net>,
	Ying Huang <ying.huang@linux.alibaba.com>,
	Alistair Popple <apopple@nvidia.com>,
	linux-mm@kvack.org, Lorenzo Stoakes <ljs@kernel.org>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	irogers@google.com, stable@vger.kernel.org
Subject: Re: [PATCH] mm/migrate_device: use locked folio in migrate_device_{range,pfns}()
Date: Wed, 25 Nov 2026 23:41:56 +0100	[thread overview]
Message-ID: <16ad231f-0cba-40a0-992a-a0d430da5a91@kernel.org> (raw)
In-Reply-To: <20261125222713.1450385-1-elkin@google.com>

On 11/25/26 23:27, Elkin Cruz wrote:
> migrate_device_range() and migrate_device_pfns() read a speculative
> folio pointer via page_folio() prior to taking a reference or lock in
> migrate_device_pfn_lock(). If the page splits or changes compound state
> before lock acquisition, folio_nr_pages(folio) inspects stale state and
> the nr > npages - i error path calls unpin_anon_rmap(), folio_unlock(),
> and folio_put() on the unowned speculative pointer while leaking the
> reference and lock on the folio actually locked by
> migrate_device_pfn_lock().
> 
> Return the referenced, locked folio directly from
> migrate_device_pfn_lock() and skip unlocked entries cleanly.
> 
> Fixes: dc41e961a269 ("mm/migrate_device: avoid out-of-bounds writes for compound folios")
> Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages")
> Cc: stable@vger.kernel.org
> Signed-off-by: Elkin Cruz <elkin@google.com>
> ---
> 
> I am trying out new Clang static analysis checks for kernel bug
> classes, and they flagged this code as possibly buggy. The findings
> were triaged/fixed and commit descriptions were drafted with help of AI,
> then checked against linux-next (not runtime-tested on hardware).

Before you send any more: if you cannot reproduce it in the tree, don't report it.

So can this here be reproduced?

We're very interested in real bugs, but not in theoretical ones.

-- 
Cheers,

David

  reply	other threads:[~2026-11-25 22:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 22:27 [PATCH] mm/migrate_device: use locked folio in migrate_device_{range,pfns}() Elkin Cruz
2026-11-25 22:41 ` David Hildenbrand (Arm) [this message]
2026-11-25 22:58   ` Elkin Cruz
2026-11-26 11:31     ` David Hildenbrand (Arm)

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=16ad231f-0cba-40a0-992a-a0d430da5a91@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=byungchul@sk.com \
    --cc=elkin@google.com \
    --cc=gourry@gourry.net \
    --cc=irogers@google.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=matthew.brost@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.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