File tree Expand file tree Collapse file tree 4 files changed +7
-15
lines changed Expand file tree Collapse file tree 4 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ alternative_else_nop_endif
104
104
105
105
#define __ptrauth_save_key (ctxt , key ) \
106
106
do { \
107
- u64 __val ; \
107
+ u64 __val ; \
108
108
__val = read_sysreg_s (SYS_ ## key ## KEYLO_EL1); \
109
109
ctxt_sys_reg(ctxt, key ## KEYLO_EL1) = __val; \
110
110
__val = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \
Original file line number Diff line number Diff line change @@ -522,10 +522,10 @@ void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu)
522
522
523
523
static void vcpu_set_pauth_traps (struct kvm_vcpu * vcpu )
524
524
{
525
- if (vcpu_has_ptrauth (vcpu )) {
525
+ if (vcpu_has_ptrauth (vcpu ) && ! is_protected_kvm_enabled () ) {
526
526
/*
527
- * Either we're running running an L2 guest, and the API/APK
528
- * bits come from L1's HCR_EL2, or API/APK are both set.
527
+ * Either we're running an L2 guest, and the API/APK bits come
528
+ * from L1's HCR_EL2, or API/APK are both set.
529
529
*/
530
530
if (unlikely (vcpu_has_nv (vcpu ) && !is_hyp_ctxt (vcpu ))) {
531
531
u64 val ;
@@ -542,16 +542,10 @@ static void vcpu_set_pauth_traps(struct kvm_vcpu *vcpu)
542
542
* Save the host keys if there is any chance for the guest
543
543
* to use pauth, as the entry code will reload the guest
544
544
* keys in that case.
545
- * Protected mode is the exception to that rule, as the
546
- * entry into the EL2 code eagerly switch back and forth
547
- * between host and hyp keys (and kvm_hyp_ctxt is out of
548
- * reach anyway).
549
545
*/
550
- if (is_protected_kvm_enabled ())
551
- return ;
552
-
553
546
if (vcpu -> arch .hcr_el2 & (HCR_API | HCR_APK )) {
554
547
struct kvm_cpu_context * ctxt ;
548
+
555
549
ctxt = this_cpu_ptr_hyp_sym (kvm_hyp_ctxt );
556
550
ptrauth_save_keys (ctxt );
557
551
}
Original file line number Diff line number Diff line change 27
27
#include <asm/kvm_hyp.h>
28
28
#include <asm/kvm_mmu.h>
29
29
#include <asm/kvm_nested.h>
30
- #include <asm/kvm_ptrauth.h>
31
30
#include <asm/fpsimd.h>
32
31
#include <asm/debug-monitors.h>
33
32
#include <asm/processor.h>
Original file line number Diff line number Diff line change @@ -173,9 +173,8 @@ static void __pmu_switch_to_host(struct kvm_vcpu *vcpu)
173
173
static bool kvm_handle_pvm_sys64 (struct kvm_vcpu * vcpu , u64 * exit_code )
174
174
{
175
175
/*
176
- * Make sure we handle the exit for workarounds and ptrauth
177
- * before the pKVM handling, as the latter could decide to
178
- * UNDEF.
176
+ * Make sure we handle the exit for workarounds before the pKVM
177
+ * handling, as the latter could decide to UNDEF.
179
178
*/
180
179
return (kvm_hyp_handle_sysreg (vcpu , exit_code ) ||
181
180
kvm_handle_pvm_sysreg (vcpu , exit_code ));
You can’t perform that action at this time.
0 commit comments