Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 2011 20:24:52 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r229022 - stable/8/sys/fs/procfs
Message-ID:  <201112302024.pBUKOqha028927@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Dec 30 20:24:52 2011
New Revision: 229022
URL: http://svn.freebsd.org/changeset/base/229022

Log:
  MFC r227393:
  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.

Modified:
  stable/8/sys/fs/procfs/procfs_status.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/fs/procfs/procfs_status.c
==============================================================================
--- stable/8/sys/fs/procfs/procfs_status.c	Fri Dec 30 20:21:53 2011	(r229021)
+++ stable/8/sys/fs/procfs/procfs_status.c	Fri Dec 30 20:24:52 2011	(r229022)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112302024.pBUKOqha028927>