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
Consider the case of Linux. We hope to use the getrandom syscall and then if that fails, we fall back to doing file I/O. We should test at least the following scenerios:
Linux returns ENOSYS, which should trigger the fallback to file I/O.
Linux returns EPERM, which is presently expected to do the same fallback, though there's an issue on file to change this.
I agree that this testing will be challenging for Platforms that aren't Tier 1, but I think we should look into it for Linux and MacOS. Maybe using LD_PRELOAD shenanigans with an older libc could work?
For the syscall vs file fallback, it would be interesting if we could get a ptrace-based test to work.
Use of `libc::getrandom` will automatically give us optimizations like
vDSO (#503) and can help with testing of fallback logic (#289).
It was also requested in #285. In that discussion we decided against
using this approach, but in the light of the vDSO optimization it may be
worth to reconsider it.
In `linux_android_with_fallback` use of `libc::syscall` is replaced by
`dlsym`-based code similar to what we use in the `netbsd` backend.
Consider the case of Linux. We hope to use the
getrandom
syscall and then if that fails, we fall back to doing file I/O. We should test at least the following scenerios:ENOSYS
, which should trigger the fallback to file I/O.EPERM
, which is presently expected to do the same fallback, though there's an issue on file to change this.This type of exhaustive testing might not be practical on all targets. However, BoringSSL has shown how to do it on Linux; see https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/fipsmodule/rand/urandom_test.cc.
Backends with runtime fallback logic:
linux_android_with_fallback
(fallack to/dev/urandom
)netbsd
(fallback toKERN_ARND
)wasm_js
(runtime selection between Web and Node.js APIs, there is also an IE 11 workaround)The text was updated successfully, but these errors were encountered: