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
@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.
@vstinner
Copy link
Member

Thanks for fixing the Linter issue ;-)

@vstinner vstinner merged commit 8fe8a94 into python:main Jan 28, 2026
47 checks passed
@miss-islington-app
Copy link

Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 28, 2026
…honGH-143713)

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.
(cherry picked from commit 8fe8a94)

Co-authored-by: stratakis <[email protected]>
@miss-islington-app
Copy link

Sorry, @stratakis and @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8fe8a94a7c050bc16cac9ec300f89c0f389f9a44 3.13

@bedevere-app
Copy link

bedevere-app bot commented Jan 28, 2026

GH-144301 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 28, 2026
@bedevere-app
Copy link

bedevere-app bot commented Jan 28, 2026

GH-144304 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 28, 2026
@vstinner
Copy link
Member

PR merged, thanks for the fix.

vstinner pushed a commit that referenced this pull request Jan 28, 2026
…-143713) (#144301)

gh-144194: Fix mmap failure check in perf_jit_trampoline.c (GH-143713)

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.
(cherry picked from commit 8fe8a94)

Co-authored-by: stratakis <[email protected]>
vstinner added a commit that referenced this pull request Jan 28, 2026
…43713) (#144304)

gh-144194: Fix mmap failure check in perf_jit_trampoline.c (#143713)

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.

(cherry picked from commit 8fe8a94)

Co-authored-by: stratakis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants