Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-24 Thread Ryan Roberts
On 23/01/2025 17:40, Peter Xu wrote: > On Thu, Jan 23, 2025 at 02:38:46PM +, Ryan Roberts wrote: >>> @@ -5470,7 +5471,18 @@ static void move_huge_pte(struct vm_area_struct >>> *vma, unsigned long old_addr, >>> spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); >>> >>> pte = hug

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-23 Thread Peter Xu
On Thu, Jan 23, 2025 at 02:38:46PM +, Ryan Roberts wrote: > > @@ -5470,7 +5471,18 @@ static void move_huge_pte(struct vm_area_struct > > *vma, unsigned long old_addr, > > spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); > > > > pte = huge_ptep_get_and_clear(mm, old_addr, src_

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-23 Thread Ryan Roberts
On 23/01/2025 14:38, Ryan Roberts wrote: > I think there might be a bug in this after all... > > > On 07/01/2025 14:47, Ryan Roberts wrote: >> When mremap()ing a memory region previously registered with userfaultfd >> as write-protected but without UFFD_FEATURE_EVENT_REMAP, an >> inconsistency in

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-23 Thread Ryan Roberts
I think there might be a bug in this after all... On 07/01/2025 14:47, Ryan Roberts wrote: > When mremap()ing a memory region previously registered with userfaultfd > as write-protected but without UFFD_FEATURE_EVENT_REMAP, an > inconsistency in flag clearing leads to a mismatch between the vma f

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-20 Thread David Hildenbrand
On 16.01.25 10:04, Ryan Roberts wrote: On 15/01/2025 20:28, Peter Xu wrote: On Tue, Jan 07, 2025 at 02:47:52PM +, Ryan Roberts wrote: When mremap()ing a memory region previously registered with userfaultfd as write-protected but without UFFD_FEATURE_EVENT_REMAP, an inconsistency in flag cle

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-16 Thread Ryan Roberts
On 15/01/2025 20:28, Peter Xu wrote: > On Tue, Jan 07, 2025 at 02:47:52PM +, Ryan Roberts wrote: >> When mremap()ing a memory region previously registered with userfaultfd >> as write-protected but without UFFD_FEATURE_EVENT_REMAP, an >> inconsistency in flag clearing leads to a mismatch betwee

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Andrew Morton
On Wed, 15 Jan 2025 17:30:20 + Lorenzo Stoakes wrote: > I sort of favour putting hotfixes in quick, but this one has gone in > quicker than some reviewed hotfixes which we left in unstable... however > towards the end of a cycle I think Andrew is stuck between a rock and a > hard place in de

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Peter Xu
On Tue, Jan 07, 2025 at 02:47:52PM +, Ryan Roberts wrote: > When mremap()ing a memory region previously registered with userfaultfd > as write-protected but without UFFD_FEATURE_EVENT_REMAP, an > inconsistency in flag clearing leads to a mismatch between the vma flags > (which have uffd-wp clea

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Ryan Roberts
On 15/01/2025 17:30, Lorenzo Stoakes wrote: > On Wed, Jan 15, 2025 at 12:21:15PM -0500, Peter Xu wrote: >> On Wed, Jan 15, 2025 at 04:58:06PM +, Ryan Roberts wrote: >>> Hi Peter, David, >> >> Hey, Ryan, >> >>> >>> On 07/01/2025 14:47, Ryan Roberts wrote: When mremap()ing a memory region pr

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Lorenzo Stoakes
On Wed, Jan 15, 2025 at 12:21:15PM -0500, Peter Xu wrote: > On Wed, Jan 15, 2025 at 04:58:06PM +, Ryan Roberts wrote: > > Hi Peter, David, > > Hey, Ryan, > > > > > On 07/01/2025 14:47, Ryan Roberts wrote: > > > When mremap()ing a memory region previously registered with userfaultfd > > > as wri

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Peter Xu
On Wed, Jan 15, 2025 at 04:58:06PM +, Ryan Roberts wrote: > Hi Peter, David, Hey, Ryan, > > On 07/01/2025 14:47, Ryan Roberts wrote: > > When mremap()ing a memory region previously registered with userfaultfd > > as write-protected but without UFFD_FEATURE_EVENT_REMAP, an > > inconsistency i

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Ryan Roberts
Hi Peter, David, On 07/01/2025 14:47, Ryan Roberts wrote: > When mremap()ing a memory region previously registered with userfaultfd > as write-protected but without UFFD_FEATURE_EVENT_REMAP, an > inconsistency in flag clearing leads to a mismatch between the vma flags > (which have uffd-wp cleared

[PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-07 Thread Ryan Roberts
When mremap()ing a memory region previously registered with userfaultfd as write-protected but without UFFD_FEATURE_EVENT_REMAP, an inconsistency in flag clearing leads to a mismatch between the vma flags (which have uffd-wp cleared) and the pte/pmd flags (which do not have uffd-wp cleared). This m