From: Andrew Morton <akpm@osdl.org>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [patch 5/13] s390: show_task oops.
Date: Thu, 12 Jan 2006 16:58:26 -0800 [thread overview]
Message-ID: <20060112165826.5843e34c.akpm@osdl.org> (raw)
In-Reply-To: <20060112171516.GF16629@skybase.boeblingen.de.ibm.com>
Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:
>
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
>
> [patch 5/13] s390: show_task oops.
>
> The show_task function walks the kernel stack backchain of
> processes assuming that the processes are not running. Since
> this assumption is not correct walking the backchain can lead
> to an addressing exception and therefore to a kernel hang.
> So prevent the kernel hang (you still get incorrect results)
> verity that all read accesses are within the bounds of the
> kernel stack before performing them.
>
This one needs to be thought about and tested versus the just-merged
s390-task_stack_page.patch. I guess it'll still work, but some of the
pretty new accessors could be used in there, at least.
> --- linux-2.6/arch/s390/kernel/process.c 2006-01-12 15:43:19.000000000 +0100
> +++ linux-2.6-patched/arch/s390/kernel/process.c 2006-01-12 15:43:55.000000000 +0100
> @@ -58,10 +58,19 @@ asmlinkage void ret_from_fork(void) __as
> */
> unsigned long thread_saved_pc(struct task_struct *tsk)
> {
> - struct stack_frame *sf;
> + struct stack_frame *sf, *low, *high;
>
> - sf = (struct stack_frame *) tsk->thread.ksp;
> - sf = (struct stack_frame *) sf->back_chain;
> + if (!tsk || !tsk->thread_info)
> + return 0;
> + low = (struct stack_frame *) tsk->thread_info;
> + high = (struct stack_frame *)
> + ((unsigned long) tsk->thread_info + THREAD_SIZE) - 1;
> + sf = (struct stack_frame *) (tsk->thread.ksp & PSW_ADDR_INSN);
> + if (sf <= low || sf > high)
> + return 0;
> + sf = (struct stack_frame *) (sf->back_chain & PSW_ADDR_INSN);
> + if (sf <= low || sf > high)
> + return 0;
> return sf->gprs[8];
> }
>
next prev parent reply other threads:[~2006-01-13 0:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 17:15 Martin Schwidefsky
2006-01-13 0:58 ` Andrew Morton [this message]
2006-01-13 8:45 ` Martin Schwidefsky
2006-01-13 12:24 ` [PATCH] s390: show_task oops fix Heiko Carstens
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=20060112165826.5843e34c.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/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®