Date: Sun, 1 Dec 2013 17:28:29 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258800 - head/sys/powerpc/aim Message-ID: <201312011728.rB1HSTUb029817@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312011728.rB1HSTUb029817>