Validation layer trigger segment fault when create instance on ubuntu 22.04
Environment:
- OS: Ubuntu 22.04.4 LTS
- GPU and driver version: Intel Corporation AlderLake-S GT1 (rev 0c) i915
- SDK or header version if building from repo: ef846ac0883cde5e69ced0e7d7af59fe92f34e25
- Options enabled (synchronization, best practices, etc.): VK_LAYER_KHRONOS_validation
Describe the Issue
When enable the vulkan validation layer, the vulkan program will crash because a segmentation fault inside the vulkan validation layer(to be more specific, the Vulkan-Utility-Libraries it used):
The segmentation fault happens when try to convert a std::string to std::filesystem::path. After a quick investigation, it seems this bug is related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050
Expected behavior
program should not crash.
Valid Usage ID No valid usage ID.
Additional context
Local g++ version:
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
The validation layer is built by
cmake -S . -B build -D UPDATE_DEPS=ON -D BUILD_WERROR=ON -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug
The program I run is:
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
./my_vulkan_program
Then to know the backtrace I build the validation layer from source code, and then run
export VK_LAYER_PATH=/path_to_/Vulkan-ValidationLayers/build/layers
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation
./my_vulkan_program
@christophe-lunarg can you take a look since this is in vkuCreateLayerSettingSet
@Zieng I am curious what you have in the VkLayerSettingsCreateInfoEXT struct as this hasn't crashed like this (to my knowledge) for years and we haven't been touching this code much at all
I did recently add https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/8405 so hopefully if you are passing in invalid things into VkLayerSettingsCreateInfoEXT you are getting an error first
Hi @spencer-lunarg , thanks for your response. I've not checked the content in my VkLayerSettingsCreateInfoEXT but I managed to make the validation layer work on my local machine. The crash seems related to the layer_setting_create_info is nullptr that pass into vkuCreateLayerSettingSet
I change the ValidateLayerSettings so it will treat a nullptr layer_setting_create_info as invalid (which seems more reasonable to me)
to avoid the later crash when convert std::string to std::filesystem::path.
I'll continue my work, but when I've spare time, I'll help check why my VkLayerSettingsCreateInfoEXT will cause vkuFindLayerSettingsCreateInfo return a nullptr.
Wishing this community continued growth and success!
Ok, so I added a test here https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/8543
I don't want to go if (!layer_setting) return false because it will skip the vkuCreateLayerSettingSet which is designed to find the settings in vk_layer_settings.txt or VK_LAYER_SETTINGS_PATH as well
I am moving this over to the VUL repo as this clearly is an issue inside vkuCreateLayerSettingSet (so not in the VVL scope)
... It does seem this might be a compiler bug, but not sure how to work around it neither then