piwheels / packages

Issue tracker for piwheels package issues
https://github.com/piwheels/packages/issues
20 stars 5 forks source link

Package issue: cryptography 36.0.1 produces "Illegal Instruction" #273

Closed mendhak closed 2 years ago

mendhak commented 2 years ago

Package name

cryptography

Package version

36.0.1

PyPI URL

https://pypi.org/project/cryptography/

piwheels URL

https://www.piwheels.org/project/cryptography/

Python version

I am the maintainer

More information

OS version: Raspbian GNU/Linux 11 (bullseye) on Raspberry Pi Zero
uname -a : Linux epaper 5.10.63+ #1488 Thu Nov 18 16:14:04 GMT 2021 armv6l GNU/Linux

On Raspberry Pi Zero, the cryptography module version 36.0.1 results in "Illegal Instruction". Downgrading to 36.0.0 doesn't produce any error.

This is the specific wheel that gets downloaded when I pip install cryptography: https://www.piwheels.org/simple/cryptography/cryptography-36.0.1-cp39-cp39-linux_armv6l.whl

As a simple test I ran

python3 -c "from cryptography.fernet import Fernet"

And the output is "Illegal Instruction"

image

I tried to do a gdb but I don't actually know what I'm doing or what the output means, but hopefully there's something in here that helps.

pi@epaper:~ $ gdb --args python3 -c "from cryptography.fernet import Fernet"
GNU gdb (Raspbian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...
(No debugging symbols found in python3)
(gdb) run
Starting program: /usr/bin/python3 -c from\ cryptography.fernet\ import\ Fernet
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0xb645356c in register_tm_clones () from /usr/local/lib/python3.9/dist-packages/cryptography/hazmat/bindings/_rust.abi3.so
(gdb) bt
#0  0xb645356c in register_tm_clones () from /usr/local/lib/python3.9/dist-packages/cryptography/hazmat/bindings/_rust.abi3.so
#1  0xb6fdd328 in call_init (l=<optimized out>, argc=argc@entry=3, argv=argv@entry=0xbefff6b4, env=env@entry=0xbefff6c4) at dl-init.c:72
#2  0xb6fdd430 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:30
#3  _dl_init (main_map=0x4c8290, argc=3, argv=0xbefff6b4, env=0xbefff6c4) at dl-init.c:119
#4  0xb6e64a0c in __GI__dl_catch_exception (exception=0x5, operate=0x0, args=0xbeffcd18) at dl-error-skeleton.c:182
#5  0xb6fe1514 in dl_open_worker (a=<optimized out>) at dl-open.c:758
#6  0xb6e649a8 in __GI__dl_catch_exception (exception=0xb668d280, operate=0xbeffcec0, args=0xbeffcf40) at dl-error-skeleton.c:208
#7  0xb6fe0d3c in _dl_open (file=0xb668ee00 "/usr/local/lib/python3.9/dist-packages/cryptography/hazmat/bindings/_rust.abi3.so", mode=-2147483646, caller_dlopen=0x1f1948, nsid=-2, argc=3, argv=0xbefff6b4, env=0xbefff6c4) at dl-open.c:837
#8  0xb6f79d98 in dlopen_doit (a=0xbeffd12c) at dlopen.c:66
#9  0xb6e649a8 in __GI__dl_catch_exception (exception=0x58, exception@entry=0xbeffd0e0, operate=0xbeffd0e8, args=0x0, args@entry=0xb6f8c000) at dl-error-skeleton.c:208
#10 0xb6e64a90 in __GI__dl_catch_error (objname=0x505394, errstring=0x505398, mallocedp=0x505390, operate=<optimized out>, args=0xbeffd12c) at dl-error-skeleton.c:227
#11 0xb6f7a87c in _dlerror_run (operate=<optimized out>, args=0xbeffd12c, args@entry=0xbeffd124) at dlerror.c:170
#12 0xb6f79e5c in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#13 0x001f1948 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) quit
A debugging session is active.

    Inferior 1 [process 1173] will be killed.

Quit anyway? (y or n) y
MichaIng commented 2 years ago

Verified, same here on armv6l RPi models, hence RPi 1 and Zero (1). This one was built manually @bennuttall, probably not on a Raspbian OS with armv6l toolchain? https://github.com/piwheels/packages/issues/267#issuecomment-1005201010

bennuttall commented 2 years ago

This issue has been identified and we hope to fix asap. Follow in #276

bennuttall commented 2 years ago

The wheels have been rebuilt and this issue should now be resolved

mendhak commented 2 years ago

Tested and working thanks.