bpo-35214: MSan workarounds for socket, time, and test_faulthandler. (GH-11375) (GH-11378)
Add Clang Memory Sanitizer build instrumentation to work around
false positives from the socket and time modules as well as skipping
a couple test_faulthandler tests.
(cherry picked from commit b474e6774d60fa67d5373e361a0ed53c18b24f53)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 13a174a..5e99bd8 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -34,6 +34,10 @@
#endif /* MS_WINDOWS */
#endif /* !__WATCOMC__ || __QNX__ */
+#ifdef _Py_MEMORY_SANITIZER
+# include <sanitizer/msan_interface.h>
+#endif
+
#define SEC_TO_NS (1000 * 1000 * 1000)
/* Forward declarations */
@@ -331,6 +335,9 @@
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
+#ifdef _Py_MEMORY_SANITIZER
+ __msan_unpoison(&clk_id, sizeof(clk_id));
+#endif
return PyLong_FromLong(clk_id);
}