From: David Ahern <[email protected]> threads of a process share the same VMAs, so when dumping all threads for all processes only push vma data for group leader.
Signed-off-by: David Ahern <[email protected]> Signed-off-by: Andrey Vagin <[email protected]> --- fs/proc/task_diag.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/proc/task_diag.c b/fs/proc/task_diag.c index e0f0b03..00db32d 100644 --- a/fs/proc/task_diag.c +++ b/fs/proc/task_diag.c @@ -433,7 +433,17 @@ static int task_diag_fill(struct task_struct *tsk, struct sk_buff *skb, } if (show_flags & TASK_DIAG_SHOW_VMA) { - if (i >= n) + bool dump_vma = true; + + /* if the request is to dump all threads of all processes + * only show VMAs for group leader. + */ + if ((req->dump_strategy == TASK_DIAG_DUMP_ALL_THREAD || + req->dump_strategy == TASK_DIAG_DUMP_THREAD) && + !thread_group_leader(tsk)) + dump_vma = false; + + if (dump_vma && i >= n) err = fill_vma(tsk, skb, cb, &progress, show_flags); if (err) goto err; -- 2.5.5

