> Date: Mon, 23 Jun 2025 18:25:17 +0200
> From: Moritz Buhl <[email protected]>
>
> Dear bugs@,
>
> for about two weeks I am having trouble running x11/alacritty on
> my Apple MacBook Air M2 from 2022.
> I suspect there is a missing BTI instruction in libmesas jit.
Yup!
So the big question is whether it is the Mesa update or the LLVM
update that broke it. The LLVM update was committed 12 days ago, so
"about two weeks" could mean it is or it isn't :(.
> m2$ dmesg | grep ^OpenBSD
> OpenBSD 7.7-current (GENERIC.MP) #11: Thu Jun 19 06:16:05 MDT 2025
> m2$ pkg_info alacritty | head -1
> Information for inst:alacritty-0.15.1
> m2$ alacritty
> Illegal instruction (core dumped)
> m2$ lastcomm | head -2
> ...
> alacritty[36377] -DXB mbuhl
> ttyp5 1.12 secs Mon Jun 23 18:15 (0:00:01.11)
>
>
> tb told me how to skip stripping libgallium so the stack trace is
> more detailed.
> Here are the last few instructions before the crash:
>
> ...
>
> (gdb) p *fpme->current_variant->jit_func
> $5 = {_Bool (struct draw_vs_jit_context *, const struct lp_jit_resources *,
> struct vertex_header *, const struct draw_vertex_buffer *, unsigned int,
> unsigned int,
> unsigned int, struct pipe_vertex_buffer *, unsigned int, unsigned int,
> unsigned int, const unsigned int *, unsigned int, unsigned int)} 0xe452eb000
> (gdb) p fpme->current_variant->jit_func
> $6 = (draw_jit_vert_func) 0xe452eb000
> (gdb) disassemble draw_jit_vert_func
> Attempt to use a type name as an expression
> (gdb) disassemble 0xe452eb000
> No function contains specified address.
> (gdb) x/200i 0xe452eb000
> 0xe452eb000: stp d15, d14, [sp, #-160]!
> 0xe452eb004: sub x9, sp, #0x80
> 0xe452eb008: stp d13, d12, [sp, #16]
> 0xe452eb00c: stp d11, d10, [sp, #32]
> 0xe452eb010: stp d9, d8, [sp, #48]
> 0xe452eb014: stp x29, x30, [sp, #64]
> 0xe452eb018: add x29, sp, #0x40
> 0xe452eb01c: stp x28, x27, [sp, #80]
> 0xe452eb020: stp x26, x25, [sp, #96]
> 0xe452eb024: stp x24, x23, [sp, #112]
> 0xe452eb028: stp x22, x21, [sp, #128]
> 0xe452eb02c: stp x20, x19, [sp, #144]
> 0xe452eb030: and sp, x9, #0xffffffffffffffe0
> 0xe452eb034: ldr w9, [x3, #56]
> 0xe452eb038: ldr w10, [x3, #72]
> 0xe452eb03c: dup v0.4s, w5
> 0xe452eb040: stp x0, x2, [sp, #80]
> 0xe452eb044: ldr w18, [x29, #96]
> 0xe452eb048: movi v1.2d, #0x0
> 0xe452eb04c: subs w12, w9, #0x3
> 0xe452eb050: ldrsw x9, [x7, #68]
> 0xe452eb054: ldr w0, [x29, #112]
> 0xe452eb058: cset w13, cc // cc = lo, ul, last
> 0xe452eb05c: subs w10, w10, #0x3
> 0xe452eb060: ldrsw x11, [x7, #52]
> 0xe452eb064: cset w14, cc // cc = lo, ul, last
> 0xe452eb068: subs w10, w10, w9
> 0xe452eb06c: ldrsw x2, [x7, #36]
> 0xe452eb070: str w10, [sp, #76]
> 0xe452eb074: csinc w10, w14, wzr, cs // cs = hs, nlast
> 0xe452eb078: cmn w0, w18
> 0xe452eb07c: csinc w20, w10, wzr, cc // cc = lo, ul, last
> 0xe452eb080: subs w10, w12, w11
> 0xe452eb084: ldr w15, [x3, #24]
> 0xe452eb088: stp w10, w4, [sp, #68]
> 0xe452eb08c: ldr w10, [x3, #40]
> 0xe452eb090: csinc w12, w13, wzr, cs // cs = hs, nlast
> 0xe452eb094: cmn w0, w18
> 0xe452eb098: ldrsw x13, [x7, #20]
> 0xe452eb09c: ldr w17, [x3, #8]
> 0xe452eb0a0: csinc w12, w12, wzr, cc // cc = lo, ul, last
> 0xe452eb0a4: subs w10, w10, #0xf
> 0xe452eb0a8: ldr x6, [x3]
> 0xe452eb0ac: cset w14, cc // cc = lo, ul, last
> 0xe452eb0b0: subs w10, w10, w2
> 0xe452eb0b4: sub w4, w4, #0x1
> 0xe452eb0b8: csinc w14, w14, wzr, cs // cs = hs, nlast
> 0xe452eb0bc: cmn w0, w18
> 0xe452eb0c0: str w10, [sp, #64]
> 0xe452eb0c4: csinc w14, w14, wzr, cc // cc = lo, ul, last
> 0xe452eb0c8: subs w15, w15, #0x7
> 0xe452eb0cc: ldrsw x10, [x7, #4]
> 0xe452eb0d0: cset w16, cc // cc = lo, ul, last
> 0xe452eb0d4: subs w15, w15, w13
> 0xe452eb0d8: movi v18.2d, #0xff000000ff
> 0xe452eb0dc: csinc w16, w16, wzr, cs // cs = hs, nlast
> 0xe452eb0e0: cmn w0, w18
> 0xe452eb0e4: add x6, x6, x10
> 0xe452eb0e8: csinc w16, w16, wzr, cc // cc = lo, ul, last
> 0xe452eb0ec: subs w17, w17, #0x3
> 0xe452eb0f0: movi v4.4s, #0x2
> 0xe452eb0f4: cset w5, cc // cc = lo, ul, last
> 0xe452eb0f8: subs w17, w17, w10
> 0xe452eb0fc: ldr x10, [x3, #16]
> 0xe452eb100: csinc w5, w5, wzr, cs // cs = hs, nlast
> --Type <RET> for more, q to quit, c to continue without paging--
> 0xe452eb104: adds w18, w0, w18
> 0xe452eb108: ldr x0, [x3, #32]
> 0xe452eb10c: csinc w5, w5, wzr, cc // cc = lo, ul, last
> 0xe452eb110: add x10, x10, x13
> 0xe452eb114: ldr x13, [x3, #48]
> 0xe452eb118: add x0, x0, x2
> 0xe452eb11c: cmp w5, #0x0
> 0xe452eb120: add x2, sp, #0x60
> 0xe452eb124: csel x6, x2, x6, ne // ne = any
> 0xe452eb128: cmp w16, #0x0
> 0xe452eb12c: fmov v5.4s, #1.000000000000000000e+00
> 0xe452eb130: csel x7, x2, x10, ne // ne = any
> 0xe452eb134: cmp w14, #0x0
> 0xe452eb138: ldr x10, [x3, #64]
> 0xe452eb13c: movi v7.4s, #0x1
> 0xe452eb140: movi v20.2d, #0x0
> 0xe452eb144: add x11, x13, x11
> 0xe452eb148: csel x3, x2, x0, ne // ne = any
> 0xe452eb14c: cmp w12, #0x0
> 0xe452eb150: dup v2.4s, w4
> 0xe452eb154: str w15, [sp, #60]
> 0xe452eb158: mov w15, w12
> 0xe452eb15c: csel x19, x2, x11, ne // ne = any
> 0xe452eb160: add x9, x10, x9
> 0xe452eb164: mov w12, w20
> 0xe452eb168: cmp w20, #0x0
> 0xe452eb16c: ldr x20, [x29, #120]
> 0xe452eb170: mov w8, wzr
> 0xe452eb174: csel x21, x2, x9, ne // ne = any
> 0xe452eb178: mov w23, #0x437f0000 // #1132396544
> 0xe452eb17c: mov x24, #0x3f80000000000000 //
> #4575657221408423936
> 0xe452eb180: str q0, [sp, #32]
> 0xe452eb184: b 0xe452eb3cc
> 0xe452eb188: dup v3.4s, v28.s[1]
> 0xe452eb18c: fmul v6.4s, v21.4s, v16.s[1]
> 0xe452eb190: fadd v16.4s, v19.4s, v28.4s
> 0xe452eb194: fmul v18.4s, v13.4s, v28.s[2]
> 0xe452eb198: fmul v19.4s, v14.4s, v28.s[3]
> 0xe452eb19c: shl v0.4s, v0.4s, #31
>
> ...
>
> (gdb) s
> 557
> &fpme->llvm->jit_resources[PIPE_SHADER_VERTEX],
> (gdb) bt
> #0 llvm_pipeline_generic (middle=0xe75ff16e0, fetch_info=0x669785e898,
> in_prim_info=0x669785e868)
> at
> /usr/xenocara/lib/mesa/mk/libgallium/../../src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:557
> #1 0x0000000e24714748 [PAC] in llvm_middle_end_run (middle=0xe3e6ef018,
> fetch_elts=<optimized out>, fetch_count=<optimized out>,
> draw_elts=0xe54117530, draw_count=6,
> prim_flags=6) at
> /usr/xenocara/lib/mesa/mk/libgallium/../../src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:780
> #2 0x0000000e2472e430 [PAC] in vsplit_run_uint32 (frontend=0xe334ed000,
> start=0, count=<optimized out>)
> at
> /usr/xenocara/lib/mesa/mk/libgallium/../../src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h:173
> #3 0x0000000e24712c00 [PAC] in draw_pt_arrays (draw=0xe54117000,
> prim=MESA_PRIM_TRIANGLES, index_bias_varies=<optimized out>,
> draw_info=0x669785eb6c, num_draws=1)
> at
> /usr/xenocara/lib/mesa/mk/libgallium/../../src/gallium/auxiliary/draw/draw_pt.c:161
> #4 0x0000000e24712754 [PAC] in draw_instances (draw=0xe54117000,
> drawid_offset=0, info=0x669785eb78, draws=0x669785eb6c, num_draws=1)
> at
> /usr/xenocara/lib/mesa/mk/libgallium/../../src/gallium/auxiliary/draw/draw_pt.c:477
> #5 0x0000000e24712664 [PAC] in draw_vbo (draw=0xe54117000,
> info=0x669785eb78, drawid_offset=0, indirect=<optimized out>,
> draws=<optimized out>, num_draws=1,
> patch_vertices=<optimized out>) at
> /usr/xenocara/lib/mesa/mk/libgallium/../../src/gallium/auxiliary/draw/draw_pt.c:628
> #6 0x0000000e24d6e94c [PAC] in llvmpipe_draw_vbo (pipe=0xd8e9b0000,
> info=0x669785eb78, drawid_offset=0, indirect=0x0, draws=0x669785eb6c,
> num_draws=1)
> at
> /usr/xenocara/lib/mesa/mk/libllvmpipe/../../src/gallium/drivers/llvmpipe/lp_draw_arrays.c:150
> #7 0x0000000e241828d0 [PAC] in _mesa_validated_drawrangeelements
> (ctx=<optimized out>, index_bo=<optimized out>, mode=<optimized out>,
> index_bounds_valid=<optimized out>, start=<optimized out>,
> end=4294967295, count=<optimized out>, type=<optimized out>,
> indices=<optimized out>,
> basevertex=<optimized out>, numInstances=<optimized out>,
> baseInstance=<optimized out>) at
> /usr/xenocara/lib/mesa/mk/libmesa/../../src/mesa/main/draw.c:1705
> #8 0x0000000e24182e64 [PAC] in
> _mesa_DrawElementsInstancedBaseVertexBaseInstance (mode=4, count=6,
> type=5125, indices=0x0, numInstances=4, basevertex=0,
> baseInstance=0) at
> /usr/xenocara/lib/mesa/mk/libmesa/../../src/mesa/main/draw.c:1923
> #9 0x0000000978a55b40 [PAC] in alacritty::display::Display::draw ()
> #10 0x000000097897bac0 [PAC] in
> winit::event_loop::EventLoop<T>::run_app::{{closure}} ()
> #11 0x00000009789a4d28 [PAC] in alacritty::alacritty ()
> #12 0x00000009789a2c78 [PAC] in alacritty::main ()
> #13 0x0000000978958c80 [PAC] in
> std::sys::backtrace::__rust_begin_short_backtrace ()
> #14 0x00000009789c0ab4 [PAC] in std::rt::lang_start::{{closure}} ()
> #15 0x0000000978ddc040 [PAC] in std::panicking::try::do_call ()
> #16 0x0000000978ddc9dc [PAC] in __rust_try.llvm.383985035128269557 ()
> #17 0x0000000978ddc150 in std::panicking::try::do_call ()
> #18 0x0000000978ddc9dc [PAC] in __rust_try.llvm.383985035128269557 ()
> #19 0x0000000978dd9120 in std::rt::lang_start_internal ()
> #20 0x00000009789c0a88 [PAC] in std::rt::lang_start ()
> #21 0x00000009789ad634 [PAC] in main ()
> (gdb) s
> 566 draw->start_instance,
> (gdb)
> 568 draw->pt.user.drawid,
> (gdb)
> 569 draw->pt.user.viewid);
> (gdb)
> 556 clipped =
> fpme->current_variant->jit_func(&fpme->llvm->vs_jit_context,
> (gdb) s
> 0x0000000e452eb000 in ?? ()
> (gdb) bt
> #0 0x0000000e452eb000 in ?? ()
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
> (gdb) n
> Cannot find bounds of current function
> (gdb) si
>
> Thread 1 received signal SIGILL, Illegal instruction.
> 0x0000000e452eb000 in ?? ()
>
> I am not sure how to continue with this.
>
> mbuhl
>
>