From: Andrew Morton <akpm@linux-foundation.org>
To: Ren Wei <weir@nebusec.ai>
Cc: linux-mm@kvack.org, david@kernel.org, ljs@kernel.org,
liam@infradead.org, vbabka@kernel.org, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, notasas@gmail.com,
vega@nebusec.ai, rakukuip@gmail.com
Subject: Re: [PATCH v2 1/1] mm/memory: constrain generic_access_phys() to page boundary
Date: Sat, 5 Sep 2026 16:03:12 -0700 [thread overview]
Message-ID: <20260905160312.9717eb43a63bed4de9f0248b@linux-foundation.org> (raw)
In-Reply-To: <eaa4de66f9491888e0ffeb2d37ba7ae796ba535e.1788531737.git.rakukuip@gmail.com>
On Sat, 5 Sep 2026 22:12:17 +0800 Ren Wei <weir@nebusec.ai> wrote:
> generic_access_phys() improperly validates the memory access range: it
> only validates the start address using follow_pfnmap_start() and passes
> PAGE_ALIGN(len + offset) to ioremap_prot().
>
> This poses two problems:
> 1. In PFNMAP VMAs, consecutive virtual pages are not guaranteed to be
> physically contiguous, and individual PTEs may have different access
> permissions or writability.
> 2. The mapping may cross VMA boundaries if len extends beyond vma->vm_end.
>
> Since __access_remote_vm() already loops over the requested length and
> accesses normal (struct page) memory page-by-page, constrain the ->access()
> callback in __access_remote_vm() to at most the current page boundary.
> Because VMA boundaries are always page-aligned, this also ensures the
> access never exceeds the current VMA.
>
> In generic_access_phys(), defensively clamp len to the page boundary as
> well, map only a single PAGE_SIZE via ioremap_prot(), and add a missing
> (resource_size_t) cast during PFN re-validation to avoid truncation on
> 32-bit PAE systems.
Thanks.
> Fixes: 9cb12d7b4cca ("mm/memory.c: actually remap enough memory")
> Cc: stable@vger.kernel.org
Why are we proposing a backport? To do that we should provide
recipients with a clear description of the userspace-visible runtime
affects of this bug and I'm not seeing that in the changelog?
next prev parent reply other threads:[~2026-09-05 23:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 14:12 [PATCH v2 0/1] mm/memory: constrain generic_access_phys() to page boundary Ren Wei
2026-09-05 14:12 ` [PATCH v2 1/1] " Ren Wei
2026-09-05 23:03 ` Andrew Morton [this message]
2026-09-07 12:08 ` 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=20260905160312.9717eb43a63bed4de9f0248b@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=notasas@gmail.com \
--cc=rakukuip@gmail.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=vega@nebusec.ai \
--cc=weir@nebusec.ai \
/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.