From: Yu-cheng Yu <yu-cheng.yu@intel.com>
To: Dave Hansen <dave.hansen@intel.com>, Andy Lutomirski <luto@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H.J. Lu" <hjl.tools@gmail.com>, Ingo Molnar <mingo@redhat.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Tony Luck <tony.luck@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Weijiang Yang <weijiang.yang@intel.com>
Subject: Re: Random shadow stack pointer corruption
Date: Sat, 18 Jul 2020 16:34:05 -0700 [thread overview]
Message-ID: <14f3bee7569f229541852f61f0a1a88fcdec7249.camel@intel.com> (raw)
In-Reply-To: <d4b9d6a1-d413-b044-1d4a-512bbbf06d78@intel.com>
On Sat, 2020-07-18 at 15:41 -0700, Dave Hansen wrote:
> On 7/18/20 11:24 AM, Yu-cheng Yu wrote:
> > On Sat, 2020-07-18 at 11:00 -0700, Andy Lutomirski wrote:
> > > On Sat, Jul 18, 2020 at 10:58 AM Yu-cheng Yu <yu-cheng.yu@intel.com> wrote:
> > > > Hi,
> > > >
> > > > My shadow stack tests start to have random shadow stack pointer corruption after
> > > > v5.7 (excluding). The symptom looks like some locking issue or the kernel is
> > > > confused about which CPU a task is on. In later tip/master, this can be
> > > > triggered by creating two tasks and each does continuous
> > > > pthread_create()/pthread_join(). If the kernel has max_cpus=1, the issue goes
> > > > away. I also checked XSAVES/XRSTORS, but this does not seem to be an issue
> > > > coming from there.
> > >
> > > What do you mean "shadow stack pointer corruption"? Is SSP itself
> > > corrupt while running in the kernel? Is one of the MSRs getting
> > > corrupted? Is the memory to which the shadow stack points getting
> > > corrupted? Is the CPU rejecting an attempt to change SSP?
> >
> > What I see is, a new thread after ret_from_fork() and iret back to ring-3,
> > its shadow stack pointer (MSR_IA32_PL3_SSP) is corrupted.
>
> Does corrupt mean random? Or is it a valid stack address, just not for
> _this_ thread? Or NULL? Or is it a kernel address? Have you tried
> tracing *ALL* the WRMSR's and XRSTOR's that write to the MSR?
When a shadow stack address is changed, the address appears to be other task's.
I traced all WRMSR's and XRSTOR's. I also verified there have not been any
XRSTORS from a wrong buffer. When rc6 is tagged, I will re-base, test, and
share current patches.
next prev parent reply other threads:[~2020-07-18 23:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-18 17:57 Yu-cheng Yu
2020-07-18 18:00 ` Andy Lutomirski
2020-07-18 18:24 ` Yu-cheng Yu
2020-07-18 18:27 ` Andy Lutomirski
2020-07-18 22:41 ` Dave Hansen
2020-07-18 23:04 ` H.J. Lu
2020-07-18 23:34 ` Yu-cheng Yu [this message]
2020-07-29 0:35 ` H.J. Lu
2020-07-29 0:56 ` Andy Lutomirski
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=14f3bee7569f229541852f61f0a1a88fcdec7249.camel@intel.com \
--to=yu-cheng.yu@intel.com \
--cc=bigeasy@linutronix.de \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hjl.tools@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=ravi.v.shankar@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=weijiang.yang@intel.com \
--cc=x86@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®