• Hugh Dickins's avatar
    [PATCH] anon_vma list locking bug · 51ba08b2
    Hugh Dickins authored
    Vladimir Saveliev reported anon_vma_unlink list_del BUG (LKML 24 June). 
    His testing is still in progress, but we believe it comes from a nasty
    locking deficiency I introduced in 2.6.7's anon_vma_prepare.
    
    Andrea's original anon_vma_prepare was fine, it needed no anon_vma lock
    because it was always linking a freshly allocated structure; but my
    find_mergeable enhancement let it adopt a neighbouring anon_vma, which of
    course needs locking against a racing linkage from another mm - which the
    earlier adjust_vma fix seems to have made more likely.
    
    Does anon_vma->lock nest inside or outside page_table_lock?  Inside, but
    that's not obvious without a lock ordering list: instead of listing the
    order here, update the list in filemap.c; but a separate patch because
    that's less urgent and more likely to get wrong or provoke controversy.
    
    (Could do it with anon_vma lock after dropping page_table_lock, but a long
    comment explaining why some code is safe suggests it's not.)
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    51ba08b2
rmap.c 20.1 KB