STRUCT VGETRANDOM_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so welcome to the struct vgetrandom_state page, bestie β€” this is from the Kernel API Manual, section 9, and it’s giving kernel-internals glam πŸ’…βœ¨

✨ NAME ✨

struct vgetrandom_state β€” State used by vDSO getrandom().

πŸ¦‹ SYNOPSIS πŸ¦‹

here’s the whole struct, no edits, no cap:

       struct vgetrandom_state {
           union {
             struct {
               u8 batch[CHACHA_BLOCK_SIZE * 3 / 2];
               u32 key[CHACHA_KEY_SIZE / sizeof(u32)];
             };
             u8 batch_key[CHACHA_BLOCK_SIZE * 2];
           };
           u64 generation;
           u8 pos;
           bool in_use;
        };

πŸŽ€ Members πŸŽ€

okay bestie, let’s meet the members one by one β€” they all matter, fr fr 🫢

  • {unnamed_union} β€” anonymous. literally a union with no name, just vibing.
  • {unnamed_struct} β€” anonymous. same energy for the nested struct.
  • batch β€” One and a half ChaCha20 blocks of buffered RNG output. iconic little buffer πŸ’–
  • key β€” Key to be used for generating next batch.
  • batch_key β€” Union of the prior two members, which is exactly two full ChaCha20 blocks in size, so that batch and key can be filled together.
  • generation β€” Snapshot of rng_info->generation in the vDSO data page at the time key was generated.
  • pos β€” Offset into batch of the next available random byte.
  • in_use β€” Reentrancy guard for reusing a state within the same thread due to signal handlers.

🌈 SEE ALSO 🌈


that’s the whole vibe check, bestie 🫢 β€” source/version: ./include/vdso, date: October 2026. stay hydrated, keep your unions anonymous if you want, and never skip the reentrancy guard πŸ’œπŸ”₯

πŸ“¦ where this page comes from