Not building vTPM frontend as module
PATCH 1/1 Not building vTPM frontend as module
This patch prevents the vTPM frontend to be built as module for now. An 'rmmod' causes some problems since the backend is still using the shared page.
This patch also fixes a problem in the backend.
xen-unstable.hg/linux-2.6-xen-sparse/drivers/char/tpm/Kconfig +6 -7
@@ -50,13 +50,12 @@ config TCG_INFINEON can be found at http://www.prosec.rub.de/tpm config TCG_XEN - tristate "XEN TPM Interface" - depends on TCG_TPM && XEN + bool "XEN TPM Interface" + depends on XEN + select TCG_TPM ---help--- - If you want to make TPM support available to a Xen - user domain, say Yes and it will - be accessible from within Linux. To compile this driver - as a module, choose M here; the module will be called - tpm_xen. + If you want to make TPM support available to a Xen user domain, + say Yes and it will be accessible from within Linux. This driver + is not available as module. endmenu
xen-unstable.hg/linux-2.6-xen-sparse/drivers/char/tpm/Makefile +2 -1
@@ -8,4 +8,5 @@ endif obj-$(CONFIG_TCG_NSC) += tpm_nsc.o obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o -obj-$(CONFIG_TCG_XEN) += tpm_xen.o tpm_vtpm.o +obj-$(CONFIG_TCG_XEN) += tpm_xenu.o +tpm_xenu-y = tpm_xen.o tpm_vtpm.o
xen-unstable.hg/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c +1 -1
@@ -745,9 +745,9 @@ failexit: static void __exit tpmif_exit(void) { +exit_tpm_xenbus ();cleanup_vtpm ();tpm_private_put (); -exit_tpm_xenbus ();gnttab_free_grant_references (gref_head); }
xen-unstable.hg/buildconfigs/linux-defconfig_xen_x86_32 +1 -1
@@ -1904,7 +1904,7 @@ CONFIG_TCG_TPM=m CONFIG_TCG_NSC=m CONFIG_TCG_ATMEL=m CONFIG_TCG_INFINEON=m -CONFIG_TCG_XEN=m +# CONFIG_TCG_XEN is not set CONFIG_TELCLOCK=m #
xen-unstable.hg/buildconfigs/linux-defconfig_xen_x86_64 +1 -1
@@ -1768,7 +1768,7 @@ CONFIG_TCG_TPM=m CONFIG_TCG_NSC=m CONFIG_TCG_ATMEL=m CONFIG_TCG_INFINEON=m -CONFIG_TCG_XEN=m +# CONFIG_TCG_XEN is not set CONFIG_TELCLOCK=m #
xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c +1 -1
@@ -179,7 +179,7 @@ void __init tpmif_interface_init(void) 0, 0, NULL, NULL); } -void __init tpmif_interface_exit (void ) +void __exit tpmif_interface_exit(void) {kmem_cache_destroy (tpmif_cachep); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Even if it is unsafe to unload the module, there is still enormous benefit in allowing to build as a module as it allows the user to choose whether or not to load it in the first place!
I suggest you add __unsafe(THIS_MODULE) to the end of your module_init function, as we have done for netback and blkback. This will make it impossible for the user to unload the module, and print a message to the kernel log explaining why.
I'll apply the hunk of your patch that fixes the backend issue however.
-- Keir
Quoted 9 lines · Stefan Berger
This patch prevents the vTPM frontend to be built as module for now. An 'rmmod' causes some problems since the backend is still using the shared page.
This patch also fixes a problem in the backend.Signed-off-by Stefan Berger <[email protected]><tpm_module.diff>
Quoted 8 lines · Keir Fraser
Even if it is unsafe to unload the module, there is still enormous benefit in allowing to build as a module as it allows the user to choose whether or not to load it in the first place!
I suggest you add
__unsafe(THIS_MODULE)to the end of yourmodule_initfunction, as we have done for netback and blkback. This will make it impossible for the user to unload the module, and print a message to the kernel log explaining why.
If a module_init() is present but a module_exit() is not then you cannot unload the module.
(unless you enable CONFIG_MODULE_FORCE_UNLOAD and use rmmod's --force option, in which case your kernel become tainted)
Ian.
Quoted 10 lines · Ian Campbell
Quoted 4 lines
I suggest you add
__unsafe(THIS_MODULE)to the end of yourmodule_initfunction, as we have done for netback and blkback. This will make it impossible for the user to unload the module, and print a message to the kernel log explaining why.If a
module_init()is present but amodule_exit()is not then you cannot unload the module.(unless you enable
CONFIG_MODULE_FORCE_UNLOADand use rmmod's --force option, in which case your kernel become tainted)
Even better. We should be using this for netback and blkback too in that case.
-- Keir