x86: Add a tboot Kconfig option
PATCH 1/1 x86: Add a tboot Kconfig option
Allows for the conditional inclusion of tboot related functionality via Kconfig
The default configuration for the new CONFIG_TBOOT option is 'y', so the behavior out of the box remains unchanged. The addition of the option allows advanced users to disable system behaviors associated with tboot at compile time rather than relying on the run-time detection and configuration.
--- xen/Rules.mk | 2 +- xen/arch/x86/Makefile | 2 +- xen/common/Kconfig | 11 +++++++++++ xen/include/asm-x86/tboot.h | 12 ++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -1
@@ -44,7 +44,7 @@ ALL_OBJS-y += $(BASEDIR)/common/built_in.o ALL_OBJS-y += $(BASEDIR)/drivers/built_in.o ALL_OBJS-y += $(BASEDIR)/xsm/built_in.o ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o -ALL_OBJS-$(CONFIG_X86) += $(BASEDIR)/crypto/built_in.o +ALL_OBJS-$(CONFIG_TBOOT) += $(BASEDIR)/crypto/built_in.o CFLAGS += -nostdinc -fno-builtin -fno-common CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
xen/arch/x86/Makefile +1 -1
@@ -62,7 +62,7 @@ obj-y += trace.o obj-y += traps.o obj-y += usercopy.o obj-y += x86_emulate.o -obj-y += tboot.o +obj-$(CONFIG_TBOOT) += tboot.o obj-y += hpet.o obj-y += vm_event.o obj-y += xstate.o
xen/common/Kconfig +11 -0
@@ -218,6 +218,17 @@ config SCHED_DEFAULT endmenu +# Enable/Disable tboot support +config TBOOT + bool "Xen tboot support" + default y + depends on X86 + ---help--- + Allows support for Trusted Boot using the Intel(R) Trusted Execution + Technology (TXT) + + If unsure, say Y. + # Enable/Disable live patching support config LIVEPATCH bool "Live patching support (TECH PREVIEW)"
xen/include/asm-x86/tboot.h +12 -0
@@ -119,6 +119,7 @@ typedef struct __packed {extern tboot_shared_t *g_tboot_shared; +#ifdef CONFIG_TBOOT void tboot_probe (void );void tboot_shutdown (uint32_t shutdown_type);int tboot_in_measured_env (void );
@@ -127,6 +128,17 @@ int tboot_parse_dmar_table(acpi_table_handler dmar_handler);int tboot_s3_resume (void );void tboot_s3_error (int error);int tboot_wake_ap (int apicid,unsigned long sipi_vec); +#else +static inline void tboot_probe (void ) {} +static inline void tboot_shutdown (uint32_t shutdown_type) {} +static inline int tboot_in_measured_env (void ) {return 0 ;} +static inline int tboot_protect_mem_regions (void ) {return 1 ;} +static inline int tboot_parse_dmar_table (acpi_table_handler dmar_handler) {return acpi_table_parse (ACPI_SIG_DMAR , dmar_handler);} +static inline int tboot_s3_resume (void ) {return 0 ; } + +static inline void tboot_s3_error (int error) {} +static inline int tboot_wake_ap (int apicid,unsigned long sipi_vec) {return 1 ;} +#endif /* CONFIG_TBOOT */ #endif /* __TBOOT_H__ */
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 8 lines · Derek Straka
Allows for the conditional inclusion of tboot related functionality via
KconfigThe default configuration for the new
CONFIG_TBOOToption is 'y', so the behavior out of the box remains unchanged. The addition of the option allows advanced users to disable system behaviors associated with tboot at compile time rather than relying on the run-time detection and configuration.Signed-off-by Derek Straka <[email protected]>
+1 for the principle. Some suggestions however.
Quoted 12 lines
--- xen/Rules.mk | 2 +- xen/arch/x86/Makefile | 2 +- xen/common/Kconfig | 11 +++++++++++ xen/include/asm-x86/tboot.h | 12 ++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-)xen/Rules.mk +0
-0
xen/Rules.mk ALL_OBJS-y += $(BASEDIR)/common/built_in.o · line 47
Quoted 5 lines
xen/Rules.mk +1
-1@@ -44,7 +44,7 @@ ALL_OBJS-y += $(BASEDIR)/common/built_in.o ALL_OBJS-y += $(BASEDIR)/drivers/built_in.o ALL_OBJS-y += $(BASEDIR)/xsm/built_in.o ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o -ALL_OBJS-$(CONFIG_X86) += $(BASEDIR)/crypto/built_in.o +ALL_OBJS-$(CONFIG_TBOOT) += $(BASEDIR)/crypto/built_in.o
TBOOT is currently the only consumer, but there are a few other suggestions on the horizons.
I think it might be better to have a CONFIG_CRYPTO (default to n) which is selected by CONFIG_TBOOT. When future work (e.g. hypervisor side signature checks on hotpatches?) gets completed, it can also select CONFIG_CRYPTO.
Quoted 21 lines
xen/Rules.mk +0
-0CFLAGS += -nostdinc -fno-builtin -fno-common CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arithxen/arch/x86/Makefile +1
-1@@ -62,7 +62,7 @@ obj-y += trace.o obj-y += traps.o obj-y += usercopy.o obj-y += x86_emulate.o -obj-y += tboot.o +obj-$(CONFIG_TBOOT) += tboot.o obj-y += hpet.o obj-y += vm_event.o obj-y += xstate.oxen/common/Kconfig +0
-0
xen/common/Kconfig config SCHED_DEFAULT · line 221
Quoted 4 lines
xen/common/Kconfig +1
-0@@ -218,6 +218,17 @@ config SCHED_DEFAULT endmenu +# Enable/Disable tboot support
This comment isn't very helpful. I would simply omit it. (In fact, I am going to submit a patch stripping all such comments from the existing Kconfig files)
xen/common/Kconfig config SCHED_DEFAULT · line 230
Quoted 9 lines
xen/common/Kconfig +9
-0+config TBOOT + bool "Xen tboot support" + default y + depends on X86 + ---help--- + Allows support for Trusted Boot using the Intel(R) Trusted Execution + Technology (TXT) + + If unsure, say Y.
This should live in xen/arch/x86/Kconfig, rather than common/Kconfig
Quoted 17 lines
xen/common/Kconfig +1
-0+ # Enable/Disable live patching support config LIVEPATCH bool "Live patching support (TECH PREVIEW)"xen/include/asm-x86/tboot.h +1
-0@@ -119,6 +119,7 @@ typedef struct __packed {extern tboot_shared_t *g_tboot_shared; +#ifdef CONFIG_TBOOT void tboot_probe (void );void tboot_shutdown (uint32_t shutdown_type);int tboot_in_measured_env (void );
xen/include/asm-x86/tboot.h int tboot_parse_dmar_table(acpi_table_handler dmar_handler); · line 136
Quoted 9 lines
xen/include/asm-x86/tboot.h +6
-0@@ -127,6 +128,17 @@ int tboot_parse_dmar_table(acpi_table_handler dmar_handler);int tboot_s3_resume (void );void tboot_s3_error (int error);int tboot_wake_ap (int apicid,unsigned long sipi_vec); +#else +static inline void tboot_probe (void ) {} +static inline void tboot_shutdown (uint32_t shutdown_type) {} +static inline int tboot_in_measured_env (void ) {return 0 ;} +static inline int tboot_protect_mem_regions (void ) {return 1 ;} +static inline int tboot_parse_dmar_table (acpi_table_handler dmar_handler) {return acpi_table_parse (ACPI_SIG_DMAR , dmar_handler);}
Please include spaces immediately inside the braces.
~Andrew
xen/include/asm-x86/tboot.h int tboot_parse_dmar_table(acpi_table_handler dmar_handler); · line 144
Quoted 8 lines
xen/include/asm-x86/tboot.h +5
-0+static inline int tboot_s3_resume (void ) {return 0 ; } + +static inline void tboot_s3_error (int error) {} +static inline int tboot_wake_ap (int apicid,unsigned long sipi_vec) {return 1 ;} +#endif /* CONFIG_TBOOT */ #endif /* __TBOOT_H__ */
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 18.08.16 at 14:06, <[email protected]> wrote:
Quoted 6 lines · Derek Straka
Allows for the conditional inclusion of tboot related functionality via
KconfigThe default configuration for the new
CONFIG_TBOOToption is 'y', so the behavior out of the box remains unchanged. The addition of the option allows advanced users to disable system behaviors associated with tboot at compile time rather than relying on the run-time detection and configuration.
You say "advanced users" here, yet ...
Quoted 4 lines
xen/common/Kconfig config SCHED_DEFAULT · line 225
Quoted 4 lines
xen/common/Kconfig +4
-0+config TBOOT + bool "Xen tboot support" + default y + depends on X86
... there's no dependency on EXPERT here. User selectable options not depending on EXPERT need extra good reasoning on why they need to be that way.
Quoted 4 lines
Quoted 4 lines
xen/include/asm-x86/tboot.h +0
-0@@ -127,6 +128,17 @@ int tboot_parse_dmar_table(acpi_table_handler dmar_handler);int tboot_s3_resume (void );void tboot_s3_error (int error);int tboot_wake_ap (int apicid,unsigned long sipi_vec);
Quoted 8 lines
xen/include/asm-x86/tboot.h int tboot_parse_dmar_table(acpi_table_handler dmar_handler); · line 136
Quoted 6 lines
xen/include/asm-x86/tboot.h +6
-0+#else +static inline void tboot_probe (void ) {} +static inline void tboot_shutdown (uint32_t shutdown_type) {} +static inline int tboot_in_measured_env (void ) {return 0 ;} +static inline int tboot_protect_mem_regions (void ) {return 1 ;} +static inline int tboot_parse_dmar_table (acpi_table_handler dmar_handler) {return acpi_table_parse (ACPI_SIG_DMAR , dmar_handler);}Please include spaces immediately inside the braces.
And the last one looks to be an overly long line.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel