From d035a90d9e2d3e67553f39c87013773370074e98 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Fri, 21 Mar 2025 17:55:02 +0000 Subject: [PATCH] gh-117657: Fix TSAN data race in _PyEval_SetTrace assertion The `sys_tracing_threads` variable should be read inside LOCK_SETUP(). --- Python/legacy_tracing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/legacy_tracing.c b/Python/legacy_tracing.c index bafc2356280b37..d308a2a40992c6 100644 --- a/Python/legacy_tracing.c +++ b/Python/legacy_tracing.c @@ -594,10 +594,10 @@ _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg) if (_PySys_Audit(current_tstate, "sys.settrace", NULL) < 0) { return -1; } - assert(tstate->interp->sys_tracing_threads >= 0); // needs to be decref'd outside of the lock PyObject *old_traceobj; LOCK_SETUP(); + assert(tstate->interp->sys_tracing_threads >= 0); Py_ssize_t tracing_threads = setup_tracing(tstate, func, arg, &old_traceobj); UNLOCK_SETUP(); Py_XDECREF(old_traceobj); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy