The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] fTPM: make sure TEE is initialized before fTPM
@ 2021-01-16  0:12 Wei Liu
  2021-01-16  0:49 ` Randy Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Wei Liu @ 2021-01-16  0:12 UTC (permalink / raw)
  To: Linux Kernel List
  Cc: tyhicks, Wei Liu, Michael S. Tsirkin, Jason Wang,
	Greg Kroah-Hartman, Thomas Gleixner, Arnd Bergmann, Randy Dunlap,
	Christian Gromm

For built-in drivers, the order of initialization function invocation is
determined by their link order.

The original code linked TPM drivers before TEE driver when they were
both built in. That caused fTPM's initialization to be deferred to a
worker thread instead of running on PID 1.

That is problematic because IMA's initialization routine, which runs on
PID 1 as a late initcall, needs to have access to the default TPM
instance. If fTPM's initialization is deferred, IMA will not be able to
get hold of a TPM instance in time.

Fix this by modifying Makefile to make sure TEE is initialized before
fTPM when they are both built in.

Signed-off-by: Wei Liu <wei.liu@kernel.org>
---
 drivers/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/Makefile b/drivers/Makefile
index fd11b9ac4cc3..45ea5ec9d0fd 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -180,6 +180,11 @@ obj-$(CONFIG_NVMEM)		+= nvmem/
 obj-$(CONFIG_FPGA)		+= fpga/
 obj-$(CONFIG_FSI)		+= fsi/
 obj-$(CONFIG_TEE)		+= tee/
+
+# TPM drivers must come after TEE, otherwise fTPM initialization will be
+# deferred, which causes IMA to not get a TPM device in time
+obj-$(CONFIG_TCG_TPM)		+= char/tpm/
+
 obj-$(CONFIG_MULTIPLEXER)	+= mux/
 obj-$(CONFIG_UNISYS_VISORBUS)	+= visorbus/
 obj-$(CONFIG_SIOX)		+= siox/
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-01-17 14:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-16  0:12 [PATCH] fTPM: make sure TEE is initialized before fTPM Wei Liu
2021-01-16  0:49 ` Randy Dunlap
2021-01-16 11:55   ` Wei Liu
2021-01-16 12:11     ` Wei Liu
2021-01-17  8:29       ` Greg Kroah-Hartman
2021-01-17 14:21         ` Wei Liu
2021-01-17 14:32           ` Greg Kroah-Hartman
2021-01-17 14:49             ` Wei Liu
2021-01-16  5:15 ` kernel test robot
2021-01-16  6:09 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox