From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Lutomirski <luto@kernel.org>
Cc: Lars Wendler <wendler.lars@web.de>,
LKML <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>,
Borislav Betkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Greg KH <gregkh@linuxfoundation.org>,
Laura Abbott <labbott@redhat.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>
Subject: Re: CONFIG_PAGE_TABLE_ISOLATION=y on x86_64 causes gcc to segfault when building x86_32 binaries
Date: Wed, 3 Jan 2018 23:22:57 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1801032322160.1957@nanos> (raw)
In-Reply-To: <CALCETrW8RD2vtcUjYoq07DEiLoXYxqXuxD7xujOtuF=UGjNYvw@mail.gmail.com>
On Wed, 3 Jan 2018, Andy Lutomirski wrote:
> On Wed, Jan 3, 2018 at 10:52 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > On Wed, 3 Jan 2018, Thomas Gleixner wrote:
> >
> >> On Wed, 3 Jan 2018, Lars Wendler wrote:
> >> > Am Wed, 3 Jan 2018 13:05:38 +0100 (CET)
> >> > schrieb Thomas Gleixner <tglx@linutronix.de>:
> >> > > Also can you please try Linus v4.15-rc6 with PTI enabled so we can see
> >> > > whether that's a backport issue or a general one?
> >> >
> >> > Same problem with 4.15-rc6. So I suppose that means it's a general
> >> > issue.
> >>
> >> Just a shot in the dark as I just decoded another issue on a AMD CPU. Can
> >> you please try the patch below?
> >
> > Ok. Found the real issue. This is a problem on AMD boxen.
> >
> > Fix below.
> >
> > Can Xen folks please have a look at that as well?
> >
> > Thanks,
> >
> > tglx
> >
> > 8<-------------------
> >
> > arch/x86/entry/entry_64_compat.S | 13 ++++++-------
> > 1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > --- a/arch/x86/entry/entry_64_compat.S
> > +++ b/arch/x86/entry/entry_64_compat.S
> > @@ -190,8 +190,13 @@ ENTRY(entry_SYSCALL_compat)
> > /* Interrupts are off on entry. */
> > swapgs
> >
> > - /* Stash user ESP and switch to the kernel stack. */
> > + /* Stash user ESP */
> > movl %esp, %r8d
> > +
> > + /* Use %rsp as scratch reg. User ESP is stashed in r8 */
> > + SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp
> > +
> > + /* Switch to the kernel stack */
> > movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
> >
> > /* Construct struct pt_regs on stack */
> > @@ -220,12 +225,6 @@ GLOBAL(entry_SYSCALL_compat_after_hwfram
> > pushq $0 /* pt_regs->r15 = 0 */
> >
> > /*
> > - * We just saved %rdi so it is safe to clobber. It is not
> > - * preserved during the C calls inside TRACE_IRQS_OFF anyway.
> > - */
> > - SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi
> > -
> > - /*
> > * User mode is traced as though IRQs are on, and SYSENTER
> > * turned them off.
> > */
>
> What's the issue that this is fixing?
> > movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
before switching CR3 is obviously broken ...
next prev parent reply other threads:[~2018-01-03 22:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180103123723.1dd26828@abudhabi.paradoxon.rec>
2018-01-03 11:57 ` CONFIG_PAGE_TABLE_ISOLATION=y on x86_64 causes gcc to segfault when building x86_32 binaries Thomas Gleixner
2018-01-03 12:05 ` Thomas Gleixner
2018-01-03 13:30 ` Lars Wendler
2018-01-03 15:21 ` Thomas Gleixner
2018-01-03 15:42 ` Dave Hansen
2018-01-03 18:52 ` Thomas Gleixner
2018-01-03 22:12 ` Laura Abbott
2018-01-03 22:14 ` Andy Lutomirski
2018-01-03 22:22 ` Thomas Gleixner [this message]
2018-01-03 23:43 ` Andy Lutomirski
2018-01-03 22:27 ` Dave Hansen
2018-01-03 22:25 ` [tip:x86/pti] x86/pti: Switch to kernel CR3 at early in entry_SYSCALL_compat() tip-bot for Thomas Gleixner
2018-01-03 23:46 ` CONFIG_PAGE_TABLE_ISOLATION=y on x86_64 causes gcc to segfault when building x86_32 binaries Lars Wendler
2018-01-04 2:44 ` Boris Ostrovsky
2018-01-03 15:40 ` Borislav Petkov
2018-01-03 23:22 ` Lars Wendler
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=alpine.DEB.2.20.1801032322160.1957@nanos \
--to=tglx@linutronix.de \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgross@suse.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=wendler.lars@web.de \
--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;
as well as URLs for NNTP newsgroup(s).