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
104104
105105#define __ptrauth_save_key (ctxt , key ) \
106106 do { \
107- u64 __val ; \
107+ u64 __val ; \
108108 __val = read_sysreg_s (SYS_ ## key ## KEYLO_EL1); \
109109 ctxt_sys_reg(ctxt, key ## KEYLO_EL1) = __val; \
110110 __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)
522522
523523static void vcpu_set_pauth_traps (struct kvm_vcpu * vcpu )
524524{
525- if (vcpu_has_ptrauth (vcpu )) {
525+ if (vcpu_has_ptrauth (vcpu ) && ! is_protected_kvm_enabled () ) {
526526 /*
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.
529529 */
530530 if (unlikely (vcpu_has_nv (vcpu ) && !is_hyp_ctxt (vcpu ))) {
531531 u64 val ;
@@ -542,16 +542,10 @@ static void vcpu_set_pauth_traps(struct kvm_vcpu *vcpu)
542542 * Save the host keys if there is any chance for the guest
543543 * to use pauth, as the entry code will reload the guest
544544 * 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).
549545 */
550- if (is_protected_kvm_enabled ())
551- return ;
552-
553546 if (vcpu -> arch .hcr_el2 & (HCR_API | HCR_APK )) {
554547 struct kvm_cpu_context * ctxt ;
548+
555549 ctxt = this_cpu_ptr_hyp_sym (kvm_hyp_ctxt );
556550 ptrauth_save_keys (ctxt );
557551 }
Original file line number Diff line number Diff line change 2727#include <asm/kvm_hyp.h>
2828#include <asm/kvm_mmu.h>
2929#include <asm/kvm_nested.h>
30- #include <asm/kvm_ptrauth.h>
3130#include <asm/fpsimd.h>
3231#include <asm/debug-monitors.h>
3332#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)
173173static bool kvm_handle_pvm_sys64 (struct kvm_vcpu * vcpu , u64 * exit_code )
174174{
175175 /*
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.
179178 */
180179 return (kvm_hyp_handle_sysreg (vcpu , exit_code ) ||
181180 kvm_handle_pvm_sysreg (vcpu , exit_code ));
You can’t perform that action at this time.
0 commit comments