mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.5.59: show_task() oops
Date: Sat, 18 Jan 2003 16:56:57 +0000	[thread overview]
Message-ID: <E18ZwHB-0007kw-00@flint.arm.linux.org.uk> (raw)

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.

--- orig/kernel/sched.c	Fri Jan 17 10:39:25 2003
+++ linux/kernel/sched.c	Sat Jan 18 14:01:39 2003
@@ -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 (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


                 reply	other threads:[~2003-01-18 16:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18ZwHB-0007kw-00@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®