cpython/Modules/_remote_debugging
Pablo Galindo Salgado 65fbec64f6
[3.15] gh-151613: Fix remote debugging frame cache ABA (#152448)
gh-151613: Fix remote debugging frame cache ABA (#151614)

The remote debugging frame cache previously used only the last_profiled_frame address as its cache anchor. If a frame returned and a later frame reused the same _PyInterpreterFrame address, the profiler could accept a stale cache entry and splice parent frames from a different call chain into the current stack.

This adds a last_profiled_frame_seq counter next to last_profiled_frame, increments it when the anchor advances, stores it in frame cache entries, and validates cache hits against both the frame address and the sequence. Cache miss walks now copy stack chunks before storing new cache entries so stored continuations come from a stable snapshot. The new regression test exercises alternating call chains and checks that cached stacks never contain frames from both branches.

(cherry picked from commit 8cda6ae2f1)
2026-06-27 17:42:31 +00:00
..
clinic [3.15] gh-150285: Fix too long docstrings in the _remote_debugging module (GH-150289) (#150334) 2026-05-24 14:09:13 +01:00
_remote_debugging.h [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
asyncio.c [3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435) 2026-05-25 23:02:37 +00:00
binary_io.h [3.15] gh-149474: use Py_fopen in Binary{Reader,Writer} for audit hook and path-like support (GH-149524) (#149586) 2026-05-09 00:28:21 +00:00
binary_io_reader.c [3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435) 2026-05-25 23:02:37 +00:00
binary_io_writer.c [3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435) 2026-05-25 23:02:37 +00:00
code_objects.c [3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435) 2026-05-25 23:02:37 +00:00
debug_offsets_validation.h [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
frame_cache.c [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
frames.c [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
gc_stats.c GH-148726: Add heap_size to generational GC (#149195) 2026-05-04 22:14:45 +01:00
gc_stats.h GH-146527: Add get_gc_stats function to _remote_debugging (#148071) 2026-05-02 15:04:18 +00:00
interpreters.c GH-146527: Add get_gc_stats function to _remote_debugging (#148071) 2026-05-02 15:04:18 +00:00
module.c [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00
object_reading.c [3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435) 2026-05-25 23:02:37 +00:00
subprocess.c [3.15] gh-149619: Harden _remote_debugging error paths (GH-150349) (#150435) 2026-05-25 23:02:37 +00:00
threads.c [3.15] gh-151613: Fix remote debugging frame cache ABA (#152448) 2026-06-27 17:42:31 +00:00