lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYhj_H2X141wU3oF@kernel.org>
Date: Sun, 8 Feb 2026 12:22:52 +0200
From: Mike Rapoport <rppt@...nel.org>
To: Peter Xu <peterx@...hat.com>
Cc: linux-mm@...ck.org, Andrea Arcangeli <aarcange@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Axel Rasmussen <axelrasmussen@...gle.com>,
	Baolin Wang <baolin.wang@...ux.alibaba.com>,
	David Hildenbrand <david@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	James Houghton <jthoughton@...gle.com>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
	Michal Hocko <mhocko@...e.com>, Muchun Song <muchun.song@...ux.dev>,
	Nikita Kalyazin <kalyazin@...zon.com>,
	Oscar Salvador <osalvador@...e.de>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Sean Christopherson <seanjc@...gle.com>,
	Shuah Khan <shuah@...nel.org>,
	Suren Baghdasaryan <surenb@...gle.com>,
	Vlastimil Babka <vbabka@...e.cz>, linux-kernel@...r.kernel.org,
	kvm@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH RFC 09/17] userfaultfd: introduce
 vm_uffd_ops->alloc_folio()

On Mon, Feb 02, 2026 at 05:13:20PM -0500, Peter Xu wrote:
> On Tue, Jan 27, 2026 at 09:29:28PM +0200, Mike Rapoport wrote:
> 
> [...]
> 
> > -static int mfill_atomic_pte_zeroed_folio(pmd_t *dst_pmd,
> > -					 struct vm_area_struct *dst_vma,
> > -					 unsigned long dst_addr)
> > +static int mfill_atomic_pte_copy(struct mfill_state *state)
> >  {
> > -	struct folio *folio;
> > -	int ret = -ENOMEM;
> > -
> > -	folio = vma_alloc_zeroed_movable_folio(dst_vma, dst_addr);
> > -	if (!folio)
> > -		return ret;
> > -
> > -	if (mem_cgroup_charge(folio, dst_vma->vm_mm, GFP_KERNEL))
> > -		goto out_put;
> > +	const struct vm_uffd_ops *ops = vma_uffd_ops(state->vma);
> >  
> > -	/*
> > -	 * The memory barrier inside __folio_mark_uptodate makes sure that
> > -	 * zeroing out the folio become visible before mapping the page
> > -	 * using set_pte_at(). See do_anonymous_page().
> > -	 */
> > -	__folio_mark_uptodate(folio);
> > +	return __mfill_atomic_pte(state, ops);
> > +}
> >  
> > -	ret = mfill_atomic_install_pte(dst_pmd, dst_vma, dst_addr,
> > -				       &folio->page, true, 0);
> > -	if (ret)
> > -		goto out_put;
> > +static int mfill_atomic_pte_zeroed_folio(struct mfill_state *state)
> > +{
> > +	const struct vm_uffd_ops *ops = vma_uffd_ops(state->vma);
> >  
> > -	return 0;
> > -out_put:
> > -	folio_put(folio);
> > -	return ret;
> > +	return __mfill_atomic_pte(state, ops);
> >  }
> >  
> >  static int mfill_atomic_pte_zeropage(struct mfill_state *state)
> > @@ -542,7 +546,7 @@ static int mfill_atomic_pte_zeropage(struct mfill_state *state)
> >  	int ret;
> >  
> >  	if (mm_forbids_zeropage(dst_vma->vm_mm))
> > -		return mfill_atomic_pte_zeroed_folio(dst_pmd, dst_vma, dst_addr);
> > +		return mfill_atomic_pte_zeroed_folio(state);
> 
> After this patch, mfill_atomic_pte_zeroed_folio() should be 100% the same
> impl with mfill_atomic_pte_copy(), so IIUC we can drop it.

It will be slightly different after the next patch to emphasize that
copying into MAP_PRIVATE actually creates anonymous memory.
 
> >  	_dst_pte = pte_mkspecial(pfn_pte(my_zero_pfn(dst_addr),
> >  					 dst_vma->vm_page_prot));
> > -- 
> > 2.51.0
> > 
> 
> -- 
> Peter Xu
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ