Kernel-testers Development Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: a.beregalov@gmail.com
Cc: mikpe@it.uu.se, kernel-testers@vger.kernel.org,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: 2.6.26-rc: SPARC: Sun Ultra 10 can not boot
Date: Thu, 07 Aug 2008 23:01:39 -0700 (PDT)	[thread overview]
Message-ID: <20080807.230139.220174417.davem@davemloft.net> (raw)
In-Reply-To: <a4423d670807070859y74f529b5i60f04e0a37a01cd3@mail.gmail.com>

From: "Alexander Beregalov" <a.beregalov@gmail.com>
Date: Mon, 7 Jul 2008 19:59:04 +0400

> I have turned off LOCKDEP and it boots properly.
> 2.6.26-rc9-00005-g1b40a89
> 
> Mikael's config also does not contain LOCKDEP.

I have finally reproduced the problem locally and figured out the
bug.

Please try this patch:

sparc64: Fix end-of-stack checking in save_stack_trace().

Bug reported by Alexander Beregalov.

Before we dereference the stack frame or try to peek at the
pt_regs magic value, make sure the entire object is within
the kernel stack bounds.

Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c
index c73ce3f..c5576e8 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -25,13 +25,15 @@ void save_stack_trace(struct stack_trace *trace)
 
 		/* Bogus frame pointer? */
 		if (fp < (thread_base + sizeof(struct thread_info)) ||
-		    fp >= (thread_base + THREAD_SIZE))
+		    fp > (thread_base + THREAD_SIZE - sizeof(struct sparc_stackf)))
 			break;
 
 		sf = (struct sparc_stackf *) fp;
 		regs = (struct pt_regs *) (sf + 1);
 
-		if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
+		if (((unsigned long)regs <=
+		     (thread_base + THREAD_SIZE - sizeof(*regs))) &&
+		    (regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
 			if (!(regs->tstate & TSTATE_PRIV))
 				break;
 			pc = regs->tpc;

  reply	other threads:[~2008-08-08  6:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 14:07 2.6.26-rc: SPARC: Sun Ultra 10 can not boot Alexander Beregalov
2008-06-19 16:02 ` Alexander Beregalov
     [not found]   ` <a4423d670806190902l48c542e0i6a7380a2d3e7f520-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-06-19 23:10     ` David Miller
2008-06-20  2:00   ` David Miller
     [not found]     ` <20080619.190048.193701955.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-06-20 21:19       ` Alexander Beregalov
2008-06-20 21:21         ` David Miller
     [not found]           ` <a4423d670806201542o5415cad7p6b9a38b67252cee1@mail.gmail.com>
2008-06-20 22:51             ` David Miller
2008-06-20 23:12               ` Alexander Beregalov
2008-06-20 23:21                 ` David Miller
     [not found]                   ` <20080620.162135.203810660.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-06-20 23:36                     ` Alexander Beregalov
     [not found]                       ` <a4423d670806201636n4f3d107bk290ed831eb5eefb4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-07  9:19                         ` Alexander Beregalov
     [not found]                           ` <a4423d670807070219s2dd43aaia29713f5076ecd0d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-07 11:01                             ` David Miller
     [not found]                               ` <20080707.040126.178187777.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-07-07 13:05                                 ` Mikael Pettersson
     [not found]                                   ` <18546.5247.797478.66373-gq7oiAaKCbRt3AgVzhmPzw@public.gmane.org>
2008-07-07 15:59                                     ` Alexander Beregalov
2008-08-08  6:01                                       ` David Miller [this message]
2008-08-08  9:31                                         ` Alexander Beregalov
2008-08-08  9:40                                           ` David Miller
     [not found]                                             ` <20080808.024024.205614839.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-08 10:14                                               ` Alexander Beregalov
     [not found]                                                 ` <a4423d670808080314weed9178o9f9ef52803a68501-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-08 10:38                                                   ` David Miller
     [not found]                                                     ` <20080808.033811.129671951.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-08 10:56                                                       ` Alexander Beregalov
     [not found]                                                         ` <a4423d670808080356r6573102am8a1eb9dcc83910c8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-08 11:18                                                           ` David Miller
2008-08-08 11:52                                                             ` Alexander Beregalov
2008-08-08 23:17                                                               ` David Miller
2008-08-14  3:53                                                               ` David Miller
     [not found]                                                                 ` <20080813.205333.202202181.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-14 10:19                                                                   ` Alexander Beregalov
     [not found]                                                             ` <20080808.041814.41687650.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-08 14:28                                                               ` Alexander Beregalov

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=20080807.230139.220174417.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=a.beregalov@gmail.com \
    --cc=kernel-testers@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    --cc=sparclinux@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