After upgrading my home router/NAS from FreeBSD 14.4 to 14.5 I noticed some Ports crashing during configuration with "Illegal instruction". It seems to affect those Ports who use CMake during configuration like devel/pcre2. root@gatekeeper:/usr/ports/devel/pcre2 # make ===> pcre2-10.48 depends on file: /usr/local/bin/cmake - found ===> pcre2-10.48 depends on executable: ninja - found ===> pcre2-10.48 depends on package: pkgconf>=1.3.0_1 - found ===> Configuring for pcre2-10.48 ===> Performing out-of-source build /bin/mkdir -p /usr/ports/devel/pcre2/work/.build -- Using CMake version 3.31.12 (/usr/local/bin/cmake) -- The C compiler identification is Clang 21.1.8 Illegal instruction (core dumped) *** Error code 132 <snip> Looking at the core dump it points to security/rhash. root@gatekeeper:/usr/ports/devel/pcre2/work/.build # gdb /usr/local/bin/cmake -c cmake.core <snip> Program terminated with signal SIGILL, Illegal instruction. Privileged opcode. #0 0x000000082512c7e4 in ?? () from /usr/local/lib/librhash.so.1 Unfortunately I'm unable to disassemble that frame to check exactly what instruction was used, because I don't know how to produce the needed debug symbols. I'm willing to try it if someone can help me with the necessary commands. But I had a look at the output from compiling security/rhash and there I see an explicit -msse4 sent to every cc line and I have no configurable option to disable this what I can find. cc -c -DRHASH_SSE4_SHANI -DOPENSSL_RUNTIME -DNDEBUG -pipe -ffunction-sections -fdata-sections -fomit-frame-pointer -msse4 -msha -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing sha3.c -o sha3.o If I add CPUTYPE?=x86-64 to /etc/make.conf the compiler adds -march=x86-64 as expected but it doesn't remove the -msse4 so unfortunately it doesn't help. cc -c -DRHASH_SSE4_SHANI -DOPENSSL_RUNTIME -DNDEBUG -pipe -ffunction-sections -fdata-sections -fomit-frame-pointer -msse4 -msha -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations -O2 -pipe -march=x86-64 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing sha3.c -o sha3.o My hardware is old but as I understand it should still be supported by FreeBSD and I did not run into this problem on 14.4. CPU: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (1800.09-MHz K8-class CPU) Origin="GenuineIntel" Id=0x106ca Family=0x6 Model=0x1c Stepping=10 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=0x40e31d<SSE3,DTES64,MON,DS_CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE> AMD Features=0x20100800<SYSCALL,NX,LM> AMD Features2=0x1<LAHF> TSC: P-state invariant, performance statistics The version of security/rhash is the same as I used on FreeBSD 14.4 so maybe this instead points to some incompatibility with the upgraded Clang that came with FreeBSD 14.5? Eventually I will have to replace my hardware but if this is a bug I would prefer not having to replace the hardware with the currently inflated prices on RAM and SSD :-) Please let me know if I can provide any other information from my system to help resolve this. Regards Morgan Wesström
(In reply to Morgan Wesström from comment #0) > I don't know how to produce the needed debug symbols. I'm willing to try > it if someone can help me with the necessary commands. $ cd security/rhash $ make WITH_DEBUG= ... $ file work/stage/usr/local/lib/librhash.so.1.4.6 work/stage/usr/local/lib/librhash.so.1.4.6: ELF [...] with debug_info, not stripped > I see an explicit -msse4 sent to every cc line and I have no configurable > option to disable this SSE4 and SHANI support is autodetected in the configure script, around line 770. > My hardware [Intel Atom D525] is old but as I understand it should still > be supported by FreeBSD and I did not run into this problem on 14.4. It is certainly supported, we'll hunt this bug down.
I reported it upstream too and the developer has issued a patch there now which I haven't tested yet (I worked around it so far by patching the configure script directly). https://github.com/rhash/RHash/issues/312 What I find surprising is that I did not run into this on 14.4 and I was running rhash there for 8 months according to my logs. Jan 15 02:29:38 gatekeeper pkg-static[17260]: rhash-1.4.4_2 deinstalled Jan 15 02:29:39 gatekeeper pkg-static[17355]: rhash-1.4.6 installed Mar 14 00:51:21 gatekeeper pkg-static[86595]: rhash-1.4.6 deinstalled Mar 14 00:51:21 gatekeeper pkg-static[86697]: rhash-1.4.6 installed Aug 28 17:45:41 gatekeeper kernel: FreeBSD 14.4-RELEASE-p9 releng/14.4-n273766-53c5c1935320 MYKERNEL amd64 Sep 19 20:00:51 gatekeeper kernel: FreeBSD 14.5-RELEASE releng/14.5-n274872-4099b5c82880 MYKERNEL amd64 Sep 25 21:24:29 gatekeeper pkg-static[39582]: rhash-1.4.6 deinstalled Sep 25 21:24:30 gatekeeper pkg-static[39697]: rhash-1.4.6 installed Perhaps it was just coincidence I didn't have any other Ports updates during those 8 months that triggered rhash...
(In reply to Morgan Wesström from comment #2) >I was running rhash there for 8 months I.e. rhash-1.4.6
Upstream pull request #320 at commit a14f302944e5a3ca3fc7bc5f47b8a211b62c424d now contains several patches that fixes this bug for me at least. https://github.com/rhash/RHash/pull/320 It compiles and installs with no errors on my x86-64-v1 system and my build test with devel/pcre2 completes with no errors.
Created attachment 275621 [details] Patch between v1.4.6 and upstream commit a14f302 For reasons unknown to me, the upstream pull request I linked is no longer available. At least I can't find it. I synced the git tree while it was still available and attach the diff between v1.4.6 and commit a14f302 if it can be of any help to the Port maintainer.