diff -ru linux-2.4.17/arch/i386/kernel/entry.S linux-2.4.17-stk16/arch/i386/kernel/entry.S
--- linux-2.4.17/arch/i386/kernel/entry.S	Sat Nov  3 10:18:49 2001
+++ linux-2.4.17-stk16/arch/i386/kernel/entry.S	Thu May 16 00:01:31 2002
@@ -129,7 +129,7 @@
 .previous
 
 #define GET_CURRENT(reg) \
-	movl $-8192, reg; \
+	movl $-16384, reg; \
 	andl %esp, reg
 
 ENTRY(lcall7)
@@ -144,7 +144,7 @@
 	movl %ecx,CS(%esp)	#
 	movl %esp,%ebx
 	pushl %ebx
-	andl $-8192,%ebx	# GET_CURRENT
+	andl $-16384,%ebx	# GET_CURRENT
 	movl exec_domain(%ebx),%edx	# Get the execution domain
 	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
 	pushl $0x7
@@ -165,7 +165,7 @@
 	movl %ecx,CS(%esp)	#
 	movl %esp,%ebx
 	pushl %ebx
-	andl $-8192,%ebx	# GET_CURRENT
+	andl $-16384,%ebx	# GET_CURRENT
 	movl exec_domain(%ebx),%edx	# Get the execution domain
 	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
 	pushl $0x27
diff -ru linux-2.4.17/arch/i386/kernel/head.S linux-2.4.17-stk16/arch/i386/kernel/head.S
--- linux-2.4.17/arch/i386/kernel/head.S	Thu Jun 21 03:00:53 2001
+++ linux-2.4.17-stk16/arch/i386/kernel/head.S	Thu May 16 00:01:31 2002
@@ -320,7 +320,7 @@
 	ret
 
 ENTRY(stack_start)
-	.long SYMBOL_NAME(init_task_union)+8192
+	.long SYMBOL_NAME(init_task_union)+16384
 	.long __KERNEL_DS
 
 /* This is the default interrupt "handler" :-) */
diff -ru linux-2.4.17/arch/i386/kernel/process.c linux-2.4.17-stk16/arch/i386/kernel/process.c
--- linux-2.4.17/arch/i386/kernel/process.c	Fri Oct  5 10:42:54 2001
+++ linux-2.4.17-stk16/arch/i386/kernel/process.c	Thu May 16 00:01:32 2002
@@ -805,12 +805,12 @@
 		return 0;
 	stack_page = (unsigned long)p;
 	esp = p->thread.esp;
-	if (!stack_page || esp < stack_page || esp > 8188+stack_page)
+	if (!stack_page || esp < stack_page || esp > 16384-4+stack_page)
 		return 0;
 	/* include/asm-i386/system.h:switch_to() pushes ebp last. */
 	ebp = *(unsigned long *) esp;
 	do {
-		if (ebp < stack_page || ebp > 8184+stack_page)
+		if (ebp < stack_page || ebp > 16384-8+stack_page)
 			return 0;
 		eip = *(unsigned long *) (ebp+4);
 		if (eip < first_sched || eip >= last_sched)
diff -ru linux-2.4.17/arch/i386/kernel/smpboot.c linux-2.4.17-stk16/arch/i386/kernel/smpboot.c
--- linux-2.4.17/arch/i386/kernel/smpboot.c	Wed May 15 23:19:54 2002
+++ linux-2.4.17-stk16/arch/i386/kernel/smpboot.c	Thu May 16 00:01:32 2002
@@ -819,7 +819,7 @@
 
 	/* So we see what's up   */
 	printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip);
-	stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle);
+	stack_start.esp = (void *) idle->thread.esp;
 
 	/*
 	 * This grunge runs the startup process for
diff -ru linux-2.4.17/arch/i386/kernel/traps.c linux-2.4.17-stk16/arch/i386/kernel/traps.c
--- linux-2.4.17/arch/i386/kernel/traps.c	Mon Oct  1 04:26:08 2001
+++ linux-2.4.17-stk16/arch/i386/kernel/traps.c	Thu May 16 00:01:32 2002
@@ -158,7 +158,7 @@
 	unsigned long esp = tsk->thread.esp;
 
 	/* User space on another CPU? */
-	if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
+	if ((esp ^ (unsigned long)tsk) & ~(THREAD_SIZE-1))
 		return;
 	show_trace((unsigned long *)esp);
 }
diff -ru linux-2.4.17/arch/i386/lib/getuser.S linux-2.4.17-stk16/arch/i386/lib/getuser.S
--- linux-2.4.17/arch/i386/lib/getuser.S	Tue Jan 13 06:42:52 1998
+++ linux-2.4.17-stk16/arch/i386/lib/getuser.S	Thu May 16 00:01:32 2002
@@ -28,7 +28,7 @@
 .globl __get_user_1
 __get_user_1:
 	movl %esp,%edx
-	andl $0xffffe000,%edx
+	andl $-16384,%edx
 	cmpl addr_limit(%edx),%eax
 	jae bad_get_user
 1:	movzbl (%eax),%edx
@@ -41,7 +41,7 @@
 	addl $1,%eax
 	movl %esp,%edx
 	jc bad_get_user
-	andl $0xffffe000,%edx
+	andl $-16384,%edx
 	cmpl addr_limit(%edx),%eax
 	jae bad_get_user
 2:	movzwl -1(%eax),%edx
@@ -54,7 +54,7 @@
 	addl $3,%eax
 	movl %esp,%edx
 	jc bad_get_user
-	andl $0xffffe000,%edx
+	andl $-16384,%edx
 	cmpl addr_limit(%edx),%eax
 	jae bad_get_user
 3:	movl -3(%eax),%edx
diff -ru linux-2.4.17/arch/i386/vmlinux.lds linux-2.4.17-stk16/arch/i386/vmlinux.lds
--- linux-2.4.17/arch/i386/vmlinux.lds	Tue Jul  3 06:40:14 2001
+++ linux-2.4.17-stk16/arch/i386/vmlinux.lds	Thu May 16 00:01:32 2002
@@ -36,7 +36,7 @@
 
   _edata = .;			/* End of data section */
 
-  . = ALIGN(8192);		/* init_task */
+  . = ALIGN(16384);		/* init_task */
   .data.init_task : { *(.data.init_task) }
 
   . = ALIGN(4096);		/* Init code and data */
diff -ru linux-2.4.17/include/asm-i386/current.h linux-2.4.17-stk16/include/asm-i386/current.h
--- linux-2.4.17/include/asm-i386/current.h	Sat Aug 15 08:35:22 1998
+++ linux-2.4.17-stk16/include/asm-i386/current.h	Thu May 16 00:01:32 2002
@@ -6,7 +6,7 @@
 static inline struct task_struct * get_current(void)
 {
 	struct task_struct *current;
-	__asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
+	__asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(16384UL-1)));
 	return current;
  }
  
diff -ru linux-2.4.17/include/asm-i386/hw_irq.h linux-2.4.17-stk16/include/asm-i386/hw_irq.h
--- linux-2.4.17/include/asm-i386/hw_irq.h	Fri Nov 23 04:46:18 2001
+++ linux-2.4.17-stk16/include/asm-i386/hw_irq.h	Thu May 16 00:01:32 2002
@@ -115,7 +115,7 @@
 
 #define GET_CURRENT \
 	"movl %esp, %ebx\n\t" \
-	"andl $-8192, %ebx\n\t"
+	"andl $-16384, %ebx\n\t"
 
 /*
  *	SMP has a few special interrupts for IPI messages
diff -ru linux-2.4.17/include/asm-i386/processor.h linux-2.4.17-stk16/include/asm-i386/processor.h
--- linux-2.4.17/include/asm-i386/processor.h	Fri Nov 23 04:46:19 2001
+++ linux-2.4.17-stk16/include/asm-i386/processor.h	Thu May 16 00:01:32 2002
@@ -444,12 +444,13 @@
 }
 
 unsigned long get_wchan(struct task_struct *p);
-#define KSTK_EIP(tsk)	(((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
-#define KSTK_ESP(tsk)	(((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
+#define KSTK_EIP(tsk)	(((unsigned long *)(16384+(unsigned long)(tsk)))[-5])
+#define KSTK_ESP(tsk)	(((unsigned long *)(16384+(unsigned long)(tsk)))[-2])
 
-#define THREAD_SIZE (2*PAGE_SIZE)
-#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
-#define free_task_struct(p) free_pages((unsigned long) (p), 1)
+#define THREAD_ORDER	2
+#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
+#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#define free_task_struct(p) free_pages((unsigned long) (p), THREAD_ORDER)
 #define get_task_struct(tsk)      atomic_inc(&virt_to_page(tsk)->count)
 
 #define init_task	(init_task_union.task)
diff -ru linux-2.4.17/include/linux/sched.h linux-2.4.17-stk16/include/linux/sched.h
--- linux-2.4.17/include/linux/sched.h	Wed May 15 23:20:10 2002
+++ linux-2.4.17-stk16/include/linux/sched.h	Thu May 16 00:22:44 2002
@@ -410,8 +410,12 @@
 
 /* journalling filesystem info */
 	void *journal_info;
+	unsigned int filler[2048]; /* 8K bytes */
+	unsigned int signature;
 };
 
+#define TASK_STRUCT_SIGNATURE 0x2396B79A
+
 /*
  * Per process flags
  */
@@ -501,11 +505,12 @@
     blocked:		{{0}},						\
     alloc_lock:		SPIN_LOCK_UNLOCKED,				\
     journal_info:	NULL,						\
+    signature:		TASK_STRUCT_SIGNATURE,				\
 }
 
 
 #ifndef INIT_TASK_SIZE
-# define INIT_TASK_SIZE	2048*sizeof(long)
+# define INIT_TASK_SIZE	16384
 #endif
 
 union task_union {
@@ -927,6 +932,12 @@
 	return res;
 }
 
+static inline void check_stkoverflow(void);
+static inline void check_stkoverflow() {
+	if (current->signature != TASK_STRUCT_SIGNATURE )
+		BUG();
+}
+
 #endif /* __KERNEL__ */
 
 #endif
diff -ru linux-2.4.17/kernel/sched.c linux-2.4.17-stk16/kernel/sched.c
--- linux-2.4.17/kernel/sched.c	Wed May 15 23:20:11 2002
+++ linux-2.4.17-stk16/kernel/sched.c	Thu May 16 00:12:45 2002
@@ -553,7 +553,7 @@
 	struct list_head *tmp;
 	int this_cpu, c;
 
-
+	check_stkoverflow();
 	spin_lock_prefetch(&runqueue_lock);
 
 	if (!current->active_mm) BUG();
