<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - telegram-desktop 2.8.1 crashes on startup with an Illegal Instruction if built with clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=50914">50914</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>telegram-desktop 2.8.1 crashes on startup with an Illegal Instruction if built with clang
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bero@lindev.ch
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Unfortunately there's no small test case for this yet.

Building telegram-desktop 2.8.1 from

<a href="https://github.com/telegramdesktop/tdesktop/releases/download/v2.8.1/tdesktop-2.8.1-full.tar.gz">https://github.com/telegramdesktop/tdesktop/releases/download/v2.8.1/tdesktop-2.8.1-full.tar.gz</a>

with clang 12.0 (and 12.0.1-rc) results in a crash on startup with an illegal
instruction error.

Disassembly shows an ud2 call that looks like it's part of the stack smashing
protector, but there's no SSP error shown and the code works perfectly when
built with gcc (with SSP enabled). It looks like the actual call is happening
in libGLdispatch constructors (which is odd, libGLdispatch happens to be used
in a lot of other applications without triggering an error like this).

(gdb) r
Starting program: /usr/bin/telegram-desktop 
Program received signal SIGILL, Illegal instruction.
0x00000000045967fc in calloc ()
(gdb) bt
#0  0x00000000045967fc in calloc ()
#1  0x00007ffff26f9b43 in _dlerror_run () at /lib64/libdl.so.2
#2  0x00007ffff26f9459 in dlsym () at /lib64/libdl.so.2
#3  0x00007fffeeb7f5b9 in glvndSetupPthreads () at
../src/util/glvnd_pthread.c:443
#4  __glDispatchOnLoadInit () at ../src/GLdispatch/GLdispatch.c:169
#5  0x00007ffff7fdcc8e in call_init () at /lib64/ld-linux-x86-64.so.2
#6  0x00007ffff7fdcd6c in _dl_init () at /lib64/ld-linux-x86-64.so.2
#7  0x00007ffff7fcd08a in  () at /lib64/ld-linux-x86-64.so.2
#8  0x0000000000000001 in  ()
#9  0x00007fffffffd744 in  ()
#10 0x0000000000000000 in  ()
(gdb) disassemble
Dump of assembler code for function calloc:
   0x00000000045967b0 <+0>:     push   %rax
   0x00000000045967b1 <+1>:     mov    %fs:0x28,%rax
   0x00000000045967ba <+10>:    mov    %rax,(%rsp)
   0x00000000045967be <+14>:    test   %rsi,%rsi
   0x00000000045967c1 <+17>:    je     0x45967d8 <calloc+40>
   0x00000000045967c3 <+19>:    mov    %rsi,%rax
   0x00000000045967c6 <+22>:    mul    %rdi
   0x00000000045967c9 <+25>:    jno    0x45967d8 <calloc+40>
   0x00000000045967cb <+27>:    call   0x459ef30 <__errno_location@plt>
   0x00000000045967d0 <+32>:    movl   $0xc,(%rax)
   0x00000000045967d6 <+38>:    jmp    0x45967e9 <calloc+57>
   0x00000000045967d8 <+40>:    imul   %rdi,%rsi
   0x00000000045967dc <+44>:    mov    %rsi,%rdi
   0x00000000045967df <+47>:    call   0x4595a70 <malloc>
   0x00000000045967e4 <+52>:    test   %rax,%rax
   0x00000000045967e7 <+55>:    jne    0x45967fc <calloc+76>
   0x00000000045967e9 <+57>:    mov    %fs:0x28,%rax
   0x00000000045967f2 <+66>:    cmp    (%rsp),%rax
   0x00000000045967f6 <+70>:    jne    0x45967fe <calloc+78>
   0x00000000045967f8 <+72>:    xor    %eax,%eax
   0x00000000045967fa <+74>:    pop    %rcx
   0x00000000045967fb <+75>:    ret    
=> 0x00000000045967fc <+76>:    ud2    
   0x00000000045967fe <+78>:    call   0x4597630 <__stack_chk_fail@plt>
End of assembler dump.


This happens regardless of whether or not telegram-desktop was built with
-fstack-protector (__stack_chk_fail references come from libraries being linked
in that were built with -fstack-protector-all).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>