Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "JongHyuk Kim(MalHyuk)" <malhyuk97@gmail.com>
To: stable@vger.kernel.org
Cc: JongHyuk Kim <malhyuk97@gmail.com>,
	Hyunwoo Kim <imv4bel@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	David Hildenbrand <david@kernel.org>,
	linux-mm@kvack.org
Subject: Please backport aedf2efd1897 ("mm/pagewalk: fix stale walk->action escaping walk_pmd_range()") to 6.12.y
Date: Sun, 25 Oct 2026 14:45:05 +0900	[thread overview]
Message-ID: <20261025054505.1448278-1-malhyuk97@gmail.com> (raw)

Please consider aedf2efd1897 ("mm/pagewalk: fix stale walk->action escaping
walk_pmd_range()") for 6.12.y.

It fixes 3b89863c3fa4 ("mm/pagewalk: fix race between concurrent split and
refault"), which is in 6.12.y, but the fix has no Cc: stable so it was never
picked up. 6.12.112 and 6.12.113 still have the pre-fix layout: in
walk_pmd_range() the "walk->action = ACTION_SUBTREE" assignment sits below
the pmd_none() block, so the continue in that block skips it and a stale
ACTION_AGAIN survives into walk_pud_range(), which then re-walks the whole
PUD with walk->private never reset. Same thing in walk_pud_range().

I hit it on the stock 6.12.112 KASAN build:

  BUG: KASAN: use-after-free in __mincore_unmapped_range+0x1ca/0x240
  Write of size 1 at addr ffff888105ae2000 by task exp_root/191
  CPU: 0 UID: 1000 PID: 191 Comm: exp_root Not tainted 6.12.112-dirty #1
   __mincore_unmapped_range+0x1ca/0x240
   mincore_unmapped_range+0x5d/0xd0
   walk_pgd_range+0x8b0/0x1b10
   __walk_page_range+0x418/0x600
   walk_page_range+0x2b1/0x620
   do_mincore+0x1a1/0x350
   __x64_sys_mincore+0x1aa/0x390

The -dirty suffix comes from the kernelCTF build, the tree itself is
unmodified 6.12.112.

Reproducer shape, everything unprivileged (uid 1000): map a memfd so that a
mincore() range of 4096 pages straddles a 1G boundary with exactly one PMD
past the boundary, have a second process call MADV_COLLAPSE on that PMD so
collapse_file() -> retract_page_tables() clears the PMD without holding
mmap_lock, and spin on mincore() in the first process. The raced PMD has to
be the last one in the range, otherwise the next non-none PMD resets
walk->action and the leak is lost. It takes about a minute on a 2 vCPU
guest. I can send the .c off-list if that is useful.

Note that 6.12.y has no CONFIG_PT_RECLAIM, so the MADV_DONTNEED path used by
CVE-2026-89754 does not reach this on 6.12, but MADV_COLLAPSE does.

I only checked 6.12.y. Any stable tree that carries 3b89863c3fa4 without
aedf2efd1897 should be in the same state.

Thanks,
JongHyuk Kim(MalHyuk)


             reply	other threads:[~2026-10-25  5:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25  5:45 JongHyuk Kim(MalHyuk) [this message]
2026-10-25 23:29 ` Please backport aedf2efd1897 ("mm/pagewalk: fix stale walk->action escaping walk_pmd_range()") to 6.12.y Sasha Levin

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=20261025054505.1448278-1-malhyuk97@gmail.com \
    --to=malhyuk97@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=imv4bel@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=stable@vger.kernel.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