From owner-svn-src-all@FreeBSD.ORG Wed Nov 9 17:15:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B653C106566C; Wed, 9 Nov 2011 17:15:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6B278FC17; Wed, 9 Nov 2011 17:15:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA9HFp7k091834; Wed, 9 Nov 2011 17:15:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA9HFpeH091832; Wed, 9 Nov 2011 17:15:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201111091715.pA9HFpeH091832@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 Nov 2011 17:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227393 - head/sys/fs/procfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2011 17:15:51 -0000 Author: kib Date: Wed Nov 9 17:15:51 2011 New Revision: 227393 URL: http://svn.freebsd.org/changeset/base/227393 Log: 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 Modified: head/sys/fs/procfs/procfs_status.c Modified: head/sys/fs/procfs/procfs_status.c ============================================================================== --- head/sys/fs/procfs/procfs_status.c Wed Nov 9 17:13:41 2011 (r227392) +++ head/sys/fs/procfs/procfs_status.c Wed Nov 9 17:15:51 2011 (r227393) @@ -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;