[PATCH 2/3] arm64: rust: Enable PAC support for Rust.

Vincenzo Palazzo vincenzopalazzodev at gmail.com
Wed Jan 25 11:54:56 PST 2023


On Wed Jan 25, 2023 at 5:37 PM CET, Jamie Cunliffe wrote:
> Enable the PAC ret and BTI options in the Rust build flags to match
> the options that are used when building C.
>
> Signed-off-by: Jamie Cunliffe <Jamie.Cunliffe at arm.com>

Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev at gmail.com>

> ---
>  arch/arm64/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index d62bd221828f..b53ab6aa2dfe 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -85,8 +85,10 @@ PACRET-$(CONFIG_UNWIND_PATCH_PAC_INTO_SCS) := pac-ret
>  
>  ifeq ($(CONFIG_ARM64_BTI_KERNEL),y)
>  branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI) := -mbranch-protection=$(PACRET-y)+bti
> +KBUILD_RUSTFLAGS += -Z branch-protection=bti,pac-ret,leaf
>  else
>  branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=$(PACRET-y)
> +KBUILD_RUSTFLAGS += -Z branch-protection=pac-ret,leaf
>  endif
>  # -march=armv8.3-a enables the non-nops instructions for PAC, to avoid the
>  # compiler to generate them and consequently to break the single image contract
> -- 
> 2.30.2




More information about the linux-arm-kernel mailing list