https://github.com/python/cpython/commit/157e946d78a501df8356af8c8c37b03b0518b6e9 commit: 157e946d78a501df8356af8c8c37b03b0518b6e9 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2026-01-28T13:57:19Z summary:
[3.14] gh-144194: Fix mmap failure check in perf_jit_trampoline.c (GH-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 8fe8a94a7c050bc16cac9ec300f89c0f389f9a44) Co-authored-by: stratakis <[email protected]> files: A Misc/NEWS.d/next/Core_and_Builtins/2026-01-23-20-20-42.gh-issue-144194.IbXfxd.rst M Python/perf_jit_trampoline.c diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-23-20-20-42.gh-issue-144194.IbXfxd.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-23-20-20-42.gh-issue-144194.IbXfxd.rst new file mode 100644 index 00000000000000..1f33284439c041 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-23-20-20-42.gh-issue-144194.IbXfxd.rst @@ -0,0 +1 @@ +Fix error handling in perf jitdump initialization on memory allocation failure. diff --git a/Python/perf_jit_trampoline.c b/Python/perf_jit_trampoline.c index c0f314a7f6522b..acfd27fa29526e 100644 --- a/Python/perf_jit_trampoline.c +++ b/Python/perf_jit_trampoline.c @@ -1054,7 +1054,8 @@ static void* perf_map_jit_init(void) { 0 // Offset 0 (first page) ); - if (perf_jit_map_state.mapped_buffer == NULL) { + if (perf_jit_map_state.mapped_buffer == MAP_FAILED) { + perf_jit_map_state.mapped_buffer = NULL; close(fd); return NULL; // Memory mapping failed } _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
