Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1073690imm; Mon, 21 May 2018 20:53:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp5k7aC7M/RcU1cbaaoEao9KfAxKWpWgoA83inufxYfPhbTBqixOot+Rs2WNZBZ72kEWHNB X-Received: by 2002:a62:5610:: with SMTP id k16-v6mr22365926pfb.19.1526961210392; Mon, 21 May 2018 20:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526961210; cv=none; d=google.com; s=arc-20160816; b=04lwUWniAvGjlK2CJwI2huOfatDuV0QKbgHvEGm0u1A7M+Y2xJ/Z9JgfmHvtQGOdst jSBfXgazkrUWoSOVMw8xqLZKmOlQYPh2yUX29aern8MasJ4SY+cNXPNT6GH1k5VB05Hc URcP5yI8knNErQpaXMH1aza8SKXbNpmxVNGMRhnUs434thCoiJ7K/pORdV4/Dl33Zwol MdwX2zx/TLiXObjF8ypMJpuMunG+8ZHTsh3xHmi7b21kdjzEXRrcqjygBHrXGii8kfuT zrUc5jni30Xskv09Cm48ZSuTF4o4xrCuK/Xvqw15golE2JgeTj6Q9ib6FFrxD/lf+5Aq c5XQ== 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=j80oPprN7ndxDwZ2llmwQJrFuY/Qc22aY5WjY4WXR9g=; b=en55TzLkiF08DQDdt7OL49ahO5Sz8RFmpB/uijP64jDcl3C0gc9Sh0ysk6iGPrKPOT 2snV+IIk5uZAjy0u81ucw9BBVIXCDI5zoYwXriPo2XuxBJLEM1dJkItANTWvfV3uRJRo MP0b5SR6sJrxW7xLM1Il9IHyOxyz09xLctPnZsNosWM846UbDdQdthULgHkAAG5E6h0M 2Rj/0mvfyvjBbLh5RNWOj3QD+ETeXubm+/q9CpL0JMs0cwDQQ4MI3KgzJ88I4y7ac9Vz +B54abvbZnYD8YJVpsgqCh+DyHE1Z9Uw9nEE3+z9wBOi0N9A0cBADsCtcNRsVyYQOGXT GDig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=NDSgA1Oz; 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 x1-v6si14932967pfm.32.2018.05.21.20.53.16; Mon, 21 May 2018 20:53:30 -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=NDSgA1Oz; 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 S1752697AbeEVDxF (ORCPT + 99 others); Mon, 21 May 2018 23:53:05 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:59388 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751763AbeEVDw6 (ORCPT ); Mon, 21 May 2018 23:52:58 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4M3l6aM072106; Tue, 22 May 2018 03:52:50 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=j80oPprN7ndxDwZ2llmwQJrFuY/Qc22aY5WjY4WXR9g=; b=NDSgA1OzzRlJmmiULvIleCR9A2aF91SeyUWG4b2ErTwblYTGSIvrPLvk8Io+PZE2mrsq gs09qT+d44aji7cgfsB7eZVWhj+IpMawwEqHlQfC69wujzalDIA7K5U2b0V1pagKbsYk ntnJnvcaq0cYRic8XLGFmArAkULdDS+3TJtDT7vNztUg/CjfIrWenlncEySGHcAz6gA4 TsYnV17LJpb7I3p/XStN0WzmU3mIXOfGrWM4CwtOy+HeYezLWri4IJwNbKmfmzlp/j1U WcL35Jo6l+uFyiTIhFHEksa7VInWGrLLdGDlkGqVtFvHElFzZ4FTdIo0YXQELXVu/xiy zQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2j2bw86n3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 May 2018 03:52:50 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4M3qogO026314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 May 2018 03:52:50 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4M3qoWP006496; Tue, 22 May 2018 03:52:50 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 ; Mon, 21 May 2018 20:52:49 -0700 From: Boris Ostrovsky To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: jgross@suse.com, JBeulich@suse.com, Boris Ostrovsky Subject: [PATCH v4 2/2] xen/PVH: Make GDT selectors PVH-specific Date: Mon, 21 May 2018 23:54:45 -0400 Message-Id: <20180522035445.16911-3-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180522035445.16911-1-boris.ostrovsky@oracle.com> References: <20180522035445.16911-1-boris.ostrovsky@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8900 signatures=668700 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=613 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805220044 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 0169374..e7a5bf4 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 @@ -96,7 +100,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 @@ -136,13 +140,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 @@ -151,7 +155,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) @@ -163,13 +167,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