Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation layer trigger segment fault when create instance on ubuntu 22.04 #234

Open
Zieng opened this issue Sep 13, 2024 · 3 comments
Open

Comments

@Zieng
Copy link

Zieng commented Sep 13, 2024

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):
image

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
@spencer-lunarg
Copy link
Contributor

@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 KhronosGroup/Vulkan-ValidationLayers#8405 so hopefully if you are passing in invalid things into VkLayerSettingsCreateInfoEXT you are getting an error first

@Zieng
Copy link
Author

Zieng commented Sep 14, 2024

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
image

I change the ValidateLayerSettings so it will treat a nullptr layer_setting_create_info as invalid (which seems more reasonable to me)
image

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!

@spencer-lunarg
Copy link
Contributor

Ok, so I added a test here KhronosGroup/Vulkan-ValidationLayers#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

@spencer-lunarg spencer-lunarg transferred this issue from KhronosGroup/Vulkan-ValidationLayers Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants