mirror of
https://github.com/python/cpython.git
synced 2026-02-06 01:45:25 +00:00
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 8fe8a94a7c)
Co-authored-by: stratakis <cstratak@redhat.com>
This commit is contained in:
parent
bc92e7878f
commit
e752ea9eb9
2 changed files with 3 additions and 1 deletions
|
|
@ -1053,7 +1053,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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue