]> xenbits.xensource.com Git - xen.git/commitdiff
x86/paging: return -EINVAL for paging domctls for dying domains
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 8 Nov 2022 11:38:50 +0000 (12:38 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 9 Feb 2023 12:04:11 +0000 (12:04 +0000)
The current logic returns 0 and leaves the domctl parameter uninitialized for
any parameter fetching operations (like the GET_ALLOCATION operation), which
is not helpful from a toolstack point of view, because there's no indication
that the data hasn't been fetched.

For at least the Ocaml stubs, this ends up passing back stack rubble as if it
were a correct result.

Inform the caller properly that it hasn't got any data.

Reported-by: Edwin Török <edvin.torok@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm/paging.c

index 1c5f54f92aefcb79b891c25d8d1e922d8c21c37f..2991585117a8686ae1be5bc91df05f8526d19962 100644 (file)
@@ -695,9 +695,8 @@ int paging_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
 
     if ( unlikely(d->is_dying) )
     {
-        gdprintk(XENLOG_INFO, "Ignoring paging op on dying domain %u\n",
-                 d->domain_id);
-        return 0;
+        gdprintk(XENLOG_INFO, "Tried to do a paging op on dying %pd\n", d);
+        return -EINVAL;
     }
 
     if ( unlikely(d->vcpu == NULL) || unlikely(d->vcpu[0] == NULL) )