https://github.com/python/cpython/commit/8fe8a94a7c050bc16cac9ec300f89c0f389f9a44
commit: 8fe8a94a7c050bc16cac9ec300f89c0f389f9a44
branch: main
author: stratakis <[email protected]>
committer: vstinner <[email protected]>
date: 2026-01-28T13:30:17Z
summary:
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.
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 f51ab1b47a04f1..0ba856ea610e59 100644
--- a/Python/perf_jit_trampoline.c
+++ b/Python/perf_jit_trampoline.c
@@ -1083,7 +1083,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]