From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>, xen-devel@lists.xen.org
Cc: Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH 12/17] xen/xsm: remove .xsm_initcall.init section
Date: Tue, 21 Jun 2016 16:21:47 +0100 [thread overview]
Message-ID: <ab27af1e-63e4-f246-fa84-f69345f6afbb@citrix.com> (raw)
In-Reply-To: <1466431466-28055-13-git-send-email-dgdegra@tycho.nsa.gov>
On 20/06/16 15:04, Daniel De Graaf wrote:
> Since FLASK is the only implementation of XSM hooks in Xen, using an
> iterated initcall dispatch for setup is overly complex. Change this to
> a direct function call to a globally visible function; if additional XSM
> hooks are added in the future, a switching mechanism will be needed
> regardless, and that can be placed in xsm_core.c.
>
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
(CC'ing ARM maintainers)
> ---
> xen/arch/arm/xen.lds.S | 5 -----
> xen/arch/x86/xen.lds.S | 5 -----
> xen/include/xsm/xsm.h | 16 ++++++++--------
> xen/xsm/flask/hooks.c | 4 +---
> xen/xsm/xsm_core.c | 13 +------------
> 5 files changed, 10 insertions(+), 33 deletions(-)
>
> diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
> index 76982b2..8320381 100644
> --- a/xen/arch/arm/xen.lds.S
> +++ b/xen/arch/arm/xen.lds.S
> @@ -162,11 +162,6 @@ SECTIONS
> *(.initcall1.init)
> __initcall_end = .;
> } :text
> - .xsm_initcall.init : {
> - __xsm_initcall_start = .;
> - *(.xsm_initcall.init)
> - __xsm_initcall_end = .;
> - } :text
> __init_end_efi = .;
> . = ALIGN(STACK_SIZE);
> __init_end = .;
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index a43b29d..dcbb8fe 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -190,11 +190,6 @@ SECTIONS
> *(.initcall1.init)
> __initcall_end = .;
> } :text
> - .xsm_initcall.init : {
> - __xsm_initcall_start = .;
> - *(.xsm_initcall.init)
> - __xsm_initcall_end = .;
> - } :text
> . = ALIGN(PAGE_SIZE);
> __init_end = .;
>
> diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
> index 8ed8ee5..0d525ec 100644
> --- a/xen/include/xsm/xsm.h
> +++ b/xen/include/xsm/xsm.h
> @@ -46,14 +46,6 @@ typedef enum xsm_default xsm_default_t;
> extern char *policy_buffer;
> extern u32 policy_size;
>
> -typedef void (*xsm_initcall_t)(void);
> -
> -extern xsm_initcall_t __xsm_initcall_start[], __xsm_initcall_end[];
> -
> -#define xsm_initcall(fn) \
> - static xsm_initcall_t __initcall_##fn \
> - __used_section(".xsm_initcall.init") = fn
> -
> struct xsm_operations {
> void (*security_domaininfo) (struct domain *d,
> struct xen_domctl_getdomaininfo *info);
> @@ -763,6 +755,14 @@ extern int unregister_xsm(struct xsm_operations *ops);
> extern struct xsm_operations dummy_xsm_ops;
> extern void xsm_fixup_ops(struct xsm_operations *ops);
>
> +#ifdef CONFIG_FLASK
> +extern void flask_init(void);
> +#else
> +static inline void flask_init(void)
> +{
> +}
> +#endif
> +
> #else /* CONFIG_XSM */
>
> #include <xsm/dummy.h>
> diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
> index 543406b..d632b0e 100644
> --- a/xen/xsm/flask/hooks.c
> +++ b/xen/xsm/flask/hooks.c
> @@ -1817,7 +1817,7 @@ static struct xsm_operations flask_ops = {
> .xen_version = flask_xen_version,
> };
>
> -static __init void flask_init(void)
> +__init void flask_init(void)
> {
> int ret = -ENOENT;
>
> @@ -1860,8 +1860,6 @@ static __init void flask_init(void)
> printk(XENLOG_INFO "Flask: Starting in permissive mode.\n");
> }
>
> -xsm_initcall(flask_init);
> -
> /*
> * Local variables:
> * mode: C
> diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
> index 634ec98..3487742 100644
> --- a/xen/xsm/xsm_core.c
> +++ b/xen/xsm/xsm_core.c
> @@ -36,17 +36,6 @@ static inline int verify(struct xsm_operations *ops)
> return 0;
> }
>
> -static void __init do_xsm_initcalls(void)
> -{
> - xsm_initcall_t *call;
> - call = __xsm_initcall_start;
> - while ( call < __xsm_initcall_end )
> - {
> - (*call) ();
> - call++;
> - }
> -}
> -
> static int __init xsm_core_init(void)
> {
> if ( verify(&dummy_xsm_ops) )
> @@ -57,7 +46,7 @@ static int __init xsm_core_init(void)
> }
>
> xsm_ops = &dummy_xsm_ops;
> - do_xsm_initcalls();
> + flask_init();
>
> return 0;
> }
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-21 15:21 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 14:04 [PATCH v2 00/17] XSM/FLASK updates for 4.8 Daniel De Graaf
2016-06-20 14:04 ` [PATCH 01/17] flask/policy: split into modules Daniel De Graaf
2016-06-20 14:04 ` [PATCH 02/17] flask/policy: split out rules for system_r Daniel De Graaf
2016-06-20 14:04 ` [PATCH 03/17] flask/policy: move user definitions and constraints into modules Daniel De Graaf
2016-06-20 14:04 ` [PATCH 04/17] flask/policy: remove unused support for binary modules Daniel De Graaf
2016-06-20 14:04 ` [PATCH 05/17] flask/policy: xenstore stubdom policy Daniel De Graaf
2016-06-20 14:04 ` [PATCH 06/17] flask/policy: remove unused example Daniel De Graaf
2016-06-20 14:04 ` [PATCH 07/17] flask: unify {get, set}vcpucontext permissions Daniel De Graaf
2016-06-20 14:27 ` Doug Goldstein
2016-06-20 14:35 ` Andrew Cooper
2016-06-20 14:50 ` Daniel De Graaf
2016-06-20 14:58 ` Andrew Cooper
2016-06-20 14:04 ` [PATCH 08/17] flask: remove unused secondary context in ocontext Daniel De Graaf
2016-06-20 14:30 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 09/17] flask: remove unused AVC callback functions Daniel De Graaf
2016-06-20 14:32 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 10/17] flask: remove xen_flask_userlist operation Daniel De Graaf
2016-06-20 14:19 ` Jan Beulich
2016-06-20 14:35 ` Doug Goldstein
2016-06-20 15:07 ` Daniel De Graaf
2016-06-20 15:16 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 11/17] flask: improve unknown permission handling Daniel De Graaf
2016-06-20 14:37 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 12/17] xen/xsm: remove .xsm_initcall.init section Daniel De Graaf
2016-06-20 14:38 ` Doug Goldstein
2016-06-21 15:21 ` Andrew Cooper [this message]
2016-06-21 15:41 ` Julien Grall
2016-06-21 16:03 ` Andrew Cooper
2016-06-20 14:04 ` [PATCH 13/17] xen: move FLASK entry under XSM in Kconfig Daniel De Graaf
2016-06-20 14:41 ` Doug Goldstein
2016-06-20 14:42 ` Doug Goldstein
2016-06-20 14:46 ` Doug Goldstein
2016-06-20 15:11 ` Daniel De Graaf
2016-06-20 15:28 ` Jan Beulich
2016-06-20 16:49 ` Doug Goldstein
2016-06-21 17:09 ` [PATCH 13/17 v3] " Daniel De Graaf
2016-06-24 14:43 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 14/17] xsm: annotate setup functions with __init Daniel De Graaf
2016-06-20 14:46 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 15/17] xsm: clean up unregistration Daniel De Graaf
2016-06-20 14:47 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 16/17] xen: Make FLASK_AVC_STATS kconfig option visible Daniel De Graaf
2016-06-20 14:49 ` Doug Goldstein
2016-06-20 14:04 ` [PATCH 17/17] xsm: add a default policy to .init.data Daniel De Graaf
2016-06-20 14:52 ` Doug Goldstein
2016-06-24 16:30 ` Julien Grall
2016-06-24 16:50 ` Konrad Rzeszutek Wilk
2016-06-24 17:34 ` Daniel De Graaf
2016-06-24 17:40 ` Konrad Rzeszutek Wilk
2016-06-24 17:42 ` Daniel De Graaf
2016-06-24 17:46 ` Konrad Rzeszutek Wilk
2016-06-24 18:02 ` Daniel De Graaf
2016-06-24 18:36 ` Konrad Rzeszutek Wilk
2016-06-24 17:41 ` Konrad Rzeszutek Wilk
2016-06-24 17:47 ` Julien Grall
2016-06-24 17:44 ` Julien Grall
2016-06-21 15:24 ` [PATCH v2 00/17] XSM/FLASK updates for 4.8 Andrew Cooper
2016-06-27 9:48 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab27af1e-63e4-f246-fa84-f69345f6afbb@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).