xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Xen Devel <xen-devel@lists.xensource.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	X86 ML <x86@kernel.org>, "Luis R. Rodriguez" <mcgrof@kernel.org>,
	lguest@lists.ozlabs.org, Borislav Petkov <bp@alien8.de>,
	David Vrabel <david.vrabel@citrix.com>,
	Andy Lutomirski <luto@kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v2 1/2] x86/entry/32: Introduce and use X86_BUG_ESPFIX instead of paravirt_enabled
Date: Tue, 1 Mar 2016 23:06:04 +0100	[thread overview]
Message-ID: <20160301220604.GF25240@wotan.suse.de> (raw)
In-Reply-To: <CALCETrWzko4H=affF=riW6PSn4mmWSR63C+VDh3uKooX1WV1fQ@mail.gmail.com>

On Tue, Mar 01, 2016 at 07:44:10AM -0800, Andy Lutomirski wrote:
> On Tue, Mar 1, 2016 at 6:00 AM, Boris Ostrovsky
> <boris.ostrovsky@oracle.com> wrote:
> > On 02/29/2016 06:50 PM, Andy Lutomirski wrote:
> >>
> >> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> >> index 91ddae732a36..c6ef4da8e4f4 100644
> >> --- a/arch/x86/kernel/cpu/common.c
> >> +++ b/arch/x86/kernel/cpu/common.c
> >> @@ -979,6 +979,31 @@ static void identify_cpu(struct cpuinfo_x86 *c)
> >>   #ifdef CONFIG_NUMA
> >>         numa_add_cpu(smp_processor_id());
> >>   #endif
> >> +
> >> +       /*
> >> +        * ESPFIX is a strange bug.  All real CPUs have it.  Paravirt
> >> +        * systems that run Linux at CPL > 0 may or may not have the
> >> +        * issue, but, even if they have the issue, there's absolutely
> >> +        * nothing we can do about it because we can't use the real IRET
> >> +        * instruction.
> >> +        *
> >> +        * NB: For the time being, only 32-bit kernels support
> >> +        * X86_BUG_ESPFIX as such.  64-bit kernels directly choose
> >> +        * whether to apply espfix using paravirt hooks.  If any
> >> +        * non-paravirt system ever shows up that does *not* have the
> >> +        * ESPFIX issue, we can change this.
> >> +        */
> >> +#ifdef CONFIG_X86_32
> >> +#ifdef CONFIG_PARAVIRT
> >> +       do {
> >> +               extern void native_iret(void);
> >> +               if (pv_cpu_ops.iret == native_iret)
> >> +                       set_cpu_bug(c, X86_BUG_ESPFIX);
> >> +       } while (0);
> >> +#else
> >> +       set_cpu_bug(c, X86_BUG_ESPFIX);
> >> +#endif
> >> +#endif
> >>   }
> >>     /*
> >
> >
> >
> > Alternatively, PV guests can clear X86_BUG_ESPFIX in their init code. E.g in
> > .set_cpu_features op, just like we do for X86_BUG_SYSRET_SS_ATTRS (although
> > this may require adding struct hypervisor_x86 for lguests. Which I think
> > they should have anyway).
> 
> I'm fine with that.
> 
> Luis, if you prefer that approach, can you do this and add the
> resulting patch to your series?  You're busily reworking that stuff
> anyway.

I would if I was certain of some things and I also understood this really well,
sadly I don't, but I'll ask questions and we'll see. Replies to follow the
thread.

  Luis

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-03-01 22:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 23:50 [PATCH v2 0/2] x86/entry/32: Get rid of paravirt_enabled in ESPFIX Andy Lutomirski
     [not found] ` <cover.1456789731.git.luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-02-29 23:50   ` [PATCH v2 1/2] x86/entry/32: Introduce and use X86_BUG_ESPFIX instead of paravirt_enabled Andy Lutomirski
2016-03-01 14:00     ` Boris Ostrovsky
     [not found]       ` <56D5A095.4050102-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-03-01 15:44         ` Andy Lutomirski
2016-03-01 22:06           ` Luis R. Rodriguez [this message]
2016-03-02  0:15       ` Luis R. Rodriguez
     [not found]         ` <20160302001554.GH25240-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org>
2016-03-03  0:33           ` Andy Lutomirski
2016-03-03  1:01             ` Luis R. Rodriguez
2016-03-01 23:11     ` Luis R. Rodriguez
     [not found]     ` <5cf8d92df1ad2965a2d8cdbb466af04da8dbbbc1.1456789731.git.luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-03-04  9:38       ` Borislav Petkov
2016-02-29 23:50   ` [PATCH v2 2/2] x86/asm-offsets: Remove PARAVIRT_enabled Andy Lutomirski
     [not found]     ` <b8adc42d21ea64d84589f8ee7540f8299df21577.1456789731.git.luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-03-04  9:38       ` Borislav Petkov
2016-03-01 22:45 ` [PATCH v2 0/2] x86/entry/32: Get rid of paravirt_enabled in ESPFIX Borislav Petkov
     [not found]   ` <20160301224512.GF22677-fF5Pk5pvG8Y@public.gmane.org>
2016-03-03  0:47     ` Andy Lutomirski
     [not found]       ` <CALCETrUcgHKYKn-K4EHF3mCOpuO3cW6Qnpa4k2ydKUAWVpQsSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-03 10:18         ` Borislav Petkov
     [not found]           ` <20160303101807.GA24621-fF5Pk5pvG8Y@public.gmane.org>
2016-03-03 23:49             ` 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=20160301220604.GF25240@wotan.suse.de \
    --to=mcgrof@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=david.vrabel@citrix.com \
    --cc=lguest@lists.ozlabs.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).