Skip to content

Conversation

@stratakis
Copy link
Contributor

@stratakis stratakis commented Jan 11, 2026

mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current check never detects mmap failures, so jitdump initialization proceeds even when the memory mapping fails.

@aisk
Copy link
Contributor

aisk commented Jan 12, 2026

Hi, I think a related issue and a news entry file are needed for this PR. Please read the Dev Guide (especially https://devguide.python.org/getting-started/pull-request-lifecycle/) to see what is required when creating a PR.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

The change LGTM, but I agree with @aisk: it would be nice to document the fix in a NEWS entry.

@vstinner vstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jan 22, 2026
@stratakis stratakis changed the title Fix mmap failure check in perf_jit_trampoline.c gh-144194: Fix mmap failure check in perf_jit_trampoline.c Jan 23, 2026
Comment on lines +1 to +2
Fix mmap failure check in perf jitdump initialization. The code incorrectly
checked for NULL instead of MAP_FAILED, causing failures to go undetected.
Copy link
Member

Choose a reason for hiding this comment

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

Can the news entry focus on what was fixed, not how (that's what we have diffs for). They are for end-users, not people familiar with internals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would you suggest? This is a fix for the internals after all that I noticed myself in the code, while working on another issue. And fixes for such types of issues have been many times in NEWS entries before, other times the NEWS entry is skipped, which is what I was going for in this case.

@StanFromIreland
Copy link
Member

You need to update your branch to fix the CI, it is incompatible.

mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current
check never detects mmap failures, so jitdump initialization proceeds
even when the memory mapping fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants