Received: by 10.192.165.148 with SMTP id m20csp333605imm; Wed, 9 May 2018 13:32:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrHTSAF5ebnqbaNZf4wEybvX2ZzejvaAc0slP+lQx8XARXHndVdi70LscjS1tGqGFVBQBIO X-Received: by 2002:a17:902:8217:: with SMTP id x23-v6mr1037911pln.380.1525897941730; Wed, 09 May 2018 13:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525897941; cv=none; d=google.com; s=arc-20160816; b=goAwNJDvlSxFS0AB6WU02G4yt7nUk5Dd4JFZmmbzeyFeiz/AAoySTPY497ViB3qEQh LZVMcXECWjkiPTyjSlKV5Ir9qKQDeP7yceHBJwKdGTxeezz2HrK58dtqSDdiU70m5+go IsRfylLyyyV9ID21iM3fx8B2wqZO+qNOsalr4WPXwyonxSxyI3ih277IR+lGPmldS3pT urxoeDgs5u4eMrGJNV7XR0uxzwj75WPvPrQGX/5EcJqjuRh5WJLSPdNFEVC2+MnpFAB9 K9KwTyRuth2w1nEdpyZ9WIPnwgITPEl4XJnrc9YEdSNokXd5SSzVBLgq9WzsLX4mF6aG zjyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7p+/KD5T1wXuvbFpTJ4uWT/dvM54A1BZ4C4WMCnds9s=; b=hlGSLUYLDuE20ZSIELDr0dwLASFRM0hK7i2r9KCEKL/iuQ+L2gxYc2jRrN8v+/gTf9 IdCkxWPnk+JwHytEPbm6FJqeFUcqLCDG/oCjul2n7b9lohnweVwsovFq3ZZLIxz9y1eL r2IF/0z5rYlT4hQq+EOFtWFeTHv7wk8zOEBN230m7y7CSNXUQB4F8qJmqpAoHHtrQcmf eB78o+xetEda0ukfZiTOSaLk9HhAjfC3ys+hIuCzBCKvOfNA6RTzk+H/u+XBRTGe5GR4 +YK6RPrOabB8sP9rN9atEqRqflea4734nkxW3Gna+g/TgP6z+T+8/OAanl05cZCjLzHQ jLUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=k5P6Cb4t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3-v6si26756608pld.300.2018.05.09.13.31.52; Wed, 09 May 2018 13:32:21 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=k5P6Cb4t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935607AbeEIUbU (ORCPT + 99 others); Wed, 9 May 2018 16:31:20 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:34728 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935558AbeEIUbR (ORCPT ); Wed, 9 May 2018 16:31:17 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w49KUv10024054; Wed, 9 May 2018 20:31:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=7p+/KD5T1wXuvbFpTJ4uWT/dvM54A1BZ4C4WMCnds9s=; b=k5P6Cb4tkLtTs41WL4X2kZdBSl4rEoQ2t3xANm/MKZ1Fy6Omidwzx+ANkmB5pn/JLh+R Db48oFeSifdW2Rxc+fvQZYczNqwNJZo6EiYJxp1lBfGYH5psJ47AT+2aydeUGTp4FD/s Bp/miJ7ml14nodMehgOA/5/YZfhS40d0/t0bUxBIdrPAIoMiblIp6hjFDd3XZrj6f4UX +eyEmxHpPqplwPsSDNcySjAHMckYeoxVjIEyt3d87tQOPTAMIclVfMf67/vluAfgJVab tF+oVk8nWC8oRhS7tvNPeTh+AnJSyd59/YIqtJUfMrIlJ50aF51ps9/gyf9OMG1BiXFJ 5g== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2hv6m4gf5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 May 2018 20:31:12 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w49KVCeD009699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 May 2018 20:31:12 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w49KVBZK008669; Wed, 9 May 2018 20:31:11 GMT Received: from dhcp-burlington7-2nd-B-east-10-152-55-162.usdhcp.oraclecorp.com.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 09 May 2018 13:31:11 -0700 From: Boris Ostrovsky To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: jgross@suse.com, Boris Ostrovsky Subject: [PATCH v2 2/2] xen/PVH: Make GDT selectors PVH-specific Date: Wed, 9 May 2018 16:33:18 -0400 Message-Id: <20180509203318.2611-3-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180509203318.2611-1-boris.ostrovsky@oracle.com> References: <20180509203318.2611-1-boris.ostrovsky@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8888 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=626 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805090191 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We don't need to share PVH GDT layout with other GDTs, especially since we now have a PVH-speciific entry (for stack canary segment). Define PVH's own selectors. (As a side effect of this change we are also fixing improper reference to __KERNEL_CS) Signed-off-by: Boris Ostrovsky --- arch/x86/xen/xen-pvh.S | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/arch/x86/xen/xen-pvh.S b/arch/x86/xen/xen-pvh.S index 22d43eb..da8589f 100644 --- a/arch/x86/xen/xen-pvh.S +++ b/arch/x86/xen/xen-pvh.S @@ -54,7 +54,11 @@ * charge of setting up it's own stack, GDT and IDT. */ -#define PVH_GDT_ENTRY_CANARY 4 +#define PVH_GDT_ENTRY_CS 1 +#define PVH_GDT_ENTRY_DS 2 +#define PVH_GDT_ENTRY_CANARY 3 +#define PVH_CS_SEL (PVH_GDT_ENTRY_CS * 8) +#define PVH_DS_SEL (PVH_GDT_ENTRY_DS * 8) #define PVH_CANARY_SEL (PVH_GDT_ENTRY_CANARY * 8) ENTRY(pvh_start_xen) @@ -62,7 +66,7 @@ ENTRY(pvh_start_xen) lgdt (_pa(gdt)) - mov $(__BOOT_DS),%eax + mov $PVH_DS_SEL,%eax mov %eax,%ds mov %eax,%es mov %eax,%ss @@ -107,7 +111,7 @@ ENTRY(pvh_start_xen) mov %eax, %cr0 /* Jump to 64-bit mode. */ - ljmp $__KERNEL_CS, $_pa(1f) + ljmp $PVH_CS_SEL, $_pa(1f) /* 64-bit entry point. */ .code64 @@ -130,13 +134,13 @@ ENTRY(pvh_start_xen) or $(X86_CR0_PG | X86_CR0_PE), %eax mov %eax, %cr0 - ljmp $__BOOT_CS, $1f + ljmp $PVH_CS_SEL, $1f 1: call xen_prepare_pvh mov $_pa(pvh_bootparams), %esi /* startup_32 doesn't expect paging and PAE to be on. */ - ljmp $__BOOT_CS, $_pa(2f) + ljmp $PVH_CS_SEL, $_pa(2f) 2: mov %cr0, %eax and $~X86_CR0_PG, %eax @@ -145,7 +149,7 @@ ENTRY(pvh_start_xen) and $~X86_CR4_PAE, %eax mov %eax, %cr4 - ljmp $__BOOT_CS, $_pa(startup_32) + ljmp $PVH_CS_SEL, $_pa(startup_32) #endif END(pvh_start_xen) @@ -157,13 +161,12 @@ gdt: .word 0 gdt_start: .quad 0x0000000000000000 /* NULL descriptor */ - .quad 0x0000000000000000 /* reserved */ #ifdef CONFIG_X86_64 - .quad GDT_ENTRY(0xa09a, 0, 0xfffff) /* __KERNEL_CS */ + .quad GDT_ENTRY(0xa09a, 0, 0xfffff) /* PVH_CS_SEL */ #else - .quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* __KERNEL_CS */ + .quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* PVH_CS_SEL */ #endif - .quad GDT_ENTRY(0xc092, 0, 0xfffff) /* __KERNEL_DS */ + .quad GDT_ENTRY(0xc092, 0, 0xfffff) /* PVH_DS_SEL */ .quad GDT_ENTRY(0x4090, 0, 0x18) /* PVH_CANARY_SEL */ gdt_end: -- 2.9.3