sysctl/XSM: drop .page_offline() hook

Integrate the checking with xsm_sysctl(), now that it has the full op
struct passed. As a positive side effect, permissions are then checked at
the same early point with and without Flask.

This is part of CVE-2026-62426 / XSA-499.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-By: Daniel P. Smith <dpsmith@apertussolutions.com>
(cherry picked from commit 299de2aeda)
This commit is contained in:
Jan Beulich authored and Andrew Cooper committed 2026-07-28 13:08:52 +01:00
1 parent 628cd49525
commit fc159bcd70
5 files changed
+18 -37

No files matched your search

-4
View File
@@ -187,10 +187,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
if ( op->u.page_offline.end < op->u.page_offline.start )
break;
ret = xsm_page_offline(XSM_HOOK, op->u.page_offline.cmd);
if ( ret )
break;
ptr = status = xmalloc_array(uint32_t,
(op->u.page_offline.end -
op->u.page_offline.start + 1));
-6
View File
@@ -428,12 +428,6 @@ static XSM_INLINE int cf_check xsm_resource_setup_misc(XSM_DEFAULT_VOID)
return xsm_default_action(action, current->domain, NULL);
}
static XSM_INLINE int cf_check xsm_page_offline(XSM_DEFAULT_ARG uint32_t cmd)
{
XSM_ASSERT_ACTION(XSM_HOOK);
return xsm_default_action(action, current->domain, NULL);
}
static XSM_INLINE int cf_check xsm_hypfs_op(XSM_DEFAULT_VOID)
{
XSM_ASSERT_ACTION(XSM_PRIV);
-6
View File
@@ -129,7 +129,6 @@ struct xsm_ops {
int (*resource_setup_gsi)(int gsi);
int (*resource_setup_misc)(void);
int (*page_offline)(uint32_t cmd);
int (*hypfs_op)(void);
long (*do_xsm_op)(XEN_GUEST_HANDLE_PARAM(void) op);
@@ -522,11 +521,6 @@ static inline int xsm_resource_setup_misc(xsm_default_t def)
return alternative_call(xsm_ops.resource_setup_misc);
}
static inline int xsm_page_offline(xsm_default_t def, uint32_t cmd)
{
return alternative_call(xsm_ops.page_offline, cmd);
}
static inline int xsm_hypfs_op(xsm_default_t def)
{
return alternative_call(xsm_ops.hypfs_op);
-1
View File
@@ -83,7 +83,6 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
.resource_setup_gsi = xsm_resource_setup_gsi,
.resource_setup_misc = xsm_resource_setup_misc,
.page_offline = xsm_page_offline,
.hypfs_op = xsm_hypfs_op,
.hvm_param = xsm_hvm_param,
.hvm_param_altp2mhvm = xsm_hvm_param_altp2mhvm,
+18 -20
View File
@@ -58,6 +58,7 @@ static int flask_deassign_dtdevice(struct domain *d, const char *dtpath);
static int flask_resource_plug_core(void);
static int flask_resource_unplug_core(void);
static int flask_resource_use_core(void);
static uint32_t domain_sid(const struct domain *dom)
{
@@ -902,10 +903,6 @@ static int cf_check flask_sysctl(const struct xen_sysctl *op)
{
switch ( op->cmd )
{
/* These have individual XSM hooks */
case XEN_SYSCTL_page_offline_op:
return 0;
case XEN_SYSCTL_readconsole:
return domain_has_xen(current->domain,
XEN__READCONSOLE |
@@ -936,6 +933,23 @@ static int cf_check flask_sysctl(const struct xen_sysctl *op)
case XEN_SYSCTL_pm_op:
return domain_has_xen(current->domain, XEN__PM_OP);
case XEN_SYSCTL_page_offline_op:
switch ( op->u.page_offline.cmd )
{
case sysctl_page_offline:
return flask_resource_unplug_core();
case sysctl_page_online:
return flask_resource_plug_core();
case sysctl_query_page_offline:
return flask_resource_use_core();
default:
return avc_unknown_permission("page_offline",
op->u.page_offline.cmd);
}
case XEN_SYSCTL_lockprof_op:
return domain_has_xen(current->domain, XEN__LOCKPROF);
@@ -1327,21 +1341,6 @@ static int cf_check flask_resource_setup_misc(void)
return avc_current_has_perm(SECINITSID_XEN, SECCLASS_RESOURCE, RESOURCE__SETUP, NULL);
}
static inline int cf_check flask_page_offline(uint32_t cmd)
{
switch ( cmd )
{
case sysctl_page_offline:
return flask_resource_unplug_core();
case sysctl_page_online:
return flask_resource_plug_core();
case sysctl_query_page_offline:
return flask_resource_use_core();
default:
return avc_unknown_permission("page_offline", cmd);
}
}
static inline int cf_check flask_hypfs_op(void)
{
return domain_has_xen(current->domain, XEN__HYPFS_OP);
@@ -1981,7 +1980,6 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
.resource_setup_gsi = flask_resource_setup_gsi,
.resource_setup_misc = flask_resource_setup_misc,
.page_offline = flask_page_offline,
.hypfs_op = flask_hypfs_op,
.hvm_param = flask_hvm_param,
.hvm_param_altp2mhvm = flask_hvm_param_altp2mhvm,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.