xen/xsm: Introduce new boot parameter xsm
PATCH 1/2 xen/xsm: Introduce new boot parameter xsm
Introduce new boot parameter xsm to choose which xsm module is enabled, and set default to dummy.
---
CC: Daniel De Graaf <[email protected]>
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: Ming Lu <[email protected]>
v4:
1. change the default XSM boot parameter name from "default" to "dummy".
2. Kconfig, remove XSM_FLASK from EXPERT.
3. Kconfig, add new choice to select the default XSM module.
--- docs/misc/xen-command-line.markdown | 13 ++++++++ xen/common/Kconfig | 13 +++++++- xen/xsm/xsm_core.c | 46 ++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-)
docs/misc/xen-command-line.markdown +13 -0
@@ -899,6 +899,19 @@ hardware domain is architecture dependent. Note that specifying zero as domU value means zero, while for dom0 it means to use the default. +### xsm +> `= dummy | flask` + +> Default: `dummy` + +Specify which XSM module should be enabled. This option is only available if +the hypervisor was compiled with XSM support. + +* `dummy`: this is the default choice. Basic restriction for common deployment + (the dummy module) will be applied. it's also used when XSM is compiled out. +* `flask`: this is the policy based access control. To choose this, the + separated option in kconfig must also be enabled. + ### flask > `= permissive | enforcing | late | disabled`
xen/common/Kconfig +12 -1
@@ -116,7 +116,7 @@ config XSM config XSM_FLASK def_bool y - prompt "FLux Advanced Security Kernel support" if EXPERT = "y" + prompt "FLux Advanced Security Kernel support" depends on XSM ---help--- Enables FLASK (FLux Advanced Security Kernel) as the access control
@@ -154,6 +154,17 @@ config XSM_FLASK_POLICY If unsure, say Y. +choice + prompt "Default XSM implementation" + depends on XSM + default XSM_FLASK_DEFAULT if XSM_FLASK + default XSM_DUMMY_DEFAULT + config XSM_DUMMY_DEFAULT + bool "Match non-XSM behavior" + config XSM_FLASK_DEFAULT + bool "FLux Advanced Security Kernel" if XSM_FLASK +endchoice + config LATE_HWDOM bool "Dedicated hardware domain" default n
xen/xsm/xsm_core.c +45 -1
58 lines not on this page · raw message
Signature · 7 lines
2.18.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/2 xen/xsm: Add new SILO mode for XSM
When SILO is enabled, there would be no page-sharing or event notifications between unprivileged VMs (no grant tables or event channels).
---
CC: Daniel De Graaf <[email protected]>
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: Ming Lu <[email protected]>
v4:
1. include the dummy.h as a copy, and call the dummy module functions to avoid indirect all.
2. call register_xsm() to setup silo module.
--- docs/misc/xen-command-line.markdown | 5 +- xen/common/Kconfig | 15 ++++ xen/include/xsm/dummy.h | 5 ++ xen/include/xsm/xsm.h | 6 ++ xen/xsm/Makefile | 1 + xen/xsm/dummy.c | 1 - xen/xsm/silo.c | 109 ++++++++++++++++++++++++++++ xen/xsm/xsm_core.c | 11 +++ 8 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 xen/xsm/silo.c
docs/misc/xen-command-line.markdown +4 -1
@@ -900,7 +900,7 @@ Note that specifying zero as domU value means zero, while for dom0 it means to use the default. ### xsm -> `= dummy | flask` +> `= dummy | flask | silo` > Default: `dummy`
@@ -911,6 +911,9 @@ the hypervisor was compiled with XSM support. (the dummy module) will be applied. it's also used when XSM is compiled out. * `flask`: this is the policy based access control. To choose this, the separated option in kconfig must also be enabled. +* `silo`: this will deny any unmediated communication channels between + unprivileged VMs. To choose this, the separated option in kconfig must also + be enabled. ### flask > `= permissive | enforcing | late | disabled`
xen/common/Kconfig +15 -0
@@ -154,15 +154,30 @@ config XSM_FLASK_POLICY If unsure, say Y. +config XSM_SILO + def_bool y + prompt "SILO support" + depends on XSM + ---help--- + Enables SILO as the access control mechanism used by the XSM framework. + This is not the default module, add boot parameter xsm=silo to choose + it. This will deny any unmediated communication channels (grant tables + and event channels) between unprivileged VMs. + + If unsure, say Y. + choice prompt "Default XSM implementation" depends on XSM default XSM_FLASK_DEFAULT if XSM_FLASK + default XSM_SILO_DEFAULT if XSM_SILO default XSM_DUMMY_DEFAULT config XSM_DUMMY_DEFAULT bool "Match non-XSM behavior" config XSM_FLASK_DEFAULT bool "FLux Advanced Security Kernel" if XSM_FLASK + config XSM_SILO_DEFAULT + bool "SILO" if XSM_SILO endchoice config LATE_HWDOM
xen/include/xsm/dummy.h +5 -0
@@ -48,7 +48,12 @@ void __xsm_action_mismatch_detected(void);* There is no xsm_default_t argument available, so the value from the assertion * is used to initialize the variable. */ +#ifdef CONFIG_XSM_SILO +#define XSM_INLINE __attribute__ ((unused)) +#else #define XSM_INLINE /* */ +#endif +#define XSM_DEFAULT_ARG /* */ #define XSM_DEFAULT_VOID void#define XSM_ASSERT_ACTION (def) xsm_default_t action = def; (void)action
xen/include/xsm/xsm.h +6 -0
@@ -733,6 +733,12 @@ extern const unsigned char xsm_flask_init_policy[];extern const unsigned int xsm_flask_init_policy_size;#endif +#ifdef CONFIG_XSM_SILO +extern void silo_init (void ); +#else +static inline void silo_init (void ) {} +#endif +#else /* CONFIG_XSM */ #include <xsm/dummy.h>
xen/xsm/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-y += xsm_core.o obj-$(CONFIG_XSM) += xsm_policy.o obj-$(CONFIG_XSM) += dummy.o +obj-$(CONFIG_XSM_SILO) += silo.o subdir-$(CONFIG_XSM_FLASK) += flask
xen/xsm/dummy.c +0 -1
@@ -11,7 +11,6 @@*/ #define XSM_NO_WRAPPERS -#define XSM_INLINE /* */ #include <xsm/dummy.h> struct xsm_operations dummy_xsm_ops;
xen/xsm/silo.c new file +109 -0
109 lines not on this page · raw message
xen/xsm/xsm_core.c +11 -0
@@ -34,11 +34,14 @@ struct xsm_operations *xsm_ops;enum xsm_bootparam {XSM_BOOTPARAM_DUMMY ,XSM_BOOTPARAM_FLASK , +XSM_BOOTPARAM_SILO , }; static enum xsm_bootparam __initdata xsm_bootparam =#ifdef CONFIG_XSM_FLASK_DEFAULT XSM_BOOTPARAM_FLASK ; +#elif CONFIG_XSM_SILO_DEFAULT +XSM_BOOTPARAM_SILO ;#else XSM_BOOTPARAM_DUMMY ;#endif
@@ -52,6 +55,10 @@ static int __init parse_xsm_param(const char *s)#ifdef CONFIG_XSM_FLASK else if ( !strcmp(s, "flask") ) xsm_bootparam =XSM_BOOTPARAM_FLASK ; +#endif +#ifdef CONFIG_XSM_SILO + else if ( !strcmp(s, "silo") ) + xsm_bootparam =XSM_BOOTPARAM_SILO ;#endif else {printk ("XSM: can't parse boot parameter xsm=%s\n" , s);
@@ -98,6 +105,10 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)flask_init (policy_buffer, policy_size);break ; +case XSM_BOOTPARAM_SILO : +silo_init (); +break ; +default :printk ("XSM: Invalid value for xsm= boot parameter\n" );break ;
Signature · 7 lines
2.18.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Non-DoD Source] [PATCH 2/2] xen/xsm: Add new SILO mode for XSM
Quoted 6 lines
When SILO is enabled, there would be no page-sharing or event notifications between unprivileged VMs (no grant tables or event channels).
Signed-off-by Xin Li <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen/xsm: Add new SILO mode for XSM
In reply to Xin Lixen/include/xsm/dummy.h void __xsm_action_mismatch_detected(void); · line 52
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.09.18 at 11:22, <[email protected]> wrote:
xen/include/xsm/dummy.h +2
-0@@ -48,7 +48,12 @@ void __xsm_action_mismatch_detected(void);* There is no xsm_default_t argument available, so the value from the assertion * is used to initialize the variable. */ +#ifdef CONFIG_XSM_SILO +#define XSM_INLINE __attribute__ ((unused))
Please don't open-code __maybe_unused. Furthermore I question the dependency on CONFIG_XSM_SILO here: Afaict you want this for just the single new inclusion site, without affecting any others.
xen/include/xsm/xsm.h extern const unsigned char xsm_flask_init_policy[]; · line 740
Quoted 11 lines
xen/include/xsm/xsm.h +5
-0@@ -733,6 +733,12 @@ extern const unsigned char xsm_flask_init_policy[];extern const unsigned int xsm_flask_init_policy_size;#endif +#ifdef CONFIG_XSM_SILO +extern void silo_init (void ); +#else +static inline void silo_init (void ) {} +#endif
Along the lines of one of my remarks on patch 1, I think you would better get away without the inline variant, by adding suitable #ifdef-s to eliminate the risk of wrong use of the new enumerator.
xen/xsm/dummy.c line 14
Quoted 8 lines
xen/xsm/dummy.c +0
-1@@ -11,7 +11,6 @@*/ #define XSM_NO_WRAPPERS -#define XSM_INLINE /* */ #include <xsm/dummy.h>
The change looks unmotivated here, perhaps because of the questionable CONFIG_XSM_SILO dependency further up. That said, it looks as if the #define could go away currently, as being redundant with what dummy.h already has. That would then better be a small separate prereq patch imo.
xen/xsm/silo.c line 4
Quoted 7 lines
xen/xsm/silo.c new file +4
-0@@ -0,0 +1,109 @@ +/****************************************************************************** +* xsm/silo.c +* +* SILO module for XSM(Xen Security Modules)
Would you mind adding the missing blank here?
Quoted 7 lines
xen/xsm/silo.c new file +7
-0+* Copyright (c) 2018 Citrix Systems Ltd. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT
xen/xsm/silo.c line 22
Quoted 10 lines
xen/xsm/silo.c new file +10
-0+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; If not, see <http://www.gnu.org/licenses/>. +*/ +#define XSM_NO_WRAPPERS + +#include <xsm/dummy.h>
Please switch around the blank and the #define lines, matching how dummy.c is written. This helps readers understand that the #define is specifically in preparation of the #include.
xen/xsm/silo.c line 31
Quoted 8 lines
xen/xsm/silo.c new file +8
-0+/* +* Check if inter-domain communication is allowed. +* Return true when pass check. +*/ +static bool silo_mode_dom_check (const struct domain *ldom, +const struct domain *rdom) +{ +const struct domain *cur_dom = current->domain;
We commonly call such variables currd.
xen/xsm/silo.c line 43
Quoted 11 lines
xen/xsm/silo.c new file +11
-0+return (is_control_domain (cur_dom) ||is_control_domain (ldom) || +is_control_domain (rdom) || ldom == rdom); +} + +static int silo_evtchn_unbound (struct domain *d1,struct evtchn *chn, +domid_t id2) +{ +int rc = -EPERM ; +struct domain *d2 =rcu_lock_domain_by_any_id (id2); + +if ( d2 ==NULL )
We generally try to use the shorter !d2 in new code. But it's a matter of personal preference, I agree.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen/xsm: Add new SILO mode for XSM
Thanks Jan.
Quoted 18 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, October 2, 2018 5:33 PM
To: Xin Li <[email protected]>
Cc: Andrew Cooper <[email protected]>; Ming Lu <[email protected]>; Sergey Dyasli <[email protected]>; Wei Liu <[email protected]>; Xin Li (Talons) <[email protected]>; George Dunlap <[email protected]>; Stefano Stabellini <[email protected]>; xen- [email protected]; Konrad Rzeszutek Wilk <[email protected]>; Daniel de Graaf <[email protected]>; Tim (Xen.org) <[email protected]>
Subject: Re: [PATCH 2/2] xen/xsm: Add new SILO mode for XSMxen/include/xsm/dummy.h void __xsm_action_mismatch_detected(void); · line 48
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 29.09.18 at 11:22, <[email protected]> wrote:
xen/include/xsm/dummy.h +0
-0@@ -48,7 +48,12 @@ void __xsm_action_mismatch_detected(void);* There is no xsm_default_t argument available, so the value from the assertion
Quoted 8 lines
xen/include/xsm/dummy.h void __xsm_action_mismatch_detected(void); · line 52
Quoted 4 lines
xen/include/xsm/dummy.h +2
-0* is used to initialize the variable. */ +#ifdef CONFIG_XSM_SILO +#define XSM_INLINE __attribute__ ((unused))Please don't open-code
__maybe_unused. Furthermore I question the dependency onCONFIG_XSM_SILOhere: Afaict you want this for just the single new inclusion site, without affecting any others.
OK, use __maybe_unused directly and remove this #ifdef.
Quoted 7 lines
Quoted 7 lines
xen/include/xsm/xsm.h +0
-0@@ -733,6 +733,12 @@ extern const unsigned charxsm_flask_init_policy[]; extern const unsigned int
xsm_flask_init_policy_size; #endif
Quoted 8 lines
xen/include/xsm/xsm.h extern const unsigned char xsm_flask_init_policy[];
Quoted 4 lines
xen/include/xsm/xsm.h +4
-0+#ifdef CONFIG_XSM_SILO +extern void silo_init (void ); +#else +static inline void silo_init (void ) {}#endif Along the lines of one of my remarks on patch 1, I think you would better get away without the inline variant, by adding suitable #ifdef-s to eliminate the risk of wrong use of the new enumerator.
I can remove the inline function, and add #idef in xsm_core.c But, this way does not match the current code style(like flask_init()). So I would like to keep this way.
Quoted 6 lines
Quoted 6 lines
xen/xsm/dummy.c +0
-0@@ -11,7 +11,6 @@*/
Quoted 8 lines
xen/xsm/dummy.c line 14
Quoted 3 lines
xen/xsm/dummy.c +0
-1#define XSM_NO_WRAPPERS -#define XSM_INLINE /* */ #include <xsm/dummy.h> The change looks unmotivated here, perhaps because of the questionable
CONFIG_XSM_SILOdependency further up. That said, it looks as if the #define could go away currently, as being redundant with whatdummy.halready has. That would then better be a small separate prereq patch imo.
This is intended, to avoid compile error, can't refine XSM_INLINE. Do you mean a separate patch to just remove this line?
Quoted 7 lines
xen/xsm/silo.c
Quoted 5 lines
xen/xsm/silo.c new file +0
-0@@ -0,0 +1,109 @@+/***************************************************************
*****
Quoted 6 lines
xen/xsm/silo.c line 4
Quoted 4 lines
xen/xsm/silo.c new file +4
-0+********** + * xsm/silo.c + * + * SILO module for XSM(Xen Security Modules)Would you mind adding the missing blank here?
Do you mean add one space after XSM?
* SILO module for XSM (Xen Security Modules)
Quoted 12 lines
xen/xsm/silo.c
Quoted 11 lines
xen/xsm/silo.c new file +10
-0+* Copyright (c) 2018 Citrix Systems Ltd. +* +* This program is free software; you can redistribute it and/or +modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but +WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Quoted 16 lines
xen/xsm/silo.c line 22
Quoted 12 lines
xen/xsm/silo.c new file +12
-0+or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +License for +* more details. +* +* You should have received a copy of the GNU General Public License +along with +* this program; If not, see <http://www.gnu.org/licenses/>. +*/ +#define XSM_NO_WRAPPERS + +#include <xsm/dummy.h> Please switch around the blank and the #define lines, matching how
dummy.cis written. This helps readers understand that the #define is specifically in preparation of the #include.
OK. Remove the line before #include.
Quoted 9 lines
xen/xsm/silo.c line 31
Quoted 7 lines
xen/xsm/silo.c new file +7
-0+/* +* Check if inter-domain communication is allowed. +* Return true when pass check. +*/ +static bool silo_mode_dom_check (const struct domain *ldom, +const struct domain *rdom) { +const struct domain *cur_dom = current->domain;We commonly call such variables currd.
OK. Rename this var.
Quoted 13 lines
xen/xsm/silo.c line 43
Quoted 10 lines
xen/xsm/silo.c new file +9
-0+return (is_control_domain (cur_dom) ||is_control_domain (ldom) || +is_control_domain (rdom) || ldom == rdom); } + +static int silo_evtchn_unbound (struct domain *d1,struct evtchn *chn, +domid_t id2) { +int rc = -EPERM ; +struct domain *d2 =rcu_lock_domain_by_any_id (id2); + +if ( d2 ==NULL )We generally try to use the shorter !d2 in new code. But it's a matter of personal preference, I agree.
Thanks. I will just keep it.
Quoted 3 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen/xsm: Add new SILO mode for XSM
Quoted 19 lines
Quoted 10 lines
Quoted 1 line · On 08.10.18 at 09:49, <[email protected]> wrote:
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, October 2, 2018 5:33 PMQuoted 6 lines
Quoted 1 line
Quoted 1 line · On 29.09.18 at 11:22, <[email protected]> wrote:
xen/xsm/dummy.c +0
-0@@ -11,7 +11,6 @@*/ Quoted 8 lines
xen/xsm/dummy.c line 14
Quoted 3 lines
xen/xsm/dummy.c +0
-1#define XSM_NO_WRAPPERS -#define XSM_INLINE /* */ #include <xsm/dummy.h> The change looks unmotivated here, perhaps because of the questionable
CONFIG_XSM_SILOdependency further up. That said, it looks as if the #define could go away currently, as being redundant with whatdummy.halready has. That would then better be a small separate prereq patch imo.
Quoted 2 lines
This is intended, to avoid compile error, can't refine
XSM_INLINE. Do you mean a separate patch to just remove this line?
Yes, and then with an explanation of why this line is not needed.
Quoted 11 lines
Quoted 11 lines
xen/xsm/silo.c
Quoted 4 lines
xen/xsm/silo.c new file +0
-0@@ -0,0 +1,109 @@+/***************************************************************
*****Quoted 4 lines
xen/xsm/silo.c new file +4
-0+********** + * xsm/silo.c + * + * SILO module for XSM(Xen Security Modules)
Quoted 4 lines
Quoted 1 line
Would you mind adding the missing blank here?
Do you mean add one space after XSM?
* SILO module for XSM (Xen Security Modules)
Yes.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines
Introduce new boot parameter xsm to choose which xsm module is enabled, and set default to dummy.
Signed-off-by Xin Li <[email protected]>
It might be useful for the commit message to also reference the new Kconfig option; thanks for adding it.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Thanks Daniel.
Quoted 18 lines
-----Original Message-----
From: DeGraaf, Daniel G [mailto:[email protected]]
Sent: Monday, October 1, 2018 11:18 PM
To: 'Xin Li' <[email protected]>; [email protected]
Cc: Xin Li (Talons) <[email protected]>; Daniel De Graaf <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>; Konrad Rzeszutek Wilk <[email protected]>; Stefano Stabellini <[email protected]>; Tim (Xen.org) <[email protected]>; Wei Liu <[email protected]>; Sergey Dyasli <[email protected]>; Andrew Cooper <[email protected]>; Ming Lu <[email protected]>
Subject: RE: [Non-DoD Source] [PATCH 1/2] xen/xsm: Introduce new boot parameter xsmQuoted 4 lines
Introduce new boot parameter xsm to choose which xsm module is enabled, and set default to dummy.
Quoted 6 lines
Quoted 1 line
Signed-off-by Xin Li <[email protected]>Acked-by Daniel De Graaf <[email protected]>It might be useful for the commit message to also reference the new
Kconfigoption; thanks for adding it.
OK. Sure.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 29.09.18 at 11:22, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -899,6 +899,19 @@ hardware domain is architecture dependent. Note that specifying zero as domU value means zero, while for dom0 it means to use the default.
docs/misc/xen-command-line.markdown hardware domain is architecture dependent. · line 911
Quoted 10 lines
docs/misc/xen-command-line.markdown +10
-0+### xsm +> `= dummy | flask` + +> Default: `dummy` + +Specify which XSM module should be enabled. This option is only available if +the hypervisor was compiled with XSM support. + +* `dummy`: this is the default choice. Basic restriction for common deployment + (the dummy module) will be applied. it's also used when XSM is compiled out.
"It's" (upper case I).
docs/misc/xen-command-line.markdown hardware domain is architecture dependent. · line 913
Quoted 2 lines
docs/misc/xen-command-line.markdown +2
-0+* `flask`: this is the policy based access control. To choose this, the + separated option in kconfig must also be enabled.
Perhaps better "separate" (but I'm not a native speaker)?
Quoted 4 lines
docs/misc/xen-command-line.markdown +0
-0@@ -154,6 +154,17 @@ config XSM_FLASK_POLICY If unsure, say Y.
docs/misc/xen-command-line.markdown config XSM_FLASK_POLICY · line 166
Quoted 10 lines
docs/misc/xen-command-line.markdown +10
-0+choice + prompt "Default XSM implementation" + depends on XSM + default XSM_FLASK_DEFAULT if XSM_FLASK + default XSM_DUMMY_DEFAULT + config XSM_DUMMY_DEFAULT + bool "Match non-XSM behavior" + config XSM_FLASK_DEFAULT + bool "FLux Advanced Security Kernel" if XSM_FLASK +endchoice
Personally I'd prefer XSM_DEFAULT_*; not sure what others think.
xen/xsm/xsm_core.c line 36
Quoted 9 lines
xen/xsm/xsm_core.c +3
-0@@ -31,6 +31,37 @@struct xsm_operations *xsm_ops; +enum xsm_bootparam { +XSM_BOOTPARAM_DUMMY , +XSM_BOOTPARAM_FLASK ,
Considering the #ifdef-s further down, should this perhaps also be put in "#ifdef CONFIG_XSM_FLASK", to avoid it mistakenly getting used when the code was compiled out?
Quoted 10 lines
xen/xsm/xsm_core.c +10
-0+}; + +static enum xsm_bootparam __initdata xsm_bootparam = +#ifdef CONFIG_XSM_FLASK_DEFAULT +XSM_BOOTPARAM_FLASK ; +#else +XSM_BOOTPARAM_DUMMY ; +#endif + +static int __init parse_xsm_param (const char *s)
xen/xsm/xsm_core.c line 56
Quoted 10 lines
xen/xsm/xsm_core.c +10
-0+{ +int rc =0 ; + +if ( !strcmp (s,"dummy" ) ) + xsm_bootparam =XSM_BOOTPARAM_DUMMY ; +#ifdef CONFIG_XSM_FLASK + else if ( !strcmp(s, "flask") ) + xsm_bootparam =XSM_BOOTPARAM_FLASK ; +#endif + else {
Style (brace goes on its own line).
xen/xsm/xsm_core.c line 57
Quoted 1 line
xen/xsm/xsm_core.c +1
-0+printk ("XSM: can't parse boot parameter xsm=%s\n" , s);
Again, not being a native speaker, "can't parse" sounds odd. Why not just "unknown" or "unknown or unsupported"?
Quoted 8 lines
xen/xsm/xsm_core.c +3
-1@@ -57,7 +88,20 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size) } xsm_ops = &dummy_xsm_ops; -flask_init (policy_buffer, policy_size); + +switch ( xsm_bootparam ) + {
xen/xsm/xsm_core.c static int __init xsm_core_init(const void *policy_buffer, size_t policy_size) · line 103
Quoted 10 lines
xen/xsm/xsm_core.c +10
-0+case XSM_BOOTPARAM_DUMMY : +break ; + +case XSM_BOOTPARAM_FLASK : +flask_init (policy_buffer, policy_size); +break ; + +default : +printk ("XSM: Invalid value for xsm= boot parameter\n" ); +break ;
What situation is this covering, when all enumerators already have their case label? Simply ASSERT_UNREACHABLE()?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Thanks Jan.
Quoted 20 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 29.09.18 at 11:22, <[email protected]> wrote:
docs/misc/xen-command-line.markdown +0
-0@@ -899,6 +899,19 @@ hardware domain is architecture dependent. Note that specifying zero as domU value means zero, while for dom0 itmeans to use the default.
docs/misc/xen-command-line.markdown +1
-0+### xsmdocs/misc/xen-command-line.markdown hardware domain is architecture dependent.
Quoted 10 lines
docs/misc/xen-command-line.markdown +10
-0+> `= dummy | flask` + +> Default: `dummy` + +Specify which XSM module should be enabled. This option is only +available if the hypervisor was compiled with XSM support. + +* `dummy`: this is the default choice. Basic restriction for common +deployment + (the dummy module) will be applied. it's also used when XSM is compiledout.
Quoted 2 lines
"It's" (upper case I).
OK. Done.
Quoted 6 lines
docs/misc/xen-command-line.markdown
Quoted 3 lines
docs/misc/xen-command-line.markdown +3
-0+* `flask`: this is the policy based access control. To choose this, +the + separated option in kconfig must also be enabled.Perhaps better "separate" (but I'm not a native speaker)?
I prefer separated, as I checked here: https://english.stackexchange.com/questions/13144/separated-versus-separate
But generally both are OK I think.
Quoted 4 lines
Quoted 4 lines
docs/misc/xen-command-line.markdown +0
-0@@ -154,6 +154,17 @@ config XSM_FLASK_POLICY If unsure, say Y.
Quoted 12 lines
docs/misc/xen-command-line.markdown config XSM_FLASK_POLICY · line 165
Quoted 9 lines
docs/misc/xen-command-line.markdown +9
-0+choice + prompt "Default XSM implementation" + depends on XSM + default XSM_FLASK_DEFAULT if XSM_FLASK + default XSM_DUMMY_DEFAULT + config XSM_DUMMY_DEFAULT + bool "Match non-XSM behavior" + config XSM_FLASK_DEFAULT + bool "FLux Advanced Security Kernel" if XSM_FLASK endchoicePersonally I'd prefer XSM_DEFAULT_*; not sure what others think.
I would like to keep this style, because I see "
default "credit" if SCHED_CREDIT_DEFAULT default "credit2" if SCHED_CREDIT2_DEFAULT
" in config file.
Quoted 6 lines
Quoted 6 lines
xen/xsm/xsm_core.c +0
-0@@ -31,6 +31,37 @@struct xsm_operations *xsm_ops;
Quoted 8 lines
xen/xsm/xsm_core.c line 36
Quoted 3 lines
xen/xsm/xsm_core.c +3
-0+enum xsm_bootparam { +XSM_BOOTPARAM_DUMMY , +XSM_BOOTPARAM_FLASK ,Considering the #ifdef-s further down, should this perhaps also be put in "#ifdef
CONFIG_XSM_FLASK", to avoid it mistakenly getting used when the code was compiled out?
I would like to avoid #ifdef here, because I prefer the same enum value in different config.
Quoted 15 lines
Quoted 4 lines
xen/xsm/xsm_core.c +4
-0+}; + +static enum xsm_bootparam __initdata xsm_bootparam = #ifdef +CONFIG_XSM_FLASK_DEFAULT xen/xsm/xsm_core.c
Quoted 10 lines
xen/xsm/xsm_core.c +10
-0+XSM_BOOTPARAM_FLASK ; +#else +XSM_BOOTPARAM_DUMMY ; +#endif + +static int __init parse_xsm_param (const char *s) { +int rc =0 ; + +if ( !strcmp (s,"dummy" ) ) + xsm_bootparam = XSM_BOOTPARAM_DUMMY; #ifdef
CONFIG_XSM_FLASK
Quoted 5 lines
xen/xsm/xsm_core.c line 56
Quoted 3 lines
xen/xsm/xsm_core.c +3
-0+else if ( !strcmp (s,"flask" ) ) + xsm_bootparam =XSM_BOOTPARAM_FLASK ;#endif + else {Style (brace goes on its own line).
OK. Done.
Quoted 5 lines
xen/xsm/xsm_core.c line 57
Quoted 2 lines
xen/xsm/xsm_core.c +1
-0+printk ("XSM: can't parse boot parameter xsm=%s\n" , s);Again, not being a native speaker, "can't parse" sounds odd. Why not just "unknown" or "unknown or unsupported"?
OK. Done.
Quoted 15 lines
xen/xsm/xsm_core.c static int __init xsm_core_init(const void
Quoted 2 lines
xen/xsm/xsm_core.c +0
-0@@ -57,7 +88,20 @@ static int __init xsm_core_init(const void
*policy_buffer,size_tpolicy_size)Quoted 12 lines
xen/xsm/xsm_core.c +8
-1} xsm_ops = &dummy_xsm_ops; -flask_init (policy_buffer, policy_size); + +switch ( xsm_bootparam ) + { +case XSM_BOOTPARAM_DUMMY : +break ; + +case XSM_BOOTPARAM_FLASK : +flask_init (policy_buffer, policy_size);
Quoted 9 lines
xen/xsm/xsm_core.c static int __init xsm_core_init(const void *policy_buffer, size_t policy_size) · line 103
Quoted 5 lines
xen/xsm/xsm_core.c +5
-0+break ; + +default : +printk ("XSM: Invalid value for xsm= boot parameter\n" ); +break ;What situation is this covering, when all enumerators already have their case label? Simply
ASSERT_UNREACHABLE()?
OK. Done.
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel