]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
xen/xsm: make getdomaininfo xsm dummy checks more stringent
authorJuergen Gross <jgross@suse.com>
Mon, 16 Dec 2024 12:06:55 +0000 (13:06 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 16 Dec 2024 12:06:55 +0000 (13:06 +0100)
Today the dummy XSM privilege checks for getdomaininfo are less
stringent than possible: they basically rely on the general
sysctl/domctl entry check to do all tests and then do the test with
the XSM_HOOK privilege, which is an "allow all" default.

Instead of XSM_HOOK use XSM_XS_PRIV, which is the privilege really
wanted. Note that this test is still wider than the sysctl entry test,
but there is no easy way to make both domctl and sysctl happy at the
same time.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/common/domctl.c
xen/common/sysctl.c
xen/include/xsm/dummy.h

index ea16b759109e5071667522bb63c5a5dd13772119..444e072fdc485ab5179988f4e185a0888e4d67ff 100644 (file)
@@ -539,7 +539,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
 
     case XEN_DOMCTL_getdomaininfo:
-        ret = xsm_getdomaininfo(XSM_HOOK, d);
+        ret = xsm_getdomaininfo(XSM_XS_PRIV, d);
         if ( ret )
             break;
 
index d02f44fe3a92dec5878dfebdcb999927b60932a6..c2d99ae12e84e3a274c45a442b4b6a950adf5b39 100644 (file)
@@ -89,7 +89,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             if ( num_domains == op->u.getdomaininfolist.max_domains )
                 break;
 
-            if ( xsm_getdomaininfo(XSM_HOOK, d) )
+            if ( xsm_getdomaininfo(XSM_XS_PRIV, d) )
                 continue;
 
             getdomaininfo(d, &info);
index 7956f27a291f73e6277c51ddf8170625fefa955b..f8a3c4b81edfb3d4e986ab27bac89c44c438a774 100644 (file)
@@ -137,7 +137,7 @@ static XSM_INLINE int cf_check xsm_domain_create(
 static XSM_INLINE int cf_check xsm_getdomaininfo(
     XSM_DEFAULT_ARG struct domain *d)
 {
-    XSM_ASSERT_ACTION(XSM_HOOK);
+    XSM_ASSERT_ACTION(XSM_XS_PRIV);
     return xsm_default_action(action, current->domain, d);
 }