All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lianghong Liu <liulhong617@163.com>
To: linux-arm-kernel@lists.infradead.org
Cc: will@kernel.org, ardb@kernel.org
Subject: Re: [PATCH] arm64: mm: fix accidental linear mapping of no-map reserved memory
Date: Sat, 09 Aug 2026 02:30:00 +0800	[thread overview]
Message-ID: <reply-no-map-e6bc49f31a3742e6-liulhong617@163.com> (raw)
In-Reply-To: <20260513010255.3764038-1-liulhong617@163.com>

Hi Will,

Thanks for applying the patch, and apologies for my earlier reply. You
were right that it read like an AI-generated response — I had used LLVM
to help me parse your message and polish my wording, and it
ended up restating your question instead of answering it. That was my
fault, and I'll answer in my own words below.

To answer the question you actually asked on July 16 — "what practical
issues are you seeing on your system?":

I'm running v6.1.177-rt on a Cortex-A78AE (Armv8.2), 64K pages. The Device Tree
has four no-map regions, two of them sub-page and holding TEE memory the
firmware has marked inaccessible to the REE:

  reserved_region1@A0100000 { reg = <0x0 0xA0100000 0x0 0x00400000>; no-map; }; /* 4 MiB          */
  reserved_region2@A0500000 { reg = <0x0 0xA0500000 0x0 0x00002000>; no-map; }; /* 8 KiB, sub-page  */
  reserved_region3@A2000000 { reg = <0x0 0xA2000000 0x0 0x00008000>; no-map; }; /* 32 KiB, sub-page */
  reserved_region4@AB000000 { reg = <0x0 0xAB000000 0x0 0x00100000>; no-map; }; /* 1 MiB          */

Regions 2 and 3 should be unmapped. With the DStream debugger I see them
folded into one mapped span instead:

  0xFFFF000060000000-0xFFFF0000604FFFFF   <unmapped>
  0xFFFF000060500000-0xFFFF00006AFFFFFF   NP:0xA0500000-0xAAFFFFFF   Normal   RW
  0xFFFF00006B000000-0xFFFF00006B0FFFFF   <unmapped>

What should be two mappable ranges (0xA0502000-0xA2000000 and
0xA2008000-0xAB000000) get outward-rounded by `phys &= PAGE_MASK` in
__create_pgd_mapping_locked() into a single 0xA0500000-0xAB000000
mapping that covers both no-map regions.

The symptom on this hardware: the Cortex-A78AE's cache prefetcher
speculatively touches the now-mapped TEE pages, trips the firmware's
secure-memory protection, and raises spurious "REE accessed secure
memory" faults.

That's what the patch addresses — round the linear-map range inward so a
sub-page-aligned start/end can't pull the mapping back over an adjacent
no-map region. I'm grateful to Ard for supplying the piece I failed to:
for_each_mem_range() presents coalesced ranges, so the inward rounding
can't drop a page the allocator owns.

On the follow-ups you and Ard raised — I'd be glad to look at moving the
rounding into __create_pgd_mapping_locked() (or dropping it there and
leaving it to callers) as a separate change, and adding a WARN when a
linear-map range comes in non-page-aligned. I'll leave the applied patch
alone and send those as follow-ups if they still seem worthwhile.

Thanks again,
Lianghong Liu



      parent reply	other threads:[~2026-08-09 11:10 UTC|newest]

Thread overview: 8+ 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
2026-08-04 14:24   ` Ard Biesheuvel
2026-08-06 13:16     ` Will Deacon
2026-08-06 17:11 ` Will Deacon
2026-08-08 18:30 ` Lianghong Liu [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=reply-no-map-e6bc49f31a3742e6-liulhong617@163.com \
    --to=liulhong617@163.com \
    --cc=ardb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --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 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.