Bug 99591 - Segmentation fault when running vulkaninfo with RADV Radeon Vulkan driver
Summary: Segmentation fault when running vulkaninfo with RADV Radeon Vulkan driver
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: 13.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-29 14:23 UTC by Jure Repinc
Modified: 2017-09-09 13:04 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Jure Repinc 2017-01-29 14:23:29 UTC
This happens when using Mesa 13.0.3 and vulkaninfo 1.0.32 on Radeon RX480. If I run vulkan info through gdb I get this backtrace, where radeon vulkan driver is mentioned last.:

gdb vulkaninfo
GNU gdb (GDB; openSUSE Tumbleweed) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vulkaninfo...Reading symbols from /usr/lib/debug/usr/bin/vulkaninfo.debug...done.
done.
(gdb) start
Temporary breakpoint 1 at 0x4015e0: file /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/demos/vulkaninfo.c, line 1406.
Starting program: /usr/bin/vulkaninfo 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffddf8) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/demos/vulkaninfo.c:1406
1406    /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/demos/vulkaninfo.c: Datoteka ali imenik s tem imenom ne obstaja.
(gdb) c
Continuing.
===========
VULKAN INFO
===========

Vulkan API Version: 1.0.32

INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_image.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_image.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /home/jlp/.local/share/vulkan/implicit_layer.d/steamoverlay_i386.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /home/jlp/.local/share/vulkan/implicit_layer.d/steamoverlay_x86_64.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/icd.d/intel_icd.x86_64.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json, version "1.0.0"

Program received signal SIGSEGV, Segmentation fault.
0x000000000001c266 in ?? ()
(gdb) where
#0  0x000000000001c266 in ?? ()
#1  0x00007fffed78efa2 in radv_lookup_entrypoint (name=<optimized out>) at radv_entrypoints.c:857
#2  0x00007ffff7654a3d in loader_scanned_icd_add (api_version=4194307, filename=0x7fffffff5c70 "/usr/lib64/libvulkan_radeon.so", icd_libs=0x66cbe0, inst=0x66cb70)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/loader/loader.c:1542
#3  loader_icd_scan (inst=inst@entry=0x66cb70, icds=icds@entry=0x66cbe0) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/loader/loader.c:3045
#4  0x00007ffff76586db in vkCreateInstance (pCreateInfo=pCreateInfo@entry=0x7fffffff6210, pAllocator=pAllocator@entry=0x0, pInstance=pInstance@entry=0x7fffffff6260)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/loader/trampoline.c:367
#5  0x0000000000401968 in app_create_instance (inst=0x7fffffff6260) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/demos/vulkaninfo.c:678
#6  main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.32.g28/demos/vulkaninfo.c:1428



dmesg contains a lne like this
vulkaninfo[17284]: segfault at 1c266 ip 000000000001c266 sp 00007fffb83cdfb8 error 14 in vulkaninfo[400000+9000]
Comment 1 Vedran Miletić 2017-01-30 11:42:21 UTC
Can you try newer vulkaninfo? Some segfaults were fixed recently.
Comment 2 Jure Repinc 2017-01-30 19:26:52 UTC
Will try as soon as the up to date version of the package gets into openSUSE Thumbleweed. Bug reported here: https://bugzilla.opensuse.org/show_bug.cgi?id=1022156
Comment 3 Petr Cervinka 2017-02-05 18:54:41 UTC
(In reply to Vedran Miletić from comment #1)
> Can you try newer vulkaninfo? Some segfaults were fixed recently.

I tested it on openSUSE with vulkan info 1.0.39.1, but the results are the same:
Type "apropos word" to search for commands related to "word"...
Reading symbols from vulkaninfo...Reading symbols from /usr/lib/debug/usr/bin/vulkaninfo.debug...done.
done.
[New LWP 3616]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `vulkaninfo'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000000001c266 in ?? ()
(gdb) bt
#0  0x000000000001c266 in ?? ()
#1  0x00007fe83d00cfa2 in radv_lookup_entrypoint (name=<optimized out>) at radv_entrypoints.c:857
#2  0x00007fe8455bf346 in loader_scanned_icd_add (api_version=4194307, filename=0x7ffd38113840 "/usr/lib64/libvulkan_radeon.so", icd_tramp_list=0xf2aa50, inst=0xf2aa10)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.39.1/loader/loader.c:1765
#3  loader_icd_scan (inst=inst@entry=0xf2aa10, icd_tramp_list=icd_tramp_list@entry=0xf2aa50) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.39.1/loader/loader.c:3430
#4  0x00007fe8455c4e9e in vkCreateInstance (pCreateInfo=pCreateInfo@entry=0x7ffd38113df0, pAllocator=pAllocator@entry=0x0, pInstance=pInstance@entry=0x7ffd38113e40)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.39.1/loader/trampoline.c:368
#5  0x0000000000401797 in AppCreateInstance (inst=0x7ffd38113e40) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.39.1/demos/vulkaninfo.c:695
#6  main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.39.1/demos/vulkaninfo.c:1476
(gdb) quit
Comment 4 Jure Repinc 2017-03-07 21:02:47 UTC
I tried with never version that is now available (vulkaninfo 1.0.41) and Mesa 17.0 and still get the crash:

jlp@linux-l7tg:~> gdb vulkaninfo
GNU gdb (GDB; openSUSE Tumbleweed) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vulkaninfo...Reading symbols from /usr/lib/debug/usr/bin/vulkaninfo.debug...done.
done.
(gdb) start
Temporary breakpoint 1 at 0x4014d0: file /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/demos/vulkaninfo.c, line 1433.
Starting program: /usr/bin/vulkaninfo 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffddb8) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/demos/vulkaninfo.c:1433
1433    int main(int argc, char **argv) {
(gdb) c
Continuing.
===========
VULKAN INFO
===========

Vulkan API Version: 1.0.41

INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /home/jlp/.local/share/vulkan/implicit_layer.d/steamoverlay_i386.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /home/jlp/.local/share/vulkan/implicit_layer.d/steamoverlay_x86_64.json, version "1.0.0"
INFO: [loader] Code 0 : Found ICD manifest file /usr/share/vulkan/icd.d/intel_icd.x86_64.json, version "1.0.0"
INFO: [loader] Code 0 : Found ICD manifest file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json, version "1.0.0"

Program received signal SIGSEGV, Segmentation fault.
0x000000000001ddc6 in ?? ()
(gdb) where
#0  0x000000000001ddc6 in ?? ()
#1  0x00007fffee33abe2 in radv_lookup_entrypoint (name=<optimized out>) at radv_entrypoints.c:933
#2  0x00007ffff7980616 in loader_scanned_icd_add (api_version=4194307, filename=0x7fffffffd560 "/usr/lib64/libvulkan_radeon.so", icd_tramp_list=0x666820, 
    inst=0x6667e0) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:1565
#3  loader_icd_scan (inst=inst@entry=0x6667e0, icd_tramp_list=icd_tramp_list@entry=0x666820)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:3177
#4  0x00007ffff798616e in vkCreateInstance (pCreateInfo=pCreateInfo@entry=0x7fffffffdb10, pAllocator=pAllocator@entry=0x0, pInstance=pInstance@entry=0x7fffffffdb60)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/trampoline.c:329
#5  0x0000000000401837 in AppCreateInstance (inst=0x7fffffffdb60) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/demos/vulkaninfo.c:667
#6  main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/demos/vulkaninfo.c:1454
Comment 5 Jure Repinc 2017-03-11 00:29:17 UTC
I'm not sure if this helps but here is some steping by instructions in GDB:

Temporary breakpoint 6, main () at main.cpp:82
82          HelloTriangleApplication app;
(gdb) c
Continuing.

Breakpoint 3, radv_lookup_entrypoint (name=0x7ffff5dcdd00 "vkCreateInstance") at radv_entrypoints.c:933
933        if (strcmp(name, strings + e->name) != 0)
(gdb) where
#0  radv_lookup_entrypoint (name=0x7ffff5dcdd00 "vkCreateInstance") at radv_entrypoints.c:933
#1  0x00007ffff5db3616 in loader_scanned_icd_add (api_version=4194307, filename=0x7fffffffd590 "/usr/lib64/libvulkan_radeon.so", icd_tramp_list=0x7fffffffda20, 
    inst=0x0) at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:1565
#2  loader_icd_scan (inst=inst@entry=0x0, icd_tramp_list=icd_tramp_list@entry=0x7fffffffda20)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:3177
#3  0x00007ffff5dbc317 in vkEnumerateInstanceExtensionProperties (pLayerName=0x0, pPropertyCount=0x7fffffffda84, pProperties=0x0)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/trampoline.c:159
#4  0x00007ffff7bc62cd in _glfwInitVulkan () at /usr/src/debug/glfw-3.2.1/src/vulkan.c:82
#5  0x00007ffff7bc65ca in _glfwInitVulkan () at /usr/src/debug/glfw-3.2.1/src/vulkan.c:228
#6  glfwGetRequiredInstanceExtensions (count=0x7fffffffdb2c) at /usr/src/debug/glfw-3.2.1/src/vulkan.c:220
#7  0x00000000004018b2 in HelloTriangleApplication::createInstance (this=0x7fffffffdc20) at main.cpp:60
#8  0x00000000004017d2 in HelloTriangleApplication::initVulkan (this=0x7fffffffdc20) at main.cpp:34
#9  0x000000000040174e in HelloTriangleApplication::run (this=0x7fffffffdc20) at main.cpp:18
#10 0x0000000000401597 in main () at main.cpp:85
(gdb) dis
disable      disassemble  disconnect   display      
(gdb) dis
disable      disassemble  disconnect   display      
(gdb) disassemble 
Dump of assembler code for function radv_lookup_entrypoint:
   0x00007ffff3976b60 <+0>:     push   %rbx
   0x00007ffff3976b61 <+1>:     movsbl (%rdi),%edx
   0x00007ffff3976b64 <+4>:     test   %dl,%dl
   0x00007ffff3976b66 <+6>:     je     0x7ffff3976bee <radv_lookup_entrypoint+142>
   0x00007ffff3976b6c <+12>:    mov    %rdi,%rcx
   0x00007ffff3976b6f <+15>:    xor    %eax,%eax
   0x00007ffff3976b71 <+17>:    nopl   0x0(%rax)
   0x00007ffff3976b78 <+24>:    imul   $0x4ca9b7,%eax,%eax
   0x00007ffff3976b7e <+30>:    add    $0x1,%rcx
   0x00007ffff3976b82 <+34>:    add    %edx,%eax
   0x00007ffff3976b84 <+36>:    movsbl (%rcx),%edx
   0x00007ffff3976b87 <+39>:    test   %dl,%dl
   0x00007ffff3976b89 <+41>:    jne    0x7ffff3976b78 <radv_lookup_entrypoint+24>
   0x00007ffff3976b8b <+43>:    lea    0xce38e(%rip),%rcx        # 0x7ffff3a44f20 <map>
   0x00007ffff3976b92 <+50>:    movzbl %al,%edx
   0x00007ffff3976b95 <+53>:    movzwl (%rcx,%rdx,2),%ebx
   0x00007ffff3976b99 <+57>:    mov    %eax,%edx
   0x00007ffff3976b9b <+59>:    lea    0xce57e(%rip),%rsi        # 0x7ffff3a45120 <entrypoints>
   0x00007ffff3976ba2 <+66>:    lea    0xce377(%rip),%r8        # 0x7ffff3a44f20 <map>
   0x00007ffff3976ba9 <+73>:    jmp    0x7ffff3976bc3 <radv_lookup_entrypoint+99>
   0x00007ffff3976bab <+75>:    nopl   0x0(%rax,%rax,1)
   0x00007ffff3976bb0 <+80>:    mov    %ebx,%ecx
   0x00007ffff3976bb2 <+82>:    add    $0x13,%edx
   0x00007ffff3976bb5 <+85>:    cmp    0x4(%rsi,%rcx,8),%eax
   0x00007ffff3976bb9 <+89>:    je     0x7ffff3976bd0 <radv_lookup_entrypoint+112>
   0x00007ffff3976bbb <+91>:    movzbl %dl,%ecx
   0x00007ffff3976bbe <+94>:    movzwl (%r8,%rcx,2),%ebx
   0x00007ffff3976bc3 <+99>:    cmp    $0xffff,%ebx
   0x00007ffff3976bc9 <+105>:   jne    0x7ffff3976bb0 <radv_lookup_entrypoint+80>
   0x00007ffff3976bcb <+107>:   xor    %eax,%eax
   0x00007ffff3976bcd <+109>:   pop    %rbx
   0x00007ffff3976bce <+110>:   retq   
   0x00007ffff3976bcf <+111>:   nop
=> 0x00007ffff3976bd0 <+112>:   mov    (%rsi,%rcx,8),%esi
   0x00007ffff3976bd3 <+115>:   lea    0xceb26(%rip),%rax        # 0x7ffff3a45700 <strings>
   0x00007ffff3976bda <+122>:   add    %rax,%rsi
   0x00007ffff3976bdd <+125>:   callq  0x7ffff3974dc0 <strcmp@plt>
   0x00007ffff3976be2 <+130>:   test   %eax,%eax
   0x00007ffff3976be4 <+132>:   jne    0x7ffff3976bcb <radv_lookup_entrypoint+107>
   0x00007ffff3976be6 <+134>:   mov    %ebx,%edi
---Type <return> to continue, or q <return> to quit---
   0x00007ffff3976be8 <+136>:   pop    %rbx
   0x00007ffff3976be9 <+137>:   jmpq   0x7ffff3976b50 <radv_resolve_entrypoint>
   0x00007ffff3976bee <+142>:   mov    $0x44,%ebx
   0x00007ffff3976bf3 <+147>:   xor    %eax,%eax
   0x00007ffff3976bf5 <+149>:   jmp    0x7ffff3976b99 <radv_lookup_entrypoint+57>
End of assembler dump.
(gdb) c
Continuing.

Breakpoint 3, radv_lookup_entrypoint (name=0x7ffff5dd0640 "vkEnumerateInstanceExtensionProperties") at radv_entrypoints.c:933
933        if (strcmp(name, strings + e->name) != 0)
(gdb) disassemble 
Dump of assembler code for function radv_lookup_entrypoint:
   0x00007ffff3976b60 <+0>:     push   %rbx
   0x00007ffff3976b61 <+1>:     movsbl (%rdi),%edx
   0x00007ffff3976b64 <+4>:     test   %dl,%dl
   0x00007ffff3976b66 <+6>:     je     0x7ffff3976bee <radv_lookup_entrypoint+142>
   0x00007ffff3976b6c <+12>:    mov    %rdi,%rcx
   0x00007ffff3976b6f <+15>:    xor    %eax,%eax
   0x00007ffff3976b71 <+17>:    nopl   0x0(%rax)
   0x00007ffff3976b78 <+24>:    imul   $0x4ca9b7,%eax,%eax
   0x00007ffff3976b7e <+30>:    add    $0x1,%rcx
   0x00007ffff3976b82 <+34>:    add    %edx,%eax
   0x00007ffff3976b84 <+36>:    movsbl (%rcx),%edx
   0x00007ffff3976b87 <+39>:    test   %dl,%dl
   0x00007ffff3976b89 <+41>:    jne    0x7ffff3976b78 <radv_lookup_entrypoint+24>
   0x00007ffff3976b8b <+43>:    lea    0xce38e(%rip),%rcx        # 0x7ffff3a44f20 <map>
   0x00007ffff3976b92 <+50>:    movzbl %al,%edx
   0x00007ffff3976b95 <+53>:    movzwl (%rcx,%rdx,2),%ebx
   0x00007ffff3976b99 <+57>:    mov    %eax,%edx
   0x00007ffff3976b9b <+59>:    lea    0xce57e(%rip),%rsi        # 0x7ffff3a45120 <entrypoints>
   0x00007ffff3976ba2 <+66>:    lea    0xce377(%rip),%r8        # 0x7ffff3a44f20 <map>
   0x00007ffff3976ba9 <+73>:    jmp    0x7ffff3976bc3 <radv_lookup_entrypoint+99>
   0x00007ffff3976bab <+75>:    nopl   0x0(%rax,%rax,1)
   0x00007ffff3976bb0 <+80>:    mov    %ebx,%ecx
   0x00007ffff3976bb2 <+82>:    add    $0x13,%edx
   0x00007ffff3976bb5 <+85>:    cmp    0x4(%rsi,%rcx,8),%eax
   0x00007ffff3976bb9 <+89>:    je     0x7ffff3976bd0 <radv_lookup_entrypoint+112>
   0x00007ffff3976bbb <+91>:    movzbl %dl,%ecx
   0x00007ffff3976bbe <+94>:    movzwl (%r8,%rcx,2),%ebx
   0x00007ffff3976bc3 <+99>:    cmp    $0xffff,%ebx
   0x00007ffff3976bc9 <+105>:   jne    0x7ffff3976bb0 <radv_lookup_entrypoint+80>
   0x00007ffff3976bcb <+107>:   xor    %eax,%eax
   0x00007ffff3976bcd <+109>:   pop    %rbx
   0x00007ffff3976bce <+110>:   retq   
   0x00007ffff3976bcf <+111>:   nop
=> 0x00007ffff3976bd0 <+112>:   mov    (%rsi,%rcx,8),%esi
   0x00007ffff3976bd3 <+115>:   lea    0xceb26(%rip),%rax        # 0x7ffff3a45700 <strings>
   0x00007ffff3976bda <+122>:   add    %rax,%rsi
   0x00007ffff3976bdd <+125>:   callq  0x7ffff3974dc0 <strcmp@plt>
   0x00007ffff3976be2 <+130>:   test   %eax,%eax
   0x00007ffff3976be4 <+132>:   jne    0x7ffff3976bcb <radv_lookup_entrypoint+107>
   0x00007ffff3976be6 <+134>:   mov    %ebx,%edi
---Type <return> to continue, or q <return> to quit---
   0x00007ffff3976be8 <+136>:   pop    %rbx
   0x00007ffff3976be9 <+137>:   jmpq   0x7ffff3976b50 <radv_resolve_entrypoint>
   0x00007ffff3976bee <+142>:   mov    $0x44,%ebx
   0x00007ffff3976bf3 <+147>:   xor    %eax,%eax
   0x00007ffff3976bf5 <+149>:   jmp    0x7ffff3976b99 <radv_lookup_entrypoint+57>
End of assembler dump.
(gdb) c
Continuing.

Breakpoint 3, radv_lookup_entrypoint (name=0x7ffff5dcdd00 "vkCreateInstance") at radv_entrypoints.c:933
933        if (strcmp(name, strings + e->name) != 0)
(gdb) disassemble 
Dump of assembler code for function radv_lookup_entrypoint:
   0x00007fffed19cb60 <+0>:     push   %rbx
   0x00007fffed19cb61 <+1>:     movsbl (%rdi),%edx
   0x00007fffed19cb64 <+4>:     test   %dl,%dl
   0x00007fffed19cb66 <+6>:     je     0x7fffed19cbee <radv_lookup_entrypoint+142>
   0x00007fffed19cb6c <+12>:    mov    %rdi,%rcx
   0x00007fffed19cb6f <+15>:    xor    %eax,%eax
   0x00007fffed19cb71 <+17>:    nopl   0x0(%rax)
   0x00007fffed19cb78 <+24>:    imul   $0x4ca9b7,%eax,%eax
   0x00007fffed19cb7e <+30>:    add    $0x1,%rcx
   0x00007fffed19cb82 <+34>:    add    %edx,%eax
   0x00007fffed19cb84 <+36>:    movsbl (%rcx),%edx
   0x00007fffed19cb87 <+39>:    test   %dl,%dl
   0x00007fffed19cb89 <+41>:    jne    0x7fffed19cb78 <radv_lookup_entrypoint+24>
   0x00007fffed19cb8b <+43>:    lea    0xce38e(%rip),%rcx        # 0x7fffed26af20 <map>
   0x00007fffed19cb92 <+50>:    movzbl %al,%edx
   0x00007fffed19cb95 <+53>:    movzwl (%rcx,%rdx,2),%ebx
   0x00007fffed19cb99 <+57>:    mov    %eax,%edx
   0x00007fffed19cb9b <+59>:    lea    0xce57e(%rip),%rsi        # 0x7fffed26b120 <entrypoints>
   0x00007fffed19cba2 <+66>:    lea    0xce377(%rip),%r8        # 0x7fffed26af20 <map>
   0x00007fffed19cba9 <+73>:    jmp    0x7fffed19cbc3 <radv_lookup_entrypoint+99>
   0x00007fffed19cbab <+75>:    nopl   0x0(%rax,%rax,1)
   0x00007fffed19cbb0 <+80>:    mov    %ebx,%ecx
   0x00007fffed19cbb2 <+82>:    add    $0x13,%edx
   0x00007fffed19cbb5 <+85>:    cmp    0x4(%rsi,%rcx,8),%eax
   0x00007fffed19cbb9 <+89>:    je     0x7fffed19cbd0 <radv_lookup_entrypoint+112>
   0x00007fffed19cbbb <+91>:    movzbl %dl,%ecx
   0x00007fffed19cbbe <+94>:    movzwl (%r8,%rcx,2),%ebx
   0x00007fffed19cbc3 <+99>:    cmp    $0xffff,%ebx
   0x00007fffed19cbc9 <+105>:   jne    0x7fffed19cbb0 <radv_lookup_entrypoint+80>
   0x00007fffed19cbcb <+107>:   xor    %eax,%eax
   0x00007fffed19cbcd <+109>:   pop    %rbx
   0x00007fffed19cbce <+110>:   retq   
   0x00007fffed19cbcf <+111>:   nop
=> 0x00007fffed19cbd0 <+112>:   mov    (%rsi,%rcx,8),%esi
   0x00007fffed19cbd3 <+115>:   lea    0xceb26(%rip),%rax        # 0x7fffed26b700 <strings>
   0x00007fffed19cbda <+122>:   add    %rax,%rsi
   0x00007fffed19cbdd <+125>:   callq  0x7fffed19adc0 <strcmp@plt>
   0x00007fffed19cbe2 <+130>:   test   %eax,%eax
   0x00007fffed19cbe4 <+132>:   jne    0x7fffed19cbcb <radv_lookup_entrypoint+107>
   0x00007fffed19cbe6 <+134>:   mov    %ebx,%edi
---Type <return> to continue, or q <return> to quit---
   0x00007fffed19cbe8 <+136>:   pop    %rbx
   0x00007fffed19cbe9 <+137>:   jmpq   0x7fffed19cb50 <radv_resolve_entrypoint>
   0x00007fffed19cbee <+142>:   mov    $0x44,%ebx
   0x00007fffed19cbf3 <+147>:   xor    %eax,%eax
   0x00007fffed19cbf5 <+149>:   jmp    0x7fffed19cb99 <radv_lookup_entrypoint+57>
End of assembler dump.
(gdb) stepi
0x00007fffed19cbd3      933        if (strcmp(name, strings + e->name) != 0)
(gdb) 
0x00007fffed19cbda      933        if (strcmp(name, strings + e->name) != 0)
(gdb) 
0x00007fffed19cbdd      933        if (strcmp(name, strings + e->name) != 0)
(gdb) 
0x00007fffed19adc0 in strcmp@plt () from /usr/lib64/libvulkan_radeon.so
(gdb) 
0x000000000001ddc6 in ?? ()
(gdb) 

Program received signal SIGSEGV, Segmentation fault.
0x000000000001ddc6 in ?? ()
Comment 6 Mike Lothian 2017-03-11 00:50:47 UTC
Out of interest was LLVM compiled with LTO? I was seeing segfaults with vulkaninfo and I found recompiling llvm without LTO fixed things for me
Comment 7 Jure Repinc 2017-03-11 02:40:31 UTC
(In reply to Mike Lothian from comment #6)
> Out of interest was LLVM compiled with LTO? I was seeing segfaults with
> vulkaninfo and I found recompiling llvm without LTO fixed things for me

I'm afraid I don't know. It is LLVM supplied by openSUSE Tumbleweed. Is there any way to check if it was compiled with LTO?
Comment 8 Vasilis LIaskovitis 2017-05-03 13:35:30 UTC
I am getting a very similar backtrace in radv (with git master Vulkan-LoaderAndValidationLayers):

(gdb) bt
#0  0x000000000001e006 in ?? ()
#1  0x00007fffedcc7e42 in radv_lookup_entrypoint (name=<optimized out>) at radv_entrypoints.c:933
#2  0x00007ffff796e2bb in loader_scanned_icd_add () from /home/vliaskovitis/Vulkan-LoaderAndValidationLayers/loader/libvulkan.so.1
#3  0x00007ffff7972904 in loader_icd_scan () from /home/vliaskovitis/Vulkan-LoaderAndValidationLayers/loader/libvulkan.so.1
#4  0x00007ffff797a017 in vkCreateInstance () from /home/vliaskovitis/Vulkan-LoaderAndValidationLayers/loader/libvulkan.so.1
#5  0x0000000000401837 in ?? ()
#6  0x00007ffff75d8541 in __libc_start_main () from /lib64/libc.so.6
#7  0x0000000000403eaa in _start ()
(gdb) up
#1  0x00007fffedcc7e42 in radv_lookup_entrypoint (name=<optimized out>) at radv_entrypoints.c:933
933	radv_entrypoints.c: No such file or directory.
(gdb) print e
$1 = (const struct radv_entrypoint *) 0x7fffedd967c0 <entrypoints>
(gdb) print *e
$2 = {name = 0, hash = 950370726}
(gdb) print i
$3 = 0

I think it happens when loader_scanned_icd_add attempts to find the radv entry point:
fp_create_inst = (PFN_vkCreateInstance)fp_get_proc_addr(NULL, "vkCreateInstance");

Mesa is 17.0.4-160.1

HW setup is completely different. I am testing on a laptop with intel GPU only, but radv is still checked during vulkaninfo (if installed) and segfaults.
Comment 9 Avindra Goolcharan 2017-07-16 21:11:35 UTC
Also getting a segfault with amdgpu. I'm using a Southern Islands card (Radeon HD 7850), running Mesa 17.1.4-166.1 on openSUSE Tumbleweed.

This is the error I get:

$  vulkaninfo 
===========
VULKAN INFO
===========

Vulkan API Version: 1.0.41

INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /etc/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"
INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"
INFO: [loader] Code 0 : Found ICD manifest file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json, version "1.0.0"
Segmentation fault (core dumped)
Comment 10 Mike Lothian 2017-07-21 17:28:47 UTC
I saw something similar when LLVM was compiled with LTO, the SaschaWillems demos would run, but often on closing I'd see messages about a missing symbol
Comment 11 Matias N. Goldberg 2017-09-01 01:52:45 UTC
There is a similar ticket in https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/1978

where they suggest export LD_BIND_NOW=1 and that has indeed fixed the issue but later crashed with:
vulkaninfo: /home/matias/Projects/Mesa/llvm/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp:719: bool (anonymous namespace)::SIPeepholeSDWA::convertToSDWA(llvm::MachineInstr &, const SDWAOperandsVector &): Assertion `AMDGPU::getNamedOperandIdx(SDWAOpcode, AMDGPU::OpName::omod) != -1' failed.

I've compiled LLVM on my own (I don't know if LTO is enabled, if there's a quick way to tell, someone let me know how to check that and I'll paste it here).
It's also possible that assert may go away if I update LLVM (it's not latest, it's 5.0.0 unknown svn version from a few months ago).
Comment 12 Michel Dänzer 2017-09-01 02:00:50 UTC
This might be related to building LLVM with -DBUILD_SHARED_LIBS=ON. Does it also happen when building LLVM with -DLLVM_BUILD_LLVM_DYLIB=ON instead?
Comment 13 Matias N. Goldberg 2017-09-01 14:44:53 UTC
I updated to latest and greatest LLVM from SVN today:
svn info -r HEAD
Path: trunk
URL: http://llvm.org/svn/llvm-project/llvm/trunk
Relative URL: ^/llvm/trunk
Repository Root: http://llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 312328
Node Kind: directory
Last Changed Author: gberry
Last Changed Rev: 312328
Last Changed Date: 2017-09-01 11:27:20 -0300 (vie, 01 sep 2017)

and these are my results:
Vulkan is now working!, but only if I set LD_BIND_NOW=1 (the assert-crash is gone).

Regarding to your questions: I forgot that llvm is built with CMake, and I'm more skilled with CMake (I thought it used a configure script).
LLVM_BUILD_LLVM_DYLIB is disabled.
LLVM_ENABLE_LTO is set to "OFF"
LLVM_TOOL_LLVM_LTO2_BUILD is set (lots of complaints from CMake if I unset)
LLVM_TOOL_LLVM_LTO_BUILD is set (lots of complaints from CMake if I unset)
LLVM_TOOL_LTO_BUILD is unset.

Oddities:
I use clang++-4.0 to compile C++ (not g++)
I use clang-4.0 to compile C (not gcc)

I will be uploading my CMakeCache.txt in a bit, which details every single option used for compiling.

My OS:
lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 17.04
Release:	17.04
Codename:	zesty

(it's tweaked to Xubuntu; using xfce)

uname -r
4.11.6
Comment 14 Matias N. Goldberg 2017-09-01 14:45:34 UTC
Forgot to say: BUILD_SHARED_LIBS *IS* enabled.
Comment 15 Matias N. Goldberg 2017-09-01 14:47:44 UTC
"This might be related to building LLVM with -DBUILD_SHARED_LIBS=ON. Does it also happen when building LLVM with -DLLVM_BUILD_LLVM_DYLIB=ON instead?"

I just re-read your comment and it seems I misunderstood it. Just to confirm:
you're asking me to:
1. BUILD_SHARED_LIBS, enable LLVM_BUILD_LLVM_DYLIB ?
or...
2. Enable BUILD_SHARED_LIBS, also enable LLVM_BUILD_LLVM_DYLIB ?

I'm asking for confirmation because compiling llvm takes quite a while...

Cheers and Thanks
Comment 16 Michel Dänzer 2017-09-03 02:47:40 UTC
The recommended LLVM build configuration is -DBUILD_SHARED_LIBS=OFF -DLLVM_BUILD_LLVM_DYLIB=ON . BUILD_SHARED_LIBS is only intended for LLVM developers.
Comment 17 Matias N. Goldberg 2017-09-04 01:07:24 UTC
I can confirm that toggling LLVM's BUILD_SHARED_LIBS from ON to OFF and LLVM_BUILD_LLVM_DYLIB from OFF to ON fixed the crash on launch.

Vulkan now works without having to set LD_BIND_NOW.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.