@@ -261,7 +261,11 @@ static inline int xsm_domctl(xsm_default_t def, struct domain *d,
static inline int xsm_sysctl(xsm_default_t def, int cmd)
{
+#ifdef CONFIG_SYSCTL
return alternative_call(xsm_ops.sysctl, cmd);
+#else
+ return -EOPNOTSUPP;
+#endif
}
static inline int xsm_readconsole(xsm_default_t def, uint32_t clear)
@@ -22,7 +22,9 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
.sysctl_scheduler_op = xsm_sysctl_scheduler_op,
.set_target = xsm_set_target,
.domctl = xsm_domctl,
+#ifdef CONFIG_SYSCTL
.sysctl = xsm_sysctl,
+#endif
.readconsole = xsm_readconsole,
.evtchn_unbound = xsm_evtchn_unbound,
@@ -856,6 +856,7 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
}
}
+#ifdef CONFIG_SYSCTL
static int cf_check flask_sysctl(int cmd)
{
switch ( cmd )
@@ -933,6 +934,7 @@ static int cf_check flask_sysctl(int cmd)
return avc_unknown_permission("sysctl", cmd);
}
}
+#endif
static int cf_check flask_readconsole(uint32_t clear)
{
@@ -1884,7 +1886,9 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
.sysctl_scheduler_op = flask_sysctl_scheduler_op,
.set_target = flask_set_target,
.domctl = flask_domctl,
+#ifdef CONFIG_SYSCTL
.sysctl = flask_sysctl,
+#endif
.readconsole = flask_readconsole,
.evtchn_unbound = flask_evtchn_unbound,
As function xsm_sysctl() is solely invoked in sysctl.c, we need to wrap around it with CONFIG_SYSCTL Signed-off-by: Penny Zheng <Penny.Zheng@amd.com> --- v1 -> v2 - remove unnecessary redundancy in dummy handler - re-place #ifdef into function body --- xen/include/xsm/xsm.h | 4 ++++ xen/xsm/dummy.c | 2 ++ xen/xsm/flask/hooks.c | 4 ++++ 3 files changed, 10 insertions(+)