All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: Hyunwoo Kim <imv4bel@gmail.com>,
	david@kernel.org, liam@infradead.org, vbabka@kernel.org,
	rppt@kernel.org, surenb@google.com, mhocko@suse.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/pagewalk: fix stale walk->action escaping walk_pmd_range()
Date: Mon, 10 Aug 2026 11:16:38 -0700	[thread overview]
Message-ID: <20260810111638.a74d094a8a198e84bb6fa5cb@linux-foundation.org> (raw)
In-Reply-To: <annzcER_eGeBq_pY@lucifer>

On Mon, 10 Aug 2026 16:55:25 +0100 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:

> > The commit message was written with help from the lovely Claude. Not the
> > most readable, admittedly :)
> 
> Yeah I did wonder :)
> 
> I'm totally fine with using an LLM to help with language, especially if English
> is not your primary language, but obviously it can go... wrong :)

yup.  Changelogs from Asian developers have become a lot easier to read
in recent times.  But please always carefully review the resulting
output.

> So will always feedback if the commit message is unclear.
> 
> LLMs seem to have a habit of constructing word salads that end up effectively
> like 'the code in English' which ends up confusing more than helping.

I wonder if it would help to put the initial changelog text through the
LLM, but don't show it any code.

> Key thing is keeping things as short and clear as possible.

I pasted the original changelog into Gemini asking "make this shorter"
and got

Issue

  walk_pmd_range() only resets walk->action after the pmd_none()
  check.  For a walker without ->install_pte, a pmd_none() branch jumps
  to the next entry before resetting walk->action.  If ACTION_AGAIN is
  set and the entry becomes none, the loop can return 0 while leaving
  ACTION_AGAIN active.

  Since commit 3b89863c3fa4, walk_pud_range() reads this leaked
  ACTION_AGAIN status and rewalks the PMD range.  Because callbacks
  like ->pmd_entry() and ->pte_hole() have already processed the range
  once, re-executing them advances walk->private beyond the allocated
  buffer, causing an unprivileged out-of-bounds write (e.g., via
  mincore(2)).

Fix

  Move the walk->action = ACTION_SUBTREE reset to the top of the loop
  body in walk_pmd_range().  Apply the same update to walk_pud_range()
  and walk_p4d_range() to maintain code consistency.

Which is at least shorter ;)


We have a description of the userspace-visible runtime effects of the
bug, which is good, especially with cc:stable fixes.  If there's a bug
report or a backtrace to Link: to then please do that.


      reply	other threads:[~2026-08-10 18:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10  9:45 [PATCH] mm/pagewalk: fix stale walk->action escaping walk_pmd_range() Hyunwoo Kim
2026-08-10 11:19 ` Lorenzo Stoakes (ARM)
2026-08-10 15:50   ` Hyunwoo Kim
2026-08-10 15:55     ` Lorenzo Stoakes (ARM)
2026-08-10 18:16       ` 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=20260810111638.a74d094a8a198e84bb6fa5cb@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=imv4bel@gmail.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.