Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3371255imm; Thu, 17 May 2018 07:46:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqogNAEilDsSa3FFh8KX5XP8Y/ZzrF7Bk3apmfa8vPEznZRWxsNQTZ1PXe13w7E36hu+rWA X-Received: by 2002:a63:2d83:: with SMTP id t125-v6mr4326818pgt.336.1526568388424; Thu, 17 May 2018 07:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526568388; cv=none; d=google.com; s=arc-20160816; b=rZvzSPcn2WPkI2v984vw9A7eGNplO7l1d8Zz8ramw7bGhpQ76eo+TnTPLGyBA4PWgh wi+nPiTHmdkTOq0NYUz5D1Ao0V/mAIvmj7NOyJi1nU97qxGPSXS6dNNEfIqsjbJZtRt9 xHTlgsWyzY/EY1tw0DwS5ji/wpK1j+s+09/AZ5FQn3zIVg+Y9wCyNRT3v/2kr6aGQJ4X ++o82XMqHe2klRrAUsgU6F8hQBfbPPG9IX7ds1DZ86k4rfplZOHAJjDRrqGtkBqzvoyw sfS8JOpEaL3cTvTbyyJA45OueTlqss9lEaghKpFZpY9PmaWkTXmP+JbEtah31egiiYRi h+AA== 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=deEiMfUINKi62GKSyes6hm0u9vTyS3eJfDli3mtqFns=; b=lBWXZXh09ytqRzqDFn3ju+arQih71Jt+DpgB42HftgpqOCysoaTUSGoNeLdE6L6xUe Mun6KfArUdu1CsWgVXhal2cegsmAyrfA09fzeP5E4HUNicdqU30OIJZE23yWN0r2tVWh wS665TGjvUYoVC2xmYsTPVZct5QL4STubGcIdFjwt+ouTDQj6Zd3X6SAcyQ5zOD0QL04 qFwtW8f8Z6jDKBGqvF1Xzw49pe9IGtVsArda/RgywgY01PWWLDJHlHG14e10Lcngk9is pH3SxB0V/SdUZdkJV0/mXYFF/9OnkAkLXqLr+5oaofW8UKvRXuMdvgjwdcvbO66OMSaO LmMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=j3aD7kMV; 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 r5-v6si5202691plo.479.2018.05.17.07.46.07; Thu, 17 May 2018 07:46:28 -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=j3aD7kMV; 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 S1752529AbeEQOpa (ORCPT + 99 others); Thu, 17 May 2018 10:45:30 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60724 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752479AbeEQOpG (ORCPT ); Thu, 17 May 2018 10:45:06 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4HEfqdq191956; Thu, 17 May 2018 14:45:02 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=deEiMfUINKi62GKSyes6hm0u9vTyS3eJfDli3mtqFns=; b=j3aD7kMVyniZ7rfjraUfgsLPNX0+WLm4oW4SkQ8MG1ABrYrBc3gc5yDsNjc1pXDWw/bB QhcaUtTvJknUkvOEBGMmzyL5+/j6wtnp+ty0fsjP5zVjjdTpX54WvU2RQruPKi6HNW4J oHfjtzz3SVWcWEVxQToE50A5K2uJ3sbe5BVtHLYNvo/Ym55mZhDVgG3VkhoKAZitFhue ZgUKKeN5fuq97yzyeMF3JRXcYx6RvHEWf5ihxpxaWzcgZDNUDRUIJLoihCKQ7koOUo5T FIxdhhmR9Wd/VyIevB7exJ+OILjPdHbZhTFqzrgNJ3qJ3eXKKpUITuqtJ+ZIyC14wPEM Yw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2hx29whjge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 May 2018 14:45:02 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4HEj0GH026500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 May 2018 14:45:01 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4HEj0jo016555; Thu, 17 May 2018 14:45:00 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 ; Thu, 17 May 2018 07:45:00 -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 v3 2/2] xen/PVH: Make GDT selectors PVH-specific Date: Thu, 17 May 2018 10:47:23 -0400 Message-Id: <20180517144723.21585-3-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180517144723.21585-1-boris.ostrovsky@oracle.com> References: <20180517144723.21585-1-boris.ostrovsky@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8895 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=617 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805170136 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 0db540c..f09350a 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 @@ -99,7 +103,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