From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Lance Yang <lance.yang@linux.dev>
Cc: kas@kernel.org, akpm@linux-foundation.org, ziy@nvidia.com,
baolin.wang@linux.alibaba.com, liam@infradead.org,
nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, usama.arif@linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/huge_memory: disallow raw PMD mappings of the huge zero page
Date: Sat, 19 Sep 2026 20:47:32 +0200 [thread overview]
Message-ID: <2ba1724b-7b10-4b7d-a9f9-c642bc48d3bf@kernel.org> (raw)
In-Reply-To: <20260919151446.5741-1-lance.yang@linux.dev>
On 9/19/26 17:14, Lance Yang wrote:
>
> On Fri, Sep 18, 2026 at 10:37:27PM +0200, David Hildenbrand (Arm) wrote:
>> On 9/18/26 04:52, Lance Yang wrote:
>>>
>>>
>>> No in-tree user inserts the zeropage through vmf_insert_pfn_prot(), so
>>> rejecting it there should be fine.
>>>
>>> Something like:
>>>
>>> ---8<---
>>> The huge zeropage is reclaimable, but a raw PFN mapping does not pin it.
>>> A PMD mapping of huge_zero_pfn can therefore outlive the folio.
>>
>> Well, just with any other folio that we PFNMAP, the mapping would have to hold a
>> reference. mm_get_huge_zero_folio() can be used for that, or just grabbing a
>> folio reference (not so nice, but works; GUP uses that, for example, to keep the
>> huge zero folio alive).
>>
>>>
>>> No in-tree user needs either mapping, so reject both with VM_FAULT_SIGBUS
>>> rather than risk making either shared zero page writable.
>>
>> That is the better reason. You could also just say that handling shared
>> zeropages correctly is more involved (see vm_mixed_ok()), and as there are no
>> users, we can just disallow it instead of trying to fix it.
>
> Ah I see, thanks! obviously, I hadn't fully understood that ...
>
> How about this instead?
>
> "
> Handling the huge/shared zeropage correctly in vmf_insert_pfn_pmd()
> and vmf_insert_pfn_prot() is more involved. We would need to check
> whether the VMA allows it and keep the mapping read-only, similar
> to the checks in vm_mixed_ok().
>
> No in-tree user needs that support, so reject these mappings with
> VM_FAULT_SIGBUS rather than complicate the code for now.
> "
Works for me.
--
Cheers,
David
next prev parent reply other threads:[~2026-09-19 18:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 12:10 Lance Yang
2026-09-17 14:32 ` Kiryl Shutsemau
2026-09-17 15:29 ` David Hildenbrand (Arm)
2026-09-17 16:03 ` Kiryl Shutsemau
2026-09-18 2:52 ` Lance Yang
2026-09-18 10:16 ` Kiryl Shutsemau
2026-09-18 20:37 ` David Hildenbrand (Arm)
2026-09-19 15:14 ` Lance Yang
2026-09-19 18:47 ` David Hildenbrand (Arm) [this message]
2026-09-18 20:32 ` David Hildenbrand (Arm)
2026-09-17 15:38 ` 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=2ba1724b-7b10-4b7d-a9f9-c642bc48d3bf@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dev.jain@arm.com \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nico.pache@linux.dev \
--cc=ryan.roberts@arm.com \
--cc=usama.arif@linux.dev \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®