From: Michael Ellerman <patch-notifications@ellerman•id.au>
To: Michael Neuling <mikey@neuling•org>
Cc: Michael Neuling <mikey@neuling•org>,
Nicholas Piggin <npiggin@gmail•com>,
aneesh.kumar@linux•vnet.ibm.com, Breno Leitao <leitao@debian•org>,
linuxppc-dev@lists•ozlabs.org
Subject: Re: powerpc/tm: Avoid possible userspace r1 corruption on reclaim
Date: Wed, 26 Sep 2018 22:13:11 +1000 (AEST) [thread overview]
Message-ID: <42Kxfb3P3Pz9s5c@ozlabs.org> (raw)
In-Reply-To: <20180925093647.23723-1-mikey@neuling.org>
On Tue, 2018-09-25 at 09:36:47 UTC, Michael Neuling wrote:
> Current we store the userspace r1 to PACATMSCRATCH before finally
> saving it to the thread struct.
>
> In theory an exception could be taken here (like a machine check or
> SLB miss) that could write PACATMSCRATCH and hence corrupt the
> userspace r1. The SLB fault currently doesn't touch PACATMSCRATCH, but
> others do.
>
> We've never actually seen this happen but it's theoretically
> possible. Either way, the code is fragile as it is.
>
> This patch saves r1 to the kernel stack (which can't fault) before we
> turn MSR[RI] back on. PACATMSCRATCH is still used but only with
> MSR[RI] off. We then copy r1 from the kernel stack to the thread
> struct once we have MSR[RI] back on.
>
> Suggested-by: Breno Leitao <leitao@debian•org>
> Signed-off-by: Michael Neuling <mikey@neuling•org>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/96dc89d526ef77604376f06220e3d2
cheers
prev parent reply other threads:[~2018-09-26 12:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 9:36 [PATCH] powerpc/tm: Avoid possible userspace r1 corruption on reclaim Michael Neuling
2018-09-25 12:00 ` Michael Ellerman
2018-09-26 3:46 ` Michael Neuling
2018-09-27 6:41 ` Michael Ellerman
2018-09-26 12:13 ` Michael Ellerman [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=42Kxfb3P3Pz9s5c@ozlabs.org \
--to=patch-notifications@ellerman$(echo .)id.au \
--cc=aneesh.kumar@linux$(echo .)vnet.ibm.com \
--cc=leitao@debian$(echo .)org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=mikey@neuling$(echo .)org \
--cc=npiggin@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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