Skip to contentSkip to conversation

XSM: add Kconfig option to override bootloader provided policy

PATCH In review Tamas K Lengyel 5 participants 9 messages Nov 28, 2017 – Nov 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XSM: add Kconfig option to override bootloader provided policy

From: Tamas K Lengyel <[email protected]>

Currently the built-in XSM policy only gets used if there is no other policy specified during boot. In this patch we add a Kconfig option to specify to only use built-in policy during boot. This is particularly important when booting Xen through the shim to ensure the XSM policy gets measured and that it can't be replaced by another unmeasured policy by the bootloader. Note that the XSM policy can still be updated after boot (from dom0 for example) if the built-in policy allows it.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[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: Daniel De Graaf <[email protected]>
Cc: [email protected]

---
 xen/common/Kconfig | 14 ++++++++++++++
 xen/xsm/xsm_core.c |  2 ++
 2 files changed, 16 insertions(+)
xen/common/Kconfig +14 -0
index 103ef44cb5..5ad0d03f37 100644
@@ -140,6 +140,20 @@ config XSM_POLICY
 
 	  If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+	bool "Built-in security policy overrides bootloader provided policy"
+	default n
+	depends on XSM && XSM_POLICY
+	---help---
+	  Set this option to 'Y' to have the hypervisor ignore the security
+	  policy provided by the bootloader, and use ONLY the built-in
+	  security policy.
+
+	  This can be used to ensure only verified security policies are
+	  loaded during boot time.
+
+	  If unsure, say N.
+
 config LATE_HWDOM
 	bool "Dedicated hardware domain"
 	default n
xen/xsm/xsm_core.c +2 -0
index 08994ee7a1..2d5c1d3fec 100644
@@ -39,7 +39,9 @@ static inline int verify(struct xsm_operations *ops)
 static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)
 {
 #ifdef CONFIG_XSM_POLICY
+#ifndef CONFIG_XSM_POLICY_OVERRIDE
     if ( policy_size == 0 )
+#endif
     {
         policy_buffer = xsm_init_policy;
         policy_size = xsm_init_policy_size;
Signature · 7 lines
2.14.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Tamas K Lengyel

From: Tamas K Lengyel <[email protected]>

Currently the built-in XSM policy only gets used if there is no other policy specified during boot. In this patch we add a Kconfig option to specify to only use built-in policy during boot. This is particularly important when booting Xen through the shim to ensure the XSM policy gets measured and that it can't be replaced by another unmeasured policy by the bootloader. Note that the XSM policy can still be updated after boot (from dom0 for example) if the built-in policy allows it.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Tamas K Lengyel
Quoted 32 lines · Tamas K Lengyel

From: Tamas K Lengyel <[email protected]>

Currently the built-in XSM policy only gets used if there is no other policy specified during boot. In this patch we add a Kconfig option to specify to only use built-in policy during boot. This is particularly important when booting Xen through the shim to ensure the XSM policy gets measured and that it can't be replaced by another unmeasured policy by the bootloader. Note that the XSM policy can still be updated after boot (from dom0 for example) if the built-in policy allows it.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[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: Daniel De Graaf <[email protected]>
Cc: [email protected]

---
 xen/common/Kconfig | 14 ++++++++++++++
 xen/xsm/xsm_core.c |  2 ++
 2 files changed, 16 insertions(+)
xen/common/Kconfig +0 -0
index 103ef44cb5..5ad0d03f37 100644

xen/common/Kconfig config XSM_POLICY · line 144

Quoted 5 lines
xen/common/Kconfig +2 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
 	  If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+	bool "Built-in security policy overrides bootloader provided policy"

The overall change certainly looks good and it is obvious why it is a benefit.  However, text/functionality like this is cognitively hard to follow, and _OVERRIDE isn't obviously as to its functionality at a glance.

Wouldn't it be better to have XSM_BOOTLOADER_POLICY (or possibly XSM_ALLOW_?), which defaults to y, and can be forced off for extra security?

~Andrew

Quoted 6 lines
xen/common/Kconfig +5 -0
+	default n
+	depends on XSM && XSM_POLICY
+	---help---
+	  Set this option to 'Y' to have the hypervisor ignore the security
+	  policy provided by the bootloader, and use ONLY the built-in

xen/common/Kconfig config XSM_POLICY · line 159

Quoted 10 lines
xen/common/Kconfig +7 -0
+	  security policy.
+
+	  This can be used to ensure only verified security policies are
+	  loaded during boot time.
+
+	  If unsure, say N.
+
 config LATE_HWDOM
 	bool "Dedicated hardware domain"
 	default n

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 43 lines · Andrew Cooper
Quoted 32 lines · Tamas K Lengyel

From: Tamas K Lengyel <[email protected]>

Currently the built-in XSM policy only gets used if there is no other policy specified during boot. In this patch we add a Kconfig option to specify to only use built-in policy during boot. This is particularly important when booting Xen through the shim to ensure the XSM policy gets measured and that it can't be replaced by another unmeasured policy by the bootloader. Note that the XSM policy can still be updated after boot (from dom0 for example) if the built-in policy allows it.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[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: Daniel De Graaf <[email protected]>
Cc: [email protected]

---
 xen/common/Kconfig | 14 ++++++++++++++
 xen/xsm/xsm_core.c |  2 ++
 2 files changed, 16 insertions(+)
xen/common/Kconfig +0 -0
index 103ef44cb5..5ad0d03f37 100644

xen/common/Kconfig config XSM_POLICY · line 144

Quoted 5 lines
xen/common/Kconfig +2 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
        If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+     bool "Built-in security policy overrides bootloader provided policy"

The overall change certainly looks good and it is obvious why it is a benefit. However, text/functionality like this is cognitively hard to follow, and _OVERRIDE isn't obviously as to its functionality at a glance.

Quoted 3 lines

Wouldn't it be better to have XSM_BOOTLOADER_POLICY (or possibly XSM_ALLOW_?), which defaults to y, and can be forced off for extra security?

I'm certainly open to alternate naming suggestions. The current one is based on an existing option that implements a similar feature with this naming (CMDLINE_OVERRIDE), while the XSM_POLICY part is from the existing XSM_POLICY option.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 45 lines · Tamas K Lengyel
Quoted 43 lines · Andrew Cooper
Quoted 32 lines · Tamas K Lengyel

From: Tamas K Lengyel <[email protected]>

Currently the built-in XSM policy only gets used if there is no other policy specified during boot. In this patch we add a Kconfig option to specify to only use built-in policy during boot. This is particularly important when booting Xen through the shim to ensure the XSM policy gets measured and that it can't be replaced by another unmeasured policy by the bootloader. Note that the XSM policy can still be updated after boot (from dom0 for example) if the built-in policy allows it.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[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: Daniel De Graaf <[email protected]>
Cc: [email protected]

---
 xen/common/Kconfig | 14 ++++++++++++++
 xen/xsm/xsm_core.c |  2 ++
 2 files changed, 16 insertions(+)
xen/common/Kconfig +0 -0
index 103ef44cb5..5ad0d03f37 100644

xen/common/Kconfig config XSM_POLICY · line 144

Quoted 5 lines
xen/common/Kconfig +2 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
        If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+     bool "Built-in security policy overrides bootloader provided policy"

The overall change certainly looks good and it is obvious why it is a benefit. However, text/functionality like this is cognitively hard to follow, and _OVERRIDE isn't obviously as to its functionality at a glance.

Quoted 8 lines
Quoted 3 lines

Wouldn't it be better to have XSM_BOOTLOADER_POLICY (or possibly XSM_ALLOW_?), which defaults to y, and can be forced off for extra security?

I'm certainly open to alternate naming suggestions. The current one is based on an existing option that implements a similar feature with this naming (CMDLINE_OVERRIDE), while the XSM_POLICY part is from the existing XSM_POLICY option.

I agree with Andy. I think CMDLINE_OVERRIDE is either mis-implemented or mis-named: The real way to have your built-in "commandline" *override* the bootloader-supplied one would be to have it parsed second. As it is, you're not *overriding* it, you're just *ignoring* it, which is not the same.

I think XSM_ALLOW_BOOTLOADER_POLICY is probably a better name.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 55 lines · George Dunlap
Quoted 45 lines · Tamas K Lengyel
Quoted 43 lines · Andrew Cooper
Quoted 32 lines · Tamas K Lengyel

From: Tamas K Lengyel <[email protected]>

Currently the built-in XSM policy only gets used if there is no other policy specified during boot. In this patch we add a Kconfig option to specify to only use built-in policy during boot. This is particularly important when booting Xen through the shim to ensure the XSM policy gets measured and that it can't be replaced by another unmeasured policy by the bootloader. Note that the XSM policy can still be updated after boot (from dom0 for example) if the built-in policy allows it.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[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: Daniel De Graaf <[email protected]>
Cc: [email protected]

---
 xen/common/Kconfig | 14 ++++++++++++++
 xen/xsm/xsm_core.c |  2 ++
 2 files changed, 16 insertions(+)
xen/common/Kconfig +0 -0
index 103ef44cb5..5ad0d03f37 100644

xen/common/Kconfig config XSM_POLICY · line 144

Quoted 5 lines
xen/common/Kconfig +2 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
        If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+     bool "Built-in security policy overrides bootloader provided policy"

The overall change certainly looks good and it is obvious why it is a benefit. However, text/functionality like this is cognitively hard to follow, and _OVERRIDE isn't obviously as to its functionality at a glance.

Quoted 8 lines
Quoted 3 lines

Wouldn't it be better to have XSM_BOOTLOADER_POLICY (or possibly XSM_ALLOW_?), which defaults to y, and can be forced off for extra security?

I'm certainly open to alternate naming suggestions. The current one is based on an existing option that implements a similar feature with this naming (CMDLINE_OVERRIDE), while the XSM_POLICY part is from the existing XSM_POLICY option.

Quoted 8 lines

I agree with Andy. I think CMDLINE_OVERRIDE is either mis-implemented or mis-named: The real way to have your built-in "commandline" *override* the bootloader-supplied one would be to have it parsed second. As it is, you're not *overriding* it, you're just *ignoring* it, which is not the same.

I think XSM_ALLOW_BOOTLOADER_POLICY is probably a better name.

SGTM

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
In reply to Tamas K Lengyel

xen/common/Kconfig config XSM_POLICY · line 145

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 28.11.17 at 19:06, <[email protected]> wrote:
xen/common/Kconfig +3 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
 	  If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+	bool "Built-in security policy overrides bootloader provided policy"
+	default n

This is pointless.

xen/common/Kconfig config XSM_POLICY · line 146

Quoted 1 line
xen/common/Kconfig +1 -0
+	depends on XSM && XSM_POLICY

Please add only direct dependencies - XSM_POLICY already depends on XSM.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 28.11.17 at 19:06, <[email protected]> wrote:
xen/common/Kconfig +0 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
Quoted 7 lines

xen/common/Kconfig config XSM_POLICY · line 145

Quoted 5 lines
xen/common/Kconfig +3 -0
        If unsure, say Y.
 
+config XSM_POLICY_OVERRIDE
+     bool "Built-in security policy overrides bootloader provided policy"
+     default n

This is pointless.

Care to elaborate?

Quoted 6 lines

xen/common/Kconfig config XSM_POLICY · line 146

Quoted 2 lines
xen/common/Kconfig +1 -0
+     depends on XSM && XSM_POLICY

Please add only direct dependencies - XSM_POLICY already depends on XSM.

Sure.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.11.17 at 16:33, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.11.17 at 19:06, <[email protected]> wrote:
xen/common/Kconfig +0 -0
@@ -140,6 +140,20 @@ config XSM_POLICY
 
        If unsure, say Y.
 
Quoted 7 lines
Quoted 5 lines

xen/common/Kconfig config XSM_POLICY · line 145

Quoted 3 lines
xen/common/Kconfig +3 -0
+config XSM_POLICY_OVERRIDE
+     bool "Built-in security policy overrides bootloader provided policy"
+     default n

This is pointless.

Care to elaborate?

If you omit the line, the default will still be 'n'.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel