Skip to content

Commit a5ecf2a

Browse files
authored
Merge branch '3.15' into backport-9aa731f-3.15
2 parents 4839a64 + bc29f96 commit a5ecf2a

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎Include/pyport.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ extern "C" {
578578
# define _Py_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
579579
# endif
580580
# endif
581+
# if __has_feature(undefined_behavior_sanitizer)
582+
# define _Py_NO_SANITIZE_FUNCTION __attribute__((no_sanitize("function")))
583+
# endif
581584
#elif defined(__GNUC__)
582585
# if defined(__SANITIZE_ADDRESS__)
583586
# define _Py_ADDRESS_SANITIZER
@@ -602,6 +605,9 @@ extern "C" {
602605
#ifndef _Py_NO_SANITIZE_MEMORY
603606
# define _Py_NO_SANITIZE_MEMORY
604607
#endif
608+
#ifndef _Py_NO_SANITIZE_FUNCTION
609+
# define _Py_NO_SANITIZE_FUNCTION
610+
#endif
605611
#ifndef _Py_MSAN_UNPOISON
606612
# define _Py_MSAN_UNPOISON(PTR, SIZE)
607613
#endif

‎Lib/test/test_perf_profiler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
if not support.has_subprocess_support:
1818
raise unittest.SkipTest("test module requires subprocess")
1919

20-
if support.check_sanitizer(address=True, memory=True, ub=True, function=True):
20+
if support.check_sanitizer(address=True, memory=True, function=False):
2121
# gh-109580: Skip the test because it does crash randomly if Python is
2222
# built with ASAN.
23-
raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")
23+
raise unittest.SkipTest("test crash randomly on ASAN/MSAN build")
2424

2525

2626
def supports_trampoline_profiling():

‎Lib/test/test_samply_profiler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
if not support.has_subprocess_support:
1515
raise unittest.SkipTest("test module requires subprocess")
1616

17-
if support.check_sanitizer(address=True, memory=True, ub=True, function=True):
17+
if support.check_sanitizer(address=True, memory=True, function=False):
1818
# gh-109580: Skip the test because it does crash randomly if Python is
1919
# built with ASAN.
20-
raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")
20+
raise unittest.SkipTest("test crash randomly on ASAN/MSAN build")
2121

2222

2323
def supports_trampoline_profiling():
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a crash in the perf trampoline (:option:`-X perf <-X>`) on builds with
2+
clang's ``-fsanitize=function``, which ``-fsanitize=undefined`` enables
3+
since clang 17.

‎Python/perf_trampoline.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ compile_trampoline(void)
434434
return code_arena_new_code(perf_code_arena);
435435
}
436436

437-
static PyObject *
437+
// gh-161288: the trampoline has no -fsanitize=function type signature
438+
static PyObject * _Py_NO_SANITIZE_FUNCTION
438439
py_trampoline_evaluator(PyThreadState *ts, _PyInterpreterFrame *frame,
439440
int throw)
440441
{

0 commit comments

Comments
 (0)