xsm: Use __initconst_cf_clobber for xsm_ops
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 4 Nov 2021 19:36:23 +0000 (19:36 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 23 Feb 2022 15:33:43 +0000 (15:33 +0000)
All calls through xsm_ops are fully altcall'd.  Harden all function pointer
targets.

This yields:

  (XEN) altcall: Optimised away 197 endbr64 instructions

of 1655 on an everything-enabled build of Xen, which is ~12%.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/xsm/dummy.c
xen/xsm/flask/hooks.c
xen/xsm/silo.c

index 4d29a9aa5b9f5fff48ffe209c04614668c2c92db..8c044ef61500ae1f8a7817726f7ad268be4d2c05 100644 (file)
@@ -13,7 +13,7 @@
 #define XSM_NO_WRAPPERS
 #include <xsm/dummy.h>
 
-static const struct xsm_ops __initconstrel dummy_ops = {
+static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
     .security_domaininfo           = xsm_security_domaininfo,
     .domain_create                 = xsm_domain_create,
     .getdomaininfo                 = xsm_getdomaininfo,
index 63484e323c098f85221060bebf0a7223e3b3e1da..0bf63ffa84c418c361ee6199b6f9a6d48ec32f40 100644 (file)
@@ -1765,7 +1765,7 @@ static int cf_check flask_argo_send(
 
 #endif
 
-static const struct xsm_ops __initconstrel flask_ops = {
+static const struct xsm_ops __initconst_cf_clobber flask_ops = {
     .security_domaininfo = flask_security_domaininfo,
     .domain_create = flask_domain_create,
     .getdomaininfo = flask_getdomaininfo,
index 4d5fc98e7e5493b91446448a419405f5e73362bd..b89b364287840623792f853e44070ce24a2b3cc4 100644 (file)
@@ -102,7 +102,7 @@ static int cf_check silo_argo_send(
 
 #endif
 
-static const struct xsm_ops __initconstrel silo_xsm_ops = {
+static const struct xsm_ops __initconst_cf_clobber silo_xsm_ops = {
     .evtchn_unbound = silo_evtchn_unbound,
     .evtchn_interdomain = silo_evtchn_interdomain,
     .grant_mapref = silo_grant_mapref,