mm/mmap: Fix vma_merge() offset when expanding the next vma
Subsystems (3)
PATCH 1/1 mm/mmap: Fix vma_merge() offset when expanding the next vma
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.
--- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mmap.c +1 -1
@@ -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;
Signature · 1 line
2.39.0
Quoted 10 lines · Liam R. Howlett
The
vm_pgoffwas being set incorrectly when expanding the next VMA to a lower address. Fix the issue by using themid->vm_pgoffvalue for this merge case (aka case 8). Note that this does not change case 3'svm_pgoffas next and mid are the same VMA.Reported-by Sanan Hasanov <[email protected]>Link https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/ open hereCc Matthew Wilcox <[email protected]>Cc David Hildenbrand <[email protected]>Cc Hugh Dickins <[email protected]>
Quoted 10 lines
Signed-off-by Liam R. Howlett <[email protected]>--- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/mmap.c +0
-0
mm/mmap.c struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, · line 984
Quoted 8 lines
mm/mmap.c +1
-1@@ -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;
Thanks!
Signature · 3 lines
Thanks, David / dhildenb
Quoted 6 lines · David Hildenbrand
Quoted 5 lines · Liam R. Howlett
The
vm_pgoffwas being set incorrectly when expanding the next VMA to a lower address. Fix the issue by using themid->vm_pgoffvalue for this merge case (aka case 8). Note that this does not change case 3'svm_pgoffas next and mid are the same VMA.
Quoted 7 lines
Quoted 5 lines
Reported-by Sanan Hasanov <[email protected]>Link https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/ open hereCc Matthew Wilcox <[email protected]>Cc David Hildenbrand <[email protected]>Cc Hugh Dickins <[email protected]>Fixes ?
Quoted 29 lines
Quoted 11 lines
Signed-off-by Liam R. Howlett <[email protected]>--- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/mmap.c +0
-0mm/mmap.c struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, · line 984
Quoted 8 lines
mm/mmap.c +1
-1@@ -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;Thanks!
Signature · 3 lines
Thanks, David / dhildenb
Quoted 13 lines · Liam R. Howlett
Quoted 12 lines · David Hildenbrand
Quoted 10 lines · Liam R. Howlett
The
vm_pgoffwas being set incorrectly when expanding the next VMA to a lower address. Fix the issue by using themid->vm_pgoffvalue for this merge case (aka case 8). Note that this does not change case 3'svm_pgoffas next and mid are the same VMA.Reported-by Sanan Hasanov <[email protected]>Link https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/ open hereCc Matthew Wilcox <[email protected]>Cc David Hildenbrand <[email protected]>Cc Hugh Dickins <[email protected]>
Quoted 3 lines
Quoted 1 line
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.
Signature · 3 lines
Thanks, David / dhildenb
Andrew Morton
maintainerQuoted 14 lines · On Tue, 31 Jan 2023 15:29:59 +0100 David Hildenbrand <[email protected]> wrote:
Quoted 13 lines · Liam R. Howlett
Quoted 12 lines · David Hildenbrand
Quoted 10 lines · Liam R. Howlett
The
vm_pgoffwas being set incorrectly when expanding the next VMA to a lower address. Fix the issue by using themid->vm_pgoffvalue for this merge case (aka case 8). Note that this does not change case 3'svm_pgoffas next and mid are the same VMA.Reported-by Sanan Hasanov <[email protected]>Link https://lore.kernel.org/linux-mm/IA1PR07MB983017D2FBA174D2FF78CEB6ABCE9@IA1PR07MB9830.namprd07.prod.outlook.com/ open hereCc Matthew Wilcox <[email protected]>Cc David Hildenbrand <[email protected]>Cc Hugh Dickins <[email protected]>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
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".