Skip to content

Don't fall back to file I/O on Linux when Rust only supports kernels guaranteed to have it #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
briansmith opened this issue Oct 14, 2023 · 5 comments · Fixed by #396
Closed

Comments

@briansmith
Copy link
Contributor

According to https://doc.rust-lang.org/beta/rustc/platform-support.html, there are only a handful of target architectures where Rust supports kernels that are so old that they would not have the getrandom syscall. Notably riscv64gc and aarch64 are guaranteed to have getrandom according to the Rust kernel support policy. For those architectures we should not have enable the fallback logic at all. I suggest in particular that we have an allowlist of target architectures where we allow the fallback, which would be i686, x86_64, arm, armv7, powerpc, powerpc64, powerpc64le. s390x, i586, according to the Rust documents.

@josephlr
Copy link
Member

I like this idea, it also serves as a bit of a test run for removing such file-based support once rust increases its supported kernel version.

@newpavlov
Copy link
Member

Sounds good to me!

@newpavlov
Copy link
Member

What about Android targets?

In this issue @josephlr wrote

We need to have a /dev/urandom fallback and will need it at least until the 3.16 kernel ends LTS support in mid 2020.

So we probably can disable file fallback for Android targets as per our platform support policy?

@briansmith
Copy link
Contributor Author

So we probably can disable file fallback for Android targets as per our platform support policy?

I have been assuming getrandom's platform support is that of its MSRV, not the latest stable Rust version. We we need to go back and look at what the kernel support policy of Rust 1.36 was.

@workingjubilee
Copy link
Contributor

That documentation was introduced in 1.47.0: https://doc.rust-lang.org/1.47.0/rustc/platform-support.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants