Subject: Re: kernel stack overflow detection
To: None <ragge@ludd.luth.se>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 06/26/2002 21:26:59
----Next_Part(Wed_Jun_26_21:26:59_2002_467)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

From: Anders Magnusson <ragge@ludd.luth.se>
Subject: Re: kernel stack overflow detection
Date: Wed, 26 Jun 2002 14:00:57 +0200 (MET DST)
> > 
> > KSTACK_CHECK_MAGIC scans kernel stack on each context switch.
> > so it affects performance too much.
> > 
> > KSTACK_CHECK_DR0 uses a debug register exclusively, so
> > people that want to use it for other purposes will not want to
> > enable it.
> > 
> Please don't force it to be on all arch's, vax already have guard pages 
> (red zones) for the kernel stacks.

it's off by default.

is attached patch is ok? i have no idea about vax..
(KSTACK_END means the lowest address in kernel stack
of the process. KSTACK_SIZE is size of the stack.)

---
YAMAMOTO Takashi<yamt@mwd.biglobe.ne.jp>

----Next_Part(Wed_Jun_26_21:26:59_2002_467)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="vax.diff"

Index: proc.h
===================================================================
RCS file: /cvs/cvsroot/syssrc/sys/arch/vax/include/proc.h,v
retrieving revision 1.2
diff -u -p -r1.2 proc.h
--- proc.h	1994/10/26 08:02:21	1.2
+++ proc.h	2002/06/26 12:20:17
@@ -47,3 +47,9 @@ struct mdproc {
 
 /* md_flags */
 #define	MDP_AST		0x0001	/* async trap pending */
+
+/* kernel stack params */
+#define	KSTACK_END(p)	\
+	((caddr_t)(p)->p_addr + (REDZONEADDR + VAX_NBPG))
+#define	KSTACK_SIZE	\
+	(USPACE - (REDZONEADDR + VAX_NBPG))

----Next_Part(Wed_Jun_26_21:26:59_2002_467)----