Skip to content

[3.6] bpo-35214: Add _Py_ prefix to MEMORY_SANITIZER def. (GH-10503) #10505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
/* A convenient way for code to know if clang's memory sanitizer is enabled. */
#if defined(__has_feature)
# if __has_feature(memory_sanitizer)
# if !defined(MEMORY_SANITIZER)
# define MEMORY_SANITIZER
# if !defined(_Py_MEMORY_SANITIZER)
# define _Py_MEMORY_SANITIZER
# endif
# endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#include <alloca.h>
#endif

#ifdef MEMORY_SANITIZER
#ifdef _Py_MEMORY_SANITIZER
#include <sanitizer/msan_interface.h>
#endif

Expand Down Expand Up @@ -1140,7 +1140,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
rtype = _ctypes_get_ffi_type(restype);
resbuf = alloca(max(rtype->size, sizeof(ffi_arg)));

#ifdef MEMORY_SANITIZER
#ifdef _Py_MEMORY_SANITIZER
/* ffi_call actually initializes resbuf, but from asm, which
* MemorySanitizer can't detect. Avoid false positives from MSan. */
if (resbuf != NULL) {
Expand Down
4 changes: 2 additions & 2 deletions Modules/_posixsubprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <dirent.h>
#endif

#ifdef MEMORY_SANITIZER
#ifdef _Py_MEMORY_SANITIZER
# include <sanitizer/msan_interface.h>
#endif

Expand Down Expand Up @@ -291,7 +291,7 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep)
sizeof(buffer))) > 0) {
struct linux_dirent64 *entry;
int offset;
#ifdef MEMORY_SANITIZER
#ifdef _Py_MEMORY_SANITIZER
__msan_unpoison(buffer, bytes);
#endif
for (offset = 0; offset < bytes; offset += entry->d_reclen) {
Expand Down
2 changes: 1 addition & 1 deletion Objects/fileobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"

#if defined(HAVE_GETC_UNLOCKED) && !defined(MEMORY_SANITIZER)
#if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
/* clang MemorySanitizer doesn't yet understand getc_unlocked. */
#define GETC(f) getc_unlocked(f)
#define FLOCKFILE(f) flockfile(f)
Expand Down
2 changes: 1 addition & 1 deletion Python/pymath.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ double _Py_force_double(double x)

/* inline assembly for getting and setting the 387 FPU control word on
gcc/x86 */
#ifdef MEMORY_SANITIZER
#ifdef _Py_MEMORY_SANITIZER
__attribute__((no_sanitize_memory))
#endif
unsigned short _Py_get_387controlword(void) {
Expand Down
4 changes: 2 additions & 2 deletions Python/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# endif
#endif

#ifdef MEMORY_SANITIZER
#ifdef _Py_MEMORY_SANITIZER
# include <sanitizer/msan_interface.h>
#endif

Expand Down Expand Up @@ -147,7 +147,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int blocking, int raise)
else {
n = syscall(SYS_getrandom, dest, n, flags);
}
# ifdef MEMORY_SANITIZER
# ifdef _Py_MEMORY_SANITIZER
if (n > 0) {
__msan_unpoison(dest, n);
}
Expand Down