Commit a20f5b17 by Alexis Hetu Committed by Commit Bot

Silence Control Flow Integrity (cfi) errors

The cfi bot is throwing 3 different errors with ANGLE when using the Vulkan backend: - ChoosePhysicalDevice causes a "function with wrong dynamic type" error when using vkGetPhysicalDeviceProperties - In volk.c, using vkGetInstanceProcAddr and vkGetDeviceProcAddr also causes a "function with wrong dynamic type" error - In vk_mem_alloc.h, included from vk_mem_alloc_wrapper.cpp, GetAllocationCallbacks() causes a "unrelated cast" error This cl silences all 3 cfi errors. Bug: chromium:1116053 Change-Id: I864ec8d9e2acaec493f472e01b3987dcc641c58f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2363209Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Alexis Hétu <sugoi@chromium.org>
parent a357cbab
...@@ -250,6 +250,20 @@ config("angle_common_config") { ...@@ -250,6 +250,20 @@ config("angle_common_config") {
} }
} }
# Silences the "indirect call of a function with wrong dynamic type" cfi error
config("angle_no_cfi_icall") {
if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) {
cflags = [ "-fno-sanitize=cfi-icall" ]
}
}
# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error
config("angle_no_cfi_unrelated_cast") {
if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) {
cflags = [ "-fno-sanitize=cfi-unrelated-cast" ]
}
}
angle_source_set("angle_system_utils") { angle_source_set("angle_system_utils") {
sources = angle_system_utils_sources sources = angle_system_utils_sources
} }
......
...@@ -63,6 +63,8 @@ angle_source_set("vulkan") { ...@@ -63,6 +63,8 @@ angle_source_set("vulkan") {
"$angle_root:angle_common", "$angle_root:angle_common",
] ]
configs += [ "$angle_root:angle_no_cfi_icall" ]
defines = [ defines = [
"ANGLE_VK_LAYERS_DIR=\"$angle_data_dir\"", "ANGLE_VK_LAYERS_DIR=\"$angle_data_dir\"",
"ANGLE_VK_MOCK_ICD_JSON=\"$angle_data_dir/VkICD_mock_icd.json\"", "ANGLE_VK_MOCK_ICD_JSON=\"$angle_data_dir/VkICD_mock_icd.json\"",
......
...@@ -174,6 +174,7 @@ angle_source_set("angle_vk_mem_alloc_wrapper") { ...@@ -174,6 +174,7 @@ angle_source_set("angle_vk_mem_alloc_wrapper") {
"$angle_root/src/common/vulkan:angle_vulkan_headers", "$angle_root/src/common/vulkan:angle_vulkan_headers",
"$angle_vulkan_memory_allocator_dir", "$angle_vulkan_memory_allocator_dir",
] ]
configs += [ "$angle_root:angle_no_cfi_unrelated_cast" ]
sources = [ sources = [
"vk_mem_alloc_wrapper.cpp", "vk_mem_alloc_wrapper.cpp",
"vk_mem_alloc_wrapper.h", "vk_mem_alloc_wrapper.h",
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("../../../gni/angle.gni")
config("volk_config") { config("volk_config") {
include_dirs = [ "." ] include_dirs = [ "." ]
} }
...@@ -12,5 +14,6 @@ source_set("volk") { ...@@ -12,5 +14,6 @@ source_set("volk") {
"volk.h", "volk.h",
] ]
public_configs = [ ":volk_config" ] public_configs = [ ":volk_config" ]
configs += [ "$angle_root:angle_no_cfi_icall" ]
public_deps = [ "../../../third_party/vulkan-headers/src:vulkan_headers" ] public_deps = [ "../../../third_party/vulkan-headers/src:vulkan_headers" ]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment