There was an error while loading. Please reload this page.
1 parent f2c7c0d commit 9668d26Copy full SHA for 9668d26
3 files changed
Include/pyport.h
@@ -553,6 +553,7 @@ extern "C" {
553
# if !defined(_Py_MEMORY_SANITIZER)
554
# define _Py_MEMORY_SANITIZER
555
# define _Py_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
556
+# define _Py_MSAN_UNPOISON(PTR, SIZE) (__msan_unpoison(PTR, SIZE))
557
# endif
558
559
# if __has_feature(address_sanitizer)
@@ -591,6 +592,9 @@ extern "C" {
591
592
#ifndef _Py_NO_SANITIZE_MEMORY
593
# define _Py_NO_SANITIZE_MEMORY
594
#endif
595
+#ifndef _Py_MSAN_UNPOISON
596
+# define _Py_MSAN_UNPOISON(PTR, SIZE)
597
+#endif
598
599
/* AIX has __bool__ redefined in it's system header file. */
600
#if defined(_AIX) && defined(__bool__)
Misc/NEWS.d/next/Core_and_Builtins/2026-04-21-19-29-29.gh-issue-148850.MSH0J_.rst
@@ -0,0 +1 @@
1
+Fix the memory sanitizer false positive in :func:`os.getrandom`.
Modules/posixmodule.c
@@ -17195,6 +17195,8 @@ os_getrandom_impl(PyObject *module, Py_ssize_t size, int flags)
17195
goto error;
17196
}
17197
17198
+ _Py_MSAN_UNPOISON(data, size);
17199
+
17200
return PyBytesWriter_FinishWithSize(writer, n);
17201
17202
error:
0 commit comments