Skip to contentSkip to conversation

Discussion on policies around minimum rust version for coconut-svsm

DISCUSSION James Bottomley 4 participants 9 messages Nov 25 – Nov 28

lore
Share & tools
lore
#0 lore raw

In the Wednesday coconut-svsm meeting I advocated for keeping this the lowest version possible, in line with the way the kernel handles gcc versioning, but since rust is a lot less mature than gcc, there are more compelling reasons not to do this. However, the situation we really want to avoid is moving too aggressively to a newer rust version which then complicates actually doing a stable release of coconut through a distribution.

Just in case it's instructive, the Linux Kernel actually maintains a global and per-architecture minimum of gcc (checked in scripts/min- tool-version.sh). The current minimum version of gcc is gcc-8, which is way behind the latest gnu release of gcc-16. The last time it was actually changed was in early 2025. The driver for the change was x86 needing gcc-8.1 for stack protector support:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3e8fe814ad15c16735cdf394454a8bd96eb4d56

However Arnd Bergmann later raised it globally because there had been no objections from any other architecture:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=118c40b7b50340bf7ff7e0adee8e3bab6e552c82

You can read the discussion in the links, but the compact summary is "does anyone care ... no ... OK let's do it"

I think the coconut-svsm policy should be conservative; i.e. we try to stay on the lowest possible rust version, starting with where we are now (1.85 but shortly to be bumped to 1.90). However, if any forcing function comes along that version should be increased. I think the two forcing functions are

1. Language feature we really need to help with or simplify the code
2. cargo dependency hygiene (we need a version of our dependencies which is current with fixes and they may require a newer rust version to keep that currency)

but others may have things to add.

The other thing that came up is that eventually coconut-svsm will have to be shipped by distributions and that means its minimum version must overlap the build versions that distributions have chosen, so this policy has to also be informed by the policies the distributions (both enterprise like RHEL and community like Debian and Fedora) are going to adopt ... which at least Red Hat promised to think about.

Are there any other considerations people can think of?

Regards,

James

#1 lore raw
Quoted 45 lines · James Bottomley

In the Wednesday coconut-svsm meeting I advocated for keeping this the lowest version possible, in line with the way the kernel handles gcc versioning, but since rust is a lot less mature than gcc, there are more compelling reasons not to do this. However, the situation we really want to avoid is moving too aggressively to a newer rust version which then complicates actually doing a stable release of coconut through a distribution.

Just in case it's instructive, the Linux Kernel actually maintains a global and per-architecture minimum of gcc (checked in scripts/min- tool-version.sh). The current minimum version of gcc is gcc-8, which is way behind the latest gnu release of gcc-16. The last time it was actually changed was in early 2025. The driver for the change was x86 needing gcc-8.1 for stack protector support:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3e8fe814ad15c16735cdf394454a8bd96eb4d56

However Arnd Bergmann later raised it globally because there had been no objections from any other architecture:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=118c40b7b50340bf7ff7e0adee8e3bab6e552c82

You can read the discussion in the links, but the compact summary is "does anyone care ... no ... OK let's do it"

I think the coconut-svsm policy should be conservative; i.e. we try to stay on the lowest possible rust version, starting with where we are now (1.85 but shortly to be bumped to 1.90). However, if any forcing function comes along that version should be increased. I think the two forcing functions are

1. Language feature we really need to help with or simplify the code
2. cargo dependency hygiene (we need a version of our dependencies which is current with fixes and they may require a newer rust version to keep that currency)

but others may have things to add.

The other thing that came up is that eventually coconut-svsm will have to be shipped by distributions and that means its minimum version must overlap the build versions that distributions have chosen, so this policy has to also be informed by the policies the distributions (both enterprise like RHEL and community like Debian and Fedora) are going to adopt ... which at least Red Hat promised to think about.

Quoted 5 lines

Are there any other considerations people can think of?

Regards,

James

For information, Rust for Linux already has a policy for this: their minimum Rust version follows Debian Stable's and is raised some months after each Debian stable release, so the kernel can always be built with the Rust that Debian ships
(https://rust-for-linux.com/rust-version-policy).

We could generally follow this policy, unless a forcing function (a needed language feature or a dependency fix) requires a newer version.

Regards,
Nagy

#2 lore raw

Hi Mahmoud,

Quoted 8 lines · Mahmoud Nagy Adam

For information, Rust for Linux already has a policy for this: their minimum Rust version follows Debian Stable's and is raised some months after each Debian stable release, so the kernel can always be built with the Rust that Debian ships
(https://rust-for-linux.com/rust-version-policy).

We could generally follow this policy, unless a forcing function (a needed language feature or a dependency fix) requires a newer version.

The Rust4Linux project is in a different situation. They do not use cargo and vendor all external dependencies to maintain them within the Linux source tree. This gives them much more freedom to set the minimum Rust version because constraint #2 (from James' email) does not apply to them.

Also Debian stable uses Rust 1.85, COCONUT is already on 1.88 with the aim to go to 1.91.

-Joerg

#3 lore raw
Quoted 13 lines · Jörg Rödel

Hi Mahmoud,

Quoted 9 lines · Mahmoud Nagy Adam

For information, Rust for Linux already has a policy for this:
their minimum Rust version follows Debian Stable's and is raised some months after each Debian stable release, so the kernel can always be built with the Rust that Debian ships
(https://rust-for-linux.com/rust-version-policy).

We could generally follow this policy, unless a forcing function (a needed language feature or a dependency fix) requires a newer version.

Quoted 5 lines

The Rust4Linux project is in a different situation. They do not use cargo and vendor all external dependencies to maintain them within the Linux source tree.
This gives them much more freedom to set the minimum Rust version because constraint #2 (from James' email) does not apply to them.

I agree with this, but it it too late to question why coconut couldn't remove or at least reduce external dependencies?  I know it's a lot easier for the rust4linux project because the kernel has a huge library set of stuff it had to home grow which rust4linux can just use. However, if I look at the coconut dependency list today, it's not that huge. I'm definitely biased; I tend to see the package ecosystem of rust going the same way as all the others and leading to nasty security problems like log4j via uncontrolled indirect dependencies. To give a concrete example: the goal of making coconut fips compliant by forcing all crypto through a fips library is impossible to achieve today due to crypto in indirect dependencies.

Quoted 2 lines

Also Debian stable uses Rust 1.85, COCONUT is already on 1.88 with the aim to go to 1.91.

Well that's only because of this:

https://github.com/coconut-svsm/svsm/pull/1277

And the rationale is dependency on this project

https://gitlab.com/kraxel/virt-firmware-rs

requires it to pull in a bug fix, but if I look through the commit logs of the latter I can't figure out why (presumably Gerd or Luigi can explain); however, since the authors are also coconut committers it might be possible to negotiate a way to get the bug fix without requiring a rust version increase.

If the crypto dependencies all get dumped for fips, there's really only the closely allied projects and some odd helpers which remain. It might be possible to internalize the helpers and keep the allies if they agree to the same rust version policy (and crypto policy for fips) ... sort of a half way house between the way a normal rust project behaves and the no external dependency requirement of rust4linux.

Regards,

James

#4 lore raw

Hi,

Quoted 7 lines
Quoted 2 lines

Also Debian stable uses Rust 1.85, COCONUT is already on 1.88 with the aim to go to 1.91.

Well that's only because of this:

https://github.com/coconut-svsm/svsm/pull/1277

Quoted 7 lines

And the rationale is dependency on this project

https://gitlab.com/kraxel/virt-firmware-rs

requires it to pull in a bug fix, but if I look through the commit logs of the latter I can't figure out why (presumably Gerd or Luigi can explain);

uefi-rs (which virt-firmware-rs depends on) raised the bar. The dependency update pulled this in. Note that virt-firmware-rs does not require the latest version ...

	uefi = { version = ">= 0.39, < 0.42" }
	uefi-raw = { version = ">= 0.15, < 0.18" }

... so pinning uefi + uefi-rs to an older version in coconut should work for now.

It is unclear how long that will hold though. There have been incompatible changes which affected virt-firmware-rs in the past, most recent was the 0.38 -> 0.39 update (which why 0.39 is the oldest supported version). It will probably happen again in the future ...

take care,
Gerd

#5 lore raw
Quoted 17 lines · Gerd Hoffmann

  Hi,

Quoted 7 lines
Quoted 2 lines

Also Debian stable uses Rust 1.85, COCONUT is already on 1.88 with the aim to go to 1.91.

Well that's only because of this:

https://github.com/coconut-svsm/svsm/pull/1277

Quoted 7 lines

And the rationale is dependency on this project

https://gitlab.com/kraxel/virt-firmware-rs

requires it to pull in a bug fix, but if I look through the commit logs of the latter I can't figure out why (presumably Gerd or Luigi can explain);

Quoted 6 lines

uefi-rs (which virt-firmware-rs depends on) raised the bar.  The dependency update pulled this in.  Note that virt-firmware-rs does not require the latest version ...

	uefi = { version = ">= 0.39, < 0.42" }
	uefi-raw = { version = ">= 0.15, < 0.18" }

Digging into their reasons, it's this:

https://github.com/rust-osdev/uefi-rs/commit/89def6ad014294d0549d3efccab4afb55ae3f6ea

So they're blaming their dependencies ... it's turtles all the way down. Their commit logs are a bit useless (like most github projects) but there are hints it's this issue:

https://github.com/rust-lang/rust/issues/100189

Quoted 2 lines

... so pinning uefi + uefi-rs to an older version in coconut should work for now.

THat's probably a good idea given this commit:

https://github.com/rust-osdev/uefi-rs/commit/b6876100e8a1cdf12ccea09252adc4ef4b367519

Although I don't quite know why going to 1.95 would be a breaking change ... but if they mark it as such, it's likely going to be a problem for you ...

The bottom line is they seem to be a project with an aggressive view about increasing rust versions to get language features, so if there's no way of controlling them, their view is going to become the forcing function even for coconut.

Quoted 4 lines

It is unclear how long that will hold though.  There have been incompatible changes which affected virt-firmware-rs in the past, most recent was the 0.38 -> 0.39 update (which why 0.39 is the oldest supported version).  It will probably happen again in the future ...

Would I be right in guessing it's just Cstr16 and the variable interface you get from them? The former should probably be generic, like it is in C and the latter could be done internally. I'm not saying that's what has to be done, just probing for ways to reconcile this conservative vs aggressive rust policy problem.

Regards,

James

#6 lore raw

Hi,

Quoted 2 lines

Would I be right in guessing it's just Cstr16 and the variable interface you get from them?

Yes, for the most part it is support for those uefi strings. Also Errors and Status codes.

The variable interface is actually internal, but it needs parse uefi strings ...

take care,
Gerd

#7 lore raw
Quoted 7 lines · Gerd Hoffmann

  Hi,

Quoted 2 lines

Would I be right in guessing it's just Cstr16 and the variable interface you get from them?

Yes, for the most part it is support for those uefi strings. Also Errors and Status codes.

So you can get the strings and errors from

https://crates.io/crates/r-efi

And widestring has a no_std version as well for Cstr16

https://crates.io/crates/widestring

Both of which seem to have much more conservative rust version requirements than even coconut is proposing. I think that's because both the above aim to be shippable by distros and uefi-rs doesn't seem to have any ambitions in that direction. However, debian is trying to package it in testing, where the rust version is 1.97.1 and which should become stable some time in mid 2027; when that happens debian will actually be committed to uefi-rs bug fix backports even if the uefi-rs project goes beyond them in rust versions so we could rely on the debian stable branch to keep everything conservative if we can wait until Forky becomes stable?

Quoted 2 lines

The variable interface is actually internal, but it needs parse uefi strings ...

If the above works, I think that would solve the problem long term and coconut could actually stick with 1.88

Of course, what this proves is that unless the direct and indirect dependencies are vetted for also following conservative rust version policies, coconut is going to get forced by them regardless of what its own policy is. So what actual policy coconut follows is up to you.

Regards,

James

#8 lore raw
In reply to James Bottomley

Hi James,

Quoted 5 lines · James Bottomley

I think the coconut-svsm policy should be conservative; i.e. we try to stay on the lowest possible rust version, starting with where we are now (1.85 but shortly to be bumped to 1.90). However, if any forcing function comes along that version should be increased. I think the two forcing functions are

I agree with the assessment, COCONUT should be conservative about updating the minimum required Rust compiler version. There are some constraints to think about, though.

Quoted 5 lines

1. Language feature we really need to help with or simplify the code
2. cargo dependency hygiene (we need a version of our dependencies which is current with fixes and they may require a newer rust version to keep that currency)

Quoted 8 lines

but others may have things to add.

The other thing that came up is that eventually coconut-svsm will have to be shipped by distributions and that means its minimum version must overlap the build versions that distributions have chosen, so this policy has to also be informed by the policies the distributions (both enterprise like RHEL and community like Debian and Fedora) are going to adopt ... which at least Red Hat promised to think about.

The distribution policies are the main uncertainty for the project. We fully control which language features COCONUT-SVSM is using, but not what our downstream users require to build packages.

This can become problematic once COCONUT maintains stable release branches and a security issue appears in a dependency, requiring an update which needs a newer compiler version. We have a similar situation right now with PR #1277.

I am sure COCONUT is not the only Rust project which aims to be packaged by a Linux distribution. It would be good to learn how the distributors handle these situations with already packaged software so that we can adapt our policy to their processes.

-Joerg