Closed
Labels
enhancementNew feature or requestNew feature or requestwaiting on upstreamWaiting for upstream changes in an external projectWaiting for upstream changes in an external project
Description
Hermitcore is a unikernel OS, written in Rust, with Tier 3 libstd support for aarch64-unknown-hermit and x86_64-unknown-hermit.
See #198 and #183 for previous attempts at this.
Other PRs/issues of note:
- My initial question to the Hermit folks about their RNG: What is the expected way to get randomness on hermitcore? hermit-os/hermit-rs#63
- Change that adds Cryptographic RNG support to Hermit (x86 only): syscall to set the seed of the random number generator hermit-os/kernel#98
- Change that exposes RNG APIs as part of
hermit-abi: add functions to create random numbers hermit-os/hermit-rs#64 - Making
hermit-abialwaysno_std: Allow hermit-abi to build without std hermit-os/hermit-rs#103 - Fix for the RDRAND implementation in
libhermit-rs: Fix broken rdrand implementation hermit-os/kernel#154 - Feature request to have hermit use a buffer-based API: Improve randomness syscalls hermit-os/kernel#143
We should figure out:
- How/when we want to add support to
getrandom - Is the existing
secure_rand64API sufficient? - Hermit's RNG apis current don't work on
aarch64, is that an issue?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestwaiting on upstreamWaiting for upstream changes in an external projectWaiting for upstream changes in an external project
Activity
newpavlov commentedon Jan 17, 2021
Yes, it's an issue, since it causes workarounds like this. In user code it can be worked around slightly more elegantly using the
customfeature, but we can not rely on it instd. Note that currently Hermit'sstdsimply uses a constant seed on all targets.josephlr commentedon Apr 29, 2021
I think the most reasonable approach here is the following:
secure_rand64API and thehermit-abicrate. Given that hermit is a unikernel, I don't see any reason to push them for a buffer-based API (so Improve randomness syscalls hermit-os/kernel#143 isn't too important).aarch64+hermitworkaround in Use getrandom for generating HashMap seed rust-lang/rust#80149 for now (to keep existing behavior).std's use of getrandom to emit a fallback seed if thegetrandomfunction fails. Then, a user onaarch64-unknown-hermitwill:getrandom::getrandom, which will callsecure_rand64, which will fail, causing the function to return an error.stdimplementation will then return a fallback seed, preserving the existing behavior.newpavlov commentedon Apr 30, 2021
Buffer-based API is not important here, it's the fact that Hermit randomness API always fails on ARM targets. To say the least, it's not normal and should be fixed.
I don't think it's a good behavior for all targets. It effectively means introduction of potential silent failures just because one target has an always failing randomness source.
josephlr commentedon Feb 9, 2023
Fixed by #333