mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yeoreum Yun <yeoreum.yun@arm.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: sudeep.holla@arm.com, peterhuewe@gmx.de, jgg@ziepe.ca,
	stuart.yoder@arm.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org
Subject: Re: [PATCH v2 0/2] fix failure of integration IMA with tpm_crb_ffa
Date: Tue, 10 Jun 2025 14:18:29 +0100	[thread overview]
Message-ID: <aEgwpXXftXW6JNRy@e129823.arm.com> (raw)
In-Reply-To: <aEgmhwu1RP27yBpw@kernel.org>

Hi Jarkko,

> On Tue, Jun 10, 2025 at 07:03:32AM +0100, Yeoreum Yun wrote:
> > To integrate a TPM device that uses CRB over FF-A with the IMA subsystem,
> > both the tpm_crb and tpm_crb_ffa drivers must be built as built-in
> > (i.e., ARM_FFA_TRANSPORT=y, CONFIG_TCG_CRB=y, and CONFIG_TCG_CRB_FFA=y),
> > because IMA itself is built-in and the TPM device must be probed
> > before ima_init() is invoked during IMA subsystem initialization.
>
> The description of the problem and motivation to solve it should be
> first; not the actions taken.

Okay. I'll describe the problem first.

>
> >
> > To ensure this works correctly, the following initcalls must be executed in order:
> > 	1.	ffa_init()
> > 	2.	tpm_crb_ffa_driver_init()
> > 	3.	crb_acpi_driver_init()
> >
> > Unfortunately, the order of these device initcalls cannot be strictly controlled.
> > As a result:
> > 	1.	ffa_init() may be called after tpm_crb_ffa_driver_init()
> > 	2.	tpm_crb_ffa_driver_init() may be called after crb_acpi_driver_init()
> >
> > For example, the following initcall sequence may occur:
> >   0000000000000888 l  .initcall6.init>  crb_acpi_driver_init
> >   000000000000088c l  .initcall6.init>  tpm_crb_ffa_driver_init
>
> This symbol does not exist.

I don't know you said "This symbol does not exit".
When CONFIG_TCG=CRB=y, CONFIG_TCG_CRB_FFA=y and ARM_FFA_TRANSPORT=y,
above symbols exist.

crb_acpi_driver_init() generated by
  module_acpi_driver(crb_acpi_driver);
in tpm_crb.c

and tpm_crb_ffa_driver_init() generated by
  module_ffa_driver(tpm_crb_ffa_driver);
in tpm_crb_ffa.c so you can get the above symbols:

$ llvm-readelf-21 --symbols vmlinux | grep crb | grep init
171332: ffff80008203ef08    56 FUNC    LOCAL  DEFAULT    19 crb_acpi_driver_init
...
370077: ffff800080d650d8    92 FUNC    GLOBAL DEFAULT     2 tpm_crb_ffa_init

>
> >   0000000000000a9c l  .initcall6.init>  ffa_init
> >
> > In this situation, the IMA subsystem fails to integrate with the TPM device
> > because the TPM was not available at the time ima_init() was called.
> > As a result, you may see the following message in the kernel log:
> >
> >   | ima: No TPM chip found, activating TPM-bypass!
>
> TPM initializes before IMA, so there should not be a problem.

If you see my commit message it describes the situation why this happen.
when crb_acpi_driver_init() is called but before tpm_crb_ffa_init() is
called, the secure partition doesn't probe. so crb_acpi_driver_init()
would be failed wiith -EPROBE.

In this situation, init_ima() which call ima_init() can be called first.
NOTE, init_ima() is deployed in late_initcall and
the "deferred_probe device" is tried again in
deferred_probe late initcall.
However, even the deferred_probe can be call later then init_ima().

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

That's why init_ima() is failed to init with TPM when It is deffered.

Would you let me know why you said it's not a problem?

--
Sincerely,
Yeoreum Yun

  reply	other threads:[~2025-06-10 13:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10  6:03 Yeoreum Yun
2025-06-10  6:03 ` [PATCH v2 1/2] firmware: arm_ffa: Change initcall level of ffa_init() to rootfs_initcall Yeoreum Yun
2025-06-10  6:03 ` [PATCH v2 2/2] tpm: tpm_crb_ffa: manually register tpm_crb_ffa driver when it's built-in Yeoreum Yun
2025-06-10 12:35 ` [PATCH v2 0/2] fix failure of integration IMA with tpm_crb_ffa Jarkko Sakkinen
2025-06-10 13:18   ` Yeoreum Yun [this message]
2025-06-10 13:58     ` Jarkko Sakkinen
2025-06-10 14:38       ` Yeoreum Yun
2025-06-10 14:59         ` Jarkko Sakkinen
2025-06-10 15:22           ` Yeoreum Yun
2025-06-11 16:40             ` Jarkko Sakkinen
2025-06-11 17:36               ` Yeoreum Yun
2025-06-12 10:30                 ` Jarkko Sakkinen
2025-06-12 13:25                   ` Yeoreum Yun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aEgwpXXftXW6JNRy@e129823.arm.com \
    --to=yeoreum.yun@arm.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=stuart.yoder@arm.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®