-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add support for SLB9760 Iridium / LetsTrust TPM boards #2585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tested and verified on a RaspberryPi 3b and 3b+ with LetsTrust-TPM. Tested-by: Paul Kissinger PaulKissinger@letstrust.de |
Now tested and verified on a combined image for RaspberryPi Zero W, Raspberry Pi 2b, RaspberryPi 3b and Raspberry Pi 3b+. Tested-by: Paul Kissinger PaulKissinger@letstrust.de |
Although I don't have a TPM to test I did build a kernel with the updated configuration. Even though the new settings are all @PeterHuewe @PaulKissinger Have you looked at the impact on the memory footprint for non-users of the TPM? Does my figure of 7MB sound right to you? How do you feel about such an increase, @popcornmix? |
Thanks for your response - to be honest I did not have a look at the decrease in free memory, as I did not really expect it, since the TPM drivers are not that big, so this was quite suprising. So by enabling TCG_TIS_SPI the resulting config changes with regard to:
I will try to find out what increases the RAM usage. |
@pelwell I tried to understand what's going on, but I could not reproduce the issue. Also the kernel virtual memory map looks identical - see dmesg I also did a code review on securityfs and the tpm code, and nothing justified a 7MB increase (no big mallocs or huge arrays). (which would have come to a suprise to me as the (former) tpm subsys maintainer) Can you help me reproduce the issue / retest on your side? |
Hi @pelwell, I see the same what @PeterHuewe describes. I hope the images are a little usefull for you. Thanks in advance! |
95d6144
to
6805e33
Compare
@pelwell - rebased and tested on latest rpi-4.17.y to make it easier for merging. |
Building my own kernels with and without those patches I get:
which shows 1.1MB more memory used (but only 320KB less "available"). That may not sound much on a Pi 3 but it is on a Model B with only 256MB to start with. This currently sounds like a very niche application |
320kb sounds much nicer than the original 7MB :) - and 320kb does not sound too bad. The 256mb limit only affects "Pi 1 Model B" before produced before October 2012 - I'm not sure how many of them will upgrade to recent kernels. If you really think this is a big blocking point - what do you think if we atleast enable TPM support for 2B/3B/3B+ (bcm2709_defconfig + bcmrpi3_defconfig) and leave it deactivated for (Zero/Zero WH/ Pi 1) (bcmrpi_defconfig) ? Thanks, |
I'm going to say no. Feel free to come back with a more persuasive argument and more supporters, or to appeal to a higher power - I'm prepared to be outvoted or overruled - but the cost to non-users (who would massively outnumber the users) feels too high. |
Hi @pelwell - thanks for your honest feedback. I share your concerns about ram usage, so I sat down the last few days to debug the issue. The topic really caught my attention. All following tests were done on I was following the guidelines from the former Linux Tiny Project: https://elinux.org/Kernel_Size_Tuning_Guide The two kernels differ in the following CONFIG options:
As the modules are not loaded by non-users, we can concentrate on the vmlinux / zImage and its built-ins only. Running
which is basically a The symbols above all come from Since some parts of it might be stripped out again after linking we have to look at the diff of
Since I don't know what the Now it comes to dynamic memory usage - which is of course much harder - so I had a look at the involved kernel code. The assumption is still that non-users do not load the modules, and since they don't care also do not mount securityfs. This function does exactly two things:
So adding static + dynamic usage does get us in the range of maybe 2k. This also matches with our test-series we conducted over the last few days. @pelwell @popcornmix what do you think? Is this analysis thorough enough and the added memory acceptable? If you are still concerned, I can also look into removing the securityfs dependency, thus resulting in zero changes to the vmlinux binary (i.e. only new modules). |
396f2af
to
6d46c46
Compare
Why isn't securityfs implemented as a module? This would solve the problem... |
@ghollingworth - |
6d46c46
to
8cd44e4
Compare
You've changed KConfig which is an upstream file, you should submit this change upstream first and if it is accepted then we'll take it. We're continuously trying to reduce our differences to the upstream kernel. Have you discussed the change to a module with the maintainer of the security? I'm guessing the correct person to contact is Chris Wright https://github.com/torvalds/linux/blob/master/MAINTAINERS#L8324 |
Of course it would be easier to accept the max. 2k ram increase of securityfs than to change upstream - but nevertheless I will try it. Both, changing the TPM Kconfig and converting securityfs to a module are upstream changes - so it will take a while to adresss either of them / have them upstream. |
Greatly looking forward for the "support for SLB9760 Iridium / LetsTrust TPM boards" in the official RPi branch/images, thanks in advance to all involved. |
9a564ac
to
26ea22f
Compare
3ef8aa7
to
b0b5a34
Compare
Hi, https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/char/tpm?h=next-20181008 @pelwell @ghollingworth : how shall we proceed here? Do we have to wait for the next merge window / next kernel version with the patch, or can I create an updated pull request (including the patch) now? Which kernel versions should we target for backporting? I would propose the same approach as with stable commits, thus including the upstream commit id in the backport. |
Congratulations on getting your patch accepted - it always feels like such a mission. I'm happy (in principle) to take a Pull Request now. We've already moved on to rpi-4.18.y, with rpi-4.19.y gradually coming online; I'd target 4.18 for now and we'll cherry-pick as necessary. Please do include the "commit upstream." line at the start of the commit message. |
commit 2f7d8db upstream. While having SECURITYFS enabled for the tpm subsystem is beneficial in most cases, it is not strictly necessary to have it enabled at all. Especially on platforms without any boot firmware integration of the TPM (e.g. raspberry pi) it does not add any value for the tpm subsystem, as there is no eventlog present. By turning it from 'select' to 'imply' it still gets selected per default, but enables users who want to save some kb of ram by turning SECURITYFS off. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
This patch enables the support for SPI TPMs which follow the TCG TIS FIFO/PTP specification like the SLB9670. In order to decrease ram usage the weak dependency on CONFIG_SECURITFS is explictly set to 'n'. Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Device Tree overlay for the Infineon SLB9670 Trusted Platform Module add-on boards, which can be used as a secure key storage and hwrng. available as "Iridium SLB9670" by Infineon and "LetsTrust TPM" by pi3g. Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
8cd44e4
to
cf5cbb8
Compare
@pelwell Ready to merge :)
|
Merged offline. Thanks for persevering with this and finding a mutually acceptable solution. |
Thanks @pelwell for merging this and fixing up the dts. |
Hi @pelwell @ghollingworth - will this be automatically added for 4.19 / 4.20 or shall I post a new pull request for these kernel versions? |
Thanks for the prompt. We've been burning through kernel versions so quickly that the 4.18 to 4.19 change hasn't had quite enough attention. TPM support should now be in 4.19, 4.20 and 4.14 for good measure. |
kernel: V4L2 codec interface See: raspberrypi/linux#2755 kernel: Add support for SLB9760 Iridium / LetsTrust TPM boards See: raspberrypi/linux#2585
kernel: V4L2 codec interface See: raspberrypi/linux#2755 kernel: Add support for SLB9760 Iridium / LetsTrust TPM boards See: raspberrypi/linux#2585
kernel: Add support for SLB9760 Iridium / LetsTrust TPM boards See: raspberrypi/linux#2585 kernel: staging: bcm2835-camera: Fix stride on RGB3/BGR3 formats See: raspberrypi/linux#2773 firmware: dispmanx: Also apply overscan_scale when clamping to screen See: https://forum.kodi.tv/showthread.php?tid=338052
kernel: Add support for SLB9760 Iridium / LetsTrust TPM boards See: raspberrypi/linux#2585 kernel: staging: bcm2835-camera: Fix stride on RGB3/BGR3 formats See: raspberrypi/linux#2773 firmware: dispmanx: Also apply overscan_scale when clamping to screen See: https://forum.kodi.tv/showthread.php?tid=338052
This patchset adds support for the SLB9670 based TPM2.0 eval boards which can be used as a secure key storage and hwrng.
These boards are available as "Iridium SLB9670" by Infineon and "LetsTrust TPM" pi3g.
Working upstream driver is available since about kernel v4.10 - so enabling support on older kernels is also possible.
Signed-off-by: Peter Huewe peterhuewe@gmx.de