From: Vladimir Murzin <vladimir.murzin@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: catalin.marinas@arm.com, will@kernel.org, liulhong617@gmail.com
Subject: [PATCH] arm64: mm: Fix pfn_is_map_memory() misreporting mapped memory
Date: Tue, 8 Sep 2026 17:20:33 +0100 [thread overview]
Message-ID: <20260908162033.74509-1-vladimir.murzin@arm.com> (raw)
Commit 7ace06a01efa ("arm64: mm: fix accidental linear mapping of
no-map reserved memory") removed sub-page no-map regions from the
linear mapping. However, pfn_is_map_memory() can still report that
such a region is mapped.
For instance, with 64K pages, say we have
normal: ...–0xa2007fff
no-map: 0xa2008000–0xa200ffff
normal: 0xa2010000–...
The range 0xa2000000–0xa200ffff is not linearly mapped, but
pfn_is_map_memory(__phys_to_pfn(0xa2008000)) aligns the address to
page granularity and passes 0xa2000000 to memblock_is_map_memory().
That address belongs to the preceding normal memblock region, so the
no-map region is ignored and the function returns true.
Fix that by checking if entire page is subset of memory block.
Fixes: 7ace06a01efa ("arm64: mm: fix accidental linear mapping of no-map reserved memory")
Assisted-by: LLM
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
arch/arm64/mm/init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index fbf215ecc7d0..5da80e1e1727 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -172,7 +172,8 @@ int pfn_is_map_memory(unsigned long pfn)
if (PHYS_PFN(addr) != pfn)
return 0;
- return memblock_is_map_memory(addr);
+ return memblock_is_region_memory(addr, PAGE_SIZE) &&
+ memblock_is_map_memory(addr);
}
EXPORT_SYMBOL(pfn_is_map_memory);
--
2.34.1
next reply other threads:[~2026-09-08 16:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 16:20 Vladimir Murzin [this message]
2026-09-09 13:31 ` [PATCH] arm64: mm: Fix pfn_is_map_memory() misreporting mapped memory Will Deacon
2026-09-10 13:57 ` Vladimir Murzin
2026-09-11 12:35 ` Will Deacon
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=20260908162033.74509-1-vladimir.murzin@arm.com \
--to=vladimir.murzin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=liulhong617@gmail.com \
--cc=will@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