Lock the thread lock around block that retrieves td_wmesg. Otherwise,

procfs could see a thread with assigned td_wchan but still NULL td_wmesg.

Reported and tested by:	pho
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2011-11-09 17:15:51 +00:00
parent ebd2498cdf
commit c8997bf02a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227393

View File

@ -113,12 +113,14 @@ procfs_doprocstatus(PFS_FILL_ARGS)
}
tdfirst = FIRST_THREAD_IN_PROC(p);
thread_lock(tdfirst);
if (tdfirst->td_wchan != NULL) {
KASSERT(tdfirst->td_wmesg != NULL,
("wchan %p has no wmesg", tdfirst->td_wchan));
wmesg = tdfirst->td_wmesg;
} else
wmesg = "nochan";
thread_unlock(tdfirst);
if (p->p_flag & P_INMEM) {
struct timeval start, ut, st;