cpython/Modules/_remote_debugging
Pablo Galindo Salgado 2c1ca6bb5b
gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (#144595)
When _ctypes is imported, it may call dlopen on the libpython shared
library, causing the dynamic linker to load a second mapping of the
library into the process address space. The remote debugging code
iterates memory regions from low addresses upward and returns the first
mapping whose filename matches libpython. After _ctypes is imported, it
finds the dlopen'd copy first, but that copy's PyRuntime section was
never initialized, so reading debug offsets from it fails.

Fix this by validating each candidate PyRuntime address before accepting
it. The validation reads the first 8 bytes and checks for the "xdebugpy"
cookie that is only present in an initialized PyRuntime. Uninitialized
duplicate mappings will fail this check and be skipped, allowing the
search to continue to the real, initialized PyRuntime.
2026-02-10 10:04:50 +00:00
..
clinic gh-138122: Add blocking mode for accurate stack traces in Tachyon (#142998) 2025-12-23 10:49:47 +00:00
_remote_debugging.h gh-140739: Fix crashes from corrupted remote memory (#143190) 2025-12-26 16:06:48 +00:00
asyncio.c gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (#144595) 2026-02-10 10:04:50 +00:00
binary_io.h gh-138122: Extend binary profiling format with full source location and opcode (#143088) 2025-12-24 16:15:11 +00:00
binary_io_reader.c gh-138122: Extend binary profiling format with full source location and opcode (#143088) 2025-12-24 16:15:11 +00:00
binary_io_writer.c gh-140739: Fix missing exception on allocation failure in BinaryWriter (#143204) 2025-12-27 01:39:21 +00:00
code_objects.c gh-140739: Fix crashes from corrupted remote memory (#143190) 2025-12-26 16:06:48 +00:00
frame_cache.c gh-138122: Add blocking mode for accurate stack traces in Tachyon (#142998) 2025-12-23 10:49:47 +00:00
frames.c gh-140739: Fix crashes from corrupted remote memory (#143190) 2025-12-26 16:06:48 +00:00
module.c gh-138122: fix AC warnings in Modules/_remote_debugging/module.c (#143218) 2025-12-27 12:57:03 +00:00
object_reading.c gh-140739: Fix crashes from corrupted remote memory (#143190) 2025-12-26 16:06:48 +00:00
subprocess.c gh-144648: Improve libproc usage in _remote_debugging (#144649) 2026-02-10 08:29:55 +00:00
threads.c gh-138122: Skip threads on EPERM in blocking mode profiler (GH-143368) 2026-01-03 15:37:16 +01:00