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

[PATCH v2 2/6] x86/P2M: relax permissions of PVH Dom0's MMIO entries

  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 2 Sep 2021 10:33:04 +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=QGrOOS+VJ3eASvPOqSojyeVdMYBWoCT8pMRR8J+S6bQ=; b=UVGP2pIZ9hKKbLUDr8rzSB9KEcyrOzfHAHCDn1SbpjIX/hhqQ6rw5sz6Tfkq7umAVGlUkXXryl0NgCFWFfkwCD5RA1xCciaPGNgmJlhLyalDZ/jSgnsi6DEA9SmH/mqkNZHj7AijtHgA0to8DyO+WssVG7f7NWN+TYIWB+nT8DSqHMmyEoRGpOG2z+03c1UpyKzLJr2uTBbehqHovGTul+mMvGDd+kdbc4sRe8RhZv0hh6YrCoA9OvOM02LhdoXE1CLzbE6eEdtOzo562DLh7y17nwCD/cS+JhNhCnhIT3ro/wOiOy9hbv84PKl2lI1B8RuFbQ7qWR5BM4JAEagrKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rh+lzgizB+Oaq/xwxm81ndeEY5ORQ+As9I0bSFEGtmWiwqTD7aW04BhDWaDWCaEm6Vsm7DvzaKDWtJEXBKfWn8tG8PP6MJobsDPyvZ+oi5idAarrhvsb0YXL47BIsVDvJSjp7H0nOpuvWP7yc4k2IsjCrxLS4icROuBzBtdFzNKjQmkw7xOJwExf2M25ruCDpQZEZ5iQSH7b6HOq/O9rKowuy6r7Kt5ui61Is1GIRgF4WGd6wz0eoP2XlPw9Z7PwDjxhUUVfsLtkDazVD0PLuasQ1zwj7EjbM2gOijfR6rtQkSSAYQr7VB6Ii/BP/gJxi0wFD6C8TrUuTT1b2eQsLg==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Thu, 02 Sep 2021 08:33:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

To become independent of the sequence of mapping operations, permit
"access" to accumulate for Dom0, noting that there's not going to be an
introspection agent for it which this might interfere with. While e.g.
ideally only ROM regions would get mapped with X set, getting there is
quite a bit of work. Plus the use of p2m_access_* here is abusive in the
first place.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
v2: Split off from original patch.

--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1319,6 +1319,18 @@ static int set_typed_p2m_entry(struct do
             return -EPERM;
+        /*
+         * Gross bodge, to go away again rather sooner than later:
+         *
+         * For MMIO allow access permissions to accumulate, but only for Dom0.
+         * Since set_identity_p2m_entry() and set_mmio_p2m_entry() differ in
+         * the way they specify "access", this will allow the ultimate result
+         * be independent of the sequence of operations.
+         */
+        if ( is_hardware_domain(d) && gfn_p2mt == p2m_mmio_direct &&
+             access <= p2m_access_rwx && a <= p2m_access_rwx )
+            access |= a;
         if ( access == a )
             gfn_unlock(p2m, gfn, order);



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