Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Oct 2023 15:59:53 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Andrew Turner <andrew@FreeBSD.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: d09a64e15d8f - main - arm64: Enable kernel branch protection
Message-ID:  <33A07449-D0C0-4E6B-BF4E-5128B8DB202B@freebsd.org>
In-Reply-To: <202310100953.39A9rFWk036835@gitrepo.freebsd.org>
References:  <202310100953.39A9rFWk036835@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10 Oct 2023, at 10:53, Andrew Turner <andrew@FreeBSD.org> wrote:
>=20
> The branch main has been updated by andrew:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dd09a64e15d8fad6588b9aad62979f20a=
fa8441df
>=20
> commit d09a64e15d8fad6588b9aad62979f20afa8441df
> Author:     Andrew Turner <andrew@FreeBSD.org>
> AuthorDate: 2023-10-02 15:55:31 +0000
> Commit:     Andrew Turner <andrew@FreeBSD.org>
> CommitDate: 2023-10-10 09:52:16 +0000
>=20
>    arm64: Enable kernel branch protection

Can we please put this kind of thing behind an option? Users may want
to be able to turn it off, and we surely will in CheriBSD for
pure-capability kernels.

This applies to any other security features in your pipeline too.

Jess

>    Add the build flags to enable branch protection on arm64. This =
enable
>    the use of PAC and BTI in the kernel.
>=20
>    For PAC we already install the kernel keys when entering the kernel
>    from userspace so this will start using these to sign the stack.
>=20
>    For BTI we need to mark the kernel page tables with a new guarded =
page
>    field. As this will require all code that could be reached through =
a
>    function pointer with an appropriate branch target instruction we
>    are enabling this before setting the field.
>=20
>    As the pointer authentication support shouldn't be reached via a
>    function pointer it is safe to not enable the use of BTI there.
>=20
>    Reviewed by:    markj
>    Sponsored by:   Arm Ltd
>    Differential Revision:  https://reviews.freebsd.org/D42079
> ---
> sys/conf/kern.mk | 2 ++
> 1 file changed, 2 insertions(+)
>=20
> diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
> index b508bc81b5f0..72b7387d3959 100644
> --- a/sys/conf/kern.mk
> +++ b/sys/conf/kern.mk
> @@ -140,6 +140,8 @@ INLINE_LIMIT?=3D 8000
> CFLAGS +=3D -mgeneral-regs-only
> # Reserve x18 for pcpu data
> CFLAGS +=3D -ffixed-x18
> +# Build with BTI+PAC
> +CFLAGS +=3D -mbranch-protection=3Dstandard
> INLINE_LIMIT?=3D 8000
> .endif
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33A07449-D0C0-4E6B-BF4E-5128B8DB202B>