diff mbox series

[v5,14/17] arm64: suspend: restore the kernel ptrauth keys

Message ID 1581931668-11559-15-git-send-email-amit.kachhap@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: return address signing | expand

Commit Message

Amit Daniel Kachhap Feb. 17, 2020, 9:27 a.m. UTC
This patch restores the kernel keys from current task during
cpu resume after the mmu is turned on and ptrauth is enabled.

Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
---
 arch/arm64/kernel/sleep.S | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Catalin Marinas Feb. 28, 2020, 6:18 p.m. UTC | #1
On Mon, Feb 17, 2020 at 02:57:45PM +0530, Amit Daniel Kachhap wrote:
> This patch restores the kernel keys from current task during
> cpu resume after the mmu is turned on and ptrauth is enabled.
> 
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
> ---
>  arch/arm64/kernel/sleep.S | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
> index 7b2f2e6..f9db925 100644
> --- a/arch/arm64/kernel/sleep.S
> +++ b/arch/arm64/kernel/sleep.S
> @@ -2,6 +2,7 @@
>  #include <linux/errno.h>
>  #include <linux/linkage.h>
>  #include <asm/asm-offsets.h>
> +#include <asm/asm_pointer_auth.h>
>  #include <asm/assembler.h>
>  #include <asm/smp.h>
>  
> @@ -134,6 +135,11 @@ ENTRY(_cpu_resume)
>  	 */
>  	bl	cpu_do_resume
>  
> +#ifdef CONFIG_ARM64_PTR_AUTH
> +	get_current_task x1
> +	ptrauth_keys_install_kernel x1, x2, x3, x4
> +#endif

Could we move this to cpu_do_resume? Most of the sysreg initialisation
during resume is done there.
Amit Daniel Kachhap March 2, 2020, 10:13 a.m. UTC | #2
On 2/28/20 11:48 PM, Catalin Marinas wrote:
> On Mon, Feb 17, 2020 at 02:57:45PM +0530, Amit Daniel Kachhap wrote:
>> This patch restores the kernel keys from current task during
>> cpu resume after the mmu is turned on and ptrauth is enabled.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
>> ---
>>   arch/arm64/kernel/sleep.S | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
>> index 7b2f2e6..f9db925 100644
>> --- a/arch/arm64/kernel/sleep.S
>> +++ b/arch/arm64/kernel/sleep.S
>> @@ -2,6 +2,7 @@
>>   #include <linux/errno.h>
>>   #include <linux/linkage.h>
>>   #include <asm/asm-offsets.h>
>> +#include <asm/asm_pointer_auth.h>
>>   #include <asm/assembler.h>
>>   #include <asm/smp.h>
>>   
>> @@ -134,6 +135,11 @@ ENTRY(_cpu_resume)
>>   	 */
>>   	bl	cpu_do_resume
>>   
>> +#ifdef CONFIG_ARM64_PTR_AUTH
>> +	get_current_task x1
>> +	ptrauth_keys_install_kernel x1, x2, x3, x4
>> +#endif
> 
> Could we move this to cpu_do_resume? Most of the sysreg initialisation
> during resume is done there.

Yes it makes sense. I will implement in my v6 series.

>
diff mbox series

Patch

diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index 7b2f2e6..f9db925 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -2,6 +2,7 @@ 
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
+#include <asm/asm_pointer_auth.h>
 #include <asm/assembler.h>
 #include <asm/smp.h>
 
@@ -134,6 +135,11 @@  ENTRY(_cpu_resume)
 	 */
 	bl	cpu_do_resume
 
+#ifdef CONFIG_ARM64_PTR_AUTH
+	get_current_task x1
+	ptrauth_keys_install_kernel x1, x2, x3, x4
+#endif
+
 #ifdef CONFIG_KASAN
 	mov	x0, sp
 	bl	kasan_unpoison_task_stack_below