Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader

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

 



On 07/14, David Ahern wrote:
>
> On 7/14/15 1:47 PM, Oleg Nesterov wrote:
>>>
>>>   	if (show_flags & TASK_DIAG_SHOW_VMA) {
>>> +		/* 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 &&
>>> +		    !thread_group_leader(tsk))
>>> +			goto done;
>>> +
>>
>> This doesn't look right, group leader can be a zombie with ->mm == NULL,
>
> Seriously?

Yes, the main thread can do sys_exit() / pthread_exit(), although this
is not that common.

> I'll find some way to track whether VMAs have been dumped for
> a pid.

In case I confused you, the thread_group_leader() check and "goto done"
above are fine, just you can't trust tsk->mm, so

>>>   		if (i >= n)
>>>   			err = fill_vma(tsk, skb, cb, &progress, show_flags);
>>
>> so this probably needs something like find_lock_task_mm().
>
> ok.

Yes, you just need to (try) find a subthread with ->mm != NULL if !tsk->mm,
find_lock_task_mm() can help.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux