From df8ee07e26bc52714885c07052b08d50f016f090 Mon Sep 17 00:00:00 2001 From: s00502827 Date: Sun, 29 Sep 2024 09:49:38 +0800 Subject: [PATCH] =?UTF-8?q?open=20cfi=20=EF=BC=88cherry=20picked=20commit?= =?UTF-8?q?=20from=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.gypi | 1 + tools/v8_gypfiles/features.gypi | 2 +- tools/v8_gypfiles/toolchain.gypi | 2 +- tools/v8_gypfiles/v8.gyp | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) mode change 100644 => 100755 common.gypi mode change 100644 => 100755 tools/v8_gypfiles/features.gypi mode change 100644 => 100755 tools/v8_gypfiles/toolchain.gypi mode change 100644 => 100755 tools/v8_gypfiles/v8.gyp diff --git a/common.gypi b/common.gypi old mode 100644 new mode 100755 index 38471d463..7893a1ab1 --- a/common.gypi +++ b/common.gypi @@ -340,6 +340,7 @@ }], [ 'target_arch=="arm64"', { 'msvs_configuration_platform': 'arm64', + 'cflags': ['-mbranch-protection=pac-ret+b-key+bti'], }], ['asan == 1 and OS != "mac" and OS != "zos"', { 'cflags+': [ diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi old mode 100644 new mode 100755 index aa59713bb..8fd14e502 --- a/tools/v8_gypfiles/features.gypi +++ b/tools/v8_gypfiles/features.gypi @@ -234,7 +234,7 @@ # Enable control-flow integrity features, such as pointer authentication # for ARM64. - 'v8_control_flow_integrity%': 0, + 'v8_control_flow_integrity%': 1, # Enable V8 zone compression experimental feature. # Sets -DV8_COMPRESS_ZONES. diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi old mode 100644 new mode 100755 index 535cc9ee1..d2f678439 --- a/tools/v8_gypfiles/toolchain.gypi +++ b/tools/v8_gypfiles/toolchain.gypi @@ -269,7 +269,7 @@ ], 'conditions': [ ['v8_control_flow_integrity==1', { - 'cflags': [ '-mbranch-protection=standard' ], + 'cflags': [ '-mbranch-protection=pac-ret+b-key+bti' ], }], ], 'target_conditions': [ diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp old mode 100644 new mode 100755 index cddf33676..4478d34f5 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -342,6 +342,11 @@ 'type': 'static_library', 'toolsets': ['target'], 'conditions': [ + ['v8_control_flow_integrity==1', { + 'sources': [ + '<(V8_ROOT)/src/deoptimizer/deoptimizer-cfi-builtins.cc', + ], + }], ['want_separate_host_toolset', { 'conditions': [ ['v8_target_arch=="arm64"', { @@ -373,6 +378,10 @@ ] }], ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + '<(generate_bytecode_output_root)', + ], 'sources': [ '<(V8_ROOT)/src/init/setup-isolate-deserialize.cc', ], @@ -1453,6 +1462,11 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + ['v8_control_flow_integrity==1', { + 'sources': [ + '<(V8_ROOT)/src/deoptimizer/deoptimizer-cfi-empty.cc', + ], + }], ], }, # mksnapshot { -- Gitee