Skip to content
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

received SIGILL, Illegal instruction from raspberry pi #1302

Open
xhiksi opened this issue Jan 10, 2025 · 2 comments
Open

received SIGILL, Illegal instruction from raspberry pi #1302

xhiksi opened this issue Jan 10, 2025 · 2 comments

Comments

@xhiksi
Copy link

xhiksi commented Jan 10, 2025

Hello,

I am having troubles using my builded amule(not building, using), where cryptopp is one of needed libraries. I removed it the repository version and make it from github master.

Now, I have the line which is failing:

Program received signal SIGILL, Illegal instruction. 0x00000055558510e8 in PMULL_00 (b=..., a=...) at /home/imesemj/c++/cryptopp/arm_simd.h:160

where there is this line:
160 __asm__ ("pmull %0.1q, %1.1d, %2.1d \n\t"

it is an assembler within c/c++

Amule stucks randomly and may be this the problem ?

regards

@xhiksi
Copy link
Author

xhiksi commented Jan 11, 2025

I think this behavior, because this cpu of rpi3 model b have not aes and pmull instruction:

`Architecture: aarch64

CPU op-mode(s): 32-bit, 64-bit

Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: ARM
Model name: Cortex-A53
Model: 4
Thread(s) per core: 1
Core(s) per cluster: 4
Socket(s): -
Cluster(s): 1
Stepping: r0p4
CPU(s) scaling MHz: 50%
CPU max MHz: 1200.0000
CPU min MHz: 600.0000
BogoMIPS: 38.40
Flags: fp asimd evtstrm crc32 cpuid
Caches (sum of all):
L1d: 128 KiB (4 instances)
L1i: 128 KiB (4 instances)
L2: 512 KiB (1 instance)
Vulnerabilities:
Gather data sampling: Not affected
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Reg file data sampling: Not affected
Retbleed: Not affected
Spec rstack overflow: Not affected
Spec store bypass: Not affected
Spectre v1: Mitigation; __user pointer sanitization
Spectre v2: Not affected
Srbds: Not affected
Tsx async abort: Not affected`

Question is: how can substitute hardware instruction with any software procedure ? support for old cpus

@xhiksi
Copy link
Author

xhiksi commented Jan 12, 2025

Hi
I replaced asm to arm_simd.h:160 with function of line 165:
return (uint64x2_t)(vmull_p64(vgetq_lane_u64(vreinterpretq_u64_u8(a),0),vgetq_lane_u64(vreinterpretq_u64_u8(b),0)));

and build library and amule from beginning. Now I have again SIGILL, illegal instruction:

`(gdb) run
Starting program: /usr/local/amule/bin/amuled -f
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0x00000055558431a4 in vaesdq_u8 (key=..., data=...) at /usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:10260
10260 return __builtin_aarch64_crypto_aesdv16qi_uuu (data, key);
(gdb) backtrace
#0 0x00000055558431a4 in vaesdq_u8 (key=..., data=...) at /usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:10260
#1 CryptoPP::CPU_ProbeAES () at rijndael_simd.cpp:130
#2 0x0000005555851780 in CryptoPP::DetectArmFeatures () at cpu.cpp:1148
#3 0x0000007ff7837898 in call_init (env=, argv=0x7ffffff3d8, argc=2) at ../csu/libc-start.c:145
#4 __libc_start_main_impl (main=0x5555610130 <main(int, char**)>, argc=2, argv=0x7ffffff3d8, init=, fini=, rtld_fini=,
stack_end=) at ../csu/libc-start.c:347
#5 0x00000055556181b0 in _start ()
(gdb)
#0 0x00000055558431a4 in vaesdq_u8 (key=..., data=...) at /usr/lib/gcc/aarch64-linux-gnu/12/include/arm_neon.h:10260
#1 CryptoPP::CPU_ProbeAES () at rijndael_simd.cpp:130
#2 0x0000005555851780 in CryptoPP::DetectArmFeatures () at cpu.cpp:1148
#3 0x0000007ff7837898 in call_init (env=, argv=0x7ffffff3d8, argc=2) at ../csu/libc-start.c:145
#4 __libc_start_main_impl (main=0x5555610130 <main(int, char**)>, argc=2, argv=0x7ffffff3d8, init=, fini=, rtld_fini=,
stack_end=) at ../csu/libc-start.c:347
#5 0x00000055556181b0 in _start ()`

All crypto file are compiling in this way:

g++ -DCRYPTOPP_DISABLE_ARM_CRC32 -DCRYPTOPP_DISABLE_ARM_PMULL -fPIC -fno-devirtualize -pthread -pipe -DNDEBUG -g2 -O3 -std=gnu++98 -c all_crypto_files.cpp

As can see here make script, identifies correctly that cpu has not this features and defines the macro CRYPTOPP_DISABLE_ARM_PMULL, which is not working. There is defined CRYPTOPP_DISABLE_ARM_CRC32, too.
Is this correct ? in cpu info above, I can see crc32 flag, it is a important improvemet if it is.

please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant