From: Jonathan McDowell <noodles@earth.li>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: rust-for-linux@vger.kernel.org, linux-integrity@vger.kernel.org
Subject: Re: Using Rust on non-Rust side of kernel
Date: Tue, 26 Aug 2025 09:35:08 +0100 [thread overview]
Message-ID: <aK1xvMTqoq-6JyHm@earth.li> (raw)
In-Reply-To: <aKy5z74FE4paL7za@kernel.org>
(I've seen your later mails, but I think this is the right one for me to
respond to around what my concerns are.)
On Mon, Aug 25, 2025 at 10:30:23PM +0300, Jarkko Sakkinen wrote:
>On Mon, Aug 25, 2025 at 01:04:38PM +0100, Jonathan McDowell wrote:
>> On Sat, Aug 23, 2025 at 03:12:44PM +0300, Jarkko Sakkinen wrote:
>>
>> > My goal with tpm2_protocol is to have ACPICA alike model of imports as
>> > the crate is driven by TCG spec updates and it is very likely to be
>> > also used by TPM-RS (also via import style process).
>>
>> I'm not entirely clear on what your plan is for this / the existing TPM
>> drivers in the kernel? I assume it's to eventually remove some of the C code
>> in favour of the Rust implementation, but I'm missing exactly how that's
>> expected to work.
>
>There's no plan of doing anything at this point. This is more like doing
>early research for the following questions:
>
>1. If this comes up in form or another, what are the directions of freedom.
>2. What could be in general done in Rust that could potentially extend
> the capabilities of e.g. /dev/tpmrm0 (which could be entirely
> different device).
>3. There has not been any discussion from my part of removing and/or
> repealing and replacing any of the C driver code.
>
>It's a bit odd position IMHO to not prepare for future outcomes. Even
>without kernel context, for the TPM marshalling/unmarshalling there does
>not exist decent implementation as of today in *any language*.
I'm not saying we shouldn't prepare for future outcomes. It sounds like
you're focusing on the marshalling/unmarshalling piece with Rust, rather
than expecting to replace the entire of drivers/char/tpm/ so that
worries me less.
>> (Given I've spent a bunch of time this year tracking down various edge case
>> issues in the TPM code that have been causing failures in our fleet I'm
>> understandably wary of a replacement of the core code. *It* might be a
>> perfect spec implementation, but hardware rarely is.)
>
>I think this is somewhat unconstructive comment. How do you implement
>against anything if you don't follow the spec and later on fix the
>incosistencies?
>
>I have not observed high stream of marshalling and unmarshalling
>associated bugs or other issues.
>
>Also if you make obnoxious arguments like that please also underline
>how implementation A is worse at dealing possible inconsistencies
>than implementation B. Otherwise, you're only spreading FUD.
I think you're confusing my concerns with concerns others have about
/dev/tpmrm0. I'm not overly worried about that. I suspect there might be
some cleanups that can be done, but we use it as our resource broker and
I don't believe it to be the root cause of any of the issues we have
seen.
If you're focused on marshalling + unmarshalling then I don't recall
seeing issues there. What I'm thinking of more are the workarounds for
firmware issues, or the subtle timing bugs that have sat in the kernel
for a number of revisions before they've been tracked down and resolved.
I'm not intending to be obnoxious; these are not fundamental design
issues, just code fixes that have hardened the driver over time. If we
were talking about ripping everything out then my concern would be we'd
have to do all this battle hardening over again, no matter what our best
efforts. i.e. we've already done some work fixing the inconsistencies,
let's make sure we don't lose that.
Examples of the sorts of fixes I'm thinking about:
d4640c394f23 tpm: Check for completion after timeout
2f661f71fda1 tpm: tis: Double the timeout B to 4s
1dbf74e00a5f tpm: End any active auth session before shutdown
de9e33df7762 tpm, tpm_tis: Workaround failed command reception on Infineon devices
7146dffa875c tpm, tpm_tis: Fix timeout handling when waiting for TPM status
e3aaebcbb7c6 tpm: Clean up TPM space after command failure
(I've also got another issue I'm currently trying to work through but
I'm pretty sure it's a firmware bug and until I nail it down fully with
a reproducible test I can't determine if there's a suitable kernel
workaround, or it _needs_ a firmware upgrade.)
J.
--
Web [ 101 things you can't have too much of : 22 - Friends. ]
site: https:// [ ] Made by
www.earth.li/~noodles/ [ ] HuggieTag 0.0.24
next prev parent reply other threads:[~2025-08-26 8:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-23 12:12 Using Rust on non-Rust side of kernel Jarkko Sakkinen
2025-08-23 12:22 ` Jarkko Sakkinen
[not found] ` <BE42A51A-60C4-4E79-8459-CADEAB8DC3BA@collabora.com>
2025-08-23 23:06 ` Jarkko Sakkinen
2025-08-23 23:12 ` Jarkko Sakkinen
2025-08-24 1:12 ` Daniel Almeida
2025-08-24 7:15 ` Jarkko Sakkinen
2025-08-24 9:21 ` Jarkko Sakkinen
2025-08-23 23:41 ` Jarkko Sakkinen
2025-08-23 23:50 ` Jarkko Sakkinen
2025-08-25 12:04 ` Jonathan McDowell
2025-08-25 19:30 ` Jarkko Sakkinen
2025-08-25 19:42 ` Jarkko Sakkinen
2025-08-25 22:29 ` Jarkko Sakkinen
2025-08-25 23:23 ` Jarkko Sakkinen
2025-08-26 8:35 ` Jonathan McDowell [this message]
2025-08-26 8:56 ` Jarkko Sakkinen
2025-08-26 9:13 ` Jarkko Sakkinen
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=aK1xvMTqoq-6JyHm@earth.li \
--to=noodles@earth.li \
--cc=jarkko@kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=rust-for-linux@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).