The patch titled Subject: Take rcu read lock when iterating through thread group has been added to the -mm tree. Its filename is procfs-mark-thread-stack-correctly-in-proc-pid-maps-take-rcu-read-lock-when-iterating-through-thread-group.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Siddhesh Poyarekar <siddhesh.poyarekar@xxxxxxxxx> Subject: Take rcu read lock when iterating through thread group Protect the iteration through thread group with rcu_read_lock when looking for tasks in the group that use the current vma as stack. Thanks KOSAKI Motohiro (kosaki.motohiro@xxxxxxxxx) for pointing it out. Signed-off-by: Siddhesh Poyarekar <siddhesh.poyarekar@xxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Jamie Lokier <jamie@xxxxxxxxxxxxx> Cc: Mike Frysinger <vapier@xxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Matt Mackall <mpm@xxxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff -puN mm/memory.c~procfs-mark-thread-stack-correctly-in-proc-pid-maps-take-rcu-read-lock-when-iterating-through-thread-group mm/memory.c --- a/mm/memory.c~procfs-mark-thread-stack-correctly-in-proc-pid-maps-take-rcu-read-lock-when-iterating-through-thread-group +++ a/mm/memory.c @@ -3904,20 +3904,27 @@ void print_vma_addr(char *prefix, unsign * just check in the current task. */ int vm_is_stack(struct task_struct *task, - struct vm_area_struct *vma, int in_group) + struct vm_area_struct *vma, int in_group) { + int ret = 0; + if (vm_is_stack_for_task(task, vma)) return 1; if (in_group) { struct task_struct *t = task; + rcu_read_lock(); while_each_thread(task, t) { - if (vm_is_stack_for_task(t, vma)) - return 1; + if (vm_is_stack_for_task(t, vma)) { + ret = 1; + goto done; + } } } - return 0; +done: + rcu_read_unlock(); + return ret; } #ifdef CONFIG_PROVE_LOCKING _ Subject: Subject: Take rcu read lock when iterating through thread group Patches currently in -mm which might be from siddhesh.poyarekar@xxxxxxxxx are linux-next.patch procfs-mark-thread-stack-correctly-in-proc-pid-maps.patch procfs-mark-thread-stack-correctly-in-proc-pid-maps-checkpatch-fixes.patch procfs-mark-thread-stack-correctly-in-proc-pid-maps-fix.patch procfs-mark-thread-stack-correctly-in-proc-pid-maps-take-rcu-read-lock-when-iterating-through-thread-group.patch procfs-mark-stack-vma-with-pid-of-the-owning-task.patch procfs-mark-stack-vma-with-pid-of-the-owning-task-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html