Re: [PATCH] mm: fix locking order in mm_take_all_locks()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 12-01-16 16:52:19, Kirill A. Shutemov wrote:
> On Tue, Jan 12, 2016 at 03:45:21PM +0100, Michal Hocko wrote:
> > On Mon 11-01-16 14:05:28, Kirill A. Shutemov wrote:
> > > Dmitry Vyukov has reported[1] possible deadlock (triggered by his syzkaller
> > > fuzzer):
> > > 
> > >  Possible unsafe locking scenario:
> > > 
> > >        CPU0                    CPU1
> > >        ----                    ----
> > >   lock(&hugetlbfs_i_mmap_rwsem_key);
> > >                                lock(&mapping->i_mmap_rwsem);
> > >                                lock(&hugetlbfs_i_mmap_rwsem_key);
> > >   lock(&mapping->i_mmap_rwsem);
> > > 
> > > Both traces points to mm_take_all_locks() as a source of the problem.
> > > It doesn't take care about ordering or hugetlbfs_i_mmap_rwsem_key (aka
> > > mapping->i_mmap_rwsem for hugetlb mapping) vs. i_mmap_rwsem.
> > 
> > Hmm, but huge_pmd_share is called with mmap_sem held no?
> 
> Why does it matter?
> 
> Both mappings can be mapped to different processes, so mmap_sem is no good
> here.

You are right! Then it really makes a differencec.
Feel free to add
Reviewed-by: Michal Hocko <mhocko@xxxxxxxx>
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]