[PATCH][BINUTILS][AARCH64] Add support for pointer authentication B key

Sam Tebbs Sam.Tebbs@arm.com
Thu Nov 1 13:23:00 GMT 2018


Hi all,

Armv8.3-A has another key used in pointer authentication called the B-key (other
than the A-key that is already supported). In order for stack unwinders to work
it is necessary to be able to identify frames that have been signed with the
B-key rather than the A-key and it was felt that keeping this as an augmentation
character in the CIE was the best bet. The DWARF extensions for ARM therefore
propose to add a new augmentation character 'B' to the CIE augmentation string
and the corresponding cfi directive ".cfi_b_key_frame". I've made the relevant
changes to GAS and LD to add support for B-key unwinding, which required
modifying LD to check for 'B' in the augmentation string, adding the
".cfi_b_key_frame" directive to GAS and adding a "pauth_key" field to GAS's
fde_entry and cie_entry structs.

The pointer authentication instructions will behave as NOPs on architectures
that don't support them, and so a check for the architecture being assembled
for is not necessary since there will be no behavioural difference between
augmentation strings with and without the 'B' character on such architectures.

Built on aarch64-linux-gnu and aarch64-none-elf, and tested on aarch64-none-elf
with no regressions. This patch has been tested with the corresponding patch
that enables B-key support in GCC.

OK for trunk? I don't have write access so I'd appreciate someone committing
after approval.

bfd/
2018-11-01  Sam Tebbs<sam.tebbs@arm.com>

	* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Add check for 'B'.

gas/
2018-11-01  Sam Tebbs<sam.tebbs@arm.com>

	* dw2gencfi.c (struct cie_entry): Add pauth_key field.
	(alloc_fde_entry): Set pauth_key to AARCH64_PAUTH_KEY_A by default.
	(output_cie): Output 'B' if pauth_key == AARCH64_PAUTH_KEY_B.
	(select_cie_for_fde): Add check for pauth_key. Set cie's pauth_key to
	fde's pauth_key.
	(frch_cfi_data, cfa_save_data): Move to dwgencfi.h.
	* config/tc-aarch64.c (dot_cfi_b_key_frame): Declare.
	(md_pseudo_table): Add "cfi_b_key_frame".
	* dw2gencfi.h (pointer_auth_key): Define.
	(struct fde_entry): Add pauth_key field.
	(frch_cfi_data, cfa_save_data): Move from dwgencfi.c.

gas/doc/
2018-11-01  Sam Tebbs<sam.tebbs@arm.com>

	* c-aarch64.texi (.cfi_b_key_frame): Add documentation.

gas/testsuite
2018-11-01  Sam Tebbs<sam.tebbs@arm.com>

	* gas/aarch64/(pac_ab_key.d, pac_ab_key.s): New file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: latest.patch
Type: text/x-patch
Size: 8646 bytes
Desc: latest.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20181101/eda2d2db/attachment.bin>


More information about the Binutils mailing list