Skip to contentSkip to conversation

x86/shadow: shadow_enable() cannot be called on oneself

PATCH In review Andrew Cooper 2 participants 2 messages Oct 31, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/shadow: shadow_enable() cannot be called on oneself

domain_pause() ASSERT()s that d != current->domain, making this particular sanity check unconditionally false.

The two callpaths leading here are from hvm_domain_initialise() (which absolutely can't be on oneself) and paging_domctl() (which checks and rejects domctls one oneself).

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
---
 xen/arch/x86/mm/shadow/common.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/x86/mm/shadow/common.c +1 -2
index a5eed28..57a1500 100644
@@ -2929,8 +2929,7 @@ int shadow_enable(struct domain *d, u32 mode)
     domain_pause(d);
 
     /* Sanity check the arguments */
-    if ( (d == current->domain) ||
-         shadow_mode_enabled(d) ||
+    if ( shadow_mode_enabled(d) ||
          ((mode & PG_translate) && !(mode & PG_refcounts)) ||
          ((mode & PG_external) && !(mode & PG_translate)) )
     {
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 11 lines · Andrew Cooper

domain_pause() ASSERT()s that d != current->domain, making this particular sanity check unconditionally false.

The two callpaths leading here are from hvm_domain_initialise() (which absolutely can't be on oneself) and paging_domctl() (which checks and rejects domctls one oneself).

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>

Nak. This check is partly documentation and entirely harmless; I'd like to keep it.

Tim.

Quoted 21 lines
---
 xen/arch/x86/mm/shadow/common.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/x86/mm/shadow/common.c +1 -2
index a5eed28..57a1500 100644
@@ -2929,8 +2929,7 @@ int shadow_enable(struct domain *d, u32 mode)
     domain_pause(d);
 
     /* Sanity check the arguments */
-    if ( (d == current->domain) ||
-         shadow_mode_enabled(d) ||
+    if ( shadow_mode_enabled(d) ||
          ((mode & PG_translate) && !(mode & PG_refcounts)) ||
          ((mode & PG_external) && !(mode & PG_translate)) )
     {
Signature · 1 line
1.7.10.4