Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Lianghong Liu <liulhong617@163.com>
Cc: linux-arm-kernel@lists.infradead.org, ardb@kernel.org
Subject: Re: [PATCH] arm64: mm: fix accidental linear mapping of no-map reserved memory
Date: Tue, 4 Aug 2026 14:41:44 +0100	[thread overview]
Message-ID: <anHsGJhv66TMQFBo@willie-the-truck> (raw)
In-Reply-To: <20260727015527.1@liulhong617.163.com>

On Mon, Jul 27, 2026 at 09:55:58AM +0800, Lianghong Liu wrote:
> Thanks for the review. Quick answers to the two open questions.
> 
> ## What I'm seeing on my system
> 
> 64K pages (PAGE_SHIFT=16). A no-map reserved region at 0xA2000000 with
> size 0x8000 (32 KiB, sub-page). The linear map should skip that hole and
> start at 0xA2008000; instead it starts at 0xA2000000 — the whole no-map
> region is mapped with PAGE_KERNEL. Debug print in
> __create_pgd_mapping_locked():
> 
>   create_pgd_mapping: phys 0xa2008000 ...
>     after PAGE_MASK align: phys 0xa2000000 - 0xab000000   <- start rounded DOWN into no-map
> 
> Cause: for_each_mem_range skips MEMBLOCK_NOMAP regions via
> should_skip_region(), but memblock_mark_nomap() splits at byte
> boundaries in memblock_isolate_range() (rgn->base = base), so the
> *adjacent* region is returned with a sub-page-aligned start/end. That
> value then hits
>   phys &= PAGE_MASK;
> in __create_pgd_mapping_locked(), which rounds the start DOWN and pulls
> the mapping back into the no-map page.
> 
> So this is a real isolation break, not cosmetic: no-map memory the
> firmware asked to leave untouched ends up read/writable in the linear
> region.
> 
> ## On "we might fail to map legitimately mappable pages"
> 
> The inward rounding can't lose any page the allocator owns. The buddy
> release path uses the exact same inward PFN rounding in
> __free_memory_core():
>   start_pfn = PFN_UP(start);
>   end_pfn   = min(PFN_DOWN(end), max_low_pfn);
>   if (start_pfn >= end_pfn) return 0;

Sorry, but I don't understand how this has anything to do with the
question I asked. It looks like you just fed my reply to an LLVM and
pasted the response here.

I'm not convinced your patch is correct and I don't understand your
reply.

Will


  reply	other threads:[~2026-08-04 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  1:02 [PATCH] arm64: mm: fix accidental linear mapping of no-map reserved memory liulhong617
2026-07-16 14:01 ` Will Deacon
2026-07-27  1:55   ` Lianghong Liu
2026-08-04 13:41     ` Will Deacon [this message]
2026-08-04 14:24   ` Ard Biesheuvel
2026-08-06 13:16     ` Will Deacon
2026-08-06 17:11 ` 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=anHsGJhv66TMQFBo@willie-the-truck \
    --to=will@kernel.org \
    --cc=ardb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=liulhong617@163.com \
    /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