You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hermit is not currently supported by getrandom #199
Hermit's RNG apis current don't work on aarch64, is that an issue?
Yes, it's an issue, since it causes workarounds like this. In user code it can be worked around slightly more elegantly using the custom feature, but we can not rely on it in std. Note that currently Hermit's std simply uses a constant seed on all targets.
I think the most reasonable approach here is the following:
Simply add support for hermit using their secure_rand64 API and the hermit-abi crate. 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).
Given that hermit is a unikernel, I don't see any reason to push them for a buffer-based API
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.
The std implementation will then return a fallback seed, preserving the existing behavior.
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.
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