Re: [PATCH v2 01/10] arm64: bti: Support building kernel C code using BTI

Mark Brown
2020-05-05T17:31:56Z

[-- Attachment #1.1: Type: text/plain, Size: 1261 bytes --]

On Tue, May 05, 2020 at 05:50:45PM +0100, Dave Martin wrote:
> On Wed, Apr 29, 2020 at 10:16:32PM +0100, Mark Brown wrote:

> > +ifeq ($(CONFIG_ARM64_BTI_KERNEL),y)
> > +branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI) := -mbranch-protection=pac-ret+leaf+bti
> > +else
> > branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf
> > +endif

> Is it worth a comment to explain how this differs from
> -mbranch-protection=standard, and why we're not using that here?

There was some open discussion in a separate thread about the use of
+leaf:

https://lore.kernel.org/linux-arm-kernel/1588149371-20310-1-git-send-email-amit.kachhap@arm.com/

which currently settled on leaving it in but I do agree, it probably
would be useful to document the choices we're making here. CCing Amit
as some of the discussion was off-list so I don't know all the details
there.

As with the recent change to explicitly default to branch-protection=none
there's probably a case for simply being explicit about whatever we're
doing rather than relying on compiler defaults in case there are any bad
interactions with code generated for an extension that isn't fully
supported in the kernel in the future.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]