From owner-svn-src-head@FreeBSD.ORG Sun Dec 1 17:28:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC5DDEC7; Sun, 1 Dec 2013 17:28:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A840810F7; Sun, 1 Dec 2013 17:28:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB1HSTXn029819; Sun, 1 Dec 2013 17:28:29 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rB1HSTUb029817; Sun, 1 Dec 2013 17:28:29 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201312011728.rB1HSTUb029817@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Dec 2013 17:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258800 - head/sys/powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2013 17:28:29 -0000 Author: nwhitehorn Date: Sun Dec 1 17:28:28 2013 New Revision: 258800 URL: http://svnweb.freebsd.org/changeset/base/258800 Log: The kernel stack guard pages are only below the stack pointer, not above. Prevent erroneous detection of stack overflows on legitimate faults on the page after this thread's stack. MFC after: 3 days Modified: head/sys/powerpc/aim/trap_subr32.S head/sys/powerpc/aim/trap_subr64.S Modified: head/sys/powerpc/aim/trap_subr32.S ============================================================================== --- head/sys/powerpc/aim/trap_subr32.S Sun Dec 1 17:00:57 2013 (r258799) +++ head/sys/powerpc/aim/trap_subr32.S Sun Dec 1 17:28:28 2013 (r258800) @@ -664,11 +664,12 @@ disitrap: stw %r31,(PC_TEMPSAVE+CPUSAVE_AIM_DSISR)(%r1) #ifdef KDB - /* Try and detect a kernel stack overflow */ + /* Try to detect a kernel stack overflow */ mfsrr1 %r31 mtcr %r31 bt 17,realtrap /* branch is user mode */ mfsprg1 %r31 /* get old SP */ + clrrwi %r31,%r31,11 /* Round SP down to nearest page */ sub. %r30,%r31,%r30 /* SP - DAR */ bge 1f neg %r30,%r30 /* modulo value */ Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Sun Dec 1 17:00:57 2013 (r258799) +++ head/sys/powerpc/aim/trap_subr64.S Sun Dec 1 17:28:28 2013 (r258800) @@ -569,11 +569,12 @@ disitrap: std %r31,(PC_TEMPSAVE+CPUSAVE_AIM_DSISR)(%r1) #ifdef KDB - /* Try and detect a kernel stack overflow */ + /* Try to detect a kernel stack overflow */ mfsrr1 %r31 mtcr %r31 bt 17,realtrap /* branch is user mode */ mfsprg1 %r31 /* get old SP */ + clrrdi %r31,%r31,11 /* Round SP down to nearest page */ sub. %r30,%r31,%r30 /* SP - DAR */ bge 1f neg %r30,%r30 /* modulo value */