Bug 102010 - libvulkan_radeon crashes if loaded on Intel hardware
Summary: libvulkan_radeon crashes if loaded on Intel hardware
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: 17.1
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-01 23:16 UTC by Thiago Macieira
Modified: 2017-08-03 19:31 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Thiago Macieira 2017-08-01 23:16:00 UTC
When I run vulkaninfo, it crashes:

===========
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/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.

The backtrace points to libvulkan loading the Radeon driver:

(gdb) bt
#0  0x000000000001f436 in ?? ()
#1  0x00007fffede683f2 in radv_lookup_entrypoint (name=<optimized out>) at radv_entrypoints.c:833
#2  0x00007ffff797f3e9 in loader_scanned_icd_add (api_version=4194307, 
    filename=0x7fffffffd0a0 "/usr/lib64/libvulkan_radeon.so", icd_tramp_list=0x5555557c2bb0, inst=0x5555557c2b70)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:1565
#3  loader_icd_scan (inst=inst@entry=0x5555557c2b70, icd_tramp_list=icd_tramp_list@entry=0x5555557c2bb0)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/loader.c:3177
#4  0x00007ffff798506b in vkCreateInstance (pCreateInfo=0x7fffffffd660, pAllocator=0x0, pInstance=0x7fffffffd6b0)
    at /usr/src/debug/Vulkan-LoaderAndValidationLayers-1.0.41/loader/trampoline.c:329
#5  0x00005555555558c2 in AppCreateInstance (inst=0x7fffffffd6b0)
    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

My system has an Intel GPU:

$ lspci -s 0:2
00:02.0 VGA compatible controller: Intel Corporation Iris Graphics 540 (rev 0a)

The Intel driver is installed:

$ ls -l /usr/lib64/libvulkan*
-rwxr-xr-x 1 root root 2625088 jul 24 04:26 /usr/lib64/libvulkan_intel.so
-rwxr-xr-x 1 root root 1655912 jul 24 04:26 /usr/lib64/libvulkan_radeon.so
lrwxrwxrwx 1 root root      19 mai 27 22:52 /usr/lib64/libvulkan.so.1 -> libvulkan.so.1.0.41
-rwxr-xr-x 1 root root  239600 mai 27 22:52 /usr/lib64/libvulkan.so.1.0.41

Both files drivers are installed due to a dependency in package management, but clearly the Radeon one should not be used. The driver should validate that it is in the correct HW and bail out if not.
Comment 1 Thiago Macieira 2017-08-01 23:17:59 UTC
Also submitted at libvulkan itself: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/1978

I don't know what is at fault: whether it's libvulkan for loading the wrong driver, or the driver for failing to properly bail out, or both for there not being a mechanism to bail out in the first place.
Comment 2 Thiago Macieira 2017-08-02 14:53:18 UTC
SUSE developers think the problem is actually a bug in glibc: the LLVM dependencies in the Radeon driver are causing the dynamic loader confusion.

https://bugzilla.opensuse.org/show_bug.cgi?id=1022156
Comment 3 Michel Dänzer 2017-08-02 15:04:11 UTC
(In reply to Thiago Macieira from comment #2)
> https://bugzilla.opensuse.org/show_bug.cgi?id=1022156

BTW, looks like SUSE is building LLVM with BUILD_SHARED_LIBS=ON, which is a bad idea. They should build it with LLVM_BUILD_LLVM_DYLIB=ON instead. Please pass this on to them. (This problem might happen regardless though)
Comment 4 Bas Nieuwenhuizen 2017-08-03 19:10:48 UTC
Also for context, libvulkan loads all drivers on the system, after which the driver is supposed to tell libvulkan if there are any devices it supports. That part seems WAI to me.

It seems there are linking issues to me that cause issues loading the driver before we even look there is any hardware we support.
Comment 5 Thiago Macieira 2017-08-03 19:31:27 UTC
(In reply to Bas Nieuwenhuizen from comment #4)
> Also for context, libvulkan loads all drivers on the system, after which the
> driver is supposed to tell libvulkan if there are any devices it supports.
> That part seems WAI to me.
> 
> It seems there are linking issues to me that cause issues loading the driver
> before we even look there is any hardware we support.

Agreed. Closing, as this does seem to be a local issue in the way OpenSUSE builds.


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.