Function reinit_auxvec_random

Source
pub unsafe fn reinit_auxvec_random(data: &[u8; 16])
Expand description

(Re)initialize the 16 random “AT_RANDOM” bytes that the kernel provides via the auxiliary vector. See getauxval(3)

§Safety

There must be no concurrent access to the AT_RANDOM data, including:

  • There must be no live rust reference to that data.
  • This function must not be called in parallel, e.g. from another thread.
  • The data must be writable. (This isn’t explicitly guaranteed by the Linux docs, but seems to be the case).
  • Overwriting this process-global value must not violate safety requirements of other code running in the same address-space, such as they dynamic linker/loader and other dynamically linked libraries. The best way to ensure this is to call this before other such code gets a chance to run.

Because this data is a process-wide global initialized by the kernel, code outside of this library may access it. The above safety requirements likely apply to that code as well. Additionally, changing this data after some code has already read it might violate assumptions in that code.