Posts
4913
Following
326
Followers
491
Linux kernel hacker and maintainer etc.

OpenPGP: 3AB05486C7752FE1
Edited 2 months ago

Real or @NanoRaptor

Well this an IBM 5120 https://en.wikipedia.org/wiki/IBM_5120 a preliminary system to the IBM PC.

1
2
0

Jarkko Sakkinen

Very cool, I start to participate to tpm-rs meetings :-) My project is not a conflicting entity, it's just the protocol layer isolated and made for import (a design choice driven by kernel ofc).

I was just worried what are the thoughts when I come from the woods and say that here's 7000 lines of source code, please repeal and replace but initial feedback is actually quite positive.

For kernel (and tpm-rs) if/when kernel has TPM2 support on Rust side the model could be a bit similar as it is for ACPICA. You have a fast policy-free upstream that tracks the protocol spec as it develops and import cycle.

Would be great to see tpm-rs story to continue but obviously they make their choices.
0
1
1

Jarkko Sakkinen

IMHO, good design goals for any Rust crate would be that:

1. It should run on your toaster.
2. It should run on #Amiga.

Once I stopped using Cargo and 3rd party crates when making my own crates I've started to enjoy Rust for real :-) IMHO, programming should be fun, not efficient or "productive". If I have to start to be too efficient I'll immediately stop this career.

#rust
1
1
9

Jarkko Sakkinen

My next thing in the Rust world is Z-modem but beyond that I'm also looking into legendary S-modem after I get Z-modem first in shape:

https://en.wikipedia.org/wiki/SMODEM

Back in the day S-modem enabled to download your games and porn, and chat with the sysop while doing it ;-)

#bbs #zmodem #smodem
1
1
5

Jarkko Sakkinen

Now it is time phase out doing this and detach myself from the grip of hyperfocus ...

https://lore.kernel.org/rust-for-linux/aKUTF6lu5JetDJxX@kernel.org/T/#u

Ton of stuff that I did not do during last three weeks that I should had done (mainly outside of work) so navigating myself to that direction :-) I just could not stop, once I got really started.

Also I sleeping might be good idea once in a while :-)

#linux #kernel #tpm #rust
1
1
5

Jarkko Sakkinen

12000 SLOC for full TCG TPM 2.0 protocol spefication in three weeks (with about 1000 SLOC of initial code I made year ago).

This includes also tpm2sh. The protocol crate is only ~7000 SLOC.

Now that tpm2_protocol is "complete", I'd believe that it will also slim down over time because first version always the fattest.

I think tpm2_protocol would be the right basis for Linux Rust support for TPM2 but it definitely must mature some time so that low-hanging bugs etc are fixed.

tpm2sh is still quite immature but it is just a test program :-) It has quite a lot of crypto code but use that your own responsibility. I've added that to help with testing now meant for use in production.

#linux #kernel #tpm #rust
0
0
0

Jarkko Sakkinen

Well... hell... TCG TPM 2.0 specification 184 minus one command coverage.
2
0
0

Jarkko Sakkinen

Edited 2 months ago
Despite having implemented SGX driver some years ago I think we all can agree that the existing confidential computing technologies suck like nothing else, right? :-)

In Linux kernel they are essentially proprietary pieces decorated as open source as the technology is unreachable by anyone and is really only option for companies such as Google.

SGX, SNP and TDX are technologies that FSF should be vocal about, not so much TPM (which open protocol specification).

E.g., with SGX Intel made a single NUC in 2018 to get ack from open source community for the kernel feature. Once it landed they have not continued to ship any affordable platforms for these technologies.

#linux #kernel #fsf #opensource
1
4
10

Jarkko Sakkinen

i just added parser for i8 as tpm2_protocol was able to parse u8 only previously :-) at least the type granularity is working
0
0
0

Jarkko Sakkinen

my daughter had her first day at the local university hooray.

and she does not proactively hate me

biggest success in my life at least
1
0
2

Jarkko Sakkinen

Yet another post in the series of of C-senior and Rust-junior posts. I also expose this as group therapy sort of influencing reason i.e, perhaps there are kernel devs with some uncertainty when it comes to Rust.Thus, I expose mine :-)

I seem to do this two-step process a lot with Rust:

1. Refine the code for capability and implement that capability.
2. Decouple the capability from the (sub)crate.

E.g., in 0.7.0 I had reworked the whole code base so that lifetime-parameters would be relaxed and finally it was Any-compatible and I had dyn_eq and those shenanigans in the crate.

i.e., straight up the very first commit after tagging:

https://github.com/puavo-org/tpm2_library/commit/c704938ec64d31a1aaa1b88a3f686d5d25045c0b

I also felt ultimately stupid as I already had e.g. pretty_printer.rs that should have "showed me the way". Still I think it was worth it because of all bottlenecks the codebase had with lifetimes that I could not have noticed w/o first going way too far :-)

Pretty printer for reference: https://github.com/puavo-org/tpm2_library/blob/main/tpm2sh/src/pretty_printer.rs

In my Z-Modem crates next version I'm going to follow the learnings and make it walk and talk like some entity in futures/streams without being coupled to async and of course make it also zero deps:

https://codeberg.org/jarkko/zmodem2/commits/branch/main

I will demonstrate async-ready capability with refined versions of RZM and SZM. Then you can finally have ZModem in your next Tokio project :-)

#linux #rust #kernel
1
1
3

Jarkko Sakkinen

Edited 2 months ago
tpm2sh 0.8.0 with print-stack sink:
1
0
0

Jarkko Sakkinen

tpm2sh starts to look pretty good and has at least the features i want it to have for kernel testing.

tpm2_protocol is "kernel-ready" (including Box<dyn TpmObject>, which is essential for a driver uapi) and this the full list of commands it lacks for 100% TCG TPM 2.0 specification coverage:

https://github.com/puavo-org/tpm2_library/issues/4

I'm pretty much done with this project for the moment :-)
1
0
0

Jarkko Sakkinen

IMHO the thing in Rust and drivers is not memory safe per se or like "overflow check type of stuff".

It's the structural integrity check that levels up over C really. E.g. in C world I check that a TPM command holding buffer is not too large.

In Rust world I'll check in byte granularity that the data coming from user space and the chip is correct.
1
0
0

Jarkko Sakkinen

Edited 2 months ago
Do rustc eBPF branches unroll loops if they have const limit known by compiler?

I'm just thinking of theory of running tpm2_protocol inside eBPF filter i.e., is it possible and how much effort it would take it realize.

would be just a cool demo

it has lot of characteristics i.e. no-alloc (fully in-stack) and test program compiles without cargo with just rustc.

#linux #kernel #ebpf #rust #tpm
0
0
1

Jarkko Sakkinen

Edited 2 months ago
Conventions I'm converged on tpm2_protocol (for lib.rs):

//! * `alloc` is disallowed.
//! * Dependencies are disallowed.
//! * Developer dependencies are disallowed.
//! * Panics are disallowed.
0
0
0

Jarkko Sakkinen

Edited 2 months ago
the future of zmodem is async as I refined zmodem2 API as follows:

1. ZmodemSession holds the protocol state.
2. ZmodemEvent provides the interface for consuming next events.

I.e. it is to bind to the future (while being still decoupled from them). Also next version of protocol will be zero deps and can compile with rustc only.

#zmodem #rust
0
0
0

Jarkko Sakkinen

tpm2_protocol 0.6.1

0.6.0 and 0.6.1 are really the same, i just fucked up tpm2sh 0.6.0 so...

https://lore.kernel.org/tpm2/aKI-xQsBNNvjeBSk@kernel.org/T/#u
0
0
0

Jarkko Sakkinen

Edited 2 months ago
OK, learning Rust as I got but I was still missing Any implementation so here it is:

https://github.com/puavo-org/tpm2_library/commit/5066da1e529c2c6fc3667ae1e4f2be397836684b

This is a milestone commit given that the implementation is capable of empowering driver, which is a consequence of being able to dynamically interpret the protocol byte stream. I.e. starting from this commit ID it would it driver implementation ready.

It is proven by the test that builds a 100 element list of random objects, streams the list and parses from stream another list, and finally compares that the lists have equal amount of element and each element matches each other.

The test is here:

https://github.com/puavo-org/tpm2_library/blob/main/tpm2sh/tests/dynamic.rs
1
0
1
Show older