Can you try with _just_ my patch? Or add a
vma->anon_vma = merge_vma->anon_vma;
to Rik's "merge_vma" case in anon_vma_prepare().
Because I'm starign at Rik's patch, and one thing strikes me: it does that
"anon_vma_clone()" in anon_vma_prepare(), and maybe I'm blind, but I don't
see where that actually sets vma->anon_vma.
As far as I can tell, anon_vma_clone() was designed purely for the fork()
case, which has done
*new = *vma;
which will set new->anon_vma to the same vma. But Rik's patch never does
that for the anon_vma_prepare() case.
And maybe we should do it in anon_vma_clone() itself, just to make it
impossible to mistakenly leave it out, the way I think Rik's patch did.
Anyway, I'm still groggy from allt he flu medication, so take everything I
say with a grain of salt.
In fact, the more I look at this, the less I think I like Rik's patch in
the first place. I think the real bug that Rik tried to fix is that
apparently anon_vma_merge() doesn't necessarily merge everything right.
From Rik's bug-explanation, step 5:
and I think that _this_ is the real bug to begin with. The real fix should
be in vma_adjust/anon_vma_merge, not in how we set up the anon_vma in the
first place. I do _not_ think we should require that we always merged
things at mmap() time, because we may _never_ be able to merge perfectly
(ie start out with to disjoing mmaps, and fill in the middle).
Linus
--