public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sam Tebbs <Sam.Tebbs@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>,
	Marcus Shawcroft	<Marcus.Shawcroft@arm.com>,
	James Greenhalgh <James.Greenhalgh@arm.com>, nd	<nd@arm.com>
Subject: Re: [PATCH 3/3][GCC][AARCH64] Add support for pointer authentication B key
Date: Fri, 04 Jan 2019 16:56:00 -0000	[thread overview]
Message-ID: <13af03b1-df52-1363-6ec1-9a6b4522f22e@arm.com> (raw)
In-Reply-To: <f284bc8a-8bca-feb5-2d90-deced94cef20@arm.com>


On 12/21/18 3:00 PM, Sam Tebbs wrote:
> On 11/9/18 11:04 AM, Sam Tebbs wrote:
>> On 11/02/2018 06:01 PM, Sam Tebbs wrote:
>>
>>> On 11/02/2018 05:35 PM, Sam Tebbs wrote:
>>>
>>>> Hi all,
>>>>
>>>> This patch adds support for the Armv8.3-A pointer authentication instructions
>>>> that use the B-key (pacib*, autib* and retab). This required adding builtins for
>>>> pacib1716 and autib1716, adding the "b-key" feature to the -mbranch-protection
>>>> option, and required emitting a new CFI directive ".cfi_b_key_frame" which
>>>> causes GAS to add 'B' to the CIE augmentation string. I also had to add a new
>>>> hook called ASM_POST_CFI_STARTPROC which is triggered when the .cfi_startproc
>>>> directive is emitted.
>>>>
>>>> The libgcc stack unwinder has been amended to authenticate return addresses
>>>> with the B key when the function has been signed with the B key.
>>>>
>>>> The previous patch in this series is here:
>>>> https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00104.html
>>>>
>>>> Bootstrapped successfully and regression tested on aarch64-none-elf.
>>>>
>>>> OK for trunk?
>>>>
>>>> gcc/
>>>> 2018-11-02  Sam Tebbs  <sam.tebbs@arm.com>
>>>>
>>>> 	* config/aarch64/aarch64-builtins.c (aarch64_builtins): Add
>>>> 	AARCH64_PAUTH_BUILTIN_AUTIB1716 and AARCH64_PAUTH_BUILTIN_PACIB1716.
>>>> 	* config/aarch64/aarch64-builtins.c (aarch64_init_pauth_hint_builtins):
>>>> 	Add autib1716 and pacib1716 initialisation.
>>>> 	* config/aarch64/aarch64-builtins.c (aarch64_expand_builtin): Add checks
>>>> 	for autib1716 and pacib1716.
>>>> 	* config/aarch64/aarch64-protos.h (aarch64_key_type,
>>>> 	aarch64_post_cfi_startproc): Define.
>>>> 	* config/aarch64/aarch64-protos.h (aarch64_ra_sign_key): Define extern.
>>>> 	* config/aarch64/aarch64.c (aarch64_return_address_signing_enabled): Add
>>>> 	check for b-key, remove frame.laid_out assertion.
>>>> 	* config/aarch64/aarch64.c (aarch64_ra_sign_key,
>>>> 	aarch64_post_cfi_startproc, aarch64_handle_pac_ret_b_key): Define.
>>>> 	* config/aarch64/aarch64.h (TARGET_ASM_POST_CFI_STARTPROC): Define.
>>>> 	* config/aarch64/aarch64.c (aarch64_pac_ret_subtypes): Add "b-key".
>>>> 	* config/aarch64/aarch64.md (unspec): Add UNSPEC_AUTIA1716,
>>>> 	UNSPEC_AUTIB1716, UNSPEC_AUTIASP, UNSPEC_AUTIBSP, UNSPEC_PACIA1716,
>>>> 	UNSPEC_PACIB1716, UNSPEC_PACIASP, UNSPEC_PACIBSP.
>>>> 	* config/aarch64/aarch64.md (do_return): Add check for b-key.
>>>> 	* config/aarch64/aarch64.md (<pauth_mnem_prefix>sp): Add check for
>>>> 	signing key and scope selected.
>>>> 	* config/aarch64/aarch64.md (<pauth_mnem_prefix>1716): Add check for
>>>> 	signing key and scope selected.
>>>> 	* config/aarch64/aarch64.opt (msign-return-address=): Deprecate.
>>>> 	* config/aarch64/iterators.md (PAUTH_LR_SP): Add UNSPEC_AUTIASP,
>>>> 	UNSPEC_AUTIBSP, UNSPEC_PACIASP, UNSPEC_PACIBSP.
>>>> 	* config/aarch64/iterators.md (PAUTH_17_16): Add UNSPEC_AUTIA1716,
>>>> 	UNSPEC_AUTIB1716, UNSPEC_PACIA1716, UNSPEC_PACIB1716.
>>>> 	* config/aarch64/iterators.md (pauth_mnem_prefix): Add UNSPEC_AUTIA1716,
>>>> 	UNSPEC_AUTIB1716, UNSPEC_PACIA1716, UNSPEC_PACIB1716, UNSPEC_AUTIASP,
>>>> 	UNSPEC_AUTIBSP, UNSPEC_PACIASP, UNSPEC_PACIBSP.
>>>> 	* config/aarch64/iterators.md (pauth_hint_num_a): Replace
>>>> 	UNSPEC_PACI1716 and UNSPEC_AUTI1716 with UNSPEC_PACIA1716 and
>>>> 	UNSPEC_AUTIA1716 respectively.
>>>> 	* config/aarch64/iterators.md (pauth_hint_num_b): New int attribute.
>>>>
>>>> gcc/testsuite
>>>> 2018-11-02  Sam Tebbs  <sam.tebbs@arm.com>
>>>>
>>>> 	* gcc.target/aarch64/return_address_sign_1.c (dg-final): Replace
>>>> 	"autiasp" and "paciasp" with "hint\t29 // autisp" and
>>>> 	"hint\t25 // pacisp" respectively.
>>>> 	* gcc.target/aarch64/return_address_sign_2.c (dg-final): Replace
>>>> 	"paciasp" with "hint\t25 // pacisp".
>>>> 	* gcc.target/aarch64/return_address_sign_3.c (dg-final): Replace
>>>> 	"paciasp" and "autiasp" with "pacisp" and "autisp" respectively.
>>>> 	* gcc.target/aarch64/return_address_sign_b_1.c: New file.
>>>> 	* gcc.target/aarch64/return_address_sign_b_2.c: New file.
>>>> 	* gcc.target/aarch64/return_address_sign_b_3.c: New file.
>>>> 	* gcc.target/aarch64/return_address_sign_b_exception.c: New file.
>>>> 	* gcc.target/aarch64/return_address_sign_builtin.c: New file
>>>>
>>>> libgcc/
>>>> 2018-11-02  Sam Tebbs  <sam.tebbs@arm.com>
>>>>
>>>> 	* config/aarch64/aarch64-unwind.h (aarch64_cie_signed_with_b_key): New
>>>> 	function.
>>>> 	* config/aarch64/aarch64-unwind.h (aarch64_post_extract_frame_addr,
>>>> 	aarch64_post_frob_eh_handler_addr): Add	check for b-key.
>>>> 	* unwind-dw2-fde.c (get_cie_encoding): Add check for 'B' in augmentation
>>>> 	string.
>>>> 	* unwind-dw2.c (extract_cie_info): Add check for 'B' in augmentation
>>>> 	string.
>>> Attached is an updated patch rebased on an improvement to the
>>> -mbranch-protection option documentation.
>> ping
> Attached is an improved patch with "hint" removed from the test scans,
> pauth_hint_num_a and pauth_hint_num_b merged into pauth_hint_num and the
> "gcc_assert (cfun->machine->frame.laid_out)" removal reverted since was
> an unnecessary change.
>
> OK for trunk?
>
> gcc/
> 2018-12-21  Sam Tebbs<sam.tebbs@arm.com>
>
> 	* config/aarch64/aarch64-builtins.c (aarch64_builtins): Add
> 	AARCH64_PAUTH_BUILTIN_AUTIB1716 and AARCH64_PAUTH_BUILTIN_PACIB1716.
> 	* config/aarch64/aarch64-builtins.c (aarch64_init_pauth_hint_builtins):
> 	Add autib1716 and pacib1716 initialisation.
> 	* config/aarch64/aarch64-builtins.c (aarch64_expand_builtin): Add checks
> 	for autib1716 and pacib1716.
> 	* config/aarch64/aarch64-protos.h (aarch64_key_type,
> 	aarch64_post_cfi_startproc): Define.
> 	* config/aarch64/aarch64-protos.h (aarch64_ra_sign_key): Define extern.
> 	* config/aarch64/aarch64.c (aarch64_return_address_signing_enabled): Add
> 	check for b-key.
> 	* config/aarch64/aarch64.c (aarch64_ra_sign_key,
> 	aarch64_post_cfi_startproc, aarch64_handle_pac_ret_b_key): Define.
> 	* config/aarch64/aarch64.h (TARGET_ASM_POST_CFI_STARTPROC): Define.
> 	* config/aarch64/aarch64.c (aarch64_pac_ret_subtypes): Add "b-key".
> 	* config/aarch64/aarch64.md (unspec): Add UNSPEC_AUTIA1716,
> 	UNSPEC_AUTIB1716, UNSPEC_AUTIASP, UNSPEC_AUTIBSP, UNSPEC_PACIA1716,
> 	UNSPEC_PACIB1716, UNSPEC_PACIASP, UNSPEC_PACIBSP.
> 	* config/aarch64/aarch64.md (do_return): Add check for b-key.
> 	* config/aarch64/aarch64.md (<pauth_mnem_prefix>sp): Replace
> 	pauth_hint_num_a with pauth_hint_num.
> 	* config/aarch64/aarch64.md (<pauth_mnem_prefix>1716): Replace
> 	pauth_hint_num_a with pauth_hint_num.
> 	* config/aarch64/aarch64.opt (msign-return-address=): Deprecate.
> 	* config/aarch64/iterators.md (PAUTH_LR_SP): Add UNSPEC_AUTIASP,
> 	UNSPEC_AUTIBSP, UNSPEC_PACIASP, UNSPEC_PACIBSP.
> 	* config/aarch64/iterators.md (PAUTH_17_16): Add UNSPEC_AUTIA1716,
> 	UNSPEC_AUTIB1716, UNSPEC_PACIA1716, UNSPEC_PACIB1716.
> 	* config/aarch64/iterators.md (pauth_mnem_prefix): Add UNSPEC_AUTIA1716,
> 	UNSPEC_AUTIB1716, UNSPEC_PACIA1716, UNSPEC_PACIB1716, UNSPEC_AUTIASP,
> 	UNSPEC_AUTIBSP, UNSPEC_PACIASP, UNSPEC_PACIBSP.
> 	* config/aarch64/iterators.md (pauth_hint_num_a): Replace
> 	UNSPEC_PACI1716 and UNSPEC_AUTI1716 with UNSPEC_PACIA1716 and
> 	UNSPEC_AUTIA1716 respectively.
> 	* config/aarch64/iterators.md (pauth_hint_num_a): Rename to pauth_hint_num
> 	and add UNSPEC_PACIBSP, UNSPEC_AUTIBSP, UNSPEC_PACIB1716, UNSPEC_AUTIB1716.
>
> gcc/testsuite
> 2018-12-21  Sam Tebbs<sam.tebbs@arm.com>
>
> 	* gcc.target/aarch64/return_address_sign_1.c (dg-final): Replace
> 	"autiasp" and "paciasp" with "hint\t29 // autisp" and
> 	"hint\t25 // pacisp" respectively.
> 	* gcc.target/aarch64/return_address_sign_2.c (dg-final): Replace
> 	"paciasp" with "hint\t25 // pacisp".
> 	* gcc.target/aarch64/return_address_sign_3.c (dg-final): Replace
> 	"paciasp" and "autiasp" with "pacisp" and "autisp" respectively.
> 	* gcc.target/aarch64/return_address_sign_b_1.c: New file.
> 	* gcc.target/aarch64/return_address_sign_b_2.c: New file.
> 	* gcc.target/aarch64/return_address_sign_b_3.c: New file.
> 	* gcc.target/aarch64/return_address_sign_b_exception.c: New file.
> 	* gcc.target/aarch64/return_address_sign_builtin.c: New file
>
> libgcc/
> 2018-12-21  Sam Tebbs<sam.tebbs@arm.com>
>
> 	* config/aarch64/aarch64-unwind.h (aarch64_cie_signed_with_b_key): New
> 	function.
> 	* config/aarch64/aarch64-unwind.h (aarch64_post_extract_frame_addr,
> 	aarch64_post_frob_eh_handler_addr): Add	check for b-key.
> 	* unwind-dw2-fde.c (get_cie_encoding): Add check for 'B' in augmentation
> 	string.
> 	* unwind-dw2.c (extract_cie_info): Add check for 'B' in augmentation
> 	string.
>
ping

  reply	other threads:[~2019-01-04 16:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 17:35 Sam Tebbs
2018-11-02 18:02 ` Sam Tebbs
2018-11-09 11:05   ` Sam Tebbs
2018-12-21 15:04     ` Sam Tebbs
2019-01-04 16:56       ` Sam Tebbs [this message]
2019-01-07 18:28       ` James Greenhalgh
2019-01-08 11:38         ` Sam Tebbs
2019-01-14 10:44           ` Kyrill Tkachov
2019-01-23 10:43             ` Sam Tebbs
2019-01-31 14:56               ` Sam Tebbs
2019-03-01 14:12                 ` Sam Tebbs
2019-05-29  9:29                   ` Sam Tebbs
2019-05-29 11:53                     ` Christophe Lyon
2019-05-29 14:24                       ` Sam Tebbs
2019-05-30 12:29                         ` Sam Tebbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13af03b1-df52-1363-6ec1-9a6b4522f22e@arm.com \
    --to=sam.tebbs@arm.com \
    --cc=James.Greenhalgh@arm.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).