All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>,
	akpm@linux-foundation.org, liam@infradead.org, vbabka@kernel.org,
	rppt@kernel.org, surenb@google.com, mhocko@suse.com,
	peterx@redhat.com, dave.hansen@linux.intel.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	syzbot+49b1021becba70c1f3f6@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm: don't ioremap COWed anon pages in generic_access_phys()
Date: Tue, 13 Oct 2026 09:20:20 +0200	[thread overview]
Message-ID: <b101664e-5eff-4ee1-a917-826edb1058cf@kernel.org> (raw)
In-Reply-To: <ar-BkhuJINKdNpYC@gremlin>

On 10/2/26 12:07, Lorenzo Stoakes (ARM) wrote:
> On Fri, Oct 02, 2026 at 12:02:15PM +0200, David Hildenbrand (Arm) wrote:
>> On 10/2/26 10:38, Lorenzo Stoakes (ARM) wrote:
> 
>>> So I'd say somebody from the core team should take over this if we want to
>>> come up with a patch.
>>
>> Yes, I'll take care of it.
> 
> Thanks!
> 
>>>
>>> This looks reasonable but I hate that we have 'special' CoW overrides like
>>> this :)
>>
>> After sending this yesterday, I concluded that we can do this cleaner: just have
>>
>> bool normal_page;
>>
>> (naming suggestions?)
>>
>> that express that this is something refcounted with a struct page, like
>> documented for vm_normal_page().
>>
>> Then we can just refuse all of these.
> 
> Yeah it's all a bit tricky.
> 
> Maybe is_vm_normal_page ?
> 
> Or do we want to default to referring to a folio... but then pfnmap not a
> folio... ugh.
> 
> is_normal?
> 
> With a comment explaining in sense of vm_normal_page/folio()?
> 
> 
>>>
>>> Hmm, if not defined before why would this need a new PUD handler? Do we
>>> even have PUD-leaf PFN mappings?
>>
>> Yes we do. In any case, good for consistency.
> 
> In that case then we should definitely have it!
> 
>>> Since a folio being 'anon' is vague, because we stupidly made 'anon' vague
>>> in general.
>>
>> For folios it's an established term :)
> 
> Yeah, fair enough, that is true.
> 
> And makes the anon folio -> tracked as such in my change consistent end-to-end.
> 
> I guess we have swapbacked for the shmem stuff as a clear delineation too.

The more I look into it, the more complicated it gets.

generic_access_phys() is only used on VM_PFNMAP, so far so good.

Handling CoW anonymous folios is easy, per previous discussion.

What's not so easy is handling when a driver allocates some pages and
remap_pfn_range's them in here. And apparently there are some HV thingies that
can end up in this.

We can try detecting pfn_valid() and refuse accessing them entirely. But that
might refuse some ranges that just happen to have a memmap.

I tried throwing in a page_is_ram() check but that also just has too many corner
cases.

I'll ponder some more about this ...

-- 
Cheers,

David


      reply	other threads:[~2026-10-13  7:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-22 11:33 [syzbot] [kernel?] WARNING in __ioremap_caller syzbot
2026-09-04 22:02 ` syzbot
2026-09-04 23:20   ` Dave Hansen
2026-10-01 15:25 ` [PATCH] mm: don't ioremap COWed anon pages in generic_access_phys() Nguyen Ngoc Thang
2026-10-01 20:22   ` David Hildenbrand (Arm)
2026-10-02  8:38     ` Lorenzo Stoakes (ARM)
2026-10-02 10:02       ` David Hildenbrand (Arm)
2026-10-02 10:04         ` David Hildenbrand (Arm)
2026-10-02 10:09           ` Lorenzo Stoakes (ARM)
2026-10-02 12:19             ` David Hildenbrand (Arm)
2026-10-02 14:03               ` Lorenzo Stoakes (ARM)
2026-10-02 14:26                 ` David Hildenbrand (Arm)
2026-10-02 10:07         ` Lorenzo Stoakes (ARM)
2026-10-13  7:20           ` 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=b101664e-5eff-4ee1-a917-826edb1058cf@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=ngocthang2710.1999@gmail.com \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=syzbot+49b1021becba70c1f3f6@syzkaller.appspotmail.com \
    --cc=vbabka@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.