ci(amd64/clang/msan): fix msan errors #59
					 4 changed files with 17 additions and 33 deletions
				
			
		|  | @ -112,7 +112,7 @@ Instance::~Instance() | ||||||
| 	unload_library(); | 	unload_library(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void Instance::initialize_instance() | void Instance::initialize_instance() | ||||||
| { | { | ||||||
| 	auto app_info = VkApplicationInfo { | 	auto app_info = VkApplicationInfo { | ||||||
| 		.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, | 		.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, | ||||||
|  | @ -231,7 +231,7 @@ __attribute__((no_sanitize("memory"))) void Instance::initialize_instance() | ||||||
| 	ensure(m_instance, "Failed to create vulkan instance"); | 	ensure(m_instance, "Failed to create vulkan instance"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void Instance::load_library() | void Instance::load_library() | ||||||
| { | { | ||||||
| 	constexpr auto runtime_loader_flags = RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE; | 	constexpr auto runtime_loader_flags = RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE; | ||||||
| 	library = dlopen("libvulkan.so.1", runtime_loader_flags); | 	library = dlopen("libvulkan.so.1", runtime_loader_flags); | ||||||
|  | @ -248,7 +248,7 @@ __attribute__((no_sanitize("memory"))) void Instance::load_library() | ||||||
| 	ensure(vk_get_instance_proc_address, "Failed to load vulkan function: vkGetInstanceProcAddr"); | 	ensure(vk_get_instance_proc_address, "Failed to load vulkan function: vkGetInstanceProcAddr"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void Instance::unload_library() | void Instance::unload_library() | ||||||
| { | { | ||||||
| 	if (!library) | 	if (!library) | ||||||
| 	{ | 	{ | ||||||
|  | @ -263,7 +263,7 @@ __attribute__((no_sanitize("memory"))) void Instance::unload_library() | ||||||
| 	// library = nullptr;
 | 	// library = nullptr;
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void Instance::load_global_functions() | void Instance::load_global_functions() | ||||||
| { | { | ||||||
| 	constexpr auto load_fn = []<typename T>(T &pfn, const char *fn_name) { | 	constexpr auto load_fn = []<typename T>(T &pfn, const char *fn_name) { | ||||||
| 		// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
 | 		// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
 | ||||||
|  | @ -277,7 +277,7 @@ __attribute__((no_sanitize("memory"))) void Instance::load_global_functions() | ||||||
| 	load_fn(vk_enumerate_instance_layer_properties, "vkEnumerateInstanceLayerProperties"); | 	load_fn(vk_enumerate_instance_layer_properties, "vkEnumerateInstanceLayerProperties"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void Instance::load_instance_functions() | void Instance::load_instance_functions() | ||||||
| { | { | ||||||
| 	const auto load_fn = [&]<typename T>(T &pfn, const char *fn_name) { | 	const auto load_fn = [&]<typename T>(T &pfn, const char *fn_name) { | ||||||
| 		// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
 | 		// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
 | ||||||
|  | @ -321,7 +321,7 @@ __attribute__((no_sanitize("memory"))) void Instance::load_instance_functions() | ||||||
| 	load_fn(vk_destroy_surface_khr, "vkDestroySurfaceKHR"); | 	load_fn(vk_destroy_surface_khr, "vkDestroySurfaceKHR"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void Instance::load_device_functions_impl(VkDevice device) | void Instance::load_device_functions_impl(VkDevice device) | ||||||
| { | { | ||||||
| 	const auto load_fn = [&]<typename T>(T &pfn, const char *fn_name) { | 	const auto load_fn = [&]<typename T>(T &pfn, const char *fn_name) { | ||||||
| 		// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
 | 		// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
 | ||||||
|  |  | ||||||
|  | @ -64,18 +64,17 @@ private: | ||||||
| 
 | 
 | ||||||
| 	Instance(); | 	Instance(); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void initialize_instance(); | 	void initialize_instance(); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void load_library(); | 	void load_library(); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void unload_library(); | 	void unload_library(); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void load_global_functions(); | 	void load_global_functions(); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void load_instance_functions(); | 	void load_instance_functions(); | ||||||
| 
 |  | ||||||
| 	__attribute__((no_sanitize("memory"))) void load_device_functions_impl(VkDevice device); |  | ||||||
| 
 | 
 | ||||||
|  | 	void load_device_functions_impl(VkDevice device); | ||||||
| 	VkInstance m_instance = VK_NULL_HANDLE; | 	VkInstance m_instance = VK_NULL_HANDLE; | ||||||
| 
 | 
 | ||||||
| 	VkAllocationCallbacks *m_allocator = nullptr; | 	VkAllocationCallbacks *m_allocator = nullptr; | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include <X11/keysymdef.h> | #include <X11/keysymdef.h> | ||||||
| 
 | 
 | ||||||
| //
 | //
 | ||||||
| #include <sanitizer/msan_interface.h> |  | ||||||
| 
 | 
 | ||||||
| namespace lt::surface { | namespace lt::surface { | ||||||
| 
 | 
 | ||||||
|  | @ -105,10 +104,7 @@ void System::on_unregister() | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize_memory)) void System::create_surface_component( | void System::create_surface_component(ecs::EntityId entity, SurfaceComponent::CreateInfo info) | ||||||
|     ecs::EntityId entity, |  | ||||||
|     SurfaceComponent::CreateInfo info |  | ||||||
| ) |  | ||||||
| try | try | ||||||
| { | { | ||||||
| 	auto &component = m_registry->add<SurfaceComponent>(entity, info); | 	auto &component = m_registry->add<SurfaceComponent>(entity, info); | ||||||
|  | @ -171,11 +167,6 @@ try | ||||||
| 	auto hints = std::array<const unsigned char, 5> { 2, 0, 0, 0, 0 }; | 	auto hints = std::array<const unsigned char, 5> { 2, 0, 0, 0, 0 }; | ||||||
| 	const auto motif_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); | 	const auto motif_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); | ||||||
| 
 | 
 | ||||||
| #if defined(__clang__) && __has_feature(memory_sanitizer) |  | ||||||
| 	auto bytes = (size_t)(1u) * (size_t)hints.size(); |  | ||||||
| 	__msan_unpoison((void *)hints.data(), bytes); |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| 	XChangeProperty( | 	XChangeProperty( | ||||||
| 	    display, | 	    display, | ||||||
| 	    surface.m_native_data.window, | 	    surface.m_native_data.window, | ||||||
|  | @ -344,10 +335,7 @@ void System::modify_title(SurfaceComponent &surface, const ModifyTitleRequest &r | ||||||
| 	XStoreName(display, window, request.title.c_str()); | 	XStoreName(display, window, request.title.c_str()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| __attribute__((no_sanitize("memory"))) void System::modify_resolution( | void System::modify_resolution(SurfaceComponent &surface, const ModifyResolutionRequest &request) | ||||||
|     SurfaceComponent &surface, |  | ||||||
|     const ModifyResolutionRequest &request |  | ||||||
| ) |  | ||||||
| { | { | ||||||
| 	// surface.m_resolution = request.resolution;
 | 	// surface.m_resolution = request.resolution;
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -27,10 +27,7 @@ public: | ||||||
| 
 | 
 | ||||||
| 	void on_unregister() override; | 	void on_unregister() override; | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void create_surface_component( | 	void create_surface_component(ecs::EntityId entity, SurfaceComponent::CreateInfo info); | ||||||
| 	    ecs::EntityId entity, |  | ||||||
| 	    SurfaceComponent::CreateInfo info |  | ||||||
| 	); |  | ||||||
| 
 | 
 | ||||||
| 	void tick(app::TickInfo tick) override; | 	void tick(app::TickInfo tick) override; | ||||||
| 
 | 
 | ||||||
|  | @ -48,12 +45,12 @@ private: | ||||||
| 
 | 
 | ||||||
| 	void modify_title(struct SurfaceComponent &surface, const struct ModifyTitleRequest &request); | 	void modify_title(struct SurfaceComponent &surface, const struct ModifyTitleRequest &request); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void modify_resolution( | 	void modify_resolution( | ||||||
| 	    struct SurfaceComponent &surface, | 	    struct SurfaceComponent &surface, | ||||||
| 	    const struct ModifyResolutionRequest &request | 	    const struct ModifyResolutionRequest &request | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	__attribute__((no_sanitize("memory"))) void modify_position( | 	void modify_position( | ||||||
| 	    struct SurfaceComponent &surface, | 	    struct SurfaceComponent &surface, | ||||||
| 	    const struct ModifyPositionRequest &request | 	    const struct ModifyPositionRequest &request | ||||||
| 	); | 	); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue