Enable PAC and BTI for runtime generated code.

This patch enables PAC and BTI for runtime generated code when PAC
is enabled. Additional BTI landing pads will resolve to NOOP when
running on non BTI device and will not cause functional problems.

Change-Id: I3993481df2c3c47e3e81bfb76a8c355f642cd572
Bug: chromium:919548, v8:10026
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3548457
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Andre Kempe <andre.kempe@arm.com>
Cr-Commit-Position: refs/heads/main@{#79630}
This commit is contained in:
André Kempe 2022-03-18 14:24:29 +00:00 committed by V8 LUCI CQ
parent e71ce3093d
commit c482a66bd7

View File

@ -474,7 +474,8 @@ if (v8_multi_arch_build &&
# Check if it is a Chromium build and activate PAC/BTI if needed.
# TODO(cavalcantii): have a single point of integration with PAC/BTI flags.
if (build_with_chromium && v8_current_cpu == "arm64" &&
arm_control_flow_integrity == "standard") {
(arm_control_flow_integrity == "standard" ||
arm_control_flow_integrity == "pac")) {
v8_control_flow_integrity = true
}
@ -1044,8 +1045,8 @@ config("toolchain") {
defines += [ "V8_TARGET_ARCH_ARM64" ]
if (current_cpu == "arm64") {
# This will enable PAC+BTI in code generation and static code.
if (v8_control_flow_integrity) {
# TODO(v8:10026): Enable this in src/build.
if (v8_control_flow_integrity &&
(!build_with_chromium || arm_control_flow_integrity == "standard")) {
cflags += [ "-mbranch-protection=standard" ]
asmflags = [ "-mmark-bti-property" ]
} else if (build_with_chromium && arm_control_flow_integrity == "pac") {