[PATCH 0/2] fix failure of integration between tpm_crb_ffa with ima

Yeoreum Yun yeoreum.yun at arm.com
Fri Jun 6 03:57:52 PDT 2025


To integrate tpm_event_log with ima subsystem,
tpm_crb and tpm_crb_ffa driver should be built as built-in
(ARM_FFA_TRANSPORT=y && CONFIG_TCG_CRB=y && CONFIG_TCG_CRB_FFA=y).

However, this could make failure for ima_init() gets tpm chip when
each initcall function deployed like:

0000000000000888 l       .initcall6.init>-------0000000000000000 crb_acpi_driver_init
000000000000088c l       .initcall6.init>-------0000000000000000 tpm_crb_ffa_driver_init
0000000000000a9c l       .initcall6.init>-------0000000000000000 ffa_init

If crb_api_driver_init() is called first, probing tpm device using CRB over
FFA method is deferred since tpm_crb_ffa_driver_init() or
ffa_init() doesn't called yet -- this means the secure partition isn't
probed yet.

and deferred probe of the tpm device will be probed by system workqueue
in proper time after deferred_probe_initcall() registers the work.
However, ima_init() could be called first if they're deployed like:

000000000000012c l       .initcall7.init>-------0000000000000000 init_ima
000000000000016c l       .initcall7.init>-------0000000000000000 deferred_probe_initcall7

In this situation, ima_init() failed to find tpm device and it failed to
generate boot_aggregate with PCR values.

That's why kernel prints log this situation though tpm device exists:
   [    3.080786] ima: No TPM chip found, activating TPM-bypass!

To resolve this,
  Patch #1, change ffa_init()'s init level to rootfs_initcall so that
  ffa_device generate before any ffa_driver is loaded.

  Patch #2, call ffa_register() at tpm_crb_ffa_init() when
  it's built as built-in. so that when tpm device is probed,
  tpm_crb_ffa secure partition in probed state with related ffa_driver.

---

Yeoreum Yun (2):
  driver/firmware/arm_ffa: change ffa_init's initlevel
  driver/tpm/tpm_crb_ffa: maunally register tpm_crb_ffa driver when it's
    built-in

 drivers/char/tpm/tpm_crb_ffa.c    | 22 +++++++++++++++++-----
 drivers/firmware/arm_ffa/driver.c |  2 +-
 2 files changed, 18 insertions(+), 6 deletions(-)

--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}




More information about the linux-arm-kernel mailing list