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