lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240806-kvm-arm64-get-reg-list-v2-2-1d3fbc7b6844@kernel.org>
Date: Tue, 06 Aug 2024 15:24:23 +0100
From: Mark Brown <broonie@...nel.org>
To: Marc Zyngier <maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>, 
 James Morse <james.morse@....com>, 
 Suzuki K Poulose <suzuki.poulose@....com>, 
 Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>, 
 Catalin Marinas <catalin.marinas@....com>, Joey Gouly <joey.gouly@....com>
Cc: linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev, 
 kvm@...r.kernel.org, linux-kselftest@...r.kernel.org, 
 linux-kernel@...r.kernel.org, Mark Brown <broonie@...nel.org>
Subject: [PATCH v2 2/3] KVM: selftests: arm64: Use symbolic definitions for
 incorrect encodings

Unfortunately incorrect encodings for CNTV_CTL_EL0 and CNTV_CVAL_EL0 made
their way into the KVM ABI, the encodings were swapped. The UAPI provides
custom KVM sysreg definitions with the incorrect encodings so let's update
get-reg-list to use them. Also add a comment explaining the situation to
help anyone looking at the test.

This will avoid these registers being picked up by further work to
automatically convert the test to use symbolic definitions rather than
manually repeating the encodings in the test.

Signed-off-by: Mark Brown <broonie@...nel.org>
---
 tools/testing/selftests/kvm/aarch64/get-reg-list.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
index 97ac3f6b5c4b..a270287a4c88 100644
--- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
+++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
@@ -313,8 +313,15 @@ static __u64 base_regs[] = {
 	KVM_REG_ARM_FW_FEAT_BMAP_REG(0),	/* KVM_REG_ARM_STD_BMAP */
 	KVM_REG_ARM_FW_FEAT_BMAP_REG(1),	/* KVM_REG_ARM_STD_HYP_BMAP */
 	KVM_REG_ARM_FW_FEAT_BMAP_REG(2),	/* KVM_REG_ARM_VENDOR_HYP_BMAP */
-	ARM64_SYS_REG(3, 3, 14, 3, 1),	/* CNTV_CTL_EL0 */
-	ARM64_SYS_REG(3, 3, 14, 3, 2),	/* CNTV_CVAL_EL0 */
+
+	/*
+	 * Incorrect encodings for CNTV_CTL_EL0 and CNTV_CVAL_EL0 made
+	 * it into the KVM ABI so we have custom encodings for them
+	 * that do not align with the architecture.
+	 */
+	KVM_REG_ARM_TIMER_CTL,
+	KVM_REG_ARM_TIMER_CVAL,
+
 	ARM64_SYS_REG(3, 3, 14, 0, 2),
 	ARM64_SYS_REG(3, 0, 0, 0, 0),	/* MIDR_EL1 */
 	ARM64_SYS_REG(3, 0, 0, 0, 6),	/* REVIDR_EL1 */

-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ