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

UBSAN error in PIPELINE_STATE::GetStageStates #4689

Closed
jbauman42 opened this issue Oct 21, 2022 · 0 comments · Fixed by #4760
Closed

UBSAN error in PIPELINE_STATE::GetStageStates #4689

jbauman42 opened this issue Oct 21, 2022 · 0 comments · Fixed by #4760

Comments

@jbauman42
Copy link

Describe the Issue
At https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/layers/pipeline_state.cpp#L86, (1<<31) is cast to a VkShaderStageFlagBits and loaded. That value is > VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM, so that's undefined behavior, which is caught by ubsan.

Environment:

  • OS: Fuchsia
  • GPU: Intel
  • SDK or header version if building from repo: 1.3.231
  • Options enabled (synchronization, best practices, etc.): default

Additional context
Callstack (as a Fuchsia log):
[00031.211991][58875][58877][klog] INFO: �[1m../../third_party/Vulkan-ValidationLayers/layers/pipeline_state.cpp:86:39:�[1m�[31m runtime error: �[1m�[0m�[1mload of value
[00031.211993][58875][58877][klog] INFO: 2147483648, which is not a valid value for type 'const VkShaderStageFlagBits'�[1m�[0m
[00031.657452][58875][58877][klog] INFO: #0 0x000021abf7484393 in PIPELINE_STATE::GetStageStates(const ValidationStateTracker&, const PIPELINE_STATE&) ../../third_party/Vulkan-ValidationLayers/layers/pipeline_state.cpp:86 <VkLayer_khronos_validation.so>+0x295a393
[00031.657500][58875][58877][klog] INFO: #1.2 0x0000208d349d83ff in ubsan_GetStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d3ff
[00031.657500][58875][58877][klog] INFO: #1.1 0x0000208d349d83ff in MaybePrintStackTrace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d3ff
[00031.657500][58875][58877][klog] INFO: #1 0x0000208d349d83ff in ~ScopedReport() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d3ff
[00031.657501][58875][58877][klog] INFO: #2 0x0000208d349db1e6 in handleLoadInvalidValue() compiler-rt/lib/ubsan/ubsan_handlers.cpp:540 <libclang_rt.asan.so>+0x401e6
[00031.657503][58875][58877][klog] INFO: #3 0x0000208d349daffd in compiler-rt/lib/ubsan/ubsan_handlers.cpp:545 <libclang_rt.asan.so>+0x3fffd
[00031.657505][58875][58877][klog] INFO: #4 0x000021abf7484393 in PIPELINE_STATE::GetStageStates(const ValidationStateTracker&, const PIPELINE_STATE&) ../../third_party/Vulkan-ValidationLayers/layers/pipeline_state.cpp:86 <VkLayer_khronos_validation.so>+0x295a393
[00031.657512][58875][58877][klog] INFO: #5 0x000021abf748aae9 in PIPELINE_STATE::PIPELINE_STATE(PIPELINE_STATE*, const ValidationStateTracker*, VkGraphicsPipelineCreateInfo const*, std::__2::shared_ptr&&, std::__2::shared_ptr&&) ../../third_party/Vulkan-ValidationLayers/layers/pipeline_state.cpp:452 <VkLayer_khronos_validation.so>+0x2960ae9
[00031.657514][58875][58877][klog] INFO: #6 0x000021abf7675515 in std::__2::__shared_ptr_emplace<PIPELINE_STATE, std::__2::allocator<PIPELINE_STATE>>::__shared_ptr_emplace<const ValidationStateTracker*, const VkGraphicsPipelineCreateInfo*&, std::__2::shared_ptr, std::__2::shared_ptr>(std::__2::__shared_ptr_emplace<PIPELINE_STATE, std::__2::allocator<PIPELINE_STATE> >, std::__2::allocator<PIPELINE_STATE>, const ValidationStateTracker&&, const VkGraphicsPipelineCreateInfo*&, std::__2::shared_ptr&&, std::__2::shared_ptr&&) ../../prebuilt/third_party/clang/linux-x64/include/c++/v1/__memory/shared_ptr.h:297 <VkLayer_khronos_validation.so>+0x2b4b515
[00031.657516][58875][58877][klog] INFO: #7 0x000021abf76751ca in std::__2::allocate_shared<PIPELINE_STATE, std::__2::allocator<PIPELINE_STATE>, const ValidationStateTracker*, const VkGraphicsPipelineCreateInfo*&, std::__2::shared_ptr, std::__2::shared_ptr, void>(const std::__2::allocator<PIPELINE_STATE>&, const ValidationStateTracker*&&, const VkGraphicsPipelineCreateInfo*&, std::__2::shared_ptr&&, std::__2::shared_ptr&&) ../../prebuilt/third_party/clang/linux-x64/include/c++/v1/__memory/shared_ptr.h:956 <VkLayer_khronos_validation.so>+0x2b4b1ca
[00031.657517][58875][58877][klog] INFO: #8.1 0x000021abf75d26d3 in std::__2::make_shared<PIPELINE_STATE, const ValidationStateTracker*, const VkGraphicsPipelineCreateInfo*&, std::__2::shared_ptr, std::__2::shared_ptr, void>(const ValidationStateTracker*&&, std::__2::shared_ptr&&, std::__2::shared_ptr&&, const VkGraphicsPipelineCreateInfo*&) ../../prebuilt/third_party/clang/linux-x64/include/c++/v1/__memory/shared_ptr.h:965 <VkLayer_khronos_validation.so>+0x2aa86d3
[00031.657517][58875][58877][klog] INFO: #8 0x000021abf75d26d3 in ValidationStateTracker::CreateGraphicsPipelineState(const ValidationStateTracker*, VkGraphicsPipelineCreateInfo const*, std::__2::shared_ptr&&, std::__2::shared_ptr&&) ../../third_party/Vulkan-ValidationLayers/layers/state_tracker.cpp:2238 <VkLayer_khronos_validation.so>+0x2aa86d3
[00031.657518][58875][58877][klog] INFO: #9 0x000021abf75d2d2c in ValidationStateTracker::PreCallValidateCreateGraphicsPipelines(const ValidationStateTracker*, VkDevice, VkPipelineCache, uint32_t, VkGraphicsPipelineCreateInfo const*, VkAllocationCallbacks const*, VkPipeline*, void*) ../../third_party/Vulkan-ValidationLayers/layers/state_tracker.cpp:2268 <VkLayer_khronos_validation.so>+0x2aa8d2c
[00031.657519][58875][58877][klog] INFO: #10 0x000021abf7069ded in CoreChecks::PreCallValidateCreateGraphicsPipelines(const CoreChecks*, VkDevice, VkPipelineCache, uint32_t, VkGraphicsPipelineCreateInfo const*, VkAllocationCallbacks const*, VkPipeline*, void*) ../../third_party/Vulkan-ValidationLayers/layers/core_validation.cpp:7378 <VkLayer_khronos_validation.so>+0x253fded
[00031.657520][58875][58877][klog] INFO: #11 0x000021abf7f2110b in vulkan_layer_chassis::CreateGraphicsPipelines(VkDevice, VkPipelineCache, uint32_t, VkGraphicsPipelineCreateInfo const*, VkAllocationCallbacks const*, VkPipeline*) ../../third_party/Vulkan-ValidationLayers/layers/generated/chassis.cpp:575 <VkLayer_khronos_validation.so>+0x33f710b
[00031.657522][58875][58877][klog] INFO: #12.2 0x000020920b843683 in vk::DispatchLoaderStatic::vkCreateGraphicsPipelines(VkDevice, VkPipelineCache, uint32_t, VkGraphicsPipelineCreateInfo const*, VkAllocationCallbacks const*, VkPipeline*, const vk::DispatchLoaderStatic*) ../../third_party/Vulkan-Headers/include/vulkan/vulkan.hpp:1724 <>+0xa3a683
[00031.657522][58875][58877][klog] INFO: #12.1 0x000020920b843683 in vk::Device::createGraphicsPipelinevk::DispatchLoaderStatic(const vk::Device*, vk::PipelineCache, const vk::GraphicsPipelineCreateInfo&, vk::Optional, const vk::DispatchLoaderStatic&) ../../third_party/Vulkan-Headers/include/vulkan/vulkan_funcs.hpp:2774 <>+0xa3a683
[00031.657522][58875][58877][klog] INFO: #12 0x000020920b843683 in escher::PipelineBuilder::BuildGraphicsPipeline(escher::PipelineBuilder*, const vk::GraphicsPipelineCreateInfo&, bool) ../../src/ui/lib/escher/vk/pipeline_builder.cc:64 <>+0xa3a683
[00031.657523][58875][58877][klog] INFO: #13 0x000020920b7da23f in escher::CommandBufferPipelineState::BuildGraphicsPipeline(escher::CommandBufferPipelineState*, const escher::PipelineLayout*, escher::ShaderProgram*, bool) ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc:443 <>+0x9d123f
[00031.657524][58875][58877][klog] INFO: #14 0x000020920b7d972d in escher::CommandBufferPipelineState::FlushGraphicsPipeline(escher::CommandBufferPipelineState*, const escher::PipelineLayout*, escher::ShaderProgram*, bool) ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc:184 <>+0x9d072d
[00031.657526][58875][58877][klog] INFO: #15 0x000020920b71ceed in escher::WarmProgramHelper(escher::impl::PipelineLayoutCache*, escher::ShaderProgramPtr const&, escher::CommandBufferPipelineState*, const std::__2::vector<fxl::RefPtrescher::Sampler, std::__2::allocator<fxl::RefPtrescher::Sampler > >&) ../../src/ui/lib/escher/paper/paper_renderer.cc:822 <>+0x913eed
[00031.657527][58875][58877][klog] INFO: #16 0x000020920b7193fb in escher::PaperRenderer::WarmPipelineAndRenderPassCaches(escher::Escher*, const escher::PaperRendererConfig&, vk::Format, vk::ImageLayout, const std::__2::vector<fxl::RefPtrescher::Sampler, std::__2::allocator<fxl::RefPtrescher::Sampler > >&, bool) ../../src/ui/lib/escher/paper/paper_renderer.cc:886 <>+0x9103fb
[00031.657528][58875][58877][klog] INFO: #17 0x000020920b2507f8 in scenic_impl::gfx::EngineRenderer::WarmPipelineCache(const scenic_impl::gfx::EngineRenderer*, std::__2::set<vk::Format, std::__2::lessvk::Format, std::__2::allocatorvk::Format >) ../../src/ui/scenic/lib/gfx/engine/engine_renderer.cc:284 <>+0x4477f8
[00031.657529][58875][58877][klog] INFO: #18.1 0x000020920b2f00dc in λ(const scenic_impl::gfx::GfxSystem::UpdateSessions::(anon class), vk::Format) ../../src/ui/scenic/lib/gfx/gfx_system.cc:233 <>+0x4e70dc
[00031.657529][58875][58877][klog] INFO: #18 0x000020920b2f00dc in fit::internal::target<(lambda at../../src/ui/scenic/lib/gfx/gfx_system.cc:232:11), true, false, void, vk::Format>::invoke(void
, vk::Format) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <>+0x4e70dc
[00031.657530][58875][58877][klog] INFO: #19.2 0x000020920b29a290 in fit::internal::function_base<16UL, false, void(vk::Format)>::invoke(const fit::internal::function_base<16UL, false, void (vk::Format)>, vk::Format) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <>+0x491290
[00031.657530][58875][58877][klog] INFO: #19.1 0x000020920b29a290 in fit::function_impl<16UL, false, void(vk::Format)>::operator()(const fit::function_impl<16UL, false, void (vk::Format)>
, vk::Format) ../../sdk/lib/fit/include/lib/fit/function.h:300 <>+0x491290
[00031.657530][58875][58877][klog] INFO: #19 0x000020920b29a290 in scenic_impl::gfx::GfxCommandApplier::CreateDisplayCompositor(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, scenic_impl::ResourceId, fuchsia::ui::gfx::DisplayCompositorArgs) ../../src/ui/scenic/lib/gfx/engine/gfx_command_applier.cc:1605 <>+0x491290
[00031.657532][58875][58877][klog] INFO: #20 0x000020920b285565 in scenic_impl::gfx::GfxCommandApplier::ApplyCreateDisplayCompositor(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, scenic_impl::ResourceId, fuchsia::ui::gfx::DisplayCompositorArgs) ../../src/ui/scenic/lib/gfx/engine/gfx_command_applier.cc:1360 <>+0x47c565
[00031.657533][58875][58877][klog] INFO: #21 0x000020920b26b2c1 in scenic_impl::gfx::GfxCommandApplier::ApplyCreateResourceCmd(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, fuchsia::ui::gfx::CreateResourceCmd) ../../src/ui/scenic/lib/gfx/engine/gfx_command_applier.cc:311 <>+0x4622c1
[00031.657534][58875][58877][klog] INFO: #22 0x000020920b268871 in scenic_impl::gfx::GfxCommandApplier::ApplyCommand(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, fuchsia::ui::gfx::Command) ../../src/ui/scenic/lib/gfx/engine/gfx_command_applier.cc:109 <>+0x45f871
[00031.657535][58875][58877][klog] INFO: #23.1 0x000020920b2bc50a in scenic_impl::gfx::Session::ApplyCommand(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, fuchsia::ui::gfx::Command) ../../src/ui/scenic/lib/gfx/engine/session.h:65 <>+0x4b350a
[00031.657535][58875][58877][klog] INFO: #23 0x000020920b2bc50a in scenic_impl::gfx::Session::ApplyUpdate(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, std::__2::vector<fuchsia::ui::gfx::Command, std::__2::allocatorfuchsia::ui::gfx::Command >) ../../src/ui/scenic/lib/gfx/engine/session.cc:167 <>+0x4b350a
[00031.657536][58875][58877][klog] INFO: #24 0x000020920b2bbab3 in scenic_impl::gfx::Session::ApplyScheduledUpdates(scenic_impl::gfx::Session*, scenic_impl::gfx::CommandContext*, scheduling::PresentId) ../../src/ui/scenic/lib/gfx/engine/session.cc:104 <>+0x4b2ab3
[00031.657537][58875][58877][klog] INFO: #25 0x000020920b2ec58e in scenic_impl::gfx::GfxSystem::UpdateSessions(scenic_impl::gfx::GfxSystem*, const std::__2::unordered_map<unsigned long, unsigned long, std::__2::hash, std::__2::equal_to, std::__2::allocator<std::__2::pair<const unsigned long, unsigned long> > >&, uint64_t, fit::function<void (unsigned long)>) ../../src/ui/scenic/lib/gfx/gfx_system.cc:256 <>+0x4e358e
[00031.657538][58875][58877][klog] INFO: #26 0x000020920b9a75fd in scenic_impl::Scenic::UpdateSessions(scenic_impl::Scenic*, const std::__2::unordered_map<unsigned long, unsigned long, std::__2::hash, std::__2::equal_to, std::__2::allocator<std::__2::pair<const unsigned long, unsigned long> > >&, uint64_t) ../../src/ui/scenic/lib/scenic/scenic.cc:65 <>+0xb9e5fd
[00031.657539][58875][58877][klog] INFO: #27 0x000020920b9a78c1 in $anon() <>+0xb9e8c1
[00031.657541][58875][58877][klog] INFO: #28.2 0x000020920b9df1d0 in λ(const std::__2::weak_ptrscheduling::SessionUpdater&, const scheduling::DefaultFrameScheduler::ApplyUpdatesToEachUpdater::(anon class)) ../../src/ui/scenic/lib/scheduling/default_frame_scheduler.cc:472 <>+0xbd61d0
[00031.657541][58875][58877][klog] INFO: #28.1 0x000020920b9df1d0 in std::__2::for_each<std::__2::__wrap_iter<std::__2::weak_ptrscheduling::SessionUpdater
>, (lambda at../../src/ui/scenic/lib/scheduling/default_frame_scheduler.cc:465:7)>(std::__2::__wrap_iter<std::__2::weak_ptrscheduling::SessionUpdater >, std::__2::__wrap_iter<std::__2::weak_ptrscheduling::SessionUpdater >, scheduling::DefaultFrameScheduler::ApplyUpdatesToEachUpdater::(anon class)) ../../prebuilt/third_party/clang/linux-x64/include/c++/v1/__algorithm/for_each.h:26 <>+0xbd61d0
[00031.657541][58875][58877][klog] INFO: #28 0x000020920b9df1d0 in scheduling::DefaultFrameScheduler::ApplyUpdatesToEachUpdater(scheduling::DefaultFrameScheduler
, const std::__2::unordered_map<unsigned long, unsigned long, std::__2::hash, std::__2::equal_to, std::__2::allocator<std::__2::pair<const unsigned long, unsigned long> > >&, uint64_t) ../../src/ui/scenic/lib/scheduling/default_frame_scheduler.cc:463 <>+0xbd61d0
[00031.657542][58875][58877][klog] INFO: #29 0x000020920b9d98b9 in scheduling::DefaultFrameScheduler::ApplyUpdates(scheduling::DefaultFrameScheduler
, zx::time, zx::time, uint64_t) ../../src/ui/scenic/lib/scheduling/default_frame_scheduler.cc:511 <>+0xbd08b9
[00031.657543][58875][58877][klog] INFO: #30 0x000020920b9d7f0c in scheduling::DefaultFrameScheduler::MaybeRenderFrame(scheduling::DefaultFrameScheduler*, async_dispatcher_t*, async::TaskBase*, zx_status_t) ../../src/ui/scenic/lib/scheduling/default_frame_scheduler.cc:175 <>+0xbcef0c
[00031.657544][58875][58877][klog] INFO: #31.3 0x000020920bb61d55 in async_loop_dispatch_task(async_loop_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async-loop/loop.c:453 <>+0xd58d55
[00031.657544][58875][58877][klog] INFO: #31.2 0x000020920bb61d55 in async_loop_dispatch_tasks(async_loop_t*) ../../zircon/system/ulib/async-loop/loop.c:434 <>+0xd58d55
[00031.657544][58875][58877][klog] INFO: #31.1 0x000020920bb61d55 in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:321 <>+0xd58d55
[00031.657544][58875][58877][klog] INFO: #31 0x000020920bb61d55 in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 <>+0xd58d55
[00031.657546][58875][58877][klog] INFO: #32 0x000020920b12da4c in main(int, const char**) ../../src/ui/scenic/bin/main.cc:64 <>+0x324a4c
[00031.657547][58875][58877][klog] INFO: #33 0x00004362d4a63200 in start_main(const start_params*) ../../zircon/third_party/ulib/musl/src/env/__libc_start_main.c:144 <libc.so>+0xe7200
[00031.657548][58875][58877][klog] INFO: #34 0x00004362d4a63ce8 in __libc_start_main(zx_handle_t, int (*)(int, char**, char**)) ../../zircon/third_party/ulib/musl/src/env/__libc_start_main.c:219 <libc.so>+0xe7ce8
[00031.657549][58875][58877][klog] INFO: #35 0x000020920baeabd0 in _start(zx_handle_t) ../../zircon/system/ulib/c/Scrt1.cc:7 <>+0xce1bd0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant