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: <535bc49d-1b8c-4dae-8ee1-1b7815473524@redhat.com>
Date: Wed, 29 May 2024 19:07:31 +0200
From: Eric Auger <eauger@...hat.com>
To: Sebastian Ott <sebott@...hat.com>, linux-arm-kernel@...ts.infradead.org,
 kvmarm@...ts.linux.dev, linux-kernel@...r.kernel.org
Cc: Marc Zyngier <maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>,
 James Morse <james.morse@....com>, Suzuki K Poulose
 <suzuki.poulose@....com>, Catalin Marinas <catalin.marinas@....com>,
 Will Deacon <will@...nel.org>
Subject: Re: [PATCH v3 6/6] KVM: selftests: arm64: Test writes to CTR_EL0



On 5/14/24 09:22, Sebastian Ott wrote:
> Test that CTR_EL0 is modifiable from userspace, that changes are
> visible to guests, and that they are preserved across a vCPU reset.
> 
> Signed-off-by: Sebastian Ott <sebott@...hat.com>
Reviewed-by: Eric Auger <eric.auger@...hat.com>

Eric


> ---
>  .../testing/selftests/kvm/aarch64/set_id_regs.c  | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/aarch64/set_id_regs.c b/tools/testing/selftests/kvm/aarch64/set_id_regs.c
> index a7de39fa2a0a..9583c04f1228 100644
> --- a/tools/testing/selftests/kvm/aarch64/set_id_regs.c
> +++ b/tools/testing/selftests/kvm/aarch64/set_id_regs.c
> @@ -219,6 +219,7 @@ static void guest_code(void)
>  	GUEST_REG_SYNC(SYS_ID_AA64MMFR1_EL1);
>  	GUEST_REG_SYNC(SYS_ID_AA64MMFR2_EL1);
>  	GUEST_REG_SYNC(SYS_ID_AA64ZFR0_EL1);
> +	GUEST_REG_SYNC(SYS_CTR_EL0);
>  
>  	GUEST_DONE();
>  }
> @@ -490,11 +491,25 @@ static void test_clidr(struct kvm_vcpu *vcpu)
>  	test_reg_vals[encoding_to_range_idx(SYS_CLIDR_EL1)] = clidr;
>  }
>  
> +static void test_ctr(struct kvm_vcpu *vcpu)
> +{
> +	u64 ctr;
> +
> +	vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CTR_EL0), &ctr);
> +	ctr &= ~CTR_EL0_DIC_MASK;
> +	if (ctr & CTR_EL0_IminLine_MASK)
> +		ctr--;
> +
> +	vcpu_set_reg(vcpu, KVM_ARM64_SYS_REG(SYS_CTR_EL0), ctr);
> +	test_reg_vals[encoding_to_range_idx(SYS_CTR_EL0)] = ctr;
> +}
> +
>  static void test_vcpu_ftr_id_regs(struct kvm_vcpu *vcpu)
>  {
>  	u64 val;
>  
>  	test_clidr(vcpu);
> +	test_ctr(vcpu);
>  
>  	vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_MPIDR_EL1), &val);
>  	val++;
> @@ -525,6 +540,7 @@ static void test_reset_preserves_id_regs(struct kvm_vcpu *vcpu)
>  		test_assert_id_reg_unchanged(vcpu, test_regs[i].reg);
>  
>  	test_assert_id_reg_unchanged(vcpu, SYS_CLIDR_EL1);
> +	test_assert_id_reg_unchanged(vcpu, SYS_CTR_EL0);
>  
>  	ksft_test_result_pass("%s\n", __func__);
>  }


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ