@@ -206,24 +206,27 @@ validate_fixed_field(
206206 } while (0)
207207
208208/*
209- * Each list below must include every offset that is later dereferenced against
210- * a local buffer or local object view. The validator checks that each field
211- * stays within both the remote table's reported section size and the local
212- * buffer size we use when reading that section. If a new dereferenced field is
213- * added to the offset tables, add it to the matching list here.
209+ * Each list below must include every offset that is later dereferenced against
210+ * a local buffer or local object view. The validator checks that each field
211+ * stays within both the remote table's reported section size and the local
212+ * buffer size we use when reading that section. If a new dereferenced field is
213+ * added to the offset tables, add it to the matching list here.
214+ *
215+ * Sections not listed here are present in the offset tables but not used by
216+ * the unwinder, so no validation is needed for them.
214217 */
215218#define PY_REMOTE_DEBUG_RUNTIME_STATE_FIELDS (APPLY , buffer_size ) \
216219 APPLY(runtime_state, interpreters_head, sizeof(uintptr_t), buffer_size)
217220
218221#define PY_REMOTE_DEBUG_THREAD_STATE_FIELDS (APPLY , buffer_size ) \
219- APPLY(thread_state, native_thread_id, sizeof(long), buffer_size); \
220- APPLY(thread_state, interp, sizeof(uintptr_t), buffer_size); \
221- APPLY(thread_state, datastack_chunk, sizeof(uintptr_t), buffer_size); \
222- APPLY(thread_state, status, FIELD_SIZE(PyThreadState, _status), buffer_size); \
223- APPLY(thread_state, holds_gil, sizeof(int), buffer_size); \
224- APPLY(thread_state, gil_requested, sizeof(int), buffer_size); \
225- APPLY(thread_state, current_exception, sizeof(uintptr_t), buffer_size); \
226- APPLY(thread_state, thread_id, sizeof(long), buffer_size); \
222+ APPLY(thread_state, native_thread_id, sizeof(unsigned long), buffer_size); \
223+ APPLY(thread_state, interp, sizeof(uintptr_t), buffer_size); \
224+ APPLY(thread_state, datastack_chunk, sizeof(uintptr_t), buffer_size); \
225+ APPLY(thread_state, status, FIELD_SIZE(PyThreadState, _status), buffer_size); \
226+ APPLY(thread_state, holds_gil, sizeof(int), buffer_size); \
227+ APPLY(thread_state, gil_requested, sizeof(int), buffer_size); \
228+ APPLY(thread_state, current_exception, sizeof(uintptr_t), buffer_size); \
229+ APPLY(thread_state, thread_id, sizeof(unsigned long), buffer_size); \
227230 APPLY(thread_state, next, sizeof(uintptr_t), buffer_size); \
228231 APPLY(thread_state, current_frame, sizeof(uintptr_t), buffer_size); \
229232 APPLY(thread_state, base_frame, sizeof(uintptr_t), buffer_size); \
@@ -296,7 +299,11 @@ validate_fixed_field(
296299static inline int
297300_PyRemoteDebug_ValidateDebugOffsetsLayout (struct _Py_DebugOffsets * debug_offsets )
298301{
299- PY_REMOTE_DEBUG_VALIDATE_SECTION (runtime_state );
302+ /* Validate every field the unwinder dereferences against a local buffer
303+ * or local object view. Fields used only for remote address arithmetic
304+ * (e.g. runtime_state.interpreters_head) are also checked as a sanity
305+ * bound on the offset value. */
306+ PY_REMOTE_DEBUG_VALIDATE_SECTION (runtime_state );
300307 PY_REMOTE_DEBUG_RUNTIME_STATE_FIELDS (
301308 PY_REMOTE_DEBUG_VALIDATE_FIELD ,
302309 sizeof (_PyRuntimeState ));
0 commit comments