summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2018-12-31 05:13:02 (GMT)
committerGitHub <noreply@github.com>2018-12-31 05:13:02 (GMT)
commit1d300ce1d8238136595c8fea76266a4755cd73a2 (patch)
tree59f91285b50d7c24b05c09ab950d9524e35e4ceb /Modules
parente5796c42c687e1454e84dcc50e6f67db48ff69a0 (diff)
downloadcpython-1d300ce1d8238136595c8fea76266a4755cd73a2.zip
cpython-1d300ce1d8238136595c8fea76266a4755cd73a2.tar.gz
cpython-1d300ce1d8238136595c8fea76266a4755cd73a2.tar.bz2
bpo-35214: Annotate posix calls for clang MSan. (#11389)
It doesn't know the details of a few less common libc functions.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 4ff1694..e5c2a9c 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -367,6 +367,10 @@ static int win32_can_symlink = 0;
#define HAVE_STRUCT_STAT_ST_FSTYPE 1
#endif
+#ifdef _Py_MEMORY_SANITIZER
+# include <sanitizer/msan_interface.h>
+#endif
+
#ifdef HAVE_FORK
static void
run_at_forkers(PyObject *lst, int reverse)
@@ -5493,6 +5497,9 @@ os_posix_spawn_impl(PyObject *module, path_t *path, PyObject *argv,
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, path->object);
goto exit;
}
+#ifdef _Py_MEMORY_SANITIZER
+ __msan_unpoison(&pid, sizeof(pid));
+#endif
result = PyLong_FromPid(pid);
exit:
@@ -6098,6 +6105,9 @@ os_sched_rr_get_interval_impl(PyObject *module, pid_t pid)
posix_error();
return -1.0;
}
+#ifdef _Py_MEMORY_SANITIZER
+ __msan_unpoison(&interval, sizeof(interval));
+#endif
return (double)interval.tv_sec + 1e-9*interval.tv_nsec;
}
#endif /* HAVE_SCHED_RR_GET_INTERVAL */
@@ -6568,6 +6578,12 @@ posix_getgrouplist(PyObject *self, PyObject *args)
return posix_error();
}
+#ifdef _Py_MEMORY_SANITIZER
+ /* Clang memory sanitizer libc intercepts don't know getgrouplist. */
+ __msan_unpoison(&ngroups, sizeof(ngroups));
+ __msan_unpoison(groups, ngroups*sizeof(*groups));
+#endif
+
list = PyList_New(ngroups);
if (list == NULL) {
PyMem_Del(groups);