On 2023/09/10 20:25, Isaac Meerwarth wrote: > I wanted to report that KiCad exits with "illegal instruction" when you try > to launch a project.
> cpu0: 12th Gen Intel(R) Core(TM) i5-1240P, 4390.58 MHz, 06-9a-03, patch > 0000042c > cpu0: > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,RDSEED,ADX,SMAP,CLFLUSHOPT,CLWB,PT,SHA,UMIP,PKU,WAITPKG,PKS,MD_CLEAR,IBT,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,IBRS_ALL,SKIP_L1DFL,MDS_NO,IF_PSCHANGE,TAA_NO,MISC_PKG_CT,ENERGY_FILT,DOITM,SBDR_SSDP_N,FBSDP_NO,PSDP_NO,RRSBA,OVERCLOCK,XSAVEOPT,XSAVEC,XGETBV1,XSAVES Machine with IBT. Here's a backtrace and disasm which suggests that it is related to this (i.e. missing an 'endbr64' landing pad at the program counter location) though there are other endbr64 in the disasm. Looks like this is coming from the coroutine code in kicad which uses a copy of libcontext https://gitlab.com/kicad/code/kicad/-/blob/master/include/tool/coroutine.h https://gitlab.com/kicad/code/kicad/-/blob/master/thirdparty/libcontext/libcontext.cpp I'll try a build with USE_NOBTCFI which should help, I'll commit that if it works. (That doesn't stop someone delving into the asm if they want). Core was generated by `kicad'. Program terminated with signal SIGILL, Illegal instruction. #0 0x00000078f0173cda in COROUTINE<int, TOOL_EVENT const&>::jumpIn(COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*) () [Current thread is 1 (process 437269)] (gdb) bt #0 0x00000078f0173cda in COROUTINE<int, TOOL_EVENT const&>::jumpIn(COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*) () #1 0x00000078f01748b1 in COROUTINE<int, TOOL_EVENT const&>::doCall(COROUTINE<int, TOOL_EVENT const&>::INVOCATION_ARGS*, TOOL_EVENT const&) () #2 0x00000078f0170b23 in COROUTINE<int, TOOL_EVENT const&>::Call(TOOL_EVENT const&) () #3 0x00000078f016d07b in TOOL_MANAGER::dispatchInternal(TOOL_EVENT&) () #4 0x00000078f016893b in TOOL_MANAGER::processEvent(TOOL_EVENT const&) () #5 0x00000078f016ee18 in TOOL_MANAGER::ProcessEvent(TOOL_EVENT const&) () #6 0x00000078eff77381 in wxEventFunctorFunctor<wxEventTypeTag<wxCommandEvent>, PANEL_KICAD_LAUNCHER::CreateLaunchers()::$_0::operator()(TOOL_ACTION const&, wxBitmap const&, wxString const&) const::{lambda(wxEvent&)#1}>::operator()(wxEvtHandler*, wxEvent&) () #7 0x0000007b046b1a22 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=0x7534b25c5230, event=...) at ./src/common/event.cpp:1431 #8 wxEvtHandler::SearchDynamicEventTable (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1901 #9 0x0000007b046b1686 in wxEvtHandler::TryHereOnly (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1624 #10 wxEvtHandler::TryBeforeAndHere (this=0x7bafaca300, event=...) at ./include/wx/event.h:4007 #11 wxEvtHandler::ProcessEventLocally (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1561 #12 0x0000007b046b14d6 in wxEvtHandler::ProcessEvent (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1534 #13 0x00000078effcdaa5 in wxAsyncMethodCallEventFunctor<BITMAP_BUTTON::OnLeftButtonUp(wxMouseEvent&)::$_0>::Execute() () #14 0x0000007b046b175f in wxEvtHandler::TryHereOnly (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1636 #15 wxEvtHandler::TryBeforeAndHere (this=0x7bafaca300, event=...) at ./include/wx/event.h:4007 #16 wxEvtHandler::ProcessEventLocally (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1561 #17 0x0000007b046b14d6 in wxEvtHandler::ProcessEvent (this=0x7bafaca300, event=...) at ./src/common/event.cpp:1534 #18 0x0000007b046b1006 in wxEvtHandler::ProcessPendingEvents (this=0x7bafaca300) at ./src/common/event.cpp:1398 #19 0x0000007b0455fd6a in wxAppConsoleBase::ProcessPendingEvents (this=0x7b90b17c80) at ./src/common/appbase.cpp:570 #20 0x0000007b68e07452 in wxApp::DoIdle (this=0x7b90b17c80) at ./src/gtk/app.cpp:151 #21 0x0000007b68e09275 in wxapp_idle_callback () at ./src/gtk/app.cpp:101 #22 0x0000007b40c643ef in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.4201.10 #23 0x0000007b40c64757 in g_main_context_iterate () from /usr/local/lib/libglib-2.0.so.4201.10 #24 0x0000007b40c64b6a in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.4201.10 #25 0x0000007bbb7ee1ec in gtk_main () from /usr/local/lib/libgtk-3.so.2201.0 #26 0x0000007b68e23bd5 in wxGUIEventLoop::DoRun (this=0x7afde71ec0) at ./src/gtk/evtloop.cpp:61 #27 0x0000007b04598da2 in wxEventLoopBase::Run (this=0x7afde71ec0) at ./src/common/evtloopcmn.cpp:87 #28 0x0000007b0455efef in wxAppConsoleBase::MainLoop (this=0x7b90b17c80) at ./src/common/appbase.cpp:381 #29 0x00000078eff8083a in APP_KICAD::OnRun() () #30 0x0000007b045de789 in wxEntry (argc=<optimized out>, argv=<optimized out>) at ./src/common/init.cpp:508 #31 0x00000078eff7fa4e in main () (gdb) disassemble Dump of assembler code for function _ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE: 0x00000078f0173af0 <+0>: endbr64 0x00000078f0173af4 <+4>: mov 0x1cf04d(%rip),%r11 # 0x78f0342b48 <__retguard_439> 0x00000078f0173afb <+11>: xor (%rsp),%r11 0x00000078f0173aff <+15>: push %rbp 0x00000078f0173b00 <+16>: mov %rsp,%rbp 0x00000078f0173b03 <+19>: push %r11 0x00000078f0173b05 <+21>: push %r15 0x00000078f0173b07 <+23>: push %r14 0x00000078f0173b09 <+25>: push %r13 0x00000078f0173b0b <+27>: push %r12 0x00000078f0173b0d <+29>: sub $0xc8,%rsp 0x00000078f0173b14 <+36>: mov %rsi,%r14 0x00000078f0173b17 <+39>: mov %rdi,%r15 0x00000078f0173b1a <+42>: mov 0x27de47(%rip),%r12 # 0x78f03f1968 0x00000078f0173b21 <+49>: mov (%r12),%rsi 0x00000078f0173b25 <+53>: lea -0x98(%rbp),%rdi 0x00000078f0173b2c <+60>: call 0x78f03320d0 0x00000078f0173b31 <+65>: mov 0x27de70(%rip),%r13 # 0x78f03f19a8 0x00000078f0173b38 <+72>: cmpq $0x0,0x0(%r13) 0x00000078f0173b3d <+77>: je 0x78f0173b4a <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+90> 0x00000078f0173b3f <+79>: call 0x78f0333330 0x00000078f0173b44 <+84>: cmp 0x0(%r13),%rax 0x00000078f0173b48 <+88>: jne 0x78f0173b6c <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+124> 0x00000078f0173b4a <+90>: mov 0x27de5f(%rip),%rax # 0x78f03f19b0 0x00000078f0173b51 <+97>: cmpb $0x0,(%rax) 0x00000078f0173b54 <+100>: je 0x78f0173b75 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+133> 0x00000078f0173b56 <+102>: lea -0x98(%rbp),%rdi 0x00000078f0173b5d <+109>: call 0x78f0333590 0x00000078f0173b62 <+114>: cmp $0x7,%rax 0x00000078f0173b66 <+118>: setae %r13b 0x00000078f0173b6a <+122>: jmp 0x78f0173b78 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+136> 0x00000078f0173b6c <+124>: call 0x78f03335b0 0x00000078f0173b71 <+129>: test %al,%al 0x00000078f0173b73 <+131>: jne 0x78f0173b56 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+102> 0x00000078f0173b75 <+133>: xor %r13d,%r13d 0x00000078f0173b78 <+136>: mov -0x80(%rbp),%rdi 0x00000078f0173b7c <+140>: call 0x78f0332050 0x00000078f0173b81 <+145>: testb $0x1,-0x98(%rbp) 0x00000078f0173b88 <+152>: je 0x78f0173b96 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+166> 0x00000078f0173b8a <+154>: mov -0x88(%rbp),%rdi 0x00000078f0173b91 <+161>: call 0x78f0332070 0x00000078f0173b96 <+166>: test %r13b,%r13b 0x00000078f0173b99 <+169>: je 0x78f0173cc2 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+466> 0x00000078f0173b9f <+175>: mov (%r12),%rax 0x00000078f0173ba3 <+179>: movq $0x7,-0x98(%rbp) 0x00000078f0173bae <+190>: lea -0x4850d3(%rip),%rcx # 0x78efceeae2 0x00000078f0173bb5 <+197>: mov %rcx,-0x90(%rbp) 0x00000078f0173bbc <+204>: lea -0x30b790(%rip),%rcx # 0x78efe68433 0x00000078f0173bc3 <+211>: mov %rcx,-0x80(%rbp) 0x00000078f0173bc7 <+215>: movl $0x1be,-0x88(%rbp) 0x00000078f0173bd1 <+225>: mov %rax,-0x78(%rbp) 0x00000078f0173bd5 <+229>: xorps %xmm0,%xmm0 0x00000078f0173bd8 <+232>: movups %xmm0,-0x70(%rbp) 0x00000078f0173bdc <+236>: call 0x78f0333330 0x00000078f0173be1 <+241>: mov %rax,-0x60(%rbp) 0x00000078f0173be5 <+245>: xorps %xmm0,%xmm0 0x00000078f0173be8 <+248>: movups %xmm0,-0x58(%rbp) 0x00000078f0173bec <+252>: movups %xmm0,-0x48(%rbp) 0x00000078f0173bf0 <+256>: movups %xmm0,-0x38(%rbp) 0x00000078f0173bf4 <+260>: mov 0x27e825(%rip),%rax # 0x78f03f2420 0x00000078f0173bfb <+267>: mov (%rax),%rax 0x00000078f0173bfe <+270>: test %rax,%rax 0x00000078f0173c01 <+273>: lea -0x2d8d74(%rip),%rsi # 0x78efe9ae94 0x00000078f0173c08 <+280>: cmovne %rax,%rsi 0x00000078f0173c0c <+284>: lea -0xc0(%rbp),%rdi 0x00000078f0173c13 <+291>: call 0x78eff725a0 <_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEC2IDnEEPKw> 0x00000078f0173c18 <+296>: xorps %xmm0,%xmm0 0x00000078f0173c1b <+299>: movups %xmm0,-0xa8(%rbp) 0x00000078f0173c22 <+306>: lea -0x2bbca5(%rip),%rsi # 0x78efeb7f84 0x00000078f0173c29 <+313>: lea -0xe8(%rbp),%rdi 0x00000078f0173c30 <+320>: call 0x78eff7fc50 <_ZN14wxFormatStringC2EPKw> 0x00000078f0173c35 <+325>: lea -0xe8(%rbp),%rdi 0x00000078f0173c3c <+332>: call 0x78f0333050 0x00000078f0173c41 <+337>: lea -0x98(%rbp),%rdi 0x00000078f0173c48 <+344>: lea -0xc0(%rbp),%rsi 0x00000078f0173c4f <+351>: mov %rax,%rdx 0x00000078f0173c52 <+354>: xor %eax,%eax 0x00000078f0173c54 <+356>: call 0x78effafdc0 <_ZN8wxLogger10DoLogTraceERK8wxStringPKwz> 0x00000078f0173c59 <+361>: lea -0xd8(%rbp),%rdi 0x00000078f0173c60 <+368>: call 0x78eff72680 <_ZN22wxScopedCharTypeBufferIwED2Ev> 0x00000078f0173c65 <+373>: lea -0xe0(%rbp),%rdi 0x00000078f0173c6c <+380>: call 0x78eff79860 <_ZN22wxScopedCharTypeBufferIcED2Ev> 0x00000078f0173c71 <+385>: lea -0xe8(%rbp),%rdi 0x00000078f0173c78 <+392>: call 0x78eff72680 <_ZN22wxScopedCharTypeBufferIwED2Ev> 0x00000078f0173c7d <+397>: mov -0xa8(%rbp),%rdi 0x00000078f0173c84 <+404>: call 0x78f0332050 0x00000078f0173c89 <+409>: testb $0x1,-0xc0(%rbp) 0x00000078f0173c90 <+416>: je 0x78f0173c9e <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+430> 0x00000078f0173c92 <+418>: mov -0xb0(%rbp),%rdi 0x00000078f0173c99 <+425>: call 0x78f0332070 0x00000078f0173c9e <+430>: mov -0x38(%rbp),%rdi 0x00000078f0173ca2 <+434>: call 0x78f0332050 0x00000078f0173ca7 <+439>: testb $0x1,-0x50(%rbp) 0x00000078f0173cab <+443>: je 0x78f0173cb6 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+454> 0x00000078f0173cad <+445>: mov -0x40(%rbp),%rdi 0x00000078f0173cb1 <+449>: call 0x78f0332070 0x00000078f0173cb6 <+454>: lea -0x90(%rbp),%rdi 0x00000078f0173cbd <+461>: call 0x78eff80260 <_ZN15wxLogRecordInfoD2Ev> 0x00000078f0173cc2 <+466>: mov 0x60(%r15),%rsi 0x00000078f0173cc6 <+470>: add $0x50,%r15 0x00000078f0173cca <+474>: mov %r15,%rdi 0x00000078f0173ccd <+477>: mov %r14,%rdx 0x00000078f0173cd0 <+480>: mov $0x1,%ecx 0x00000078f0173cd5 <+485>: call 0x78f0174a70 <jump_fcontext> => 0x00000078f0173cda <+490>: add $0xc8,%rsp 0x00000078f0173ce1 <+497>: pop %r12 0x00000078f0173ce3 <+499>: pop %r13 0x00000078f0173ce5 <+501>: pop %r14 0x00000078f0173ce7 <+503>: pop %r15 0x00000078f0173ce9 <+505>: pop %r11 0x00000078f0173ceb <+507>: pop %rbp 0x00000078f0173cec <+508>: xor (%rsp),%r11 0x00000078f0173cf0 <+512>: cmp 0x1cee51(%rip),%r11 # 0x78f0342b48 <__retguard_439> 0x00000078f0173cf7 <+519>: je 0x78f0173cff <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+527> 0x00000078f0173cf9 <+521>: int3 0x00000078f0173cfa <+522>: int3 0x00000078f0173cfb <+523>: int3 0x00000078f0173cfc <+524>: int3 0x00000078f0173cfd <+525>: int3 0x00000078f0173cfe <+526>: int3 0x00000078f0173cff <+527>: ret 0x00000078f0173d00 <+528>: endbr64 0x00000078f0173d04 <+532>: mov %rax,%rdi 0x00000078f0173d07 <+535>: call 0x78eff70fb0 <__clang_call_terminate> 0x00000078f0173d0c <+540>: endbr64 0x00000078f0173d10 <+544>: mov %rax,%rdi 0x00000078f0173d13 <+547>: call 0x78eff70fb0 <__clang_call_terminate> 0x00000078f0173d18 <+552>: endbr64 0x00000078f0173d1c <+556>: mov %rax,%r14 0x00000078f0173d1f <+559>: jmp 0x78f0173d55 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+613> 0x00000078f0173d21 <+561>: endbr64 0x00000078f0173d25 <+565>: mov %rax,%r14 0x00000078f0173d28 <+568>: jmp 0x78f0173d76 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+646> 0x00000078f0173d2a <+570>: endbr64 0x00000078f0173d2e <+574>: mov %rax,%r14 0x00000078f0173d31 <+577>: lea -0xd8(%rbp),%rdi 0x00000078f0173d38 <+584>: call 0x78eff72680 <_ZN22wxScopedCharTypeBufferIwED2Ev> 0x00000078f0173d3d <+589>: lea -0xe0(%rbp),%rdi 0x00000078f0173d44 <+596>: call 0x78eff79860 <_ZN22wxScopedCharTypeBufferIcED2Ev> 0x00000078f0173d49 <+601>: lea -0xe8(%rbp),%rdi 0x00000078f0173d50 <+608>: call 0x78eff72680 <_ZN22wxScopedCharTypeBufferIwED2Ev> 0x00000078f0173d55 <+613>: mov -0xa8(%rbp),%rdi 0x00000078f0173d5c <+620>: call 0x78f0332050 0x00000078f0173d61 <+625>: testb $0x1,-0xc0(%rbp) 0x00000078f0173d68 <+632>: je 0x78f0173d76 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+646> 0x00000078f0173d6a <+634>: mov -0xb0(%rbp),%rdi 0x00000078f0173d71 <+641>: call 0x78f0332070 0x00000078f0173d76 <+646>: mov -0x38(%rbp),%rdi 0x00000078f0173d7a <+650>: call 0x78f0332050 0x00000078f0173d7f <+655>: testb $0x1,-0x50(%rbp) 0x00000078f0173d83 <+659>: je 0x78f0173d8e <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+670> 0x00000078f0173d85 <+661>: mov -0x40(%rbp),%rdi 0x00000078f0173d89 <+665>: call 0x78f0332070 0x00000078f0173d8e <+670>: lea -0x90(%rbp),%rdi 0x00000078f0173d95 <+677>: call 0x78eff80260 <_ZN15wxLogRecordInfoD2Ev> 0x00000078f0173d9a <+682>: jmp 0x78f0173dd9 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+745> 0x00000078f0173d9c <+684>: endbr64 0x00000078f0173da0 <+688>: mov %rax,%rdi 0x00000078f0173da3 <+691>: call 0x78eff70fb0 <__clang_call_terminate> 0x00000078f0173da8 <+696>: endbr64 0x00000078f0173dac <+700>: mov %rax,%rdi 0x00000078f0173daf <+703>: call 0x78eff70fb0 <__clang_call_terminate> 0x00000078f0173db4 <+708>: endbr64 0x00000078f0173db8 <+712>: mov %rax,%rdi 0x00000078f0173dbb <+715>: call 0x78eff70fb0 <__clang_call_terminate> 0x00000078f0173dc0 <+720>: endbr64 0x00000078f0173dc4 <+724>: mov %rax,%r14 0x00000078f0173dc7 <+727>: mov -0x80(%rbp),%rdi 0x00000078f0173dcb <+731>: call 0x78f0332050 0x00000078f0173dd0 <+736>: testb $0x1,-0x98(%rbp) 0x00000078f0173dd7 <+743>: jne 0x78f0173de1 <_ZN9COROUTINEIiRK10TOOL_EVENTE6jumpInEPNS3_15INVOCATION_ARGSE+753> 0x00000078f0173dd9 <+745>: mov %r14,%rdi 0x00000078f0173ddc <+748>: call 0x78f0332310 0x00000078f0173de1 <+753>: mov -0x88(%rbp),%rdi 0x00000078f0173de8 <+760>: call 0x78f0332070 0x00000078f0173ded <+765>: mov %r14,%rdi 0x00000078f0173df0 <+768>: call 0x78f0332310 0x00000078f0173df5 <+773>: endbr64 0x00000078f0173df9 <+777>: mov %rax,%rdi 0x00000078f0173dfc <+780>: call 0x78eff70fb0 <__clang_call_terminate> End of assembler dump.