From bac26de41db706c7677a26fdb9785b1a80d36885 Mon Sep 17 00:00:00 2001 From: BREW <81044362+b-re-w@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:28:28 +0900 Subject: [PATCH 1/2] Android 3.15t: make mimalloc take its libc branch so x86_64 apps are not killed by seccomp CPython's vendored mimalloc calls syscall(SYS_access) and syscall(SYS_open) directly whenever those numbers exist. Android's x86_64 app seccomp filter allows only faccessat/openat, so the free-threaded x86_64 build died with SIGSYS at Py_Initialize (toolchain#145 android-e2e, run 43691526214, traced to _mi_prim_numa_node_count). The build script now adds && !defined(__ANDROID__) to that guard and fails loudly if the guard line changes. arm64 has no __NR_access and already took the libc branch. Closes #436 --- .github/scripts/ft-mobile/build-android.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/scripts/ft-mobile/build-android.sh b/.github/scripts/ft-mobile/build-android.sh index cb9500cf..2222d1b6 100755 --- a/.github/scripts/ft-mobile/build-android.sh +++ b/.github/scripts/ft-mobile/build-android.sh @@ -20,6 +20,25 @@ esac src="$(fetch_source "$PY_VERSION")" cd "$src" +# Android's app seccomp filter kills legacy syscalls on x86_64: CPython's vendored mimalloc calls +# syscall(SYS_access) (and SYS_open) directly whenever those numbers exist, which raised SIGSYS +# at Py_Initialize on the x86_64 emulator (issue #436, toolchain#145). Make Android take +# mimalloc's libc branch (bionic uses openat/faccessat). arm64 has no __NR_access and already does. +prim=Objects/mimalloc/prim/unix/prim.c +guard='#if defined(MI_HAS_SYSCALL_H) && defined(SYS_open) && defined(SYS_close) && defined(SYS_read) && defined(SYS_access)' +if ! grep -qF '&& !defined(__ANDROID__)' "$prim"; then + grep -qxF "$guard" "$prim" || die "$prim: mimalloc raw-syscall guard not found; recheck issue #436" + GUARD="$guard" python3 - "$prim" <<'PY' +import os, sys +p = sys.argv[1] +g = os.environ["GUARD"] +s = open(p).read() +assert s.count(g + "\n") == 1, "guard line is not unique" +open(p, "w").write(s.replace(g + "\n", g + " && !defined(__ANDROID__)\n")) +PY +fi +grep -qF "$guard && !defined(__ANDROID__)" "$prim" || die "$prim: Android seccomp patch did not apply" + # `Platforms/Android package` lists the files to ship with `git ls-files`, so # the unpacked tarball needs an index that tracks Platforms/Android. if [ ! -d .git ]; then From 519faa1afd3c4debcdbbb5ca68ce2fcfc3104e91 Mon Sep 17 00:00:00 2001 From: BREW <81044362+b-re-w@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:35:17 +0900 Subject: [PATCH 2/2] Pin the rebuilt Android x86_64 3.15t runtime The cpython-3.15.0t-mobile x86_64 asset was rebuilt with the mimalloc seccomp fix (build-ft-mobile run 43697003385; the new libpython3.15t.so has no raw access/open syscall sites) and replaced on the release with the owner's approval (2026-11-15). The old asset is kept under .cache. Refs #436. --- python-checksums.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-checksums.properties b/python-checksums.properties index 956b5db0..30390ab9 100644 --- a/python-checksums.properties +++ b/python-checksums.properties @@ -1,6 +1,6 @@ # Python Multiplatform Checksums android-aarch64-3.15.0-freethreaded=40995c530c3e454d829b4fdea8404d8c0b0e58f60c2d41d400daa1fb0ab65991 -android-x86_64-3.15.0-freethreaded=d52580653858c429f542db0ca4ecfe12452faf6c9a967bb4b62797df7c2c8d24 +android-x86_64-3.15.0-freethreaded=e1dfe075c50d9f0888905706be2aa1c20734676f8db05661110b228e15eb30db ios-3.15.0-freethreaded=b8c0a4b32d31738f6ead7ace28acee0cb2a590bd0ca7015e9c32af613445e6b5 linux-x86_64-3.14.7-20260807=a2478d654ed51d443bae21ec20ad927f116b4f5aae4094ab74918a6aa38f0575 linux-x86_64-3.14.7-20260807-freethreaded=13f80b7fc242814c0be4e2a4d8283f39c7e1c0f3f0d8f6d6a15cedb5b62eb6d3