[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 05/11] x86/shadow: move bogus HVM checks in sh_pagetable_dying()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 5 Jan 2023 17:04:08 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tiwgHbCRXYI+56kwUcOCgcEtwg3HWt+T1yYbvqBjdYM=; b=LcDpJmTakRzhrmgRdUK6CYYQUe0Rpt+3dW/0+TdMvxGSu5wItFqSnWTvbFLKR4YBDH+/JywaQUpwL9yhMcnLvWM/D5C0zA2YEDGLw5fY/zeBJaEVxpNejZnxLn4w6Jb601ayQPlXmww48lJ/pgMbM5mRfQSt5gOHzYXyaObjKhmGfZjdUFATmi4zgh1eQ/oWwBXca9YnX/MtE58FQs8z5x4RM+1kLU9rpQ2nKQ0Ud1rVQICgmbyBefN9mQX5W96KKsYtEVKVaFnXZDiRS3JYnAZXMz3oHl1/RxrogIen7ZkcMsa3CECnCh0Qr6OJ7nX81OaF8klNdkZfUL2ewxuwag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xr++NsNdGlT6TtWx6/n2fQDVYMbGG7WnSMBPz5KHSmGDF9QPtDETIPnA+CjBMH4oPBWT2bwfWX4suSbXeGIypOwZCQRpTh1AompNiWRAlvR3hIiY0nJ6hTmozX01k/WZA6eOtK75QCrBTeKQR+G1WaHokMXzv0nXtNRfUHLzLajaYJfDUasD8xfrsGU7MFRG3/BJ9VBHUTxL2ixjbZZ2EnZb7G1bYkJODXyMMoBjDClEwluN71Ga3FRwXt5oxS0IRdnWM/ugNIysCEu5Rdy/khqVLzO7lWhksIzdRGFzZ/+e/VN1Gehli+018mZsv3P2TtkPaY38eJzZbIkw8YXx4w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Thu, 05 Jan 2023 16:04:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Perhaps these should have been dropped right in 2fb2dee1ac62 ("x86/mm:
pagetable_dying() is HVM-only"). Convert both to assertions, noting that
in particular the one in the 3-level variant of the function comes too
late anyway - first thing there we access the HVM part of a union.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -3780,6 +3780,8 @@ static void cf_check sh_pagetable_dying(
     unsigned long l3gfn;
     mfn_t l3mfn;
 
+    ASSERT(is_hvm_domain(d));
+
     gcr3 = v->arch.hvm.guest_cr[3];
     /* fast path: the pagetable belongs to the current context */
     if ( gcr3 == gpa )
@@ -3822,7 +3824,7 @@ static void cf_check sh_pagetable_dying(
                    : shadow_hash_lookup(d, mfn_x(gmfn), SH_type_l2_pae_shadow);
         }
 
-        if ( mfn_valid(smfn) && is_hvm_domain(d) )
+        if ( mfn_valid(smfn) )
         {
             gmfn = _mfn(mfn_to_page(smfn)->v.sh.back);
             mfn_to_page(gmfn)->pagetable_dying = true;
@@ -3854,6 +3856,8 @@ static void cf_check sh_pagetable_dying(
     mfn_t smfn, gmfn;
     p2m_type_t p2mt;
 
+    ASSERT(is_hvm_domain(d));
+
     gmfn = get_gfn_query(d, _gfn(gpa >> PAGE_SHIFT), &p2mt);
     paging_lock(d);
 
@@ -3863,7 +3867,7 @@ static void cf_check sh_pagetable_dying(
     smfn = shadow_hash_lookup(d, mfn_x(gmfn), SH_type_l4_64_shadow);
 #endif
 
-    if ( mfn_valid(smfn) && is_hvm_domain(d) )
+    if ( mfn_valid(smfn) )
     {
         mfn_to_page(gmfn)->pagetable_dying = true;
         shadow_unhook_mappings(d, smfn, 1/* user pages only */);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.