diff mbox series

[AArch64] Fix a couple of bugs in BTI

Message ID 42052add-f07c-c987-ae0c-a39482040a34@arm.com
State New
Headers show
Series [AArch64] Fix a couple of bugs in BTI | expand

Commit Message

Sudakshina Das Feb. 21, 2019, 12:19 p.m. UTC
Hi

While doing more testing I found a couple of issues with my BTI patches. 
This patch fixes them:
1) Remove a reference to return address key. The original patch was 
written based on a different not yet committed patch ([PATCH 
3/3][GCC][AARCH64] Add support for pointer authentication B key) and I 
missed out on cleaning this up. This is hidden behind the configuration 
option and thus went unnoticed.
2) Add a missed case for adding the BTI instruction in thunk functions.

Bootstrapped on aarch64-none-linux-gnu and regression tested on 
aarch64-none-elf with configuration turned on.

gcc/ChangeLog:

2019-xx-xx  Sudakshina Das  <sudi.das@arm.com>

	* config/aarch64/aarch64.c (aarch64_output_mi_thunk): Add bti
	instruction if enabled.
	(aarch64_override_options): Remove reference to return address
	key.


Is this ok for trunk?
Sudi

Comments

James Greenhalgh Feb. 21, 2019, 10:52 p.m. UTC | #1
On Thu, Feb 21, 2019 at 06:19:10AM -0600, Sudakshina Das wrote:
> Hi
> 
> While doing more testing I found a couple of issues with my BTI patches. 
> This patch fixes them:
> 1) Remove a reference to return address key. The original patch was 
> written based on a different not yet committed patch ([PATCH 
> 3/3][GCC][AARCH64] Add support for pointer authentication B key) and I 
> missed out on cleaning this up. This is hidden behind the configuration 
> option and thus went unnoticed.
> 2) Add a missed case for adding the BTI instruction in thunk functions.
> 
> Bootstrapped on aarch64-none-linux-gnu and regression tested on 
> aarch64-none-elf with configuration turned on.

OK.

Thanks,
James

> 
> gcc/ChangeLog:
> 
> 2019-xx-xx  Sudakshina Das  <sudi.das@arm.com>
> 
> 	* config/aarch64/aarch64.c (aarch64_output_mi_thunk): Add bti
> 	instruction if enabled.
> 	(aarch64_override_options): Remove reference to return address
> 	key.
> 
> 
> Is this ok for trunk?
> Sudi
Sudakshina Das Feb. 22, 2019, 11:02 a.m. UTC | #2
On 21/02/2019 22:52, James Greenhalgh wrote:
> On Thu, Feb 21, 2019 at 06:19:10AM -0600, Sudakshina Das wrote:
>> Hi
>>
>> While doing more testing I found a couple of issues with my BTI patches.
>> This patch fixes them:
>> 1) Remove a reference to return address key. The original patch was
>> written based on a different not yet committed patch ([PATCH
>> 3/3][GCC][AARCH64] Add support for pointer authentication B key) and I
>> missed out on cleaning this up. This is hidden behind the configuration
>> option and thus went unnoticed.
>> 2) Add a missed case for adding the BTI instruction in thunk functions.
>>
>> Bootstrapped on aarch64-none-linux-gnu and regression tested on
>> aarch64-none-elf with configuration turned on.
> 
> OK.
> 

Thanks committed as r269112.
Sudi

> Thanks,
> James
> 
>>
>> gcc/ChangeLog:
>>
>> 2019-xx-xx  Sudakshina Das  <sudi.das@arm.com>
>>
>> 	* config/aarch64/aarch64.c (aarch64_output_mi_thunk): Add bti
>> 	instruction if enabled.
>> 	(aarch64_override_options): Remove reference to return address
>> 	key.
>>
>>
>> Is this ok for trunk?
>> Sudi
>
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9f52cc9..7d9824a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5980,6 +5980,9 @@  aarch64_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
   rtx this_rtx, temp0, temp1, addr, funexp;
   rtx_insn *insn;
 
+  if (aarch64_bti_enabled ())
+    emit_insn (gen_bti_c());
+
   reload_completed = 1;
   emit_note (NOTE_INSN_PROLOGUE_END);
 
@@ -12032,7 +12035,6 @@  aarch64_override_options (void)
     {
 #ifdef TARGET_ENABLE_PAC_RET
       aarch64_ra_sign_scope = AARCH64_FUNCTION_NON_LEAF;
-      aarch64_ra_sign_key = AARCH64_KEY_A;
 #else
       aarch64_ra_sign_scope = AARCH64_FUNCTION_NONE;
 #endif