Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp915302imm; Wed, 23 May 2018 07:29:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZongFLRVG3fFg3+L2NYXkYr8v9LEHugoI06+sdXy9w63EmBC6rz/sGmYzkk5Zio1h2XhKIW X-Received: by 2002:a63:4202:: with SMTP id p2-v6mr2556333pga.137.1527085749647; Wed, 23 May 2018 07:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527085749; cv=none; d=google.com; s=arc-20160816; b=ndQPef3hu/xxwcVA/O3Kwn2eaS4Sq9lc3V8T5uuHtg8W+Qxr+hNPjdMQvLg+YZMYw6 zVsR/aQVh+cxt7tArcLEk+90NnEkRQYtcGGysF3p8HDDBwcW052Q6li0is2eEZv95Wlz 7tq6MsxOB3sZxXlizOQDMv/J+xWfpH6SbxBHfk1sRlAqugQivqR+XGC22RRkQ+zuJbGD kP4ZpjGa04DTnH/MmXiOSVqwj/6bkLiR9LMqliR9sOxtxAGO5G+mWlRz7ek4P4XuGeVE zDKK7axEvNhMMYBOlOc5Q51k5uKxdQFva7jPKNCy1ZDBRp4Kmpm7PDwjCoVqcUny1YtA 2zwA== 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=W2LsO14QFY4jdM1U2saX7+eCTSHAwM8XzAAnyrjGpbo=; b=AafSIsOmLV2CKRMVtNwGKwtEGtgLT5T/ci01e+9EmCJxkudi9ORJKRcaJOPc5si/AV myRMEodXjyElTx8HSqKs1tSE0stZSg/JoIOi4McyLWUvPKdlGlwmGhwhhF6cySmK6H3R L7Qi2hAantUqqn9pQyGi+waWTaFQb3qrYe/PYKthoQ+Inj6ihhTUxp5gy+1UE/bRDKts TqPY588JaKD7oj9l3vdoqcL8EqU+XcDTBRvHgF/6Ruv3O8dtW8eQpGmvzV5+FoPdlD/2 PFiCtnbwYC7Fohu736FG3rwIIxd5JWRKEcKRXm4L9tNvAG6qeggIYdgXvbEH9VPemPjY H+QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=hr+p+PU2; 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 u70-v6si1929025pgc.376.2018.05.23.07.28.53; Wed, 23 May 2018 07:29:09 -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=hr+p+PU2; 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 S933344AbeEWO2L (ORCPT + 99 others); Wed, 23 May 2018 10:28:11 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:38342 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754205AbeEWO2H (ORCPT ); Wed, 23 May 2018 10:28:07 -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 w4NEQYmj012115; Wed, 23 May 2018 14:28:00 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=W2LsO14QFY4jdM1U2saX7+eCTSHAwM8XzAAnyrjGpbo=; b=hr+p+PU2hJJbfCSiVgKnZUIhe557l4Jm9M6Apj2NtsTmbmCd8hxOt1MZZe0T2lVRuzoB 5aGU4ZQgeRgwS8tCzm1aYTK2Ou8EZUO1gdyaqzQCxOPoN3GZ7nUFXpj7VUVK4nVHp/Ls QGkjT5qGjP3vbqDNmh727eEOzUd5hfZSb2gVjq4+L7gMscgX0Rwd+7YsB7fSFsJrejMh bxDqmLLbX3pZxmw5hlbGdc/Y6iiPJtvNojRiwMQ/+KlIH/j+nOfbFZIpgzjhyfK2hcm4 4terghc8xh+ZuAq2pf+tJT/3NTUl2TBPwB02noYNYhuH9JygxEBAvCqigHqwFlwqzfnY 8w== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2j4nh7m8jh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 May 2018 14:28:00 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4NERxL5017348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 May 2018 14:28:00 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4NERxiE009348; Wed, 23 May 2018 14:27:59 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, 23 May 2018 07:27:59 -0700 From: Boris Ostrovsky To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: jgross@suse.com, JBeulich@suse.com, brgerst@gmail.com, Boris Ostrovsky Subject: [PATCH v5 2/2] xen/PVH: Make GDT selectors PVH-specific Date: Wed, 23 May 2018 10:30:02 -0400 Message-Id: <20180523143002.29252-3-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180523143002.29252-1-boris.ostrovsky@oracle.com> References: <20180523143002.29252-1-boris.ostrovsky@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8901 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=658 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805230146 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 Reviewed-by: Juergen Gross --- 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 d6a17b9..dd852ac 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