Skip to contentSkip to conversation

2.5.59: show_task() oops

PATCH New Russell King 1 participant 1 message Jan 18, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.59: show_task() oops

show_task() attempts to calculate the amount of free space which hasn't been written to on the kernel stack by reading from the base of the kernel stack upwards.

However, it mistakenly uses the task_struct pointer as the base of the stack, which it isn't, and this can cause an oops.

Here is a patch which uses the task thread pointer instead, which should be located at the bottom of the kernel stack. It appears this was missed when the thread structure was introduced.

kernel/sched.c +1 -1
@@ -2057,7 +2057,7 @@
 		printk(" %016lx ", thread_saved_pc(p));
 #endif
 	{
-		unsigned long * n = (unsigned long *) (p+1);
+		unsigned long * n = (unsigned long *) (p->thread_info+1);
 		while (!*n)
 			n++;
 		free = (unsigned long) n - (unsigned long)(p+1);

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html