linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Juergen Gross <jgross@suse.com>,
	Jason Andryuk <jandryuk@gmail.com>
Subject: [PATCH 4.14 04/48] xen/PVH: Set up GS segment for stack canary
Date: Fri, 27 Jul 2018 11:59:49 +0200	[thread overview]
Message-ID: <20180727095918.941271116@linuxfoundation.org> (raw)
In-Reply-To: <20180727095918.503549522@linuxfoundation.org>

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

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

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

commit 98014068328c5574de9a4a30b604111fd9d8f901 upstream.

We are making calls to C code (e.g. xen_prepare_pvh()) which may use
stack canary (stored in GS segment).

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Cc: Jason Andryuk <jandryuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/xen/xen-pvh.S |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

--- a/arch/x86/xen/xen-pvh.S
+++ b/arch/x86/xen/xen-pvh.S
@@ -54,6 +54,9 @@
  * charge of setting up it's own stack, GDT and IDT.
  */
 
+#define PVH_GDT_ENTRY_CANARY	4
+#define PVH_CANARY_SEL		(PVH_GDT_ENTRY_CANARY * 8)
+
 ENTRY(pvh_start_xen)
 	cld
 
@@ -98,6 +101,12 @@ ENTRY(pvh_start_xen)
 	/* 64-bit entry point. */
 	.code64
 1:
+	/* Set base address in stack canary descriptor. */
+	mov $MSR_GS_BASE,%ecx
+	mov $_pa(canary), %eax
+	xor %edx, %edx
+	wrmsr
+
 	call xen_prepare_pvh
 
 	/* startup_64 expects boot_params in %rsi. */
@@ -107,6 +116,17 @@ ENTRY(pvh_start_xen)
 
 #else /* CONFIG_X86_64 */
 
+	/* Set base address in stack canary descriptor. */
+	movl $_pa(gdt_start),%eax
+	movl $_pa(canary),%ecx
+	movw %cx, (PVH_GDT_ENTRY_CANARY * 8) + 2(%eax)
+	shrl $16, %ecx
+	movb %cl, (PVH_GDT_ENTRY_CANARY * 8) + 4(%eax)
+	movb %ch, (PVH_GDT_ENTRY_CANARY * 8) + 7(%eax)
+
+	mov $PVH_CANARY_SEL,%eax
+	mov %eax,%gs
+
 	call mk_early_pgtbl_32
 
 	mov $_pa(initial_page_table), %eax
@@ -150,9 +170,13 @@ gdt_start:
 	.quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* __KERNEL_CS */
 #endif
 	.quad GDT_ENTRY(0xc092, 0, 0xfffff) /* __KERNEL_DS */
+	.quad GDT_ENTRY(0x4090, 0, 0x18)    /* PVH_CANARY_SEL */
 gdt_end:
 
-	.balign 4
+	.balign 16
+canary:
+	.fill 48, 1, 0
+
 early_stack:
 	.fill 256, 1, 0
 early_stack_end:



  parent reply	other threads:[~2018-07-27 10:01 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27  9:59 [PATCH 4.14 00/48] 4.14.59-stable review Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 02/48] MIPS: ath79: fix register address in ath79_ddr_wb_flush() Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 03/48] MIPS: Fix off-by-one in pci_resource_to_user() Greg Kroah-Hartman
2018-07-27  9:59 ` Greg Kroah-Hartman [this message]
2018-07-27  9:59 ` [PATCH 4.14 05/48] KVM: PPC: Check if IOMMU page is contained in the pinned physical page Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 06/48] drm/nouveau/drm/nouveau: Fix runtime PM leak in nv50_disp_atomic_commit() Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 07/48] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 08/48] bonding: set default miimon value for non-arp modes if not set Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 09/48] ip: hash fragments consistently Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 10/48] ip: in cmsg IP(V6)_ORIGDSTADDR call pskb_may_pull Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 11/48] net/mlx4_core: Save the qpn from the input modifier in RST2INIT wrapper Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 12/48] net: skb_segment() should not return NULL Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 13/48] net/mlx5: Adjust clock overflow work period Greg Kroah-Hartman
2018-07-27  9:59 ` [PATCH 4.14 14/48] net/mlx5e: Dont allow aRFS for encapsulated packets Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 15/48] net/mlx5e: Fix quota counting in aRFS expire flow Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 16/48] net/ipv6: Fix linklocal to global address with VRF Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 17/48] multicast: do not restore deleted record source filter mode to new one Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 18/48] net: phy: consider PHY_IGNORE_INTERRUPT in phy_start_aneg_priv Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 19/48] sock: fix sg page frag coalescing in sk_alloc_sg Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 20/48] rtnetlink: add rtnl_link_state check in rtnl_configure_link Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 21/48] vxlan: add new fdb alloc and create helpers Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 22/48] vxlan: make netlink notify in vxlan_fdb_destroy optional Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 23/48] vxlan: fix default fdb entry netlink notify ordering during netdev create Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 24/48] tcp: fix dctcp delayed ACK schedule Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 25/48] tcp: helpers to send special DCTCP ack Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 26/48] tcp: do not cancel delay-AcK on DCTCP special ACK Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 27/48] tcp: do not delay ACK in DCTCP upon CE status change Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 28/48] tcp: free batches of packets in tcp_prune_ofo_queue() Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 29/48] tcp: avoid collapses in tcp_prune_queue() if possible Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 30/48] tcp: detect malicious patterns in tcp_collapse_ofo_queue() Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 31/48] tcp: call tcp_drop() from tcp_data_queue_ofo() Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 32/48] tcp: add tcp_ooo_try_coalesce() helper Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 33/48] staging: speakup: fix wraparound in uaccess length check Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 34/48] usb: cdc_acm: Add quirk for Castles VEGA3000 Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 35/48] usb: core: handle hub C_PORT_OVER_CURRENT condition Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 37/48] usb: gadget: f_fs: Only return delayed status when len is 0 Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 38/48] driver core: Partially revert "driver core: correct devices shutdown order" Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 39/48] can: xilinx_can: fix RX loop if RXNEMP is asserted without RXOK Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 40/48] can: xilinx_can: fix power management handling Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 41/48] can: xilinx_can: fix recovery from error states not being propagated Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 42/48] can: xilinx_can: fix device dropping off bus on RX overrun Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 43/48] can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 44/48] can: xilinx_can: fix incorrect clear of non-processed interrupts Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 45/48] can: xilinx_can: fix RX overflow interrupt not being enabled Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 46/48] can: peak_canfd: fix firmware < v3.3.0: limit allocation to 32-bit DMA addr only Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 47/48] can: m_can.c: fix setup of CCCR register: clear CCCR NISO bit before checking can.ctrlmode Greg Kroah-Hartman
2018-07-27 10:00 ` [PATCH 4.14 48/48] turn off -Wattribute-alias Greg Kroah-Hartman
2018-07-27 17:31 ` [PATCH 4.14 00/48] 4.14.59-stable review Guenter Roeck
2018-07-27 19:55 ` Shuah Khan
2018-07-28  6:54 ` Naresh Kamboju

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=20180727095918.941271116@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jandryuk@gmail.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.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).