TPM+IMA: tpm_add_char_device() is taking too long for IMA to detect TPM
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c
- Domain
- operating-systems, security
Research direction
Trace the startup ordering between ima_init(), tpm_default_chip(), tpm_add_char_device(), idr_get_next(), and idr_replace(). Reproduce on the Raspberry Pi 4 with the Infineon SLB9670 using the reported 5.15.30 kernel and capture boot logs around the TPM messages. Done means IMA detects the TPM instead of activating TPM-bypass when the TPM becomes available.
Written by the indexing model from the issue text.
Description
Describe the bug
I'm using a Raspberry 4 with kernel linux 5.15.y and i kit my board with a TPM Infineon SLB9670.
I've noticed that in the function ima_init() there is a call to tpm_default_chip() that should return a valid tpm instance, but in my case always fails to "No TPM chip found, activating TPM-bypass!\n". In that function there is a call to idr_get_next() which return NULL, because the idr_replace() function in tpm_add_char_device() is called after the call to ima_init()->tpm_default_chip().
In the picture the idr_replace() is call at second 2 ("tpm: TPM available" print) which is after ima_init calls tpm_default_chip to get the tpm (which it takes only 1.73 seconds).

Steps to reproduce the behaviour
.
Device (s)
Raspberry Pi 4 Mod. B
System
OS: rpi-5.15.30
Kernel: linux-5.15.30
Logs
No response
Additional context
No response
- Dominant language
- C
- Stars
- 13.2k
- Forks
- 5.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 21
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7415 · 2 comments · 1 reaction ·
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/linux#7399 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
raspberrypi/linux#7357 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7054 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
raspberrypi/linux#7634 · 8 comments · 1 reaction ·
All issues in raspberrypi/linux
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·