All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma
@ 2023-01-30 19:57 Liam R. Howlett
  2023-01-31  8:35 ` David Hildenbrand
  0 siblings, 1 reply; 5+ messages in thread
From: Liam R. Howlett @ 2023-01-30 19:57 UTC (permalink / raw)
  To: maple-tree, linux-mm, linux-kernel, Andrew Morton, linux-next
  Cc: Liam R. Howlett, Sanan Hasanov, Matthew Wilcox,
	David Hildenbrand, Hugh Dickins

The vm_pgoff was being set incorrectly when expanding the next VMA to a
lower address.  Fix the issue by using the mid->vm_pgoff value for this
merge case (aka case 8).  Note that this does not change case 3's
vm_pgoff as next and mid are the same VMA.

Reported-by: Sanan Hasanov <sanan.hasanov@knights.ucf.edu>
Link: https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 00d90bbc250e..614ea2d93b0a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -978,7 +978,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
 			vma = next;			/* case 3 */
 			vma_start = addr;
 			vma_end = next->vm_end;
-			vma_pgoff = next->vm_pgoff;
+			vma_pgoff = mid->vm_pgoff;
 			err = 0;
 			if (mid != next) {		/* case 8 */
 				remove = mid;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma
  2023-01-30 19:57 [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma Liam R. Howlett
@ 2023-01-31  8:35 ` David Hildenbrand
  2023-01-31 14:24   ` Liam R. Howlett
  0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2023-01-31  8:35 UTC (permalink / raw)
  To: Liam R. Howlett, maple-tree, linux-mm, linux-kernel,
	Andrew Morton, linux-next
  Cc: Sanan Hasanov, Matthew Wilcox, Hugh Dickins

On 30.01.23 20:57, Liam R. Howlett wrote:
> The vm_pgoff was being set incorrectly when expanding the next VMA to a
> lower address.  Fix the issue by using the mid->vm_pgoff value for this
> merge case (aka case 8).  Note that this does not change case 3's
> vm_pgoff as next and mid are the same VMA.
> 
> Reported-by: Sanan Hasanov <sanan.hasanov@knights.ucf.edu>
> Link: https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>

Fixes: ?

> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
>   mm/mmap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 00d90bbc250e..614ea2d93b0a 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -978,7 +978,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
>   			vma = next;			/* case 3 */
>   			vma_start = addr;
>   			vma_end = next->vm_end;
> -			vma_pgoff = next->vm_pgoff;
> +			vma_pgoff = mid->vm_pgoff;
>   			err = 0;
>   			if (mid != next) {		/* case 8 */
>   				remove = mid;

Acked-by: David Hildenbrand <david@redhat.com>

Thanks!

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma
  2023-01-31  8:35 ` David Hildenbrand
@ 2023-01-31 14:24   ` Liam R. Howlett
  2023-01-31 14:29     ` David Hildenbrand
  0 siblings, 1 reply; 5+ messages in thread
From: Liam R. Howlett @ 2023-01-31 14:24 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: maple-tree, linux-mm, linux-kernel, Andrew Morton, linux-next,
	Sanan Hasanov, Matthew Wilcox, Hugh Dickins

* David Hildenbrand <david@redhat.com> [230131 03:35]:
> On 30.01.23 20:57, Liam R. Howlett wrote:
> > The vm_pgoff was being set incorrectly when expanding the next VMA to a
> > lower address.  Fix the issue by using the mid->vm_pgoff value for this
> > merge case (aka case 8).  Note that this does not change case 3's
> > vm_pgoff as next and mid are the same VMA.
> > 
> > Reported-by: Sanan Hasanov <sanan.hasanov@knights.ucf.edu>
> > Link: https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/
> > Cc: Matthew Wilcox <willy@infradead.org>
> > Cc: David Hildenbrand <david@redhat.com>
> > Cc: Hugh Dickins <hughd@google.com>
> 
> Fixes: ?

Fixes: (soon to be invalid git id :) ("mm/mmap: remove __vma_adjust()")

> 
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> > ---
> >   mm/mmap.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mm/mmap.c b/mm/mmap.c
> > index 00d90bbc250e..614ea2d93b0a 100644
> > --- a/mm/mmap.c
> > +++ b/mm/mmap.c
> > @@ -978,7 +978,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
> >   			vma = next;			/* case 3 */
> >   			vma_start = addr;
> >   			vma_end = next->vm_end;
> > -			vma_pgoff = next->vm_pgoff;
> > +			vma_pgoff = mid->vm_pgoff;
> >   			err = 0;
> >   			if (mid != next) {		/* case 8 */
> >   				remove = mid;
> 
> Acked-by: David Hildenbrand <david@redhat.com>
> 
> Thanks!
> 
> -- 
> Thanks,
> 
> David / dhildenb
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma
  2023-01-31 14:24   ` Liam R. Howlett
@ 2023-01-31 14:29     ` David Hildenbrand
  2023-01-31 21:07       ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2023-01-31 14:29 UTC (permalink / raw)
  To: Liam R. Howlett, maple-tree, linux-mm, linux-kernel,
	Andrew Morton, linux-next, Sanan Hasanov, Matthew Wilcox,
	Hugh Dickins

On 31.01.23 15:24, Liam R. Howlett wrote:
> * David Hildenbrand <david@redhat.com> [230131 03:35]:
>> On 30.01.23 20:57, Liam R. Howlett wrote:
>>> The vm_pgoff was being set incorrectly when expanding the next VMA to a
>>> lower address.  Fix the issue by using the mid->vm_pgoff value for this
>>> merge case (aka case 8).  Note that this does not change case 3's
>>> vm_pgoff as next and mid are the same VMA.
>>>
>>> Reported-by: Sanan Hasanov <sanan.hasanov@knights.ucf.edu>
>>> Link: https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/
>>> Cc: Matthew Wilcox <willy@infradead.org>
>>> Cc: David Hildenbrand <david@redhat.com>
>>> Cc: Hugh Dickins <hughd@google.com>
>>
>> Fixes: ?
> 
> Fixes: (soon to be invalid git id :) ("mm/mmap: remove __vma_adjust()")

Ah, right, upstream was not affected ... :)

... so this should be squashed into that commit instead as long as it 
doesn't have a stable ID.

-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma
  2023-01-31 14:29     ` David Hildenbrand
@ 2023-01-31 21:07       ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2023-01-31 21:07 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Liam R. Howlett, maple-tree, linux-mm, linux-kernel, linux-next,
	Sanan Hasanov, Matthew Wilcox, Hugh Dickins

On Tue, 31 Jan 2023 15:29:59 +0100 David Hildenbrand <david@redhat.com> wrote:

> On 31.01.23 15:24, Liam R. Howlett wrote:
> > * David Hildenbrand <david@redhat.com> [230131 03:35]:
> >> On 30.01.23 20:57, Liam R. Howlett wrote:
> >>> The vm_pgoff was being set incorrectly when expanding the next VMA to a
> >>> lower address.  Fix the issue by using the mid->vm_pgoff value for this
> >>> merge case (aka case 8).  Note that this does not change case 3's
> >>> vm_pgoff as next and mid are the same VMA.
> >>>
> >>> Reported-by: Sanan Hasanov <sanan.hasanov@knights.ucf.edu>
> >>> Link: https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/
> >>> Cc: Matthew Wilcox <willy@infradead.org>
> >>> Cc: David Hildenbrand <david@redhat.com>
> >>> Cc: Hugh Dickins <hughd@google.com>
> >>
> >> Fixes: ?
> > 
> > Fixes: (soon to be invalid git id :) ("mm/mmap: remove __vma_adjust()")
> 
> Ah, right, upstream was not affected ... :)
> 
> ... so this should be squashed into that commit instead as long as it 
> doesn't have a stable ID.

Yup, I queued this as mm-mmap-remove-__vma_adjust-fix.patch so it's
to-be-squished.

Generally, please let's tell people when a patch fixes something which
is staged in mm-unstable - to save a few brain cycles and to hopefully
improve review.  A Fixes: with no SHA works, or simply "this fixes X".


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-31 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 19:57 [PATCH] mm/mmap: Fix vma_merge() offset when expanding the next vma Liam R. Howlett
2023-01-31  8:35 ` David Hildenbrand
2023-01-31 14:24   ` Liam R. Howlett
2023-01-31 14:29     ` David Hildenbrand
2023-01-31 21:07       ` Andrew Morton

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.