Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1285394

[PATCH 3.14 20/37] x86/cpu: Fix SMAP check in PVOPS environments

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.14 20/37] x86/cpu: Fix SMAP check in PVOPS environments
Date 2015-12-07 15:30 +0100
Message-ID <qD4XF-5GH-41@gated-at.bofh.it> (permalink)
References <qD4XE-5GH-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrew Cooper <andrew.cooper3@citrix.com>

commit 581b7f158fe0383b492acd1ce3fb4e99d4e57808 upstream.

There appears to be no formal statement of what pv_irq_ops.save_fl() is
supposed to return precisely.  Native returns the full flags, while lguest and
Xen only return the Interrupt Flag, and both have comments by the
implementations stating that only the Interrupt Flag is looked at.  This may
have been true when initially implemented, but no longer is.

To make matters worse, the Xen PVOP leaves the upper bits undefined, making
the BUG_ON() undefined behaviour.  Experimentally, this now trips for 32bit PV
guests on Broadwell hardware.  The BUG_ON() is consistent for an individual
build, but not consistent for all builds.  It has also been a sitting timebomb
since SMAP support was introduced.

Use native_save_fl() instead, which will obtain an accurate view of the AC
flag.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: <lguest@lists.ozlabs.org>
Cc: Xen-devel <xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/1433323874-6927-1-git-send-email-andrew.cooper3@citrix.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/cpu/common.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -280,10 +280,9 @@ __setup("nosmap", setup_disable_smap);
 
 static __always_inline void setup_smap(struct cpuinfo_x86 *c)
 {
-	unsigned long eflags;
+	unsigned long eflags = native_save_fl();
 
 	/* This should have been cleared long ago */
-	raw_local_save_flags(eflags);
 	BUG_ON(eflags & X86_EFLAGS_AC);
 
 	if (cpu_has(c, X86_FEATURE_SMAP)) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.14 00/37] 3.14.58-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 24/37] staging: rtl8712: Add device ID for Sitecom WLA2100 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 03/37] ppp: fix pppoe_dev deletion condition in pppoe_release() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 21/37] mac80211: fix driver RSSI event calculations Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 18/37] x86/setup: Fix low identity map for >= 2GB kernel range Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 35/37] ALSA: usb-audio: add packet size quirk for the Medeli DD305 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 20/37] x86/cpu: Fix SMAP check in PVOPS environments Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 25/37] Bluetooth: hidp: fix device disconnect on idle timeout Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 07/37] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 23/37] mwifiex: fix mwifiex_rdeeprom_read() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
  [PATCH 3.14 26/37] Bluetooth: ath3k: Add new AR3012 0930:021c id Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 14/37] ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 16/37] ARM: common: edma: Fix channel parameter for irq callbacks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 37/37] ALSA: usb-audio: work around CH345 input SysEx corruption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 28/37] can: sja1000: clear interrupts on start Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 04/37] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 09/37] packet: race condition in packet_bind Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 02/37] macvtap: unbreak receiving of gro skb with frag list Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 17/37] x86/setup: Extend low identity map to cover whole kernel range Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 27/37] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 36/37] ALSA: usb-audio: prevent CH345 multiport output SysEx corruption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 06/37] stmmac: Correctly report PTP capabilities. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 13/37] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 08/37] net: avoid NULL deref in inet_ctl_sock_destroy() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 29/37] arm64: Fix compat register mappings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 05/37] net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 30/37] usblp: do not set TASK_INTERRUPTIBLE before lock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
  [PATCH 3.14 12/37] RDS: verify the underlying transport exists before creating a connection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 17:30 +0100
  [PATCH 3.14 11/37] virtio-net: drop NETIF_F_FRAGLIST Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 17:30 +0100
  Re: [PATCH 3.14 00/37] 3.14.58-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-12-07 18:20 +0100
  Re: [PATCH 3.14 00/37] 3.14.58-stable review Guenter Roeck <linux@roeck-us.net> - 2015-12-07 22:20 +0100
    Re: [PATCH 3.14 00/37] 3.14.58-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-09 04:30 +0100

csiph-web