Curl: 'illegal instruction'

I am running into this on a 19.07 branch build. Curl used to work fine on older 19.07 builds for me so it looks like something recent.

This happens on a WNDR3700 running an ath79 build with as good as stock settings (no compiler optimisations or anything). Weird thing is it works fine on s newer similar SoC (TL-WR1043ND v2).

I was recommended to check with either gdb or strace at this. I am getting the following with strace. I googled SIGILL and apparently that means 'illegal instruction', but I'm no programmer so I can't tell from the strace output if the actual issue is shown or not. Gdb means I need to rebuild with debugging symbols enabled so that will take a bit more time for output to produce.

Thank you!

# strace curl
execve("/usr/bin/curl", ["curl"], 0x7fb56a10 /* 13 vars */) = 0
set_thread_area(0x77fdceb8)             = 0
set_tid_address(0x77fd3fa8)             = 2852
open("/etc/ld-musl-mips-sf.path", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/libcurl.so.4", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libcurl.so.4", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libcurl.so.4", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0755, st_size=214984, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0,0\0\0\0004"..., 936) = 936
mmap2(NULL, 282624, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x77ee8000
mmap2(0x77f2b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x33000) = 0x77f2b000
close(3)                                = 0
open("/lib/libmbedtls.so.12", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libmbedtls.so.12", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libmbedtls.so.12", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0755, st_size=86868, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0:\220\0\0\0004"..., 936) = 936
mmap2(NULL, 155648, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x77ec2000
mmap2(0x77ee6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x14000) = 0x77ee6000
close(3)                                = 0
open("/lib/libmbedx509.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libmbedx509.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libmbedx509.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0755, st_size=49648, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0#\220\0\0\0004"..., 936) = 936
mmap2(NULL, 118784, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x77ea4000
mmap2(0x77ebf000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xb000) = 0x77ebf000
close(3)                                = 0
open("/lib/libmbedcrypto.so.3", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libmbedcrypto.so.3", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libmbedcrypto.so.3", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0755, st_size=239000, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0f\240\0\0\0004"..., 936) = 936
mmap2(NULL, 315392, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x77e56000
mmap2(0x77e9f000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x39000) = 0x77e9f000
mmap2(0x77ea1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x77ea1000
close(3)                                = 0
open("/lib/libgcc_s.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=78080, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\10\0\0\0\1\0\0'\320\0\0\0004"..., 936) = 936
mmap2(NULL, 147456, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x77e32000
mmap2(0x77e54000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12000) = 0x77e54000
close(3)                                = 0
mprotect(0x77f2b000, 4096, PROT_READ)   = 0
mprotect(0x77ee6000, 4096, PROT_READ)   = 0
mprotect(0x77ebf000, 4096, PROT_READ)   = 0
mprotect(0x77e9f000, 4096, PROT_READ)   = 0
mprotect(0x77e54000, 4096, PROT_READ)   = 0
mprotect(0x42a000, 8192, PROT_READ)     = 0
pipe([3, 4])                            = 3
close(3)                                = 0
close(4)                                = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[RT_68 RT_70 RT_73 RT_74 RT_75 RT_77 RT_78 RT_80 RT_81 RT_82 RT_85 RT_86 RT_87 RT_88 RT_89 RT_90 RT_91 RT_93 RT_94 RT_95], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=NULL}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 16) = 0
socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP) = 3
close(3)                                = 0
--- SIGILL {si_signo=SIGILL, si_code=SI_KERNEL, si_addr=NULL} ---
+++ killed by SIGILL +++
Illegal instruction

Have you tried doing a clean build?
Do you have any notes where it did work on your boxes (revisions or such)?

Thanks. I was recommended to try disabling the MIPS16 instructions and had to run make package/network/utils/curl/clean to make it work.

I had re-enabled MIPS16 instructions at some point but that clearly wasn't needed :).

fwiw, I always disable MIPS16 instructions globally on the few MIPS boxes I have left as I've found it to do more harm than good.

1 Like

So did I. Don't remember anymore why I re-enabled it again... Probably after trying to get my config in line with upstream again.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.