Bug report
Bug description:
When python is built with memory sanitizer enabled, reading any data returned by os.getrandom() will trigger a memory sanitizer false positive, because the buffer is filled using a syscall, and the memory isn't marked as having been written to.
Currently,
$ cat test.py
import os
data = os.getrandom(32)
h = data.hex()
print(f'h={h}')
$ ./python ./test.py
Uninitialized bytes in memchr at offset 18 inside [0x707000006458, 66)
==242471==WARNING: MemorySanitizer: use-of-uninitialized-value
...
SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/peter/dev/pvanvugt-cpython/Objects/stringlib/fastsearch.h:58:13 in ucs1lib_find_char
Exiting
I have verified that applying __masan_unpoison() to the data fixes this.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
When python is built with memory sanitizer enabled, reading any data returned by
os.getrandom()will trigger a memory sanitizer false positive, because the buffer is filled using a syscall, and the memory isn't marked as having been written to.Currently,
I have verified that applying
__masan_unpoison()to the data fixes this.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs