Skip to contentSkip to conversation

stack bounds checking

PATCH New William Lee Irwin III 1 participant 6 messages Apr 17, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover stack bounds checking

The stack is now shared with struct thread_info on most arches, not task_t. This patch series attempts to sweep up the remaining arches in need of updates. This mostly affects get_wchan() and stack usage debug.

-- wli

#1 lore raw

PATCH 1/5 h8300 stack bounds checking

arch/h8300/kernel/process.c +1 -1
Index: wli-2.6.5-mm6/arch/h8300/kernel/process.c
===================================================================
@@ -277,7 +277,7 @@
 	stack_page = (unsigned long)p;
 	fp = ((struct pt_regs *)p->thread.ksp)->er6;
 	do {
-		if (fp < stack_page+sizeof(struct task_struct) ||
+		if (fp < stack_page+sizeof(struct thread_info) ||
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
#2 lore raw

PATCH 2/5 m68k stack bounds checking

arch/m68k/kernel/process.c +1 -1
Index: wli-2.6.5-mm6/arch/m68k/kernel/process.c
===================================================================
@@ -392,7 +392,7 @@
 	stack_page = (unsigned long)(p->thread_info);
 	fp = ((struct switch_stack *)p->thread.ksp)->a6;
 	do {
-		if (fp < stack_page+sizeof(struct task_struct) ||
+		if (fp < stack_page+sizeof(struct thread_info) ||
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
#3 lore raw

PATCH 3/5 m68knommu stack bounds checking

arch/m68knommu/kernel/process.c +1 -1
Index: wli-2.6.5-mm6/arch/m68knommu/kernel/process.c
===================================================================
@@ -415,7 +415,7 @@
 	stack_page = (unsigned long)p;
 	fp = ((struct switch_stack *)p->thread.ksp)->a6;
 	do {
-		if (fp < stack_page+sizeof(struct task_struct) ||
+		if (fp < stack_page+sizeof(struct thread_info) ||
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
#4 lore raw

PATCH 4/5 ppc32 stack bounds checking

arch/ppc/kernel/process.c +1 -1
Index: wli-2.6.5-mm6/arch/ppc/kernel/process.c
===================================================================
@@ -83,7 +83,7 @@
 unsigned long
 task_top(struct task_struct *tsk)
 {
-	return ((unsigned long)tsk) + sizeof(struct task_struct);
+	return ((unsigned long)tsk) + sizeof(struct thread_info);
 }
 
 /* check to make sure the kernel stack is healthy */
#5 lore raw

PATCH 5/5 sparc32 stack bounds checking

arch/sparc/kernel/process.c +2 -2
Index: wli-2.6.5-mm6/arch/sparc/kernel/process.c
===================================================================
@@ -318,7 +318,7 @@
 	fp = (unsigned long) _ksp;
 	do {
 		/* Bogus frame pointer? */
-		if (fp < (task_base + sizeof(struct task_struct)) ||
+		if (fp < (task_base + sizeof(struct thread_info)) ||
 		    fp >= (task_base + (PAGE_SIZE << 1)))
 			break;
 		rw = (struct reg_window *) fp;
@@ -710,7 +710,7 @@
 	fp = task->thread_info->ksp + bias;
 	do {
 		/* Bogus frame pointer? */
-		if (fp < (task_base + sizeof(struct task_struct)) ||
+		if (fp < (task_base + sizeof(struct thread_info)) ||
 		    fp >= (task_base + (2 * PAGE_SIZE)))
 			break;
 		rw = (struct reg_window *) fp;