unpoison_linux_getrandom_result

Function unpoison_linux_getrandom_result 

Source
pub unsafe fn unpoison_linux_getrandom_result(
    buf: &mut [MaybeUninit<u8>],
    ret: isize,
)
Expand description

Interprets the result of the getrandom syscall of Linux, unpoisoning any written part of buf.

buf must be the output buffer that was originally passed to the getrandom syscall.

ret must be the result returned by getrandom. If ret is negative or larger than the length of buf then nothing is done.

Memory Sanitizer only intercepts getrandom on this condition (from its source code):

#define SANITIZER_INTERCEPT_GETRANDOM \
  ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD || SI_SOLARIS)

So, effectively, we have to assume that it is never intercepted on Linux.