Skip to content

Commit a243c16

Browse files
amitdanielkachhapMarc Zyngier
authored andcommitted
KVM: arm64: Add capability to advertise ptrauth for guest
This patch advertises the capability of two cpu feature called address pointer authentication and generic pointer authentication. These capabilities depend upon system support for pointer authentication and VHE mode. The current arm64 KVM partially implements pointer authentication and support of address/generic authentication are tied together. However, separate ABI requirements for both of them is added so that any future isolated implementation will not require any ABI changes. Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Christoffer Dall <christoffer.dall@arm.com> Cc: kvmarm@lists.cs.columbia.edu Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent a22fa32 commit a243c16

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎Documentation/virtual/kvm/api.txt‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,13 +2763,19 @@ Possible features:
27632763

27642764
- KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication
27652765
for arm64 only.
2766-
Both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC
2767-
must be requested or neither must be requested.
2766+
Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS.
2767+
If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are
2768+
both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and
2769+
KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be
2770+
requested.
27682771

27692772
- KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication
27702773
for arm64 only.
2771-
Both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC
2772-
must be requested or neither must be requested.
2774+
Depends on KVM_CAP_ARM_PTRAUTH_GENERIC.
2775+
If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are
2776+
both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and
2777+
KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be
2778+
requested.
27732779

27742780
- KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only).
27752781
Depends on KVM_CAP_ARM_SVE.

‎arch/arm64/kvm/reset.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext)
101101
case KVM_CAP_ARM_SVE:
102102
r = system_supports_sve();
103103
break;
104+
case KVM_CAP_ARM_PTRAUTH_ADDRESS:
105+
case KVM_CAP_ARM_PTRAUTH_GENERIC:
106+
r = has_vhe() && system_supports_address_auth() &&
107+
system_supports_generic_auth();
108+
break;
104109
default:
105110
r = 0;
106111
}

‎include/uapi/linux/kvm.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,8 @@ struct kvm_ppc_resize_hpt {
989989
#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
990990
#define KVM_CAP_HYPERV_CPUID 167
991991
#define KVM_CAP_ARM_SVE 168
992+
#define KVM_CAP_ARM_PTRAUTH_ADDRESS 169
993+
#define KVM_CAP_ARM_PTRAUTH_GENERIC 170
992994

993995
#ifdef KVM_CAP_IRQ_ROUTING
994996

0 commit comments

Comments
 (0)