pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: firefox-112



Found some more interesting things with maya@:

1. In modular X from pkgsrc, Mesa just doesn't do any static TLS --
   everything is done with C11 tss(3).

2. In xsrc, our patched libGL.so and libglapi.so both define
   _glapi_tls_Context.  This sounds like a recipe for disaster!

3. Setting LD_PRELOAD doesn't change the tlsoffset printed by
   ld.elf_so with LD_DEBUG=1 for libGL.so and libglapi.so.  But it
   _does_ change the offset loaded by _mesa_GetError in

 6a0:   48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 6a7 <_mesa_GetError+0x10>                
                        6a3: R_X86_64_GOTTPOFF  _glapi_tls_Context-0x4

   I suspect it may be by luck that we get the right offset with
   LD_PRELOAD and the wrong one without, and there may be other parts
   of the address space that are still getting the wrong one.

4. It turns out our xsrc Mesa had an old TLS patch from tnn@ in pkgsrc
   Mesa, dating to 2019, which introduced the definition of
   _glapi_tls_Context into libGL.so:

      commit e81a0f50af920255e5c0c0df06ae2d08d5cdc554
      Author: maya <maya%NetBSD.org@localhost>
      Date:   Tue Apr 9 14:14:59 2019 +0000

          Add workaround for non-zero initialized initial-exec TLS variables.
          NetBSD doesn't support these with dlopen.

          Ref:
          https://bugs.freedesktop.org/show_bug.cgi?id=35268
          https://mail-index.netbsd.org/pkgsrc-users/2015/09/11/msg022180.html
          http://gnats.netbsd.org/50277

          Fixes dlopen of libGL reported by prlw1 on current users.
          From tnn, via pkgsrc/graphics/MesaLib*.

   That patch was since updated by tnn@ in 2020:

      commit 0e33e24256c28aed530eb25e07d1c2f23bdf1e12
      Author: tnn <tnn%pkgsrc.org@localhost>   
      Date:   Wed Feb 19 21:03:41 2020 +0000

          MesaLib: fix issues in TLS dispatch code on NetBSD/amd64. Bump.

          - workaround for toolchain/50277 had bitrotted after meson switch
          - make tls dispatch stub template behave correct (with input from joerg@)
          - double alignment of stubs to accommodate slightly larger code size

          Fixes among other things Xorg crash in glamor_egl_init().

   But we have not applied the updated patch to xsrc.

So we need to figure out:

(a) why pkgsrc Mesa has TLS patches but is using tss(3) instead
    (something about GLX_USE_TLS vs USE_ELF_TLS?),

(b) whether pkgsrc Mesa's TLS patches work if TLS is enabled, and

(c) how to fix Mesa properly in xsrc -- whether by disabling
    GLX_USE_TLS or by fixing toolchain/50277 properly.


Home | Main Index | Thread Index | Old Index