Skip to content

gh-115491: Keep some fields valid across allocations in obmalloc (free-threading)#115745

Merged
DinoV merged 1 commit into
python:mainfrom
colesbury:gh-115491-debug-fill-obmalloc
Feb 21, 2024
Merged

gh-115491: Keep some fields valid across allocations in obmalloc (free-threading)#115745
DinoV merged 1 commit into
python:mainfrom
colesbury:gh-115491-debug-fill-obmalloc

Conversation

@colesbury

@colesbury colesbury commented Feb 20, 2024

Copy link
Copy Markdown
Contributor

This avoids overwriting the first few fields in the PyObject header with debug bytes (like 0xDD for dead bytes) in the free-threaded build. These fields may be accessed for a period after an object is deallocated.

For simplicity, this skips some of the filling of debug bytes for the "realloc" calls in the free-threaded build, because that case is more complex. The calls that delegate to mimalloc will be filled by mimalloc with debug bytes anyways.

@DinoV DinoV left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@DinoV DinoV merged commit 347acde into python:main Feb 21, 2024
@colesbury colesbury deleted the gh-115491-debug-fill-obmalloc branch February 21, 2024 18:00
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this pull request Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants