Skip to content

Commit d0055da

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: remove ptrauth_keys_install_kernel sync arg
The 'sync' argument to ptrauth_keys_install_kernel macro is somewhat opaque at callsites, so instead lets have regular and _nosync variants of the macro to make this a little more obvious. Signed-off-by: Mark Rutland <[email protected]> Cc: Amit Daniel Kachhap <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 6a8b55e commit d0055da

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

arch/arm64/include/asm/asm_pointer_auth.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,24 @@ alternative_if ARM64_HAS_GENERIC_AUTH
3939
alternative_else_nop_endif
4040
.endm
4141

42-
.macro ptrauth_keys_install_kernel tsk, sync, tmp1, tmp2, tmp3
43-
alternative_if ARM64_HAS_ADDRESS_AUTH
42+
.macro __ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
4443
mov \tmp1, #THREAD_KEYS_KERNEL
4544
add \tmp1, \tsk, \tmp1
4645
ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_KERNEL_KEY_APIA]
4746
msr_s SYS_APIAKEYLO_EL1, \tmp2
4847
msr_s SYS_APIAKEYHI_EL1, \tmp3
49-
.if \sync == 1
48+
.endm
49+
50+
.macro ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
51+
alternative_if ARM64_HAS_ADDRESS_AUTH
52+
__ptrauth_keys_install_kernel_nosync \tsk, \tmp1, \tmp2, \tmp3
53+
alternative_else_nop_endif
54+
.endm
55+
56+
.macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3
57+
alternative_if ARM64_HAS_ADDRESS_AUTH
58+
__ptrauth_keys_install_kernel_nosync \tsk, \tmp1, \tmp2, \tmp3
5059
isb
51-
.endif
5260
alternative_else_nop_endif
5361
.endm
5462

@@ -57,7 +65,10 @@ alternative_else_nop_endif
5765
.macro ptrauth_keys_install_user tsk, tmp1, tmp2, tmp3
5866
.endm
5967

60-
.macro ptrauth_keys_install_kernel tsk, sync, tmp1, tmp2, tmp3
68+
.macro ptrauth_keys_install_kernel_nosync tsk, tmp1, tmp2, tmp3
69+
.endm
70+
71+
.macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3
6172
.endm
6273

6374
#endif /* CONFIG_ARM64_PTR_AUTH */

arch/arm64/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ alternative_cb_end
178178

179179
apply_ssbd 1, x22, x23
180180

181-
ptrauth_keys_install_kernel tsk, 1, x20, x22, x23
181+
ptrauth_keys_install_kernel tsk, x20, x22, x23
182182
.else
183183
add x21, sp, #S_FRAME_SIZE
184184
get_current_task tsk
@@ -900,7 +900,7 @@ SYM_FUNC_START(cpu_switch_to)
900900
ldr lr, [x8]
901901
mov sp, x9
902902
msr sp_el0, x1
903-
ptrauth_keys_install_kernel x1, 1, x8, x9, x10
903+
ptrauth_keys_install_kernel x1, x8, x9, x10
904904
ret
905905
SYM_FUNC_END(cpu_switch_to)
906906
NOKPROBE(cpu_switch_to)

arch/arm64/mm/proc.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ alternative_if ARM64_HAS_RAS_EXTN
139139
msr_s SYS_DISR_EL1, xzr
140140
alternative_else_nop_endif
141141

142-
ptrauth_keys_install_kernel x14, 0, x1, x2, x3
142+
ptrauth_keys_install_kernel_nosync x14, x1, x2, x3
143143
isb
144144
ret
145145
SYM_FUNC_END(cpu_do_resume)

0 commit comments

Comments
 (0)