On Thu, 18 May 2023, Chavdar Ivanov wrote:

This turned out to be /usr/bin/ftp crashing:

#  /usr/bin/ftp -o node-v20.2.0.tar.xz
'https://nodejs.org/dist/v20.2.0/node-v20.2.0.tar.xz'
Trying 104.20.23.46:443 ...
[1]    7100 segmentation fault  /usr/bin/ftp -o node-v20.2.0.tar.xz
....

If I run it under gdb, I get:

(gdb) run -o node-v20.2.0.tar.xz
'https://nodejs.org/dist/v20.2.0/node-v20.2.0.tar.xz'
Starting program: /usr/bin/ftp -o node-v20.2.0.tar.xz
'https://nodejs.org/dist/v20.2.0/node-v20.2.0.tar.xz'

Program received signal SIGILL, Illegal instruction.
0x0000f7db5d54be70 in _armv8_sha512_probe () from /usr/lib/libcrypto.so.14
(gdb) bt
#0  0x0000f7db5d54be70 in _armv8_sha512_probe () from /usr/lib/libcrypto.so.14
#1  0x0000f7db5d54c23c in OPENSSL_cpuid_setup () from /usr/lib/libcrypto.so.14
#2  0x0000ffffef643398 in _rtld_call_init_function () from
/usr/libexec/ld.elf_so
#3  0x0000ffffef6436a4 in _rtld_call_init_functions () from
/usr/libexec/ld.elf_so
#4  0x0000ffffef643f74 in _rtld () from /usr/libexec/ld.elf_so
#5  0x0000ffffef640b10 in _rtld_start () from /usr/libexec/ld.elf_so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


You should ignore SIGILL when it's in libcrypto on some archs. eg. ARM,
PPC & Sparc. On x86 systems, libcrypto uses the CPUID instruction to
determine which optimized assembly routines can be used for speedup. On
ARM etc, it installs a SIGILL handler and just runs test instructions. The
handler being called means _those_ instructions are not available.

So, on ARM, you have to tell gdb to pass through SIGILL to the program:

```
(gdb) handle SIGILL nostop noprint pass
```

The weird and suspicious thing is that /usr/bin/ftp is linked to both
existing libcrypto.so versions:

ldd /usr/bin/ftp
/usr/bin/ftp:
       -ledit.3 => /usr/lib/libedit.so.3
       -lterminfo.2 => /usr/lib/libterminfo.so.2
       -lc.12 => /usr/lib/libc.so.12
       -lssl.15 => /usr/lib/libssl.so.15
       -lcrypto.14 => /usr/lib/libcrypto.so.14
       -lcrypt.1 => /lib/libcrypt.so.1
       -lcrypto.15 => /usr/lib/libcrypto.so.15


I would say this is the real reason for the crash (SIGSEGV).

-RVP

Reply via email to