Received: by 10.223.185.116 with SMTP id b49csp739980wrg; Wed, 21 Feb 2018 06:13:13 -0800 (PST) X-Google-Smtp-Source: AH8x227mCHxOIIB6UHcrpJMaN3X9dKBGnwhXgHUGi6AgO8w+HKiPne95cbI2iro1/1suNpyPmLAD X-Received: by 10.98.7.73 with SMTP id b70mr3439884pfd.39.1519222393871; Wed, 21 Feb 2018 06:13:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519222393; cv=none; d=google.com; s=arc-20160816; b=w5gLJ5OGx2nsERaPPxwxVKLN3anisffOAhYe1l7/SSDYsC4EhC8v0G73zmuFSn38bL HPEgaKIFRXyZxy1hONX52RJFvAkAxkWufMQblGTOnddea1zVZvs4xxbfEzsbQwcdMwnN hgrcMFa1AyqIWoLkqlxl5qPH0UDDR6u0WfgmpW0La9FjElubfretwP38+QqWSY4+0aAL nPNVOr56FN8aydme5BarRxxq5AW9V7AayW+lGrG+HQD+mG1R/NFR1fDysxnWSj8RVOat JpCX3KutnABLbw76EmNbYI2K3swnxBBC2PaEr/FowRdP2ok0/LpYtB7tboSE4udMAcu5 XxYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sPXVGmUo0KEbJ6ImmLViOflp43XSswBgcGICGJwxGHo=; b=l93ZYTGOR4oI25yUvgmW+C84USxKpi0Vg3oV4TCnpivQxSWZ4d/gItwl5DpgX3wetE rpRSXLXvVDNDEUmTHXNBtvsXf+/y9kN43EZZVwkCtKncKnzw8Hh76w27McX0/O3SeryN 21qIQCwnxDWm1N2SxilOKE5VXwVE+EXlc16407Rz3AWMm2/DNvIPjTEnN8SVR46huep2 47UFYbHiMifW+t1vGHn6uGFlemuvGC8bD9pJLV/jqfP4eeVywkndpG8XuOn6/SvZ7XDb LmI4G7Q4D46R7O2ft6uFJfxy/ZaWmqug+ZJRcR6sqZZdc9uwkT6YKC+zGXW0fwTOmwCO DedA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si1617770plc.260.2018.02.21.06.12.59; Wed, 21 Feb 2018 06:13:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935814AbeBUOLp (ORCPT + 99 others); Wed, 21 Feb 2018 09:11:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37836 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935408AbeBUNBL (ORCPT ); Wed, 21 Feb 2018 08:01:11 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0B44F1075; Wed, 21 Feb 2018 13:00:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky , Chris Patterson Subject: [PATCH 4.14 038/167] x86/xen: init %gs very early to avoid page faults with stack protector Date: Wed, 21 Feb 2018 13:47:29 +0100 Message-Id: <20180221124526.680823597@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross commit 4f277295e54c5b7340e48efea3fc5cc21a2872b7 upstream. When running as Xen pv guest %gs is initialized some time after C code is started. Depending on stack protector usage this might be too late, resulting in page faults. So setup %gs and MSR_GS_BASE in assembly code already. Cc: stable@vger.kernel.org Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky Tested-by: Chris Patterson Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- arch/x86/xen/xen-head.S | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -9,7 +9,9 @@ #include #include +#include #include +#include #include #include @@ -35,6 +37,20 @@ ENTRY(startup_xen) mov %_ASM_SI, xen_start_info mov $init_thread_union+THREAD_SIZE, %_ASM_SP +#ifdef CONFIG_X86_64 + /* Set up %gs. + * + * The base of %gs always points to the bottom of the irqstack + * union. If the stack protector canary is enabled, it is + * located at %gs:40. Note that, on SMP, the boot cpu uses + * init data section till per cpu areas are set up. + */ + movl $MSR_GS_BASE,%ecx + movq $INIT_PER_CPU_VAR(irq_stack_union),%rax + cdq + wrmsr +#endif + jmp xen_start_kernel END(startup_xen) __FINIT