Skip to content
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

runtime: use getrandom(2) for readRandom on Linux #69421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 12, 2024

  1. runtime: use getrandom(2) for readRandom on Linux

    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
    apocelipes committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    65fd37e View commit details
    Browse the repository at this point in the history