@@ -364,11 +364,14 @@ static inline bool esr_is_ptrauth_trap(u32 esr)
364
364
return false;
365
365
}
366
366
367
- #define __ptrauth_save_key (regs , key ) \
368
- ({ \
369
- regs[key ## KEYLO_EL1] = read_sysreg_s(SYS_ ## key ## KEYLO_EL1); \
370
- regs[key ## KEYHI_EL1] = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \
371
- })
367
+ #define __ptrauth_save_key (ctxt , key ) \
368
+ do { \
369
+ u64 __val; \
370
+ __val = read_sysreg_s(SYS_ ## key ## KEYLO_EL1); \
371
+ ctxt_sys_reg(ctxt, key ## KEYLO_EL1) = __val; \
372
+ __val = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \
373
+ ctxt_sys_reg(ctxt, key ## KEYHI_EL1) = __val; \
374
+ } while(0)
372
375
373
376
static inline bool __hyp_handle_ptrauth (struct kvm_vcpu * vcpu )
374
377
{
@@ -380,11 +383,11 @@ static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu)
380
383
return false;
381
384
382
385
ctxt = & __hyp_this_cpu_ptr (kvm_host_data )-> host_ctxt ;
383
- __ptrauth_save_key (ctxt -> sys_regs , APIA );
384
- __ptrauth_save_key (ctxt -> sys_regs , APIB );
385
- __ptrauth_save_key (ctxt -> sys_regs , APDA );
386
- __ptrauth_save_key (ctxt -> sys_regs , APDB );
387
- __ptrauth_save_key (ctxt -> sys_regs , APGA );
386
+ __ptrauth_save_key (ctxt , APIA );
387
+ __ptrauth_save_key (ctxt , APIB );
388
+ __ptrauth_save_key (ctxt , APDA );
389
+ __ptrauth_save_key (ctxt , APDB );
390
+ __ptrauth_save_key (ctxt , APGA );
388
391
389
392
vcpu_ptrauth_enable (vcpu );
390
393
0 commit comments