New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
android: test_ctypes crashes on armv7 and aarch64 #71129
Comments
test_ctypes crashes on an android emulator running an armv7 system image (but not on x86) at API level 21. 143|root@generic:/data/local/tmp # python -m test -v test_ctypes Current thread 0xb6f2eec8 (most recent call first): |
The crash occurs at the same line that the crash reported in issue |
Running the following interactive statements [1]:
The corresponding attached gdb session: (gdb) continue Program received signal SIGSEGV, Segmentation fault. [1] Gdb is attached after the import statement because gdb fails with SIGILL in __dl_notify_gdb_of_libraries both with arm and armv7, whenever a library is loaded. This is gdb from the Android ndk started by ndk-gdb.py from the r11c ndk. A workaround is to add the following lines in the gdbinit script: |
Maybe a libffi issue. The crash is still with libffi git-master and CPython hg-tip + |
Found libffi PR240 that fixes closures on Android: shell@ASUS_Z00E_2:/data/local/tmp $ python3.6 -m test.test_ctypes OK (skipped=92) See yan12125/python3-android@1daebca for details. By http://comments.gmane.org/gmane.comp.lib.ffi.general/1235, SELinux affects the result, too. PR240 of libffi assumes SELinux is disabled. I have disabled SELinux on my phone for some root applications. I'm not sure whether PR240 works for phones with SELinux or not. |
Thanks for looking into that problem. |
By msg264746, only ARM fails, so I patch libffi for arm and aarch64 triplets only |
Test results against patched libffi in Modules/_ctypes: shell@ASUS_Z00E_2:/data/local/tmp $ python3.6 -m test.test_ctypes Traceback (most recent call last):
File "/data/local/tmp/python3/lib/python3.6/ctypes/test/test_win32.py", line 133, in test_struct_by_value
self.assertEqual(ret.left, left.value)
AssertionError: -200 != 10 Ran 456 tests in 1.970s FAILED (failures=1, skipped=92) A failure occurs with libffi 3.1 while all tests passes with libffi git-master. bpo-23085 may be the solution. |
Nice, the patch fixes the problem when python is built with gcc :)
I did not try with clang, stopped by the problem in bpo-27627 for armv7 and in bpo-27606 for arm. |
You're right. I thought the default malloc() implementation is better, and now I think a unified implementation on Android brings less surprises. |
We should wait for the pull request to be merged in the libffi development repo before committing the patch. The PR is at libffi/libffi#265. |
Thanks Chi Hsuan Yen for your contributions with this issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: