Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAC/BTI enablement in TS #771

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions fvp-psa-sp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ SP_PACKAGING_METHOD ?= embedded
SPMC_TESTS ?= n
SPMC_AT_EL ?= 1

# Behaves a similar way like BRANCH_PROTECTION in TF-A:
# unset: Default value. mbranch-protection flag is not provided
# 0: Turns off all types of branch protection
# 1: Enables all types of branch protection features
# 2: Return address signing to its standard level
# 3: Extend the signing to include leaf functions
# 4: Turn on branch target identification mechanism
TS_BRANCH_PROTECTION ?= unset
gabor-toth-arm marked this conversation as resolved.
Show resolved Hide resolved
BRANCH_PROTECTION_OPTIONS := unset 0 1 2 3 4

ifeq ($(filter $(TS_BRANCH_PROTECTION),$(BRANCH_PROTECTION_OPTIONS)),)
$(error TS_BRANCH_PROTECTION is not set to a valid option)
endif

ifneq ($(TS_UEFI_AUTH_VAR)-$(TS_SMM_GATEWAY),y-y)
SP_SMM_GATEWAY_EXTRA_FLAGS += -DUEFI_AUTH_VAR=OFF
TS_APP_UEFI_TEST_EXTRA_FLAGS += -DUEFI_AUTH_VAR=OFF
Expand Down Expand Up @@ -80,6 +94,32 @@ OPTEE_OS_COMMON_EXTRA_FLAGS += \
CFG_DT=y \
CFG_MAP_EXT_DT_SECURE=y

# If branch protection is unset, do not pass it
ifeq ($(filter $(TS_BRANCH_PROTECTION),unset),)
TF_A_FLAGS += BRANCH_PROTECTION=$(TS_BRANCH_PROTECTION)
TS_APP_COMMON_FLAGS += -DBRANCH_PROTECTION=$(TS_BRANCH_PROTECTION)
SP_COMMON_FLAGS += -DBRANCH_PROTECTION=$(TS_BRANCH_PROTECTION)
endif

# Branch Target Identification enablement
ifneq ($(filter $(TS_BRANCH_PROTECTION),1 4),)
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_CORE_BTI=y
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_TA_BTI=y

FVP_EXTRA_ARGS += -C cluster0.has_branch_target_exception=2
FVP_EXTRA_ARGS += -C cluster1.has_branch_target_exception=2
FVP_EXTRA_ARGS += -C cluster0.has_arm_v8-5=1
FVP_EXTRA_ARGS += -C cluster1.has_arm_v8-5=1
endif

# Pointer Authentication enablement
ifneq ($(filter $(TS_BRANCH_PROTECTION),1 2 3),)
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_CORE_PAUTH=y
OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_TA_PAUTH=y

FVP_EXTRA_ARGS += -C cluster0.has_pointer_authentication=2
FVP_EXTRA_ARGS += -C cluster1.has_pointer_authentication=2
endif

# The boot order of the SPs is determined by the order of calls here. This is
# due to the SPMC not (yet) supporting the boot order field of the SP manifest.
Expand Down