https://github.com/python/cpython/commit/04cfecc06b4e652e2a981fea8f55dc48b87f460d
commit: 04cfecc06b4e652e2a981fea8f55dc48b87f460d
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: mhsmith <[email protected]>
date: 2026-11-09T23:00:27Z
summary:

[3.15] gh-158529: Prevent mimalloc calling system calls directly on Android 
(GH-158530) (#161709)

(cherry picked from commit 78407daea0ff0c29e32d2cb03896957a51b294e2)

Co-authored-by: Malcolm Smith <[email protected]>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2026-09-30-21-29-54.gh-issue-158529.kZO7mX.rst
M Objects/mimalloc/prim/unix/prim.c

diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2026-09-30-21-29-54.gh-issue-158529.kZO7mX.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2026-09-30-21-29-54.gh-issue-158529.kZO7mX.rst
new file mode 100644
index 000000000000000..712f26f6493877c
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2026-09-30-21-29-54.gh-issue-158529.kZO7mX.rst
@@ -0,0 +1,2 @@
+Fixed crash on Android x86_64, API levels 27-28, caused by mimalloc calling
+system calls directly.
diff --git a/Objects/mimalloc/prim/unix/prim.c 
b/Objects/mimalloc/prim/unix/prim.c
index bb619569a1bdb12..ebf89ac24a15544 100644
--- a/Objects/mimalloc/prim/unix/prim.c
+++ b/Objects/mimalloc/prim/unix/prim.c
@@ -78,10 +78,11 @@ terms of the MIT license. A copy of the license can be 
found in the file
 // Use syscalls for some primitives to allow for libraries that override 
open/read/close etc.
 // and do allocation themselves; using syscalls prevents recursion when 
mimalloc is
 // still initializing (issue #713)
+// Not used on Android, see issue python/cpython/pull/158530
 // Declare inline to avoid unused function warnings.
 
//------------------------------------------------------------------------------------
 
-#if defined(MI_HAS_SYSCALL_H) && defined(SYS_open) && defined(SYS_close) && 
defined(SYS_read) && defined(SYS_access)
+#if defined(MI_HAS_SYSCALL_H) && defined(SYS_open) && defined(SYS_close) && 
defined(SYS_read) && defined(SYS_access) &&  !defined(__ANDROID__)
 
 static inline int mi_prim_open(const char* fpath, int open_flags) {
   return syscall(SYS_open,fpath,open_flags,0);

_______________________________________________
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]

Reply via email to