From owner-svn-src-all@FreeBSD.ORG Thu Dec 3 14:59:43 2009 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 07C58106566B; Thu, 3 Dec 2009 14:59:43 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB5268FC14; Thu, 3 Dec 2009 14:59:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB3Exgf2017320; Thu, 3 Dec 2009 14:59:42 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB3ExgeU017318; Thu, 3 Dec 2009 14:59:42 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200912031459.nB3ExgeU017318@svn.freebsd.org> From: Joseph Koshy Date: Thu, 3 Dec 2009 14:59:42 +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: r200060 - head/sys/dev/hwpmc 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: Thu, 03 Dec 2009 14:59:43 -0000 Author: jkoshy Date: Thu Dec 3 14:59:42 2009 New Revision: 200060 URL: http://svn.freebsd.org/changeset/base/200060 Log: Use a better check for a valid kernel stack address when capturing kernel call chains. Submitted by: Mark Unangst Tested by: fabient Modified: head/sys/dev/hwpmc/hwpmc_x86.c Modified: head/sys/dev/hwpmc/hwpmc_x86.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_x86.c Thu Dec 3 14:22:15 2009 (r200059) +++ head/sys/dev/hwpmc/hwpmc_x86.c Thu Dec 3 14:59:42 2009 (r200060) @@ -176,7 +176,8 @@ pmc_save_kernel_callchain(uintptr_t *cc, stackend = (uintptr_t) td->td_kstack + td->td_kstack_pages * PAGE_SIZE; if (PMC_IN_TRAP_HANDLER(pc) || - !PMC_IN_KERNEL(pc) || !PMC_IN_KERNEL(r) || + !PMC_IN_KERNEL(pc) || + !PMC_IN_KERNEL_STACK(r, stackstart, stackend) || !PMC_IN_KERNEL_STACK(sp, stackstart, stackend) || !PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) return (1); @@ -221,7 +222,7 @@ pmc_save_kernel_callchain(uintptr_t *cc, r = fp + sizeof(uintptr_t); if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend) || - !PMC_IN_KERNEL(r)) + !PMC_IN_KERNEL_STACK(r, stackstart, stackend)) break; pc = *(uintptr_t *) r; fp = *(uintptr_t *) fp;