From: Ralf Baechle <ralf@linux-mips.org>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: Avoid clobbering struct pt_regs in kthreads (v2).
Date: Thu, 9 Jul 2009 01:09:15 +0100 [thread overview]
Message-ID: <20090709000915.GA28139@linux-mips.org> (raw)
In-Reply-To: <20090708174040.GA4069@linux-mips.org>
On Wed, Jul 08, 2009 at 06:40:40PM +0100, Ralf Baechle wrote:
> > The resume() implementation octeon_switch.S examines the saved
> > cp0_status register. We were clobbering the entire pt_regs structure
> > in kernel threads leading to random crashes.
> >
> > When switching away from a kernel thread, the saved cp0_status is
> > examined and if bit 30 is set it is cleared and the CP2 state saved
> > into the pt_regs structure. Since the kernel thread stack overlaid
> > the pt_regs structure this resulted in a corrupt stack. When the
> > kthread with the corrupt stack was resumed, it could crash if it used
> > any of the data in the stack that was clobbered.
> >
> > We fix it by moving the kernel thread stack down so it doesn't overlay
> > pt_regs.
> >
> > Differences from v1: Don't adjust the sp by an additional 32 bytes, it
> > was not needed. Also fix up __KSTK_TOS and
> > task_pt_regs.
>
> Thanks for fixing and testing the issues I raised on IRC. Next I'm wonding
> what impact the uninitialized state of the stack frame we allocate may
> have. I think we're ok - but I need to stare at this for a few more
> minutes.
Applied :)
Ralf
prev parent reply other threads:[~2009-07-09 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-08 17:07 [PATCH] MIPS: Avoid clobbering struct pt_regs in kthreads (v2) David Daney
2009-07-08 17:40 ` Ralf Baechle
2009-07-09 0:09 ` Ralf Baechle [this message]
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=20090709000915.GA28139@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=ddaney@caviumnetworks.com \
--cc=linux-mips@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.