The option "Enable assembly optimizations for your CPU" causes the crash of gmp-6.2.0 on an Intel(R) Atom(TM) CPU C2758. This does not happen on gmp-6.1.2_1. The crash happens in python3.7/site-packages/Crypto/Math/_IntegerGMP.py We have tried to find the cause in related Python packages here: https://github.com/Legrandin/pycryptodome/issues/394 https://github.com/rthalley/dnspython/issues/446 but had no luck. Stacktrace and part of dmesg below. ------------- Current thread 0x0000000800a24000 (most recent call first): File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/Crypto/Math/_IntegerGMP.py", line 163 in __init__ File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/Crypto/PublicKey/ECC.py", line 123 in init_p256 File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/Crypto/PublicKey/ECC.py", line 138 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/Crypto/Signature/DSS.py", line 42 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1035 in _handle_fromlist File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/dns/dnssec.py", line 484 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/dns/rdtypes/dnskeybase.py", line 22 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/dns/rdtypes/ANY/DNSKEY.py", line 18 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "/usr/local/src/DSKM/DSKM/zone.py", line 37 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "/usr/local/src/DSKM/DSKM/operate.py", line 32 in <module> File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed File "<frozen importlib._bootstrap_external>", line 728 in exec_module File "<frozen importlib._bootstrap>", line 677 in _load_unlocked File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 983 in _find_and_load File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2352 in resolve File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2346 in load File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2728 in load_entry_point File "/usr/local/py_venv/dskm_p37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 487 in load_entry_point File "/usr/local/py_venv/dskm_p37/bin/operate_dskm", line 11 in <module> Illegal instruction (core dumped) -------------------- From dmesg: ----------- Copyright (c) 1992-2019 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.1-RELEASE-p3 GENERIC amd64 FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1) VT(efifb): resolution 1024x768 CPU: Intel(R) Atom(TM) CPU C2758 @ 2.40GHz (2400.07-MHz K8-class CPU) Origin="GenuineIntel" Id=0x406d8 Family=0x6 Model=0x4d Stepping=8 Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> Features2=0x43d8e3bf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,AESNI,RDRAND> AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM> AMD Features2=0x101<LAHF,Prefetch> Structured Extended Features=0x2282<TSCADJ,SMEP,ERMS,NFPUSG> VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID TSC: P-state invariant, performance statistics real memory = 8589934592 (8192 MB) avail memory = 8228855808 (7847 MB) -----------------
Do you have any kind of optimization set in /etc/make.conf ? Do you get any failures if you run make test?
> Do you have any kind of optimization set in /etc/make.conf ? No. > Do you get any failures if you run make test? No.
As suggested by others, you should try to reproduce the issue with a small C program and submit a bug report to mpfr. I cannot help you with ASM optimizations in MPFR code. The quick workaround is to disable CPU specific ASM code, obviously.
> As suggested by others, you should try to reproduce the issue with a small C program and submit a bug report to mpfr.I cannot help you with ASM optimizations in MPFR code. My Python application is 3 levels above that code and I have no experience with that low level stuff. > The quick workaround is to disable CPU specific ASM code, obviously. I did this already. (-; Maybe warning other people by an addition to the options text? Axel
From what I can tell py-cryptodome does offer some kind of unit tests so perhaps it's worth trying to add that to the port to pin it down where it actually fails since gmp itself seems to be fine.
..also suggested on irc is that you make sure you have the latest microcode for your cpu loaded/installed which might fix the issue. https://www.freshports.org/sysutils/devcpu-data/ If you cannot update bios or if your the manufactorer doesn't provide an updated version.