On Fri, 2011-06-17 at 10:20 +0530, Srikar Dronamraju wrote: > > > > void __unregister_uprobe(...) > > { > > uprobe = find_uprobe(); // ref++ > > if (delete_consumer(...)); // includes tree removal on last consumer > > // implies we own the last ref > > return; // consumers > > > > vma_prio_tree_foreach() { > > // create list > > } > > > > list_for_each_entry_safe() { > > // remove from list > > remove_breakpoint(); // unconditional, if it wasn't there > > // its a nop anyway, can't get any new > > // new probes on account of holding > > // uprobes_mutex and mmap() doesn't see > > // it due to tree removal. > > } > > } > > > > This would have a bigger race. > A breakpoint might be hit by which time the node is removed and we > have no way to find out the uprobe. So we deliver an extra TRAP to the > app. Gah indeed. Back to the drawing board for me. > > int mmap_uprobe(...) > > { > > spin_lock(&uprobes_treelock); > > for_each_probe_in_inode() { > > // create list; > > } > > spin_unlock(..); > > > > list_for_each_entry_safe() { > > // remove from list > > ret = install_breakpoint(); > > if (ret) > > goto fail; > > if (!uprobe_still_there()) // takes treelock > > remove_breakpoint(); > > } > > > > return 0; > > > > fail: > > list_for_each_entry_safe() { > > // destroy list > > } > > return ret; > > } > > > > > register_uprobe will race with mmap_uprobe's first pass. > So we might end up with a vma that doesnot have a breakpoint inserted > but inserted in all other vma that map to the same inode. I'm not seeing this though, if mmap_uprobe() is before register_uprobe() inserts the probe in the tree, the vma is already in the rmap and register_uprobe() will find it in its vma walk. If its after, mmap_uprobe() will find it and install, if a concurrent register_uprobe()'s vma walk also finds it, it will -EEXISTS and ignore the error. -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href