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

[PATCH 1/2] x86/mem-sharing: ensure consistent lock order in get_two_gfns()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 29 Jun 2021 14:53:57 +0200
  • 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-SenderADCheck; bh=T+KmuULkjATHsJkpBCbdQw5XA9fzShGhY+AfPy7XXqk=; b=TKUCEGsCho7705fA+y8Wl7Yj85Jz134ObhNFPuu7RiflzwAVA35hzpB8oh9KLNaS2WHoGo/tC+6sxokpX/r3Z+PxzWWG06GuwOtye++TXoukpqAARRVsFd9Yas7i1bfAyyDKelP3d3rIDo8/cFJ3d8KgRlqy+Mc3CmUMfC1UAsVa/kXv/gzfOSFNZ3+PSYE0IXLw8pfaGTgXnJD+dAV7tXDrNZOyf1hpYVQDQ3c2z3ZOyINBYmEGxlYwj+j2sSPy3er0tkgzljYgOH0geGqMLOyPxV7im3+liNyXuZ9fBSyy3IucyAmyQlxcsPR+ty49ZrD9z0JqJs2I7AIrrhcQCQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fJp63VXxr6xepdm84a+yyqUxl7uPfYouhqPTE4A9msOjGJWuFo8OAgwuqbSDVazY4hHCx7czaZnmUFuds56khZH3X9ai8Ik01cuOwRy+vvWd0vDdnVCD5i3mGbv62WeGRk+HVMJNydaqfTLa9dG/7PZYTGRKg1nOhz93dDoV698LFTlahapQDfxtNysYBNumTw2aNmPe+csO7E3qdwYedV1XzY16X1qYavC/8rYhb2RE08pl77G8Z4xYwJeZAoRk2J6Y4XoNFZG8L2a4YM7PCOjJ6umo6D2rPuv3MyuqpxvElpFQC4KTr0FLrPoKuHcS4sBkabSXdMbqZwtSZcHt4A==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 29 Jun 2021 12:54:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While the comment validly says "Sort by domain, if same domain by gfn",
the implementation also included equal domain IDs in the first part of
the check, thus rending the second part entirely dead and leaving
deadlock potential when there's only a single domain involved.

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

--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -587,7 +587,7 @@ do {
     dest ## _t   = (source ## t)   ?: &scratch_t;       \
 } while (0)
 
-    if ( (rd->domain_id <= ld->domain_id) ||
+    if ( (rd->domain_id < ld->domain_id) ||
          ((rd == ld) && (gfn_x(rgfn) <= gfn_x(lgfn))) )
     {
         assign_pointers(first, r);




 


Rackspace

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