KVM: arm64: selftests: Test pointer authentication support in KVM guest
PATCH v2 1/1 KVM: arm64: selftests: Test pointer authentication support in KVM guest
Verify the KVM guest PAuth support on H/W with FEAT_PAuth. This test will be skipped on H/W without FEAT_PAuth.
Following PAuth instructions are tested:
paciza, pacizb, pacdza, pacdzb, autiza, autizb, autdza, autdzb, pacga, xpaclri, xpaci, xpacd
It also shows the implemented algorithm for both address authentication and generic code authentication.
Signed-off-by Jing Zhang <[email protected]>
--- tools/arch/arm64/include/asm/sysreg.h | 5 + tools/testing/selftests/kvm/Makefile | 5 + .../selftests/kvm/aarch64/pauth_test.c | 511 ++++++++++++++++++ .../selftests/kvm/include/aarch64/processor.h | 2 + 4 files changed, 523 insertions(+) create mode 100644 tools/testing/selftests/kvm/aarch64/pauth_test.c
tools/arch/arm64/include/asm/sysreg.h +5 -0
@@ -179,6 +179,7 @@#define SYS_ID_AA64ISAR0_EL1 sys_reg(3, 0, 0, 6, 0)#define SYS_ID_AA64ISAR1_EL1 sys_reg(3, 0, 0, 6, 1) +#define SYS_ID_AA64ISAR2_EL1 sys_reg(3, 0, 0, 6, 2)#define SYS_ID_AA64MMFR0_EL1 sys_reg(3, 0, 0, 7, 0)#define SYS_ID_AA64MMFR1_EL1 sys_reg(3, 0, 0, 7, 1)
@@ -764,6 +765,10 @@#define ID_AA64ISAR1_GPI_NI 0x0#define ID_AA64ISAR1_GPI_IMP_DEF 0x1 +/* id_aa64isar2 */ +#define ID_AA64ISAR2_APA3_SHIFT 12 +#define ID_AA64ISAR2_GPA3_SHIFT 8 +/* id_aa64pfr0 */ #define ID_AA64PFR0_CSV3_SHIFT 60#define ID_AA64PFR0_CSV2_SHIFT 56
tools/testing/selftests/kvm/Makefile +5 -0
@@ -143,6 +143,7 @@ TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list TEST_GEN_PROGS_aarch64 += aarch64/hypercalls TEST_GEN_PROGS_aarch64 += aarch64/page_fault_test +TEST_GEN_PROGS_aarch64 += aarch64/pauth_test TEST_GEN_PROGS_aarch64 += aarch64/psci_test TEST_GEN_PROGS_aarch64 += aarch64/smccc_filter TEST_GEN_PROGS_aarch64 += aarch64/vcpu_width_config
@@ -212,6 +213,10 @@ ifeq ($(ARCH),s390) CFLAGS += -march=z10 endif +ifeq ($(ARCH),arm64) + CFLAGS += -march=armv8.3-a +endif + no-pie-option := $(call try-run, echo 'int main(void) { return 0; }' | \ $(CC) -Werror $(CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
tools/testing/selftests/kvm/aarch64/pauth_test.c new file +511 -0
511 lines not on this page · raw message
tools/testing/selftests/kvm/include/aarch64/processor.h +2 -0
@@ -104,7 +104,9 @@ enum {#define ESR_EC_SHIFT 26#define ESR_EC_MASK (ESR_EC_NUM - 1) +#define ESR_EC_UNKNOWN 0x00#define ESR_EC_SVC64 0x15 +#define ESR_EC_FPAC 0x1c#define ESR_EC_IABT 0x21#define ESR_EC_DABT 0x25#define ESR_EC_HW_BP_CURRENT 0x31
base-commit: 52a93d39b17dc7eb98b6aa3edb93943248e03b2f
Signature · 1 line
2.41.0.640.ga95def55d0-goog