Skip to contentSkip to conversation

Xen Security Advisory 210 - arm: memory corruption when freeing p2m pages

PATCH Xen.org security team 1 participant 1 message Feb 23, 2017

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Xen Security Advisory XSA-210

arm: memory corruption when freeing p2m pages

ISSUE DESCRIPTION
=================

When freeing pages used for stage-2 page tables, the freeing routine failed to remove these pages from an internally managed list they were put on during allocation. The same list node elements are also used by the hypervisor's page allocator. Subsequent manipulation of ARM's private P2M list could therefore corrupt the lists maintained by the page allocator. The buggy code is exposed to guests via the XENMEM_decrease_reservation hypercall.

IMPACT
======

A malicious or buggy guest may corrupt hypervisor state, commonly leading to a host crash (Denial of Service). Privilege escalation or information leaks cannot be excluded.

VULNERABLE SYSTEMS
==================

Only Xen version 4.8 is affected. Xen versions 4.7 and earlier are not vulnerable.

Only ARM systems are vulnerable. X86 based systems are not vulnerable.

MITIGATION
==========

There is no known mitigation.

NOTE REGARDING LACK OF EMBARGO
==============================

The issue was discussed publicly before being recognized as a security issue.

RESOLUTION
==========

Applying the attached patch resolves this issue.

xsa210.patch xen-unstable, Xen 4.8.x

$ sha256sum xsa210*
10e26c017c916dcac261c6a3c92656831f0ad037f792940e6faf6905c6e23861  xsa210.patch
$

CREDITS
=======

The initial bug was discovered by Vijay Kilari of Cavium and the security aspect was diagnosed by Julien Grall of ARM.

DEPLOYMENT DURING EMBARGO
=========================

Deployment of the patches and/or mitigations described above (or others which are substantially similar) is permitted during the embargo, even on public-facing systems with untrusted guest users and administrators.

But: Distribution of updated software is prohibited (except to other members of the predisclosure list).

Predisclosure list members who wish to deploy significantly different patches and/or mitigations, please contact the Xen Project Security Team.

(Note: this during-embargo deployment notice is retained in post-embargo publicly released Xen Project advisories, even though it is then no longer applicable. This is to enable the community to have oversight of the Xen Project Security Team's decisionmaking.)

For more information about permissible uses of embargoed information, consult the Xen Project community's agreed Security Policy:
http://www.xenproject.org/security-policy.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJYrw2aAAoJEIP+FMlX6CvZuw4H/34z2io/65h2RLDL3bx4w//A nWNcrceKrxyvtZmTss56RHrUeiOOKOeuCXWMx5CSihBcSRXqyZa79IDul9t1b7fB m6NUPerILGueF3uOYTRUvvSiWKWRzVPOCgqSxlCmd7YTrkjHZkq/x2Gb9Acj3hrl yE0fFdD/hTIN9wZtHWY+gTIXMIGHBJ4/xieZeYZvylbnmu9nDC0WIupTExonWqie sG0DICl+eKJMt3ioSzaGd9117Xk1P7JWvcr7MJQvzn/2VDTG2TjC4kZE1iDHHVPz +txQh2G2Luf+jX5VQSqWnlv7I9zuGlqYEpAMQacjrLzGejuqPSC2kbzliOEoCaE= =1k3w
-----END PGP SIGNATURE-----

From: Julien Grall <[email protected]>
Subject: arm/p2m: remove the page from p2m->pages list before freeing it

The p2m code is using the page list field to link all the pages used for the stage-2 page tables. The page is added into the p2m->pages list just after the allocation but never removed from the list.

The page list field is also used by the allocator, not removing may result a later Xen crash due to inconsistency (see [1]).

This bug was introduced by the reworking of p2m code in commit 2ef3e36ec7 "xen/arm: p2m: Introduce p2m_set_entry and __p2m_set_entry".

[1] https://lists.xenproject.org/archives/html/xen-devel/2017-02/msg00524.html

xen/arch/arm/p2m.c +5 -1
@@ -660,6 +660,7 @@ static void p2m_free_entry(struct p2m_domain *p2m,
     unsigned int i;
     lpae_t *table;
     mfn_t mfn;
+    struct page_info *pg;
 
     /* Nothing to do if the entry is invalid. */
     if ( !p2m_valid(entry) )
@@ -697,7 +698,10 @@ static void p2m_free_entry(struct p2m_domain *p2m,
     mfn = _mfn(entry.p2m.base);
     ASSERT(mfn_valid(mfn_x(mfn)));
 
-    free_domheap_page(mfn_to_page(mfn_x(mfn)));
+    pg = mfn_to_page(mfn_x(mfn));
+
+    page_list_del(pg, &p2m->pages);
+    free_domheap_page(pg);
 }
 
 static bool p2m_split_superpage(struct p2m_domain *p2m, lpae_t *entry,

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel