Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a20f5b1

Browse files
sugoi1Commit Bot
authored andcommitted
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/+/2363209 Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Jamie Madill <[email protected]> Commit-Queue: Alexis Hétu <[email protected]>
1 parent a357cba commit a20f5b1

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

BUILD.gn

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,20 @@ config("angle_common_config") {
250250
}
251251
}
252252

253+
# Silences the "indirect call of a function with wrong dynamic type" cfi error
254+
config("angle_no_cfi_icall") {
255+
if (is_cfi && use_cfi_icall && current_toolchain == default_toolchain) {
256+
cflags = [ "-fno-sanitize=cfi-icall" ]
257+
}
258+
}
259+
260+
# Silences the "cast from void* or another unrelated type to the wrong dynamic type" cfi error
261+
config("angle_no_cfi_unrelated_cast") {
262+
if (is_cfi && use_cfi_cast && current_toolchain == default_toolchain) {
263+
cflags = [ "-fno-sanitize=cfi-unrelated-cast" ]
264+
}
265+
}
266+
253267
angle_source_set("angle_system_utils") {
254268
sources = angle_system_utils_sources
255269
}

src/common/vulkan/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ angle_source_set("vulkan") {
6363
"$angle_root:angle_common",
6464
]
6565

66+
configs += [ "$angle_root:angle_no_cfi_icall" ]
67+
6668
defines = [
6769
"ANGLE_VK_LAYERS_DIR=\"$angle_data_dir\"",
6870
"ANGLE_VK_MOCK_ICD_JSON=\"$angle_data_dir/VkICD_mock_icd.json\"",

src/libANGLE/renderer/vulkan/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ angle_source_set("angle_vk_mem_alloc_wrapper") {
174174
"$angle_root/src/common/vulkan:angle_vulkan_headers",
175175
"$angle_vulkan_memory_allocator_dir",
176176
]
177+
configs += [ "$angle_root:angle_no_cfi_unrelated_cast" ]
177178
sources = [
178179
"vk_mem_alloc_wrapper.cpp",
179180
"vk_mem_alloc_wrapper.h",

src/third_party/volk/BUILD.gn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5+
import("../../../gni/angle.gni")
6+
57
config("volk_config") {
68
include_dirs = [ "." ]
79
}
@@ -12,5 +14,6 @@ source_set("volk") {
1214
"volk.h",
1315
]
1416
public_configs = [ ":volk_config" ]
17+
configs += [ "$angle_root:angle_no_cfi_icall" ]
1518
public_deps = [ "../../../third_party/vulkan-headers/src:vulkan_headers" ]
1619
}

0 commit comments

Comments
 (0)