* Peter Zijlstra <peterz@xxxxxxxxxxxxx> [2011-06-15 20:11:26]: > On Tue, 2011-06-07 at 18:29 +0530, Srikar Dronamraju wrote: > > + up_write(&mm->mmap_sem); > > + mutex_lock(&uprobes_mutex); > > + down_read(&mm->mmap_sem); > > egads, and all that without a comment explaining why you think that is > even remotely sane. > > I'm not at all convinced, it would expose the mmap() even though you > could still decide to tear it down if this function were to fail, I bet > there's some funnies there. The problem is with lock ordering. register/unregister operations acquire uprobes_mutex (which serializes register unregister and the mmap_hook) and then holds mmap_sem for read before they insert a breakpoint. But the mmap hook would be called with mmap_sem held for write. So acquiring uprobes_mutex can result in deadlock. Hence we release the mmap_sem, take the uprobes_mutex and then again hold the mmap_sem. After we re-acquire the mmap_sem, we do check if the vma is valid. Do we have better solutions? -- Thanks and Regards Srikar -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>