patch-2.1.117 linux/fs/proc/array.c

Next file: linux/fs/super.c
Previous file: linux/fs/nfs/write.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.116/linux/fs/proc/array.c linux/fs/proc/array.c
@@ -485,16 +485,18 @@
 		return 0;
 #if defined(__i386__)
 	{
-		unsigned long ebp, eip;
+		unsigned long ebp, esp, eip;
 		unsigned long stack_page;
 		int count = 0;
 
-		stack_page = 4096 + (unsigned long)p;
-		if (!stack_page)
+		stack_page = (unsigned long)p;
+		esp = p->tss.esp;
+		if (!stack_page || esp < stack_page || esp >= 8188+stack_page)
 			return 0;
-		ebp = p->tss.ebp;
+		/* include/asm-i386/system.h:switch_to() pushes ebp last. */
+		ebp = *(unsigned long *) esp;
 		do {
-			if (ebp < stack_page || ebp >= 4092+stack_page)
+			if (ebp < stack_page || ebp >= 8188+stack_page)
 				return 0;
 			eip = *(unsigned long *) (ebp+4);
 			if (eip < first_sched || eip >= last_sched)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov