Skip to content

Commit caa6693

Browse files
committed
Revert "[3.15] Add MSan to CI (GH-158625) (#158832)"
This reverts commit 1bc78de.
1 parent ebca12a commit caa6693

13 files changed

Lines changed: 11 additions & 58 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,6 @@ jobs:
605605
- check-name: Undefined behavior
606606
sanitizer: UBSan
607607
free-threading: false
608-
- check-name: Memory
609-
sanitizer: MSan
610-
free-threading: false
611608
uses: ./.github/workflows/reusable-san.yml
612609
with:
613610
sanitizer: ${{ matrix.sanitizer }}

‎.github/workflows/reusable-san.yml‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
|| ''
6161
}}
6262
- name: UBSan option setup
63-
if: inputs.sanitizer == 'UBSan'
63+
if: inputs.sanitizer != 'TSan'
6464
run: >-
6565
echo
6666
"UBSAN_OPTIONS=${SAN_LOG_OPTION}
@@ -69,20 +69,6 @@ jobs:
6969
>> "$GITHUB_ENV"
7070
env:
7171
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log
72-
- name: MSan option setup
73-
if: inputs.sanitizer == 'MSan'
74-
run: |
75-
echo "MSAN_OPTIONS=${SAN_LOG_OPTION} allocator_may_return_null=1 handle_segv=0" >> "$GITHUB_ENV"
76-
# MSan reports false positives for memory initialized by libraries
77-
# that are not built with MSan, so disable modules that use them.
78-
# _remote_debugging links to libzstd directly, but we unpoision the memory.
79-
{
80-
echo '*disabled*'
81-
echo '_bz2 _ctypes _curses _curses_panel _dbm _decimal _gdbm _hashlib'
82-
echo '_lzma _sqlite3 _ssl _tkinter _uuid _zstd readline zlib'
83-
} > Modules/Setup.local
84-
env:
85-
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log
8672
- name: Add ccache to PATH
8773
run: |
8874
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
@@ -107,8 +93,6 @@ jobs:
10793
# gh-157958: -O2 instead of the pydebug default -Og to avoid a clang 21
10894
# compile-time blowup on some interpreter files.
10995
# (https://github.com/llvm/llvm-project/issues/179695)
110-
# MSan uses --with-assertions instead of --with-pydebug because its
111-
# hooks on the Python memory allocators hide uninitialized reads.
11296
- name: Configure CPython
11397
run: >-
11498
./configure
@@ -117,11 +101,9 @@ jobs:
117101
${{
118102
inputs.sanitizer == 'TSan'
119103
&& '--with-thread-sanitizer'
120-
|| inputs.sanitizer == 'MSan'
121-
&& '--with-memory-sanitizer'
122104
|| '--with-undefined-behavior-sanitizer --with-strict-overflow'
123105
}}
124-
${{ inputs.sanitizer == 'MSan' && '--with-assertions' || '--with-pydebug' }}
106+
--with-pydebug
125107
${{ inputs.sanitizer == 'TSan' && '--with-openssl="$OPENSSL_DIR" --with-openssl-rpath=auto' || '' }}
126108
${{ inputs.free-threading && '--disable-gil' || '' }}
127109
- name: Build CPython

‎Doc/using/configure.rst‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,6 @@ Debug options
10151015

10161016
Enable MemorySanitizer allocation error detector, ``msan`` (default is no).
10171017

1018-
MSan reports false positives for memory initialized by libraries that are
1019-
not built with MSan, so either build all dependencies with MSan or disable
1020-
the extension modules that use them in :file:`Modules/Setup.local`.
1021-
10221018
.. versionadded:: 3.6
10231019

10241020
.. option:: --with-undefined-behavior-sanitizer

‎Include/pyport.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,6 @@ extern "C" {
554554
# define _Py_MEMORY_SANITIZER
555555
# define _Py_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
556556
# define _Py_MSAN_UNPOISON(PTR, SIZE) (__msan_unpoison(PTR, SIZE))
557-
# define _Py_MSAN_UNPOISON_STRING(STR) (__msan_unpoison_string(STR))
558557
# endif
559558
# endif
560559
# if __has_feature(address_sanitizer)
@@ -596,9 +595,6 @@ extern "C" {
596595
#ifndef _Py_MSAN_UNPOISON
597596
# define _Py_MSAN_UNPOISON(PTR, SIZE)
598597
#endif
599-
#ifndef _Py_MSAN_UNPOISON_STRING
600-
# define _Py_MSAN_UNPOISON_STRING(STR)
601-
#endif
602598

603599
/* AIX has __bool__ redefined in it's system header file. */
604600
#if defined(_AIX) && defined(__bool__)

‎Lib/test/test_faulthandler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535

3636
def skip_if_sanitizer_signal(signame):
37-
return support.skip_if_sanitizer(f"TSan/UBSan/MSan intercepts {signame}",
38-
thread=True, ub=True, memory=True)
37+
return support.skip_if_sanitizer(f"TSAN/UBSan itercepts {signame}",
38+
thread=True, ub=True)
3939

4040

4141
def expected_traceback(lineno1, lineno2, header, min_count=1):

‎Modules/_remote_debugging/binary_io_reader.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#include <zstd.h>
2020
#endif
2121

22-
#ifdef _Py_MEMORY_SANITIZER
23-
# include <sanitizer/msan_interface.h>
24-
#endif
25-
2622
/* ============================================================================
2723
* CONSTANTS FOR BINARY FORMAT SIZES
2824
* ============================================================================ */
@@ -319,7 +315,6 @@ reader_decompress_samples(BinaryReader *reader, const uint8_t *data)
319315
return -1;
320316
}
321317

322-
_Py_MSAN_UNPOISON(output.dst, output.pos);
323318
total_output += output.pos;
324319
}
325320

‎Modules/_remote_debugging/binary_io_writer.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#include <zstd.h>
2020
#endif
2121

22-
#ifdef _Py_MEMORY_SANITIZER
23-
# include <sanitizer/msan_interface.h>
24-
#endif
25-
2622
/* ============================================================================
2723
* CONSTANTS FOR BINARY FORMAT SIZES
2824
* ============================================================================ */
@@ -239,7 +235,6 @@ writer_flush_buffer(BinaryWriter *writer)
239235
return -1;
240236
}
241237

242-
_Py_MSAN_UNPOISON(writer->zstd.compressed_buffer, output.pos);
243238
if (output.pos > 0) {
244239
if (fwrite_checked_allow_threads(writer->zstd.compressed_buffer, output.pos, writer->fp) < 0) {
245240
return -1;
@@ -1109,7 +1104,6 @@ binary_writer_finalize(BinaryWriter *writer)
11091104
return -1;
11101105
}
11111106

1112-
_Py_MSAN_UNPOISON(writer->zstd.compressed_buffer, output.pos);
11131107
if (output.pos > 0) {
11141108
if (fwrite_checked_allow_threads(writer->zstd.compressed_buffer, output.pos, writer->fp) < 0) {
11151109
return -1;

‎Modules/_testinternalcapi.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ next_frame_pointer_is_valid(uintptr_t *frame_pointer, uintptr_t *next_fp,
438438
#endif
439439
}
440440

441-
static PyObject * _Py_NO_SANITIZE_MEMORY
441+
static PyObject *
442442
manual_unwind_from_fp(uintptr_t *frame_pointer)
443443
{
444444
uintptr_t stack_min = 0;
@@ -2049,8 +2049,8 @@ check_pyobject_forbidden_bytes_is_freed(PyObject *self,
20492049
static PyObject *
20502050
check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
20512051
{
2052-
/* ASan, MSan or TSan would report an error. */
2053-
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER) || defined(_Py_MEMORY_SANITIZER)
2052+
/* ASan or TSan would report an use-after-free error */
2053+
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
20542054
Py_RETURN_NONE;
20552055
#else
20562056
PyObject *op = PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);

‎Modules/posixmodule.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10137,7 +10137,6 @@ os_getlogin_impl(PyObject *module)
1013710137
errno = old_errno;
1013810138
}
1013910139
else {
10140-
_Py_MSAN_UNPOISON(name, sizeof(name));
1014110140
result = PyUnicode_DecodeFSDefault(name);
1014210141
}
1014310142
#else

‎Modules/socketmodule.c‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,7 @@ set_herror(socket_state *state, int h_error)
754754
PyObject *v;
755755

756756
#ifdef HAVE_HSTRERROR
757-
const char *errmsg = hstrerror(h_error);
758-
_Py_MSAN_UNPOISON_STRING(errmsg);
759-
v = Py_BuildValue("(iN)", h_error, decode_error_message(errmsg));
757+
v = Py_BuildValue("(iN)", h_error, decode_error_message(hstrerror(h_error)));
760758
#else
761759
v = Py_BuildValue("(is)", h_error, "host not found");
762760
#endif
@@ -783,9 +781,7 @@ set_gaierror(socket_state *state, int error)
783781
#endif
784782

785783
#ifdef HAVE_GAI_STRERROR
786-
const char *errmsg = gai_strerror(error);
787-
_Py_MSAN_UNPOISON_STRING(errmsg);
788-
v = Py_BuildValue("(iN)", error, decode_error_message(errmsg));
784+
v = Py_BuildValue("(iN)", error, decode_error_message(gai_strerror(error)));
789785
#else
790786
v = Py_BuildValue("(is)", error, "getaddrinfo failed");
791787
#endif
@@ -6424,7 +6420,6 @@ socket_getservbyport(PyObject *self, PyObject *args)
64246420
PyErr_SetString(PyExc_OSError, "port/proto not found");
64256421
return NULL;
64266422
}
6427-
_Py_MSAN_UNPOISON_STRING(sp->s_name);
64286423
return PyUnicode_FromString(sp->s_name);
64296424
}
64306425

0 commit comments

Comments
 (0)