From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Ren Wei <weir@nebusec.ai>, linux-mm@kvack.org
Cc: akpm@linux-foundation.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 v3 1/1] mm/memory: constrain generic_access_phys() to page boundary
Date: Thu, 10 Sep 2026 10:16:43 +0200 [thread overview]
Message-ID: <06c15d6b-444f-46f2-9341-84d8afc1afc0@kernel.org> (raw)
In-Reply-To: <e06e28a46c2a176238f03b5740df0913e57c2861.1788842306.git.rakukuip@gmail.com>
On 9/10/26 05:42, Ren Wei wrote:
> From: Luxiao Xu <rakukuip@gmail.com>
>
> 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.
>
> Constrain the access in generic_access_phys() to at most the current page
> boundary (PAGE_SIZE - offset) and map only a single PAGE_SIZE via
> ioremap_prot(). Since the caller __access_remote_vm() already loops over
> the requested length and handles partial transfers, it will naturally
> iterate over the remaining pages.
>
> Also add a missing (resource_size_t) cast during PFN re-validation to avoid
> truncation on 32-bit PAE systems.
>
> Fixes: 9cb12d7b4cca ("mm/memory.c: actually remap enough memory")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Assisted-by: LLM
> Suggested-by: David Hildenbrand <david@kernel.org>
> Signed-off-by: Luxiao Xu <rakukuip@gmail.com>
> Signed-off-by: Ren Wei <weir@nebusec.ai>
> ---
Yes, LGTM!
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
prev parent reply other threads:[~2026-09-10 8:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 3:42 [PATCH v3 0/1] mm/memory: constrain generic_access_phys() to page boundary Ren Wei
2026-09-10 3:42 ` [PATCH v3 1/1] " Ren Wei
2026-09-10 6:18 ` Andrew Morton
2026-09-10 8:16 ` David Hildenbrand (Arm) [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=06c15d6b-444f-46f2-9341-84d8afc1afc0@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox