All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Andy Lutomirski <luto@kernel.org>,
	"Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: lguest@lists.ozlabs.org,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	x86@kernel.org, xen-devel@lists.xensource.com,
	Borislav Petkov <bp@alien8.de>,
	david.vrabel@citrix.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 09:00:53 -0500	[thread overview]
Message-ID: <56D5A095.4050102@oracle.com> (raw)
In-Reply-To: <5cf8d92df1ad2965a2d8cdbb466af04da8dbbbc1.1456789731.git.luto@kernel.org>

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).

-boris

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

  reply	other threads:[~2016-03-01 14:00 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 [this message]
     [not found]       ` <56D5A095.4050102-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-03-01 15:44         ` Andy Lutomirski
2016-03-01 22:06           ` Luis R. Rodriguez
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=56D5A095.4050102@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=david.vrabel@citrix.com \
    --cc=lguest@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=mcgrof@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 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.