* [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-11 13:54 ` Konstantin Khlebnikov
0 siblings, 0 replies; 12+ messages in thread
From: Konstantin Khlebnikov @ 2015-01-11 13:54 UTC (permalink / raw)
To: linux-mm, Andrew Morton, Linus Torvalds, linux-kernel
Cc: Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay, Michal Hocko
Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
("kernel BUG at mm/rmap.c:399!").
Anon_vma_clone() is usually called for a copy of source vma in destination
argument. If source vma has anon_vma it should be already in dst->anon_vma.
NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
In this case anon_vma_clone() finds anon_vma for reusing.
Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
anon_vma_clone() links vma to old anon_vma and updates degree counters but
vma_adjust() overrides vma->anon_vma right after that. As a result final
unlink_anon_vmas() decrements degree for wrong anon_vma.
This patch assigns ->anon_vma before calling anon_vma_clone().
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
Tested-by: Chris Clayton <chris2553@googlemail.com>
Tested-by: Oded Gabbay <oded.gabbay@amd.com>
Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
---
mm/mmap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 7b36aa7..12616c5 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -778,10 +778,12 @@ again: remove_next = 1 + (end > next->vm_end);
if (exporter && exporter->anon_vma && !importer->anon_vma) {
int error;
+ importer->anon_vma = exporter->anon_vma;
error = anon_vma_clone(importer, exporter);
- if (error)
+ if (error) {
+ importer->anon_vma = NULL;
return error;
- importer->anon_vma = exporter->anon_vma;
+ }
}
}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-11 13:54 ` Konstantin Khlebnikov
0 siblings, 0 replies; 12+ messages in thread
From: Konstantin Khlebnikov @ 2015-01-11 13:54 UTC (permalink / raw)
To: linux-mm, Andrew Morton, Linus Torvalds, linux-kernel
Cc: Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay, Michal Hocko
Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
("kernel BUG at mm/rmap.c:399!").
Anon_vma_clone() is usually called for a copy of source vma in destination
argument. If source vma has anon_vma it should be already in dst->anon_vma.
NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
In this case anon_vma_clone() finds anon_vma for reusing.
Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
anon_vma_clone() links vma to old anon_vma and updates degree counters but
vma_adjust() overrides vma->anon_vma right after that. As a result final
unlink_anon_vmas() decrements degree for wrong anon_vma.
This patch assigns ->anon_vma before calling anon_vma_clone().
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
Tested-by: Chris Clayton <chris2553@googlemail.com>
Tested-by: Oded Gabbay <oded.gabbay@amd.com>
Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
---
mm/mmap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 7b36aa7..12616c5 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -778,10 +778,12 @@ again: remove_next = 1 + (end > next->vm_end);
if (exporter && exporter->anon_vma && !importer->anon_vma) {
int error;
+ importer->anon_vma = exporter->anon_vma;
error = anon_vma_clone(importer, exporter);
- if (error)
+ if (error) {
+ importer->anon_vma = NULL;
return error;
- importer->anon_vma = exporter->anon_vma;
+ }
}
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
2015-01-11 13:54 ` Konstantin Khlebnikov
@ 2015-01-11 14:25 ` Rik van Riel
-1 siblings, 0 replies; 12+ messages in thread
From: Rik van Riel @ 2015-01-11 14:25 UTC (permalink / raw)
To: Konstantin Khlebnikov, linux-mm, Andrew Morton, Linus Torvalds,
linux-kernel
Cc: Elifaz, Dana, Bridgman, John, Daniel Forrest, Chris Clayton,
Oded Gabbay, Michal Hocko
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/11/2015 08:54 AM, Konstantin Khlebnikov wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in
> destination argument. If source vma has anon_vma it should be
> already in dst->anon_vma. NULL in dst->anon_vma is used as a sign
> that it's called from anon_vma_fork(). In this case
> anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing
> logic: anon_vma_clone() links vma to old anon_vma and updates
> degree counters but vma_adjust() overrides vma->anon_vma right
> after that. As a result final unlink_anon_vmas() decrements degree
> for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com> Fixes:
> 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
> Tested-by: Chris Clayton <chris2553@googlemail.com> Tested-by: Oded
> Gabbay <oded.gabbay@amd.com> Cc: Daniel Forrest
> <dan.forrest@ssec.wisc.edu> Cc: Michal Hocko <mhocko@suse.cz> Cc:
> Rik van Riel <riel@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
- --
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJUsoe+AAoJEM553pKExN6D4x0H/RpBJella2+JhOBPyCBtLY7Z
9w8n14TlqEq7cK/WRmjhYZfVMNGIG3MDe+nAH0hTF0teh/MvJuAkraYnPxtIZYqX
R7IpNOUS3HJBLqsRjNdVNsoMnWOGBC6j/RV70pLj1VklZnq/VDsUPybm0XWk1oh6
nC1QhdLfcnuaFS4M1lzsSyURwQYxi+2vv/kFdtYscArTYmjI7I4gCP3fD7lQKCwK
za0z/oZb5Z5cOHXyQfe/HUROCCNUZUQfcX1XvW+TWvuwcatOvKeVCmJAy5/aPkfH
THtwAP6EyZpu5XwsYXCNfbyalqYpH5lKxd5C+vG86YKEYZyeqRLKLeYAVY3yTho=
=v95A
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-11 14:25 ` Rik van Riel
0 siblings, 0 replies; 12+ messages in thread
From: Rik van Riel @ 2015-01-11 14:25 UTC (permalink / raw)
To: Konstantin Khlebnikov, linux-mm, Andrew Morton, Linus Torvalds,
linux-kernel
Cc: Elifaz, Dana, Bridgman, John, Daniel Forrest, Chris Clayton,
Oded Gabbay, Michal Hocko
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/11/2015 08:54 AM, Konstantin Khlebnikov wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in
> destination argument. If source vma has anon_vma it should be
> already in dst->anon_vma. NULL in dst->anon_vma is used as a sign
> that it's called from anon_vma_fork(). In this case
> anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing
> logic: anon_vma_clone() links vma to old anon_vma and updates
> degree counters but vma_adjust() overrides vma->anon_vma right
> after that. As a result final unlink_anon_vmas() decrements degree
> for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com> Fixes:
> 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
> Tested-by: Chris Clayton <chris2553@googlemail.com> Tested-by: Oded
> Gabbay <oded.gabbay@amd.com> Cc: Daniel Forrest
> <dan.forrest@ssec.wisc.edu> Cc: Michal Hocko <mhocko@suse.cz> Cc:
> Rik van Riel <riel@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
- --
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJUsoe+AAoJEM553pKExN6D4x0H/RpBJella2+JhOBPyCBtLY7Z
9w8n14TlqEq7cK/WRmjhYZfVMNGIG3MDe+nAH0hTF0teh/MvJuAkraYnPxtIZYqX
R7IpNOUS3HJBLqsRjNdVNsoMnWOGBC6j/RV70pLj1VklZnq/VDsUPybm0XWk1oh6
nC1QhdLfcnuaFS4M1lzsSyURwQYxi+2vv/kFdtYscArTYmjI7I4gCP3fD7lQKCwK
za0z/oZb5Z5cOHXyQfe/HUROCCNUZUQfcX1XvW+TWvuwcatOvKeVCmJAy5/aPkfH
THtwAP6EyZpu5XwsYXCNfbyalqYpH5lKxd5C+vG86YKEYZyeqRLKLeYAVY3yTho=
=v95A
-----END PGP SIGNATURE-----
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
2015-01-11 13:54 ` Konstantin Khlebnikov
@ 2015-01-11 15:05 ` Vlastimil Babka
-1 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2015-01-11 15:05 UTC (permalink / raw)
To: Konstantin Khlebnikov, linux-mm, Andrew Morton, Linus Torvalds,
linux-kernel
Cc: Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay, Michal Hocko
On 01/11/2015 02:54 PM, Konstantin Khlebnikov wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in destination
> argument. If source vma has anon_vma it should be already in dst->anon_vma.
> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
> In this case anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
> anon_vma_clone() links vma to old anon_vma and updates degree counters but
> vma_adjust() overrides vma->anon_vma right after that. As a result final
> unlink_anon_vmas() decrements degree for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/mmap.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 7b36aa7..12616c5 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -778,10 +778,12 @@ again: remove_next = 1 + (end > next->vm_end);
> if (exporter && exporter->anon_vma && !importer->anon_vma) {
> int error;
>
> + importer->anon_vma = exporter->anon_vma;
> error = anon_vma_clone(importer, exporter);
> - if (error)
> + if (error) {
> + importer->anon_vma = NULL;
> return error;
> - importer->anon_vma = exporter->anon_vma;
> + }
> }
> }
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-11 15:05 ` Vlastimil Babka
0 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2015-01-11 15:05 UTC (permalink / raw)
To: Konstantin Khlebnikov, linux-mm, Andrew Morton, Linus Torvalds,
linux-kernel
Cc: Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay, Michal Hocko
On 01/11/2015 02:54 PM, Konstantin Khlebnikov wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in destination
> argument. If source vma has anon_vma it should be already in dst->anon_vma.
> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
> In this case anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
> anon_vma_clone() links vma to old anon_vma and updates degree counters but
> vma_adjust() overrides vma->anon_vma right after that. As a result final
> unlink_anon_vmas() decrements degree for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/mmap.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 7b36aa7..12616c5 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -778,10 +778,12 @@ again: remove_next = 1 + (end > next->vm_end);
> if (exporter && exporter->anon_vma && !importer->anon_vma) {
> int error;
>
> + importer->anon_vma = exporter->anon_vma;
> error = anon_vma_clone(importer, exporter);
> - if (error)
> + if (error) {
> + importer->anon_vma = NULL;
> return error;
> - importer->anon_vma = exporter->anon_vma;
> + }
> }
> }
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
2015-01-11 13:54 ` Konstantin Khlebnikov
@ 2015-01-12 9:50 ` Michal Hocko
-1 siblings, 0 replies; 12+ messages in thread
From: Michal Hocko @ 2015-01-12 9:50 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: linux-mm, Andrew Morton, Linus Torvalds, linux-kernel,
Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay
On Sun 11-01-15 16:54:06, Konstantin Khlebnikov wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in destination
> argument. If source vma has anon_vma it should be already in dst->anon_vma.
> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
> In this case anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
> anon_vma_clone() links vma to old anon_vma and updates degree counters but
> vma_adjust() overrides vma->anon_vma right after that. As a result final
> unlink_anon_vmas() decrements degree for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/mmap.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 7b36aa7..12616c5 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -778,10 +778,12 @@ again: remove_next = 1 + (end > next->vm_end);
> if (exporter && exporter->anon_vma && !importer->anon_vma) {
> int error;
>
> + importer->anon_vma = exporter->anon_vma;
> error = anon_vma_clone(importer, exporter);
> - if (error)
> + if (error) {
> + importer->anon_vma = NULL;
> return error;
> - importer->anon_vma = exporter->anon_vma;
> + }
> }
> }
>
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-12 9:50 ` Michal Hocko
0 siblings, 0 replies; 12+ messages in thread
From: Michal Hocko @ 2015-01-12 9:50 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: linux-mm, Andrew Morton, Linus Torvalds, linux-kernel,
Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay
On Sun 11-01-15 16:54:06, Konstantin Khlebnikov wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in destination
> argument. If source vma has anon_vma it should be already in dst->anon_vma.
> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
> In this case anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
> anon_vma_clone() links vma to old anon_vma and updates degree counters but
> vma_adjust() overrides vma->anon_vma right after that. As a result final
> unlink_anon_vmas() decrements degree for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/mmap.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 7b36aa7..12616c5 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -778,10 +778,12 @@ again: remove_next = 1 + (end > next->vm_end);
> if (exporter && exporter->anon_vma && !importer->anon_vma) {
> int error;
>
> + importer->anon_vma = exporter->anon_vma;
> error = anon_vma_clone(importer, exporter);
> - if (error)
> + if (error) {
> + importer->anon_vma = NULL;
> return error;
> - importer->anon_vma = exporter->anon_vma;
> + }
> }
> }
>
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
2015-01-11 13:54 ` Konstantin Khlebnikov
@ 2015-01-12 20:21 ` Andrew Morton
-1 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2015-01-12 20:21 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: linux-mm, Linus Torvalds, linux-kernel, Rik van Riel, Elifaz,
Dana, Bridgman, John, Daniel Forrest, Chris Clayton, Oded Gabbay,
Michal Hocko, Greg KH
On Sun, 11 Jan 2015 16:54:06 +0300 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in destination
> argument. If source vma has anon_vma it should be already in dst->anon_vma.
> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
> In this case anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
> anon_vma_clone() links vma to old anon_vma and updates degree counters but
> vma_adjust() overrides vma->anon_vma right after that. As a result final
> unlink_anon_vmas() decrements degree for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
I've asked Greg not to take 7a3ef208e662 into -stable because of this
problem. So if you still think we should fix this in -stable, could
you please prepare an updated patch and send it to Greg?
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-12 20:21 ` Andrew Morton
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2015-01-12 20:21 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: linux-mm, Linus Torvalds, linux-kernel, Rik van Riel, Elifaz,
Dana, Bridgman, John, Daniel Forrest, Chris Clayton, Oded Gabbay,
Michal Hocko, Greg KH
On Sun, 11 Jan 2015 16:54:06 +0300 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
> ("kernel BUG at mm/rmap.c:399!").
>
> Anon_vma_clone() is usually called for a copy of source vma in destination
> argument. If source vma has anon_vma it should be already in dst->anon_vma.
> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
> In this case anon_vma_clone() finds anon_vma for reusing.
>
> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
> anon_vma_clone() links vma to old anon_vma and updates degree counters but
> vma_adjust() overrides vma->anon_vma right after that. As a result final
> unlink_anon_vmas() decrements degree for wrong anon_vma.
>
> This patch assigns ->anon_vma before calling anon_vma_clone().
>
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
I've asked Greg not to take 7a3ef208e662 into -stable because of this
problem. So if you still think we should fix this in -stable, could
you please prepare an updated patch and send it to Greg?
> Tested-by: Chris Clayton <chris2553@googlemail.com>
> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Rik van Riel <riel@redhat.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
2015-01-12 20:21 ` Andrew Morton
@ 2015-01-13 6:53 ` Konstantin Khlebnikov
-1 siblings, 0 replies; 12+ messages in thread
From: Konstantin Khlebnikov @ 2015-01-13 6:53 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Linus Torvalds, Linux Kernel Mailing List,
Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay, Michal Hocko, Greg KH
On Mon, Jan 12, 2015 at 11:21 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Sun, 11 Jan 2015 16:54:06 +0300 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>
>> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
>> ("kernel BUG at mm/rmap.c:399!").
>>
>> Anon_vma_clone() is usually called for a copy of source vma in destination
>> argument. If source vma has anon_vma it should be already in dst->anon_vma.
>> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
>> In this case anon_vma_clone() finds anon_vma for reusing.
>>
>> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
>> anon_vma_clone() links vma to old anon_vma and updates degree counters but
>> vma_adjust() overrides vma->anon_vma right after that. As a result final
>> unlink_anon_vmas() decrements degree for wrong anon_vma.
>>
>> This patch assigns ->anon_vma before calling anon_vma_clone().
>>
>> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
>> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
>
> I've asked Greg not to take 7a3ef208e662 into -stable because of this
> problem. So if you still think we should fix this in -stable, could
> you please prepare an updated patch and send it to Greg?
Will do. But let's wait for some just to be sure that is the last bug here.
>
>> Tested-by: Chris Clayton <chris2553@googlemail.com>
>> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
>> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
>> Cc: Michal Hocko <mhocko@suse.cz>
>> Cc: Rik van Riel <riel@redhat.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] mm: fix corner case in anon_vma endless growing prevention
@ 2015-01-13 6:53 ` Konstantin Khlebnikov
0 siblings, 0 replies; 12+ messages in thread
From: Konstantin Khlebnikov @ 2015-01-13 6:53 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Linus Torvalds, Linux Kernel Mailing List,
Rik van Riel, Elifaz, Dana, Bridgman, John, Daniel Forrest,
Chris Clayton, Oded Gabbay, Michal Hocko, Greg KH
On Mon, Jan 12, 2015 at 11:21 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Sun, 11 Jan 2015 16:54:06 +0300 Konstantin Khlebnikov <koct9i@gmail.com> wrote:
>
>> Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas()
>> ("kernel BUG at mm/rmap.c:399!").
>>
>> Anon_vma_clone() is usually called for a copy of source vma in destination
>> argument. If source vma has anon_vma it should be already in dst->anon_vma.
>> NULL in dst->anon_vma is used as a sign that it's called from anon_vma_fork().
>> In this case anon_vma_clone() finds anon_vma for reusing.
>>
>> Vma_adjust() calls it differently and this breaks anon_vma reusing logic:
>> anon_vma_clone() links vma to old anon_vma and updates degree counters but
>> vma_adjust() overrides vma->anon_vma right after that. As a result final
>> unlink_anon_vmas() decrements degree for wrong anon_vma.
>>
>> This patch assigns ->anon_vma before calling anon_vma_clone().
>>
>> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
>> Fixes: 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy")
>
> I've asked Greg not to take 7a3ef208e662 into -stable because of this
> problem. So if you still think we should fix this in -stable, could
> you please prepare an updated patch and send it to Greg?
Will do. But let's wait for some just to be sure that is the last bug here.
>
>> Tested-by: Chris Clayton <chris2553@googlemail.com>
>> Tested-by: Oded Gabbay <oded.gabbay@amd.com>
>> Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
>> Cc: Michal Hocko <mhocko@suse.cz>
>> Cc: Rik van Riel <riel@redhat.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-01-13 6:53 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-11 13:54 [PATCH] mm: fix corner case in anon_vma endless growing prevention Konstantin Khlebnikov
2015-01-11 13:54 ` Konstantin Khlebnikov
2015-01-11 14:25 ` Rik van Riel
2015-01-11 14:25 ` Rik van Riel
2015-01-11 15:05 ` Vlastimil Babka
2015-01-11 15:05 ` Vlastimil Babka
2015-01-12 9:50 ` Michal Hocko
2015-01-12 9:50 ` Michal Hocko
2015-01-12 20:21 ` Andrew Morton
2015-01-12 20:21 ` Andrew Morton
2015-01-13 6:53 ` Konstantin Khlebnikov
2015-01-13 6:53 ` Konstantin Khlebnikov
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.