Received: by 10.223.185.116 with SMTP id b49csp1024812wrg; Wed, 21 Feb 2018 10:46:03 -0800 (PST) X-Google-Smtp-Source: AH8x226lfjPLfjYAbJ/eQz7EzHjj7Sn9fUY4Wyv0LOcpnOQ7nidamANrqwQiYRRihFSFSJMuuaWM X-Received: by 10.99.113.90 with SMTP id b26mr3434650pgn.10.1519238763669; Wed, 21 Feb 2018 10:46:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238763; cv=none; d=google.com; s=arc-20160816; b=Mq/rDUjcrs5o0YDvPzo3oMqO4pHT+2sZDzSA+nlTbthgGGXM3kYAvadA3yFbSbEjEw CNClKLJB1JIyXqxbd9MN6ZyvutenYM/q0Q/p4fnAnP2OOT1IzmfIznX01iDrvbdbHf/M g6CK+0vmyqMv2Yq7ojnMSvRTfeTURcuC/mIG/lN+2Kzcbly1qRK0YOg9ieqn62pzA0fP PSZLgs+SLRDsFgM31yI+96vgs1N2JUvjL9UTGJyzOyU7R5moIOfaasjQvTRrtPy0Zuu/ +rKt/XD7fPuqL/6GUcxW5saKySh5jI/4mFtluWnQkRF2qCTlpf39L+tRi+1uLDPBt/51 GBlw== 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=u7s0EeUQCkFeuj0DqV9/aLg5a6vGrvdYxVzfWL01rT4=; b=y6PKJVUT0ZofjqpjOybi+V1Q1bK9A7CP6Zrr7Y0kiDc4/MOTEkkkBkDyQ9cTygQbL4 BM1iWcoRuvpznpfKrNLQx1xr/Tozw1mwQyW9jF//NmIn74KNObaFaFX8CiTNyvCx0sxe RtlpQBDhe4HQPvEkz00IsVWMfs4n9EXMOR/S2dq8TnQlqiZfZBZVQMxB/sMCT+LMmULL udBSNXFDjPg321bOYDwo8Iy0MX0kFmQD/ma8S+zrDhQqEYv/YrxTL/HXqaKm9T9Z6+gb In4kfFc/Q+tzNGGPdfVEAeS+M7xwzm/vcmPiy3j+hZwbaPCWQgj4qWT1FCrHOeDdFyX7 BtWg== 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 q127si3766839pgq.309.2018.02.21.10.45.49; Wed, 21 Feb 2018 10:46:03 -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 S965264AbeBUNnF (ORCPT + 99 others); Wed, 21 Feb 2018 08:43:05 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41484 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965096AbeBUNHJ (ORCPT ); Wed, 21 Feb 2018 08:07:09 -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 6CCFFF9C; Wed, 21 Feb 2018 13:07:08 +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.15 037/163] x86/xen: init %gs very early to avoid page faults with stack protector Date: Wed, 21 Feb 2018 13:47:46 +0100 Message-Id: <20180221124532.355272122@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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