[PATCH v2 13/14] XSM: convert remaining miscellaneous hooks
Jan Beulich <[email protected]>
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <[email protected]> |
Make the ones left also follow the standard scheme, i.e. taking xsm_default_t as first argument at call sites. This way they can be covered by the recently introduced hook machinery. Signed-off-by: Jan Beulich <[email protected]> --- Interestingly .show_irq_sid() is unused on Arm. Oddly there's no use of register_keyhandler() there at all. (IOW I think it would be wrong to make the hook x86-only.) --- v2: New. --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -497,7 +497,7 @@ void asmlinkage __init noreturn start_xe /* Hide UART from DOM0 if we're using it */ serial_endboot(); - if ( (rc = xsm_set_system_active()) != 0 ) + if ( (rc = xsm_set_system_active(XSM_HOOK)) != 0 ) panic("xsm: unable to switch to SYSTEM_ACTIVE privilege: %d\n", rc); system_state = SYS_STATE_active; --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -2549,7 +2549,7 @@ static void cf_check dump_irqs(unsigned if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type ) continue; - ssid = in_irq() ? NULL : xsm_show_irq_sid(irq); + ssid = in_irq() ? NULL : xsm_show_irq_sid(XSM_HOOK, irq); spin_lock_irqsave(&desc->lock, flags); --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -835,7 +835,7 @@ static void noreturn init_done(void) unsigned long start, end; int err; - if ( (err = xsm_set_system_active()) != 0 ) + if ( (err = xsm_set_system_active(XSM_HOOK)) != 0 ) panic("xsm: unable to switch to SYSTEM_ACTIVE privilege: %d\n", err); system_state = SYS_STATE_active; --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -104,10 +104,12 @@ static always_inline int xsm_default_act } } -static XSM_INLINE int xsm_set_system_active(void) +static XSM_INLINE int xsm_set_system_active(XSM_DEFAULT_VOID) { struct domain *d = current->domain; + XSM_ASSERT_ACTION(XSM_HOOK); + ASSERT(d->is_privileged); if ( d->domain_id != DOMID_IDLE ) @@ -467,8 +469,9 @@ static XSM_INLINE int xsm_do_compat_op(X #endif /* CONFIG_XSM */ -static XSM_INLINE char *xsm_show_irq_sid(int irq) +static XSM_INLINE char *xsm_show_irq_sid(XSM_DEFAULT_ARG int irq) { + XSM_ASSERT_ACTION(XSM_HOOK); return NULL; } --- a/xen/include/xsm/hooks.h +++ b/xen/include/xsm/hooks.h @@ -17,6 +17,8 @@ #endif /* XSM_HOOK */ +XSM_HOOK(int, set_system_active) + XSM_HOOK(int, domain_create, struct domain *, uint32_t) XSM_HOOK(int, getdomaininfo, struct domain *) XSM_HOOK(int, get_domain_state, struct domain *) @@ -84,6 +86,8 @@ XSM_HOOK(int, irq_mapping, struct domain XSM_HOOK(int, pt_irq_binding, struct domain *, struct xen_domctl_bind_pt_irq *, bool) +XSM_HOOK(pchar_t, show_irq_sid, int) + XSM_HOOK(int, irq_permission, struct domain *, int, bool) XSM_HOOK(int, iomem_permission, struct domain *, uint64_t, uint64_t, bool) --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -61,7 +61,6 @@ typedef enum xsm_default xsm_default_t; * !!! WARNING !!! */ struct xsm_ops { - int (*set_system_active)(void); #define XSM_HOOK0(rtype, name) rtype (*name)(void); #define XSM_HOOK1(rtype, name, type1) \ @@ -77,7 +76,6 @@ struct xsm_ops { #include "hooks.h" - char *(*show_irq_sid)(int irq); }; #ifdef CONFIG_XSM @@ -86,11 +84,6 @@ extern struct xsm_ops xsm_ops; #ifndef XSM_NO_WRAPPERS -static inline int xsm_set_system_active(void) -{ - return alternative_call(xsm_ops.set_system_active); -} - #define XSM_ALT_void alternative_vcall #define XSM_ALT_int return alternative_call #define XSM_ALT_pchar_t return alternative_call @@ -138,11 +131,6 @@ static inline rtype xsm_ ## name( \ #include "hooks.h" -static inline char *xsm_show_irq_sid(int irq) -{ - return alternative_call(xsm_ops.show_irq_sid, irq); -} - #endif /* XSM_NO_WRAPPERS */ #ifdef CONFIG_MULTIBOOT --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -14,7 +14,6 @@ #include <xsm/dummy.h> static const struct xsm_ops __initconst_cf_clobber dummy_ops = { - .set_system_active = xsm_set_system_active, #define XSM_HOOK0(rtype, name) .name = xsm_ ## name, #define XSM_HOOK1(rtype, name, ...) XSM_HOOK0(rtype, name) @@ -25,7 +24,6 @@ static const struct xsm_ops __initconst_ #include <xsm/hooks.h> - .show_irq_sid = xsm_show_irq_sid, }; void __init xsm_fixup_ops(struct xsm_ops *ops) --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1903,7 +1903,6 @@ static int cf_check flask_get_domain_sta } static const struct xsm_ops __initconst_cf_clobber flask_ops = { - .set_system_active = flask_set_system_active, #define XSM_HOOK0(rtype, name) .name = flask_ ## name, #define XSM_HOOK1(rtype, name, ...) XSM_HOOK0(rtype, name) @@ -1914,7 +1913,6 @@ static const struct xsm_ops __initconst_ #include <xsm/hooks.h> - .show_irq_sid = flask_show_irq_sid, }; const struct xsm_ops *__init flask_init(