-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: use getrandom(2) for readRandom on Linux #69421
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
Conversation
Add Getrandom to internal/runtime/syscall. Use Getrandom instead of reading /dev/urandom to simplify the code. Since Go 1.24 needs Linux kernel >= 3.2, and getrandom(2) was introduced by Linux kernel 3.17, Getrandom could return ENOSYS. This doesn't matter because the Linux kernel always sets startupRand, so readRandom is usually not reachable. We also have a time-based fallback even if readRandom fails. Updates golang#51087 Fixes golang#68278
This PR (HEAD: 65fd37e) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/612715. Important tips:
|
Message from Meng Zhuo: Patch Set 1: Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from Go LUCI: Patch Set 1: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-09-12T14:52:37Z","revision":"caec28d8e0bbb42c41ed8fa5ab34b3807005d395"} Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from Meng Zhuo: Patch Set 1: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from Go LUCI: Patch Set 1: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from Go LUCI: Patch Set 1: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from kyose chang: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from Ian Lance Taylor: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from Filippo Valsorda: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Message from kyose chang: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/612715. |
Add Getrandom to internal/runtime/syscall.
Use Getrandom instead of reading /dev/urandom to simplify the code.
Since Go 1.24 needs Linux kernel >= 3.2, and getrandom(2) was
introduced by Linux kernel 3.17, Getrandom could return ENOSYS.
This doesn't matter because the Linux kernel always sets startupRand,
so readRandom is usually not reachable. We also have a time-based fallback
even if readRandom fails.
Updates #51087
Fixes #68278